@@ -10,6 +10,9 @@ discard block |
||
10 | 10 | class update_db { |
11 | 11 | public static $db_sqlite; |
12 | 12 | |
13 | + /** |
|
14 | + * @param string $file |
|
15 | + */ |
|
13 | 16 | public static function download($url, $file, $referer = '') { |
14 | 17 | global $globalProxy, $globalForceIPv4; |
15 | 18 | $fp = fopen($file, 'w'); |
@@ -34,6 +37,9 @@ discard block |
||
34 | 37 | fclose($fp); |
35 | 38 | } |
36 | 39 | |
40 | + /** |
|
41 | + * @param string $in_file |
|
42 | + */ |
|
37 | 43 | public static function gunzip($in_file,$out_file_name = '') { |
38 | 44 | //echo $in_file.' -> '.$out_file_name."\n"; |
39 | 45 | $buffer_size = 4096; // read 4kb at a time |
@@ -55,6 +61,9 @@ discard block |
||
55 | 61 | } |
56 | 62 | } |
57 | 63 | |
64 | + /** |
|
65 | + * @param string $in_file |
|
66 | + */ |
|
58 | 67 | public static function unzip($in_file) { |
59 | 68 | if ($in_file != '' && file_exists($in_file)) { |
60 | 69 | $path = pathinfo(realpath($in_file), PATHINFO_DIRNAME); |
@@ -76,6 +85,9 @@ discard block |
||
76 | 85 | } |
77 | 86 | } |
78 | 87 | |
88 | + /** |
|
89 | + * @param string $database_file |
|
90 | + */ |
|
79 | 91 | public static function retrieve_route_sqlite_to_dest($database_file) { |
80 | 92 | global $globalDebug, $globalTransaction; |
81 | 93 | //$query = 'TRUNCATE TABLE routes'; |
@@ -118,6 +130,10 @@ discard block |
||
118 | 130 | } |
119 | 131 | return ''; |
120 | 132 | } |
133 | + |
|
134 | + /** |
|
135 | + * @param string $database_file |
|
136 | + */ |
|
121 | 137 | public static function retrieve_route_oneworld($database_file) { |
122 | 138 | global $globalDebug, $globalTransaction; |
123 | 139 | //$query = 'TRUNCATE TABLE routes'; |
@@ -159,6 +175,9 @@ discard block |
||
159 | 175 | return ''; |
160 | 176 | } |
161 | 177 | |
178 | + /** |
|
179 | + * @param string $database_file |
|
180 | + */ |
|
162 | 181 | public static function retrieve_route_skyteam($database_file) { |
163 | 182 | global $globalDebug, $globalTransaction; |
164 | 183 | //$query = 'TRUNCATE TABLE routes'; |
@@ -201,6 +220,10 @@ discard block |
||
201 | 220 | } |
202 | 221 | return ''; |
203 | 222 | } |
223 | + |
|
224 | + /** |
|
225 | + * @param string $database_file |
|
226 | + */ |
|
204 | 227 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
205 | 228 | global $globalTransaction; |
206 | 229 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -267,6 +290,9 @@ discard block |
||
267 | 290 | return ''; |
268 | 291 | } |
269 | 292 | |
293 | + /** |
|
294 | + * @param string $database_file |
|
295 | + */ |
|
270 | 296 | public static function retrieve_modes_flarmnet($database_file) { |
271 | 297 | global $globalTransaction; |
272 | 298 | $Common = new Common(); |
@@ -337,6 +363,9 @@ discard block |
||
337 | 363 | return ''; |
338 | 364 | } |
339 | 365 | |
366 | + /** |
|
367 | + * @param string $database_file |
|
368 | + */ |
|
340 | 369 | public static function retrieve_modes_ogn($database_file) { |
341 | 370 | global $globalTransaction; |
342 | 371 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -406,6 +435,9 @@ discard block |
||
406 | 435 | return ''; |
407 | 436 | } |
408 | 437 | |
438 | + /** |
|
439 | + * @param string $database_file |
|
440 | + */ |
|
409 | 441 | public static function retrieve_owner($database_file,$country = 'F') { |
410 | 442 | global $globalTransaction, $globalMasterSource; |
411 | 443 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -1438,6 +1470,10 @@ discard block |
||
1438 | 1470 | return ''; |
1439 | 1471 | } |
1440 | 1472 | |
1473 | + /** |
|
1474 | + * @param string $filename |
|
1475 | + * @param string $tletype |
|
1476 | + */ |
|
1441 | 1477 | public static function tle($filename,$tletype) { |
1442 | 1478 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1443 | 1479 | global $tmp_dir, $globalTransaction; |
@@ -1487,6 +1523,9 @@ discard block |
||
1487 | 1523 | return ''; |
1488 | 1524 | } |
1489 | 1525 | |
1526 | + /** |
|
1527 | + * @param string $filename |
|
1528 | + */ |
|
1490 | 1529 | public static function satellite_ucsdb($filename) { |
1491 | 1530 | global $tmp_dir, $globalTransaction; |
1492 | 1531 | |
@@ -1535,6 +1574,9 @@ discard block |
||
1535 | 1574 | return ''; |
1536 | 1575 | } |
1537 | 1576 | |
1577 | + /** |
|
1578 | + * @param string $filename |
|
1579 | + */ |
|
1538 | 1580 | public static function satellite_celestrak($filename) { |
1539 | 1581 | global $tmp_dir, $globalTransaction, $globalDebug; |
1540 | 1582 | $satcat_sources = array( |
@@ -1861,6 +1903,9 @@ discard block |
||
1861 | 1903 | |
1862 | 1904 | } |
1863 | 1905 | */ |
1906 | + /** |
|
1907 | + * @param string $filename |
|
1908 | + */ |
|
1864 | 1909 | public static function waypoints($filename) { |
1865 | 1910 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1866 | 1911 | global $tmp_dir, $globalTransaction; |
@@ -1938,6 +1983,9 @@ discard block |
||
1938 | 1983 | } |
1939 | 1984 | } |
1940 | 1985 | |
1986 | + /** |
|
1987 | + * @param string $filename |
|
1988 | + */ |
|
1941 | 1989 | public static function ivao_airlines($filename) { |
1942 | 1990 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1943 | 1991 | global $tmp_dir, $globalTransaction; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $ch = curl_init(); |
17 | 17 | curl_setopt($ch, CURLOPT_URL, $url); |
18 | 18 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
19 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
19 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
20 | 20 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
21 | 21 | } |
22 | 22 | } |
@@ -34,20 +34,20 @@ discard block |
||
34 | 34 | fclose($fp); |
35 | 35 | } |
36 | 36 | |
37 | - public static function gunzip($in_file,$out_file_name = '') { |
|
37 | + public static function gunzip($in_file, $out_file_name = '') { |
|
38 | 38 | //echo $in_file.' -> '.$out_file_name."\n"; |
39 | 39 | $buffer_size = 4096; // read 4kb at a time |
40 | 40 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
41 | 41 | if ($in_file != '' && file_exists($in_file)) { |
42 | 42 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
43 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
44 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
43 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
44 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
45 | 45 | else { |
46 | 46 | echo 'gzopen not available'; |
47 | 47 | die; |
48 | 48 | } |
49 | 49 | $out_file = fopen($out_file_name, 'wb'); |
50 | - while(!gzeof($file)) { |
|
50 | + while (!gzeof($file)) { |
|
51 | 51 | fwrite($out_file, gzread($file, $buffer_size)); |
52 | 52 | } |
53 | 53 | fclose($out_file); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | try { |
72 | 72 | self::$db_sqlite = new PDO('sqlite:'.$database); |
73 | 73 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
74 | - } catch(PDOException $e) { |
|
74 | + } catch (PDOException $e) { |
|
75 | 75 | return "error : ".$e->getMessage(); |
76 | 76 | } |
77 | 77 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | //$Connection = new Connection(); |
87 | 87 | $sth = $Connection->db->prepare($query); |
88 | 88 | $sth->execute(array(':source' => $database_file)); |
89 | - } catch(PDOException $e) { |
|
89 | + } catch (PDOException $e) { |
|
90 | 90 | return "error : ".$e->getMessage(); |
91 | 91 | } |
92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | try { |
98 | 98 | $sth = update_db::$db_sqlite->prepare($query); |
99 | 99 | $sth->execute(); |
100 | - } catch(PDOException $e) { |
|
100 | + } catch (PDOException $e) { |
|
101 | 101 | return "error : ".$e->getMessage(); |
102 | 102 | } |
103 | 103 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | if ($globalTransaction) $Connection->db->beginTransaction(); |
109 | 109 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
110 | 110 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
111 | - $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
111 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
112 | 112 | $sth_dest->execute($query_dest_values); |
113 | 113 | } |
114 | 114 | if ($globalTransaction) $Connection->db->commit(); |
115 | - } catch(PDOException $e) { |
|
115 | + } catch (PDOException $e) { |
|
116 | 116 | if ($globalTransaction) $Connection->db->rollBack(); |
117 | 117 | return "error : ".$e->getMessage(); |
118 | 118 | } |
@@ -128,26 +128,26 @@ discard block |
||
128 | 128 | //$Connection = new Connection(); |
129 | 129 | $sth = $Connection->db->prepare($query); |
130 | 130 | $sth->execute(array(':source' => 'oneworld')); |
131 | - } catch(PDOException $e) { |
|
131 | + } catch (PDOException $e) { |
|
132 | 132 | return "error : ".$e->getMessage(); |
133 | 133 | } |
134 | 134 | |
135 | 135 | if ($globalDebug) echo " - Add routes to DB -"; |
136 | 136 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
137 | 137 | $Spotter = new Spotter(); |
138 | - if ($fh = fopen($database_file,"r")) { |
|
138 | + if ($fh = fopen($database_file, "r")) { |
|
139 | 139 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
140 | 140 | $Connection = new Connection(); |
141 | 141 | $sth_dest = $Connection->db->prepare($query_dest); |
142 | 142 | if ($globalTransaction) $Connection->db->beginTransaction(); |
143 | 143 | while (!feof($fh)) { |
144 | - $line = fgetcsv($fh,9999,','); |
|
144 | + $line = fgetcsv($fh, 9999, ','); |
|
145 | 145 | if ($line[0] != '') { |
146 | 146 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
147 | 147 | try { |
148 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
148 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
149 | 149 | $sth_dest->execute($query_dest_values); |
150 | - } catch(PDOException $e) { |
|
150 | + } catch (PDOException $e) { |
|
151 | 151 | if ($globalTransaction) $Connection->db->rollBack(); |
152 | 152 | return "error : ".$e->getMessage(); |
153 | 153 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | //$Connection = new Connection(); |
170 | 170 | $sth = $Connection->db->prepare($query); |
171 | 171 | $sth->execute(array(':source' => 'skyteam')); |
172 | - } catch(PDOException $e) { |
|
172 | + } catch (PDOException $e) { |
|
173 | 173 | return "error : ".$e->getMessage(); |
174 | 174 | } |
175 | 175 | |
@@ -177,24 +177,24 @@ discard block |
||
177 | 177 | |
178 | 178 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
179 | 179 | $Spotter = new Spotter(); |
180 | - if ($fh = fopen($database_file,"r")) { |
|
180 | + if ($fh = fopen($database_file, "r")) { |
|
181 | 181 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
182 | 182 | $Connection = new Connection(); |
183 | 183 | $sth_dest = $Connection->db->prepare($query_dest); |
184 | 184 | try { |
185 | 185 | if ($globalTransaction) $Connection->db->beginTransaction(); |
186 | 186 | while (!feof($fh)) { |
187 | - $line = fgetcsv($fh,9999,','); |
|
187 | + $line = fgetcsv($fh, 9999, ','); |
|
188 | 188 | if ($line[0] != '') { |
189 | - $datebe = explode(' - ',$line[2]); |
|
189 | + $datebe = explode(' - ', $line[2]); |
|
190 | 190 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
191 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
191 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
192 | 192 | $sth_dest->execute($query_dest_values); |
193 | 193 | } |
194 | 194 | } |
195 | 195 | } |
196 | 196 | if ($globalTransaction) $Connection->db->commit(); |
197 | - } catch(PDOException $e) { |
|
197 | + } catch (PDOException $e) { |
|
198 | 198 | if ($globalTransaction) $Connection->db->rollBack(); |
199 | 199 | return "error : ".$e->getMessage(); |
200 | 200 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $Connection = new Connection(); |
210 | 210 | $sth = $Connection->db->prepare($query); |
211 | 211 | $sth->execute(array(':source' => $database_file)); |
212 | - } catch(PDOException $e) { |
|
212 | + } catch (PDOException $e) { |
|
213 | 213 | return "error : ".$e->getMessage(); |
214 | 214 | } |
215 | 215 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $Connection = new Connection(); |
218 | 218 | $sth = $Connection->db->prepare($query); |
219 | 219 | $sth->execute(array(':source' => $database_file)); |
220 | - } catch(PDOException $e) { |
|
220 | + } catch (PDOException $e) { |
|
221 | 221 | return "error : ".$e->getMessage(); |
222 | 222 | } |
223 | 223 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | try { |
227 | 227 | $sth = update_db::$db_sqlite->prepare($query); |
228 | 228 | $sth->execute(); |
229 | - } catch(PDOException $e) { |
|
229 | + } catch (PDOException $e) { |
|
230 | 230 | return "error : ".$e->getMessage(); |
231 | 231 | } |
232 | 232 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -243,15 +243,15 @@ discard block |
||
243 | 243 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
244 | 244 | if ($values['UserString4'] == 'M') $type = 'military'; |
245 | 245 | else $type = null; |
246 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
246 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
247 | 247 | $sth_dest->execute($query_dest_values); |
248 | 248 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
249 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
249 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
250 | 250 | $sth_dest_owner->execute($query_dest_owner_values); |
251 | 251 | } |
252 | 252 | } |
253 | 253 | if ($globalTransaction) $Connection->db->commit(); |
254 | - } catch(PDOException $e) { |
|
254 | + } catch (PDOException $e) { |
|
255 | 255 | return "error : ".$e->getMessage(); |
256 | 256 | } |
257 | 257 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $Connection = new Connection(); |
262 | 262 | $sth = $Connection->db->prepare($query); |
263 | 263 | $sth->execute(array(':source' => $database_file)); |
264 | - } catch(PDOException $e) { |
|
264 | + } catch (PDOException $e) { |
|
265 | 265 | return "error : ".$e->getMessage(); |
266 | 266 | } |
267 | 267 | return ''; |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | $Connection = new Connection(); |
277 | 277 | $sth = $Connection->db->prepare($query); |
278 | 278 | $sth->execute(array(':source' => $database_file)); |
279 | - } catch(PDOException $e) { |
|
279 | + } catch (PDOException $e) { |
|
280 | 280 | return "error : ".$e->getMessage(); |
281 | 281 | } |
282 | 282 | |
283 | - if ($fh = fopen($database_file,"r")) { |
|
283 | + if ($fh = fopen($database_file, "r")) { |
|
284 | 284 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
285 | 285 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
286 | 286 | |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | if ($globalTransaction) $Connection->db->beginTransaction(); |
291 | 291 | while (!feof($fh)) { |
292 | 292 | $values = array(); |
293 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
293 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
294 | 294 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
295 | - $values['ModeS'] = substr($line,0,6); |
|
296 | - $values['Registration'] = trim(substr($line,69,6)); |
|
297 | - $aircraft_name = trim(substr($line,48,6)); |
|
295 | + $values['ModeS'] = substr($line, 0, 6); |
|
296 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
297 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
298 | 298 | // Check if we can find ICAO, else set it to GLID |
299 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
299 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
300 | 300 | $search_more = ''; |
301 | 301 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
302 | 302 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -308,20 +308,20 @@ discard block |
||
308 | 308 | if (isset($result['icao']) && $result['icao'] != '') { |
309 | 309 | $values['ICAOTypeCode'] = $result['icao']; |
310 | 310 | } |
311 | - } catch(PDOException $e) { |
|
311 | + } catch (PDOException $e) { |
|
312 | 312 | return "error : ".$e->getMessage(); |
313 | 313 | } |
314 | 314 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
315 | 315 | // Add data to db |
316 | 316 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
317 | 317 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
318 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
318 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
319 | 319 | //print_r($query_dest_values); |
320 | 320 | $sth_dest->execute($query_dest_values); |
321 | 321 | } |
322 | 322 | } |
323 | 323 | if ($globalTransaction) $Connection->db->commit(); |
324 | - } catch(PDOException $e) { |
|
324 | + } catch (PDOException $e) { |
|
325 | 325 | return "error : ".$e->getMessage(); |
326 | 326 | } |
327 | 327 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $Connection = new Connection(); |
332 | 332 | $sth = $Connection->db->prepare($query); |
333 | 333 | $sth->execute(array(':source' => $database_file)); |
334 | - } catch(PDOException $e) { |
|
334 | + } catch (PDOException $e) { |
|
335 | 335 | return "error : ".$e->getMessage(); |
336 | 336 | } |
337 | 337 | return ''; |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | $Connection = new Connection(); |
346 | 346 | $sth = $Connection->db->prepare($query); |
347 | 347 | $sth->execute(array(':source' => $database_file)); |
348 | - } catch(PDOException $e) { |
|
348 | + } catch (PDOException $e) { |
|
349 | 349 | return "error : ".$e->getMessage(); |
350 | 350 | } |
351 | 351 | |
352 | - if ($fh = fopen($database_file,"r")) { |
|
352 | + if ($fh = fopen($database_file, "r")) { |
|
353 | 353 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
354 | 354 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
355 | 355 | |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | $sth_dest = $Connection->db->prepare($query_dest); |
358 | 358 | try { |
359 | 359 | if ($globalTransaction) $Connection->db->beginTransaction(); |
360 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
360 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
361 | 361 | while (!feof($fh)) { |
362 | - $line = fgetcsv($fh,9999,',',"'"); |
|
362 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
363 | 363 | |
364 | 364 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
365 | 365 | //print_r($line); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | $values['ICAOTypeCode'] = ''; |
369 | 369 | $aircraft_name = $line[2]; |
370 | 370 | // Check if we can find ICAO, else set it to GLID |
371 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
371 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
372 | 372 | $search_more = ''; |
373 | 373 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
374 | 374 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -377,20 +377,20 @@ discard block |
||
377 | 377 | $sth_search->execute(); |
378 | 378 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
379 | 379 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
380 | - } catch(PDOException $e) { |
|
380 | + } catch (PDOException $e) { |
|
381 | 381 | return "error : ".$e->getMessage(); |
382 | 382 | } |
383 | 383 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
384 | 384 | // Add data to db |
385 | 385 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
386 | 386 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
387 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
387 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
388 | 388 | //print_r($query_dest_values); |
389 | 389 | $sth_dest->execute($query_dest_values); |
390 | 390 | } |
391 | 391 | } |
392 | 392 | if ($globalTransaction) $Connection->db->commit(); |
393 | - } catch(PDOException $e) { |
|
393 | + } catch (PDOException $e) { |
|
394 | 394 | return "error : ".$e->getMessage(); |
395 | 395 | } |
396 | 396 | } |
@@ -400,13 +400,13 @@ discard block |
||
400 | 400 | $Connection = new Connection(); |
401 | 401 | $sth = $Connection->db->prepare($query); |
402 | 402 | $sth->execute(array(':source' => $database_file)); |
403 | - } catch(PDOException $e) { |
|
403 | + } catch (PDOException $e) { |
|
404 | 404 | return "error : ".$e->getMessage(); |
405 | 405 | } |
406 | 406 | return ''; |
407 | 407 | } |
408 | 408 | |
409 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
409 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
410 | 410 | global $globalTransaction, $globalMasterSource; |
411 | 411 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
412 | 412 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -414,12 +414,12 @@ discard block |
||
414 | 414 | $Connection = new Connection(); |
415 | 415 | $sth = $Connection->db->prepare($query); |
416 | 416 | $sth->execute(array(':source' => $database_file)); |
417 | - } catch(PDOException $e) { |
|
417 | + } catch (PDOException $e) { |
|
418 | 418 | return "error : ".$e->getMessage(); |
419 | 419 | } |
420 | 420 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
421 | 421 | $Spotter = new Spotter(); |
422 | - if ($fh = fopen($database_file,"r")) { |
|
422 | + if ($fh = fopen($database_file, "r")) { |
|
423 | 423 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
424 | 424 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
425 | 425 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -429,9 +429,9 @@ discard block |
||
429 | 429 | $sth_modes = $Connection->db->prepare($query_modes); |
430 | 430 | try { |
431 | 431 | if ($globalTransaction) $Connection->db->beginTransaction(); |
432 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
432 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
433 | 433 | while (!feof($fh)) { |
434 | - $line = fgetcsv($fh,9999,',','"'); |
|
434 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
435 | 435 | $values = array(); |
436 | 436 | //print_r($line); |
437 | 437 | if ($country == 'F') { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $values['base'] = $line[4]; |
440 | 440 | $values['owner'] = $line[5]; |
441 | 441 | if ($line[6] == '') $values['date_first_reg'] = null; |
442 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
442 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
443 | 443 | $values['cancel'] = $line[7]; |
444 | 444 | } elseif ($country == 'EI') { |
445 | 445 | // TODO : add modeS & reg to aircraft_modes |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | $values['base'] = $line[3]; |
448 | 448 | $values['owner'] = $line[2]; |
449 | 449 | if ($line[1] == '') $values['date_first_reg'] = null; |
450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
450 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
451 | 451 | $values['cancel'] = ''; |
452 | 452 | $values['modes'] = $line[7]; |
453 | 453 | $values['icao'] = $line[8]; |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | $values['base'] = null; |
468 | 468 | $values['owner'] = $line[5]; |
469 | 469 | if ($line[18] == '') $values['date_first_reg'] = null; |
470 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
470 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
471 | 471 | $values['cancel'] = ''; |
472 | 472 | } elseif ($country == 'VH') { |
473 | 473 | // TODO : add modeS & reg to aircraft_modes |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $values['base'] = null; |
476 | 476 | $values['owner'] = $line[12]; |
477 | 477 | if ($line[28] == '') $values['date_first_reg'] = null; |
478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
478 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
479 | 479 | |
480 | 480 | $values['cancel'] = $line[39]; |
481 | 481 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -495,28 +495,28 @@ discard block |
||
495 | 495 | $values['base'] = null; |
496 | 496 | $values['owner'] = $line[8]; |
497 | 497 | if ($line[7] == '') $values['date_first_reg'] = null; |
498 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
498 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
499 | 499 | $values['cancel'] = ''; |
500 | 500 | } elseif ($country == 'PP') { |
501 | 501 | $values['registration'] = $line[0]; |
502 | 502 | $values['base'] = null; |
503 | 503 | $values['owner'] = $line[4]; |
504 | 504 | if ($line[6] == '') $values['date_first_reg'] = null; |
505 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
505 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
506 | 506 | $values['cancel'] = $line[7]; |
507 | 507 | } elseif ($country == 'E7') { |
508 | 508 | $values['registration'] = $line[0]; |
509 | 509 | $values['base'] = null; |
510 | 510 | $values['owner'] = $line[4]; |
511 | 511 | if ($line[5] == '') $values['date_first_reg'] = null; |
512 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
512 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
513 | 513 | $values['cancel'] = ''; |
514 | 514 | } elseif ($country == '8Q') { |
515 | 515 | $values['registration'] = $line[0]; |
516 | 516 | $values['base'] = null; |
517 | 517 | $values['owner'] = $line[3]; |
518 | 518 | if ($line[7] == '') $values['date_first_reg'] = null; |
519 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
519 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
520 | 520 | $values['cancel'] = ''; |
521 | 521 | } elseif ($country == 'ZK') { |
522 | 522 | $values['registration'] = $line[0]; |
@@ -530,18 +530,18 @@ discard block |
||
530 | 530 | $values['registration'] = $line[0]; |
531 | 531 | $values['base'] = null; |
532 | 532 | $values['owner'] = $line[6]; |
533 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
534 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
533 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
534 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
535 | 535 | $values['modes'] = $line[4]; |
536 | 536 | $values['icao'] = $line[10]; |
537 | 537 | } elseif ($country == 'OY') { |
538 | 538 | $values['registration'] = $line[0]; |
539 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
539 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
540 | 540 | $values['modes'] = $line[5]; |
541 | 541 | $values['icao'] = $line[6]; |
542 | 542 | } elseif ($country == 'PH') { |
543 | 543 | $values['registration'] = $line[0]; |
544 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
544 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
545 | 545 | $values['modes'] = $line[4]; |
546 | 546 | $values['icao'] = $line[5]; |
547 | 547 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -552,17 +552,17 @@ discard block |
||
552 | 552 | $values['cancel'] = ''; |
553 | 553 | } |
554 | 554 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
555 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
555 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
556 | 556 | $sth_dest->execute($query_dest_values); |
557 | 557 | } |
558 | 558 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
559 | 559 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
560 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
560 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
561 | 561 | $sth_modes->execute($query_modes_values); |
562 | 562 | } |
563 | 563 | } |
564 | 564 | if ($globalTransaction) $Connection->db->commit(); |
565 | - } catch(PDOException $e) { |
|
565 | + } catch (PDOException $e) { |
|
566 | 566 | return "error : ".$e->getMessage(); |
567 | 567 | } |
568 | 568 | } |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | if ($globalTransaction) $Connection->db->beginTransaction(); |
701 | 701 | |
702 | 702 | $i = 0; |
703 | - while($row = sparql_fetch_array($result)) |
|
703 | + while ($row = sparql_fetch_array($result)) |
|
704 | 704 | { |
705 | 705 | if ($i >= 1) { |
706 | 706 | //print_r($row); |
@@ -720,33 +720,33 @@ discard block |
||
720 | 720 | $row['image'] = ''; |
721 | 721 | $row['image_thumb'] = ''; |
722 | 722 | } else { |
723 | - $image = str_replace(' ','_',$row['image']); |
|
723 | + $image = str_replace(' ', '_', $row['image']); |
|
724 | 724 | $digest = md5($image); |
725 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
726 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
727 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
728 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
725 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
726 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
727 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
728 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
729 | 729 | } |
730 | 730 | |
731 | - $country = explode('-',$row['country']); |
|
731 | + $country = explode('-', $row['country']); |
|
732 | 732 | $row['country'] = $country[0]; |
733 | 733 | |
734 | 734 | $row['type'] = trim($row['type']); |
735 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
735 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
736 | 736 | $row['type'] = 'military'; |
737 | 737 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
738 | 738 | $row['type'] = 'small_airport'; |
739 | 739 | } |
740 | 740 | |
741 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
742 | - $query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($row['altitude']),':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
741 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
742 | + $query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($row['altitude']), ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
743 | 743 | //print_r($query_dest_values); |
744 | 744 | |
745 | 745 | if ($row['icao'] != '') { |
746 | 746 | try { |
747 | 747 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
748 | 748 | $sth->execute(array(':icao' => $row['icao'])); |
749 | - } catch(PDOException $e) { |
|
749 | + } catch (PDOException $e) { |
|
750 | 750 | return "error : ".$e->getMessage(); |
751 | 751 | } |
752 | 752 | if ($sth->fetchColumn() > 0) { |
@@ -754,15 +754,15 @@ discard block |
||
754 | 754 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
755 | 755 | try { |
756 | 756 | $sth = $Connection->db->prepare($query); |
757 | - $sth->execute(array(':icao' => $row['icao'],':type' => $row['type'])); |
|
758 | - } catch(PDOException $e) { |
|
757 | + $sth->execute(array(':icao' => $row['icao'], ':type' => $row['type'])); |
|
758 | + } catch (PDOException $e) { |
|
759 | 759 | return "error : ".$e->getMessage(); |
760 | 760 | } |
761 | 761 | echo $row['icao'].' : '.$row['type']."\n"; |
762 | 762 | } else { |
763 | 763 | try { |
764 | 764 | $sth_dest->execute($query_dest_values); |
765 | - } catch(PDOException $e) { |
|
765 | + } catch (PDOException $e) { |
|
766 | 766 | return "error : ".$e->getMessage(); |
767 | 767 | } |
768 | 768 | } |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | echo "Download data from ourairports.com...\n"; |
814 | 814 | $delimiter = ','; |
815 | 815 | $out_file = $tmp_dir.'airports.csv'; |
816 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
816 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
817 | 817 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
818 | 818 | echo "Add data from ourairports.com...\n"; |
819 | 819 | |
@@ -824,33 +824,33 @@ discard block |
||
824 | 824 | //$Connection->db->beginTransaction(); |
825 | 825 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
826 | 826 | { |
827 | - if(!$header) $header = $row; |
|
827 | + if (!$header) $header = $row; |
|
828 | 828 | else { |
829 | 829 | $data = array(); |
830 | 830 | $data = array_combine($header, $row); |
831 | 831 | try { |
832 | 832 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
833 | 833 | $sth->execute(array(':icao' => $data['ident'])); |
834 | - } catch(PDOException $e) { |
|
834 | + } catch (PDOException $e) { |
|
835 | 835 | return "error : ".$e->getMessage(); |
836 | 836 | } |
837 | 837 | if ($sth->fetchColumn() > 0) { |
838 | 838 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
839 | 839 | try { |
840 | 840 | $sth = $Connection->db->prepare($query); |
841 | - $sth->execute(array(':icao' => $data['ident'],':type' => $data['type'])); |
|
842 | - } catch(PDOException $e) { |
|
841 | + $sth->execute(array(':icao' => $data['ident'], ':type' => $data['type'])); |
|
842 | + } catch (PDOException $e) { |
|
843 | 843 | return "error : ".$e->getMessage(); |
844 | 844 | } |
845 | 845 | } else { |
846 | 846 | if ($data['gps_code'] == $data['ident']) { |
847 | 847 | $query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link) |
848 | 848 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
849 | - $query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
849 | + $query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
850 | 850 | try { |
851 | 851 | $sth = $Connection->db->prepare($query); |
852 | 852 | $sth->execute($query_values); |
853 | - } catch(PDOException $e) { |
|
853 | + } catch (PDOException $e) { |
|
854 | 854 | return "error : ".$e->getMessage(); |
855 | 855 | } |
856 | 856 | $i++; |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | |
866 | 866 | echo "Download data from another free database...\n"; |
867 | 867 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
868 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
868 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
869 | 869 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
870 | 870 | update_db::unzip($out_file); |
871 | 871 | $header = NULL; |
@@ -877,15 +877,15 @@ discard block |
||
877 | 877 | //$Connection->db->beginTransaction(); |
878 | 878 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
879 | 879 | { |
880 | - if(!$header) $header = $row; |
|
880 | + if (!$header) $header = $row; |
|
881 | 881 | else { |
882 | 882 | $data = $row; |
883 | 883 | |
884 | 884 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
885 | 885 | try { |
886 | 886 | $sth = $Connection->db->prepare($query); |
887 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
888 | - } catch(PDOException $e) { |
|
887 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
888 | + } catch (PDOException $e) { |
|
889 | 889 | return "error : ".$e->getMessage(); |
890 | 890 | } |
891 | 891 | } |
@@ -899,15 +899,15 @@ discard block |
||
899 | 899 | try { |
900 | 900 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'"); |
901 | 901 | $sth->execute(); |
902 | - } catch(PDOException $e) { |
|
902 | + } catch (PDOException $e) { |
|
903 | 903 | return "error : ".$e->getMessage(); |
904 | 904 | } |
905 | 905 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
906 | 906 | $query2 = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
907 | 907 | try { |
908 | 908 | $sth2 = $Connection->db->prepare($query2); |
909 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
910 | - } catch(PDOException $e) { |
|
909 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
910 | + } catch (PDOException $e) { |
|
911 | 911 | return "error : ".$e->getMessage(); |
912 | 912 | } |
913 | 913 | } |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | $Connection = new Connection(); |
929 | 929 | $sth = $Connection->db->prepare($query); |
930 | 930 | $sth->execute(array(':source' => 'translation.csv')); |
931 | - } catch(PDOException $e) { |
|
931 | + } catch (PDOException $e) { |
|
932 | 932 | return "error : ".$e->getMessage(); |
933 | 933 | } |
934 | 934 | |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
946 | 946 | { |
947 | 947 | $i++; |
948 | - if($i > 12) { |
|
948 | + if ($i > 12) { |
|
949 | 949 | $data = $row; |
950 | 950 | $operator = $data[2]; |
951 | 951 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | //echo substr($operator, 0, 2)."\n";; |
954 | 954 | if (count($airline_array) > 0) { |
955 | 955 | //print_r($airline_array); |
956 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
956 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
957 | 957 | } |
958 | 958 | } |
959 | 959 | |
@@ -961,14 +961,14 @@ discard block |
||
961 | 961 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
962 | 962 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
963 | 963 | if (count($airline_array) > 0) { |
964 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
964 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
965 | 965 | } |
966 | 966 | } |
967 | 967 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
968 | 968 | try { |
969 | 969 | $sth = $Connection->db->prepare($query); |
970 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
971 | - } catch(PDOException $e) { |
|
970 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
971 | + } catch (PDOException $e) { |
|
972 | 972 | return "error : ".$e->getMessage(); |
973 | 973 | } |
974 | 974 | } |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | $Connection = new Connection(); |
987 | 987 | $sth = $Connection->db->prepare($query); |
988 | 988 | $sth->execute(array(':source' => 'website_fam')); |
989 | - } catch(PDOException $e) { |
|
989 | + } catch (PDOException $e) { |
|
990 | 990 | return "error : ".$e->getMessage(); |
991 | 991 | } |
992 | 992 | //update_db::unzip($out_file); |
@@ -1004,8 +1004,8 @@ discard block |
||
1004 | 1004 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
1005 | 1005 | try { |
1006 | 1006 | $sth = $Connection->db->prepare($query); |
1007 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
1008 | - } catch(PDOException $e) { |
|
1007 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
1008 | + } catch (PDOException $e) { |
|
1009 | 1009 | return "error : ".$e->getMessage(); |
1010 | 1010 | } |
1011 | 1011 | } |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | $Connection = new Connection(); |
1029 | 1029 | $sth = $Connection->db->prepare($query); |
1030 | 1030 | $sth->execute(array(':source' => 'website_faa')); |
1031 | - } catch(PDOException $e) { |
|
1031 | + } catch (PDOException $e) { |
|
1032 | 1032 | return "error : ".$e->getMessage(); |
1033 | 1033 | } |
1034 | 1034 | |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $Connection = new Connection(); |
1038 | 1038 | $sth = $Connection->db->prepare($query); |
1039 | 1039 | $sth->execute(array(':source' => 'website_faa')); |
1040 | - } catch(PDOException $e) { |
|
1040 | + } catch (PDOException $e) { |
|
1041 | 1041 | return "error : ".$e->getMessage(); |
1042 | 1042 | } |
1043 | 1043 | |
@@ -1054,8 +1054,8 @@ discard block |
||
1054 | 1054 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
1055 | 1055 | try { |
1056 | 1056 | $sths = $Connection->db->prepare($query_search); |
1057 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
1058 | - } catch(PDOException $e) { |
|
1057 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
1058 | + } catch (PDOException $e) { |
|
1059 | 1059 | return "error s : ".$e->getMessage(); |
1060 | 1060 | } |
1061 | 1061 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1068,8 +1068,8 @@ discard block |
||
1068 | 1068 | //} |
1069 | 1069 | try { |
1070 | 1070 | $sthi = $Connection->db->prepare($queryi); |
1071 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1072 | - } catch(PDOException $e) { |
|
1071 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1072 | + } catch (PDOException $e) { |
|
1073 | 1073 | return "error u : ".$e->getMessage(); |
1074 | 1074 | } |
1075 | 1075 | } else { |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | try { |
1078 | 1078 | $sthsm = $Connection->db->prepare($query_search_mfr); |
1079 | 1079 | $sthsm->execute(array(':mfr' => $data[2])); |
1080 | - } catch(PDOException $e) { |
|
1080 | + } catch (PDOException $e) { |
|
1081 | 1081 | return "error mfr : ".$e->getMessage(); |
1082 | 1082 | } |
1083 | 1083 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1087,8 +1087,8 @@ discard block |
||
1087 | 1087 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1088 | 1088 | try { |
1089 | 1089 | $sthf = $Connection->db->prepare($queryf); |
1090 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
1091 | - } catch(PDOException $e) { |
|
1090 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
1091 | + } catch (PDOException $e) { |
|
1092 | 1092 | return "error f : ".$e->getMessage(); |
1093 | 1093 | } |
1094 | 1094 | } |
@@ -1098,13 +1098,13 @@ discard block |
||
1098 | 1098 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1099 | 1099 | try { |
1100 | 1100 | $sth = $Connection->db->prepare($query); |
1101 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
1102 | - } catch(PDOException $e) { |
|
1101 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
1102 | + } catch (PDOException $e) { |
|
1103 | 1103 | return "error i : ".$e->getMessage(); |
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | } |
1107 | - if ($i % 90 == 0) { |
|
1107 | + if ($i%90 == 0) { |
|
1108 | 1108 | if ($globalTransaction) $Connection->db->commit(); |
1109 | 1109 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1110 | 1110 | } |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | $Connection = new Connection(); |
1124 | 1124 | $sth = $Connection->db->prepare($query); |
1125 | 1125 | $sth->execute(array(':source' => 'website_fam')); |
1126 | - } catch(PDOException $e) { |
|
1126 | + } catch (PDOException $e) { |
|
1127 | 1127 | return "error : ".$e->getMessage(); |
1128 | 1128 | } |
1129 | 1129 | $delimiter = "\t"; |
@@ -1139,8 +1139,8 @@ discard block |
||
1139 | 1139 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1140 | 1140 | try { |
1141 | 1141 | $sth = $Connection->db->prepare($query); |
1142 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
1143 | - } catch(PDOException $e) { |
|
1142 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
1143 | + } catch (PDOException $e) { |
|
1144 | 1144 | return "error : ".$e->getMessage(); |
1145 | 1145 | } |
1146 | 1146 | } |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | try { |
1173 | 1173 | $sth = $Connection->db->prepare($query); |
1174 | 1174 | $sth->execute(); |
1175 | - } catch(PDOException $e) { |
|
1175 | + } catch (PDOException $e) { |
|
1176 | 1176 | return "error : ".$e->getMessage(); |
1177 | 1177 | } |
1178 | 1178 | $delimiter = "\t"; |
@@ -1187,8 +1187,8 @@ discard block |
||
1187 | 1187 | $query = 'INSERT INTO airlines (airline_id,name,alias,iata,icao,callsign,country,active,type,home_link,wikipedia_link,alliance,ban_eu) VALUES (0,:name,:alias,:iata,:icao,:callsign,:country,:active,:type,:home,:wikipedia_link,:alliance,:ban_eu)'; |
1188 | 1188 | try { |
1189 | 1189 | $sth = $Connection->db->prepare($query); |
1190 | - $sth->execute(array(':name' => $data[0],':alias' => $data[1],':iata' => $data[2],':icao' => $data[3], ':callsign' => $data[4],':country' => $data[5],':active' => $data[6],':type' => $data[7],':home' => $data[8],':wikipedia_link' => $data[9],':alliance' => $data[10],':ban_eu' => $data[11])); |
|
1191 | - } catch(PDOException $e) { |
|
1190 | + $sth->execute(array(':name' => $data[0], ':alias' => $data[1], ':iata' => $data[2], ':icao' => $data[3], ':callsign' => $data[4], ':country' => $data[5], ':active' => $data[6], ':type' => $data[7], ':home' => $data[8], ':wikipedia_link' => $data[9], ':alliance' => $data[10], ':ban_eu' => $data[11])); |
|
1191 | + } catch (PDOException $e) { |
|
1192 | 1192 | return "error : ".$e->getMessage(); |
1193 | 1193 | } |
1194 | 1194 | } |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | $Connection = new Connection(); |
1217 | 1217 | $sth = $Connection->db->prepare($query); |
1218 | 1218 | $sth->execute(array(':source' => 'website_fam')); |
1219 | - } catch(PDOException $e) { |
|
1219 | + } catch (PDOException $e) { |
|
1220 | 1220 | return "error : ".$e->getMessage(); |
1221 | 1221 | } |
1222 | 1222 | |
@@ -1232,8 +1232,8 @@ discard block |
||
1232 | 1232 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1233 | 1233 | try { |
1234 | 1234 | $sth = $Connection->db->prepare($query); |
1235 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1236 | - } catch(PDOException $e) { |
|
1235 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1236 | + } catch (PDOException $e) { |
|
1237 | 1237 | //print_r($data); |
1238 | 1238 | return "error : ".$e->getMessage(); |
1239 | 1239 | } |
@@ -1253,7 +1253,7 @@ discard block |
||
1253 | 1253 | $Connection = new Connection(); |
1254 | 1254 | $sth = $Connection->db->prepare($query); |
1255 | 1255 | $sth->execute(array(':source' => 'website_fam')); |
1256 | - } catch(PDOException $e) { |
|
1256 | + } catch (PDOException $e) { |
|
1257 | 1257 | return "error : ".$e->getMessage(); |
1258 | 1258 | } |
1259 | 1259 | $delimiter = "\t"; |
@@ -1269,13 +1269,13 @@ discard block |
||
1269 | 1269 | $query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
1270 | 1270 | try { |
1271 | 1271 | $sth = $Connection->db->prepare($query); |
1272 | - $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
1273 | - } catch(PDOException $e) { |
|
1274 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1272 | + $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
1273 | + } catch (PDOException $e) { |
|
1274 | + if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data); |
|
1275 | 1275 | die(); |
1276 | 1276 | } |
1277 | 1277 | } |
1278 | - if ($globalTransaction && $i % 2000 == 0) { |
|
1278 | + if ($globalTransaction && $i%2000 == 0) { |
|
1279 | 1279 | $Connection->db->commit(); |
1280 | 1280 | if ($globalDebug) echo '.'; |
1281 | 1281 | $Connection->db->beginTransaction(); |
@@ -1295,7 +1295,7 @@ discard block |
||
1295 | 1295 | $Connection = new Connection(); |
1296 | 1296 | $sth = $Connection->db->prepare($query); |
1297 | 1297 | $sth->execute(array(':source' => 'website_fam')); |
1298 | - } catch(PDOException $e) { |
|
1298 | + } catch (PDOException $e) { |
|
1299 | 1299 | return "error : ".$e->getMessage(); |
1300 | 1300 | } |
1301 | 1301 | $Connection = new Connection(); |
@@ -1308,12 +1308,12 @@ discard block |
||
1308 | 1308 | $query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)'; |
1309 | 1309 | try { |
1310 | 1310 | $sth = $Connection->db->prepare($query); |
1311 | - $sth->execute(array(':callSign' => trim($data),':source' => 'website_fam')); |
|
1312 | - } catch(PDOException $e) { |
|
1311 | + $sth->execute(array(':callSign' => trim($data), ':source' => 'website_fam')); |
|
1312 | + } catch (PDOException $e) { |
|
1313 | 1313 | if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data; |
1314 | 1314 | die(); |
1315 | 1315 | } |
1316 | - if ($globalTransaction && $i % 2000 == 0) { |
|
1316 | + if ($globalTransaction && $i%2000 == 0) { |
|
1317 | 1317 | $Connection->db->commit(); |
1318 | 1318 | if ($globalDebug) echo '.'; |
1319 | 1319 | $Connection->db->beginTransaction(); |
@@ -1333,7 +1333,7 @@ discard block |
||
1333 | 1333 | $Connection = new Connection(); |
1334 | 1334 | $sth = $Connection->db->prepare($query); |
1335 | 1335 | $sth->execute(); |
1336 | - } catch(PDOException $e) { |
|
1336 | + } catch (PDOException $e) { |
|
1337 | 1337 | return "error : ".$e->getMessage(); |
1338 | 1338 | } |
1339 | 1339 | |
@@ -1354,8 +1354,8 @@ discard block |
||
1354 | 1354 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
1355 | 1355 | try { |
1356 | 1356 | $sth = $Connection->db->prepare($query); |
1357 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
1358 | - } catch(PDOException $e) { |
|
1357 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
1358 | + } catch (PDOException $e) { |
|
1359 | 1359 | return "error : ".$e->getMessage(); |
1360 | 1360 | } |
1361 | 1361 | } |
@@ -1374,7 +1374,7 @@ discard block |
||
1374 | 1374 | $Connection = new Connection(); |
1375 | 1375 | $sth = $Connection->db->prepare($query); |
1376 | 1376 | $sth->execute(); |
1377 | - } catch(PDOException $e) { |
|
1377 | + } catch (PDOException $e) { |
|
1378 | 1378 | return "error : ".$e->getMessage(); |
1379 | 1379 | } |
1380 | 1380 | $delimiter = "\t"; |
@@ -1391,8 +1391,8 @@ discard block |
||
1391 | 1391 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1392 | 1392 | try { |
1393 | 1393 | $sth = $Connection->db->prepare($query); |
1394 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1395 | - } catch(PDOException $e) { |
|
1394 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1395 | + } catch (PDOException $e) { |
|
1396 | 1396 | return "error : ".$e->getMessage(); |
1397 | 1397 | } |
1398 | 1398 | } |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | $Connection = new Connection(); |
1412 | 1412 | $sth = $Connection->db->prepare($query); |
1413 | 1413 | $sth->execute(); |
1414 | - } catch(PDOException $e) { |
|
1414 | + } catch (PDOException $e) { |
|
1415 | 1415 | return "error : ".$e->getMessage(); |
1416 | 1416 | } |
1417 | 1417 | |
@@ -1427,7 +1427,7 @@ discard block |
||
1427 | 1427 | try { |
1428 | 1428 | $sth = $Connection->db->prepare($query); |
1429 | 1429 | $sth->execute(array(':icao' => $icao)); |
1430 | - } catch(PDOException $e) { |
|
1430 | + } catch (PDOException $e) { |
|
1431 | 1431 | return "error : ".$e->getMessage(); |
1432 | 1432 | } |
1433 | 1433 | } |
@@ -1438,7 +1438,7 @@ discard block |
||
1438 | 1438 | return ''; |
1439 | 1439 | } |
1440 | 1440 | |
1441 | - public static function tle($filename,$tletype) { |
|
1441 | + public static function tle($filename, $tletype) { |
|
1442 | 1442 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1443 | 1443 | global $tmp_dir, $globalTransaction; |
1444 | 1444 | //$Spotter = new Spotter(); |
@@ -1448,7 +1448,7 @@ discard block |
||
1448 | 1448 | $Connection = new Connection(); |
1449 | 1449 | $sth = $Connection->db->prepare($query); |
1450 | 1450 | $sth->execute(array(':source' => $filename)); |
1451 | - } catch(PDOException $e) { |
|
1451 | + } catch (PDOException $e) { |
|
1452 | 1452 | return "error : ".$e->getMessage(); |
1453 | 1453 | } |
1454 | 1454 | |
@@ -1473,8 +1473,8 @@ discard block |
||
1473 | 1473 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1474 | 1474 | try { |
1475 | 1475 | $sth = $Connection->db->prepare($query); |
1476 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1477 | - } catch(PDOException $e) { |
|
1476 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1477 | + } catch (PDOException $e) { |
|
1478 | 1478 | return "error : ".$e->getMessage(); |
1479 | 1479 | } |
1480 | 1480 | |
@@ -1495,7 +1495,7 @@ discard block |
||
1495 | 1495 | $Connection = new Connection(); |
1496 | 1496 | $sth = $Connection->db->prepare($query); |
1497 | 1497 | $sth->execute(array(':source' => $filename)); |
1498 | - } catch(PDOException $e) { |
|
1498 | + } catch (PDOException $e) { |
|
1499 | 1499 | return "error : ".$e->getMessage(); |
1500 | 1500 | } |
1501 | 1501 | |
@@ -1506,13 +1506,13 @@ discard block |
||
1506 | 1506 | $i = 0; |
1507 | 1507 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1508 | 1508 | //$Connection->db->beginTransaction(); |
1509 | - while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE) |
|
1509 | + while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) |
|
1510 | 1510 | { |
1511 | 1511 | if ($i > 0 && $data[0] != '') { |
1512 | 1512 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1513 | - $period = str_replace(',','',$data[14]); |
|
1514 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1515 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1513 | + $period = str_replace(',', '', $data[14]); |
|
1514 | + if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60; |
|
1515 | + if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18])); |
|
1516 | 1516 | else $launch_date = NULL; |
1517 | 1517 | $data = array_map(function($value) { |
1518 | 1518 | return trim($value) === '' ? null : $value; |
@@ -1522,8 +1522,8 @@ discard block |
||
1522 | 1522 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1523 | 1523 | try { |
1524 | 1524 | $sth = $Connection->db->prepare($query); |
1525 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1526 | - } catch(PDOException $e) { |
|
1525 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1526 | + } catch (PDOException $e) { |
|
1527 | 1527 | return "error : ".$e->getMessage(); |
1528 | 1528 | } |
1529 | 1529 | } |
@@ -1563,7 +1563,7 @@ discard block |
||
1563 | 1563 | 'EGYP' => array('country' => 'Egypt', 'owner' => ''), |
1564 | 1564 | 'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'), |
1565 | 1565 | 'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'), |
1566 | - 'EST' => array('country' => 'Estonia','owner' => ''), |
|
1566 | + 'EST' => array('country' => 'Estonia', 'owner' => ''), |
|
1567 | 1567 | 'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'), |
1568 | 1568 | 'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'), |
1569 | 1569 | 'FGER' => array('country' => 'France/Germany', 'owner' => ''), |
@@ -1687,10 +1687,10 @@ discard block |
||
1687 | 1687 | { |
1688 | 1688 | if ($data != '') { |
1689 | 1689 | $result = array(); |
1690 | - $result['cospar'] = trim(substr($data,0,11)); |
|
1691 | - $result['norad'] = trim(substr($data,13,6)); |
|
1692 | - $result['operational'] = trim(substr($data,21,1)); |
|
1693 | - $result['name'] = trim(substr($data,23,24)); |
|
1690 | + $result['cospar'] = trim(substr($data, 0, 11)); |
|
1691 | + $result['norad'] = trim(substr($data, 13, 6)); |
|
1692 | + $result['operational'] = trim(substr($data, 21, 1)); |
|
1693 | + $result['name'] = trim(substr($data, 23, 24)); |
|
1694 | 1694 | /* |
1695 | 1695 | * R/B(1) = Rocket body, first stage |
1696 | 1696 | * R/B(2) = Rocket body, second stage |
@@ -1702,28 +1702,28 @@ discard block |
||
1702 | 1702 | * An ampersand (&) indicates two or more objects are attached |
1703 | 1703 | */ |
1704 | 1704 | |
1705 | - $owner_code = trim(substr($data,49,5)); |
|
1705 | + $owner_code = trim(substr($data, 49, 5)); |
|
1706 | 1706 | |
1707 | 1707 | if (!isset($satcat_sources[$owner_code]) && $satcat_sources[$owner_code] != 'TBD') { |
1708 | 1708 | if ($globalDebug) echo $data.'owner_code: '.$owner_code."\n"; |
1709 | 1709 | } |
1710 | - if (!isset($satcat_launch_site[trim(substr($data,68,5))])) { |
|
1711 | - if ($globalDebug) echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
1710 | + if (!isset($satcat_launch_site[trim(substr($data, 68, 5))])) { |
|
1711 | + if ($globalDebug) echo 'launch_site_code: '.trim(substr($data, 68, 5))."\n"; |
|
1712 | 1712 | } |
1713 | 1713 | |
1714 | - if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data,68,5))])) { |
|
1714 | + if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data, 68, 5))])) { |
|
1715 | 1715 | $result['country_owner'] = $satcat_sources[$owner_code]['country']; |
1716 | 1716 | $result['owner'] = $satcat_sources[$owner_code]['owner']; |
1717 | - $result['launch_date'] = trim(substr($data,56,10)); |
|
1718 | - $launch_site_code = trim(substr($data,68,5)); |
|
1717 | + $result['launch_date'] = trim(substr($data, 56, 10)); |
|
1718 | + $launch_site_code = trim(substr($data, 68, 5)); |
|
1719 | 1719 | $result['launch_site'] = $satcat_launch_site[$launch_site_code]; |
1720 | - $result['lifetime'] = trim(substr($data,75,10)); |
|
1721 | - $result['period'] = trim(substr($data,87,7)); |
|
1722 | - $result['inclination'] = trim(substr($data,96,5)); |
|
1723 | - $result['apogee'] = trim(substr($data,103,6)); |
|
1724 | - $result['perigee'] = trim(substr($data,111,6)); |
|
1720 | + $result['lifetime'] = trim(substr($data, 75, 10)); |
|
1721 | + $result['period'] = trim(substr($data, 87, 7)); |
|
1722 | + $result['inclination'] = trim(substr($data, 96, 5)); |
|
1723 | + $result['apogee'] = trim(substr($data, 103, 6)); |
|
1724 | + $result['perigee'] = trim(substr($data, 111, 6)); |
|
1725 | 1725 | //$result['radarcross'] = trim(substr($data,119,8)); |
1726 | - $result['status'] = trim(substr($data,129,3)); |
|
1726 | + $result['status'] = trim(substr($data, 129, 3)); |
|
1727 | 1727 | //print_r($result); |
1728 | 1728 | $result = array_map(function($value) { |
1729 | 1729 | return trim($value) === '' ? null : $value; |
@@ -1736,7 +1736,7 @@ discard block |
||
1736 | 1736 | $sth = $Connection->db->prepare($query); |
1737 | 1737 | $sth->execute(array(':cospar' => $result['cospar'])); |
1738 | 1738 | $exist = $sth->fetchAll(PDO::FETCH_ASSOC); |
1739 | - } catch(PDOException $e) { |
|
1739 | + } catch (PDOException $e) { |
|
1740 | 1740 | return "error : ".$e->getMessage(); |
1741 | 1741 | } |
1742 | 1742 | if (empty($exist)) { |
@@ -1748,10 +1748,10 @@ discard block |
||
1748 | 1748 | ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
1749 | 1749 | ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
1750 | 1750 | ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
1751 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1751 | + ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1752 | 1752 | ) |
1753 | 1753 | ); |
1754 | - } catch(PDOException $e) { |
|
1754 | + } catch (PDOException $e) { |
|
1755 | 1755 | return "error : ".$e->getMessage(); |
1756 | 1756 | } |
1757 | 1757 | } elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) { |
@@ -1759,8 +1759,8 @@ discard block |
||
1759 | 1759 | try { |
1760 | 1760 | $Connection = new Connection(); |
1761 | 1761 | $sth = $Connection->db->prepare($query); |
1762 | - $sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar'])); |
|
1763 | - } catch(PDOException $e) { |
|
1762 | + $sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar'])); |
|
1763 | + } catch (PDOException $e) { |
|
1764 | 1764 | return "error : ".$e->getMessage(); |
1765 | 1765 | } |
1766 | 1766 | } |
@@ -1879,13 +1879,13 @@ discard block |
||
1879 | 1879 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1880 | 1880 | { |
1881 | 1881 | $i++; |
1882 | - if($i > 3 && count($row) > 2) { |
|
1882 | + if ($i > 3 && count($row) > 2) { |
|
1883 | 1883 | $data = array_values(array_filter($row)); |
1884 | 1884 | $cntdata = count($data); |
1885 | 1885 | if ($cntdata > 10) { |
1886 | 1886 | $value = $data[9]; |
1887 | 1887 | |
1888 | - for ($i =10;$i < $cntdata;$i++) { |
|
1888 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1889 | 1889 | $value .= ' '.$data[$i]; |
1890 | 1890 | } |
1891 | 1891 | $data[9] = $value; |
@@ -1895,8 +1895,8 @@ discard block |
||
1895 | 1895 | $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)'; |
1896 | 1896 | try { |
1897 | 1897 | $sth = $Connection->db->prepare($query); |
1898 | - $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])); |
|
1899 | - } catch(PDOException $e) { |
|
1898 | + $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])); |
|
1899 | + } catch (PDOException $e) { |
|
1900 | 1900 | return "error : ".$e->getMessage(); |
1901 | 1901 | } |
1902 | 1902 | } |
@@ -1913,22 +1913,22 @@ discard block |
||
1913 | 1913 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
1914 | 1914 | $delimiter = ','; |
1915 | 1915 | $Common = new Common(); |
1916 | - $Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv',$tmp_dir.'fires.csv'); |
|
1916 | + $Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv', $tmp_dir.'fires.csv'); |
|
1917 | 1917 | $Connection = new Connection(); |
1918 | 1918 | $Source = new Source(); |
1919 | 1919 | $Source->deleteLocationByType('fires'); |
1920 | 1920 | $i = 0; |
1921 | - if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) { |
|
1921 | + if (($handle = fopen($tmp_dir.'fires.csv', 'r')) !== false) { |
|
1922 | 1922 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1923 | - while (($row = fgetcsv($handle,1000)) !== false) { |
|
1923 | + while (($row = fgetcsv($handle, 1000)) !== false) { |
|
1924 | 1924 | if ($i > 0 && $row[0] != '' && $row[8] != 'low') { |
1925 | - $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]); |
|
1925 | + $description = array('bright_t14' => $row[2], 'scan' => $row[3], 'track' => $row[4], 'sat' => $row[7], 'confidence' => $row[8], 'version' => $row[9], 'bright_t15' => $row[10], 'frp' => $row[11], 'daynight' => $row[12]); |
|
1926 | 1926 | $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
1927 | - $query_values = array(':name' => '',':latitude' => $row[0], ':longitude' => $row[1],':altitude' => null,':city' => '',':country' => '',':logo' => 'fire.png',':source' => 'NASA',':type' => 'fires',':source_id' => 0,':last_seen' => $row[5].' '.substr($row[6],0,2).':'.substr($row[6],2,2),':location_id' => 0,':description' => json_encode($description)); |
|
1927 | + $query_values = array(':name' => '', ':latitude' => $row[0], ':longitude' => $row[1], ':altitude' => null, ':city' => '', ':country' => '', ':logo' => 'fire.png', ':source' => 'NASA', ':type' => 'fires', ':source_id' => 0, ':last_seen' => $row[5].' '.substr($row[6], 0, 2).':'.substr($row[6], 2, 2), ':location_id' => 0, ':description' => json_encode($description)); |
|
1928 | 1928 | try { |
1929 | 1929 | $sth = $Connection->db->prepare($query); |
1930 | 1930 | $sth->execute($query_values); |
1931 | - } catch(PDOException $e) { |
|
1931 | + } catch (PDOException $e) { |
|
1932 | 1932 | echo "error : ".$e->getMessage(); |
1933 | 1933 | } |
1934 | 1934 | } |
@@ -1947,7 +1947,7 @@ discard block |
||
1947 | 1947 | $Connection = new Connection(); |
1948 | 1948 | $sth = $Connection->db->prepare($query); |
1949 | 1949 | $sth->execute(); |
1950 | - } catch(PDOException $e) { |
|
1950 | + } catch (PDOException $e) { |
|
1951 | 1951 | return "error : ".$e->getMessage(); |
1952 | 1952 | } |
1953 | 1953 | $header = NULL; |
@@ -1958,12 +1958,12 @@ discard block |
||
1958 | 1958 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1959 | 1959 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1960 | 1960 | { |
1961 | - if(count($row) > 1) { |
|
1961 | + if (count($row) > 1) { |
|
1962 | 1962 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1963 | 1963 | try { |
1964 | 1964 | $sth = $Connection->db->prepare($query); |
1965 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1966 | - } catch(PDOException $e) { |
|
1965 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1966 | + } catch (PDOException $e) { |
|
1967 | 1967 | return "error : ".$e->getMessage(); |
1968 | 1968 | } |
1969 | 1969 | } |
@@ -1983,21 +1983,21 @@ discard block |
||
1983 | 1983 | try { |
1984 | 1984 | $sth = $Connection->db->prepare($query); |
1985 | 1985 | $sth->execute(); |
1986 | - } catch(PDOException $e) { |
|
1986 | + } catch (PDOException $e) { |
|
1987 | 1987 | return "error : ".$e->getMessage(); |
1988 | 1988 | } |
1989 | 1989 | } |
1990 | 1990 | |
1991 | 1991 | |
1992 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1992 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1993 | 1993 | else { |
1994 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1994 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1995 | 1995 | $query = "CREATE EXTENSION postgis"; |
1996 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1996 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1997 | 1997 | try { |
1998 | 1998 | $sth = $Connection->db->prepare($query); |
1999 | 1999 | $sth->execute(); |
2000 | - } catch(PDOException $e) { |
|
2000 | + } catch (PDOException $e) { |
|
2001 | 2001 | return "error : ".$e->getMessage(); |
2002 | 2002 | } |
2003 | 2003 | } |
@@ -2010,13 +2010,13 @@ discard block |
||
2010 | 2010 | include_once('class.create_db.php'); |
2011 | 2011 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
2012 | 2012 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
2013 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
|
2013 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5', $tmp_dir.'notam.txt.gz.md5'); |
|
2014 | 2014 | $error = ''; |
2015 | 2015 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
2016 | - $notam_md5_file = explode(' ',file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
2016 | + $notam_md5_file = explode(' ', file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
2017 | 2017 | $notam_md5 = $notam_md5_file[0]; |
2018 | 2018 | if (!update_db::check_notam_version($notam_md5)) { |
2019 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
2019 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
2020 | 2020 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
2021 | 2021 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
2022 | 2022 | if ($globalDebug) echo "Gunzip..."; |
@@ -2052,14 +2052,14 @@ discard block |
||
2052 | 2052 | try { |
2053 | 2053 | $sth = $Connection->db->prepare($query); |
2054 | 2054 | $sth->execute(); |
2055 | - } catch(PDOException $e) { |
|
2055 | + } catch (PDOException $e) { |
|
2056 | 2056 | echo "error : ".$e->getMessage(); |
2057 | 2057 | } |
2058 | 2058 | } |
2059 | 2059 | if ($globalDBdriver == 'mysql') { |
2060 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
2060 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
2061 | 2061 | } else { |
2062 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
2062 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
2063 | 2063 | } |
2064 | 2064 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
2065 | 2065 | return $error; |
@@ -2072,7 +2072,7 @@ discard block |
||
2072 | 2072 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
2073 | 2073 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
2074 | 2074 | // 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'); |
2075 | - 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'); |
|
2075 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
2076 | 2076 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
2077 | 2077 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
2078 | 2078 | return $error; |
@@ -2093,7 +2093,7 @@ discard block |
||
2093 | 2093 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
2094 | 2094 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
2095 | 2095 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
2096 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
2096 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
2097 | 2097 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
2098 | 2098 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
2099 | 2099 | } else $error = "ZIP module not loaded but required for IVAO."; |
@@ -2107,7 +2107,7 @@ discard block |
||
2107 | 2107 | global $tmp_dir, $globalDebug; |
2108 | 2108 | $error = ''; |
2109 | 2109 | if ($globalDebug) echo "Routes : Download..."; |
2110 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
2110 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
2111 | 2111 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
2112 | 2112 | if ($globalDebug) echo "Gunzip..."; |
2113 | 2113 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -2123,7 +2123,7 @@ discard block |
||
2123 | 2123 | global $tmp_dir, $globalDebug; |
2124 | 2124 | $error = ''; |
2125 | 2125 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
2126 | - update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
2126 | + update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
2127 | 2127 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
2128 | 2128 | if ($globalDebug) echo "Gunzip..."; |
2129 | 2129 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -2139,7 +2139,7 @@ discard block |
||
2139 | 2139 | global $tmp_dir, $globalDebug; |
2140 | 2140 | $error = ''; |
2141 | 2141 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
2142 | - update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
2142 | + update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
2143 | 2143 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
2144 | 2144 | if ($globalDebug) echo "Gunzip..."; |
2145 | 2145 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -2167,7 +2167,7 @@ discard block |
||
2167 | 2167 | */ |
2168 | 2168 | if ($globalDebug) echo "Modes : Download..."; |
2169 | 2169 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
2170 | - update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
2170 | + update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
2171 | 2171 | |
2172 | 2172 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2173 | 2173 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -2187,7 +2187,7 @@ discard block |
||
2187 | 2187 | public static function update_ModeS_faa() { |
2188 | 2188 | global $tmp_dir, $globalDebug; |
2189 | 2189 | if ($globalDebug) echo "Modes FAA: Download..."; |
2190 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
2190 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
2191 | 2191 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2192 | 2192 | if ($globalDebug) echo "Unzip..."; |
2193 | 2193 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -2203,7 +2203,7 @@ discard block |
||
2203 | 2203 | public static function update_ModeS_flarm() { |
2204 | 2204 | global $tmp_dir, $globalDebug; |
2205 | 2205 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
2206 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
2206 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
2207 | 2207 | if (file_exists($tmp_dir.'data.fln')) { |
2208 | 2208 | if ($globalDebug) echo "Add to DB..."; |
2209 | 2209 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -2217,7 +2217,7 @@ discard block |
||
2217 | 2217 | public static function update_ModeS_ogn() { |
2218 | 2218 | global $tmp_dir, $globalDebug; |
2219 | 2219 | if ($globalDebug) echo "Modes OGN: Download..."; |
2220 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
2220 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
2221 | 2221 | if (file_exists($tmp_dir.'ogn.csv')) { |
2222 | 2222 | if ($globalDebug) echo "Add to DB..."; |
2223 | 2223 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -2232,201 +2232,201 @@ discard block |
||
2232 | 2232 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2233 | 2233 | |
2234 | 2234 | if ($globalDebug) echo "Owner France: Download..."; |
2235 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
2235 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
2236 | 2236 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2237 | 2237 | if ($globalDebug) echo "Add to DB..."; |
2238 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
2238 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
2239 | 2239 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
2240 | 2240 | if ($error != '') { |
2241 | 2241 | return $error; |
2242 | 2242 | } elseif ($globalDebug) echo "Done\n"; |
2243 | 2243 | |
2244 | 2244 | if ($globalDebug) echo "Owner Ireland: Download..."; |
2245 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
2245 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
2246 | 2246 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2247 | 2247 | if ($globalDebug) echo "Add to DB..."; |
2248 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
2248 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
2249 | 2249 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
2250 | 2250 | if ($error != '') { |
2251 | 2251 | return $error; |
2252 | 2252 | } elseif ($globalDebug) echo "Done\n"; |
2253 | 2253 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
2254 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
2254 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
2255 | 2255 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2256 | 2256 | if ($globalDebug) echo "Add to DB..."; |
2257 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
2257 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
2258 | 2258 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
2259 | 2259 | if ($error != '') { |
2260 | 2260 | return $error; |
2261 | 2261 | } elseif ($globalDebug) echo "Done\n"; |
2262 | 2262 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
2263 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
2263 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
2264 | 2264 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2265 | 2265 | if ($globalDebug) echo "Add to DB..."; |
2266 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
2266 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
2267 | 2267 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
2268 | 2268 | if ($error != '') { |
2269 | 2269 | return $error; |
2270 | 2270 | } elseif ($globalDebug) echo "Done\n"; |
2271 | 2271 | if ($globalDebug) echo "Owner Australia: Download..."; |
2272 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
2272 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
2273 | 2273 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2274 | 2274 | if ($globalDebug) echo "Add to DB..."; |
2275 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
2275 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
2276 | 2276 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
2277 | 2277 | if ($error != '') { |
2278 | 2278 | return $error; |
2279 | 2279 | } elseif ($globalDebug) echo "Done\n"; |
2280 | 2280 | if ($globalDebug) echo "Owner Austria: Download..."; |
2281 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
2281 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
2282 | 2282 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2283 | 2283 | if ($globalDebug) echo "Add to DB..."; |
2284 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
2284 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
2285 | 2285 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
2286 | 2286 | if ($error != '') { |
2287 | 2287 | return $error; |
2288 | 2288 | } elseif ($globalDebug) echo "Done\n"; |
2289 | 2289 | if ($globalDebug) echo "Owner Chile: Download..."; |
2290 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
2290 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
2291 | 2291 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2292 | 2292 | if ($globalDebug) echo "Add to DB..."; |
2293 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
2293 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
2294 | 2294 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
2295 | 2295 | if ($error != '') { |
2296 | 2296 | return $error; |
2297 | 2297 | } elseif ($globalDebug) echo "Done\n"; |
2298 | 2298 | if ($globalDebug) echo "Owner Colombia: Download..."; |
2299 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
2299 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
2300 | 2300 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2301 | 2301 | if ($globalDebug) echo "Add to DB..."; |
2302 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
2302 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
2303 | 2303 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
2304 | 2304 | if ($error != '') { |
2305 | 2305 | return $error; |
2306 | 2306 | } elseif ($globalDebug) echo "Done\n"; |
2307 | 2307 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
2308 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
2308 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
2309 | 2309 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2310 | 2310 | if ($globalDebug) echo "Add to DB..."; |
2311 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
2311 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
2312 | 2312 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
2313 | 2313 | if ($error != '') { |
2314 | 2314 | return $error; |
2315 | 2315 | } elseif ($globalDebug) echo "Done\n"; |
2316 | 2316 | if ($globalDebug) echo "Owner Brazil: Download..."; |
2317 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
2317 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
2318 | 2318 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2319 | 2319 | if ($globalDebug) echo "Add to DB..."; |
2320 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
2320 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
2321 | 2321 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
2322 | 2322 | if ($error != '') { |
2323 | 2323 | return $error; |
2324 | 2324 | } elseif ($globalDebug) echo "Done\n"; |
2325 | 2325 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
2326 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
2326 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
2327 | 2327 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2328 | 2328 | if ($globalDebug) echo "Add to DB..."; |
2329 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
2329 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
2330 | 2330 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
2331 | 2331 | if ($error != '') { |
2332 | 2332 | return $error; |
2333 | 2333 | } elseif ($globalDebug) echo "Done\n"; |
2334 | 2334 | if ($globalDebug) echo "Owner Croatia: Download..."; |
2335 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
2335 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
2336 | 2336 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2337 | 2337 | if ($globalDebug) echo "Add to DB..."; |
2338 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
2338 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
2339 | 2339 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
2340 | 2340 | if ($error != '') { |
2341 | 2341 | return $error; |
2342 | 2342 | } elseif ($globalDebug) echo "Done\n"; |
2343 | 2343 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
2344 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
2344 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
2345 | 2345 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2346 | 2346 | if ($globalDebug) echo "Add to DB..."; |
2347 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
2347 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
2348 | 2348 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
2349 | 2349 | if ($error != '') { |
2350 | 2350 | return $error; |
2351 | 2351 | } elseif ($globalDebug) echo "Done\n"; |
2352 | 2352 | if ($globalDebug) echo "Owner Maldives: Download..."; |
2353 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
2353 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
2354 | 2354 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2355 | 2355 | if ($globalDebug) echo "Add to DB..."; |
2356 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
2356 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
2357 | 2357 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
2358 | 2358 | if ($error != '') { |
2359 | 2359 | return $error; |
2360 | 2360 | } elseif ($globalDebug) echo "Done\n"; |
2361 | 2361 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
2362 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
2362 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
2363 | 2363 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2364 | 2364 | if ($globalDebug) echo "Add to DB..."; |
2365 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
2365 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
2366 | 2366 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
2367 | 2367 | if ($error != '') { |
2368 | 2368 | return $error; |
2369 | 2369 | } elseif ($globalDebug) echo "Done\n"; |
2370 | 2370 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
2371 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
2371 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
2372 | 2372 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2373 | 2373 | if ($globalDebug) echo "Add to DB..."; |
2374 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
2374 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
2375 | 2375 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
2376 | 2376 | if ($error != '') { |
2377 | 2377 | return $error; |
2378 | 2378 | } elseif ($globalDebug) echo "Done\n"; |
2379 | 2379 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
2380 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
2380 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
2381 | 2381 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2382 | 2382 | if ($globalDebug) echo "Add to DB..."; |
2383 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
2383 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
2384 | 2384 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
2385 | 2385 | if ($error != '') { |
2386 | 2386 | return $error; |
2387 | 2387 | } elseif ($globalDebug) echo "Done\n"; |
2388 | 2388 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
2389 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
2389 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
2390 | 2390 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2391 | 2391 | if ($globalDebug) echo "Add to DB..."; |
2392 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
2392 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
2393 | 2393 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
2394 | 2394 | if ($error != '') { |
2395 | 2395 | return $error; |
2396 | 2396 | } elseif ($globalDebug) echo "Done\n"; |
2397 | 2397 | if ($globalDebug) echo "Owner Iceland: Download..."; |
2398 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
2398 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
2399 | 2399 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2400 | 2400 | if ($globalDebug) echo "Add to DB..."; |
2401 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
2401 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
2402 | 2402 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
2403 | 2403 | if ($error != '') { |
2404 | 2404 | return $error; |
2405 | 2405 | } elseif ($globalDebug) echo "Done\n"; |
2406 | 2406 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
2407 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
2407 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
2408 | 2408 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2409 | 2409 | if ($globalDebug) echo "Add to DB..."; |
2410 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
2410 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
2411 | 2411 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
2412 | 2412 | if ($error != '') { |
2413 | 2413 | return $error; |
2414 | 2414 | } elseif ($globalDebug) echo "Done\n"; |
2415 | 2415 | if ($globalMasterSource) { |
2416 | 2416 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
2417 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
2417 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
2418 | 2418 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2419 | 2419 | if ($globalDebug) echo "Add to DB..."; |
2420 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
2420 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
2421 | 2421 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
2422 | 2422 | if ($error != '') { |
2423 | 2423 | return $error; |
2424 | 2424 | } elseif ($globalDebug) echo "Done\n"; |
2425 | 2425 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
2426 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
2426 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
2427 | 2427 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2428 | 2428 | if ($globalDebug) echo "Add to DB..."; |
2429 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
2429 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
2430 | 2430 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
2431 | 2431 | if ($error != '') { |
2432 | 2432 | return $error; |
@@ -2439,7 +2439,7 @@ discard block |
||
2439 | 2439 | global $tmp_dir, $globalDebug; |
2440 | 2440 | $error = ''; |
2441 | 2441 | if ($globalDebug) echo "Translation : Download..."; |
2442 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
2442 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
2443 | 2443 | if (file_exists($tmp_dir.'translation.zip')) { |
2444 | 2444 | if ($globalDebug) echo "Unzip..."; |
2445 | 2445 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -2456,10 +2456,10 @@ discard block |
||
2456 | 2456 | global $tmp_dir, $globalDebug; |
2457 | 2457 | $error = ''; |
2458 | 2458 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
2459 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
2460 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
|
2459 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
2460 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5', $tmp_dir.'translation.tsv.gz.md5'); |
|
2461 | 2461 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
2462 | - $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
2462 | + $translation_md5_file = explode(' ', file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
2463 | 2463 | $translation_md5 = $translation_md5_file[0]; |
2464 | 2464 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
2465 | 2465 | if ($globalDebug) echo "Gunzip..."; |
@@ -2477,10 +2477,10 @@ discard block |
||
2477 | 2477 | global $tmp_dir, $globalDebug; |
2478 | 2478 | $error = ''; |
2479 | 2479 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
2480 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
2481 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
|
2480 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
2481 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5', $tmp_dir.'modes.tsv.gz.md5'); |
|
2482 | 2482 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
2483 | - $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
2483 | + $modes_md5_file = explode(' ', file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
2484 | 2484 | $modes_md5 = $modes_md5_file[0]; |
2485 | 2485 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
2486 | 2486 | if ($globalDebug) echo "Gunzip..."; |
@@ -2499,12 +2499,12 @@ discard block |
||
2499 | 2499 | global $tmp_dir, $globalDebug; |
2500 | 2500 | $error = ''; |
2501 | 2501 | if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
2502 | - update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
|
2502 | + update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5', $tmp_dir.'airlines.tsv.gz.md5'); |
|
2503 | 2503 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
2504 | - $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
2504 | + $airlines_md5_file = explode(' ', file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
2505 | 2505 | $airlines_md5 = $airlines_md5_file[0]; |
2506 | 2506 | if (!update_db::check_airlines_version($airlines_md5)) { |
2507 | - update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
|
2507 | + update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz', $tmp_dir.'airlines.tsv.gz'); |
|
2508 | 2508 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
2509 | 2509 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
2510 | 2510 | if ($globalDebug) echo "Gunzip..."; |
@@ -2529,14 +2529,14 @@ discard block |
||
2529 | 2529 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
2530 | 2530 | $error = ''; |
2531 | 2531 | if ($globalOwner === TRUE) { |
2532 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2533 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
2532 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2533 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
2534 | 2534 | } else { |
2535 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2536 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
2535 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2536 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
2537 | 2537 | } |
2538 | 2538 | if (file_exists($tmp_dir.'owners.tsv.gz') && file_exists($tmp_dir.'owners.tsv.gz.md5')) { |
2539 | - $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
2539 | + $owners_md5_file = explode(' ', file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
2540 | 2540 | $owners_md5 = $owners_md5_file[0]; |
2541 | 2541 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
2542 | 2542 | if ($globalDebug) echo "Gunzip..."; |
@@ -2553,10 +2553,10 @@ discard block |
||
2553 | 2553 | public static function update_routes_fam() { |
2554 | 2554 | global $tmp_dir, $globalDebug; |
2555 | 2555 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2556 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
2557 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
|
2556 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2557 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5', $tmp_dir.'routes.tsv.gz.md5'); |
|
2558 | 2558 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
2559 | - $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
2559 | + $routes_md5_file = explode(' ', file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
2560 | 2560 | $routes_md5 = $routes_md5_file[0]; |
2561 | 2561 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
2562 | 2562 | if ($globalDebug) echo "Gunzip..."; |
@@ -2573,10 +2573,10 @@ discard block |
||
2573 | 2573 | public static function update_block_fam() { |
2574 | 2574 | global $tmp_dir, $globalDebug; |
2575 | 2575 | if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
2576 | - update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
|
2577 | - update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
|
2576 | + update_db::download('http://data.flightairmap.com/data/block.tsv.gz', $tmp_dir.'block.tsv.gz'); |
|
2577 | + update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5', $tmp_dir.'block.tsv.gz.md5'); |
|
2578 | 2578 | if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
2579 | - $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
|
2579 | + $block_md5_file = explode(' ', file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
|
2580 | 2580 | $block_md5 = $block_md5_file[0]; |
2581 | 2581 | if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
2582 | 2582 | if ($globalDebug) echo "Gunzip..."; |
@@ -2592,13 +2592,13 @@ discard block |
||
2592 | 2592 | } |
2593 | 2593 | public static function update_marine_identity_fam() { |
2594 | 2594 | global $tmp_dir, $globalDebug; |
2595 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2595 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2596 | 2596 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2597 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2597 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2598 | 2598 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2599 | 2599 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2600 | 2600 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2601 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2601 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2602 | 2602 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2603 | 2603 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
2604 | 2604 | if ($globalDebug) echo "Gunzip..."; |
@@ -2620,13 +2620,13 @@ discard block |
||
2620 | 2620 | |
2621 | 2621 | public static function update_satellite_fam() { |
2622 | 2622 | global $tmp_dir, $globalDebug; |
2623 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5'); |
|
2623 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5'); |
|
2624 | 2624 | if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) { |
2625 | - $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2625 | + $satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2626 | 2626 | $satellite_md5 = $satellite_md5_file[0]; |
2627 | 2627 | if (!update_db::check_satellite_version($satellite_md5)) { |
2628 | 2628 | if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
2629 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
|
2629 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz'); |
|
2630 | 2630 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2631 | 2631 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
2632 | 2632 | if ($globalDebug) echo "Gunzip..."; |
@@ -2648,7 +2648,7 @@ discard block |
||
2648 | 2648 | public static function update_banned_fam() { |
2649 | 2649 | global $tmp_dir, $globalDebug; |
2650 | 2650 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2651 | - update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2651 | + update_db::download('http://data.flightairmap.com/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2652 | 2652 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2653 | 2653 | //if ($globalDebug) echo "Gunzip..."; |
2654 | 2654 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2667,18 +2667,18 @@ discard block |
||
2667 | 2667 | $error = ''; |
2668 | 2668 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2669 | 2669 | if ($globalDBdriver == 'mysql') { |
2670 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2670 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2671 | 2671 | } else { |
2672 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2672 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2673 | 2673 | } |
2674 | 2674 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2675 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2675 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2676 | 2676 | $airspace_md5 = $airspace_md5_file[0]; |
2677 | 2677 | if (!update_db::check_airspace_version($airspace_md5)) { |
2678 | 2678 | if ($globalDBdriver == 'mysql') { |
2679 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2679 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2680 | 2680 | } else { |
2681 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2681 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2682 | 2682 | } |
2683 | 2683 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2684 | 2684 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
@@ -2691,7 +2691,7 @@ discard block |
||
2691 | 2691 | try { |
2692 | 2692 | $sth = $Connection->db->prepare($query); |
2693 | 2693 | $sth->execute(); |
2694 | - } catch(PDOException $e) { |
|
2694 | + } catch (PDOException $e) { |
|
2695 | 2695 | return "error : ".$e->getMessage(); |
2696 | 2696 | } |
2697 | 2697 | } |
@@ -2711,16 +2711,16 @@ discard block |
||
2711 | 2711 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2712 | 2712 | $error = ''; |
2713 | 2713 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
2714 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2714 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2715 | 2715 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2716 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2716 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2717 | 2717 | $geoid_md5 = $geoid_md5_file[0]; |
2718 | 2718 | if (!update_db::check_geoid_version($geoid_md5)) { |
2719 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2719 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2720 | 2720 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2721 | 2721 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
2722 | 2722 | if ($globalDebug) echo "Gunzip..."; |
2723 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2723 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2724 | 2724 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2725 | 2725 | update_db::insert_geoid_version($geoid_md5); |
2726 | 2726 | } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
@@ -2737,15 +2737,15 @@ discard block |
||
2737 | 2737 | public static function update_tle() { |
2738 | 2738 | global $tmp_dir, $globalDebug; |
2739 | 2739 | if ($globalDebug) echo "Download TLE : Download..."; |
2740 | - $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', |
|
2741 | - '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', |
|
2742 | - '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'); |
|
2740 | + $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', |
|
2741 | + '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', |
|
2742 | + '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'); |
|
2743 | 2743 | foreach ($alltle as $filename) { |
2744 | 2744 | if ($globalDebug) echo "downloading ".$filename.'...'; |
2745 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2745 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2746 | 2746 | if (file_exists($tmp_dir.$filename)) { |
2747 | 2747 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
2748 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2748 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2749 | 2749 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2750 | 2750 | if ($error != '') { |
2751 | 2751 | echo $error."\n"; |
@@ -2757,7 +2757,7 @@ discard block |
||
2757 | 2757 | public static function update_ucsdb() { |
2758 | 2758 | global $tmp_dir, $globalDebug; |
2759 | 2759 | if ($globalDebug) echo "Download UCS DB : Download..."; |
2760 | - update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/9-1-17-update/UCS_Satellite_Database_officialname_9-1-2017.txt',$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
|
2760 | + update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/9-1-17-update/UCS_Satellite_Database_officialname_9-1-2017.txt', $tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
|
2761 | 2761 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2762 | 2762 | if ($globalDebug) echo "Add to DB..."; |
2763 | 2763 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
@@ -2771,7 +2771,7 @@ discard block |
||
2771 | 2771 | public static function update_celestrak() { |
2772 | 2772 | global $tmp_dir, $globalDebug; |
2773 | 2773 | if ($globalDebug) echo "Download Celestrak DB : Download..."; |
2774 | - update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
|
2774 | + update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt'); |
|
2775 | 2775 | if (file_exists($tmp_dir.'satcat.txt')) { |
2776 | 2776 | if ($globalDebug) echo "Add to DB..."; |
2777 | 2777 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
@@ -2790,62 +2790,62 @@ discard block |
||
2790 | 2790 | if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
2791 | 2791 | return ''; |
2792 | 2792 | } |
2793 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2793 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2794 | 2794 | if (file_exists($tmp_dir.'models.md5sum')) { |
2795 | 2795 | if ($globalDebug) echo "Check files...\n"; |
2796 | 2796 | $newmodelsdb = array(); |
2797 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2798 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2797 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2798 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2799 | 2799 | $model = trim($row[2]); |
2800 | 2800 | $newmodelsdb[$model] = trim($row[0]); |
2801 | 2801 | } |
2802 | 2802 | } |
2803 | 2803 | $modelsdb = array(); |
2804 | 2804 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2805 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2806 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2805 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2806 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2807 | 2807 | $model = trim($row[2]); |
2808 | 2808 | $modelsdb[$model] = trim($row[0]); |
2809 | 2809 | } |
2810 | 2810 | } |
2811 | 2811 | } |
2812 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2812 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2813 | 2813 | foreach ($diff as $key => $value) { |
2814 | 2814 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2815 | - update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2815 | + update_db::download('http://data.flightairmap.com/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2816 | 2816 | } |
2817 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2817 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2818 | 2818 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2819 | 2819 | if ($error != '') { |
2820 | 2820 | return $error; |
2821 | 2821 | } elseif ($globalDebug) echo "Done\n"; |
2822 | 2822 | if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
2823 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
|
2823 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', $tmp_dir.'modelsgltf2.md5sum'); |
|
2824 | 2824 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
2825 | 2825 | if ($globalDebug) echo "Check files...\n"; |
2826 | 2826 | $newmodelsdb = array(); |
2827 | - if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
|
2828 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2827 | + if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum', 'r')) !== FALSE) { |
|
2828 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2829 | 2829 | $model = trim($row[2]); |
2830 | 2830 | $newmodelsdb[$model] = trim($row[0]); |
2831 | 2831 | } |
2832 | 2832 | } |
2833 | 2833 | $modelsdb = array(); |
2834 | 2834 | if (file_exists(dirname(__FILE__).'/../models/gltf2/models.md5sum')) { |
2835 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum','r')) !== FALSE) { |
|
2836 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2835 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum', 'r')) !== FALSE) { |
|
2836 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2837 | 2837 | $model = trim($row[2]); |
2838 | 2838 | $modelsdb[$model] = trim($row[0]); |
2839 | 2839 | } |
2840 | 2840 | } |
2841 | 2841 | } |
2842 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2842 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2843 | 2843 | foreach ($diff as $key => $value) { |
2844 | 2844 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2845 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
|
2845 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key, dirname(__FILE__).'/../models/gltf2/'.$key); |
|
2846 | 2846 | |
2847 | 2847 | } |
2848 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
|
2848 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
|
2849 | 2849 | } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
2850 | 2850 | if ($error != '') { |
2851 | 2851 | return $error; |
@@ -2861,32 +2861,32 @@ discard block |
||
2861 | 2861 | return ''; |
2862 | 2862 | } |
2863 | 2863 | if ($globalDebug) echo "Weather Models from FlightAirMap website : Download..."; |
2864 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum'); |
|
2864 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', $tmp_dir.'modelsweather.md5sum'); |
|
2865 | 2865 | if (file_exists($tmp_dir.'modelsweather.md5sum')) { |
2866 | 2866 | if ($globalDebug) echo "Check files...\n"; |
2867 | 2867 | $newmodelsdb = array(); |
2868 | - if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) { |
|
2869 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2868 | + if (($handle = fopen($tmp_dir.'modelsweather.md5sum', 'r')) !== FALSE) { |
|
2869 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2870 | 2870 | $model = trim($row[2]); |
2871 | 2871 | $newmodelsdb[$model] = trim($row[0]); |
2872 | 2872 | } |
2873 | 2873 | } |
2874 | 2874 | $modelsdb = array(); |
2875 | 2875 | if (file_exists(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum')) { |
2876 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum','r')) !== FALSE) { |
|
2877 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2876 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum', 'r')) !== FALSE) { |
|
2877 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2878 | 2878 | $model = trim($row[2]); |
2879 | 2879 | $modelsdb[$model] = trim($row[0]); |
2880 | 2880 | } |
2881 | 2881 | } |
2882 | 2882 | } |
2883 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2883 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2884 | 2884 | foreach ($diff as $key => $value) { |
2885 | 2885 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2886 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
|
2886 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key, dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
|
2887 | 2887 | |
2888 | 2888 | } |
2889 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
|
2889 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
|
2890 | 2890 | } else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
2891 | 2891 | if ($error != '') { |
2892 | 2892 | return $error; |
@@ -2898,32 +2898,32 @@ discard block |
||
2898 | 2898 | global $tmp_dir, $globalDebug; |
2899 | 2899 | $error = ''; |
2900 | 2900 | if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
2901 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
|
2901 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', $tmp_dir.'liveries.md5sum'); |
|
2902 | 2902 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
2903 | 2903 | if ($globalDebug) echo "Check files...\n"; |
2904 | 2904 | $newmodelsdb = array(); |
2905 | - if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
|
2906 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2905 | + if (($handle = fopen($tmp_dir.'liveries.md5sum', 'r')) !== FALSE) { |
|
2906 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2907 | 2907 | $model = trim($row[2]); |
2908 | 2908 | $newmodelsdb[$model] = trim($row[0]); |
2909 | 2909 | } |
2910 | 2910 | } |
2911 | 2911 | $modelsdb = array(); |
2912 | 2912 | if (file_exists(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum')) { |
2913 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum','r')) !== FALSE) { |
|
2914 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2913 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum', 'r')) !== FALSE) { |
|
2914 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2915 | 2915 | $model = trim($row[2]); |
2916 | 2916 | $modelsdb[$model] = trim($row[0]); |
2917 | 2917 | } |
2918 | 2918 | } |
2919 | 2919 | } |
2920 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2920 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2921 | 2921 | foreach ($diff as $key => $value) { |
2922 | 2922 | if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
2923 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
|
2923 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key, dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
|
2924 | 2924 | |
2925 | 2925 | } |
2926 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
|
2926 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
|
2927 | 2927 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2928 | 2928 | if ($error != '') { |
2929 | 2929 | return $error; |
@@ -2939,32 +2939,32 @@ discard block |
||
2939 | 2939 | return ''; |
2940 | 2940 | } |
2941 | 2941 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
2942 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
2942 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2943 | 2943 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2944 | 2944 | if ($globalDebug) echo "Check files...\n"; |
2945 | 2945 | $newmodelsdb = array(); |
2946 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2947 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2946 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
2947 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2948 | 2948 | $model = trim($row[2]); |
2949 | 2949 | $newmodelsdb[$model] = trim($row[0]); |
2950 | 2950 | } |
2951 | 2951 | } |
2952 | 2952 | $modelsdb = array(); |
2953 | 2953 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
2954 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2955 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2954 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2955 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2956 | 2956 | $model = trim($row[2]); |
2957 | 2957 | $modelsdb[$model] = trim($row[0]); |
2958 | 2958 | } |
2959 | 2959 | } |
2960 | 2960 | } |
2961 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2961 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2962 | 2962 | foreach ($diff as $key => $value) { |
2963 | 2963 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2964 | - update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2964 | + update_db::download('http://data.flightairmap.com/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2965 | 2965 | |
2966 | 2966 | } |
2967 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2967 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2968 | 2968 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2969 | 2969 | if ($error != '') { |
2970 | 2970 | return $error; |
@@ -2980,32 +2980,32 @@ discard block |
||
2980 | 2980 | return ''; |
2981 | 2981 | } |
2982 | 2982 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
2983 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
2983 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2984 | 2984 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2985 | 2985 | if ($globalDebug) echo "Check files...\n"; |
2986 | 2986 | $newmodelsdb = array(); |
2987 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2988 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2987 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2988 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2989 | 2989 | $model = trim($row[2]); |
2990 | 2990 | $newmodelsdb[$model] = trim($row[0]); |
2991 | 2991 | } |
2992 | 2992 | } |
2993 | 2993 | $modelsdb = array(); |
2994 | 2994 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
2995 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2996 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2995 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2996 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2997 | 2997 | $model = trim($row[2]); |
2998 | 2998 | $modelsdb[$model] = trim($row[0]); |
2999 | 2999 | } |
3000 | 3000 | } |
3001 | 3001 | } |
3002 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
3002 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
3003 | 3003 | foreach ($diff as $key => $value) { |
3004 | 3004 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
3005 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
3005 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
3006 | 3006 | |
3007 | 3007 | } |
3008 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
3008 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
3009 | 3009 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
3010 | 3010 | if ($error != '') { |
3011 | 3011 | return $error; |
@@ -3017,8 +3017,8 @@ discard block |
||
3017 | 3017 | global $tmp_dir, $globalDebug; |
3018 | 3018 | date_default_timezone_set('UTC'); |
3019 | 3019 | $Common = new Common(); |
3020 | - $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); |
|
3021 | - $all = json_decode($data,true); |
|
3020 | + $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); |
|
3021 | + $all = json_decode($data, true); |
|
3022 | 3022 | $Connection = new Connection(); |
3023 | 3023 | $querychk = "SELECT COUNT(1) as nb FROM aircraft WHERE icao = :icao"; |
3024 | 3024 | $sth = $Connection->db->prepare($querychk); |
@@ -3030,8 +3030,8 @@ discard block |
||
3030 | 3030 | foreach ($all as $model) { |
3031 | 3031 | $icao = $model['Designator']; |
3032 | 3032 | if (!isset($allicao[$icao])) { |
3033 | - $aircraft_shadow = 'generic_'.substr($model['EngineType'],0,1).$model['EngineCount'].$model['WTC'].'.png'; |
|
3034 | - $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']); |
|
3033 | + $aircraft_shadow = 'generic_'.substr($model['EngineType'], 0, 1).$model['EngineCount'].$model['WTC'].'.png'; |
|
3034 | + $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']); |
|
3035 | 3035 | } else { |
3036 | 3036 | $allicao[$icao][':type'] = $allicao[$icao][':type'].'/'.$model['ModelFullName']; |
3037 | 3037 | } |
@@ -3043,9 +3043,9 @@ discard block |
||
3043 | 3043 | if ($exist[0]['nb'] == 0) { |
3044 | 3044 | $sthins->execute($airdata); |
3045 | 3045 | } else { |
3046 | - $sthup->execute(array(':type' => $airdata[':type'],':icao' => $icao)); |
|
3046 | + $sthup->execute(array(':type' => $airdata[':type'], ':icao' => $icao)); |
|
3047 | 3047 | } |
3048 | - } catch(PDOException $e) { |
|
3048 | + } catch (PDOException $e) { |
|
3049 | 3049 | return "error : ".$e->getMessage(); |
3050 | 3050 | } |
3051 | 3051 | } |
@@ -3077,23 +3077,23 @@ discard block |
||
3077 | 3077 | $Connection = new Connection(); |
3078 | 3078 | $sth = $Connection->db->prepare($query); |
3079 | 3079 | $sth->execute(); |
3080 | - } catch(PDOException $e) { |
|
3080 | + } catch (PDOException $e) { |
|
3081 | 3081 | return "error : ".$e->getMessage(); |
3082 | 3082 | } |
3083 | 3083 | |
3084 | 3084 | $error = ''; |
3085 | 3085 | if ($globalDebug) echo "Notam : Download..."; |
3086 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
3086 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
3087 | 3087 | if (file_exists($tmp_dir.'notam.rss')) { |
3088 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
3088 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
3089 | 3089 | foreach ($notams['channel']['item'] as $notam) { |
3090 | - $title = explode(':',$notam['title']); |
|
3090 | + $title = explode(':', $notam['title']); |
|
3091 | 3091 | $data['ref'] = trim($title[0]); |
3092 | 3092 | unset($title[0]); |
3093 | - $data['title'] = trim(implode(':',$title)); |
|
3094 | - $description = strip_tags($notam['description'],'<pre>'); |
|
3095 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
3096 | - $q = explode('/',$match[1]); |
|
3093 | + $data['title'] = trim(implode(':', $title)); |
|
3094 | + $description = strip_tags($notam['description'], '<pre>'); |
|
3095 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
3096 | + $q = explode('/', $match[1]); |
|
3097 | 3097 | $data['fir'] = $q[0]; |
3098 | 3098 | $data['code'] = $q[1]; |
3099 | 3099 | $ifrvfr = $q[2]; |
@@ -3109,30 +3109,30 @@ discard block |
||
3109 | 3109 | $data['lower_limit'] = $q[5]; |
3110 | 3110 | $data['upper_limit'] = $q[6]; |
3111 | 3111 | $latlonrad = $q[7]; |
3112 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
3113 | - $latitude = $Common->convertDec($las,'latitude'); |
|
3114 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
3112 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
3113 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
3114 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
3115 | 3115 | if ($lac == 'S') $latitude = '-'.$latitude; |
3116 | 3116 | if ($lnc == 'W') $longitude = '-'.$longitude; |
3117 | 3117 | $data['center_latitude'] = $latitude; |
3118 | 3118 | $data['center_longitude'] = $longitude; |
3119 | 3119 | $data['radius'] = intval($radius); |
3120 | 3120 | |
3121 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
3121 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
3122 | 3122 | $data['text'] = $match[1]; |
3123 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
3123 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
3124 | 3124 | $fromto = $match[1]; |
3125 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
3125 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
3126 | 3126 | $fromall = trim($match[1]); |
3127 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
3127 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
3128 | 3128 | $from = trim($match[1]); |
3129 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
3130 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
3129 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
3130 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
3131 | 3131 | $toall = trim($match[1]); |
3132 | - if (!preg_match(':Permanent:',$toall)) { |
|
3133 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
3132 | + if (!preg_match(':Permanent:', $toall)) { |
|
3133 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
3134 | 3134 | $to = trim($match[1]); |
3135 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
3135 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
3136 | 3136 | $data['permanent'] = 0; |
3137 | 3137 | } else { |
3138 | 3138 | $data['date_end'] = NULL; |
@@ -3140,7 +3140,7 @@ discard block |
||
3140 | 3140 | } |
3141 | 3141 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
3142 | 3142 | $NOTAM = new NOTAM(); |
3143 | - $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']); |
|
3143 | + $NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
3144 | 3144 | unset($data); |
3145 | 3145 | } |
3146 | 3146 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -3163,16 +3163,16 @@ discard block |
||
3163 | 3163 | $Connection = new Connection(); |
3164 | 3164 | $sth = $Connection->db->prepare($query); |
3165 | 3165 | $sth->execute(); |
3166 | - } catch(PDOException $e) { |
|
3166 | + } catch (PDOException $e) { |
|
3167 | 3167 | return "error : ".$e->getMessage(); |
3168 | 3168 | } |
3169 | 3169 | } |
3170 | 3170 | $Common = new Common(); |
3171 | 3171 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
3172 | - $airspace_json = json_decode($airspace_lst,true); |
|
3172 | + $airspace_json = json_decode($airspace_lst, true); |
|
3173 | 3173 | foreach ($airspace_json['records'] as $airspace) { |
3174 | 3174 | if ($globalDebug) echo $airspace['name']."...\n"; |
3175 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
3175 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
3176 | 3176 | if (file_exists($tmp_dir.$airspace['name'])) { |
3177 | 3177 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
3178 | 3178 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -3194,7 +3194,7 @@ discard block |
||
3194 | 3194 | $Connection = new Connection(); |
3195 | 3195 | $sth = $Connection->db->prepare($query); |
3196 | 3196 | $sth->execute(array(':new' => $new, ':old' => $old)); |
3197 | - } catch(PDOException $e) { |
|
3197 | + } catch (PDOException $e) { |
|
3198 | 3198 | return "error : ".$e->getMessage(); |
3199 | 3199 | } |
3200 | 3200 | } |
@@ -3211,7 +3211,7 @@ discard block |
||
3211 | 3211 | $Connection = new Connection(); |
3212 | 3212 | $sth = $Connection->db->prepare($query); |
3213 | 3213 | $sth->execute(); |
3214 | - } catch(PDOException $e) { |
|
3214 | + } catch (PDOException $e) { |
|
3215 | 3215 | return "error : ".$e->getMessage(); |
3216 | 3216 | } |
3217 | 3217 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3226,7 +3226,7 @@ discard block |
||
3226 | 3226 | $Connection = new Connection(); |
3227 | 3227 | $sth = $Connection->db->prepare($query); |
3228 | 3228 | $sth->execute(); |
3229 | - } catch(PDOException $e) { |
|
3229 | + } catch (PDOException $e) { |
|
3230 | 3230 | return "error : ".$e->getMessage(); |
3231 | 3231 | } |
3232 | 3232 | } |
@@ -3237,7 +3237,7 @@ discard block |
||
3237 | 3237 | $Connection = new Connection(); |
3238 | 3238 | $sth = $Connection->db->prepare($query); |
3239 | 3239 | $sth->execute(array(':version' => $version)); |
3240 | - } catch(PDOException $e) { |
|
3240 | + } catch (PDOException $e) { |
|
3241 | 3241 | return "error : ".$e->getMessage(); |
3242 | 3242 | } |
3243 | 3243 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3251,7 +3251,7 @@ discard block |
||
3251 | 3251 | $Connection = new Connection(); |
3252 | 3252 | $sth = $Connection->db->prepare($query); |
3253 | 3253 | $sth->execute(array(':version' => $version)); |
3254 | - } catch(PDOException $e) { |
|
3254 | + } catch (PDOException $e) { |
|
3255 | 3255 | return "error : ".$e->getMessage(); |
3256 | 3256 | } |
3257 | 3257 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3265,7 +3265,7 @@ discard block |
||
3265 | 3265 | $Connection = new Connection(); |
3266 | 3266 | $sth = $Connection->db->prepare($query); |
3267 | 3267 | $sth->execute(array(':version' => $version)); |
3268 | - } catch(PDOException $e) { |
|
3268 | + } catch (PDOException $e) { |
|
3269 | 3269 | return "error : ".$e->getMessage(); |
3270 | 3270 | } |
3271 | 3271 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3279,7 +3279,7 @@ discard block |
||
3279 | 3279 | $Connection = new Connection(); |
3280 | 3280 | $sth = $Connection->db->prepare($query); |
3281 | 3281 | $sth->execute(array(':version' => $version)); |
3282 | - } catch(PDOException $e) { |
|
3282 | + } catch (PDOException $e) { |
|
3283 | 3283 | return "error : ".$e->getMessage(); |
3284 | 3284 | } |
3285 | 3285 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3293,7 +3293,7 @@ discard block |
||
3293 | 3293 | $Connection = new Connection(); |
3294 | 3294 | $sth = $Connection->db->prepare($query); |
3295 | 3295 | $sth->execute(array(':version' => $version)); |
3296 | - } catch(PDOException $e) { |
|
3296 | + } catch (PDOException $e) { |
|
3297 | 3297 | return "error : ".$e->getMessage(); |
3298 | 3298 | } |
3299 | 3299 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3307,7 +3307,7 @@ discard block |
||
3307 | 3307 | $Connection = new Connection(); |
3308 | 3308 | $sth = $Connection->db->prepare($query); |
3309 | 3309 | $sth->execute(array(':version' => $version)); |
3310 | - } catch(PDOException $e) { |
|
3310 | + } catch (PDOException $e) { |
|
3311 | 3311 | return "error : ".$e->getMessage(); |
3312 | 3312 | } |
3313 | 3313 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3322,7 +3322,7 @@ discard block |
||
3322 | 3322 | $Connection = new Connection(); |
3323 | 3323 | $sth = $Connection->db->prepare($query); |
3324 | 3324 | $sth->execute(array(':version' => $version)); |
3325 | - } catch(PDOException $e) { |
|
3325 | + } catch (PDOException $e) { |
|
3326 | 3326 | return "error : ".$e->getMessage(); |
3327 | 3327 | } |
3328 | 3328 | } |
@@ -3334,7 +3334,7 @@ discard block |
||
3334 | 3334 | $Connection = new Connection(); |
3335 | 3335 | $sth = $Connection->db->prepare($query); |
3336 | 3336 | $sth->execute(array(':version' => $version)); |
3337 | - } catch(PDOException $e) { |
|
3337 | + } catch (PDOException $e) { |
|
3338 | 3338 | return "error : ".$e->getMessage(); |
3339 | 3339 | } |
3340 | 3340 | } |
@@ -3346,7 +3346,7 @@ discard block |
||
3346 | 3346 | $Connection = new Connection(); |
3347 | 3347 | $sth = $Connection->db->prepare($query); |
3348 | 3348 | $sth->execute(array(':version' => $version)); |
3349 | - } catch(PDOException $e) { |
|
3349 | + } catch (PDOException $e) { |
|
3350 | 3350 | return "error : ".$e->getMessage(); |
3351 | 3351 | } |
3352 | 3352 | } |
@@ -3358,7 +3358,7 @@ discard block |
||
3358 | 3358 | $Connection = new Connection(); |
3359 | 3359 | $sth = $Connection->db->prepare($query); |
3360 | 3360 | $sth->execute(array(':version' => $version)); |
3361 | - } catch(PDOException $e) { |
|
3361 | + } catch (PDOException $e) { |
|
3362 | 3362 | return "error : ".$e->getMessage(); |
3363 | 3363 | } |
3364 | 3364 | } |
@@ -3370,7 +3370,7 @@ discard block |
||
3370 | 3370 | $Connection = new Connection(); |
3371 | 3371 | $sth = $Connection->db->prepare($query); |
3372 | 3372 | $sth->execute(array(':version' => $version)); |
3373 | - } catch(PDOException $e) { |
|
3373 | + } catch (PDOException $e) { |
|
3374 | 3374 | return "error : ".$e->getMessage(); |
3375 | 3375 | } |
3376 | 3376 | } |
@@ -3382,7 +3382,7 @@ discard block |
||
3382 | 3382 | $Connection = new Connection(); |
3383 | 3383 | $sth = $Connection->db->prepare($query); |
3384 | 3384 | $sth->execute(array(':version' => $version)); |
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); |
@@ -3692,7 +3692,7 @@ discard block |
||
3692 | 3692 | $Connection = new Connection(); |
3693 | 3693 | $sth = $Connection->db->prepare($query); |
3694 | 3694 | $sth->execute(); |
3695 | - } catch(PDOException $e) { |
|
3695 | + } catch (PDOException $e) { |
|
3696 | 3696 | return "error : ".$e->getMessage(); |
3697 | 3697 | } |
3698 | 3698 | } |
@@ -3708,7 +3708,7 @@ discard block |
||
3708 | 3708 | $Connection = new Connection(); |
3709 | 3709 | $sth = $Connection->db->prepare($query); |
3710 | 3710 | $sth->execute(); |
3711 | - } catch(PDOException $e) { |
|
3711 | + } catch (PDOException $e) { |
|
3712 | 3712 | return "error : ".$e->getMessage(); |
3713 | 3713 | } |
3714 | 3714 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3727,7 +3727,7 @@ discard block |
||
3727 | 3727 | $Connection = new Connection(); |
3728 | 3728 | $sth = $Connection->db->prepare($query); |
3729 | 3729 | $sth->execute(); |
3730 | - } catch(PDOException $e) { |
|
3730 | + } catch (PDOException $e) { |
|
3731 | 3731 | return "error : ".$e->getMessage(); |
3732 | 3732 | } |
3733 | 3733 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3742,7 +3742,7 @@ discard block |
||
3742 | 3742 | $Connection = new Connection(); |
3743 | 3743 | $sth = $Connection->db->prepare($query); |
3744 | 3744 | $sth->execute(); |
3745 | - } catch(PDOException $e) { |
|
3745 | + } catch (PDOException $e) { |
|
3746 | 3746 | return "error : ".$e->getMessage(); |
3747 | 3747 | } |
3748 | 3748 | } |
@@ -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 | } |
@@ -3770,7 +3770,7 @@ discard block |
||
3770 | 3770 | $Connection = new Connection(); |
3771 | 3771 | $sth = $Connection->db->prepare($query); |
3772 | 3772 | $sth->execute(); |
3773 | - } catch(PDOException $e) { |
|
3773 | + } catch (PDOException $e) { |
|
3774 | 3774 | return "error : ".$e->getMessage(); |
3775 | 3775 | } |
3776 | 3776 | } |
@@ -3785,7 +3785,7 @@ discard block |
||
3785 | 3785 | $Connection = new Connection(); |
3786 | 3786 | $sth = $Connection->db->prepare($query); |
3787 | 3787 | $sth->execute(); |
3788 | - } catch(PDOException $e) { |
|
3788 | + } catch (PDOException $e) { |
|
3789 | 3789 | return "error : ".$e->getMessage(); |
3790 | 3790 | } |
3791 | 3791 | } |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
27 | 27 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
28 | 28 | curl_setopt($ch, CURLOPT_TIMEOUT, 200); |
29 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
29 | + if ($referer != '') { |
|
30 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
31 | + } |
|
30 | 32 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
31 | 33 | curl_setopt($ch, CURLOPT_FILE, $fp); |
32 | 34 | curl_exec($ch); |
@@ -37,12 +39,16 @@ discard block |
||
37 | 39 | public static function gunzip($in_file,$out_file_name = '') { |
38 | 40 | //echo $in_file.' -> '.$out_file_name."\n"; |
39 | 41 | $buffer_size = 4096; // read 4kb at a time |
40 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
42 | + if ($out_file_name == '') { |
|
43 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
44 | + } |
|
41 | 45 | if ($in_file != '' && file_exists($in_file)) { |
42 | 46 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
43 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
44 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
45 | - else { |
|
47 | + if (function_exists('gzopen')) { |
|
48 | + $file = gzopen($in_file,'rb'); |
|
49 | + } elseif (function_exists('gzopen64')) { |
|
50 | + $file = gzopen64($in_file,'rb'); |
|
51 | + } else { |
|
46 | 52 | echo 'gzopen not available'; |
47 | 53 | die; |
48 | 54 | } |
@@ -63,8 +69,12 @@ discard block |
||
63 | 69 | if ($res === TRUE) { |
64 | 70 | $zip->extractTo($path); |
65 | 71 | $zip->close(); |
66 | - } else return false; |
|
67 | - } else return false; |
|
72 | + } else { |
|
73 | + return false; |
|
74 | + } |
|
75 | + } else { |
|
76 | + return false; |
|
77 | + } |
|
68 | 78 | } |
69 | 79 | |
70 | 80 | public static function connect_sqlite($database) { |
@@ -79,7 +89,9 @@ discard block |
||
79 | 89 | public static function retrieve_route_sqlite_to_dest($database_file) { |
80 | 90 | global $globalDebug, $globalTransaction; |
81 | 91 | //$query = 'TRUNCATE TABLE routes'; |
82 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
92 | + if ($globalDebug) { |
|
93 | + echo " - Delete previous routes from DB -"; |
|
94 | + } |
|
83 | 95 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
84 | 96 | $Connection = new Connection(); |
85 | 97 | try { |
@@ -90,7 +102,9 @@ discard block |
||
90 | 102 | return "error : ".$e->getMessage(); |
91 | 103 | } |
92 | 104 | |
93 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
105 | + if ($globalDebug) { |
|
106 | + echo " - Add routes to DB -"; |
|
107 | + } |
|
94 | 108 | update_db::connect_sqlite($database_file); |
95 | 109 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
96 | 110 | $query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID"; |
@@ -105,15 +119,21 @@ discard block |
||
105 | 119 | $Connection = new Connection(); |
106 | 120 | $sth_dest = $Connection->db->prepare($query_dest); |
107 | 121 | try { |
108 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
122 | + if ($globalTransaction) { |
|
123 | + $Connection->db->beginTransaction(); |
|
124 | + } |
|
109 | 125 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
110 | 126 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
111 | 127 | $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
112 | 128 | $sth_dest->execute($query_dest_values); |
113 | 129 | } |
114 | - if ($globalTransaction) $Connection->db->commit(); |
|
130 | + if ($globalTransaction) { |
|
131 | + $Connection->db->commit(); |
|
132 | + } |
|
115 | 133 | } catch(PDOException $e) { |
116 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
134 | + if ($globalTransaction) { |
|
135 | + $Connection->db->rollBack(); |
|
136 | + } |
|
117 | 137 | return "error : ".$e->getMessage(); |
118 | 138 | } |
119 | 139 | return ''; |
@@ -121,7 +141,9 @@ discard block |
||
121 | 141 | public static function retrieve_route_oneworld($database_file) { |
122 | 142 | global $globalDebug, $globalTransaction; |
123 | 143 | //$query = 'TRUNCATE TABLE routes'; |
124 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
144 | + if ($globalDebug) { |
|
145 | + echo " - Delete previous routes from DB -"; |
|
146 | + } |
|
125 | 147 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
126 | 148 | $Connection = new Connection(); |
127 | 149 | try { |
@@ -132,14 +154,18 @@ discard block |
||
132 | 154 | return "error : ".$e->getMessage(); |
133 | 155 | } |
134 | 156 | |
135 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
157 | + if ($globalDebug) { |
|
158 | + echo " - Add routes to DB -"; |
|
159 | + } |
|
136 | 160 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
137 | 161 | $Spotter = new Spotter(); |
138 | 162 | if ($fh = fopen($database_file,"r")) { |
139 | 163 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
140 | 164 | $Connection = new Connection(); |
141 | 165 | $sth_dest = $Connection->db->prepare($query_dest); |
142 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
166 | + if ($globalTransaction) { |
|
167 | + $Connection->db->beginTransaction(); |
|
168 | + } |
|
143 | 169 | while (!feof($fh)) { |
144 | 170 | $line = fgetcsv($fh,9999,','); |
145 | 171 | if ($line[0] != '') { |
@@ -148,13 +174,17 @@ discard block |
||
148 | 174 | $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
149 | 175 | $sth_dest->execute($query_dest_values); |
150 | 176 | } catch(PDOException $e) { |
151 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
177 | + if ($globalTransaction) { |
|
178 | + $Connection->db->rollBack(); |
|
179 | + } |
|
152 | 180 | return "error : ".$e->getMessage(); |
153 | 181 | } |
154 | 182 | } |
155 | 183 | } |
156 | 184 | } |
157 | - if ($globalTransaction) $Connection->db->commit(); |
|
185 | + if ($globalTransaction) { |
|
186 | + $Connection->db->commit(); |
|
187 | + } |
|
158 | 188 | } |
159 | 189 | return ''; |
160 | 190 | } |
@@ -162,7 +192,9 @@ discard block |
||
162 | 192 | public static function retrieve_route_skyteam($database_file) { |
163 | 193 | global $globalDebug, $globalTransaction; |
164 | 194 | //$query = 'TRUNCATE TABLE routes'; |
165 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
195 | + if ($globalDebug) { |
|
196 | + echo " - Delete previous routes from DB -"; |
|
197 | + } |
|
166 | 198 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
167 | 199 | $Connection = new Connection(); |
168 | 200 | try { |
@@ -173,7 +205,9 @@ discard block |
||
173 | 205 | return "error : ".$e->getMessage(); |
174 | 206 | } |
175 | 207 | |
176 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
208 | + if ($globalDebug) { |
|
209 | + echo " - Add routes to DB -"; |
|
210 | + } |
|
177 | 211 | |
178 | 212 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
179 | 213 | $Spotter = new Spotter(); |
@@ -182,7 +216,9 @@ discard block |
||
182 | 216 | $Connection = new Connection(); |
183 | 217 | $sth_dest = $Connection->db->prepare($query_dest); |
184 | 218 | try { |
185 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
219 | + if ($globalTransaction) { |
|
220 | + $Connection->db->beginTransaction(); |
|
221 | + } |
|
186 | 222 | while (!feof($fh)) { |
187 | 223 | $line = fgetcsv($fh,9999,','); |
188 | 224 | if ($line[0] != '') { |
@@ -193,9 +229,13 @@ discard block |
||
193 | 229 | } |
194 | 230 | } |
195 | 231 | } |
196 | - if ($globalTransaction) $Connection->db->commit(); |
|
232 | + if ($globalTransaction) { |
|
233 | + $Connection->db->commit(); |
|
234 | + } |
|
197 | 235 | } catch(PDOException $e) { |
198 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
236 | + if ($globalTransaction) { |
|
237 | + $Connection->db->rollBack(); |
|
238 | + } |
|
199 | 239 | return "error : ".$e->getMessage(); |
200 | 240 | } |
201 | 241 | } |
@@ -238,11 +278,16 @@ discard block |
||
238 | 278 | $sth_dest = $Connection->db->prepare($query_dest); |
239 | 279 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
240 | 280 | try { |
241 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
281 | + if ($globalTransaction) { |
|
282 | + $Connection->db->beginTransaction(); |
|
283 | + } |
|
242 | 284 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
243 | 285 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
244 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
245 | - else $type = null; |
|
286 | + if ($values['UserString4'] == 'M') { |
|
287 | + $type = 'military'; |
|
288 | + } else { |
|
289 | + $type = null; |
|
290 | + } |
|
246 | 291 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
247 | 292 | $sth_dest->execute($query_dest_values); |
248 | 293 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -250,7 +295,9 @@ discard block |
||
250 | 295 | $sth_dest_owner->execute($query_dest_owner_values); |
251 | 296 | } |
252 | 297 | } |
253 | - if ($globalTransaction) $Connection->db->commit(); |
|
298 | + if ($globalTransaction) { |
|
299 | + $Connection->db->commit(); |
|
300 | + } |
|
254 | 301 | } catch(PDOException $e) { |
255 | 302 | return "error : ".$e->getMessage(); |
256 | 303 | } |
@@ -287,7 +334,9 @@ discard block |
||
287 | 334 | $Connection = new Connection(); |
288 | 335 | $sth_dest = $Connection->db->prepare($query_dest); |
289 | 336 | try { |
290 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
337 | + if ($globalTransaction) { |
|
338 | + $Connection->db->beginTransaction(); |
|
339 | + } |
|
291 | 340 | while (!feof($fh)) { |
292 | 341 | $values = array(); |
293 | 342 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -298,7 +347,9 @@ discard block |
||
298 | 347 | // Check if we can find ICAO, else set it to GLID |
299 | 348 | $aircraft_name_split = explode(' ',$aircraft_name); |
300 | 349 | $search_more = ''; |
301 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
350 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
351 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
352 | + } |
|
302 | 353 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
303 | 354 | $sth_search = $Connection->db->prepare($query_search); |
304 | 355 | try { |
@@ -311,7 +362,9 @@ discard block |
||
311 | 362 | } catch(PDOException $e) { |
312 | 363 | return "error : ".$e->getMessage(); |
313 | 364 | } |
314 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
365 | + if (!isset($values['ICAOTypeCode'])) { |
|
366 | + $values['ICAOTypeCode'] = 'GLID'; |
|
367 | + } |
|
315 | 368 | // Add data to db |
316 | 369 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
317 | 370 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
@@ -320,7 +373,9 @@ discard block |
||
320 | 373 | $sth_dest->execute($query_dest_values); |
321 | 374 | } |
322 | 375 | } |
323 | - if ($globalTransaction) $Connection->db->commit(); |
|
376 | + if ($globalTransaction) { |
|
377 | + $Connection->db->commit(); |
|
378 | + } |
|
324 | 379 | } catch(PDOException $e) { |
325 | 380 | return "error : ".$e->getMessage(); |
326 | 381 | } |
@@ -356,7 +411,9 @@ discard block |
||
356 | 411 | $Connection = new Connection(); |
357 | 412 | $sth_dest = $Connection->db->prepare($query_dest); |
358 | 413 | try { |
359 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
414 | + if ($globalTransaction) { |
|
415 | + $Connection->db->beginTransaction(); |
|
416 | + } |
|
360 | 417 | $tmp = fgetcsv($fh,9999,',',"'"); |
361 | 418 | while (!feof($fh)) { |
362 | 419 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -370,13 +427,17 @@ discard block |
||
370 | 427 | // Check if we can find ICAO, else set it to GLID |
371 | 428 | $aircraft_name_split = explode(' ',$aircraft_name); |
372 | 429 | $search_more = ''; |
373 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
430 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
431 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
432 | + } |
|
374 | 433 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
375 | 434 | $sth_search = $Connection->db->prepare($query_search); |
376 | 435 | try { |
377 | 436 | $sth_search->execute(); |
378 | 437 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
379 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
438 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
439 | + $values['ICAOTypeCode'] = $result['icao']; |
|
440 | + } |
|
380 | 441 | } catch(PDOException $e) { |
381 | 442 | return "error : ".$e->getMessage(); |
382 | 443 | } |
@@ -389,7 +450,9 @@ discard block |
||
389 | 450 | $sth_dest->execute($query_dest_values); |
390 | 451 | } |
391 | 452 | } |
392 | - if ($globalTransaction) $Connection->db->commit(); |
|
453 | + if ($globalTransaction) { |
|
454 | + $Connection->db->commit(); |
|
455 | + } |
|
393 | 456 | } catch(PDOException $e) { |
394 | 457 | return "error : ".$e->getMessage(); |
395 | 458 | } |
@@ -428,7 +491,9 @@ discard block |
||
428 | 491 | $sth_dest = $Connection->db->prepare($query_dest); |
429 | 492 | $sth_modes = $Connection->db->prepare($query_modes); |
430 | 493 | try { |
431 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
494 | + if ($globalTransaction) { |
|
495 | + $Connection->db->beginTransaction(); |
|
496 | + } |
|
432 | 497 | $tmp = fgetcsv($fh,9999,',','"'); |
433 | 498 | while (!feof($fh)) { |
434 | 499 | $line = fgetcsv($fh,9999,',','"'); |
@@ -438,16 +503,22 @@ discard block |
||
438 | 503 | $values['registration'] = $line[0]; |
439 | 504 | $values['base'] = $line[4]; |
440 | 505 | $values['owner'] = $line[5]; |
441 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
442 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
506 | + if ($line[6] == '') { |
|
507 | + $values['date_first_reg'] = null; |
|
508 | + } else { |
|
509 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
510 | + } |
|
443 | 511 | $values['cancel'] = $line[7]; |
444 | 512 | } elseif ($country == 'EI') { |
445 | 513 | // TODO : add modeS & reg to aircraft_modes |
446 | 514 | $values['registration'] = $line[0]; |
447 | 515 | $values['base'] = $line[3]; |
448 | 516 | $values['owner'] = $line[2]; |
449 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
517 | + if ($line[1] == '') { |
|
518 | + $values['date_first_reg'] = null; |
|
519 | + } else { |
|
520 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
521 | + } |
|
451 | 522 | $values['cancel'] = ''; |
452 | 523 | $values['modes'] = $line[7]; |
453 | 524 | $values['icao'] = $line[8]; |
@@ -466,16 +537,22 @@ discard block |
||
466 | 537 | $values['registration'] = $line[3]; |
467 | 538 | $values['base'] = null; |
468 | 539 | $values['owner'] = $line[5]; |
469 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
470 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
540 | + if ($line[18] == '') { |
|
541 | + $values['date_first_reg'] = null; |
|
542 | + } else { |
|
543 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
544 | + } |
|
471 | 545 | $values['cancel'] = ''; |
472 | 546 | } elseif ($country == 'VH') { |
473 | 547 | // TODO : add modeS & reg to aircraft_modes |
474 | 548 | $values['registration'] = $line[0]; |
475 | 549 | $values['base'] = null; |
476 | 550 | $values['owner'] = $line[12]; |
477 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
551 | + if ($line[28] == '') { |
|
552 | + $values['date_first_reg'] = null; |
|
553 | + } else { |
|
554 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
555 | + } |
|
479 | 556 | |
480 | 557 | $values['cancel'] = $line[39]; |
481 | 558 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -494,29 +571,41 @@ discard block |
||
494 | 571 | $values['registration'] = $line[0]; |
495 | 572 | $values['base'] = null; |
496 | 573 | $values['owner'] = $line[8]; |
497 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
498 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
574 | + if ($line[7] == '') { |
|
575 | + $values['date_first_reg'] = null; |
|
576 | + } else { |
|
577 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
578 | + } |
|
499 | 579 | $values['cancel'] = ''; |
500 | 580 | } elseif ($country == 'PP') { |
501 | 581 | $values['registration'] = $line[0]; |
502 | 582 | $values['base'] = null; |
503 | 583 | $values['owner'] = $line[4]; |
504 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
505 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
584 | + if ($line[6] == '') { |
|
585 | + $values['date_first_reg'] = null; |
|
586 | + } else { |
|
587 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
588 | + } |
|
506 | 589 | $values['cancel'] = $line[7]; |
507 | 590 | } elseif ($country == 'E7') { |
508 | 591 | $values['registration'] = $line[0]; |
509 | 592 | $values['base'] = null; |
510 | 593 | $values['owner'] = $line[4]; |
511 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
512 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
594 | + if ($line[5] == '') { |
|
595 | + $values['date_first_reg'] = null; |
|
596 | + } else { |
|
597 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
598 | + } |
|
513 | 599 | $values['cancel'] = ''; |
514 | 600 | } elseif ($country == '8Q') { |
515 | 601 | $values['registration'] = $line[0]; |
516 | 602 | $values['base'] = null; |
517 | 603 | $values['owner'] = $line[3]; |
518 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
519 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
604 | + if ($line[7] == '') { |
|
605 | + $values['date_first_reg'] = null; |
|
606 | + } else { |
|
607 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
608 | + } |
|
520 | 609 | $values['cancel'] = ''; |
521 | 610 | } elseif ($country == 'ZK') { |
522 | 611 | $values['registration'] = $line[0]; |
@@ -561,7 +650,9 @@ discard block |
||
561 | 650 | $sth_modes->execute($query_modes_values); |
562 | 651 | } |
563 | 652 | } |
564 | - if ($globalTransaction) $Connection->db->commit(); |
|
653 | + if ($globalTransaction) { |
|
654 | + $Connection->db->commit(); |
|
655 | + } |
|
565 | 656 | } catch(PDOException $e) { |
566 | 657 | return "error : ".$e->getMessage(); |
567 | 658 | } |
@@ -697,25 +788,45 @@ discard block |
||
697 | 788 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
698 | 789 | $Connection = new Connection(); |
699 | 790 | $sth_dest = $Connection->db->prepare($query_dest); |
700 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
791 | + if ($globalTransaction) { |
|
792 | + $Connection->db->beginTransaction(); |
|
793 | + } |
|
701 | 794 | |
702 | 795 | $i = 0; |
703 | 796 | while($row = sparql_fetch_array($result)) |
704 | 797 | { |
705 | 798 | if ($i >= 1) { |
706 | 799 | //print_r($row); |
707 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
708 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
709 | - if (!isset($row['type'])) $row['type'] = ''; |
|
710 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
800 | + if (!isset($row['iata'])) { |
|
801 | + $row['iata'] = ''; |
|
802 | + } |
|
803 | + if (!isset($row['icao'])) { |
|
804 | + $row['icao'] = ''; |
|
805 | + } |
|
806 | + if (!isset($row['type'])) { |
|
807 | + $row['type'] = ''; |
|
808 | + } |
|
809 | + if (!isset($row['altitude'])) { |
|
810 | + $row['altitude'] = ''; |
|
811 | + } |
|
711 | 812 | if (isset($row['city_bis'])) { |
712 | 813 | $row['city'] = $row['city_bis']; |
713 | 814 | } |
714 | - if (!isset($row['city'])) $row['city'] = ''; |
|
715 | - if (!isset($row['country'])) $row['country'] = ''; |
|
716 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
717 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
718 | - if (!isset($row['name'])) continue; |
|
815 | + if (!isset($row['city'])) { |
|
816 | + $row['city'] = ''; |
|
817 | + } |
|
818 | + if (!isset($row['country'])) { |
|
819 | + $row['country'] = ''; |
|
820 | + } |
|
821 | + if (!isset($row['homepage'])) { |
|
822 | + $row['homepage'] = ''; |
|
823 | + } |
|
824 | + if (!isset($row['wikipedia_page'])) { |
|
825 | + $row['wikipedia_page'] = ''; |
|
826 | + } |
|
827 | + if (!isset($row['name'])) { |
|
828 | + continue; |
|
829 | + } |
|
719 | 830 | if (!isset($row['image'])) { |
720 | 831 | $row['image'] = ''; |
721 | 832 | $row['image_thumb'] = ''; |
@@ -771,7 +882,9 @@ discard block |
||
771 | 882 | |
772 | 883 | $i++; |
773 | 884 | } |
774 | - if ($globalTransaction) $Connection->db->commit(); |
|
885 | + if ($globalTransaction) { |
|
886 | + $Connection->db->commit(); |
|
887 | + } |
|
775 | 888 | /* |
776 | 889 | echo "Delete duplicate rows...\n"; |
777 | 890 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
@@ -814,7 +927,9 @@ discard block |
||
814 | 927 | $delimiter = ','; |
815 | 928 | $out_file = $tmp_dir.'airports.csv'; |
816 | 929 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
817 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
930 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
931 | + return FALSE; |
|
932 | + } |
|
818 | 933 | echo "Add data from ourairports.com...\n"; |
819 | 934 | |
820 | 935 | $header = NULL; |
@@ -824,8 +939,9 @@ discard block |
||
824 | 939 | //$Connection->db->beginTransaction(); |
825 | 940 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
826 | 941 | { |
827 | - if(!$header) $header = $row; |
|
828 | - else { |
|
942 | + if(!$header) { |
|
943 | + $header = $row; |
|
944 | + } else { |
|
829 | 945 | $data = array(); |
830 | 946 | $data = array_combine($header, $row); |
831 | 947 | try { |
@@ -866,7 +982,9 @@ discard block |
||
866 | 982 | echo "Download data from another free database...\n"; |
867 | 983 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
868 | 984 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
869 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
985 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
986 | + return FALSE; |
|
987 | + } |
|
870 | 988 | update_db::unzip($out_file); |
871 | 989 | $header = NULL; |
872 | 990 | echo "Add data from another free database...\n"; |
@@ -877,8 +995,9 @@ discard block |
||
877 | 995 | //$Connection->db->beginTransaction(); |
878 | 996 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
879 | 997 | { |
880 | - if(!$header) $header = $row; |
|
881 | - else { |
|
998 | + if(!$header) { |
|
999 | + $header = $row; |
|
1000 | + } else { |
|
882 | 1001 | $data = $row; |
883 | 1002 | |
884 | 1003 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
@@ -1047,7 +1166,9 @@ discard block |
||
1047 | 1166 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
1048 | 1167 | { |
1049 | 1168 | $i = 0; |
1050 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1169 | + if ($globalTransaction) { |
|
1170 | + $Connection->db->beginTransaction(); |
|
1171 | + } |
|
1051 | 1172 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1052 | 1173 | { |
1053 | 1174 | if ($i > 0) { |
@@ -1060,7 +1181,9 @@ discard block |
||
1060 | 1181 | } |
1061 | 1182 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
1062 | 1183 | if (!empty($result_search)) { |
1063 | - if ($globalDebug) echo '.'; |
|
1184 | + if ($globalDebug) { |
|
1185 | + echo '.'; |
|
1186 | + } |
|
1064 | 1187 | //if ($globalDBdriver == 'mysql') { |
1065 | 1188 | // $queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao'; |
1066 | 1189 | //} else { |
@@ -1082,8 +1205,12 @@ discard block |
||
1082 | 1205 | } |
1083 | 1206 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
1084 | 1207 | if (!empty($result_search_mfr)) { |
1085 | - if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23]; |
|
1086 | - if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15]; |
|
1208 | + if (trim($data[16]) == '' && trim($data[23]) != '') { |
|
1209 | + $data[16] = $data[23]; |
|
1210 | + } |
|
1211 | + if (trim($data[16]) == '' && trim($data[15]) != '') { |
|
1212 | + $data[16] = $data[15]; |
|
1213 | + } |
|
1087 | 1214 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1088 | 1215 | try { |
1089 | 1216 | $sthf = $Connection->db->prepare($queryf); |
@@ -1094,7 +1221,9 @@ discard block |
||
1094 | 1221 | } |
1095 | 1222 | } |
1096 | 1223 | if (strtotime($data[29]) > time()) { |
1097 | - if ($globalDebug) echo 'i'; |
|
1224 | + if ($globalDebug) { |
|
1225 | + echo 'i'; |
|
1226 | + } |
|
1098 | 1227 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1099 | 1228 | try { |
1100 | 1229 | $sth = $Connection->db->prepare($query); |
@@ -1105,13 +1234,19 @@ discard block |
||
1105 | 1234 | } |
1106 | 1235 | } |
1107 | 1236 | if ($i % 90 == 0) { |
1108 | - if ($globalTransaction) $Connection->db->commit(); |
|
1109 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1237 | + if ($globalTransaction) { |
|
1238 | + $Connection->db->commit(); |
|
1239 | + } |
|
1240 | + if ($globalTransaction) { |
|
1241 | + $Connection->db->beginTransaction(); |
|
1242 | + } |
|
1110 | 1243 | } |
1111 | 1244 | $i++; |
1112 | 1245 | } |
1113 | 1246 | fclose($handle); |
1114 | - if ($globalTransaction) $Connection->db->commit(); |
|
1247 | + if ($globalTransaction) { |
|
1248 | + $Connection->db->commit(); |
|
1249 | + } |
|
1115 | 1250 | } |
1116 | 1251 | return ''; |
1117 | 1252 | } |
@@ -1131,11 +1266,15 @@ discard block |
||
1131 | 1266 | if (($handle = fopen($tmp_dir.'modes.tsv', 'r')) !== FALSE) |
1132 | 1267 | { |
1133 | 1268 | $i = 0; |
1134 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1269 | + if ($globalTransaction) { |
|
1270 | + $Connection->db->beginTransaction(); |
|
1271 | + } |
|
1135 | 1272 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1136 | 1273 | { |
1137 | 1274 | if ($i > 0) { |
1138 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
1275 | + if ($data[1] == 'NULL') { |
|
1276 | + $data[1] = $data[0]; |
|
1277 | + } |
|
1139 | 1278 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1140 | 1279 | try { |
1141 | 1280 | $sth = $Connection->db->prepare($query); |
@@ -1147,7 +1286,9 @@ discard block |
||
1147 | 1286 | $i++; |
1148 | 1287 | } |
1149 | 1288 | fclose($handle); |
1150 | - if ($globalTransaction) $Connection->db->commit(); |
|
1289 | + if ($globalTransaction) { |
|
1290 | + $Connection->db->commit(); |
|
1291 | + } |
|
1151 | 1292 | } |
1152 | 1293 | return ''; |
1153 | 1294 | } |
@@ -1179,11 +1320,15 @@ discard block |
||
1179 | 1320 | if (($handle = fopen($tmp_dir.'airlines.tsv', 'r')) !== FALSE) |
1180 | 1321 | { |
1181 | 1322 | $i = 0; |
1182 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1323 | + if ($globalTransaction) { |
|
1324 | + $Connection->db->beginTransaction(); |
|
1325 | + } |
|
1183 | 1326 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1184 | 1327 | { |
1185 | 1328 | if ($i > 0) { |
1186 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
1329 | + if ($data[1] == 'NULL') { |
|
1330 | + $data[1] = $data[0]; |
|
1331 | + } |
|
1187 | 1332 | $query = 'INSERT INTO airlines (airline_id,name,alias,iata,icao,callsign,country,active,type,home_link,wikipedia_link,alliance,ban_eu) VALUES (0,:name,:alias,:iata,:icao,:callsign,:country,:active,:type,:home,:wikipedia_link,:alliance,:ban_eu)'; |
1188 | 1333 | try { |
1189 | 1334 | $sth = $Connection->db->prepare($query); |
@@ -1195,7 +1340,9 @@ discard block |
||
1195 | 1340 | $i++; |
1196 | 1341 | } |
1197 | 1342 | fclose($handle); |
1198 | - if ($globalTransaction) $Connection->db->commit(); |
|
1343 | + if ($globalTransaction) { |
|
1344 | + $Connection->db->commit(); |
|
1345 | + } |
|
1199 | 1346 | } |
1200 | 1347 | /* |
1201 | 1348 | $query = "UNLOCK TABLES"; |
@@ -1225,7 +1372,9 @@ discard block |
||
1225 | 1372 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
1226 | 1373 | { |
1227 | 1374 | $i = 0; |
1228 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1375 | + if ($globalTransaction) { |
|
1376 | + $Connection->db->beginTransaction(); |
|
1377 | + } |
|
1229 | 1378 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1230 | 1379 | { |
1231 | 1380 | if ($i > 0) { |
@@ -1241,7 +1390,9 @@ discard block |
||
1241 | 1390 | $i++; |
1242 | 1391 | } |
1243 | 1392 | fclose($handle); |
1244 | - if ($globalTransaction) $Connection->db->commit(); |
|
1393 | + if ($globalTransaction) { |
|
1394 | + $Connection->db->commit(); |
|
1395 | + } |
|
1245 | 1396 | } |
1246 | 1397 | return ''; |
1247 | 1398 | } |
@@ -1261,7 +1412,9 @@ discard block |
||
1261 | 1412 | if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE) |
1262 | 1413 | { |
1263 | 1414 | $i = 0; |
1264 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1415 | + if ($globalTransaction) { |
|
1416 | + $Connection->db->beginTransaction(); |
|
1417 | + } |
|
1265 | 1418 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1266 | 1419 | { |
1267 | 1420 | if ($i > 0) { |
@@ -1271,19 +1424,25 @@ discard block |
||
1271 | 1424 | $sth = $Connection->db->prepare($query); |
1272 | 1425 | $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
1273 | 1426 | } catch(PDOException $e) { |
1274 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1427 | + if ($globalDebug) { |
|
1428 | + echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1429 | + } |
|
1275 | 1430 | die(); |
1276 | 1431 | } |
1277 | 1432 | } |
1278 | 1433 | if ($globalTransaction && $i % 2000 == 0) { |
1279 | 1434 | $Connection->db->commit(); |
1280 | - if ($globalDebug) echo '.'; |
|
1435 | + if ($globalDebug) { |
|
1436 | + echo '.'; |
|
1437 | + } |
|
1281 | 1438 | $Connection->db->beginTransaction(); |
1282 | 1439 | } |
1283 | 1440 | $i++; |
1284 | 1441 | } |
1285 | 1442 | fclose($handle); |
1286 | - if ($globalTransaction) $Connection->db->commit(); |
|
1443 | + if ($globalTransaction) { |
|
1444 | + $Connection->db->commit(); |
|
1445 | + } |
|
1287 | 1446 | } |
1288 | 1447 | return ''; |
1289 | 1448 | } |
@@ -1302,7 +1461,9 @@ discard block |
||
1302 | 1461 | if (($handle = fopen($tmp_dir.'block.tsv', 'r')) !== FALSE) |
1303 | 1462 | { |
1304 | 1463 | $i = 0; |
1305 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1464 | + if ($globalTransaction) { |
|
1465 | + $Connection->db->beginTransaction(); |
|
1466 | + } |
|
1306 | 1467 | while (($data = fgets($handle, 1000)) !== FALSE) |
1307 | 1468 | { |
1308 | 1469 | $query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)'; |
@@ -1310,18 +1471,24 @@ discard block |
||
1310 | 1471 | $sth = $Connection->db->prepare($query); |
1311 | 1472 | $sth->execute(array(':callSign' => trim($data),':source' => 'website_fam')); |
1312 | 1473 | } catch(PDOException $e) { |
1313 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data; |
|
1474 | + if ($globalDebug) { |
|
1475 | + echo "error: ".$e->getMessage()." - data: ".$data; |
|
1476 | + } |
|
1314 | 1477 | die(); |
1315 | 1478 | } |
1316 | 1479 | if ($globalTransaction && $i % 2000 == 0) { |
1317 | 1480 | $Connection->db->commit(); |
1318 | - if ($globalDebug) echo '.'; |
|
1481 | + if ($globalDebug) { |
|
1482 | + echo '.'; |
|
1483 | + } |
|
1319 | 1484 | $Connection->db->beginTransaction(); |
1320 | 1485 | } |
1321 | 1486 | $i++; |
1322 | 1487 | } |
1323 | 1488 | fclose($handle); |
1324 | - if ($globalTransaction) $Connection->db->commit(); |
|
1489 | + if ($globalTransaction) { |
|
1490 | + $Connection->db->commit(); |
|
1491 | + } |
|
1325 | 1492 | } |
1326 | 1493 | return ''; |
1327 | 1494 | } |
@@ -1346,7 +1513,9 @@ discard block |
||
1346 | 1513 | $i = 0; |
1347 | 1514 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1348 | 1515 | //$Connection->db->beginTransaction(); |
1349 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1516 | + if ($globalTransaction) { |
|
1517 | + $Connection->db->beginTransaction(); |
|
1518 | + } |
|
1350 | 1519 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1351 | 1520 | { |
1352 | 1521 | if ($i > 0) { |
@@ -1362,7 +1531,9 @@ discard block |
||
1362 | 1531 | $i++; |
1363 | 1532 | } |
1364 | 1533 | fclose($handle); |
1365 | - if ($globalTransaction) $Connection->db->commit(); |
|
1534 | + if ($globalTransaction) { |
|
1535 | + $Connection->db->commit(); |
|
1536 | + } |
|
1366 | 1537 | } |
1367 | 1538 | return ''; |
1368 | 1539 | } |
@@ -1382,7 +1553,9 @@ discard block |
||
1382 | 1553 | if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE) |
1383 | 1554 | { |
1384 | 1555 | $i = 0; |
1385 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1556 | + if ($globalTransaction) { |
|
1557 | + $Connection->db->beginTransaction(); |
|
1558 | + } |
|
1386 | 1559 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1387 | 1560 | { |
1388 | 1561 | if ($i > 0) { |
@@ -1399,7 +1572,9 @@ discard block |
||
1399 | 1572 | $i++; |
1400 | 1573 | } |
1401 | 1574 | fclose($handle); |
1402 | - if ($globalTransaction) $Connection->db->commit(); |
|
1575 | + if ($globalTransaction) { |
|
1576 | + $Connection->db->commit(); |
|
1577 | + } |
|
1403 | 1578 | } |
1404 | 1579 | return ''; |
1405 | 1580 | } |
@@ -1418,7 +1593,9 @@ discard block |
||
1418 | 1593 | $Connection = new Connection(); |
1419 | 1594 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
1420 | 1595 | { |
1421 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1596 | + if ($globalTransaction) { |
|
1597 | + $Connection->db->beginTransaction(); |
|
1598 | + } |
|
1422 | 1599 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
1423 | 1600 | { |
1424 | 1601 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1433,7 +1610,9 @@ discard block |
||
1433 | 1610 | } |
1434 | 1611 | } |
1435 | 1612 | fclose($handle); |
1436 | - if ($globalTransaction) $Connection->db->commit(); |
|
1613 | + if ($globalTransaction) { |
|
1614 | + $Connection->db->commit(); |
|
1615 | + } |
|
1437 | 1616 | } |
1438 | 1617 | return ''; |
1439 | 1618 | } |
@@ -1511,9 +1690,14 @@ discard block |
||
1511 | 1690 | if ($i > 0 && $data[0] != '') { |
1512 | 1691 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1513 | 1692 | $period = str_replace(',','',$data[14]); |
1514 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1515 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1516 | - else $launch_date = NULL; |
|
1693 | + if (!empty($period) && strpos($period,'days')) { |
|
1694 | + $period = str_replace(' days','',$period)*24*60; |
|
1695 | + } |
|
1696 | + if ($data[18] != '') { |
|
1697 | + $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1698 | + } else { |
|
1699 | + $launch_date = NULL; |
|
1700 | + } |
|
1517 | 1701 | $data = array_map(function($value) { |
1518 | 1702 | return trim($value) === '' ? null : $value; |
1519 | 1703 | }, $data); |
@@ -1705,10 +1889,14 @@ discard block |
||
1705 | 1889 | $owner_code = trim(substr($data,49,5)); |
1706 | 1890 | |
1707 | 1891 | if (!isset($satcat_sources[$owner_code]) && $satcat_sources[$owner_code] != 'TBD') { |
1708 | - if ($globalDebug) echo $data.'owner_code: '.$owner_code."\n"; |
|
1892 | + if ($globalDebug) { |
|
1893 | + echo $data.'owner_code: '.$owner_code."\n"; |
|
1894 | + } |
|
1709 | 1895 | } |
1710 | 1896 | if (!isset($satcat_launch_site[trim(substr($data,68,5))])) { |
1711 | - if ($globalDebug) echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
1897 | + if ($globalDebug) { |
|
1898 | + echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
1899 | + } |
|
1712 | 1900 | } |
1713 | 1901 | |
1714 | 1902 | if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data,68,5))])) { |
@@ -1875,7 +2063,9 @@ discard block |
||
1875 | 2063 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1876 | 2064 | { |
1877 | 2065 | $i = 0; |
1878 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
2066 | + if ($globalTransaction) { |
|
2067 | + $Connection->db->beginTransaction(); |
|
2068 | + } |
|
1879 | 2069 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1880 | 2070 | { |
1881 | 2071 | $i++; |
@@ -1903,7 +2093,9 @@ discard block |
||
1903 | 2093 | } |
1904 | 2094 | } |
1905 | 2095 | fclose($handle); |
1906 | - if ($globalTransaction) $Connection->db->commit(); |
|
2096 | + if ($globalTransaction) { |
|
2097 | + $Connection->db->commit(); |
|
2098 | + } |
|
1907 | 2099 | } |
1908 | 2100 | return ''; |
1909 | 2101 | } |
@@ -1919,7 +2111,9 @@ discard block |
||
1919 | 2111 | $Source->deleteLocationByType('fires'); |
1920 | 2112 | $i = 0; |
1921 | 2113 | if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) { |
1922 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
2114 | + if ($globalTransaction) { |
|
2115 | + $Connection->db->beginTransaction(); |
|
2116 | + } |
|
1923 | 2117 | while (($row = fgetcsv($handle,1000)) !== false) { |
1924 | 2118 | if ($i > 0 && $row[0] != '' && $row[8] != 'low') { |
1925 | 2119 | $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]); |
@@ -1934,7 +2128,9 @@ discard block |
||
1934 | 2128 | } |
1935 | 2129 | $i++; |
1936 | 2130 | } |
1937 | - if ($globalTransaction) $Connection->db->commit(); |
|
2131 | + if ($globalTransaction) { |
|
2132 | + $Connection->db->commit(); |
|
2133 | + } |
|
1938 | 2134 | } |
1939 | 2135 | } |
1940 | 2136 | |
@@ -1955,7 +2151,9 @@ discard block |
||
1955 | 2151 | $Connection = new Connection(); |
1956 | 2152 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1957 | 2153 | { |
1958 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
2154 | + if ($globalTransaction) { |
|
2155 | + $Connection->db->beginTransaction(); |
|
2156 | + } |
|
1959 | 2157 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1960 | 2158 | { |
1961 | 2159 | if(count($row) > 1) { |
@@ -1969,7 +2167,9 @@ discard block |
||
1969 | 2167 | } |
1970 | 2168 | } |
1971 | 2169 | fclose($handle); |
1972 | - if ($globalTransaction) $Connection->db->commit(); |
|
2170 | + if ($globalTransaction) { |
|
2171 | + $Connection->db->commit(); |
|
2172 | + } |
|
1973 | 2173 | } |
1974 | 2174 | return ''; |
1975 | 2175 | } |
@@ -1989,8 +2189,9 @@ discard block |
||
1989 | 2189 | } |
1990 | 2190 | |
1991 | 2191 | |
1992 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1993 | - else { |
|
2192 | + if ($globalDBdriver == 'mysql') { |
|
2193 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
2194 | + } else { |
|
1994 | 2195 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
1995 | 2196 | $query = "CREATE EXTENSION postgis"; |
1996 | 2197 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -2009,7 +2210,9 @@ discard block |
||
2009 | 2210 | global $tmp_dir, $globalDebug; |
2010 | 2211 | include_once('class.create_db.php'); |
2011 | 2212 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
2012 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
2213 | + if ($globalDebug) { |
|
2214 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
2215 | + } |
|
2013 | 2216 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
2014 | 2217 | $error = ''; |
2015 | 2218 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
@@ -2019,20 +2222,34 @@ discard block |
||
2019 | 2222 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
2020 | 2223 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
2021 | 2224 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
2022 | - if ($globalDebug) echo "Gunzip..."; |
|
2225 | + if ($globalDebug) { |
|
2226 | + echo "Gunzip..."; |
|
2227 | + } |
|
2023 | 2228 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
2024 | - if ($globalDebug) echo "Add to DB..."; |
|
2229 | + if ($globalDebug) { |
|
2230 | + echo "Add to DB..."; |
|
2231 | + } |
|
2025 | 2232 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
2026 | 2233 | $NOTAM = new NOTAM(); |
2027 | 2234 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
2028 | 2235 | update_db::insert_notam_version($notam_md5); |
2029 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
2030 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2031 | - } elseif ($globalDebug) echo "No new version."; |
|
2032 | - } else $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
2236 | + } else { |
|
2237 | + $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
2238 | + } |
|
2239 | + } else { |
|
2240 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2241 | + } |
|
2242 | + } elseif ($globalDebug) { |
|
2243 | + echo "No new version."; |
|
2244 | + } |
|
2245 | + } else { |
|
2246 | + $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
2247 | + } |
|
2033 | 2248 | if ($error != '') { |
2034 | 2249 | return $error; |
2035 | - } elseif ($globalDebug) echo "Done\n"; |
|
2250 | + } elseif ($globalDebug) { |
|
2251 | + echo "Done\n"; |
|
2252 | + } |
|
2036 | 2253 | return ''; |
2037 | 2254 | } |
2038 | 2255 | |
@@ -2087,68 +2304,114 @@ discard block |
||
2087 | 2304 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
2088 | 2305 | if (extension_loaded('zip')) { |
2089 | 2306 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
2090 | - if ($globalDebug) echo "Unzip..."; |
|
2307 | + if ($globalDebug) { |
|
2308 | + echo "Unzip..."; |
|
2309 | + } |
|
2091 | 2310 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
2092 | - if ($globalDebug) echo "Add to DB..."; |
|
2311 | + if ($globalDebug) { |
|
2312 | + echo "Add to DB..."; |
|
2313 | + } |
|
2093 | 2314 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
2094 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
2315 | + if ($globalDebug) { |
|
2316 | + echo "Copy airlines logos to airlines images directory..."; |
|
2317 | + } |
|
2095 | 2318 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
2096 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
2097 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
2098 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2099 | - } else $error = "ZIP module not loaded but required for IVAO."; |
|
2319 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
2320 | + $error = "Failed to copy airlines logo."; |
|
2321 | + } |
|
2322 | + } else { |
|
2323 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
2324 | + } |
|
2325 | + } else { |
|
2326 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2327 | + } |
|
2328 | + } else { |
|
2329 | + $error = "ZIP module not loaded but required for IVAO."; |
|
2330 | + } |
|
2100 | 2331 | if ($error != '') { |
2101 | 2332 | return $error; |
2102 | - } elseif ($globalDebug) echo "Done\n"; |
|
2333 | + } elseif ($globalDebug) { |
|
2334 | + echo "Done\n"; |
|
2335 | + } |
|
2103 | 2336 | return ''; |
2104 | 2337 | } |
2105 | 2338 | |
2106 | 2339 | public static function update_routes() { |
2107 | 2340 | global $tmp_dir, $globalDebug; |
2108 | 2341 | $error = ''; |
2109 | - if ($globalDebug) echo "Routes : Download..."; |
|
2342 | + if ($globalDebug) { |
|
2343 | + echo "Routes : Download..."; |
|
2344 | + } |
|
2110 | 2345 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
2111 | 2346 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
2112 | - if ($globalDebug) echo "Gunzip..."; |
|
2347 | + if ($globalDebug) { |
|
2348 | + echo "Gunzip..."; |
|
2349 | + } |
|
2113 | 2350 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
2114 | - if ($globalDebug) echo "Add to DB..."; |
|
2351 | + if ($globalDebug) { |
|
2352 | + echo "Add to DB..."; |
|
2353 | + } |
|
2115 | 2354 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
2116 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2355 | + } else { |
|
2356 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2357 | + } |
|
2117 | 2358 | if ($error != '') { |
2118 | 2359 | return $error; |
2119 | - } elseif ($globalDebug) echo "Done\n"; |
|
2360 | + } elseif ($globalDebug) { |
|
2361 | + echo "Done\n"; |
|
2362 | + } |
|
2120 | 2363 | return ''; |
2121 | 2364 | } |
2122 | 2365 | public static function update_oneworld() { |
2123 | 2366 | global $tmp_dir, $globalDebug; |
2124 | 2367 | $error = ''; |
2125 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
2368 | + if ($globalDebug) { |
|
2369 | + echo "Schedules Oneworld : Download..."; |
|
2370 | + } |
|
2126 | 2371 | update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
2127 | 2372 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
2128 | - if ($globalDebug) echo "Gunzip..."; |
|
2373 | + if ($globalDebug) { |
|
2374 | + echo "Gunzip..."; |
|
2375 | + } |
|
2129 | 2376 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
2130 | - if ($globalDebug) echo "Add to DB..."; |
|
2377 | + if ($globalDebug) { |
|
2378 | + echo "Add to DB..."; |
|
2379 | + } |
|
2131 | 2380 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
2132 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2381 | + } else { |
|
2382 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2383 | + } |
|
2133 | 2384 | if ($error != '') { |
2134 | 2385 | return $error; |
2135 | - } elseif ($globalDebug) echo "Done\n"; |
|
2386 | + } elseif ($globalDebug) { |
|
2387 | + echo "Done\n"; |
|
2388 | + } |
|
2136 | 2389 | return ''; |
2137 | 2390 | } |
2138 | 2391 | public static function update_skyteam() { |
2139 | 2392 | global $tmp_dir, $globalDebug; |
2140 | 2393 | $error = ''; |
2141 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
2394 | + if ($globalDebug) { |
|
2395 | + echo "Schedules Skyteam : Download..."; |
|
2396 | + } |
|
2142 | 2397 | update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
2143 | 2398 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
2144 | - if ($globalDebug) echo "Gunzip..."; |
|
2399 | + if ($globalDebug) { |
|
2400 | + echo "Gunzip..."; |
|
2401 | + } |
|
2145 | 2402 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
2146 | - if ($globalDebug) echo "Add to DB..."; |
|
2403 | + if ($globalDebug) { |
|
2404 | + echo "Add to DB..."; |
|
2405 | + } |
|
2147 | 2406 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
2148 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2407 | + } else { |
|
2408 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2409 | + } |
|
2149 | 2410 | if ($error != '') { |
2150 | 2411 | return $error; |
2151 | - } elseif ($globalDebug) echo "Done\n"; |
|
2412 | + } elseif ($globalDebug) { |
|
2413 | + echo "Done\n"; |
|
2414 | + } |
|
2152 | 2415 | return ''; |
2153 | 2416 | } |
2154 | 2417 | public static function update_ModeS() { |
@@ -2165,340 +2428,590 @@ discard block |
||
2165 | 2428 | exit; |
2166 | 2429 | } elseif ($globalDebug) echo "Done\n"; |
2167 | 2430 | */ |
2168 | - if ($globalDebug) echo "Modes : Download..."; |
|
2169 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2431 | + if ($globalDebug) { |
|
2432 | + echo "Modes : Download..."; |
|
2433 | + } |
|
2434 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2170 | 2435 | update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
2171 | 2436 | |
2172 | 2437 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2173 | 2438 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
2174 | - if ($globalDebug) echo "Unzip..."; |
|
2175 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2439 | + if ($globalDebug) { |
|
2440 | + echo "Unzip..."; |
|
2441 | + } |
|
2442 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2176 | 2443 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
2177 | - if ($globalDebug) echo "Add to DB..."; |
|
2444 | + if ($globalDebug) { |
|
2445 | + echo "Add to DB..."; |
|
2446 | + } |
|
2178 | 2447 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
2179 | 2448 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
2180 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2449 | + } else { |
|
2450 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2451 | + } |
|
2181 | 2452 | if ($error != '') { |
2182 | 2453 | return $error; |
2183 | - } elseif ($globalDebug) echo "Done\n"; |
|
2454 | + } elseif ($globalDebug) { |
|
2455 | + echo "Done\n"; |
|
2456 | + } |
|
2184 | 2457 | return ''; |
2185 | 2458 | } |
2186 | 2459 | |
2187 | 2460 | public static function update_ModeS_faa() { |
2188 | 2461 | global $tmp_dir, $globalDebug; |
2189 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
2462 | + if ($globalDebug) { |
|
2463 | + echo "Modes FAA: Download..."; |
|
2464 | + } |
|
2190 | 2465 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
2191 | 2466 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2192 | - if ($globalDebug) echo "Unzip..."; |
|
2467 | + if ($globalDebug) { |
|
2468 | + echo "Unzip..."; |
|
2469 | + } |
|
2193 | 2470 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
2194 | - if ($globalDebug) echo "Add to DB..."; |
|
2471 | + if ($globalDebug) { |
|
2472 | + echo "Add to DB..."; |
|
2473 | + } |
|
2195 | 2474 | $error = update_db::modes_faa(); |
2196 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2475 | + } else { |
|
2476 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2477 | + } |
|
2197 | 2478 | if ($error != '') { |
2198 | 2479 | return $error; |
2199 | - } elseif ($globalDebug) echo "Done\n"; |
|
2480 | + } elseif ($globalDebug) { |
|
2481 | + echo "Done\n"; |
|
2482 | + } |
|
2200 | 2483 | return ''; |
2201 | 2484 | } |
2202 | 2485 | |
2203 | 2486 | public static function update_ModeS_flarm() { |
2204 | 2487 | global $tmp_dir, $globalDebug; |
2205 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
2488 | + if ($globalDebug) { |
|
2489 | + echo "Modes Flarmnet: Download..."; |
|
2490 | + } |
|
2206 | 2491 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
2207 | 2492 | if (file_exists($tmp_dir.'data.fln')) { |
2208 | - if ($globalDebug) echo "Add to DB..."; |
|
2493 | + if ($globalDebug) { |
|
2494 | + echo "Add to DB..."; |
|
2495 | + } |
|
2209 | 2496 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
2210 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2497 | + } else { |
|
2498 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2499 | + } |
|
2211 | 2500 | if ($error != '') { |
2212 | 2501 | return $error; |
2213 | - } elseif ($globalDebug) echo "Done\n"; |
|
2502 | + } elseif ($globalDebug) { |
|
2503 | + echo "Done\n"; |
|
2504 | + } |
|
2214 | 2505 | return ''; |
2215 | 2506 | } |
2216 | 2507 | |
2217 | 2508 | public static function update_ModeS_ogn() { |
2218 | 2509 | global $tmp_dir, $globalDebug; |
2219 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
2510 | + if ($globalDebug) { |
|
2511 | + echo "Modes OGN: Download..."; |
|
2512 | + } |
|
2220 | 2513 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
2221 | 2514 | if (file_exists($tmp_dir.'ogn.csv')) { |
2222 | - if ($globalDebug) echo "Add to DB..."; |
|
2515 | + if ($globalDebug) { |
|
2516 | + echo "Add to DB..."; |
|
2517 | + } |
|
2223 | 2518 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
2224 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2519 | + } else { |
|
2520 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2521 | + } |
|
2225 | 2522 | if ($error != '') { |
2226 | 2523 | return $error; |
2227 | - } elseif ($globalDebug) echo "Done\n"; |
|
2524 | + } elseif ($globalDebug) { |
|
2525 | + echo "Done\n"; |
|
2526 | + } |
|
2228 | 2527 | return ''; |
2229 | 2528 | } |
2230 | 2529 | |
2231 | 2530 | public static function update_owner() { |
2232 | 2531 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2233 | 2532 | |
2234 | - if ($globalDebug) echo "Owner France: Download..."; |
|
2533 | + if ($globalDebug) { |
|
2534 | + echo "Owner France: Download..."; |
|
2535 | + } |
|
2235 | 2536 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
2236 | 2537 | if (file_exists($tmp_dir.'owner_f.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_f.csv','F'); |
2239 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2542 | + } else { |
|
2543 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2544 | + } |
|
2240 | 2545 | if ($error != '') { |
2241 | 2546 | return $error; |
2242 | - } elseif ($globalDebug) echo "Done\n"; |
|
2547 | + } elseif ($globalDebug) { |
|
2548 | + echo "Done\n"; |
|
2549 | + } |
|
2243 | 2550 | |
2244 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
2551 | + if ($globalDebug) { |
|
2552 | + echo "Owner Ireland: Download..."; |
|
2553 | + } |
|
2245 | 2554 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
2246 | 2555 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2247 | - if ($globalDebug) echo "Add to DB..."; |
|
2556 | + if ($globalDebug) { |
|
2557 | + echo "Add to DB..."; |
|
2558 | + } |
|
2248 | 2559 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
2249 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2560 | + } else { |
|
2561 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2562 | + } |
|
2250 | 2563 | if ($error != '') { |
2251 | 2564 | return $error; |
2252 | - } elseif ($globalDebug) echo "Done\n"; |
|
2253 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
2565 | + } elseif ($globalDebug) { |
|
2566 | + echo "Done\n"; |
|
2567 | + } |
|
2568 | + if ($globalDebug) { |
|
2569 | + echo "Owner Switzerland: Download..."; |
|
2570 | + } |
|
2254 | 2571 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
2255 | 2572 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2256 | - if ($globalDebug) echo "Add to DB..."; |
|
2573 | + if ($globalDebug) { |
|
2574 | + echo "Add to DB..."; |
|
2575 | + } |
|
2257 | 2576 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
2258 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2577 | + } else { |
|
2578 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2579 | + } |
|
2259 | 2580 | if ($error != '') { |
2260 | 2581 | return $error; |
2261 | - } elseif ($globalDebug) echo "Done\n"; |
|
2262 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
2582 | + } elseif ($globalDebug) { |
|
2583 | + echo "Done\n"; |
|
2584 | + } |
|
2585 | + if ($globalDebug) { |
|
2586 | + echo "Owner Czech Republic: Download..."; |
|
2587 | + } |
|
2263 | 2588 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
2264 | 2589 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2265 | - if ($globalDebug) echo "Add to DB..."; |
|
2590 | + if ($globalDebug) { |
|
2591 | + echo "Add to DB..."; |
|
2592 | + } |
|
2266 | 2593 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
2267 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2594 | + } else { |
|
2595 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2596 | + } |
|
2268 | 2597 | if ($error != '') { |
2269 | 2598 | return $error; |
2270 | - } elseif ($globalDebug) echo "Done\n"; |
|
2271 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
2599 | + } elseif ($globalDebug) { |
|
2600 | + echo "Done\n"; |
|
2601 | + } |
|
2602 | + if ($globalDebug) { |
|
2603 | + echo "Owner Australia: Download..."; |
|
2604 | + } |
|
2272 | 2605 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
2273 | 2606 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2274 | - if ($globalDebug) echo "Add to DB..."; |
|
2607 | + if ($globalDebug) { |
|
2608 | + echo "Add to DB..."; |
|
2609 | + } |
|
2275 | 2610 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
2276 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2611 | + } else { |
|
2612 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2613 | + } |
|
2277 | 2614 | if ($error != '') { |
2278 | 2615 | return $error; |
2279 | - } elseif ($globalDebug) echo "Done\n"; |
|
2280 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
2616 | + } elseif ($globalDebug) { |
|
2617 | + echo "Done\n"; |
|
2618 | + } |
|
2619 | + if ($globalDebug) { |
|
2620 | + echo "Owner Austria: Download..."; |
|
2621 | + } |
|
2281 | 2622 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
2282 | 2623 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2283 | - if ($globalDebug) echo "Add to DB..."; |
|
2624 | + if ($globalDebug) { |
|
2625 | + echo "Add to DB..."; |
|
2626 | + } |
|
2284 | 2627 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
2285 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2628 | + } else { |
|
2629 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2630 | + } |
|
2286 | 2631 | if ($error != '') { |
2287 | 2632 | return $error; |
2288 | - } elseif ($globalDebug) echo "Done\n"; |
|
2289 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
2633 | + } elseif ($globalDebug) { |
|
2634 | + echo "Done\n"; |
|
2635 | + } |
|
2636 | + if ($globalDebug) { |
|
2637 | + echo "Owner Chile: Download..."; |
|
2638 | + } |
|
2290 | 2639 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
2291 | 2640 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2292 | - if ($globalDebug) echo "Add to DB..."; |
|
2641 | + if ($globalDebug) { |
|
2642 | + echo "Add to DB..."; |
|
2643 | + } |
|
2293 | 2644 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
2294 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2645 | + } else { |
|
2646 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2647 | + } |
|
2295 | 2648 | if ($error != '') { |
2296 | 2649 | return $error; |
2297 | - } elseif ($globalDebug) echo "Done\n"; |
|
2298 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
2650 | + } elseif ($globalDebug) { |
|
2651 | + echo "Done\n"; |
|
2652 | + } |
|
2653 | + if ($globalDebug) { |
|
2654 | + echo "Owner Colombia: Download..."; |
|
2655 | + } |
|
2299 | 2656 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
2300 | 2657 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2301 | - if ($globalDebug) echo "Add to DB..."; |
|
2658 | + if ($globalDebug) { |
|
2659 | + echo "Add to DB..."; |
|
2660 | + } |
|
2302 | 2661 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
2303 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2662 | + } else { |
|
2663 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2664 | + } |
|
2304 | 2665 | if ($error != '') { |
2305 | 2666 | return $error; |
2306 | - } elseif ($globalDebug) echo "Done\n"; |
|
2307 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
2667 | + } elseif ($globalDebug) { |
|
2668 | + echo "Done\n"; |
|
2669 | + } |
|
2670 | + if ($globalDebug) { |
|
2671 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
2672 | + } |
|
2308 | 2673 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
2309 | 2674 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2310 | - if ($globalDebug) echo "Add to DB..."; |
|
2675 | + if ($globalDebug) { |
|
2676 | + echo "Add to DB..."; |
|
2677 | + } |
|
2311 | 2678 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
2312 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2679 | + } else { |
|
2680 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2681 | + } |
|
2313 | 2682 | if ($error != '') { |
2314 | 2683 | return $error; |
2315 | - } elseif ($globalDebug) echo "Done\n"; |
|
2316 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
2684 | + } elseif ($globalDebug) { |
|
2685 | + echo "Done\n"; |
|
2686 | + } |
|
2687 | + if ($globalDebug) { |
|
2688 | + echo "Owner Brazil: Download..."; |
|
2689 | + } |
|
2317 | 2690 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
2318 | 2691 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2319 | - if ($globalDebug) echo "Add to DB..."; |
|
2692 | + if ($globalDebug) { |
|
2693 | + echo "Add to DB..."; |
|
2694 | + } |
|
2320 | 2695 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
2321 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2696 | + } else { |
|
2697 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2698 | + } |
|
2322 | 2699 | if ($error != '') { |
2323 | 2700 | return $error; |
2324 | - } elseif ($globalDebug) echo "Done\n"; |
|
2325 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
2701 | + } elseif ($globalDebug) { |
|
2702 | + echo "Done\n"; |
|
2703 | + } |
|
2704 | + if ($globalDebug) { |
|
2705 | + echo "Owner Cayman Islands: Download..."; |
|
2706 | + } |
|
2326 | 2707 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
2327 | 2708 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2328 | - if ($globalDebug) echo "Add to DB..."; |
|
2709 | + if ($globalDebug) { |
|
2710 | + echo "Add to DB..."; |
|
2711 | + } |
|
2329 | 2712 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
2330 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2713 | + } else { |
|
2714 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2715 | + } |
|
2331 | 2716 | if ($error != '') { |
2332 | 2717 | return $error; |
2333 | - } elseif ($globalDebug) echo "Done\n"; |
|
2334 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
2718 | + } elseif ($globalDebug) { |
|
2719 | + echo "Done\n"; |
|
2720 | + } |
|
2721 | + if ($globalDebug) { |
|
2722 | + echo "Owner Croatia: Download..."; |
|
2723 | + } |
|
2335 | 2724 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
2336 | 2725 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2337 | - if ($globalDebug) echo "Add to DB..."; |
|
2726 | + if ($globalDebug) { |
|
2727 | + echo "Add to DB..."; |
|
2728 | + } |
|
2338 | 2729 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
2339 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2730 | + } else { |
|
2731 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2732 | + } |
|
2340 | 2733 | if ($error != '') { |
2341 | 2734 | return $error; |
2342 | - } elseif ($globalDebug) echo "Done\n"; |
|
2343 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
2735 | + } elseif ($globalDebug) { |
|
2736 | + echo "Done\n"; |
|
2737 | + } |
|
2738 | + if ($globalDebug) { |
|
2739 | + echo "Owner Luxembourg: Download..."; |
|
2740 | + } |
|
2344 | 2741 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
2345 | 2742 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2346 | - if ($globalDebug) echo "Add to DB..."; |
|
2743 | + if ($globalDebug) { |
|
2744 | + echo "Add to DB..."; |
|
2745 | + } |
|
2347 | 2746 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
2348 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2747 | + } else { |
|
2748 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2749 | + } |
|
2349 | 2750 | if ($error != '') { |
2350 | 2751 | return $error; |
2351 | - } elseif ($globalDebug) echo "Done\n"; |
|
2352 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
2752 | + } elseif ($globalDebug) { |
|
2753 | + echo "Done\n"; |
|
2754 | + } |
|
2755 | + if ($globalDebug) { |
|
2756 | + echo "Owner Maldives: Download..."; |
|
2757 | + } |
|
2353 | 2758 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
2354 | 2759 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2355 | - if ($globalDebug) echo "Add to DB..."; |
|
2760 | + if ($globalDebug) { |
|
2761 | + echo "Add to DB..."; |
|
2762 | + } |
|
2356 | 2763 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
2357 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2764 | + } else { |
|
2765 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2766 | + } |
|
2358 | 2767 | if ($error != '') { |
2359 | 2768 | return $error; |
2360 | - } elseif ($globalDebug) echo "Done\n"; |
|
2361 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
2769 | + } elseif ($globalDebug) { |
|
2770 | + echo "Done\n"; |
|
2771 | + } |
|
2772 | + if ($globalDebug) { |
|
2773 | + echo "Owner New Zealand: Download..."; |
|
2774 | + } |
|
2362 | 2775 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
2363 | 2776 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2364 | - if ($globalDebug) echo "Add to DB..."; |
|
2777 | + if ($globalDebug) { |
|
2778 | + echo "Add to DB..."; |
|
2779 | + } |
|
2365 | 2780 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
2366 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2367 | - if ($error != '') { |
|
2781 | + } else { |
|
2782 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2783 | + } |
|
2784 | + if ($error != '') { |
|
2368 | 2785 | return $error; |
2369 | - } elseif ($globalDebug) echo "Done\n"; |
|
2370 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
2786 | + } elseif ($globalDebug) { |
|
2787 | + echo "Done\n"; |
|
2788 | + } |
|
2789 | + if ($globalDebug) { |
|
2790 | + echo "Owner Papua New Guinea: Download..."; |
|
2791 | + } |
|
2371 | 2792 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
2372 | 2793 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2373 | - if ($globalDebug) echo "Add to DB..."; |
|
2794 | + if ($globalDebug) { |
|
2795 | + echo "Add to DB..."; |
|
2796 | + } |
|
2374 | 2797 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
2375 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2798 | + } else { |
|
2799 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2800 | + } |
|
2376 | 2801 | if ($error != '') { |
2377 | 2802 | return $error; |
2378 | - } elseif ($globalDebug) echo "Done\n"; |
|
2379 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
2803 | + } elseif ($globalDebug) { |
|
2804 | + echo "Done\n"; |
|
2805 | + } |
|
2806 | + if ($globalDebug) { |
|
2807 | + echo "Owner Slovakia: Download..."; |
|
2808 | + } |
|
2380 | 2809 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
2381 | 2810 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2382 | - if ($globalDebug) echo "Add to DB..."; |
|
2811 | + if ($globalDebug) { |
|
2812 | + echo "Add to DB..."; |
|
2813 | + } |
|
2383 | 2814 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
2384 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2815 | + } else { |
|
2816 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2817 | + } |
|
2385 | 2818 | if ($error != '') { |
2386 | 2819 | return $error; |
2387 | - } elseif ($globalDebug) echo "Done\n"; |
|
2388 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
2820 | + } elseif ($globalDebug) { |
|
2821 | + echo "Done\n"; |
|
2822 | + } |
|
2823 | + if ($globalDebug) { |
|
2824 | + echo "Owner Ecuador: Download..."; |
|
2825 | + } |
|
2389 | 2826 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
2390 | 2827 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2391 | - if ($globalDebug) echo "Add to DB..."; |
|
2828 | + if ($globalDebug) { |
|
2829 | + echo "Add to DB..."; |
|
2830 | + } |
|
2392 | 2831 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
2393 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2832 | + } else { |
|
2833 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2834 | + } |
|
2394 | 2835 | if ($error != '') { |
2395 | 2836 | return $error; |
2396 | - } elseif ($globalDebug) echo "Done\n"; |
|
2397 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
2837 | + } elseif ($globalDebug) { |
|
2838 | + echo "Done\n"; |
|
2839 | + } |
|
2840 | + if ($globalDebug) { |
|
2841 | + echo "Owner Iceland: Download..."; |
|
2842 | + } |
|
2398 | 2843 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
2399 | 2844 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2400 | - if ($globalDebug) echo "Add to DB..."; |
|
2845 | + if ($globalDebug) { |
|
2846 | + echo "Add to DB..."; |
|
2847 | + } |
|
2401 | 2848 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
2402 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2849 | + } else { |
|
2850 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2851 | + } |
|
2403 | 2852 | if ($error != '') { |
2404 | 2853 | return $error; |
2405 | - } elseif ($globalDebug) echo "Done\n"; |
|
2406 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
2854 | + } elseif ($globalDebug) { |
|
2855 | + echo "Done\n"; |
|
2856 | + } |
|
2857 | + if ($globalDebug) { |
|
2858 | + echo "Owner Isle of Man: Download..."; |
|
2859 | + } |
|
2407 | 2860 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
2408 | 2861 | if (file_exists($tmp_dir.'owner_m.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_m.csv','M'); |
2411 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2866 | + } else { |
|
2867 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2868 | + } |
|
2412 | 2869 | if ($error != '') { |
2413 | 2870 | return $error; |
2414 | - } elseif ($globalDebug) echo "Done\n"; |
|
2871 | + } elseif ($globalDebug) { |
|
2872 | + echo "Done\n"; |
|
2873 | + } |
|
2415 | 2874 | if ($globalMasterSource) { |
2416 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
2875 | + if ($globalDebug) { |
|
2876 | + echo "ModeS Netherlands: Download..."; |
|
2877 | + } |
|
2417 | 2878 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
2418 | 2879 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2419 | - if ($globalDebug) echo "Add to DB..."; |
|
2880 | + if ($globalDebug) { |
|
2881 | + echo "Add to DB..."; |
|
2882 | + } |
|
2420 | 2883 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
2421 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2884 | + } else { |
|
2885 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2886 | + } |
|
2422 | 2887 | if ($error != '') { |
2423 | 2888 | return $error; |
2424 | - } elseif ($globalDebug) echo "Done\n"; |
|
2425 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
2889 | + } elseif ($globalDebug) { |
|
2890 | + echo "Done\n"; |
|
2891 | + } |
|
2892 | + if ($globalDebug) { |
|
2893 | + echo "ModeS Denmark: Download..."; |
|
2894 | + } |
|
2426 | 2895 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
2427 | 2896 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2428 | - if ($globalDebug) echo "Add to DB..."; |
|
2897 | + if ($globalDebug) { |
|
2898 | + echo "Add to DB..."; |
|
2899 | + } |
|
2429 | 2900 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
2430 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2901 | + } else { |
|
2902 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2903 | + } |
|
2431 | 2904 | if ($error != '') { |
2432 | 2905 | return $error; |
2433 | - } elseif ($globalDebug) echo "Done\n"; |
|
2434 | - } elseif ($globalDebug) echo "Done\n"; |
|
2906 | + } elseif ($globalDebug) { |
|
2907 | + echo "Done\n"; |
|
2908 | + } |
|
2909 | + } elseif ($globalDebug) { |
|
2910 | + echo "Done\n"; |
|
2911 | + } |
|
2435 | 2912 | return ''; |
2436 | 2913 | } |
2437 | 2914 | |
2438 | 2915 | public static function update_translation() { |
2439 | 2916 | global $tmp_dir, $globalDebug; |
2440 | 2917 | $error = ''; |
2441 | - if ($globalDebug) echo "Translation : Download..."; |
|
2918 | + if ($globalDebug) { |
|
2919 | + echo "Translation : Download..."; |
|
2920 | + } |
|
2442 | 2921 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
2443 | 2922 | if (file_exists($tmp_dir.'translation.zip')) { |
2444 | - if ($globalDebug) echo "Unzip..."; |
|
2923 | + if ($globalDebug) { |
|
2924 | + echo "Unzip..."; |
|
2925 | + } |
|
2445 | 2926 | update_db::unzip($tmp_dir.'translation.zip'); |
2446 | - if ($globalDebug) echo "Add to DB..."; |
|
2927 | + if ($globalDebug) { |
|
2928 | + echo "Add to DB..."; |
|
2929 | + } |
|
2447 | 2930 | $error = update_db::translation(); |
2448 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2931 | + } else { |
|
2932 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2933 | + } |
|
2449 | 2934 | if ($error != '') { |
2450 | 2935 | return $error; |
2451 | - } elseif ($globalDebug) echo "Done\n"; |
|
2936 | + } elseif ($globalDebug) { |
|
2937 | + echo "Done\n"; |
|
2938 | + } |
|
2452 | 2939 | return ''; |
2453 | 2940 | } |
2454 | 2941 | |
2455 | 2942 | public static function update_translation_fam() { |
2456 | 2943 | global $tmp_dir, $globalDebug; |
2457 | 2944 | $error = ''; |
2458 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
2945 | + if ($globalDebug) { |
|
2946 | + echo "Translation from FlightAirMap website : Download..."; |
|
2947 | + } |
|
2459 | 2948 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
2460 | 2949 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
2461 | 2950 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
2462 | 2951 | $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
2463 | 2952 | $translation_md5 = $translation_md5_file[0]; |
2464 | 2953 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
2465 | - if ($globalDebug) echo "Gunzip..."; |
|
2954 | + if ($globalDebug) { |
|
2955 | + echo "Gunzip..."; |
|
2956 | + } |
|
2466 | 2957 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
2467 | - if ($globalDebug) echo "Add to DB..."; |
|
2958 | + if ($globalDebug) { |
|
2959 | + echo "Add to DB..."; |
|
2960 | + } |
|
2468 | 2961 | $error = update_db::translation_fam(); |
2469 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
2470 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2962 | + } else { |
|
2963 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
2964 | + } |
|
2965 | + } else { |
|
2966 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2967 | + } |
|
2471 | 2968 | if ($error != '') { |
2472 | 2969 | return $error; |
2473 | - } elseif ($globalDebug) echo "Done\n"; |
|
2970 | + } elseif ($globalDebug) { |
|
2971 | + echo "Done\n"; |
|
2972 | + } |
|
2474 | 2973 | return ''; |
2475 | 2974 | } |
2476 | 2975 | public static function update_ModeS_fam() { |
2477 | 2976 | global $tmp_dir, $globalDebug; |
2478 | 2977 | $error = ''; |
2479 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
2978 | + if ($globalDebug) { |
|
2979 | + echo "ModeS from FlightAirMap website : Download..."; |
|
2980 | + } |
|
2480 | 2981 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
2481 | 2982 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
2482 | 2983 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
2483 | 2984 | $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
2484 | 2985 | $modes_md5 = $modes_md5_file[0]; |
2485 | 2986 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
2486 | - if ($globalDebug) echo "Gunzip..."; |
|
2987 | + if ($globalDebug) { |
|
2988 | + echo "Gunzip..."; |
|
2989 | + } |
|
2487 | 2990 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
2488 | - if ($globalDebug) echo "Add to DB..."; |
|
2991 | + if ($globalDebug) { |
|
2992 | + echo "Add to DB..."; |
|
2993 | + } |
|
2489 | 2994 | $error = update_db::modes_fam(); |
2490 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
2491 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2995 | + } else { |
|
2996 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
2997 | + } |
|
2998 | + } else { |
|
2999 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
3000 | + } |
|
2492 | 3001 | if ($error != '') { |
2493 | 3002 | return $error; |
2494 | - } elseif ($globalDebug) echo "Done\n"; |
|
3003 | + } elseif ($globalDebug) { |
|
3004 | + echo "Done\n"; |
|
3005 | + } |
|
2495 | 3006 | return ''; |
2496 | 3007 | } |
2497 | 3008 | |
2498 | 3009 | public static function update_airlines_fam() { |
2499 | 3010 | global $tmp_dir, $globalDebug; |
2500 | 3011 | $error = ''; |
2501 | - if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
|
3012 | + if ($globalDebug) { |
|
3013 | + echo "Airlines from FlightAirMap website : Download..."; |
|
3014 | + } |
|
2502 | 3015 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
2503 | 3016 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
2504 | 3017 | $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
@@ -2507,26 +3020,42 @@ discard block |
||
2507 | 3020 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
2508 | 3021 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
2509 | 3022 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
2510 | - if ($globalDebug) echo "Gunzip..."; |
|
3023 | + if ($globalDebug) { |
|
3024 | + echo "Gunzip..."; |
|
3025 | + } |
|
2511 | 3026 | update_db::gunzip($tmp_dir.'airlines.tsv.gz'); |
2512 | - if ($globalDebug) echo "Add to DB..."; |
|
3027 | + if ($globalDebug) { |
|
3028 | + echo "Add to DB..."; |
|
3029 | + } |
|
2513 | 3030 | $error = update_db::airlines_fam(); |
2514 | 3031 | update_db::insert_airlines_version($airlines_md5); |
2515 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
2516 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
2517 | - } elseif ($globalDebug) echo "No update."; |
|
2518 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
3032 | + } else { |
|
3033 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
3034 | + } |
|
3035 | + } else { |
|
3036 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
3037 | + } |
|
3038 | + } elseif ($globalDebug) { |
|
3039 | + echo "No update."; |
|
3040 | + } |
|
3041 | + } else { |
|
3042 | + $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
3043 | + } |
|
2519 | 3044 | if ($error != '') { |
2520 | 3045 | return $error; |
2521 | 3046 | } else { |
2522 | - if ($globalDebug) echo "Done\n"; |
|
3047 | + if ($globalDebug) { |
|
3048 | + echo "Done\n"; |
|
3049 | + } |
|
2523 | 3050 | } |
2524 | 3051 | return ''; |
2525 | 3052 | } |
2526 | 3053 | |
2527 | 3054 | public static function update_owner_fam() { |
2528 | 3055 | global $tmp_dir, $globalDebug, $globalOwner; |
2529 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
3056 | + if ($globalDebug) { |
|
3057 | + echo "owner from FlightAirMap website : Download..."; |
|
3058 | + } |
|
2530 | 3059 | $error = ''; |
2531 | 3060 | if ($globalOwner === TRUE) { |
2532 | 3061 | update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
@@ -2539,55 +3068,89 @@ discard block |
||
2539 | 3068 | $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
2540 | 3069 | $owners_md5 = $owners_md5_file[0]; |
2541 | 3070 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
2542 | - if ($globalDebug) echo "Gunzip..."; |
|
3071 | + if ($globalDebug) { |
|
3072 | + echo "Gunzip..."; |
|
3073 | + } |
|
2543 | 3074 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
2544 | - if ($globalDebug) echo "Add to DB..."; |
|
3075 | + if ($globalDebug) { |
|
3076 | + echo "Add to DB..."; |
|
3077 | + } |
|
2545 | 3078 | $error = update_db::owner_fam(); |
2546 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
2547 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
3079 | + } else { |
|
3080 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
3081 | + } |
|
3082 | + } else { |
|
3083 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
3084 | + } |
|
2548 | 3085 | if ($error != '') { |
2549 | 3086 | return $error; |
2550 | - } elseif ($globalDebug) echo "Done\n"; |
|
3087 | + } elseif ($globalDebug) { |
|
3088 | + echo "Done\n"; |
|
3089 | + } |
|
2551 | 3090 | return ''; |
2552 | 3091 | } |
2553 | 3092 | public static function update_routes_fam() { |
2554 | 3093 | global $tmp_dir, $globalDebug; |
2555 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
3094 | + if ($globalDebug) { |
|
3095 | + echo "Routes from FlightAirMap website : Download..."; |
|
3096 | + } |
|
2556 | 3097 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
2557 | 3098 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
2558 | 3099 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
2559 | 3100 | $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
2560 | 3101 | $routes_md5 = $routes_md5_file[0]; |
2561 | 3102 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
2562 | - if ($globalDebug) echo "Gunzip..."; |
|
3103 | + if ($globalDebug) { |
|
3104 | + echo "Gunzip..."; |
|
3105 | + } |
|
2563 | 3106 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
2564 | - if ($globalDebug) echo "Add to DB..."; |
|
3107 | + if ($globalDebug) { |
|
3108 | + echo "Add to DB..."; |
|
3109 | + } |
|
2565 | 3110 | $error = update_db::routes_fam(); |
2566 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
2567 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
3111 | + } else { |
|
3112 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
3113 | + } |
|
3114 | + } else { |
|
3115 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
3116 | + } |
|
2568 | 3117 | if ($error != '') { |
2569 | 3118 | return $error; |
2570 | - } elseif ($globalDebug) echo "Done\n"; |
|
3119 | + } elseif ($globalDebug) { |
|
3120 | + echo "Done\n"; |
|
3121 | + } |
|
2571 | 3122 | return ''; |
2572 | 3123 | } |
2573 | 3124 | public static function update_block_fam() { |
2574 | 3125 | global $tmp_dir, $globalDebug; |
2575 | - if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
3126 | + if ($globalDebug) { |
|
3127 | + echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
3128 | + } |
|
2576 | 3129 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
2577 | 3130 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
2578 | 3131 | if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
2579 | 3132 | $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
2580 | 3133 | $block_md5 = $block_md5_file[0]; |
2581 | 3134 | if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
2582 | - if ($globalDebug) echo "Gunzip..."; |
|
3135 | + if ($globalDebug) { |
|
3136 | + echo "Gunzip..."; |
|
3137 | + } |
|
2583 | 3138 | update_db::gunzip($tmp_dir.'block.tsv.gz'); |
2584 | - if ($globalDebug) echo "Add to DB..."; |
|
3139 | + if ($globalDebug) { |
|
3140 | + echo "Add to DB..."; |
|
3141 | + } |
|
2585 | 3142 | $error = update_db::block_fam(); |
2586 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
2587 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
3143 | + } else { |
|
3144 | + $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
3145 | + } |
|
3146 | + } else { |
|
3147 | + $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
3148 | + } |
|
2588 | 3149 | if ($error != '') { |
2589 | 3150 | return $error; |
2590 | - } elseif ($globalDebug) echo "Done\n"; |
|
3151 | + } elseif ($globalDebug) { |
|
3152 | + echo "Done\n"; |
|
3153 | + } |
|
2591 | 3154 | return ''; |
2592 | 3155 | } |
2593 | 3156 | public static function update_marine_identity_fam() { |
@@ -2597,21 +3160,33 @@ discard block |
||
2597 | 3160 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
2598 | 3161 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2599 | 3162 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2600 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
3163 | + if ($globalDebug) { |
|
3164 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
3165 | + } |
|
2601 | 3166 | update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
2602 | 3167 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2603 | 3168 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
2604 | - if ($globalDebug) echo "Gunzip..."; |
|
3169 | + if ($globalDebug) { |
|
3170 | + echo "Gunzip..."; |
|
3171 | + } |
|
2605 | 3172 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
2606 | - if ($globalDebug) echo "Add to DB..."; |
|
3173 | + if ($globalDebug) { |
|
3174 | + echo "Add to DB..."; |
|
3175 | + } |
|
2607 | 3176 | $error = update_db::marine_identity_fam(); |
2608 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
2609 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
3177 | + } else { |
|
3178 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
3179 | + } |
|
3180 | + } else { |
|
3181 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
3182 | + } |
|
2610 | 3183 | if ($error != '') { |
2611 | 3184 | return $error; |
2612 | 3185 | } else { |
2613 | 3186 | update_db::insert_marine_identity_version($marine_identity_md5); |
2614 | - if ($globalDebug) echo "Done\n"; |
|
3187 | + if ($globalDebug) { |
|
3188 | + echo "Done\n"; |
|
3189 | + } |
|
2615 | 3190 | } |
2616 | 3191 | } |
2617 | 3192 | } |
@@ -2625,21 +3200,33 @@ discard block |
||
2625 | 3200 | $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
2626 | 3201 | $satellite_md5 = $satellite_md5_file[0]; |
2627 | 3202 | if (!update_db::check_satellite_version($satellite_md5)) { |
2628 | - if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
|
3203 | + if ($globalDebug) { |
|
3204 | + echo "Satellite from FlightAirMap website : Download..."; |
|
3205 | + } |
|
2629 | 3206 | update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
2630 | 3207 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2631 | 3208 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
2632 | - if ($globalDebug) echo "Gunzip..."; |
|
3209 | + if ($globalDebug) { |
|
3210 | + echo "Gunzip..."; |
|
3211 | + } |
|
2633 | 3212 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
2634 | - if ($globalDebug) echo "Add to DB..."; |
|
3213 | + if ($globalDebug) { |
|
3214 | + echo "Add to DB..."; |
|
3215 | + } |
|
2635 | 3216 | $error = update_db::satellite_fam(); |
2636 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
2637 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
3217 | + } else { |
|
3218 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
3219 | + } |
|
3220 | + } else { |
|
3221 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
3222 | + } |
|
2638 | 3223 | if ($error != '') { |
2639 | 3224 | return $error; |
2640 | 3225 | } else { |
2641 | 3226 | update_db::insert_satellite_version($satellite_md5); |
2642 | - if ($globalDebug) echo "Done\n"; |
|
3227 | + if ($globalDebug) { |
|
3228 | + echo "Done\n"; |
|
3229 | + } |
|
2643 | 3230 | } |
2644 | 3231 | } |
2645 | 3232 | } |
@@ -2647,17 +3234,25 @@ discard block |
||
2647 | 3234 | } |
2648 | 3235 | public static function update_banned_fam() { |
2649 | 3236 | global $tmp_dir, $globalDebug; |
2650 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
3237 | + if ($globalDebug) { |
|
3238 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
3239 | + } |
|
2651 | 3240 | update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
2652 | 3241 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2653 | 3242 | //if ($globalDebug) echo "Gunzip..."; |
2654 | 3243 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
2655 | - if ($globalDebug) echo "Add to DB..."; |
|
3244 | + if ($globalDebug) { |
|
3245 | + echo "Add to DB..."; |
|
3246 | + } |
|
2656 | 3247 | $error = update_db::banned_fam(); |
2657 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
3248 | + } else { |
|
3249 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
3250 | + } |
|
2658 | 3251 | if ($error != '') { |
2659 | 3252 | return $error; |
2660 | - } elseif ($globalDebug) echo "Done\n"; |
|
3253 | + } elseif ($globalDebug) { |
|
3254 | + echo "Done\n"; |
|
3255 | + } |
|
2661 | 3256 | return ''; |
2662 | 3257 | } |
2663 | 3258 | |
@@ -2665,7 +3260,9 @@ discard block |
||
2665 | 3260 | global $tmp_dir, $globalDebug, $globalDBdriver; |
2666 | 3261 | include_once('class.create_db.php'); |
2667 | 3262 | $error = ''; |
2668 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
3263 | + if ($globalDebug) { |
|
3264 | + echo "Airspace from FlightAirMap website : Download..."; |
|
3265 | + } |
|
2669 | 3266 | if ($globalDBdriver == 'mysql') { |
2670 | 3267 | update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
2671 | 3268 | } else { |
@@ -2682,9 +3279,13 @@ discard block |
||
2682 | 3279 | } |
2683 | 3280 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2684 | 3281 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
2685 | - if ($globalDebug) echo "Gunzip..."; |
|
3282 | + if ($globalDebug) { |
|
3283 | + echo "Gunzip..."; |
|
3284 | + } |
|
2686 | 3285 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
2687 | - if ($globalDebug) echo "Add to DB..."; |
|
3286 | + if ($globalDebug) { |
|
3287 | + echo "Add to DB..."; |
|
3288 | + } |
|
2688 | 3289 | $Connection = new Connection(); |
2689 | 3290 | if ($Connection->tableExists('airspace')) { |
2690 | 3291 | $query = 'DROP TABLE airspace'; |
@@ -2697,20 +3298,30 @@ discard block |
||
2697 | 3298 | } |
2698 | 3299 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2699 | 3300 | update_db::insert_airspace_version($airspace_md5); |
2700 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
2701 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
3301 | + } else { |
|
3302 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
3303 | + } |
|
3304 | + } else { |
|
3305 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
3306 | + } |
|
2702 | 3307 | } |
2703 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
3308 | + } else { |
|
3309 | + $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
3310 | + } |
|
2704 | 3311 | if ($error != '') { |
2705 | 3312 | return $error; |
2706 | - } elseif ($globalDebug) echo "Done\n"; |
|
3313 | + } elseif ($globalDebug) { |
|
3314 | + echo "Done\n"; |
|
3315 | + } |
|
2707 | 3316 | return ''; |
2708 | 3317 | } |
2709 | 3318 | |
2710 | 3319 | public static function update_geoid_fam() { |
2711 | 3320 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2712 | 3321 | $error = ''; |
2713 | - if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
3322 | + if ($globalDebug) { |
|
3323 | + echo "Geoid from FlightAirMap website : Download..."; |
|
3324 | + } |
|
2714 | 3325 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
2715 | 3326 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2716 | 3327 | $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
@@ -2719,80 +3330,126 @@ discard block |
||
2719 | 3330 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
2720 | 3331 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2721 | 3332 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
2722 | - if ($globalDebug) echo "Gunzip..."; |
|
3333 | + if ($globalDebug) { |
|
3334 | + echo "Gunzip..."; |
|
3335 | + } |
|
2723 | 3336 | update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
2724 | 3337 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2725 | 3338 | update_db::insert_geoid_version($geoid_md5); |
2726 | - } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
2727 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
2728 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
2729 | - } elseif ($globalDebug) echo 'No new version'."\n"; |
|
2730 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3339 | + } else { |
|
3340 | + $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
3341 | + } |
|
3342 | + } else { |
|
3343 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
3344 | + } |
|
3345 | + } else { |
|
3346 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
3347 | + } |
|
3348 | + } elseif ($globalDebug) { |
|
3349 | + echo 'No new version'."\n"; |
|
3350 | + } |
|
3351 | + } else { |
|
3352 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3353 | + } |
|
2731 | 3354 | if ($error != '') { |
2732 | 3355 | return $error; |
2733 | - } elseif ($globalDebug) echo "Done\n"; |
|
3356 | + } elseif ($globalDebug) { |
|
3357 | + echo "Done\n"; |
|
3358 | + } |
|
2734 | 3359 | return ''; |
2735 | 3360 | } |
2736 | 3361 | |
2737 | 3362 | public static function update_tle() { |
2738 | 3363 | global $tmp_dir, $globalDebug; |
2739 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
3364 | + if ($globalDebug) { |
|
3365 | + echo "Download TLE : Download..."; |
|
3366 | + } |
|
2740 | 3367 | $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', |
2741 | 3368 | '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', |
2742 | 3369 | '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'); |
2743 | 3370 | foreach ($alltle as $filename) { |
2744 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
3371 | + if ($globalDebug) { |
|
3372 | + echo "downloading ".$filename.'...'; |
|
3373 | + } |
|
2745 | 3374 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
2746 | 3375 | if (file_exists($tmp_dir.$filename)) { |
2747 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
3376 | + if ($globalDebug) { |
|
3377 | + echo "Add to DB ".$filename."..."; |
|
3378 | + } |
|
2748 | 3379 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
2749 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3380 | + } else { |
|
3381 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3382 | + } |
|
2750 | 3383 | if ($error != '') { |
2751 | 3384 | echo $error."\n"; |
2752 | - } elseif ($globalDebug) echo "Done\n"; |
|
3385 | + } elseif ($globalDebug) { |
|
3386 | + echo "Done\n"; |
|
3387 | + } |
|
2753 | 3388 | } |
2754 | 3389 | return ''; |
2755 | 3390 | } |
2756 | 3391 | |
2757 | 3392 | public static function update_ucsdb() { |
2758 | 3393 | global $tmp_dir, $globalDebug; |
2759 | - if ($globalDebug) echo "Download UCS DB : Download..."; |
|
3394 | + if ($globalDebug) { |
|
3395 | + echo "Download UCS DB : Download..."; |
|
3396 | + } |
|
2760 | 3397 | update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/9-1-17-update/UCS_Satellite_Database_officialname_9-1-2017.txt',$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
2761 | 3398 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2762 | - if ($globalDebug) echo "Add to DB..."; |
|
3399 | + if ($globalDebug) { |
|
3400 | + echo "Add to DB..."; |
|
3401 | + } |
|
2763 | 3402 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
2764 | - } else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'." doesn't exist. Download failed."; |
|
3403 | + } else { |
|
3404 | + $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'." doesn't exist. Download failed."; |
|
3405 | + } |
|
2765 | 3406 | if ($error != '') { |
2766 | 3407 | echo $error."\n"; |
2767 | - } elseif ($globalDebug) echo "Done\n"; |
|
3408 | + } elseif ($globalDebug) { |
|
3409 | + echo "Done\n"; |
|
3410 | + } |
|
2768 | 3411 | return ''; |
2769 | 3412 | } |
2770 | 3413 | |
2771 | 3414 | public static function update_celestrak() { |
2772 | 3415 | global $tmp_dir, $globalDebug; |
2773 | - if ($globalDebug) echo "Download Celestrak DB : Download..."; |
|
3416 | + if ($globalDebug) { |
|
3417 | + echo "Download Celestrak DB : Download..."; |
|
3418 | + } |
|
2774 | 3419 | update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
2775 | 3420 | if (file_exists($tmp_dir.'satcat.txt')) { |
2776 | - if ($globalDebug) echo "Add to DB..."; |
|
3421 | + if ($globalDebug) { |
|
3422 | + echo "Add to DB..."; |
|
3423 | + } |
|
2777 | 3424 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
2778 | - } else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3425 | + } else { |
|
3426 | + $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3427 | + } |
|
2779 | 3428 | if ($error != '') { |
2780 | 3429 | echo $error."\n"; |
2781 | - } elseif ($globalDebug) echo "Done\n"; |
|
3430 | + } elseif ($globalDebug) { |
|
3431 | + echo "Done\n"; |
|
3432 | + } |
|
2782 | 3433 | return ''; |
2783 | 3434 | } |
2784 | 3435 | |
2785 | 3436 | public static function update_models() { |
2786 | 3437 | global $tmp_dir, $globalDebug; |
2787 | 3438 | $error = ''; |
2788 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
3439 | + if ($globalDebug) { |
|
3440 | + echo "Models from FlightAirMap website : Download..."; |
|
3441 | + } |
|
2789 | 3442 | if (!is_writable(dirname(__FILE__).'/../models')) { |
2790 | - if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
3443 | + if ($globalDebug) { |
|
3444 | + echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
3445 | + } |
|
2791 | 3446 | return ''; |
2792 | 3447 | } |
2793 | 3448 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
2794 | 3449 | if (file_exists($tmp_dir.'models.md5sum')) { |
2795 | - if ($globalDebug) echo "Check files...\n"; |
|
3450 | + if ($globalDebug) { |
|
3451 | + echo "Check files...\n"; |
|
3452 | + } |
|
2796 | 3453 | $newmodelsdb = array(); |
2797 | 3454 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
2798 | 3455 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2811,18 +3468,28 @@ discard block |
||
2811 | 3468 | } |
2812 | 3469 | $diff = array_diff($newmodelsdb,$modelsdb); |
2813 | 3470 | foreach ($diff as $key => $value) { |
2814 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3471 | + if ($globalDebug) { |
|
3472 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3473 | + } |
|
2815 | 3474 | update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
2816 | 3475 | } |
2817 | 3476 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
2818 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3477 | + } else { |
|
3478 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3479 | + } |
|
2819 | 3480 | if ($error != '') { |
2820 | 3481 | return $error; |
2821 | - } elseif ($globalDebug) echo "Done\n"; |
|
2822 | - if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
3482 | + } elseif ($globalDebug) { |
|
3483 | + echo "Done\n"; |
|
3484 | + } |
|
3485 | + if ($globalDebug) { |
|
3486 | + echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
3487 | + } |
|
2823 | 3488 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
2824 | 3489 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
2825 | - if ($globalDebug) echo "Check files...\n"; |
|
3490 | + if ($globalDebug) { |
|
3491 | + echo "Check files...\n"; |
|
3492 | + } |
|
2826 | 3493 | $newmodelsdb = array(); |
2827 | 3494 | if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
2828 | 3495 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2841,29 +3508,43 @@ discard block |
||
2841 | 3508 | } |
2842 | 3509 | $diff = array_diff($newmodelsdb,$modelsdb); |
2843 | 3510 | foreach ($diff as $key => $value) { |
2844 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3511 | + if ($globalDebug) { |
|
3512 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3513 | + } |
|
2845 | 3514 | update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
2846 | 3515 | |
2847 | 3516 | } |
2848 | 3517 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
2849 | - } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
3518 | + } else { |
|
3519 | + $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
3520 | + } |
|
2850 | 3521 | if ($error != '') { |
2851 | 3522 | return $error; |
2852 | - } elseif ($globalDebug) echo "Done\n"; |
|
3523 | + } elseif ($globalDebug) { |
|
3524 | + echo "Done\n"; |
|
3525 | + } |
|
2853 | 3526 | return ''; |
2854 | 3527 | } |
2855 | 3528 | public static function update_weather_models() { |
2856 | 3529 | global $tmp_dir, $globalDebug; |
2857 | 3530 | $error = ''; |
2858 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
3531 | + if ($globalDebug) { |
|
3532 | + echo "Models from FlightAirMap website : Download..."; |
|
3533 | + } |
|
2859 | 3534 | if (!is_writable(dirname(__FILE__).'/../models/gltf2/weather')) { |
2860 | - if ($globalDebug) echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !'; |
|
3535 | + if ($globalDebug) { |
|
3536 | + echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !'; |
|
3537 | + } |
|
2861 | 3538 | return ''; |
2862 | 3539 | } |
2863 | - if ($globalDebug) echo "Weather Models from FlightAirMap website : Download..."; |
|
3540 | + if ($globalDebug) { |
|
3541 | + echo "Weather Models from FlightAirMap website : Download..."; |
|
3542 | + } |
|
2864 | 3543 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum'); |
2865 | 3544 | if (file_exists($tmp_dir.'modelsweather.md5sum')) { |
2866 | - if ($globalDebug) echo "Check files...\n"; |
|
3545 | + if ($globalDebug) { |
|
3546 | + echo "Check files...\n"; |
|
3547 | + } |
|
2867 | 3548 | $newmodelsdb = array(); |
2868 | 3549 | if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) { |
2869 | 3550 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2882,25 +3563,35 @@ discard block |
||
2882 | 3563 | } |
2883 | 3564 | $diff = array_diff($newmodelsdb,$modelsdb); |
2884 | 3565 | foreach ($diff as $key => $value) { |
2885 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3566 | + if ($globalDebug) { |
|
3567 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3568 | + } |
|
2886 | 3569 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
2887 | 3570 | |
2888 | 3571 | } |
2889 | 3572 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
2890 | - } else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
|
3573 | + } else { |
|
3574 | + $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
|
3575 | + } |
|
2891 | 3576 | if ($error != '') { |
2892 | 3577 | return $error; |
2893 | - } elseif ($globalDebug) echo "Done\n"; |
|
3578 | + } elseif ($globalDebug) { |
|
3579 | + echo "Done\n"; |
|
3580 | + } |
|
2894 | 3581 | return ''; |
2895 | 3582 | } |
2896 | 3583 | |
2897 | 3584 | public static function update_liveries() { |
2898 | 3585 | global $tmp_dir, $globalDebug; |
2899 | 3586 | $error = ''; |
2900 | - if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
|
3587 | + if ($globalDebug) { |
|
3588 | + echo "Liveries from FlightAirMap website : Download..."; |
|
3589 | + } |
|
2901 | 3590 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
2902 | 3591 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
2903 | - if ($globalDebug) echo "Check files...\n"; |
|
3592 | + if ($globalDebug) { |
|
3593 | + echo "Check files...\n"; |
|
3594 | + } |
|
2904 | 3595 | $newmodelsdb = array(); |
2905 | 3596 | if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
2906 | 3597 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2919,15 +3610,21 @@ discard block |
||
2919 | 3610 | } |
2920 | 3611 | $diff = array_diff($newmodelsdb,$modelsdb); |
2921 | 3612 | foreach ($diff as $key => $value) { |
2922 | - if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
|
3613 | + if ($globalDebug) { |
|
3614 | + echo 'Downloading liveries '.$key.' ...'."\n"; |
|
3615 | + } |
|
2923 | 3616 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
2924 | 3617 | |
2925 | 3618 | } |
2926 | 3619 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
2927 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3620 | + } else { |
|
3621 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3622 | + } |
|
2928 | 3623 | if ($error != '') { |
2929 | 3624 | return $error; |
2930 | - } elseif ($globalDebug) echo "Done\n"; |
|
3625 | + } elseif ($globalDebug) { |
|
3626 | + echo "Done\n"; |
|
3627 | + } |
|
2931 | 3628 | return ''; |
2932 | 3629 | } |
2933 | 3630 | |
@@ -2935,13 +3632,19 @@ discard block |
||
2935 | 3632 | global $tmp_dir, $globalDebug; |
2936 | 3633 | $error = ''; |
2937 | 3634 | if (!is_writable(dirname(__FILE__).'/../models')) { |
2938 | - if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
3635 | + if ($globalDebug) { |
|
3636 | + echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
3637 | + } |
|
2939 | 3638 | return ''; |
2940 | 3639 | } |
2941 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
3640 | + if ($globalDebug) { |
|
3641 | + echo "Space models from FlightAirMap website : Download..."; |
|
3642 | + } |
|
2942 | 3643 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
2943 | 3644 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2944 | - if ($globalDebug) echo "Check files...\n"; |
|
3645 | + if ($globalDebug) { |
|
3646 | + echo "Check files...\n"; |
|
3647 | + } |
|
2945 | 3648 | $newmodelsdb = array(); |
2946 | 3649 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
2947 | 3650 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2960,15 +3663,21 @@ discard block |
||
2960 | 3663 | } |
2961 | 3664 | $diff = array_diff($newmodelsdb,$modelsdb); |
2962 | 3665 | foreach ($diff as $key => $value) { |
2963 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
3666 | + if ($globalDebug) { |
|
3667 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
3668 | + } |
|
2964 | 3669 | update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
2965 | 3670 | |
2966 | 3671 | } |
2967 | 3672 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
2968 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3673 | + } else { |
|
3674 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3675 | + } |
|
2969 | 3676 | if ($error != '') { |
2970 | 3677 | return $error; |
2971 | - } elseif ($globalDebug) echo "Done\n"; |
|
3678 | + } elseif ($globalDebug) { |
|
3679 | + echo "Done\n"; |
|
3680 | + } |
|
2972 | 3681 | return ''; |
2973 | 3682 | } |
2974 | 3683 | |
@@ -2976,13 +3685,19 @@ discard block |
||
2976 | 3685 | global $tmp_dir, $globalDebug; |
2977 | 3686 | $error = ''; |
2978 | 3687 | if (!is_writable(dirname(__FILE__).'/../models/vehicules')) { |
2979 | - if ($globalDebug) echo dirname(__FILE__).'/../models/vehicules'.' is not writable !'; |
|
3688 | + if ($globalDebug) { |
|
3689 | + echo dirname(__FILE__).'/../models/vehicules'.' is not writable !'; |
|
3690 | + } |
|
2980 | 3691 | return ''; |
2981 | 3692 | } |
2982 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
3693 | + if ($globalDebug) { |
|
3694 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
3695 | + } |
|
2983 | 3696 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
2984 | 3697 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2985 | - if ($globalDebug) echo "Check files...\n"; |
|
3698 | + if ($globalDebug) { |
|
3699 | + echo "Check files...\n"; |
|
3700 | + } |
|
2986 | 3701 | $newmodelsdb = array(); |
2987 | 3702 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
2988 | 3703 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -3001,15 +3716,21 @@ discard block |
||
3001 | 3716 | } |
3002 | 3717 | $diff = array_diff($newmodelsdb,$modelsdb); |
3003 | 3718 | foreach ($diff as $key => $value) { |
3004 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3719 | + if ($globalDebug) { |
|
3720 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3721 | + } |
|
3005 | 3722 | update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
3006 | 3723 | |
3007 | 3724 | } |
3008 | 3725 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
3009 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3726 | + } else { |
|
3727 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3728 | + } |
|
3010 | 3729 | if ($error != '') { |
3011 | 3730 | return $error; |
3012 | - } elseif ($globalDebug) echo "Done\n"; |
|
3731 | + } elseif ($globalDebug) { |
|
3732 | + echo "Done\n"; |
|
3733 | + } |
|
3013 | 3734 | return ''; |
3014 | 3735 | } |
3015 | 3736 | |
@@ -3082,7 +3803,9 @@ discard block |
||
3082 | 3803 | } |
3083 | 3804 | |
3084 | 3805 | $error = ''; |
3085 | - if ($globalDebug) echo "Notam : Download..."; |
|
3806 | + if ($globalDebug) { |
|
3807 | + echo "Notam : Download..."; |
|
3808 | + } |
|
3086 | 3809 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
3087 | 3810 | if (file_exists($tmp_dir.'notam.rss')) { |
3088 | 3811 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -3097,14 +3820,30 @@ discard block |
||
3097 | 3820 | $data['fir'] = $q[0]; |
3098 | 3821 | $data['code'] = $q[1]; |
3099 | 3822 | $ifrvfr = $q[2]; |
3100 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
3101 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
3102 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
3103 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
3104 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
3105 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
3106 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
3107 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
3823 | + if ($ifrvfr == 'IV') { |
|
3824 | + $data['rules'] = 'IFR/VFR'; |
|
3825 | + } |
|
3826 | + if ($ifrvfr == 'I') { |
|
3827 | + $data['rules'] = 'IFR'; |
|
3828 | + } |
|
3829 | + if ($ifrvfr == 'V') { |
|
3830 | + $data['rules'] = 'VFR'; |
|
3831 | + } |
|
3832 | + if ($q[4] == 'A') { |
|
3833 | + $data['scope'] = 'Airport warning'; |
|
3834 | + } |
|
3835 | + if ($q[4] == 'E') { |
|
3836 | + $data['scope'] = 'Enroute warning'; |
|
3837 | + } |
|
3838 | + if ($q[4] == 'W') { |
|
3839 | + $data['scope'] = 'Navigation warning'; |
|
3840 | + } |
|
3841 | + if ($q[4] == 'AE') { |
|
3842 | + $data['scope'] = 'Airport/Enroute warning'; |
|
3843 | + } |
|
3844 | + if ($q[4] == 'AW') { |
|
3845 | + $data['scope'] = 'Airport/Navigation warning'; |
|
3846 | + } |
|
3108 | 3847 | //$data['scope'] = $q[4]; |
3109 | 3848 | $data['lower_limit'] = $q[5]; |
3110 | 3849 | $data['upper_limit'] = $q[6]; |
@@ -3112,8 +3851,12 @@ discard block |
||
3112 | 3851 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
3113 | 3852 | $latitude = $Common->convertDec($las,'latitude'); |
3114 | 3853 | $longitude = $Common->convertDec($lns,'longitude'); |
3115 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
3116 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
3854 | + if ($lac == 'S') { |
|
3855 | + $latitude = '-'.$latitude; |
|
3856 | + } |
|
3857 | + if ($lnc == 'W') { |
|
3858 | + $longitude = '-'.$longitude; |
|
3859 | + } |
|
3117 | 3860 | $data['center_latitude'] = $latitude; |
3118 | 3861 | $data['center_longitude'] = $longitude; |
3119 | 3862 | $data['radius'] = intval($radius); |
@@ -3143,10 +3886,14 @@ discard block |
||
3143 | 3886 | $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
3144 | 3887 | unset($data); |
3145 | 3888 | } |
3146 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3889 | + } else { |
|
3890 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3891 | + } |
|
3147 | 3892 | if ($error != '') { |
3148 | 3893 | return $error; |
3149 | - } elseif ($globalDebug) echo "Done\n"; |
|
3894 | + } elseif ($globalDebug) { |
|
3895 | + echo "Done\n"; |
|
3896 | + } |
|
3150 | 3897 | return ''; |
3151 | 3898 | } |
3152 | 3899 | |
@@ -3171,7 +3918,9 @@ discard block |
||
3171 | 3918 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
3172 | 3919 | $airspace_json = json_decode($airspace_lst,true); |
3173 | 3920 | foreach ($airspace_json['records'] as $airspace) { |
3174 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
3921 | + if ($globalDebug) { |
|
3922 | + echo $airspace['name']."...\n"; |
|
3923 | + } |
|
3175 | 3924 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
3176 | 3925 | if (file_exists($tmp_dir.$airspace['name'])) { |
3177 | 3926 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -3215,8 +3964,11 @@ discard block |
||
3215 | 3964 | return "error : ".$e->getMessage(); |
3216 | 3965 | } |
3217 | 3966 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3218 | - if ($row['nb'] > 0) return false; |
|
3219 | - else return true; |
|
3967 | + if ($row['nb'] > 0) { |
|
3968 | + return false; |
|
3969 | + } else { |
|
3970 | + return true; |
|
3971 | + } |
|
3220 | 3972 | } |
3221 | 3973 | |
3222 | 3974 | public static function insert_last_update() { |
@@ -3241,8 +3993,11 @@ discard block |
||
3241 | 3993 | return "error : ".$e->getMessage(); |
3242 | 3994 | } |
3243 | 3995 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3244 | - if ($row['nb'] > 0) return true; |
|
3245 | - else return false; |
|
3996 | + if ($row['nb'] > 0) { |
|
3997 | + return true; |
|
3998 | + } else { |
|
3999 | + return false; |
|
4000 | + } |
|
3246 | 4001 | } |
3247 | 4002 | |
3248 | 4003 | public static function check_geoid_version($version) { |
@@ -3255,8 +4010,11 @@ discard block |
||
3255 | 4010 | return "error : ".$e->getMessage(); |
3256 | 4011 | } |
3257 | 4012 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3258 | - if ($row['nb'] > 0) return true; |
|
3259 | - else return false; |
|
4013 | + if ($row['nb'] > 0) { |
|
4014 | + return true; |
|
4015 | + } else { |
|
4016 | + return false; |
|
4017 | + } |
|
3260 | 4018 | } |
3261 | 4019 | |
3262 | 4020 | public static function check_marine_identity_version($version) { |
@@ -3269,8 +4027,11 @@ discard block |
||
3269 | 4027 | return "error : ".$e->getMessage(); |
3270 | 4028 | } |
3271 | 4029 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3272 | - if ($row['nb'] > 0) return true; |
|
3273 | - else return false; |
|
4030 | + if ($row['nb'] > 0) { |
|
4031 | + return true; |
|
4032 | + } else { |
|
4033 | + return false; |
|
4034 | + } |
|
3274 | 4035 | } |
3275 | 4036 | |
3276 | 4037 | public static function check_satellite_version($version) { |
@@ -3283,8 +4044,11 @@ discard block |
||
3283 | 4044 | return "error : ".$e->getMessage(); |
3284 | 4045 | } |
3285 | 4046 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3286 | - if ($row['nb'] > 0) return true; |
|
3287 | - else return false; |
|
4047 | + if ($row['nb'] > 0) { |
|
4048 | + return true; |
|
4049 | + } else { |
|
4050 | + return false; |
|
4051 | + } |
|
3288 | 4052 | } |
3289 | 4053 | |
3290 | 4054 | public static function check_airlines_version($version) { |
@@ -3297,8 +4061,11 @@ discard block |
||
3297 | 4061 | return "error : ".$e->getMessage(); |
3298 | 4062 | } |
3299 | 4063 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3300 | - if ($row['nb'] > 0) return true; |
|
3301 | - else return false; |
|
4064 | + if ($row['nb'] > 0) { |
|
4065 | + return true; |
|
4066 | + } else { |
|
4067 | + return false; |
|
4068 | + } |
|
3302 | 4069 | } |
3303 | 4070 | |
3304 | 4071 | public static function check_notam_version($version) { |
@@ -3311,8 +4078,11 @@ discard block |
||
3311 | 4078 | return "error : ".$e->getMessage(); |
3312 | 4079 | } |
3313 | 4080 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3314 | - if ($row['nb'] > 0) return true; |
|
3315 | - else return false; |
|
4081 | + if ($row['nb'] > 0) { |
|
4082 | + return true; |
|
4083 | + } else { |
|
4084 | + return false; |
|
4085 | + } |
|
3316 | 4086 | } |
3317 | 4087 | |
3318 | 4088 | public static function insert_airlines_version($version) { |
@@ -3402,8 +4172,11 @@ discard block |
||
3402 | 4172 | return "error : ".$e->getMessage(); |
3403 | 4173 | } |
3404 | 4174 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3405 | - if ($row['nb'] > 0) return false; |
|
3406 | - else return true; |
|
4175 | + if ($row['nb'] > 0) { |
|
4176 | + return false; |
|
4177 | + } else { |
|
4178 | + return true; |
|
4179 | + } |
|
3407 | 4180 | } |
3408 | 4181 | |
3409 | 4182 | public static function insert_last_notam_update() { |
@@ -3433,8 +4206,11 @@ discard block |
||
3433 | 4206 | return "error : ".$e->getMessage(); |
3434 | 4207 | } |
3435 | 4208 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3436 | - if ($row['nb'] > 0) return false; |
|
3437 | - else return true; |
|
4209 | + if ($row['nb'] > 0) { |
|
4210 | + return false; |
|
4211 | + } else { |
|
4212 | + return true; |
|
4213 | + } |
|
3438 | 4214 | } |
3439 | 4215 | |
3440 | 4216 | public static function insert_last_airspace_update() { |
@@ -3464,8 +4240,11 @@ discard block |
||
3464 | 4240 | return "error : ".$e->getMessage(); |
3465 | 4241 | } |
3466 | 4242 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3467 | - if ($row['nb'] > 0) return false; |
|
3468 | - else return true; |
|
4243 | + if ($row['nb'] > 0) { |
|
4244 | + return false; |
|
4245 | + } else { |
|
4246 | + return true; |
|
4247 | + } |
|
3469 | 4248 | } |
3470 | 4249 | |
3471 | 4250 | public static function insert_last_geoid_update() { |
@@ -3495,8 +4274,11 @@ discard block |
||
3495 | 4274 | return "error : ".$e->getMessage(); |
3496 | 4275 | } |
3497 | 4276 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3498 | - if ($row['nb'] > 0) return false; |
|
3499 | - else return true; |
|
4277 | + if ($row['nb'] > 0) { |
|
4278 | + return false; |
|
4279 | + } else { |
|
4280 | + return true; |
|
4281 | + } |
|
3500 | 4282 | } |
3501 | 4283 | |
3502 | 4284 | public static function insert_last_owner_update() { |
@@ -3526,8 +4308,11 @@ discard block |
||
3526 | 4308 | return "error : ".$e->getMessage(); |
3527 | 4309 | } |
3528 | 4310 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3529 | - if ($row['nb'] > 0) return false; |
|
3530 | - else return true; |
|
4311 | + if ($row['nb'] > 0) { |
|
4312 | + return false; |
|
4313 | + } else { |
|
4314 | + return true; |
|
4315 | + } |
|
3531 | 4316 | } |
3532 | 4317 | |
3533 | 4318 | public static function insert_last_fires_update() { |
@@ -3557,8 +4342,11 @@ discard block |
||
3557 | 4342 | return "error : ".$e->getMessage(); |
3558 | 4343 | } |
3559 | 4344 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3560 | - if ($row['nb'] > 0) return false; |
|
3561 | - else return true; |
|
4345 | + if ($row['nb'] > 0) { |
|
4346 | + return false; |
|
4347 | + } else { |
|
4348 | + return true; |
|
4349 | + } |
|
3562 | 4350 | } |
3563 | 4351 | |
3564 | 4352 | public static function insert_last_airlines_update() { |
@@ -3588,8 +4376,11 @@ discard block |
||
3588 | 4376 | return "error : ".$e->getMessage(); |
3589 | 4377 | } |
3590 | 4378 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3591 | - if ($row['nb'] > 0) return false; |
|
3592 | - else return true; |
|
4379 | + if ($row['nb'] > 0) { |
|
4380 | + return false; |
|
4381 | + } else { |
|
4382 | + return true; |
|
4383 | + } |
|
3593 | 4384 | } |
3594 | 4385 | |
3595 | 4386 | public static function insert_last_schedules_update() { |
@@ -3619,8 +4410,11 @@ discard block |
||
3619 | 4410 | return "error : ".$e->getMessage(); |
3620 | 4411 | } |
3621 | 4412 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3622 | - if ($row['nb'] > 0) return false; |
|
3623 | - else return true; |
|
4413 | + if ($row['nb'] > 0) { |
|
4414 | + return false; |
|
4415 | + } else { |
|
4416 | + return true; |
|
4417 | + } |
|
3624 | 4418 | } |
3625 | 4419 | |
3626 | 4420 | public static function insert_last_tle_update() { |
@@ -3650,8 +4444,11 @@ discard block |
||
3650 | 4444 | return "error : ".$e->getMessage(); |
3651 | 4445 | } |
3652 | 4446 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3653 | - if ($row['nb'] > 0) return false; |
|
3654 | - else return true; |
|
4447 | + if ($row['nb'] > 0) { |
|
4448 | + return false; |
|
4449 | + } else { |
|
4450 | + return true; |
|
4451 | + } |
|
3655 | 4452 | } |
3656 | 4453 | |
3657 | 4454 | public static function insert_last_ucsdb_update() { |
@@ -3681,8 +4478,11 @@ discard block |
||
3681 | 4478 | return "error : ".$e->getMessage(); |
3682 | 4479 | } |
3683 | 4480 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3684 | - if ($row['nb'] > 0) return false; |
|
3685 | - else return true; |
|
4481 | + if ($row['nb'] > 0) { |
|
4482 | + return false; |
|
4483 | + } else { |
|
4484 | + return true; |
|
4485 | + } |
|
3686 | 4486 | } |
3687 | 4487 | |
3688 | 4488 | public static function insert_last_celestrak_update() { |
@@ -3712,8 +4512,11 @@ discard block |
||
3712 | 4512 | return "error : ".$e->getMessage(); |
3713 | 4513 | } |
3714 | 4514 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3715 | - if ($row['nb'] > 0) return false; |
|
3716 | - else return true; |
|
4515 | + if ($row['nb'] > 0) { |
|
4516 | + return false; |
|
4517 | + } else { |
|
4518 | + return true; |
|
4519 | + } |
|
3717 | 4520 | } |
3718 | 4521 | |
3719 | 4522 | public static function check_last_satellite_update() { |
@@ -3731,8 +4534,11 @@ discard block |
||
3731 | 4534 | return "error : ".$e->getMessage(); |
3732 | 4535 | } |
3733 | 4536 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3734 | - if ($row['nb'] > 0) return false; |
|
3735 | - else return true; |
|
4537 | + if ($row['nb'] > 0) { |
|
4538 | + return false; |
|
4539 | + } else { |
|
4540 | + return true; |
|
4541 | + } |
|
3736 | 4542 | } |
3737 | 4543 | |
3738 | 4544 | public static function insert_last_marine_identity_update() { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | require_once(dirname(__FILE__).'/class.create_db.php'); |
23 | 23 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.settings.php'); |
25 | -$title="Install"; |
|
25 | +$title = "Install"; |
|
26 | 26 | require(dirname(__FILE__).'/../require/settings.php'); |
27 | 27 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
28 | 28 | require(dirname(__FILE__).'/header.php'); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | if (!extension_loaded('curl')) { |
94 | 94 | $error[] = "Curl is not loaded."; |
95 | 95 | } |
96 | - if(function_exists('apache_get_modules') ){ |
|
97 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
96 | + if (function_exists('apache_get_modules')) { |
|
97 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
98 | 98 | $error[] = "mod_rewrite is not available."; |
99 | 99 | } |
100 | 100 | /* |
@@ -113,22 +113,22 @@ discard block |
||
113 | 113 | $alllng = $Language->listLocaleDir(); |
114 | 114 | if (count($alllng) != count($availablelng)) { |
115 | 115 | $notavailable = array(); |
116 | - foreach($alllng as $lng) { |
|
116 | + foreach ($alllng as $lng) { |
|
117 | 117 | if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
118 | 118 | } |
119 | - print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
119 | + print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ', $notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>'; |
123 | 123 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
124 | 124 | if (function_exists('get_headers')) { |
125 | 125 | //$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
126 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
127 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
126 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
127 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
128 | 128 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
129 | 129 | } else { |
130 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
131 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
130 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
131 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
132 | 132 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
133 | 133 | } |
134 | 134 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
209 | 209 | if (isset($_SERVER['REQUEST_URI'])) { |
210 | 210 | $URL = $_SERVER['REQUEST_URI']; |
211 | - $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
|
211 | + $globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL))); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | ?> |
@@ -549,13 +549,13 @@ discard block |
||
549 | 549 | ?> |
550 | 550 | <tr> |
551 | 551 | <?php |
552 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
552 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
553 | 553 | ?> |
554 | 554 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
555 | 555 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
556 | 556 | <?php |
557 | 557 | } else { |
558 | - $hostport = explode(':',$source['host']); |
|
558 | + $hostport = explode(':', $source['host']); |
|
559 | 559 | if (isset($hostport[1])) { |
560 | 560 | $host = $hostport[0]; |
561 | 561 | $port = $hostport[1]; |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | <select name="timezones[]" id="timezones"> |
607 | 607 | <?php |
608 | 608 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
609 | - foreach($timezonelist as $timezones){ |
|
609 | + foreach ($timezonelist as $timezones) { |
|
610 | 610 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
611 | 611 | print '<option selected>'.$timezones.'</option>'; |
612 | 612 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | <select name="timezones[]" id="timezones"> |
663 | 663 | <?php |
664 | 664 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
665 | - foreach($timezonelist as $timezones){ |
|
665 | + foreach ($timezonelist as $timezones) { |
|
666 | 666 | if ($timezones == 'UTC') { |
667 | 667 | print '<option selected>'.$timezones.'</option>'; |
668 | 668 | } else print '<option>'.$timezones.'</option>'; |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | <br /> |
1143 | 1143 | <p> |
1144 | 1144 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1145 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1145 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
1146 | 1146 | </p> |
1147 | 1147 | <br /> |
1148 | 1148 | <p> |
@@ -1225,14 +1225,14 @@ discard block |
||
1225 | 1225 | $error = ''; |
1226 | 1226 | |
1227 | 1227 | if (isset($_POST['dbtype'])) { |
1228 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
1229 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
1230 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
1231 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
1232 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
1233 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
1234 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
1235 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
1228 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
1229 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
1230 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
1231 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
1232 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
1233 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
1234 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
1235 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
1236 | 1236 | |
1237 | 1237 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
1238 | 1238 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1252,59 +1252,59 @@ discard block |
||
1252 | 1252 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
1253 | 1253 | */ |
1254 | 1254 | |
1255 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
1255 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
1256 | 1256 | |
1257 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1258 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1259 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1260 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1261 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1257 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1258 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1259 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1260 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1261 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1262 | 1262 | |
1263 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1264 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1265 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1266 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1267 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1268 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1269 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1270 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1271 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1272 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1263 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1264 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1265 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1266 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1267 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1268 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1269 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1270 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1271 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1272 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1273 | 1273 | |
1274 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1275 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1276 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1277 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1278 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1279 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1274 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1275 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1276 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1277 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1278 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1279 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1280 | 1280 | |
1281 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1282 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1281 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1282 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1283 | 1283 | |
1284 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1285 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1286 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1284 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1285 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1286 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1287 | 1287 | |
1288 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1288 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1289 | 1289 | if ($acars == 'acars') { |
1290 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1290 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1291 | 1291 | } else { |
1292 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1292 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1293 | 1293 | } |
1294 | - $updatecheck = filter_input(INPUT_POST,'updatecheck',FILTER_SANITIZE_STRING); |
|
1294 | + $updatecheck = filter_input(INPUT_POST, 'updatecheck', FILTER_SANITIZE_STRING); |
|
1295 | 1295 | if ($updatecheck == 'updatecheck') { |
1296 | - $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'TRUE')); |
|
1296 | + $settings = array_merge($settings, array('globalDisableUpdateCheck' => 'TRUE')); |
|
1297 | 1297 | } else { |
1298 | - $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'FALSE')); |
|
1298 | + $settings = array_merge($settings, array('globalDisableUpdateCheck' => 'FALSE')); |
|
1299 | 1299 | } |
1300 | 1300 | |
1301 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1302 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1303 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1301 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1302 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1303 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1304 | 1304 | |
1305 | - $sailawayemail = filter_input(INPUT_POST,'sailawayemail',FILTER_SANITIZE_STRING); |
|
1306 | - $sailawaypass = filter_input(INPUT_POST,'sailawaypassword',FILTER_SANITIZE_STRING); |
|
1307 | - $settings = array_merge($settings,array('globalSailaway' => array('email' => $sailawayemail,'password' => $sailawaypass))); |
|
1305 | + $sailawayemail = filter_input(INPUT_POST, 'sailawayemail', FILTER_SANITIZE_STRING); |
|
1306 | + $sailawaypass = filter_input(INPUT_POST, 'sailawaypassword', FILTER_SANITIZE_STRING); |
|
1307 | + $settings = array_merge($settings, array('globalSailaway' => array('email' => $sailawayemail, 'password' => $sailawaypass))); |
|
1308 | 1308 | |
1309 | 1309 | $source_name = $_POST['source_name']; |
1310 | 1310 | $source_latitude = $_POST['source_latitude']; |
@@ -1318,8 +1318,8 @@ discard block |
||
1318 | 1318 | |
1319 | 1319 | $sources = array(); |
1320 | 1320 | foreach ($source_name as $keys => $name) { |
1321 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1322 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1321 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
1322 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
1323 | 1323 | } |
1324 | 1324 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1325 | 1325 | |
@@ -1328,16 +1328,16 @@ discard block |
||
1328 | 1328 | $newstype = $_POST['newstype']; |
1329 | 1329 | |
1330 | 1330 | $newsfeeds = array(); |
1331 | - foreach($newsurl as $newskey => $url) { |
|
1331 | + foreach ($newsurl as $newskey => $url) { |
|
1332 | 1332 | if ($url != '') { |
1333 | 1333 | $type = $newstype[$newskey]; |
1334 | 1334 | $lng = $newslng[$newskey]; |
1335 | 1335 | if (isset($newsfeeds[$type][$lng])) { |
1336 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1336 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url)); |
|
1337 | 1337 | } else $newsfeeds[$type][$lng] = array($url); |
1338 | 1338 | } |
1339 | 1339 | } |
1340 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
1340 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
1341 | 1341 | |
1342 | 1342 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
1343 | 1343 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1348,28 +1348,28 @@ discard block |
||
1348 | 1348 | $sbsurl = $_POST['sbsurl']; |
1349 | 1349 | */ |
1350 | 1350 | |
1351 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1352 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1353 | - $globalvm = filter_input(INPUT_POST,'globalvm',FILTER_SANITIZE_STRING); |
|
1354 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1355 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1356 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1357 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1358 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1359 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1351 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1352 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1353 | + $globalvm = filter_input(INPUT_POST, 'globalvm', FILTER_SANITIZE_STRING); |
|
1354 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1355 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1356 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1357 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1358 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1359 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1360 | 1360 | |
1361 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1362 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1363 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1364 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1365 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1366 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1367 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1368 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1369 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1370 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1371 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1372 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1361 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1362 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1363 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1364 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1365 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1366 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1367 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1368 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1369 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1370 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1371 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1372 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1373 | 1373 | |
1374 | 1374 | /* |
1375 | 1375 | $globalSBS1Hosts = array(); |
@@ -1385,7 +1385,7 @@ discard block |
||
1385 | 1385 | } |
1386 | 1386 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1387 | 1387 | */ |
1388 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1388 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1389 | 1389 | $host = $_POST['host']; |
1390 | 1390 | $port = $_POST['port']; |
1391 | 1391 | $name = $_POST['name']; |
@@ -1402,115 +1402,115 @@ discard block |
||
1402 | 1402 | else $cov = 'FALSE'; |
1403 | 1403 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1404 | 1404 | else $arch = 'FALSE'; |
1405 | - if (strpos($format[$key],'_callback')) { |
|
1406 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1405 | + if (strpos($format[$key], '_callback')) { |
|
1406 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1407 | 1407 | } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) { |
1408 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1408 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1409 | 1409 | } |
1410 | 1410 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1411 | 1411 | } |
1412 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1412 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1413 | 1413 | |
1414 | 1414 | /* |
1415 | 1415 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1416 | 1416 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1417 | 1417 | */ |
1418 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1419 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1420 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1418 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1419 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1420 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1421 | 1421 | |
1422 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1423 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1422 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1423 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1424 | 1424 | |
1425 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1426 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1425 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1426 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1427 | 1427 | |
1428 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1429 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1428 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1429 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1430 | 1430 | |
1431 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1432 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1433 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1434 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1431 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1432 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1433 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1434 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1435 | 1435 | |
1436 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1437 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1438 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1436 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1437 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1438 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1439 | 1439 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1440 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1441 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1440 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1441 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1442 | 1442 | |
1443 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1444 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1445 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1446 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1447 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1448 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1449 | - $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT); |
|
1450 | - $settings = array_merge($settings,array('globalMinFetch' => $minfetch)); |
|
1451 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1452 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1443 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1444 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1445 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1446 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1447 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1448 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1449 | + $minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT); |
|
1450 | + $settings = array_merge($settings, array('globalMinFetch' => $minfetch)); |
|
1451 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1452 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1453 | 1453 | |
1454 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1455 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1454 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1455 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1456 | 1456 | |
1457 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1458 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1457 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1458 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1459 | 1459 | |
1460 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1460 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1461 | 1461 | if ($archiveyear == "archiveyear") { |
1462 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1462 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1463 | 1463 | } else { |
1464 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1464 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1465 | 1465 | } |
1466 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1467 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1468 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1469 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1466 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1467 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1468 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1469 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1470 | 1470 | |
1471 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1472 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1473 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1474 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1471 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1472 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1473 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1474 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1475 | 1475 | |
1476 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1477 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1478 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1476 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1477 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1478 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1479 | 1479 | |
1480 | 1480 | // Create in settings.php keys not yet configurable if not already here |
1481 | 1481 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1482 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1482 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1483 | 1483 | |
1484 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1484 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1485 | 1485 | if ($resetyearstats == 'resetyearstats') { |
1486 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1486 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1487 | 1487 | } else { |
1488 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1488 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1489 | 1489 | } |
1490 | 1490 | |
1491 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1491 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1492 | 1492 | if ($archive == 'archive') { |
1493 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1493 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1494 | 1494 | } else { |
1495 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1495 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1496 | 1496 | } |
1497 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1497 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1498 | 1498 | if ($archiveresults == 'archiveresults') { |
1499 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1499 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1500 | 1500 | } else { |
1501 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1501 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1502 | 1502 | } |
1503 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1503 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1504 | 1504 | if ($daemon == 'daemon') { |
1505 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1505 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1506 | 1506 | } else { |
1507 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1507 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1508 | 1508 | } |
1509 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1509 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1510 | 1510 | if ($schedules == 'schedules') { |
1511 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1511 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1512 | 1512 | } else { |
1513 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1513 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | /* |
@@ -1521,311 +1521,311 @@ discard block |
||
1521 | 1521 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1522 | 1522 | } |
1523 | 1523 | */ |
1524 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1525 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1526 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1527 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1528 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1524 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1525 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1526 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1527 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1528 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1529 | 1529 | $va = false; |
1530 | 1530 | if ($globalivao == 'ivao') { |
1531 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1531 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1532 | 1532 | $va = true; |
1533 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1533 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1534 | 1534 | if ($globalvatsim == 'vatsim') { |
1535 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1535 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1536 | 1536 | $va = true; |
1537 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1537 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1538 | 1538 | if ($globalphpvms == 'phpvms') { |
1539 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1539 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1540 | 1540 | $va = true; |
1541 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1541 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1542 | 1542 | if ($globalvam == 'vam') { |
1543 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1543 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1544 | 1544 | $va = true; |
1545 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1545 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1546 | 1546 | if ($va) { |
1547 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1548 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1547 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1548 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1549 | 1549 | if ($globalva == 'va' || $va) { |
1550 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1551 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1550 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1551 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1552 | 1552 | } else { |
1553 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1554 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1555 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1553 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1554 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1555 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1556 | 1556 | } |
1557 | 1557 | if ($globalvm == 'vm') { |
1558 | - $settings = array_merge($settings,array('globalVM' => 'TRUE')); |
|
1558 | + $settings = array_merge($settings, array('globalVM' => 'TRUE')); |
|
1559 | 1559 | } else { |
1560 | - $settings = array_merge($settings,array('globalVM' => 'FALSE')); |
|
1560 | + $settings = array_merge($settings, array('globalVM' => 'FALSE')); |
|
1561 | 1561 | } |
1562 | 1562 | |
1563 | - $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING); |
|
1563 | + $mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING); |
|
1564 | 1564 | if ($mapoffline == 'mapoffline') { |
1565 | - $settings = array_merge($settings,array('globalMapOffline' => 'TRUE')); |
|
1565 | + $settings = array_merge($settings, array('globalMapOffline' => 'TRUE')); |
|
1566 | 1566 | } else { |
1567 | - $settings = array_merge($settings,array('globalMapOffline' => 'FALSE')); |
|
1567 | + $settings = array_merge($settings, array('globalMapOffline' => 'FALSE')); |
|
1568 | 1568 | } |
1569 | - $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING); |
|
1569 | + $globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING); |
|
1570 | 1570 | if ($globaloffline == 'globaloffline') { |
1571 | - $settings = array_merge($settings,array('globalOffline' => 'TRUE')); |
|
1571 | + $settings = array_merge($settings, array('globalOffline' => 'TRUE')); |
|
1572 | 1572 | } else { |
1573 | - $settings = array_merge($settings,array('globalOffline' => 'FALSE')); |
|
1573 | + $settings = array_merge($settings, array('globalOffline' => 'FALSE')); |
|
1574 | 1574 | } |
1575 | 1575 | |
1576 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1576 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1577 | 1577 | if ($notam == 'notam') { |
1578 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1578 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1579 | 1579 | } else { |
1580 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1580 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1581 | 1581 | } |
1582 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1582 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1583 | 1583 | if ($owner == 'owner') { |
1584 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1584 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1585 | 1585 | } else { |
1586 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1586 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1587 | 1587 | } |
1588 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1588 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1589 | 1589 | if ($map3d == 'map3d') { |
1590 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1590 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1591 | 1591 | } else { |
1592 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1592 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1593 | 1593 | } |
1594 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1594 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1595 | 1595 | if ($crash == 'crash') { |
1596 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1596 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1597 | 1597 | } else { |
1598 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1598 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1599 | 1599 | } |
1600 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
1600 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
1601 | 1601 | if ($fires == 'fires') { |
1602 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
1602 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
1603 | 1603 | } else { |
1604 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
1604 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
1605 | 1605 | } |
1606 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
1606 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
1607 | 1607 | if ($firessupport == 'firessupport') { |
1608 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
1608 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
1609 | 1609 | } else { |
1610 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
1610 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
1611 | 1611 | } |
1612 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1612 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1613 | 1613 | if ($mapsatellites == 'mapsatellites') { |
1614 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1614 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1615 | 1615 | } else { |
1616 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1616 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1617 | 1617 | } |
1618 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1618 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1619 | 1619 | if ($map3ddefault == 'map3ddefault') { |
1620 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1620 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1621 | 1621 | } else { |
1622 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1622 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1623 | 1623 | } |
1624 | - $one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING); |
|
1624 | + $one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING); |
|
1625 | 1625 | if ($one3dmodel == 'one3dmodel') { |
1626 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE')); |
|
1626 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE')); |
|
1627 | 1627 | } else { |
1628 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE')); |
|
1628 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE')); |
|
1629 | 1629 | } |
1630 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
1630 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
1631 | 1631 | if ($map3dliveries == 'map3dliveries') { |
1632 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
1632 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
1633 | 1633 | } else { |
1634 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
1634 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
1635 | 1635 | } |
1636 | - $map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING); |
|
1636 | + $map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING); |
|
1637 | 1637 | if ($map3dshadows == 'map3dshadows') { |
1638 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE')); |
|
1638 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE')); |
|
1639 | 1639 | } else { |
1640 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE')); |
|
1640 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE')); |
|
1641 | 1641 | } |
1642 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1642 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1643 | 1643 | if ($translate == 'translate') { |
1644 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1644 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1645 | 1645 | } else { |
1646 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1646 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1647 | 1647 | } |
1648 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1648 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1649 | 1649 | if ($realairlines == 'realairlines') { |
1650 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1650 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1651 | 1651 | } else { |
1652 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1652 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1653 | 1653 | } |
1654 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1654 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1655 | 1655 | if ($estimation == 'estimation') { |
1656 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1656 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1657 | 1657 | } else { |
1658 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1658 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1659 | 1659 | } |
1660 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1660 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1661 | 1661 | if ($metar == 'metar') { |
1662 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1662 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1663 | 1663 | } else { |
1664 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1664 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1665 | 1665 | } |
1666 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1666 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1667 | 1667 | if ($metarcycle == 'metarcycle') { |
1668 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1668 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1669 | 1669 | } else { |
1670 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1670 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1671 | 1671 | } |
1672 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1672 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1673 | 1673 | if ($fork == 'fork') { |
1674 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1674 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1675 | 1675 | } else { |
1676 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1676 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1677 | 1677 | } |
1678 | 1678 | |
1679 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1679 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1680 | 1680 | if ($colormap == 'colormap') { |
1681 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1681 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1682 | 1682 | } else { |
1683 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1683 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1684 | 1684 | } |
1685 | 1685 | |
1686 | 1686 | if (isset($_POST['aircrafticoncolor'])) { |
1687 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1688 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1687 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1688 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1689 | 1689 | } |
1690 | 1690 | if (isset($_POST['marineiconcolor'])) { |
1691 | - $marineiconcolor = filter_input(INPUT_POST,'marineiconcolor',FILTER_SANITIZE_STRING); |
|
1692 | - $settings = array_merge($settings,array('globalMarineIconColor' => substr($marineiconcolor,1))); |
|
1691 | + $marineiconcolor = filter_input(INPUT_POST, 'marineiconcolor', FILTER_SANITIZE_STRING); |
|
1692 | + $settings = array_merge($settings, array('globalMarineIconColor' => substr($marineiconcolor, 1))); |
|
1693 | 1693 | } |
1694 | 1694 | if (isset($_POST['trackericoncolor'])) { |
1695 | - $trackericoncolor = filter_input(INPUT_POST,'trackericoncolor',FILTER_SANITIZE_STRING); |
|
1696 | - $settings = array_merge($settings,array('globalTrackerIconColor' => substr($trackericoncolor,1))); |
|
1695 | + $trackericoncolor = filter_input(INPUT_POST, 'trackericoncolor', FILTER_SANITIZE_STRING); |
|
1696 | + $settings = array_merge($settings, array('globalTrackerIconColor' => substr($trackericoncolor, 1))); |
|
1697 | 1697 | } |
1698 | 1698 | if (isset($_POST['satelliteiconcolor'])) { |
1699 | - $satelliteiconcolor = filter_input(INPUT_POST,'satelliteiconcolor',FILTER_SANITIZE_STRING); |
|
1700 | - $settings = array_merge($settings,array('globalSatelliteIconColor' => substr($satelliteiconcolor,1))); |
|
1699 | + $satelliteiconcolor = filter_input(INPUT_POST, 'satelliteiconcolor', FILTER_SANITIZE_STRING); |
|
1700 | + $settings = array_merge($settings, array('globalSatelliteIconColor' => substr($satelliteiconcolor, 1))); |
|
1701 | 1701 | } |
1702 | 1702 | |
1703 | - $corsproxy = filter_input(INPUT_POST,'corsproxy',FILTER_SANITIZE_STRING); |
|
1704 | - $settings = array_merge($settings,array('globalCORSproxy' => $corsproxy)); |
|
1703 | + $corsproxy = filter_input(INPUT_POST, 'corsproxy', FILTER_SANITIZE_STRING); |
|
1704 | + $settings = array_merge($settings, array('globalCORSproxy' => $corsproxy)); |
|
1705 | 1705 | |
1706 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1707 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1706 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1707 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1708 | 1708 | |
1709 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1710 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1711 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1712 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1713 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1714 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1709 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1710 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1711 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1712 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1713 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1714 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1715 | 1715 | |
1716 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1716 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1717 | 1717 | if ($mappopup == 'mappopup') { |
1718 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1718 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1719 | 1719 | } else { |
1720 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1720 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1721 | 1721 | } |
1722 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1722 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1723 | 1723 | if ($airportpopup == 'airportpopup') { |
1724 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1724 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1725 | 1725 | } else { |
1726 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1726 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1727 | 1727 | } |
1728 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1728 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1729 | 1729 | if ($maphistory == 'maphistory') { |
1730 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1730 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1731 | 1731 | } else { |
1732 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1732 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1733 | 1733 | } |
1734 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1734 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1735 | 1735 | if ($maptooltip == 'maptooltip') { |
1736 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1736 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1737 | 1737 | } else { |
1738 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1738 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1739 | 1739 | } |
1740 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1740 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1741 | 1741 | if ($flightroute == 'flightroute') { |
1742 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1742 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1743 | 1743 | } else { |
1744 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1744 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1745 | 1745 | } |
1746 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1746 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1747 | 1747 | if ($flightremainingroute == 'flightremainingroute') { |
1748 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1748 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1749 | 1749 | } else { |
1750 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1750 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1751 | 1751 | } |
1752 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1752 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1753 | 1753 | if ($allflights == 'allflights') { |
1754 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1754 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1755 | 1755 | } else { |
1756 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1756 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1757 | 1757 | } |
1758 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1758 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1759 | 1759 | if ($bbox == 'bbox') { |
1760 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1760 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1761 | 1761 | } else { |
1762 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1762 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1763 | 1763 | } |
1764 | - $singlemodel = filter_input(INPUT_POST,'singlemodel',FILTER_SANITIZE_STRING); |
|
1764 | + $singlemodel = filter_input(INPUT_POST, 'singlemodel', FILTER_SANITIZE_STRING); |
|
1765 | 1765 | if ($singlemodel == 'singlemodel') { |
1766 | - $settings = array_merge($settings,array('globalMap3DSelected' => 'TRUE')); |
|
1766 | + $settings = array_merge($settings, array('globalMap3DSelected' => 'TRUE')); |
|
1767 | 1767 | } else { |
1768 | - $settings = array_merge($settings,array('globalMap3DSelected' => 'FALSE')); |
|
1768 | + $settings = array_merge($settings, array('globalMap3DSelected' => 'FALSE')); |
|
1769 | 1769 | } |
1770 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1770 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1771 | 1771 | if ($groundaltitude == 'groundaltitude') { |
1772 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1772 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1773 | 1773 | } else { |
1774 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1774 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1775 | 1775 | } |
1776 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1776 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1777 | 1777 | if ($waypoints == 'waypoints') { |
1778 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1778 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1779 | 1779 | } else { |
1780 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1780 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1781 | 1781 | } |
1782 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1782 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1783 | 1783 | if ($geoid == 'geoid') { |
1784 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1784 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1785 | 1785 | } else { |
1786 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1786 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1787 | 1787 | } |
1788 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1789 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1788 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1789 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1790 | 1790 | |
1791 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1791 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1792 | 1792 | if ($noairlines == 'noairlines') { |
1793 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1793 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1794 | 1794 | } else { |
1795 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1795 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1796 | 1796 | } |
1797 | 1797 | |
1798 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
1798 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
1799 | 1799 | if ($tsk == 'tsk') { |
1800 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
1800 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
1801 | 1801 | } else { |
1802 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
1802 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
1803 | 1803 | } |
1804 | - $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING); |
|
1804 | + $mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING); |
|
1805 | 1805 | if ($mapmatching == 'mapmatching') { |
1806 | - $settings = array_merge($settings,array('globalMapMatching' => 'TRUE')); |
|
1806 | + $settings = array_merge($settings, array('globalMapMatching' => 'TRUE')); |
|
1807 | 1807 | } else { |
1808 | - $settings = array_merge($settings,array('globalMapMatching' => 'FALSE')); |
|
1808 | + $settings = array_merge($settings, array('globalMapMatching' => 'FALSE')); |
|
1809 | 1809 | } |
1810 | - $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING); |
|
1811 | - $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1812 | - $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
|
1813 | - $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
|
1810 | + $mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING); |
|
1811 | + $settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1812 | + $graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING); |
|
1813 | + $settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper)); |
|
1814 | 1814 | |
1815 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1815 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1816 | 1816 | |
1817 | 1817 | // Set some defaults values... |
1818 | 1818 | if (!isset($globalAircraftImageSources)) { |
1819 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1820 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1819 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1820 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1821 | 1821 | } |
1822 | 1822 | |
1823 | 1823 | if (!isset($globalSchedulesSources)) { |
1824 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1825 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1824 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1825 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1826 | 1826 | } |
1827 | 1827 | |
1828 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1828 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1829 | 1829 | |
1830 | 1830 | if ($error == '') settings::modify_settings($settings); |
1831 | 1831 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -4,11 +4,19 @@ discard block |
||
4 | 4 | if (isset($_SESSION['error'])) { |
5 | 5 | header('Content-Encoding: none;'); |
6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
11 | -} |
|
7 | + if (isset($_SESSION['error'])) { |
|
8 | + unset($_SESSION['error']); |
|
9 | + } |
|
10 | + if (isset($_SESSION['errorlst'])) { |
|
11 | + unset($_SESSION['errorlst']); |
|
12 | + } |
|
13 | + if (isset($_SESSION['next'])) { |
|
14 | + unset($_SESSION['next']); |
|
15 | + } |
|
16 | + if (isset($_SESSION['install'])) { |
|
17 | + unset($_SESSION['install']); |
|
18 | + } |
|
19 | + } |
|
12 | 20 | /* |
13 | 21 | if (isset($_SESSION['errorlst'])) { |
14 | 22 | header('Content-Encoding: none;'); |
@@ -114,7 +122,9 @@ discard block |
||
114 | 122 | if (count($alllng) != count($availablelng)) { |
115 | 123 | $notavailable = array(); |
116 | 124 | foreach($alllng as $lng) { |
117 | - if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
|
125 | + if (!isset($availablelng[$lng])) { |
|
126 | + $notavailable[] = $lng; |
|
127 | + } |
|
118 | 128 | } |
119 | 129 | print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
120 | 130 | } |
@@ -175,31 +185,49 @@ discard block |
||
175 | 185 | </div> |
176 | 186 | <p> |
177 | 187 | <label for="dbhost">Database hostname</label> |
178 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
188 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
189 | + print $globalDBhost; |
|
190 | +} |
|
191 | +?>" /> |
|
179 | 192 | </p> |
180 | 193 | <p> |
181 | 194 | <label for="dbport">Database port</label> |
182 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
195 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
196 | + print $globalDBport; |
|
197 | +} |
|
198 | +?>" /> |
|
183 | 199 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
184 | 200 | </p> |
185 | 201 | <p> |
186 | 202 | <label for="dbname">Database name</label> |
187 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
203 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
204 | + print $globalDBname; |
|
205 | +} |
|
206 | +?>" /> |
|
188 | 207 | </p> |
189 | 208 | <p> |
190 | 209 | <label for="dbuser">Database user</label> |
191 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
210 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
211 | + print $globalDBuser; |
|
212 | +} |
|
213 | +?>" /> |
|
192 | 214 | </p> |
193 | 215 | <p> |
194 | 216 | <label for="dbuserpass">Database user password</label> |
195 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
217 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
218 | + print $globalDBpass; |
|
219 | +} |
|
220 | +?>" /> |
|
196 | 221 | </p> |
197 | 222 | </fieldset> |
198 | 223 | <fieldset id="site"> |
199 | 224 | <legend>Site configuration</legend> |
200 | 225 | <p> |
201 | 226 | <label for="sitename">Site name</label> |
202 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
227 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
228 | + print $globalName; |
|
229 | +} |
|
230 | +?>" /> |
|
203 | 231 | </p> |
204 | 232 | <p> |
205 | 233 | <label for="siteurl">Site directory</label> |
@@ -212,18 +240,27 @@ discard block |
||
212 | 240 | } |
213 | 241 | } |
214 | 242 | ?> |
215 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
243 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
244 | + print $globalURL; |
|
245 | +} |
|
246 | +?>" /> |
|
216 | 247 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
217 | 248 | <p class="help-block">Can be empty</p> |
218 | 249 | </p> |
219 | 250 | <p> |
220 | 251 | <label for="timezone">Timezone</label> |
221 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
252 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
253 | + print $globalTimezone; |
|
254 | +} |
|
255 | +?>" /> |
|
222 | 256 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
223 | 257 | </p> |
224 | 258 | <p> |
225 | 259 | <label for="language">Language</label> |
226 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
260 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
261 | + print $globalLanguage; |
|
262 | +} |
|
263 | +?>" /> |
|
227 | 264 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
228 | 265 | </p> |
229 | 266 | </fieldset> |
@@ -243,11 +280,17 @@ discard block |
||
243 | 280 | <div id="mapbox_data"> |
244 | 281 | <p> |
245 | 282 | <label for="mapboxid">Mapbox id</label> |
246 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
283 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
284 | + print $globalMapboxId; |
|
285 | +} |
|
286 | +?>" /> |
|
247 | 287 | </p> |
248 | 288 | <p> |
249 | 289 | <label for="mapboxtoken">Mapbox token</label> |
250 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
290 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
291 | + print $globalMapboxToken; |
|
292 | +} |
|
293 | +?>" /> |
|
251 | 294 | </p> |
252 | 295 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
253 | 296 | </div> |
@@ -255,7 +298,10 @@ discard block |
||
255 | 298 | <div id="google_data"> |
256 | 299 | <p> |
257 | 300 | <label for="googlekey">Google API key</label> |
258 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
301 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
302 | + print $globalGoogleAPIKey; |
|
303 | +} |
|
304 | +?>" /> |
|
259 | 305 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
260 | 306 | </p> |
261 | 307 | </div> |
@@ -263,7 +309,10 @@ discard block |
||
263 | 309 | <div id="bing_data"> |
264 | 310 | <p> |
265 | 311 | <label for="bingkey">Bing Map key</label> |
266 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
312 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
313 | + print $globalBingMapKey; |
|
314 | +} |
|
315 | +?>" /> |
|
267 | 316 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
268 | 317 | </p> |
269 | 318 | </div> |
@@ -271,7 +320,10 @@ discard block |
||
271 | 320 | <div id="mapquest_data"> |
272 | 321 | <p> |
273 | 322 | <label for="mapquestkey">MapQuest key</label> |
274 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
323 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
324 | + print $globalMapQuestKey; |
|
325 | +} |
|
326 | +?>" /> |
|
275 | 327 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
276 | 328 | </p> |
277 | 329 | </div> |
@@ -279,11 +331,17 @@ discard block |
||
279 | 331 | <div id="here_data"> |
280 | 332 | <p> |
281 | 333 | <label for="hereappid">Here App_Id</label> |
282 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
334 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
335 | + print $globalHereappId; |
|
336 | +} |
|
337 | +?>" /> |
|
283 | 338 | </p> |
284 | 339 | <p> |
285 | 340 | <label for="hereappcode">Here App_Code</label> |
286 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
341 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
342 | + print $globalHereappCode; |
|
343 | +} |
|
344 | +?>" /> |
|
287 | 345 | </p> |
288 | 346 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
289 | 347 | </div> |
@@ -291,7 +349,10 @@ discard block |
||
291 | 349 | <div id="openweathermap_data"> |
292 | 350 | <p> |
293 | 351 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
294 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
352 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
353 | + print $globalOpenWeatherMapKey; |
|
354 | +} |
|
355 | +?>" /> |
|
295 | 356 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
296 | 357 | </p> |
297 | 358 | </div> |
@@ -320,42 +381,86 @@ discard block |
||
320 | 381 | <legend>Coverage area</legend> |
321 | 382 | <p> |
322 | 383 | <label for="latitudemax">The maximum latitude (north)</label> |
323 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
384 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
385 | + print $globalLatitudeMax; |
|
386 | +} |
|
387 | +?>" /> |
|
324 | 388 | </p> |
325 | 389 | <p> |
326 | 390 | <label for="latitudemin">The minimum latitude (south)</label> |
327 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
391 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
392 | + print $globalLatitudeMin; |
|
393 | +} |
|
394 | +?>" /> |
|
328 | 395 | </p> |
329 | 396 | <p> |
330 | 397 | <label for="longitudemax">The maximum longitude (west)</label> |
331 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
398 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
399 | + print $globalLongitudeMax; |
|
400 | +} |
|
401 | +?>" /> |
|
332 | 402 | </p> |
333 | 403 | <p> |
334 | 404 | <label for="longitudemin">The minimum longitude (east)</label> |
335 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
405 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
406 | + print $globalLongitudeMin; |
|
407 | +} |
|
408 | +?>" /> |
|
336 | 409 | </p> |
337 | 410 | <p> |
338 | 411 | <label for="latitudecenter">The latitude center</label> |
339 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
412 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
413 | + print $globalCenterLatitude; |
|
414 | +} |
|
415 | +?>" /> |
|
340 | 416 | </p> |
341 | 417 | <p> |
342 | 418 | <label for="longitudecenter">The longitude center</label> |
343 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
419 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
420 | + print $globalCenterLongitude; |
|
421 | +} |
|
422 | +?>" /> |
|
344 | 423 | </p> |
345 | 424 | <p> |
346 | 425 | <label for="livezoom">Default Zoom on live map</label> |
347 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
426 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
427 | + print $globalLiveZoom; |
|
428 | +} else { |
|
429 | + print '9'; |
|
430 | +} |
|
431 | +?>" /> |
|
348 | 432 | </p> |
349 | 433 | <p> |
350 | 434 | <label for="squawk_country">Country for squawk usage</label> |
351 | 435 | <select name="squawk_country" id="squawk_country"> |
352 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
353 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
354 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
355 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
356 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
357 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
358 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
436 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
437 | + print ' selected '; |
|
438 | +} |
|
439 | +?>>UK</option> |
|
440 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
441 | + print ' selected '; |
|
442 | +} |
|
443 | +?>>NZ</option> |
|
444 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
445 | + print ' selected '; |
|
446 | +} |
|
447 | +?>>US</option> |
|
448 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
449 | + print ' selected '; |
|
450 | +} |
|
451 | +?>>AU</option> |
|
452 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
453 | + print ' selected '; |
|
454 | +} |
|
455 | +?>>NL</option> |
|
456 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
457 | + print ' selected '; |
|
458 | +} |
|
459 | +?>>FR</option> |
|
460 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
461 | + print ' selected '; |
|
462 | +} |
|
463 | +?>>TR</option> |
|
359 | 464 | </select> |
360 | 465 | </p> |
361 | 466 | </fieldset> |
@@ -364,15 +469,24 @@ discard block |
||
364 | 469 | <p><i>Only put in DB flights that are inside a circle</i></p> |
365 | 470 | <p> |
366 | 471 | <label for="latitude">Center latitude</label> |
367 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
472 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
473 | + echo $globalDistanceIgnore['latitude']; |
|
474 | +} |
|
475 | +?>" /> |
|
368 | 476 | </p> |
369 | 477 | <p> |
370 | 478 | <label for="longitude">Center longitude</label> |
371 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
479 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
480 | + echo $globalDistanceIgnore['longitude']; |
|
481 | +} |
|
482 | +?>" /> |
|
372 | 483 | </p> |
373 | 484 | <p> |
374 | 485 | <label for="Distance">Distance (in km)</label> |
375 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
486 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
487 | + echo $globalDistanceIgnore['distance']; |
|
488 | +} |
|
489 | +?>" /> |
|
376 | 490 | </p> |
377 | 491 | </fieldset> |
378 | 492 | <fieldset id="sourceloc"> |
@@ -495,22 +609,34 @@ discard block |
||
495 | 609 | <div id="flightaware_data"> |
496 | 610 | <p> |
497 | 611 | <label for="flightawareusername">FlightAware username</label> |
498 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
612 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
613 | + print $globalFlightAwareUsername; |
|
614 | +} |
|
615 | +?>" /> |
|
499 | 616 | </p> |
500 | 617 | <p> |
501 | 618 | <label for="flightawarepassword">FlightAware password/API key</label> |
502 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
619 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
620 | + print $globalFlightAwarePassword; |
|
621 | +} |
|
622 | +?>" /> |
|
503 | 623 | </p> |
504 | 624 | </div> |
505 | 625 | --> |
506 | 626 | <div id="sailaway_data"> |
507 | 627 | <p> |
508 | 628 | <label for="sailawayemail">Sailaway email</label> |
509 | - <input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) print $globalSailaway['email']; ?>" /> |
|
629 | + <input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) { |
|
630 | + print $globalSailaway['email']; |
|
631 | +} |
|
632 | +?>" /> |
|
510 | 633 | </p> |
511 | 634 | <p> |
512 | 635 | <label for="sailawaypassword">Sailaway password</label> |
513 | - <input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) print $globalSailaway['password']; ?>" /> |
|
636 | + <input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) { |
|
637 | + print $globalSailaway['password']; |
|
638 | +} |
|
639 | +?>" /> |
|
514 | 640 | </p> |
515 | 641 | </div> |
516 | 642 | |
@@ -552,7 +678,10 @@ discard block |
||
552 | 678 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
553 | 679 | ?> |
554 | 680 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
555 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
681 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
682 | + print $source['port']; |
|
683 | +} |
|
684 | +?>" /></td> |
|
556 | 685 | <?php |
557 | 686 | } else { |
558 | 687 | $hostport = explode(':',$source['host']); |
@@ -571,37 +700,118 @@ discard block |
||
571 | 700 | ?> |
572 | 701 | <td> |
573 | 702 | <select name="format[]" id="format"> |
574 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
575 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
576 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
577 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
578 | - <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option> |
|
579 | - <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option> |
|
580 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
581 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
582 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
583 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
584 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
585 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
586 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
587 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
588 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
589 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
590 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
591 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
592 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
593 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
594 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
595 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
596 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
597 | - <option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') print 'selected'; ?>>Sailaway</option> |
|
703 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
704 | + print 'selected'; |
|
705 | +} |
|
706 | +?>>Auto</option> |
|
707 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
708 | + print 'selected'; |
|
709 | +} |
|
710 | +?>>SBS</option> |
|
711 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
712 | + print 'selected'; |
|
713 | +} |
|
714 | +?>>TSV</option> |
|
715 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
716 | + print 'selected'; |
|
717 | +} |
|
718 | +?>>Raw</option> |
|
719 | + <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') { |
|
720 | + print 'selected'; |
|
721 | +} |
|
722 | +?>>Dump1090 aircraft.json</option> |
|
723 | + <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') { |
|
724 | + print 'selected'; |
|
725 | +} |
|
726 | +?>>Planefinder client</option> |
|
727 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
728 | + print 'selected'; |
|
729 | +} |
|
730 | +?>>APRS</option> |
|
731 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
732 | + print 'selected'; |
|
733 | +} |
|
734 | +?>>Radarcape deltadb.txt</option> |
|
735 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
736 | + print 'selected'; |
|
737 | +} |
|
738 | +?>>Vatsim</option> |
|
739 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
740 | + print 'selected'; |
|
741 | +} |
|
742 | +?>>Virtual Radar Server AircraftList.json</option> |
|
743 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
744 | + print 'selected'; |
|
745 | +} |
|
746 | +?>>Virtual Radar Server TCP</option> |
|
747 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
748 | + print 'selected'; |
|
749 | +} |
|
750 | +?>>phpVMS</option> |
|
751 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
752 | + print 'selected'; |
|
753 | +} |
|
754 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
755 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
756 | + print 'selected'; |
|
757 | +} |
|
758 | +?>>Virtual Airlines Manager</option> |
|
759 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
760 | + print 'selected'; |
|
761 | +} |
|
762 | +?>>IVAO</option> |
|
763 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
764 | + print 'selected'; |
|
765 | +} |
|
766 | +?>>FlightGear Multiplayer</option> |
|
767 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
768 | + print 'selected'; |
|
769 | +} |
|
770 | +?>>FlightGear Singleplayer</option> |
|
771 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
772 | + print 'selected'; |
|
773 | +} |
|
774 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
775 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
776 | + print 'selected'; |
|
777 | +} |
|
778 | +?>>ACARS SBS-3 over TCP</option> |
|
779 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
780 | + print 'selected'; |
|
781 | +} |
|
782 | +?>>NMEA AIS over TCP</option> |
|
783 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
784 | + print 'selected'; |
|
785 | +} |
|
786 | +?>>AirWhere website</option> |
|
787 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
788 | + print 'selected'; |
|
789 | +} |
|
790 | +?>>HidnSeek Callback</option> |
|
791 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
792 | + print 'selected'; |
|
793 | +} |
|
794 | +?>>Blitzortung</option> |
|
795 | + <option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') { |
|
796 | + print 'selected'; |
|
797 | +} |
|
798 | +?>>Sailaway</option> |
|
598 | 799 | </select> |
599 | 800 | </td> |
600 | 801 | <td> |
601 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
802 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
803 | + print $source['name']; |
|
804 | +} |
|
805 | +?>" /> |
|
602 | 806 | </td> |
603 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
604 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
807 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
808 | + print 'checked'; |
|
809 | +} |
|
810 | +?> /></td> |
|
811 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
812 | + print 'checked'; |
|
813 | +} |
|
814 | +?> /></td> |
|
605 | 815 | <td> |
606 | 816 | <select name="timezones[]" id="timezones"> |
607 | 817 | <?php |
@@ -611,7 +821,9 @@ discard block |
||
611 | 821 | print '<option selected>'.$timezones.'</option>'; |
612 | 822 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
613 | 823 | print '<option selected>'.$timezones.'</option>'; |
614 | - } else print '<option>'.$timezones.'</option>'; |
|
824 | + } else { |
|
825 | + print '<option>'.$timezones.'</option>'; |
|
826 | + } |
|
615 | 827 | } |
616 | 828 | ?> |
617 | 829 | </select> |
@@ -665,7 +877,9 @@ discard block |
||
665 | 877 | foreach($timezonelist as $timezones){ |
666 | 878 | if ($timezones == 'UTC') { |
667 | 879 | print '<option selected>'.$timezones.'</option>'; |
668 | - } else print '<option>'.$timezones.'</option>'; |
|
880 | + } else { |
|
881 | + print '<option>'.$timezones.'</option>'; |
|
882 | + } |
|
669 | 883 | } |
670 | 884 | ?> |
671 | 885 | </select> |
@@ -690,11 +904,17 @@ discard block |
||
690 | 904 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
691 | 905 | <p> |
692 | 906 | <label for="acarshost">ACARS UDP host</label> |
693 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
907 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
908 | + print $globalACARSHost; |
|
909 | +} |
|
910 | +?>" /> |
|
694 | 911 | </p> |
695 | 912 | <p> |
696 | 913 | <label for="acarsport">ACARS UDP port</label> |
697 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
914 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
915 | + print $globalACARSPort; |
|
916 | +} |
|
917 | +?>" /> |
|
698 | 918 | </p> |
699 | 919 | <p class="help-block"><i>daemon-acars.php</i> can only be run as daemon. It's an alternate script for ACARS data, <i>daemon-spotter.php</i> may be better.</p> |
700 | 920 | </fieldset> |
@@ -721,17 +941,38 @@ discard block |
||
721 | 941 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
722 | 942 | <td> |
723 | 943 | <select name="newslang[]"> |
724 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
725 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
944 | + <option value="en"<?php if ($lng == 'en') { |
|
945 | + print ' selected'; |
|
946 | +} |
|
947 | +?>>English</option> |
|
948 | + <option value="fr"<?php if ($lng == 'fr') { |
|
949 | + print ' selected'; |
|
950 | +} |
|
951 | +?>>French</option> |
|
726 | 952 | </select> |
727 | 953 | </td> |
728 | 954 | <td> |
729 | 955 | <select name="newstype[]"> |
730 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
731 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
732 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
733 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
734 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
956 | + <option value="global"<?php if ($type == 'global') { |
|
957 | + print ' selected'; |
|
958 | +} |
|
959 | +?>>Global</option> |
|
960 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
961 | + print ' selected'; |
|
962 | +} |
|
963 | +?>>Aircraft</option> |
|
964 | + <option value="marine"<?php if ($type == 'marine') { |
|
965 | + print ' selected'; |
|
966 | +} |
|
967 | +?>>Marine</option> |
|
968 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
969 | + print ' selected'; |
|
970 | +} |
|
971 | +?>>Tracker</option> |
|
972 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
973 | + print ' selected'; |
|
974 | +} |
|
975 | +?>>Satellite</option> |
|
735 | 976 | </select> |
736 | 977 | </td> |
737 | 978 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -815,7 +1056,10 @@ discard block |
||
815 | 1056 | </p> |
816 | 1057 | <p> |
817 | 1058 | <label for="corsproxy">CORS proxy</label> |
818 | - <input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) print $globalCORSproxy; else print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" /> |
|
1059 | + <input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) { |
|
1060 | + print $globalCORSproxy; |
|
1061 | +} else { |
|
1062 | + print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" /> |
|
819 | 1063 | <p class="help-block">CORS proxy used for some WMS servers</p> |
820 | 1064 | </p> |
821 | 1065 | <!-- |
@@ -878,13 +1122,18 @@ discard block |
||
878 | 1122 | <div id="schedules_options"> |
879 | 1123 | <p> |
880 | 1124 | <label for="britishairways">British Airways API Key</label> |
881 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
1125 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; |
|
1126 | +} |
|
1127 | +?>" /> |
|
882 | 1128 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
883 | 1129 | </p> |
884 | 1130 | <!-- |
885 | 1131 | <p> |
886 | 1132 | <label for="transavia">Transavia Test API Consumer Key</label> |
887 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
1133 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
1134 | + print $globalTransaviaKey; |
|
1135 | +} |
|
1136 | +?>" /> |
|
888 | 1137 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
889 | 1138 | </p> |
890 | 1139 | --> |
@@ -893,10 +1142,16 @@ discard block |
||
893 | 1142 | <b>Lufthansa API Key</b> |
894 | 1143 | <p> |
895 | 1144 | <label for="lufthansakey">Key</label> |
896 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
1145 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
1146 | + print $globalLufthansaKey['key']; |
|
1147 | +} |
|
1148 | +?>" /> |
|
897 | 1149 | </p><p> |
898 | 1150 | <label for="lufthansasecret">Secret</label> |
899 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
1151 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
1152 | + print $globalLufthansaKey['secret']; |
|
1153 | +} |
|
1154 | +?>" /> |
|
900 | 1155 | </p> |
901 | 1156 | </div> |
902 | 1157 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -906,11 +1161,17 @@ discard block |
||
906 | 1161 | <b>FlightAware API Key</b> |
907 | 1162 | <p> |
908 | 1163 | <label for="flightawareusername">Username</label> |
909 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
1164 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
1165 | + print $globalFlightAwareUsername; |
|
1166 | +} |
|
1167 | +?>" /> |
|
910 | 1168 | </p> |
911 | 1169 | <p> |
912 | 1170 | <label for="flightawarepassword">API key</label> |
913 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
1171 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
1172 | + print $globalFlightAwarePassword; |
|
1173 | +} |
|
1174 | +?>" /> |
|
914 | 1175 | </p> |
915 | 1176 | </div> |
916 | 1177 | <p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p> |
@@ -927,10 +1188,22 @@ discard block |
||
927 | 1188 | <p> |
928 | 1189 | <label for="mapmatchingsource">Map Matching source</label> |
929 | 1190 | <select name="mapmatchingsource" id="mapmatchingsource"> |
930 | - <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option> |
|
931 | - <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option> |
|
932 | - <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option> |
|
933 | - <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option> |
|
1191 | + <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) { |
|
1192 | + print 'selected="selected" '; |
|
1193 | +} |
|
1194 | +?>>FlightAirMap Map Matching</option> |
|
1195 | + <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') { |
|
1196 | + print 'selected="selected" '; |
|
1197 | +} |
|
1198 | +?>>GraphHopper</option> |
|
1199 | + <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') { |
|
1200 | + print 'selected="selected" '; |
|
1201 | +} |
|
1202 | +?>>OSMR</option> |
|
1203 | + <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') { |
|
1204 | + print 'selected="selected" '; |
|
1205 | +} |
|
1206 | +?>>Mapbox</option> |
|
934 | 1207 | </select> |
935 | 1208 | <p class="help-block">Mapbox need the API Key defined in map section.</p> |
936 | 1209 | <p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p> |
@@ -938,7 +1211,10 @@ discard block |
||
938 | 1211 | <br /> |
939 | 1212 | <p> |
940 | 1213 | <label for="graphhopper">GraphHopper API Key</label> |
941 | - <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" /> |
|
1214 | + <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) { |
|
1215 | + print $globalGraphHopperKey; |
|
1216 | +} |
|
1217 | +?>" /> |
|
942 | 1218 | <p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p> |
943 | 1219 | </p> |
944 | 1220 | </div> |
@@ -956,7 +1232,10 @@ discard block |
||
956 | 1232 | </p> |
957 | 1233 | <p> |
958 | 1234 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
959 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
1235 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
1236 | + print $globalNOTAMSource; |
|
1237 | +} |
|
1238 | +?>" /> |
|
960 | 1239 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
961 | 1240 | </p> |
962 | 1241 | <br /> |
@@ -972,14 +1251,20 @@ discard block |
||
972 | 1251 | <div id="metarsrc"> |
973 | 1252 | <p> |
974 | 1253 | <label for="metarsource">URL of your METAR source</label> |
975 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
1254 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
1255 | + print $globalMETARurl; |
|
1256 | +} |
|
1257 | +?>" /> |
|
976 | 1258 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
977 | 1259 | </p> |
978 | 1260 | </div> |
979 | 1261 | <br /> |
980 | 1262 | <p> |
981 | 1263 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
982 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
1264 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
1265 | + print $globalBitlyAccessToken; |
|
1266 | +} |
|
1267 | +?>" /> |
|
983 | 1268 | </p> |
984 | 1269 | <br /> |
985 | 1270 | <p> |
@@ -995,11 +1280,26 @@ discard block |
||
995 | 1280 | <p> |
996 | 1281 | <label for="geoid_source">Geoid Source</label> |
997 | 1282 | <select name="geoid_source" id="geoid_source"> |
998 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
999 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
1000 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
1001 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
1002 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
1283 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
1284 | + print ' selected="selected"'; |
|
1285 | +} |
|
1286 | +?>>EGM96 15' (2.1MB)</option> |
|
1287 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
1288 | + print ' selected="selected"'; |
|
1289 | +} |
|
1290 | +?>>EGM96 5' (19MB)</option> |
|
1291 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
1292 | + print ' selected="selected"'; |
|
1293 | +} |
|
1294 | +?>>EGM2008 5' (19MB)</option> |
|
1295 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
1296 | + print ' selected="selected"'; |
|
1297 | +} |
|
1298 | +?>>EGM2008 2.5' (75MB)</option> |
|
1299 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
1300 | + print ' selected="selected"'; |
|
1301 | +} |
|
1302 | +?>>EGM2008 1' (470MB)</option> |
|
1003 | 1303 | </select> |
1004 | 1304 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
1005 | 1305 | </p> |
@@ -1021,7 +1321,12 @@ discard block |
||
1021 | 1321 | </p> |
1022 | 1322 | <p> |
1023 | 1323 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
1024 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
1324 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
1325 | + print $globalArchiveMonths; |
|
1326 | +} else { |
|
1327 | + echo '1'; |
|
1328 | +} |
|
1329 | +?>" /> |
|
1025 | 1330 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
1026 | 1331 | </p> |
1027 | 1332 | <p> |
@@ -1031,12 +1336,22 @@ discard block |
||
1031 | 1336 | </p> |
1032 | 1337 | <p> |
1033 | 1338 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
1034 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
1339 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
1340 | + print $globalArchiveKeepMonths; |
|
1341 | +} else { |
|
1342 | + echo '1'; |
|
1343 | +} |
|
1344 | +?>" /> |
|
1035 | 1345 | <p class="help-block">0 to disable</p> |
1036 | 1346 | </p> |
1037 | 1347 | <p> |
1038 | 1348 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
1039 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
1349 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
1350 | + print $globalArchiveKeepTrackMonths; |
|
1351 | +} else { |
|
1352 | + echo '1'; |
|
1353 | +} |
|
1354 | +?>" /> |
|
1040 | 1355 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
1041 | 1356 | </p> |
1042 | 1357 | <br /> |
@@ -1046,7 +1361,12 @@ discard block |
||
1046 | 1361 | <p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p> |
1047 | 1362 | <div id="cronends"> |
1048 | 1363 | <label for="cronend">Run script for xx seconds</label> |
1049 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
1364 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
1365 | + print $globalCronEnd; |
|
1366 | +} else { |
|
1367 | + print '0'; |
|
1368 | +} |
|
1369 | +?>" /> |
|
1050 | 1370 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
1051 | 1371 | </div> |
1052 | 1372 | </p> |
@@ -1105,20 +1425,40 @@ discard block |
||
1105 | 1425 | <br /> |
1106 | 1426 | <p> |
1107 | 1427 | <label for="refresh">Show flights detected since xxx seconds</label> |
1108 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
1428 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
1429 | + echo $globalLiveInterval; |
|
1430 | +} else { |
|
1431 | + echo '200'; |
|
1432 | +} |
|
1433 | +?>" /> |
|
1109 | 1434 | </p> |
1110 | 1435 | <p> |
1111 | 1436 | <label for="maprefresh">Live map refresh (in seconds)</label> |
1112 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
1437 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
1438 | + echo $globalMapRefresh; |
|
1439 | +} else { |
|
1440 | + echo '30'; |
|
1441 | +} |
|
1442 | +?>" /> |
|
1113 | 1443 | </p> |
1114 | 1444 | <p> |
1115 | 1445 | <label for="mapidle">Map idle timeout (in minutes)</label> |
1116 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
1446 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
1447 | + echo $globalMapIdleTimeout; |
|
1448 | +} else { |
|
1449 | + echo '30'; |
|
1450 | +} |
|
1451 | +?>" /> |
|
1117 | 1452 | <p class="help-block">0 to disable</p> |
1118 | 1453 | </p> |
1119 | 1454 | <p> |
1120 | 1455 | <label for="minfetch">HTTP/file source fetch every xxx seconds</label> |
1121 | - <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" /> |
|
1456 | + <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) { |
|
1457 | + echo $globalMinFetch; |
|
1458 | +} else { |
|
1459 | + echo '20'; |
|
1460 | +} |
|
1461 | +?>" /> |
|
1122 | 1462 | </p> |
1123 | 1463 | <p> |
1124 | 1464 | <label for="bbox">Only display flights that we can see on screen (bounding box)</label> |
@@ -1137,12 +1477,20 @@ discard block |
||
1137 | 1477 | <br /> |
1138 | 1478 | <p> |
1139 | 1479 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
1140 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
1480 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
1481 | + echo $globalClosestMinDist; |
|
1482 | +} else { |
|
1483 | + echo '50'; |
|
1484 | +} |
|
1485 | +?>" /> |
|
1141 | 1486 | </p> |
1142 | 1487 | <br /> |
1143 | 1488 | <p> |
1144 | 1489 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1145 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1490 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
1491 | + echo $globalAircraftSize; |
|
1492 | +} |
|
1493 | +?>" /> |
|
1146 | 1494 | </p> |
1147 | 1495 | <br /> |
1148 | 1496 | <p> |
@@ -1161,22 +1509,42 @@ discard block |
||
1161 | 1509 | <br /> |
1162 | 1510 | <p> |
1163 | 1511 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
1164 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
1512 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
1513 | + echo $globalAircraftIconColor; |
|
1514 | +} else { |
|
1515 | + echo '1a3151'; |
|
1516 | +} |
|
1517 | +?>" /> |
|
1165 | 1518 | </p> |
1166 | 1519 | <br /> |
1167 | 1520 | <p> |
1168 | 1521 | <label for="marineiconcolor">Color of marine icon on map</label> |
1169 | - <input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) echo $globalMarineIconColor; else echo '43d1d8'; ?>" /> |
|
1522 | + <input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) { |
|
1523 | + echo $globalMarineIconColor; |
|
1524 | +} else { |
|
1525 | + echo '43d1d8'; |
|
1526 | +} |
|
1527 | +?>" /> |
|
1170 | 1528 | </p> |
1171 | 1529 | <br /> |
1172 | 1530 | <p> |
1173 | 1531 | <label for="trackericoncolor">Color of tracker icon on map</label> |
1174 | - <input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) echo $globalTrackerIconColor; else echo '1a3151'; ?>" /> |
|
1532 | + <input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) { |
|
1533 | + echo $globalTrackerIconColor; |
|
1534 | +} else { |
|
1535 | + echo '1a3151'; |
|
1536 | +} |
|
1537 | +?>" /> |
|
1175 | 1538 | </p> |
1176 | 1539 | <br /> |
1177 | 1540 | <p> |
1178 | 1541 | <label for="satelliteiconcolor">Color of satellite icon on map</label> |
1179 | - <input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) echo $globalSatelliteIconColor; else echo '1a3151'; ?>" /> |
|
1542 | + <input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) { |
|
1543 | + echo $globalSatelliteIconColor; |
|
1544 | +} else { |
|
1545 | + echo '1a3151'; |
|
1546 | +} |
|
1547 | +?>" /> |
|
1180 | 1548 | </p> |
1181 | 1549 | <?php |
1182 | 1550 | if (!is_writable('../cache')) { |
@@ -1200,14 +1568,27 @@ discard block |
||
1200 | 1568 | <p> |
1201 | 1569 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
1202 | 1570 | <div class="range"> |
1203 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
1204 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
1571 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
1572 | + echo $globalAirportZoom; |
|
1573 | +} else { |
|
1574 | + echo '7'; |
|
1575 | +} |
|
1576 | +?>" /> |
|
1577 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
1578 | + echo $globalAirportZoom; |
|
1579 | +} else { |
|
1580 | + echo '7'; |
|
1581 | +} |
|
1582 | +?></output> |
|
1205 | 1583 | </div> |
1206 | 1584 | </p> |
1207 | 1585 | <br /> |
1208 | 1586 | <p> |
1209 | 1587 | <label for="customcss">Custom CSS web path</label> |
1210 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
1588 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
1589 | + echo $globalCustomCSS; |
|
1590 | +} |
|
1591 | +?>" /> |
|
1211 | 1592 | </p> |
1212 | 1593 | </fieldset> |
1213 | 1594 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1234,8 +1615,12 @@ discard block |
||
1234 | 1615 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
1235 | 1616 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
1236 | 1617 | |
1237 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
1238 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1618 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
1619 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
1620 | + } |
|
1621 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
1622 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1623 | + } |
|
1239 | 1624 | |
1240 | 1625 | $_SESSION['database_root'] = $dbroot; |
1241 | 1626 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1313,15 +1698,23 @@ discard block |
||
1313 | 1698 | $source_city = $_POST['source_city']; |
1314 | 1699 | $source_country = $_POST['source_country']; |
1315 | 1700 | $source_ref = $_POST['source_ref']; |
1316 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
1317 | - else $source_id = array(); |
|
1701 | + if (isset($source_id)) { |
|
1702 | + $source_id = $_POST['source_id']; |
|
1703 | + } else { |
|
1704 | + $source_id = array(); |
|
1705 | + } |
|
1318 | 1706 | |
1319 | 1707 | $sources = array(); |
1320 | 1708 | foreach ($source_name as $keys => $name) { |
1321 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1322 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1709 | + if (isset($source_id[$keys])) { |
|
1710 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1711 | + } else { |
|
1712 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1713 | + } |
|
1714 | + } |
|
1715 | + if (count($sources) > 0) { |
|
1716 | + $_SESSION['sources'] = $sources; |
|
1323 | 1717 | } |
1324 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
1325 | 1718 | |
1326 | 1719 | $newsurl = $_POST['newsurl']; |
1327 | 1720 | $newslng = $_POST['newslang']; |
@@ -1334,7 +1727,9 @@ discard block |
||
1334 | 1727 | $lng = $newslng[$newskey]; |
1335 | 1728 | if (isset($newsfeeds[$type][$lng])) { |
1336 | 1729 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
1337 | - } else $newsfeeds[$type][$lng] = array($url); |
|
1730 | + } else { |
|
1731 | + $newsfeeds[$type][$lng] = array($url); |
|
1732 | + } |
|
1338 | 1733 | } |
1339 | 1734 | } |
1340 | 1735 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1359,17 +1754,29 @@ discard block |
||
1359 | 1754 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
1360 | 1755 | |
1361 | 1756 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
1362 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1363 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1757 | + if ($globalaircraft == 'aircraft') { |
|
1758 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1759 | + } else { |
|
1760 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1761 | + } |
|
1364 | 1762 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
1365 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1366 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1763 | + if ($globaltracker == 'tracker') { |
|
1764 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1765 | + } else { |
|
1766 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1767 | + } |
|
1367 | 1768 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
1368 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1369 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1769 | + if ($globalmarine == 'marine') { |
|
1770 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1771 | + } else { |
|
1772 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1773 | + } |
|
1370 | 1774 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
1371 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1372 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1775 | + if ($globalsatellite == 'satellite') { |
|
1776 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1777 | + } else { |
|
1778 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1779 | + } |
|
1373 | 1780 | |
1374 | 1781 | /* |
1375 | 1782 | $globalSBS1Hosts = array(); |
@@ -1391,23 +1798,37 @@ discard block |
||
1391 | 1798 | $name = $_POST['name']; |
1392 | 1799 | $format = $_POST['format']; |
1393 | 1800 | $timezones = $_POST['timezones']; |
1394 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
1395 | - else $sourcestats = array(); |
|
1396 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
1397 | - else $noarchive = array(); |
|
1801 | + if (isset($_POST['sourcestats'])) { |
|
1802 | + $sourcestats = $_POST['sourcestats']; |
|
1803 | + } else { |
|
1804 | + $sourcestats = array(); |
|
1805 | + } |
|
1806 | + if (isset($_POST['noarchive'])) { |
|
1807 | + $noarchive = $_POST['noarchive']; |
|
1808 | + } else { |
|
1809 | + $noarchive = array(); |
|
1810 | + } |
|
1398 | 1811 | $gSources = array(); |
1399 | 1812 | $forcepilots = false; |
1400 | 1813 | foreach ($host as $key => $h) { |
1401 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
1402 | - else $cov = 'FALSE'; |
|
1403 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
1404 | - else $arch = 'FALSE'; |
|
1814 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
1815 | + $cov = 'TRUE'; |
|
1816 | + } else { |
|
1817 | + $cov = 'FALSE'; |
|
1818 | + } |
|
1819 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
1820 | + $arch = 'TRUE'; |
|
1821 | + } else { |
|
1822 | + $arch = 'FALSE'; |
|
1823 | + } |
|
1405 | 1824 | if (strpos($format[$key],'_callback')) { |
1406 | 1825 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
1407 | 1826 | } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) { |
1408 | 1827 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
1409 | 1828 | } |
1410 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
1829 | + if ($format[$key] == 'airwhere') { |
|
1830 | + $forcepilots = true; |
|
1831 | + } |
|
1411 | 1832 | } |
1412 | 1833 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
1413 | 1834 | |
@@ -1438,7 +1859,9 @@ discard block |
||
1438 | 1859 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
1439 | 1860 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1440 | 1861 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
1441 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1862 | + } else { |
|
1863 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1864 | + } |
|
1442 | 1865 | |
1443 | 1866 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
1444 | 1867 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1479,7 +1902,9 @@ discard block |
||
1479 | 1902 | |
1480 | 1903 | // Create in settings.php keys not yet configurable if not already here |
1481 | 1904 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1482 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1905 | + if (!isset($globalDebug)) { |
|
1906 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1907 | + } |
|
1483 | 1908 | |
1484 | 1909 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
1485 | 1910 | if ($resetyearstats == 'resetyearstats') { |
@@ -1522,37 +1947,56 @@ discard block |
||
1522 | 1947 | } |
1523 | 1948 | */ |
1524 | 1949 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
1525 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1526 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1527 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1528 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1950 | + if ($globalsbs == 'sbs') { |
|
1951 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1952 | + } else { |
|
1953 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1954 | + } |
|
1955 | + if ($globalaprs == 'aprs') { |
|
1956 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1957 | + } else { |
|
1958 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1959 | + } |
|
1529 | 1960 | $va = false; |
1530 | 1961 | if ($globalivao == 'ivao') { |
1531 | 1962 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
1532 | 1963 | $va = true; |
1533 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1964 | + } else { |
|
1965 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1966 | + } |
|
1534 | 1967 | if ($globalvatsim == 'vatsim') { |
1535 | 1968 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
1536 | 1969 | $va = true; |
1537 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1970 | + } else { |
|
1971 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1972 | + } |
|
1538 | 1973 | if ($globalphpvms == 'phpvms') { |
1539 | 1974 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
1540 | 1975 | $va = true; |
1541 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1976 | + } else { |
|
1977 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1978 | + } |
|
1542 | 1979 | if ($globalvam == 'vam') { |
1543 | 1980 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
1544 | 1981 | $va = true; |
1545 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1982 | + } else { |
|
1983 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1984 | + } |
|
1546 | 1985 | if ($va) { |
1547 | 1986 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
1548 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1987 | + } else { |
|
1988 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1989 | + } |
|
1549 | 1990 | if ($globalva == 'va' || $va) { |
1550 | 1991 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
1551 | 1992 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
1552 | 1993 | } else { |
1553 | 1994 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
1554 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1555 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1995 | + if ($forcepilots) { |
|
1996 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1997 | + } else { |
|
1998 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1999 | + } |
|
1556 | 2000 | } |
1557 | 2001 | if ($globalvm == 'vm') { |
1558 | 2002 | $settings = array_merge($settings,array('globalVM' => 'TRUE')); |
@@ -1812,7 +2256,9 @@ discard block |
||
1812 | 2256 | $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
1813 | 2257 | $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
1814 | 2258 | |
1815 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
2259 | + if (!isset($globalTransaction)) { |
|
2260 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
2261 | + } |
|
1816 | 2262 | |
1817 | 2263 | // Set some defaults values... |
1818 | 2264 | if (!isset($globalAircraftImageSources)) { |
@@ -1827,15 +2273,23 @@ discard block |
||
1827 | 2273 | |
1828 | 2274 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1829 | 2275 | |
1830 | - if ($error == '') settings::modify_settings($settings); |
|
1831 | - if ($error == '') settings::comment_settings($settings_comment); |
|
2276 | + if ($error == '') { |
|
2277 | + settings::modify_settings($settings); |
|
2278 | + } |
|
2279 | + if ($error == '') { |
|
2280 | + settings::comment_settings($settings_comment); |
|
2281 | + } |
|
1832 | 2282 | if ($error != '') { |
1833 | 2283 | print '<div class="info column">'.$error.'</div>'; |
1834 | 2284 | require('../footer.php'); |
1835 | 2285 | exit; |
1836 | 2286 | } else { |
1837 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
1838 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
2287 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
2288 | + $_SESSION['waypoints'] = 1; |
|
2289 | + } |
|
2290 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
2291 | + $_SESSION['owner'] = 1; |
|
2292 | + } |
|
1839 | 2293 | if (isset($_POST['createdb'])) { |
1840 | 2294 | $_SESSION['install'] = 'database_create'; |
1841 | 2295 | } else { |
@@ -1872,10 +2326,18 @@ discard block |
||
1872 | 2326 | $popw = false; |
1873 | 2327 | foreach ($_SESSION['done'] as $done) { |
1874 | 2328 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
1875 | - if ($done == 'Create database') $pop = true; |
|
1876 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1877 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1878 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
2329 | + if ($done == 'Create database') { |
|
2330 | + $pop = true; |
|
2331 | + } |
|
2332 | + if ($_SESSION['install'] == 'database_create') { |
|
2333 | + $pop = true; |
|
2334 | + } |
|
2335 | + if ($_SESSION['install'] == 'database_import') { |
|
2336 | + $popi = true; |
|
2337 | + } |
|
2338 | + if ($_SESSION['install'] == 'waypoints') { |
|
2339 | + $popw = true; |
|
2340 | + } |
|
1879 | 2341 | } |
1880 | 2342 | if ($pop) { |
1881 | 2343 | sleep(5); |
@@ -1886,7 +2348,9 @@ discard block |
||
1886 | 2348 | } else if ($popw) { |
1887 | 2349 | sleep(5); |
1888 | 2350 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
1889 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
2351 | + } else { |
|
2352 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
2353 | + } |
|
1890 | 2354 | print '</div></ul>'; |
1891 | 2355 | print '<div id="error"></div>'; |
1892 | 2356 | /* foreach ($_SESSION['done'] as $done) { |