@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | $page_url = $globalURL.'/accident-latest'; |
10 | 10 | |
11 | -if(!isset($_GET['limit'])) |
|
11 | +if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | print '<div class="table column">'; |
35 | 35 | print '<p>'._("The table below shows the latest Accidents.").'</p>'; |
36 | -$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference,'accident'); |
|
36 | +$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference, 'accident'); |
|
37 | 37 | //print_r($spotter_array); |
38 | 38 | if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) { |
39 | 39 | include('table-output.php'); |
@@ -58,8 +58,12 @@ |
||
58 | 58 | if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) { |
59 | 59 | include('table-output.php'); |
60 | 60 | print '<div class="pagination">'; |
61 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
62 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
61 | + if ($limit_previous_1 >= 0) { |
|
62 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
63 | + } |
|
64 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
65 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
66 | + } |
|
63 | 67 | print '</div>'; |
64 | 68 | } |
65 | 69 | print '</div>'; |
@@ -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 | $fp = fopen($file, 'w+'); |
15 | 18 | $ch = curl_init(); |
@@ -24,6 +27,9 @@ discard block |
||
24 | 27 | fclose($fp); |
25 | 28 | } |
26 | 29 | |
30 | + /** |
|
31 | + * @param string $in_file |
|
32 | + */ |
|
27 | 33 | public static function gunzip($in_file,$out_file_name = '') { |
28 | 34 | //echo $in_file.' -> '.$out_file_name."\n"; |
29 | 35 | $buffer_size = 4096; // read 4kb at a time |
@@ -45,6 +51,9 @@ discard block |
||
45 | 51 | } |
46 | 52 | } |
47 | 53 | |
54 | + /** |
|
55 | + * @param string $in_file |
|
56 | + */ |
|
48 | 57 | public static function unzip($in_file) { |
49 | 58 | if ($in_file != '' && file_exists($in_file)) { |
50 | 59 | $path = pathinfo(realpath($in_file), PATHINFO_DIRNAME); |
@@ -66,6 +75,9 @@ discard block |
||
66 | 75 | } |
67 | 76 | } |
68 | 77 | |
78 | + /** |
|
79 | + * @param string $database_file |
|
80 | + */ |
|
69 | 81 | public static function retrieve_route_sqlite_to_dest($database_file) { |
70 | 82 | global $globalDebug, $globalTransaction; |
71 | 83 | //$query = 'TRUNCATE TABLE routes'; |
@@ -108,6 +120,10 @@ discard block |
||
108 | 120 | } |
109 | 121 | return ''; |
110 | 122 | } |
123 | + |
|
124 | + /** |
|
125 | + * @param string $database_file |
|
126 | + */ |
|
111 | 127 | public static function retrieve_route_oneworld($database_file) { |
112 | 128 | global $globalDebug, $globalTransaction; |
113 | 129 | //$query = 'TRUNCATE TABLE routes'; |
@@ -149,6 +165,9 @@ discard block |
||
149 | 165 | return ''; |
150 | 166 | } |
151 | 167 | |
168 | + /** |
|
169 | + * @param string $database_file |
|
170 | + */ |
|
152 | 171 | public static function retrieve_route_skyteam($database_file) { |
153 | 172 | global $globalDebug, $globalTransaction; |
154 | 173 | //$query = 'TRUNCATE TABLE routes'; |
@@ -191,6 +210,10 @@ discard block |
||
191 | 210 | } |
192 | 211 | return ''; |
193 | 212 | } |
213 | + |
|
214 | + /** |
|
215 | + * @param string $database_file |
|
216 | + */ |
|
194 | 217 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
195 | 218 | global $globalTransaction; |
196 | 219 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -257,6 +280,9 @@ discard block |
||
257 | 280 | return ''; |
258 | 281 | } |
259 | 282 | |
283 | + /** |
|
284 | + * @param string $database_file |
|
285 | + */ |
|
260 | 286 | public static function retrieve_modes_flarmnet($database_file) { |
261 | 287 | global $globalTransaction; |
262 | 288 | $Common = new Common(); |
@@ -327,6 +353,9 @@ discard block |
||
327 | 353 | return ''; |
328 | 354 | } |
329 | 355 | |
356 | + /** |
|
357 | + * @param string $database_file |
|
358 | + */ |
|
330 | 359 | public static function retrieve_modes_ogn($database_file) { |
331 | 360 | global $globalTransaction; |
332 | 361 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -395,6 +424,9 @@ discard block |
||
395 | 424 | return ''; |
396 | 425 | } |
397 | 426 | |
427 | + /** |
|
428 | + * @param string $database_file |
|
429 | + */ |
|
398 | 430 | public static function retrieve_owner($database_file,$country = 'F') { |
399 | 431 | global $globalTransaction, $globalMasterSource; |
400 | 432 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -1235,6 +1267,10 @@ discard block |
||
1235 | 1267 | return ''; |
1236 | 1268 | } |
1237 | 1269 | |
1270 | + /** |
|
1271 | + * @param string $filename |
|
1272 | + * @param string $tletype |
|
1273 | + */ |
|
1238 | 1274 | public static function tle($filename,$tletype) { |
1239 | 1275 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1240 | 1276 | global $tmp_dir, $globalTransaction; |
@@ -1367,6 +1403,9 @@ discard block |
||
1367 | 1403 | |
1368 | 1404 | } |
1369 | 1405 | */ |
1406 | + /** |
|
1407 | + * @param string $filename |
|
1408 | + */ |
|
1370 | 1409 | public static function waypoints($filename) { |
1371 | 1410 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1372 | 1411 | global $tmp_dir, $globalTransaction; |
@@ -1414,6 +1453,9 @@ discard block |
||
1414 | 1453 | return ''; |
1415 | 1454 | } |
1416 | 1455 | |
1456 | + /** |
|
1457 | + * @param string $filename |
|
1458 | + */ |
|
1417 | 1459 | public static function ivao_airlines($filename) { |
1418 | 1460 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1419 | 1461 | global $tmp_dir, $globalTransaction; |
@@ -75,38 +75,38 @@ discard block |
||
75 | 75 | try { |
76 | 76 | //$Connection = new Connection(); |
77 | 77 | $sth = $Connection->db->prepare($query); |
78 | - $sth->execute(array(':source' => $database_file)); |
|
79 | - } catch(PDOException $e) { |
|
80 | - return "error : ".$e->getMessage(); |
|
81 | - } |
|
78 | + $sth->execute(array(':source' => $database_file)); |
|
79 | + } catch(PDOException $e) { |
|
80 | + return "error : ".$e->getMessage(); |
|
81 | + } |
|
82 | 82 | |
83 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
84 | - update_db::connect_sqlite($database_file); |
|
83 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
84 | + update_db::connect_sqlite($database_file); |
|
85 | 85 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
86 | 86 | $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"; |
87 | 87 | try { |
88 | - $sth = update_db::$db_sqlite->prepare($query); |
|
89 | - $sth->execute(); |
|
90 | - } catch(PDOException $e) { |
|
91 | - return "error : ".$e->getMessage(); |
|
92 | - } |
|
88 | + $sth = update_db::$db_sqlite->prepare($query); |
|
89 | + $sth->execute(); |
|
90 | + } catch(PDOException $e) { |
|
91 | + return "error : ".$e->getMessage(); |
|
92 | + } |
|
93 | 93 | //$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)'; |
94 | 94 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
95 | 95 | $Connection = new Connection(); |
96 | 96 | $sth_dest = $Connection->db->prepare($query_dest); |
97 | 97 | try { |
98 | 98 | if ($globalTransaction) $Connection->db->beginTransaction(); |
99 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
99 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
100 | 100 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
101 | 101 | $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
102 | 102 | $sth_dest->execute($query_dest_values); |
103 | - } |
|
103 | + } |
|
104 | 104 | if ($globalTransaction) $Connection->db->commit(); |
105 | 105 | } catch(PDOException $e) { |
106 | 106 | if ($globalTransaction) $Connection->db->rollBack(); |
107 | 107 | return "error : ".$e->getMessage(); |
108 | 108 | } |
109 | - return ''; |
|
109 | + return ''; |
|
110 | 110 | } |
111 | 111 | public static function retrieve_route_oneworld($database_file) { |
112 | 112 | global $globalDebug, $globalTransaction; |
@@ -117,12 +117,12 @@ discard block |
||
117 | 117 | try { |
118 | 118 | //$Connection = new Connection(); |
119 | 119 | $sth = $Connection->db->prepare($query); |
120 | - $sth->execute(array(':source' => 'oneworld')); |
|
121 | - } catch(PDOException $e) { |
|
122 | - return "error : ".$e->getMessage(); |
|
123 | - } |
|
120 | + $sth->execute(array(':source' => 'oneworld')); |
|
121 | + } catch(PDOException $e) { |
|
122 | + return "error : ".$e->getMessage(); |
|
123 | + } |
|
124 | 124 | |
125 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
125 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
126 | 126 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
127 | 127 | $Spotter = new Spotter(); |
128 | 128 | if ($fh = fopen($database_file,"r")) { |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | if ($globalTransaction) $Connection->db->commit(); |
148 | 148 | } |
149 | - return ''; |
|
149 | + return ''; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | public static function retrieve_route_skyteam($database_file) { |
@@ -158,12 +158,12 @@ discard block |
||
158 | 158 | try { |
159 | 159 | //$Connection = new Connection(); |
160 | 160 | $sth = $Connection->db->prepare($query); |
161 | - $sth->execute(array(':source' => 'skyteam')); |
|
162 | - } catch(PDOException $e) { |
|
163 | - return "error : ".$e->getMessage(); |
|
164 | - } |
|
161 | + $sth->execute(array(':source' => 'skyteam')); |
|
162 | + } catch(PDOException $e) { |
|
163 | + return "error : ".$e->getMessage(); |
|
164 | + } |
|
165 | 165 | |
166 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
166 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
167 | 167 | |
168 | 168 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
169 | 169 | $Spotter = new Spotter(); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | return "error : ".$e->getMessage(); |
190 | 190 | } |
191 | 191 | } |
192 | - return ''; |
|
192 | + return ''; |
|
193 | 193 | } |
194 | 194 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
195 | 195 | global $globalTransaction; |
@@ -198,27 +198,27 @@ discard block |
||
198 | 198 | try { |
199 | 199 | $Connection = new Connection(); |
200 | 200 | $sth = $Connection->db->prepare($query); |
201 | - $sth->execute(array(':source' => $database_file)); |
|
202 | - } catch(PDOException $e) { |
|
203 | - return "error : ".$e->getMessage(); |
|
204 | - } |
|
201 | + $sth->execute(array(':source' => $database_file)); |
|
202 | + } catch(PDOException $e) { |
|
203 | + return "error : ".$e->getMessage(); |
|
204 | + } |
|
205 | 205 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
206 | 206 | try { |
207 | 207 | $Connection = new Connection(); |
208 | 208 | $sth = $Connection->db->prepare($query); |
209 | - $sth->execute(array(':source' => $database_file)); |
|
210 | - } catch(PDOException $e) { |
|
211 | - return "error : ".$e->getMessage(); |
|
212 | - } |
|
209 | + $sth->execute(array(':source' => $database_file)); |
|
210 | + } catch(PDOException $e) { |
|
211 | + return "error : ".$e->getMessage(); |
|
212 | + } |
|
213 | 213 | |
214 | - update_db::connect_sqlite($database_file); |
|
214 | + update_db::connect_sqlite($database_file); |
|
215 | 215 | $query = 'select * from Aircraft'; |
216 | 216 | try { |
217 | - $sth = update_db::$db_sqlite->prepare($query); |
|
218 | - $sth->execute(); |
|
219 | - } catch(PDOException $e) { |
|
220 | - return "error : ".$e->getMessage(); |
|
221 | - } |
|
217 | + $sth = update_db::$db_sqlite->prepare($query); |
|
218 | + $sth->execute(); |
|
219 | + } catch(PDOException $e) { |
|
220 | + return "error : ".$e->getMessage(); |
|
221 | + } |
|
222 | 222 | //$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)'; |
223 | 223 | $query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)'; |
224 | 224 | |
@@ -229,17 +229,17 @@ discard block |
||
229 | 229 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
230 | 230 | try { |
231 | 231 | if ($globalTransaction) $Connection->db->beginTransaction(); |
232 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
232 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
233 | 233 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
234 | 234 | if ($values['UserString4'] == 'M') $type = 'military'; |
235 | 235 | else $type = null; |
236 | 236 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
237 | 237 | $sth_dest->execute($query_dest_values); |
238 | 238 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
239 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
240 | - $sth_dest_owner->execute($query_dest_owner_values); |
|
239 | + $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
240 | + $sth_dest_owner->execute($query_dest_owner_values); |
|
241 | 241 | } |
242 | - } |
|
242 | + } |
|
243 | 243 | if ($globalTransaction) $Connection->db->commit(); |
244 | 244 | } catch(PDOException $e) { |
245 | 245 | return "error : ".$e->getMessage(); |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | try { |
251 | 251 | $Connection = new Connection(); |
252 | 252 | $sth = $Connection->db->prepare($query); |
253 | - $sth->execute(array(':source' => $database_file)); |
|
254 | - } catch(PDOException $e) { |
|
255 | - return "error : ".$e->getMessage(); |
|
256 | - } |
|
253 | + $sth->execute(array(':source' => $database_file)); |
|
254 | + } catch(PDOException $e) { |
|
255 | + return "error : ".$e->getMessage(); |
|
256 | + } |
|
257 | 257 | return ''; |
258 | 258 | } |
259 | 259 | |
@@ -265,10 +265,10 @@ discard block |
||
265 | 265 | try { |
266 | 266 | $Connection = new Connection(); |
267 | 267 | $sth = $Connection->db->prepare($query); |
268 | - $sth->execute(array(':source' => $database_file)); |
|
269 | - } catch(PDOException $e) { |
|
270 | - return "error : ".$e->getMessage(); |
|
271 | - } |
|
268 | + $sth->execute(array(':source' => $database_file)); |
|
269 | + } catch(PDOException $e) { |
|
270 | + return "error : ".$e->getMessage(); |
|
271 | + } |
|
272 | 272 | |
273 | 273 | if ($fh = fopen($database_file,"r")) { |
274 | 274 | //$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)'; |
@@ -278,26 +278,26 @@ discard block |
||
278 | 278 | $sth_dest = $Connection->db->prepare($query_dest); |
279 | 279 | try { |
280 | 280 | if ($globalTransaction) $Connection->db->beginTransaction(); |
281 | - while (!feof($fh)) { |
|
282 | - $values = array(); |
|
283 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
281 | + while (!feof($fh)) { |
|
282 | + $values = array(); |
|
283 | + $line = $Common->hex2str(fgets($fh,9999)); |
|
284 | 284 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
285 | - $values['ModeS'] = substr($line,0,6); |
|
286 | - $values['Registration'] = trim(substr($line,69,6)); |
|
287 | - $aircraft_name = trim(substr($line,48,6)); |
|
288 | - // Check if we can find ICAO, else set it to GLID |
|
289 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
290 | - $search_more = ''; |
|
291 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
292 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
293 | - $sth_search = $Connection->db->prepare($query_search); |
|
285 | + $values['ModeS'] = substr($line,0,6); |
|
286 | + $values['Registration'] = trim(substr($line,69,6)); |
|
287 | + $aircraft_name = trim(substr($line,48,6)); |
|
288 | + // Check if we can find ICAO, else set it to GLID |
|
289 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
290 | + $search_more = ''; |
|
291 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
292 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
293 | + $sth_search = $Connection->db->prepare($query_search); |
|
294 | 294 | try { |
295 | - $sth_search->execute(); |
|
296 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
297 | - //if (count($result) > 0) { |
|
298 | - if (isset($result['icao']) && $result['icao'] != '') { |
|
299 | - $values['ICAOTypeCode'] = $result['icao']; |
|
300 | - } |
|
295 | + $sth_search->execute(); |
|
296 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
297 | + //if (count($result) > 0) { |
|
298 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
299 | + $values['ICAOTypeCode'] = $result['icao']; |
|
300 | + } |
|
301 | 301 | } catch(PDOException $e) { |
302 | 302 | return "error : ".$e->getMessage(); |
303 | 303 | } |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | try { |
321 | 321 | $Connection = new Connection(); |
322 | 322 | $sth = $Connection->db->prepare($query); |
323 | - $sth->execute(array(':source' => $database_file)); |
|
324 | - } catch(PDOException $e) { |
|
325 | - return "error : ".$e->getMessage(); |
|
326 | - } |
|
323 | + $sth->execute(array(':source' => $database_file)); |
|
324 | + } catch(PDOException $e) { |
|
325 | + return "error : ".$e->getMessage(); |
|
326 | + } |
|
327 | 327 | return ''; |
328 | 328 | } |
329 | 329 | |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | try { |
335 | 335 | $Connection = new Connection(); |
336 | 336 | $sth = $Connection->db->prepare($query); |
337 | - $sth->execute(array(':source' => $database_file)); |
|
338 | - } catch(PDOException $e) { |
|
339 | - return "error : ".$e->getMessage(); |
|
340 | - } |
|
337 | + $sth->execute(array(':source' => $database_file)); |
|
338 | + } catch(PDOException $e) { |
|
339 | + return "error : ".$e->getMessage(); |
|
340 | + } |
|
341 | 341 | |
342 | 342 | if ($fh = fopen($database_file,"r")) { |
343 | 343 | //$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)'; |
@@ -348,24 +348,24 @@ discard block |
||
348 | 348 | try { |
349 | 349 | if ($globalTransaction) $Connection->db->beginTransaction(); |
350 | 350 | $tmp = fgetcsv($fh,9999,',',"'"); |
351 | - while (!feof($fh)) { |
|
352 | - $line = fgetcsv($fh,9999,',',"'"); |
|
351 | + while (!feof($fh)) { |
|
352 | + $line = fgetcsv($fh,9999,',',"'"); |
|
353 | 353 | |
354 | 354 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
355 | 355 | //print_r($line); |
356 | - $values['ModeS'] = $line[1]; |
|
357 | - $values['Registration'] = $line[3]; |
|
358 | - $aircraft_name = $line[2]; |
|
359 | - // Check if we can find ICAO, else set it to GLID |
|
360 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
361 | - $search_more = ''; |
|
362 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
363 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
364 | - $sth_search = $Connection->db->prepare($query_search); |
|
356 | + $values['ModeS'] = $line[1]; |
|
357 | + $values['Registration'] = $line[3]; |
|
358 | + $aircraft_name = $line[2]; |
|
359 | + // Check if we can find ICAO, else set it to GLID |
|
360 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
361 | + $search_more = ''; |
|
362 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
363 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
364 | + $sth_search = $Connection->db->prepare($query_search); |
|
365 | 365 | try { |
366 | - $sth_search->execute(); |
|
367 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
368 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
366 | + $sth_search->execute(); |
|
367 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
368 | + if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
369 | 369 | } catch(PDOException $e) { |
370 | 370 | return "error : ".$e->getMessage(); |
371 | 371 | } |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | try { |
389 | 389 | $Connection = new Connection(); |
390 | 390 | $sth = $Connection->db->prepare($query); |
391 | - $sth->execute(array(':source' => $database_file)); |
|
392 | - } catch(PDOException $e) { |
|
393 | - return "error : ".$e->getMessage(); |
|
394 | - } |
|
391 | + $sth->execute(array(':source' => $database_file)); |
|
392 | + } catch(PDOException $e) { |
|
393 | + return "error : ".$e->getMessage(); |
|
394 | + } |
|
395 | 395 | return ''; |
396 | 396 | } |
397 | 397 | |
@@ -402,16 +402,16 @@ discard block |
||
402 | 402 | try { |
403 | 403 | $Connection = new Connection(); |
404 | 404 | $sth = $Connection->db->prepare($query); |
405 | - $sth->execute(array(':source' => $database_file)); |
|
406 | - } catch(PDOException $e) { |
|
407 | - return "error : ".$e->getMessage(); |
|
408 | - } |
|
405 | + $sth->execute(array(':source' => $database_file)); |
|
406 | + } catch(PDOException $e) { |
|
407 | + return "error : ".$e->getMessage(); |
|
408 | + } |
|
409 | 409 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
410 | 410 | $Spotter = new Spotter(); |
411 | 411 | if ($fh = fopen($database_file,"r")) { |
412 | 412 | //$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)'; |
413 | 413 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
414 | - $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
414 | + $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
415 | 415 | |
416 | 416 | $Connection = new Connection(); |
417 | 417 | $sth_dest = $Connection->db->prepare($query_dest); |
@@ -419,126 +419,126 @@ discard block |
||
419 | 419 | try { |
420 | 420 | if ($globalTransaction) $Connection->db->beginTransaction(); |
421 | 421 | $tmp = fgetcsv($fh,9999,',','"'); |
422 | - while (!feof($fh)) { |
|
423 | - $line = fgetcsv($fh,9999,',','"'); |
|
424 | - $values = array(); |
|
425 | - //print_r($line); |
|
426 | - if ($country == 'F') { |
|
427 | - $values['registration'] = $line[0]; |
|
428 | - $values['base'] = $line[4]; |
|
429 | - $values['owner'] = $line[5]; |
|
430 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
431 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
432 | - $values['cancel'] = $line[7]; |
|
422 | + while (!feof($fh)) { |
|
423 | + $line = fgetcsv($fh,9999,',','"'); |
|
424 | + $values = array(); |
|
425 | + //print_r($line); |
|
426 | + if ($country == 'F') { |
|
427 | + $values['registration'] = $line[0]; |
|
428 | + $values['base'] = $line[4]; |
|
429 | + $values['owner'] = $line[5]; |
|
430 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
431 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
432 | + $values['cancel'] = $line[7]; |
|
433 | 433 | } elseif ($country == 'EI') { |
434 | - // TODO : add modeS & reg to aircraft_modes |
|
435 | - $values['registration'] = $line[0]; |
|
436 | - $values['base'] = $line[3]; |
|
437 | - $values['owner'] = $line[2]; |
|
438 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
439 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
440 | - $values['cancel'] = ''; |
|
441 | - $values['modes'] = $line[7]; |
|
442 | - $values['icao'] = $line[8]; |
|
434 | + // TODO : add modeS & reg to aircraft_modes |
|
435 | + $values['registration'] = $line[0]; |
|
436 | + $values['base'] = $line[3]; |
|
437 | + $values['owner'] = $line[2]; |
|
438 | + if ($line[1] == '') $values['date_first_reg'] = null; |
|
439 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
440 | + $values['cancel'] = ''; |
|
441 | + $values['modes'] = $line[7]; |
|
442 | + $values['icao'] = $line[8]; |
|
443 | 443 | |
444 | 444 | } elseif ($country == 'HB') { |
445 | - // TODO : add modeS & reg to aircraft_modes |
|
446 | - $values['registration'] = $line[0]; |
|
447 | - $values['base'] = null; |
|
448 | - $values['owner'] = $line[5]; |
|
449 | - $values['date_first_reg'] = null; |
|
450 | - $values['cancel'] = ''; |
|
451 | - $values['modes'] = $line[4]; |
|
452 | - $values['icao'] = $line[7]; |
|
445 | + // TODO : add modeS & reg to aircraft_modes |
|
446 | + $values['registration'] = $line[0]; |
|
447 | + $values['base'] = null; |
|
448 | + $values['owner'] = $line[5]; |
|
449 | + $values['date_first_reg'] = null; |
|
450 | + $values['cancel'] = ''; |
|
451 | + $values['modes'] = $line[4]; |
|
452 | + $values['icao'] = $line[7]; |
|
453 | 453 | } elseif ($country == 'OK') { |
454 | - // TODO : add modeS & reg to aircraft_modes |
|
455 | - $values['registration'] = $line[3]; |
|
456 | - $values['base'] = null; |
|
457 | - $values['owner'] = $line[5]; |
|
458 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
459 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
460 | - $values['cancel'] = ''; |
|
454 | + // TODO : add modeS & reg to aircraft_modes |
|
455 | + $values['registration'] = $line[3]; |
|
456 | + $values['base'] = null; |
|
457 | + $values['owner'] = $line[5]; |
|
458 | + if ($line[18] == '') $values['date_first_reg'] = null; |
|
459 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
460 | + $values['cancel'] = ''; |
|
461 | 461 | } elseif ($country == 'VH') { |
462 | - // TODO : add modeS & reg to aircraft_modes |
|
463 | - $values['registration'] = $line[0]; |
|
464 | - $values['base'] = null; |
|
465 | - $values['owner'] = $line[12]; |
|
466 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
467 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
468 | - |
|
469 | - $values['cancel'] = $line[39]; |
|
462 | + // TODO : add modeS & reg to aircraft_modes |
|
463 | + $values['registration'] = $line[0]; |
|
464 | + $values['base'] = null; |
|
465 | + $values['owner'] = $line[12]; |
|
466 | + if ($line[28] == '') $values['date_first_reg'] = null; |
|
467 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
468 | + |
|
469 | + $values['cancel'] = $line[39]; |
|
470 | 470 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
471 | - $values['registration'] = $line[0]; |
|
472 | - $values['base'] = null; |
|
473 | - $values['owner'] = $line[4]; |
|
474 | - $values['date_first_reg'] = null; |
|
475 | - $values['cancel'] = ''; |
|
471 | + $values['registration'] = $line[0]; |
|
472 | + $values['base'] = null; |
|
473 | + $values['owner'] = $line[4]; |
|
474 | + $values['date_first_reg'] = null; |
|
475 | + $values['cancel'] = ''; |
|
476 | 476 | } elseif ($country == 'CC') { |
477 | - $values['registration'] = $line[0]; |
|
478 | - $values['base'] = null; |
|
479 | - $values['owner'] = $line[6]; |
|
480 | - $values['date_first_reg'] = null; |
|
481 | - $values['cancel'] = ''; |
|
477 | + $values['registration'] = $line[0]; |
|
478 | + $values['base'] = null; |
|
479 | + $values['owner'] = $line[6]; |
|
480 | + $values['date_first_reg'] = null; |
|
481 | + $values['cancel'] = ''; |
|
482 | 482 | } elseif ($country == 'HJ') { |
483 | - $values['registration'] = $line[0]; |
|
484 | - $values['base'] = null; |
|
485 | - $values['owner'] = $line[8]; |
|
486 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
487 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
488 | - $values['cancel'] = ''; |
|
483 | + $values['registration'] = $line[0]; |
|
484 | + $values['base'] = null; |
|
485 | + $values['owner'] = $line[8]; |
|
486 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
487 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
488 | + $values['cancel'] = ''; |
|
489 | 489 | } elseif ($country == 'PP') { |
490 | - $values['registration'] = $line[0]; |
|
491 | - $values['base'] = null; |
|
492 | - $values['owner'] = $line[4]; |
|
493 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
494 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
495 | - $values['cancel'] = $line[7]; |
|
490 | + $values['registration'] = $line[0]; |
|
491 | + $values['base'] = null; |
|
492 | + $values['owner'] = $line[4]; |
|
493 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
494 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
495 | + $values['cancel'] = $line[7]; |
|
496 | 496 | } elseif ($country == 'E7') { |
497 | - $values['registration'] = $line[0]; |
|
498 | - $values['base'] = null; |
|
499 | - $values['owner'] = $line[4]; |
|
500 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
501 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
502 | - $values['cancel'] = ''; |
|
497 | + $values['registration'] = $line[0]; |
|
498 | + $values['base'] = null; |
|
499 | + $values['owner'] = $line[4]; |
|
500 | + if ($line[5] == '') $values['date_first_reg'] = null; |
|
501 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
502 | + $values['cancel'] = ''; |
|
503 | 503 | } elseif ($country == '8Q') { |
504 | - $values['registration'] = $line[0]; |
|
505 | - $values['base'] = null; |
|
506 | - $values['owner'] = $line[3]; |
|
507 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
508 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
509 | - $values['cancel'] = ''; |
|
504 | + $values['registration'] = $line[0]; |
|
505 | + $values['base'] = null; |
|
506 | + $values['owner'] = $line[3]; |
|
507 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
508 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
509 | + $values['cancel'] = ''; |
|
510 | 510 | } elseif ($country == 'ZK') { |
511 | - $values['registration'] = $line[0]; |
|
512 | - $values['base'] = null; |
|
513 | - $values['owner'] = $line[3]; |
|
514 | - $values['date_first_reg'] = null; |
|
515 | - $values['cancel'] = ''; |
|
516 | - $values['modes'] = $line[5]; |
|
517 | - $values['icao'] = $line[9]; |
|
511 | + $values['registration'] = $line[0]; |
|
512 | + $values['base'] = null; |
|
513 | + $values['owner'] = $line[3]; |
|
514 | + $values['date_first_reg'] = null; |
|
515 | + $values['cancel'] = ''; |
|
516 | + $values['modes'] = $line[5]; |
|
517 | + $values['icao'] = $line[9]; |
|
518 | 518 | } elseif ($country == 'M') { |
519 | - $values['registration'] = $line[0]; |
|
520 | - $values['base'] = null; |
|
521 | - $values['owner'] = $line[6]; |
|
522 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
523 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
524 | - $values['modes'] = $line[4]; |
|
525 | - $values['icao'] = $line[10]; |
|
519 | + $values['registration'] = $line[0]; |
|
520 | + $values['base'] = null; |
|
521 | + $values['owner'] = $line[6]; |
|
522 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
523 | + $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
524 | + $values['modes'] = $line[4]; |
|
525 | + $values['icao'] = $line[10]; |
|
526 | 526 | } elseif ($country == 'OY') { |
527 | - $values['registration'] = $line[0]; |
|
528 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
529 | - $values['modes'] = $line[5]; |
|
530 | - $values['icao'] = $line[6]; |
|
527 | + $values['registration'] = $line[0]; |
|
528 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
529 | + $values['modes'] = $line[5]; |
|
530 | + $values['icao'] = $line[6]; |
|
531 | 531 | } elseif ($country == 'PH') { |
532 | - $values['registration'] = $line[0]; |
|
533 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
534 | - $values['modes'] = $line[4]; |
|
535 | - $values['icao'] = $line[5]; |
|
532 | + $values['registration'] = $line[0]; |
|
533 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
534 | + $values['modes'] = $line[4]; |
|
535 | + $values['icao'] = $line[5]; |
|
536 | 536 | } elseif ($country == 'OM' || $country == 'TF') { |
537 | - $values['registration'] = $line[0]; |
|
538 | - $values['base'] = null; |
|
539 | - $values['owner'] = $line[3]; |
|
540 | - $values['date_first_reg'] = null; |
|
541 | - $values['cancel'] = ''; |
|
537 | + $values['registration'] = $line[0]; |
|
538 | + $values['base'] = null; |
|
539 | + $values['owner'] = $line[3]; |
|
540 | + $values['date_first_reg'] = null; |
|
541 | + $values['cancel'] = ''; |
|
542 | 542 | } |
543 | 543 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
544 | 544 | $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
@@ -665,20 +665,20 @@ discard block |
||
665 | 665 | try { |
666 | 666 | $Connection = new Connection(); |
667 | 667 | $sth = $Connection->db->prepare($query); |
668 | - $sth->execute(); |
|
669 | - } catch(PDOException $e) { |
|
670 | - return "error : ".$e->getMessage(); |
|
671 | - } |
|
668 | + $sth->execute(); |
|
669 | + } catch(PDOException $e) { |
|
670 | + return "error : ".$e->getMessage(); |
|
671 | + } |
|
672 | 672 | |
673 | 673 | |
674 | 674 | $query = 'ALTER TABLE airport DROP INDEX icaoidx'; |
675 | 675 | try { |
676 | 676 | $Connection = new Connection(); |
677 | 677 | $sth = $Connection->db->prepare($query); |
678 | - $sth->execute(); |
|
679 | - } catch(PDOException $e) { |
|
680 | - return "error : ".$e->getMessage(); |
|
681 | - } |
|
678 | + $sth->execute(); |
|
679 | + } catch(PDOException $e) { |
|
680 | + return "error : ".$e->getMessage(); |
|
681 | + } |
|
682 | 682 | |
683 | 683 | $query_dest = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image_thumb`,`image`) |
684 | 684 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
@@ -744,10 +744,10 @@ discard block |
||
744 | 744 | try { |
745 | 745 | $Connection = new Connection(); |
746 | 746 | $sth = $Connection->db->prepare($query); |
747 | - $sth->execute(); |
|
748 | - } catch(PDOException $e) { |
|
749 | - return "error : ".$e->getMessage(); |
|
750 | - } |
|
747 | + $sth->execute(); |
|
748 | + } catch(PDOException $e) { |
|
749 | + return "error : ".$e->getMessage(); |
|
750 | + } |
|
751 | 751 | |
752 | 752 | |
753 | 753 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
@@ -757,10 +757,10 @@ discard block |
||
757 | 757 | try { |
758 | 758 | $Connection = new Connection(); |
759 | 759 | $sth = $Connection->db->prepare($query); |
760 | - $sth->execute($query_values); |
|
761 | - } catch(PDOException $e) { |
|
762 | - return "error : ".$e->getMessage(); |
|
763 | - } |
|
760 | + $sth->execute($query_values); |
|
761 | + } catch(PDOException $e) { |
|
762 | + return "error : ".$e->getMessage(); |
|
763 | + } |
|
764 | 764 | $i++; |
765 | 765 | /* |
766 | 766 | $query = 'DELETE FROM airport WHERE airport_id IN (SELECT * FROM (SELECT min(a.airport_id) FROM airport a GROUP BY a.icao) x)'; |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | |
875 | 875 | |
876 | 876 | |
877 | - return "success"; |
|
877 | + return "success"; |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | public static function translation() { |
@@ -890,10 +890,10 @@ discard block |
||
890 | 890 | try { |
891 | 891 | $Connection = new Connection(); |
892 | 892 | $sth = $Connection->db->prepare($query); |
893 | - $sth->execute(array(':source' => 'translation.csv')); |
|
894 | - } catch(PDOException $e) { |
|
895 | - return "error : ".$e->getMessage(); |
|
896 | - } |
|
893 | + $sth->execute(array(':source' => 'translation.csv')); |
|
894 | + } catch(PDOException $e) { |
|
895 | + return "error : ".$e->getMessage(); |
|
896 | + } |
|
897 | 897 | |
898 | 898 | |
899 | 899 | //update_db::unzip($out_file); |
@@ -912,21 +912,21 @@ discard block |
||
912 | 912 | $data = $row; |
913 | 913 | $operator = $data[2]; |
914 | 914 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
915 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
916 | - //echo substr($operator, 0, 2)."\n";; |
|
917 | - if (count($airline_array) > 0) { |
|
915 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
916 | + //echo substr($operator, 0, 2)."\n";; |
|
917 | + if (count($airline_array) > 0) { |
|
918 | 918 | //print_r($airline_array); |
919 | 919 | $operator = $airline_array[0]['icao'].substr($operator,2); |
920 | - } |
|
921 | - } |
|
920 | + } |
|
921 | + } |
|
922 | 922 | |
923 | 923 | $operator_correct = $data[3]; |
924 | 924 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
925 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
926 | - if (count($airline_array) > 0) { |
|
927 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
928 | - } |
|
929 | - } |
|
925 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
926 | + if (count($airline_array) > 0) { |
|
927 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
928 | + } |
|
929 | + } |
|
930 | 930 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
931 | 931 | try { |
932 | 932 | $sth = $Connection->db->prepare($query); |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | //$Connection->db->commit(); |
941 | 941 | } |
942 | 942 | return ''; |
943 | - } |
|
943 | + } |
|
944 | 944 | |
945 | 945 | public static function translation_fam() { |
946 | 946 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -950,10 +950,10 @@ discard block |
||
950 | 950 | try { |
951 | 951 | $Connection = new Connection(); |
952 | 952 | $sth = $Connection->db->prepare($query); |
953 | - $sth->execute(array(':source' => 'website_fam')); |
|
954 | - } catch(PDOException $e) { |
|
955 | - return "error : ".$e->getMessage(); |
|
956 | - } |
|
953 | + $sth->execute(array(':source' => 'website_fam')); |
|
954 | + } catch(PDOException $e) { |
|
955 | + return "error : ".$e->getMessage(); |
|
956 | + } |
|
957 | 957 | |
958 | 958 | |
959 | 959 | //update_db::unzip($out_file); |
@@ -982,7 +982,7 @@ discard block |
||
982 | 982 | //$Connection->db->commit(); |
983 | 983 | } |
984 | 984 | return ''; |
985 | - } |
|
985 | + } |
|
986 | 986 | |
987 | 987 | /* |
988 | 988 | * This function use FAA public data. |
@@ -994,19 +994,19 @@ discard block |
||
994 | 994 | try { |
995 | 995 | $Connection = new Connection(); |
996 | 996 | $sth = $Connection->db->prepare($query); |
997 | - $sth->execute(array(':source' => 'website_faa')); |
|
998 | - } catch(PDOException $e) { |
|
999 | - return "error : ".$e->getMessage(); |
|
1000 | - } |
|
997 | + $sth->execute(array(':source' => 'website_faa')); |
|
998 | + } catch(PDOException $e) { |
|
999 | + return "error : ".$e->getMessage(); |
|
1000 | + } |
|
1001 | 1001 | |
1002 | 1002 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source"; |
1003 | 1003 | try { |
1004 | 1004 | $Connection = new Connection(); |
1005 | 1005 | $sth = $Connection->db->prepare($query); |
1006 | - $sth->execute(array(':source' => 'website_faa')); |
|
1007 | - } catch(PDOException $e) { |
|
1008 | - return "error : ".$e->getMessage(); |
|
1009 | - } |
|
1006 | + $sth->execute(array(':source' => 'website_faa')); |
|
1007 | + } catch(PDOException $e) { |
|
1008 | + return "error : ".$e->getMessage(); |
|
1009 | + } |
|
1010 | 1010 | |
1011 | 1011 | $delimiter = ","; |
1012 | 1012 | $mfr = array(); |
@@ -1082,17 +1082,17 @@ discard block |
||
1082 | 1082 | } |
1083 | 1083 | print_r($mfr); |
1084 | 1084 | return ''; |
1085 | - } |
|
1085 | + } |
|
1086 | 1086 | public static function modes_fam() { |
1087 | 1087 | global $tmp_dir, $globalTransaction; |
1088 | 1088 | $query = "DELETE FROM aircraft_modes WHERE Source = '' OR Source = :source"; |
1089 | 1089 | try { |
1090 | 1090 | $Connection = new Connection(); |
1091 | 1091 | $sth = $Connection->db->prepare($query); |
1092 | - $sth->execute(array(':source' => 'website_fam')); |
|
1093 | - } catch(PDOException $e) { |
|
1094 | - return "error : ".$e->getMessage(); |
|
1095 | - } |
|
1092 | + $sth->execute(array(':source' => 'website_fam')); |
|
1093 | + } catch(PDOException $e) { |
|
1094 | + return "error : ".$e->getMessage(); |
|
1095 | + } |
|
1096 | 1096 | |
1097 | 1097 | |
1098 | 1098 | //update_db::unzip($out_file); |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | if ($globalTransaction) $Connection->db->commit(); |
1123 | 1123 | } |
1124 | 1124 | return ''; |
1125 | - } |
|
1125 | + } |
|
1126 | 1126 | |
1127 | 1127 | public static function owner_fam() { |
1128 | 1128 | global $tmp_dir, $globalTransaction; |
@@ -1130,10 +1130,10 @@ discard block |
||
1130 | 1130 | try { |
1131 | 1131 | $Connection = new Connection(); |
1132 | 1132 | $sth = $Connection->db->prepare($query); |
1133 | - $sth->execute(array(':source' => 'website_fam')); |
|
1134 | - } catch(PDOException $e) { |
|
1135 | - return "error : ".$e->getMessage(); |
|
1136 | - } |
|
1133 | + $sth->execute(array(':source' => 'website_fam')); |
|
1134 | + } catch(PDOException $e) { |
|
1135 | + return "error : ".$e->getMessage(); |
|
1136 | + } |
|
1137 | 1137 | |
1138 | 1138 | $delimiter = "\t"; |
1139 | 1139 | $Connection = new Connection(); |
@@ -1159,7 +1159,7 @@ discard block |
||
1159 | 1159 | if ($globalTransaction) $Connection->db->commit(); |
1160 | 1160 | } |
1161 | 1161 | return ''; |
1162 | - } |
|
1162 | + } |
|
1163 | 1163 | |
1164 | 1164 | public static function routes_fam() { |
1165 | 1165 | global $tmp_dir, $globalTransaction; |
@@ -1167,10 +1167,10 @@ discard block |
||
1167 | 1167 | try { |
1168 | 1168 | $Connection = new Connection(); |
1169 | 1169 | $sth = $Connection->db->prepare($query); |
1170 | - $sth->execute(array(':source' => 'website_fam')); |
|
1171 | - } catch(PDOException $e) { |
|
1172 | - return "error : ".$e->getMessage(); |
|
1173 | - } |
|
1170 | + $sth->execute(array(':source' => 'website_fam')); |
|
1171 | + } catch(PDOException $e) { |
|
1172 | + return "error : ".$e->getMessage(); |
|
1173 | + } |
|
1174 | 1174 | |
1175 | 1175 | |
1176 | 1176 | //update_db::unzip($out_file); |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | if ($globalTransaction) $Connection->db->commit(); |
1200 | 1200 | } |
1201 | 1201 | return ''; |
1202 | - } |
|
1202 | + } |
|
1203 | 1203 | |
1204 | 1204 | public static function marine_identity_fam() { |
1205 | 1205 | global $tmp_dir, $globalTransaction; |
@@ -1207,10 +1207,10 @@ discard block |
||
1207 | 1207 | try { |
1208 | 1208 | $Connection = new Connection(); |
1209 | 1209 | $sth = $Connection->db->prepare($query); |
1210 | - $sth->execute(); |
|
1211 | - } catch(PDOException $e) { |
|
1212 | - return "error : ".$e->getMessage(); |
|
1213 | - } |
|
1210 | + $sth->execute(); |
|
1211 | + } catch(PDOException $e) { |
|
1212 | + return "error : ".$e->getMessage(); |
|
1213 | + } |
|
1214 | 1214 | |
1215 | 1215 | |
1216 | 1216 | //update_db::unzip($out_file); |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | if ($globalTransaction) $Connection->db->commit(); |
1240 | 1240 | } |
1241 | 1241 | return ''; |
1242 | - } |
|
1242 | + } |
|
1243 | 1243 | |
1244 | 1244 | public static function banned_fam() { |
1245 | 1245 | global $tmp_dir, $globalTransaction; |
@@ -1273,7 +1273,7 @@ discard block |
||
1273 | 1273 | if ($globalTransaction) $Connection->db->commit(); |
1274 | 1274 | } |
1275 | 1275 | return ''; |
1276 | - } |
|
1276 | + } |
|
1277 | 1277 | |
1278 | 1278 | public static function tle($filename,$tletype) { |
1279 | 1279 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1284,10 +1284,10 @@ discard block |
||
1284 | 1284 | try { |
1285 | 1285 | $Connection = new Connection(); |
1286 | 1286 | $sth = $Connection->db->prepare($query); |
1287 | - $sth->execute(array(':source' => $filename)); |
|
1288 | - } catch(PDOException $e) { |
|
1289 | - return "error : ".$e->getMessage(); |
|
1290 | - } |
|
1287 | + $sth->execute(array(':source' => $filename)); |
|
1288 | + } catch(PDOException $e) { |
|
1289 | + return "error : ".$e->getMessage(); |
|
1290 | + } |
|
1291 | 1291 | |
1292 | 1292 | $Connection = new Connection(); |
1293 | 1293 | if (($handle = fopen($filename, 'r')) !== FALSE) |
@@ -1322,54 +1322,54 @@ discard block |
||
1322 | 1322 | //$Connection->db->commit(); |
1323 | 1323 | } |
1324 | 1324 | return ''; |
1325 | - } |
|
1325 | + } |
|
1326 | 1326 | |
1327 | 1327 | /** |
1328 | - * Convert a HTML table to an array |
|
1329 | - * @param String $data HTML page |
|
1330 | - * @return Array array of the tables in HTML page |
|
1331 | - */ |
|
1332 | - private static function table2array($data) { |
|
1333 | - $html = str_get_html($data); |
|
1334 | - $tabledata=array(); |
|
1335 | - foreach($html->find('tr') as $element) |
|
1336 | - { |
|
1337 | - $td = array(); |
|
1338 | - foreach( $element->find('th') as $row) |
|
1339 | - { |
|
1340 | - $td [] = trim($row->plaintext); |
|
1341 | - } |
|
1342 | - $td=array_filter($td); |
|
1343 | - $tabledata[] = $td; |
|
1344 | - |
|
1345 | - $td = array(); |
|
1346 | - $tdi = array(); |
|
1347 | - foreach( $element->find('td') as $row) |
|
1348 | - { |
|
1349 | - $td [] = trim($row->plaintext); |
|
1350 | - $tdi [] = trim($row->innertext); |
|
1351 | - } |
|
1352 | - $td=array_filter($td); |
|
1353 | - $tdi=array_filter($tdi); |
|
1354 | - // $tabledata[]=array_merge($td,$tdi); |
|
1355 | - $tabledata[]=$td; |
|
1356 | - } |
|
1357 | - return(array_filter($tabledata)); |
|
1358 | - } |
|
1359 | - |
|
1360 | - /** |
|
1361 | - * Get data from form result |
|
1362 | - * @param String $url form URL |
|
1363 | - * @return String the result |
|
1364 | - */ |
|
1365 | - private static function getData($url) { |
|
1366 | - $ch = curl_init(); |
|
1367 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
1368 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
1369 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
1370 | - 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'); |
|
1371 | - return curl_exec($ch); |
|
1372 | - } |
|
1328 | + * Convert a HTML table to an array |
|
1329 | + * @param String $data HTML page |
|
1330 | + * @return Array array of the tables in HTML page |
|
1331 | + */ |
|
1332 | + private static function table2array($data) { |
|
1333 | + $html = str_get_html($data); |
|
1334 | + $tabledata=array(); |
|
1335 | + foreach($html->find('tr') as $element) |
|
1336 | + { |
|
1337 | + $td = array(); |
|
1338 | + foreach( $element->find('th') as $row) |
|
1339 | + { |
|
1340 | + $td [] = trim($row->plaintext); |
|
1341 | + } |
|
1342 | + $td=array_filter($td); |
|
1343 | + $tabledata[] = $td; |
|
1344 | + |
|
1345 | + $td = array(); |
|
1346 | + $tdi = array(); |
|
1347 | + foreach( $element->find('td') as $row) |
|
1348 | + { |
|
1349 | + $td [] = trim($row->plaintext); |
|
1350 | + $tdi [] = trim($row->innertext); |
|
1351 | + } |
|
1352 | + $td=array_filter($td); |
|
1353 | + $tdi=array_filter($tdi); |
|
1354 | + // $tabledata[]=array_merge($td,$tdi); |
|
1355 | + $tabledata[]=$td; |
|
1356 | + } |
|
1357 | + return(array_filter($tabledata)); |
|
1358 | + } |
|
1359 | + |
|
1360 | + /** |
|
1361 | + * Get data from form result |
|
1362 | + * @param String $url form URL |
|
1363 | + * @return String the result |
|
1364 | + */ |
|
1365 | + private static function getData($url) { |
|
1366 | + $ch = curl_init(); |
|
1367 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
1368 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
1369 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
1370 | + 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'); |
|
1371 | + return curl_exec($ch); |
|
1372 | + } |
|
1373 | 1373 | /* |
1374 | 1374 | public static function waypoints() { |
1375 | 1375 | $data = update_db::getData('http://www.fallingrain.com/world/FR/waypoints.html'); |
@@ -1452,7 +1452,7 @@ discard block |
||
1452 | 1452 | if ($globalTransaction) $Connection->db->commit(); |
1453 | 1453 | } |
1454 | 1454 | return ''; |
1455 | - } |
|
1455 | + } |
|
1456 | 1456 | |
1457 | 1457 | public static function ivao_airlines($filename) { |
1458 | 1458 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1462,10 +1462,10 @@ discard block |
||
1462 | 1462 | try { |
1463 | 1463 | $Connection = new Connection(); |
1464 | 1464 | $sth = $Connection->db->prepare($query); |
1465 | - $sth->execute(); |
|
1466 | - } catch(PDOException $e) { |
|
1467 | - return "error : ".$e->getMessage(); |
|
1468 | - } |
|
1465 | + $sth->execute(); |
|
1466 | + } catch(PDOException $e) { |
|
1467 | + return "error : ".$e->getMessage(); |
|
1468 | + } |
|
1469 | 1469 | |
1470 | 1470 | $header = NULL; |
1471 | 1471 | $delimiter = ':'; |
@@ -1489,7 +1489,7 @@ discard block |
||
1489 | 1489 | if ($globalTransaction) $Connection->db->commit(); |
1490 | 1490 | } |
1491 | 1491 | return ''; |
1492 | - } |
|
1492 | + } |
|
1493 | 1493 | |
1494 | 1494 | public static function update_airspace() { |
1495 | 1495 | global $tmp_dir, $globalDBdriver; |
@@ -1499,11 +1499,11 @@ discard block |
||
1499 | 1499 | $query = 'DROP TABLE airspace'; |
1500 | 1500 | try { |
1501 | 1501 | $sth = $Connection->db->prepare($query); |
1502 | - $sth->execute(); |
|
1503 | - } catch(PDOException $e) { |
|
1502 | + $sth->execute(); |
|
1503 | + } catch(PDOException $e) { |
|
1504 | 1504 | return "error : ".$e->getMessage(); |
1505 | - } |
|
1506 | - } |
|
1505 | + } |
|
1506 | + } |
|
1507 | 1507 | |
1508 | 1508 | |
1509 | 1509 | if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
@@ -1558,10 +1558,10 @@ discard block |
||
1558 | 1558 | $query = 'DROP TABLE countries'; |
1559 | 1559 | try { |
1560 | 1560 | $sth = $Connection->db->prepare($query); |
1561 | - $sth->execute(); |
|
1562 | - } catch(PDOException $e) { |
|
1563 | - echo "error : ".$e->getMessage(); |
|
1564 | - } |
|
1561 | + $sth->execute(); |
|
1562 | + } catch(PDOException $e) { |
|
1563 | + echo "error : ".$e->getMessage(); |
|
1564 | + } |
|
1565 | 1565 | } |
1566 | 1566 | if ($globalDBdriver == 'mysql') { |
1567 | 1567 | update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
@@ -2090,11 +2090,11 @@ discard block |
||
2090 | 2090 | $query = 'DROP TABLE airspace'; |
2091 | 2091 | try { |
2092 | 2092 | $sth = $Connection->db->prepare($query); |
2093 | - $sth->execute(); |
|
2094 | - } catch(PDOException $e) { |
|
2093 | + $sth->execute(); |
|
2094 | + } catch(PDOException $e) { |
|
2095 | 2095 | return "error : ".$e->getMessage(); |
2096 | - } |
|
2097 | - } |
|
2096 | + } |
|
2097 | + } |
|
2098 | 2098 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2099 | 2099 | update_db::insert_airspace_version($airspace_md5); |
2100 | 2100 | } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
@@ -2251,12 +2251,12 @@ discard block |
||
2251 | 2251 | echo $data; |
2252 | 2252 | */ |
2253 | 2253 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2254 | - //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
2255 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2256 | - $result = fread($fh,100000000); |
|
2257 | - //echo $result; |
|
2258 | - //var_dump(str_get_html($result)); |
|
2259 | - //print_r(self::table2array($result)); |
|
2254 | + //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
2255 | + $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2256 | + $result = fread($fh,100000000); |
|
2257 | + //echo $result; |
|
2258 | + //var_dump(str_get_html($result)); |
|
2259 | + //print_r(self::table2array($result)); |
|
2260 | 2260 | } |
2261 | 2261 | |
2262 | 2262 | } |
@@ -2270,10 +2270,10 @@ discard block |
||
2270 | 2270 | try { |
2271 | 2271 | $Connection = new Connection(); |
2272 | 2272 | $sth = $Connection->db->prepare($query); |
2273 | - $sth->execute(); |
|
2274 | - } catch(PDOException $e) { |
|
2275 | - return "error : ".$e->getMessage(); |
|
2276 | - } |
|
2273 | + $sth->execute(); |
|
2274 | + } catch(PDOException $e) { |
|
2275 | + return "error : ".$e->getMessage(); |
|
2276 | + } |
|
2277 | 2277 | |
2278 | 2278 | $error = ''; |
2279 | 2279 | if ($globalDebug) echo "Notam : Download..."; |
@@ -2329,8 +2329,8 @@ discard block |
||
2329 | 2329 | $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
2330 | 2330 | $data['permanent'] = 0; |
2331 | 2331 | } else { |
2332 | - $data['date_end'] = NULL; |
|
2333 | - $data['permanent'] = 1; |
|
2332 | + $data['date_end'] = NULL; |
|
2333 | + $data['permanent'] = 1; |
|
2334 | 2334 | } |
2335 | 2335 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2336 | 2336 | $NOTAM = new NOTAM(); |
@@ -2404,13 +2404,13 @@ discard block |
||
2404 | 2404 | try { |
2405 | 2405 | $Connection = new Connection(); |
2406 | 2406 | $sth = $Connection->db->prepare($query); |
2407 | - $sth->execute(); |
|
2408 | - } catch(PDOException $e) { |
|
2409 | - return "error : ".$e->getMessage(); |
|
2410 | - } |
|
2411 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2412 | - if ($row['nb'] > 0) return false; |
|
2413 | - else return true; |
|
2407 | + $sth->execute(); |
|
2408 | + } catch(PDOException $e) { |
|
2409 | + return "error : ".$e->getMessage(); |
|
2410 | + } |
|
2411 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2412 | + if ($row['nb'] > 0) return false; |
|
2413 | + else return true; |
|
2414 | 2414 | } |
2415 | 2415 | |
2416 | 2416 | public static function insert_last_update() { |
@@ -2419,10 +2419,10 @@ discard block |
||
2419 | 2419 | try { |
2420 | 2420 | $Connection = new Connection(); |
2421 | 2421 | $sth = $Connection->db->prepare($query); |
2422 | - $sth->execute(); |
|
2423 | - } catch(PDOException $e) { |
|
2424 | - return "error : ".$e->getMessage(); |
|
2425 | - } |
|
2422 | + $sth->execute(); |
|
2423 | + } catch(PDOException $e) { |
|
2424 | + return "error : ".$e->getMessage(); |
|
2425 | + } |
|
2426 | 2426 | } |
2427 | 2427 | |
2428 | 2428 | public static function check_airspace_version($version) { |
@@ -2430,13 +2430,13 @@ discard block |
||
2430 | 2430 | try { |
2431 | 2431 | $Connection = new Connection(); |
2432 | 2432 | $sth = $Connection->db->prepare($query); |
2433 | - $sth->execute(array(':version' => $version)); |
|
2434 | - } catch(PDOException $e) { |
|
2435 | - return "error : ".$e->getMessage(); |
|
2436 | - } |
|
2437 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2438 | - if ($row['nb'] > 0) return true; |
|
2439 | - else return false; |
|
2433 | + $sth->execute(array(':version' => $version)); |
|
2434 | + } catch(PDOException $e) { |
|
2435 | + return "error : ".$e->getMessage(); |
|
2436 | + } |
|
2437 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2438 | + if ($row['nb'] > 0) return true; |
|
2439 | + else return false; |
|
2440 | 2440 | } |
2441 | 2441 | |
2442 | 2442 | public static function check_marine_identity_version($version) { |
@@ -2444,13 +2444,13 @@ discard block |
||
2444 | 2444 | try { |
2445 | 2445 | $Connection = new Connection(); |
2446 | 2446 | $sth = $Connection->db->prepare($query); |
2447 | - $sth->execute(array(':version' => $version)); |
|
2448 | - } catch(PDOException $e) { |
|
2449 | - return "error : ".$e->getMessage(); |
|
2450 | - } |
|
2451 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2452 | - if ($row['nb'] > 0) return true; |
|
2453 | - else return false; |
|
2447 | + $sth->execute(array(':version' => $version)); |
|
2448 | + } catch(PDOException $e) { |
|
2449 | + return "error : ".$e->getMessage(); |
|
2450 | + } |
|
2451 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2452 | + if ($row['nb'] > 0) return true; |
|
2453 | + else return false; |
|
2454 | 2454 | } |
2455 | 2455 | |
2456 | 2456 | |
@@ -2460,10 +2460,10 @@ discard block |
||
2460 | 2460 | try { |
2461 | 2461 | $Connection = new Connection(); |
2462 | 2462 | $sth = $Connection->db->prepare($query); |
2463 | - $sth->execute(array(':version' => $version)); |
|
2464 | - } catch(PDOException $e) { |
|
2465 | - return "error : ".$e->getMessage(); |
|
2466 | - } |
|
2463 | + $sth->execute(array(':version' => $version)); |
|
2464 | + } catch(PDOException $e) { |
|
2465 | + return "error : ".$e->getMessage(); |
|
2466 | + } |
|
2467 | 2467 | } |
2468 | 2468 | |
2469 | 2469 | public static function insert_marine_identity_version($version) { |
@@ -2472,10 +2472,10 @@ discard block |
||
2472 | 2472 | try { |
2473 | 2473 | $Connection = new Connection(); |
2474 | 2474 | $sth = $Connection->db->prepare($query); |
2475 | - $sth->execute(array(':version' => $version)); |
|
2476 | - } catch(PDOException $e) { |
|
2477 | - return "error : ".$e->getMessage(); |
|
2478 | - } |
|
2475 | + $sth->execute(array(':version' => $version)); |
|
2476 | + } catch(PDOException $e) { |
|
2477 | + return "error : ".$e->getMessage(); |
|
2478 | + } |
|
2479 | 2479 | } |
2480 | 2480 | |
2481 | 2481 | public static function check_last_notam_update() { |
@@ -2488,13 +2488,13 @@ discard block |
||
2488 | 2488 | try { |
2489 | 2489 | $Connection = new Connection(); |
2490 | 2490 | $sth = $Connection->db->prepare($query); |
2491 | - $sth->execute(); |
|
2492 | - } catch(PDOException $e) { |
|
2493 | - return "error : ".$e->getMessage(); |
|
2494 | - } |
|
2495 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2496 | - if ($row['nb'] > 0) return false; |
|
2497 | - else return true; |
|
2491 | + $sth->execute(); |
|
2492 | + } catch(PDOException $e) { |
|
2493 | + return "error : ".$e->getMessage(); |
|
2494 | + } |
|
2495 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2496 | + if ($row['nb'] > 0) return false; |
|
2497 | + else return true; |
|
2498 | 2498 | } |
2499 | 2499 | |
2500 | 2500 | public static function insert_last_notam_update() { |
@@ -2503,10 +2503,10 @@ discard block |
||
2503 | 2503 | try { |
2504 | 2504 | $Connection = new Connection(); |
2505 | 2505 | $sth = $Connection->db->prepare($query); |
2506 | - $sth->execute(); |
|
2507 | - } catch(PDOException $e) { |
|
2508 | - return "error : ".$e->getMessage(); |
|
2509 | - } |
|
2506 | + $sth->execute(); |
|
2507 | + } catch(PDOException $e) { |
|
2508 | + return "error : ".$e->getMessage(); |
|
2509 | + } |
|
2510 | 2510 | } |
2511 | 2511 | public static function check_last_airspace_update() { |
2512 | 2512 | global $globalDBdriver; |
@@ -2518,13 +2518,13 @@ discard block |
||
2518 | 2518 | try { |
2519 | 2519 | $Connection = new Connection(); |
2520 | 2520 | $sth = $Connection->db->prepare($query); |
2521 | - $sth->execute(); |
|
2522 | - } catch(PDOException $e) { |
|
2523 | - return "error : ".$e->getMessage(); |
|
2524 | - } |
|
2525 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2526 | - if ($row['nb'] > 0) return false; |
|
2527 | - else return true; |
|
2521 | + $sth->execute(); |
|
2522 | + } catch(PDOException $e) { |
|
2523 | + return "error : ".$e->getMessage(); |
|
2524 | + } |
|
2525 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2526 | + if ($row['nb'] > 0) return false; |
|
2527 | + else return true; |
|
2528 | 2528 | } |
2529 | 2529 | |
2530 | 2530 | public static function insert_last_airspace_update() { |
@@ -2533,10 +2533,10 @@ discard block |
||
2533 | 2533 | try { |
2534 | 2534 | $Connection = new Connection(); |
2535 | 2535 | $sth = $Connection->db->prepare($query); |
2536 | - $sth->execute(); |
|
2537 | - } catch(PDOException $e) { |
|
2538 | - return "error : ".$e->getMessage(); |
|
2539 | - } |
|
2536 | + $sth->execute(); |
|
2537 | + } catch(PDOException $e) { |
|
2538 | + return "error : ".$e->getMessage(); |
|
2539 | + } |
|
2540 | 2540 | } |
2541 | 2541 | |
2542 | 2542 | public static function check_last_owner_update() { |
@@ -2549,13 +2549,13 @@ discard block |
||
2549 | 2549 | try { |
2550 | 2550 | $Connection = new Connection(); |
2551 | 2551 | $sth = $Connection->db->prepare($query); |
2552 | - $sth->execute(); |
|
2553 | - } catch(PDOException $e) { |
|
2554 | - return "error : ".$e->getMessage(); |
|
2555 | - } |
|
2556 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2557 | - if ($row['nb'] > 0) return false; |
|
2558 | - else return true; |
|
2552 | + $sth->execute(); |
|
2553 | + } catch(PDOException $e) { |
|
2554 | + return "error : ".$e->getMessage(); |
|
2555 | + } |
|
2556 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2557 | + if ($row['nb'] > 0) return false; |
|
2558 | + else return true; |
|
2559 | 2559 | } |
2560 | 2560 | |
2561 | 2561 | public static function insert_last_owner_update() { |
@@ -2564,10 +2564,10 @@ discard block |
||
2564 | 2564 | try { |
2565 | 2565 | $Connection = new Connection(); |
2566 | 2566 | $sth = $Connection->db->prepare($query); |
2567 | - $sth->execute(); |
|
2568 | - } catch(PDOException $e) { |
|
2569 | - return "error : ".$e->getMessage(); |
|
2570 | - } |
|
2567 | + $sth->execute(); |
|
2568 | + } catch(PDOException $e) { |
|
2569 | + return "error : ".$e->getMessage(); |
|
2570 | + } |
|
2571 | 2571 | } |
2572 | 2572 | public static function check_last_schedules_update() { |
2573 | 2573 | global $globalDBdriver; |
@@ -2579,13 +2579,13 @@ discard block |
||
2579 | 2579 | try { |
2580 | 2580 | $Connection = new Connection(); |
2581 | 2581 | $sth = $Connection->db->prepare($query); |
2582 | - $sth->execute(); |
|
2583 | - } catch(PDOException $e) { |
|
2584 | - return "error : ".$e->getMessage(); |
|
2585 | - } |
|
2586 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2587 | - if ($row['nb'] > 0) return false; |
|
2588 | - else return true; |
|
2582 | + $sth->execute(); |
|
2583 | + } catch(PDOException $e) { |
|
2584 | + return "error : ".$e->getMessage(); |
|
2585 | + } |
|
2586 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2587 | + if ($row['nb'] > 0) return false; |
|
2588 | + else return true; |
|
2589 | 2589 | } |
2590 | 2590 | |
2591 | 2591 | public static function insert_last_schedules_update() { |
@@ -2594,10 +2594,10 @@ discard block |
||
2594 | 2594 | try { |
2595 | 2595 | $Connection = new Connection(); |
2596 | 2596 | $sth = $Connection->db->prepare($query); |
2597 | - $sth->execute(); |
|
2598 | - } catch(PDOException $e) { |
|
2599 | - return "error : ".$e->getMessage(); |
|
2600 | - } |
|
2597 | + $sth->execute(); |
|
2598 | + } catch(PDOException $e) { |
|
2599 | + return "error : ".$e->getMessage(); |
|
2600 | + } |
|
2601 | 2601 | } |
2602 | 2602 | public static function check_last_tle_update() { |
2603 | 2603 | global $globalDBdriver; |
@@ -2609,13 +2609,13 @@ discard block |
||
2609 | 2609 | try { |
2610 | 2610 | $Connection = new Connection(); |
2611 | 2611 | $sth = $Connection->db->prepare($query); |
2612 | - $sth->execute(); |
|
2613 | - } catch(PDOException $e) { |
|
2614 | - return "error : ".$e->getMessage(); |
|
2615 | - } |
|
2616 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2617 | - if ($row['nb'] > 0) return false; |
|
2618 | - else return true; |
|
2612 | + $sth->execute(); |
|
2613 | + } catch(PDOException $e) { |
|
2614 | + return "error : ".$e->getMessage(); |
|
2615 | + } |
|
2616 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2617 | + if ($row['nb'] > 0) return false; |
|
2618 | + else return true; |
|
2619 | 2619 | } |
2620 | 2620 | |
2621 | 2621 | public static function insert_last_tle_update() { |
@@ -2624,10 +2624,10 @@ discard block |
||
2624 | 2624 | try { |
2625 | 2625 | $Connection = new Connection(); |
2626 | 2626 | $sth = $Connection->db->prepare($query); |
2627 | - $sth->execute(); |
|
2628 | - } catch(PDOException $e) { |
|
2629 | - return "error : ".$e->getMessage(); |
|
2630 | - } |
|
2627 | + $sth->execute(); |
|
2628 | + } catch(PDOException $e) { |
|
2629 | + return "error : ".$e->getMessage(); |
|
2630 | + } |
|
2631 | 2631 | } |
2632 | 2632 | public static function check_last_marine_identity_update() { |
2633 | 2633 | global $globalDBdriver; |
@@ -2639,13 +2639,13 @@ discard block |
||
2639 | 2639 | try { |
2640 | 2640 | $Connection = new Connection(); |
2641 | 2641 | $sth = $Connection->db->prepare($query); |
2642 | - $sth->execute(); |
|
2643 | - } catch(PDOException $e) { |
|
2644 | - return "error : ".$e->getMessage(); |
|
2645 | - } |
|
2646 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2647 | - if ($row['nb'] > 0) return false; |
|
2648 | - else return true; |
|
2642 | + $sth->execute(); |
|
2643 | + } catch(PDOException $e) { |
|
2644 | + return "error : ".$e->getMessage(); |
|
2645 | + } |
|
2646 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2647 | + if ($row['nb'] > 0) return false; |
|
2648 | + else return true; |
|
2649 | 2649 | } |
2650 | 2650 | |
2651 | 2651 | public static function insert_last_marine_identity_update() { |
@@ -2654,10 +2654,10 @@ discard block |
||
2654 | 2654 | try { |
2655 | 2655 | $Connection = new Connection(); |
2656 | 2656 | $sth = $Connection->db->prepare($query); |
2657 | - $sth->execute(); |
|
2658 | - } catch(PDOException $e) { |
|
2659 | - return "error : ".$e->getMessage(); |
|
2660 | - } |
|
2657 | + $sth->execute(); |
|
2658 | + } catch(PDOException $e) { |
|
2659 | + return "error : ".$e->getMessage(); |
|
2660 | + } |
|
2661 | 2661 | } |
2662 | 2662 | public static function delete_duplicatemodes() { |
2663 | 2663 | global $globalDBdriver; |
@@ -2669,10 +2669,10 @@ discard block |
||
2669 | 2669 | try { |
2670 | 2670 | $Connection = new Connection(); |
2671 | 2671 | $sth = $Connection->db->prepare($query); |
2672 | - $sth->execute(); |
|
2673 | - } catch(PDOException $e) { |
|
2674 | - return "error : ".$e->getMessage(); |
|
2675 | - } |
|
2672 | + $sth->execute(); |
|
2673 | + } catch(PDOException $e) { |
|
2674 | + return "error : ".$e->getMessage(); |
|
2675 | + } |
|
2676 | 2676 | } |
2677 | 2677 | public static function delete_duplicateowner() { |
2678 | 2678 | global $globalDBdriver; |
@@ -2684,10 +2684,10 @@ discard block |
||
2684 | 2684 | try { |
2685 | 2685 | $Connection = new Connection(); |
2686 | 2686 | $sth = $Connection->db->prepare($query); |
2687 | - $sth->execute(); |
|
2688 | - } catch(PDOException $e) { |
|
2689 | - return "error : ".$e->getMessage(); |
|
2690 | - } |
|
2687 | + $sth->execute(); |
|
2688 | + } catch(PDOException $e) { |
|
2689 | + return "error : ".$e->getMessage(); |
|
2690 | + } |
|
2691 | 2691 | } |
2692 | 2692 | |
2693 | 2693 | public static function update_all() { |
@@ -24,20 +24,20 @@ discard block |
||
24 | 24 | fclose($fp); |
25 | 25 | } |
26 | 26 | |
27 | - public static function gunzip($in_file,$out_file_name = '') { |
|
27 | + public static function gunzip($in_file, $out_file_name = '') { |
|
28 | 28 | //echo $in_file.' -> '.$out_file_name."\n"; |
29 | 29 | $buffer_size = 4096; // read 4kb at a time |
30 | 30 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
31 | 31 | if ($in_file != '' && file_exists($in_file)) { |
32 | 32 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
33 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
34 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
33 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
34 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
35 | 35 | else { |
36 | 36 | echo 'gzopen not available'; |
37 | 37 | die; |
38 | 38 | } |
39 | 39 | $out_file = fopen($out_file_name, 'wb'); |
40 | - while(!gzeof($file)) { |
|
40 | + while (!gzeof($file)) { |
|
41 | 41 | fwrite($out_file, gzread($file, $buffer_size)); |
42 | 42 | } |
43 | 43 | fclose($out_file); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | try { |
62 | 62 | self::$db_sqlite = new PDO('sqlite:'.$database); |
63 | 63 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
64 | - } catch(PDOException $e) { |
|
64 | + } catch (PDOException $e) { |
|
65 | 65 | return "error : ".$e->getMessage(); |
66 | 66 | } |
67 | 67 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | //$Connection = new Connection(); |
77 | 77 | $sth = $Connection->db->prepare($query); |
78 | 78 | $sth->execute(array(':source' => $database_file)); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error : ".$e->getMessage(); |
81 | 81 | } |
82 | 82 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | try { |
88 | 88 | $sth = update_db::$db_sqlite->prepare($query); |
89 | 89 | $sth->execute(); |
90 | - } catch(PDOException $e) { |
|
90 | + } catch (PDOException $e) { |
|
91 | 91 | return "error : ".$e->getMessage(); |
92 | 92 | } |
93 | 93 | //$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)'; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | if ($globalTransaction) $Connection->db->beginTransaction(); |
99 | 99 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
100 | 100 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
101 | - $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); |
|
101 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
102 | 102 | $sth_dest->execute($query_dest_values); |
103 | 103 | } |
104 | 104 | if ($globalTransaction) $Connection->db->commit(); |
105 | - } catch(PDOException $e) { |
|
105 | + } catch (PDOException $e) { |
|
106 | 106 | if ($globalTransaction) $Connection->db->rollBack(); |
107 | 107 | return "error : ".$e->getMessage(); |
108 | 108 | } |
@@ -118,26 +118,26 @@ discard block |
||
118 | 118 | //$Connection = new Connection(); |
119 | 119 | $sth = $Connection->db->prepare($query); |
120 | 120 | $sth->execute(array(':source' => 'oneworld')); |
121 | - } catch(PDOException $e) { |
|
121 | + } catch (PDOException $e) { |
|
122 | 122 | return "error : ".$e->getMessage(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | if ($globalDebug) echo " - Add routes to DB -"; |
126 | 126 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
127 | 127 | $Spotter = new Spotter(); |
128 | - if ($fh = fopen($database_file,"r")) { |
|
128 | + if ($fh = fopen($database_file, "r")) { |
|
129 | 129 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
130 | 130 | $Connection = new Connection(); |
131 | 131 | $sth_dest = $Connection->db->prepare($query_dest); |
132 | 132 | if ($globalTransaction) $Connection->db->beginTransaction(); |
133 | 133 | while (!feof($fh)) { |
134 | - $line = fgetcsv($fh,9999,','); |
|
134 | + $line = fgetcsv($fh, 9999, ','); |
|
135 | 135 | if ($line[0] != '') { |
136 | 136 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
137 | 137 | try { |
138 | - $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'); |
|
138 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
139 | 139 | $sth_dest->execute($query_dest_values); |
140 | - } catch(PDOException $e) { |
|
140 | + } catch (PDOException $e) { |
|
141 | 141 | if ($globalTransaction) $Connection->db->rollBack(); |
142 | 142 | return "error : ".$e->getMessage(); |
143 | 143 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | //$Connection = new Connection(); |
160 | 160 | $sth = $Connection->db->prepare($query); |
161 | 161 | $sth->execute(array(':source' => 'skyteam')); |
162 | - } catch(PDOException $e) { |
|
162 | + } catch (PDOException $e) { |
|
163 | 163 | return "error : ".$e->getMessage(); |
164 | 164 | } |
165 | 165 | |
@@ -167,24 +167,24 @@ discard block |
||
167 | 167 | |
168 | 168 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
169 | 169 | $Spotter = new Spotter(); |
170 | - if ($fh = fopen($database_file,"r")) { |
|
170 | + if ($fh = fopen($database_file, "r")) { |
|
171 | 171 | $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)'; |
172 | 172 | $Connection = new Connection(); |
173 | 173 | $sth_dest = $Connection->db->prepare($query_dest); |
174 | 174 | try { |
175 | 175 | if ($globalTransaction) $Connection->db->beginTransaction(); |
176 | 176 | while (!feof($fh)) { |
177 | - $line = fgetcsv($fh,9999,','); |
|
177 | + $line = fgetcsv($fh, 9999, ','); |
|
178 | 178 | if ($line[0] != '') { |
179 | - $datebe = explode(' - ',$line[2]); |
|
179 | + $datebe = explode(' - ', $line[2]); |
|
180 | 180 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
181 | - $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'); |
|
181 | + $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'); |
|
182 | 182 | $sth_dest->execute($query_dest_values); |
183 | 183 | } |
184 | 184 | } |
185 | 185 | } |
186 | 186 | if ($globalTransaction) $Connection->db->commit(); |
187 | - } catch(PDOException $e) { |
|
187 | + } catch (PDOException $e) { |
|
188 | 188 | if ($globalTransaction) $Connection->db->rollBack(); |
189 | 189 | return "error : ".$e->getMessage(); |
190 | 190 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $Connection = new Connection(); |
200 | 200 | $sth = $Connection->db->prepare($query); |
201 | 201 | $sth->execute(array(':source' => $database_file)); |
202 | - } catch(PDOException $e) { |
|
202 | + } catch (PDOException $e) { |
|
203 | 203 | return "error : ".$e->getMessage(); |
204 | 204 | } |
205 | 205 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $Connection = new Connection(); |
208 | 208 | $sth = $Connection->db->prepare($query); |
209 | 209 | $sth->execute(array(':source' => $database_file)); |
210 | - } catch(PDOException $e) { |
|
210 | + } catch (PDOException $e) { |
|
211 | 211 | return "error : ".$e->getMessage(); |
212 | 212 | } |
213 | 213 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | try { |
217 | 217 | $sth = update_db::$db_sqlite->prepare($query); |
218 | 218 | $sth->execute(); |
219 | - } catch(PDOException $e) { |
|
219 | + } catch (PDOException $e) { |
|
220 | 220 | return "error : ".$e->getMessage(); |
221 | 221 | } |
222 | 222 | //$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)'; |
@@ -233,15 +233,15 @@ discard block |
||
233 | 233 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
234 | 234 | if ($values['UserString4'] == 'M') $type = 'military'; |
235 | 235 | else $type = null; |
236 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
236 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
237 | 237 | $sth_dest->execute($query_dest_values); |
238 | 238 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
239 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
239 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
240 | 240 | $sth_dest_owner->execute($query_dest_owner_values); |
241 | 241 | } |
242 | 242 | } |
243 | 243 | if ($globalTransaction) $Connection->db->commit(); |
244 | - } catch(PDOException $e) { |
|
244 | + } catch (PDOException $e) { |
|
245 | 245 | return "error : ".$e->getMessage(); |
246 | 246 | } |
247 | 247 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $Connection = new Connection(); |
252 | 252 | $sth = $Connection->db->prepare($query); |
253 | 253 | $sth->execute(array(':source' => $database_file)); |
254 | - } catch(PDOException $e) { |
|
254 | + } catch (PDOException $e) { |
|
255 | 255 | return "error : ".$e->getMessage(); |
256 | 256 | } |
257 | 257 | return ''; |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | $Connection = new Connection(); |
267 | 267 | $sth = $Connection->db->prepare($query); |
268 | 268 | $sth->execute(array(':source' => $database_file)); |
269 | - } catch(PDOException $e) { |
|
269 | + } catch (PDOException $e) { |
|
270 | 270 | return "error : ".$e->getMessage(); |
271 | 271 | } |
272 | 272 | |
273 | - if ($fh = fopen($database_file,"r")) { |
|
273 | + if ($fh = fopen($database_file, "r")) { |
|
274 | 274 | //$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)'; |
275 | 275 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
276 | 276 | |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | if ($globalTransaction) $Connection->db->beginTransaction(); |
281 | 281 | while (!feof($fh)) { |
282 | 282 | $values = array(); |
283 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
283 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
284 | 284 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
285 | - $values['ModeS'] = substr($line,0,6); |
|
286 | - $values['Registration'] = trim(substr($line,69,6)); |
|
287 | - $aircraft_name = trim(substr($line,48,6)); |
|
285 | + $values['ModeS'] = substr($line, 0, 6); |
|
286 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
287 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
288 | 288 | // Check if we can find ICAO, else set it to GLID |
289 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
289 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
290 | 290 | $search_more = ''; |
291 | 291 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
292 | 292 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -298,20 +298,20 @@ discard block |
||
298 | 298 | if (isset($result['icao']) && $result['icao'] != '') { |
299 | 299 | $values['ICAOTypeCode'] = $result['icao']; |
300 | 300 | } |
301 | - } catch(PDOException $e) { |
|
301 | + } catch (PDOException $e) { |
|
302 | 302 | return "error : ".$e->getMessage(); |
303 | 303 | } |
304 | 304 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
305 | 305 | // Add data to db |
306 | 306 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
307 | 307 | //$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']); |
308 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
308 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
309 | 309 | //print_r($query_dest_values); |
310 | 310 | $sth_dest->execute($query_dest_values); |
311 | 311 | } |
312 | 312 | } |
313 | 313 | if ($globalTransaction) $Connection->db->commit(); |
314 | - } catch(PDOException $e) { |
|
314 | + } catch (PDOException $e) { |
|
315 | 315 | return "error : ".$e->getMessage(); |
316 | 316 | } |
317 | 317 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $Connection = new Connection(); |
322 | 322 | $sth = $Connection->db->prepare($query); |
323 | 323 | $sth->execute(array(':source' => $database_file)); |
324 | - } catch(PDOException $e) { |
|
324 | + } catch (PDOException $e) { |
|
325 | 325 | return "error : ".$e->getMessage(); |
326 | 326 | } |
327 | 327 | return ''; |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | $Connection = new Connection(); |
336 | 336 | $sth = $Connection->db->prepare($query); |
337 | 337 | $sth->execute(array(':source' => $database_file)); |
338 | - } catch(PDOException $e) { |
|
338 | + } catch (PDOException $e) { |
|
339 | 339 | return "error : ".$e->getMessage(); |
340 | 340 | } |
341 | 341 | |
342 | - if ($fh = fopen($database_file,"r")) { |
|
342 | + if ($fh = fopen($database_file, "r")) { |
|
343 | 343 | //$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)'; |
344 | 344 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
345 | 345 | |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | $sth_dest = $Connection->db->prepare($query_dest); |
348 | 348 | try { |
349 | 349 | if ($globalTransaction) $Connection->db->beginTransaction(); |
350 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
350 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
351 | 351 | while (!feof($fh)) { |
352 | - $line = fgetcsv($fh,9999,',',"'"); |
|
352 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
353 | 353 | |
354 | 354 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
355 | 355 | //print_r($line); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $values['Registration'] = $line[3]; |
358 | 358 | $aircraft_name = $line[2]; |
359 | 359 | // Check if we can find ICAO, else set it to GLID |
360 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
360 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
361 | 361 | $search_more = ''; |
362 | 362 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
363 | 363 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -366,20 +366,20 @@ discard block |
||
366 | 366 | $sth_search->execute(); |
367 | 367 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
368 | 368 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
369 | - } catch(PDOException $e) { |
|
369 | + } catch (PDOException $e) { |
|
370 | 370 | return "error : ".$e->getMessage(); |
371 | 371 | } |
372 | 372 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
373 | 373 | // Add data to db |
374 | 374 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
375 | 375 | //$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']); |
376 | - $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'); |
|
376 | + $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'); |
|
377 | 377 | //print_r($query_dest_values); |
378 | 378 | $sth_dest->execute($query_dest_values); |
379 | 379 | } |
380 | 380 | } |
381 | 381 | if ($globalTransaction) $Connection->db->commit(); |
382 | - } catch(PDOException $e) { |
|
382 | + } catch (PDOException $e) { |
|
383 | 383 | return "error : ".$e->getMessage(); |
384 | 384 | } |
385 | 385 | } |
@@ -389,13 +389,13 @@ discard block |
||
389 | 389 | $Connection = new Connection(); |
390 | 390 | $sth = $Connection->db->prepare($query); |
391 | 391 | $sth->execute(array(':source' => $database_file)); |
392 | - } catch(PDOException $e) { |
|
392 | + } catch (PDOException $e) { |
|
393 | 393 | return "error : ".$e->getMessage(); |
394 | 394 | } |
395 | 395 | return ''; |
396 | 396 | } |
397 | 397 | |
398 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
398 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
399 | 399 | global $globalTransaction, $globalMasterSource; |
400 | 400 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
401 | 401 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -403,12 +403,12 @@ discard block |
||
403 | 403 | $Connection = new Connection(); |
404 | 404 | $sth = $Connection->db->prepare($query); |
405 | 405 | $sth->execute(array(':source' => $database_file)); |
406 | - } catch(PDOException $e) { |
|
406 | + } catch (PDOException $e) { |
|
407 | 407 | return "error : ".$e->getMessage(); |
408 | 408 | } |
409 | 409 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
410 | 410 | $Spotter = new Spotter(); |
411 | - if ($fh = fopen($database_file,"r")) { |
|
411 | + if ($fh = fopen($database_file, "r")) { |
|
412 | 412 | //$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)'; |
413 | 413 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
414 | 414 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -418,9 +418,9 @@ discard block |
||
418 | 418 | $sth_modes = $Connection->db->prepare($query_modes); |
419 | 419 | try { |
420 | 420 | if ($globalTransaction) $Connection->db->beginTransaction(); |
421 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
421 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
422 | 422 | while (!feof($fh)) { |
423 | - $line = fgetcsv($fh,9999,',','"'); |
|
423 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
424 | 424 | $values = array(); |
425 | 425 | //print_r($line); |
426 | 426 | if ($country == 'F') { |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $values['base'] = $line[4]; |
429 | 429 | $values['owner'] = $line[5]; |
430 | 430 | if ($line[6] == '') $values['date_first_reg'] = null; |
431 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
431 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
432 | 432 | $values['cancel'] = $line[7]; |
433 | 433 | } elseif ($country == 'EI') { |
434 | 434 | // TODO : add modeS & reg to aircraft_modes |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | $values['base'] = $line[3]; |
437 | 437 | $values['owner'] = $line[2]; |
438 | 438 | if ($line[1] == '') $values['date_first_reg'] = null; |
439 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
439 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
440 | 440 | $values['cancel'] = ''; |
441 | 441 | $values['modes'] = $line[7]; |
442 | 442 | $values['icao'] = $line[8]; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $values['base'] = null; |
457 | 457 | $values['owner'] = $line[5]; |
458 | 458 | if ($line[18] == '') $values['date_first_reg'] = null; |
459 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
459 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
460 | 460 | $values['cancel'] = ''; |
461 | 461 | } elseif ($country == 'VH') { |
462 | 462 | // TODO : add modeS & reg to aircraft_modes |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $values['base'] = null; |
465 | 465 | $values['owner'] = $line[12]; |
466 | 466 | if ($line[28] == '') $values['date_first_reg'] = null; |
467 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
467 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
468 | 468 | |
469 | 469 | $values['cancel'] = $line[39]; |
470 | 470 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -484,28 +484,28 @@ discard block |
||
484 | 484 | $values['base'] = null; |
485 | 485 | $values['owner'] = $line[8]; |
486 | 486 | if ($line[7] == '') $values['date_first_reg'] = null; |
487 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
487 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
488 | 488 | $values['cancel'] = ''; |
489 | 489 | } elseif ($country == 'PP') { |
490 | 490 | $values['registration'] = $line[0]; |
491 | 491 | $values['base'] = null; |
492 | 492 | $values['owner'] = $line[4]; |
493 | 493 | if ($line[6] == '') $values['date_first_reg'] = null; |
494 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
494 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
495 | 495 | $values['cancel'] = $line[7]; |
496 | 496 | } elseif ($country == 'E7') { |
497 | 497 | $values['registration'] = $line[0]; |
498 | 498 | $values['base'] = null; |
499 | 499 | $values['owner'] = $line[4]; |
500 | 500 | if ($line[5] == '') $values['date_first_reg'] = null; |
501 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
501 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
502 | 502 | $values['cancel'] = ''; |
503 | 503 | } elseif ($country == '8Q') { |
504 | 504 | $values['registration'] = $line[0]; |
505 | 505 | $values['base'] = null; |
506 | 506 | $values['owner'] = $line[3]; |
507 | 507 | if ($line[7] == '') $values['date_first_reg'] = null; |
508 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
508 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
509 | 509 | $values['cancel'] = ''; |
510 | 510 | } elseif ($country == 'ZK') { |
511 | 511 | $values['registration'] = $line[0]; |
@@ -519,18 +519,18 @@ discard block |
||
519 | 519 | $values['registration'] = $line[0]; |
520 | 520 | $values['base'] = null; |
521 | 521 | $values['owner'] = $line[6]; |
522 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
523 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
522 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
523 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
524 | 524 | $values['modes'] = $line[4]; |
525 | 525 | $values['icao'] = $line[10]; |
526 | 526 | } elseif ($country == 'OY') { |
527 | 527 | $values['registration'] = $line[0]; |
528 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
528 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
529 | 529 | $values['modes'] = $line[5]; |
530 | 530 | $values['icao'] = $line[6]; |
531 | 531 | } elseif ($country == 'PH') { |
532 | 532 | $values['registration'] = $line[0]; |
533 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
533 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
534 | 534 | $values['modes'] = $line[4]; |
535 | 535 | $values['icao'] = $line[5]; |
536 | 536 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -541,17 +541,17 @@ discard block |
||
541 | 541 | $values['cancel'] = ''; |
542 | 542 | } |
543 | 543 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
544 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
544 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
545 | 545 | $sth_dest->execute($query_dest_values); |
546 | 546 | } |
547 | 547 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
548 | 548 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
549 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
549 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
550 | 550 | $sth_modes->execute($query_modes_values); |
551 | 551 | } |
552 | 552 | } |
553 | 553 | if ($globalTransaction) $Connection->db->commit(); |
554 | - } catch(PDOException $e) { |
|
554 | + } catch (PDOException $e) { |
|
555 | 555 | return "error : ".$e->getMessage(); |
556 | 556 | } |
557 | 557 | } |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | $Connection = new Connection(); |
667 | 667 | $sth = $Connection->db->prepare($query); |
668 | 668 | $sth->execute(); |
669 | - } catch(PDOException $e) { |
|
669 | + } catch (PDOException $e) { |
|
670 | 670 | return "error : ".$e->getMessage(); |
671 | 671 | } |
672 | 672 | |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | $Connection = new Connection(); |
677 | 677 | $sth = $Connection->db->prepare($query); |
678 | 678 | $sth->execute(); |
679 | - } catch(PDOException $e) { |
|
679 | + } catch (PDOException $e) { |
|
680 | 680 | return "error : ".$e->getMessage(); |
681 | 681 | } |
682 | 682 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | if ($globalTransaction) $Connection->db->beginTransaction(); |
688 | 688 | |
689 | 689 | $i = 0; |
690 | - while($row = sparql_fetch_array($result)) |
|
690 | + while ($row = sparql_fetch_array($result)) |
|
691 | 691 | { |
692 | 692 | if ($i >= 1) { |
693 | 693 | //print_r($row); |
@@ -707,31 +707,31 @@ discard block |
||
707 | 707 | $row['image'] = ''; |
708 | 708 | $row['image_thumb'] = ''; |
709 | 709 | } else { |
710 | - $image = str_replace(' ','_',$row['image']); |
|
710 | + $image = str_replace(' ', '_', $row['image']); |
|
711 | 711 | $digest = md5($image); |
712 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
713 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
714 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
715 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
712 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
713 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
714 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
715 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
716 | 716 | } |
717 | 717 | |
718 | - $country = explode('-',$row['country']); |
|
718 | + $country = explode('-', $row['country']); |
|
719 | 719 | $row['country'] = $country[0]; |
720 | 720 | |
721 | 721 | $row['type'] = trim($row['type']); |
722 | - 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'])) { |
|
722 | + 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'])) { |
|
723 | 723 | $row['type'] = 'Military'; |
724 | 724 | } 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') { |
725 | 725 | $row['type'] = 'small_airport'; |
726 | 726 | } |
727 | 727 | |
728 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
729 | - $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $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']); |
|
728 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
729 | + $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => $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']); |
|
730 | 730 | //print_r($query_dest_values); |
731 | 731 | |
732 | 732 | try { |
733 | 733 | $sth_dest->execute($query_dest_values); |
734 | - } catch(PDOException $e) { |
|
734 | + } catch (PDOException $e) { |
|
735 | 735 | return "error : ".$e->getMessage(); |
736 | 736 | } |
737 | 737 | } |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | $Connection = new Connection(); |
746 | 746 | $sth = $Connection->db->prepare($query); |
747 | 747 | $sth->execute(); |
748 | - } catch(PDOException $e) { |
|
748 | + } catch (PDOException $e) { |
|
749 | 749 | return "error : ".$e->getMessage(); |
750 | 750 | } |
751 | 751 | |
@@ -753,12 +753,12 @@ discard block |
||
753 | 753 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
754 | 754 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
755 | 755 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
756 | - $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
|
756 | + $query_values = array(':airport_id' => $i, ':name' => 'Not available', ':iata' => 'NA', ':icao' => 'NA', ':latitude' => '0', ':longitude' => '0', ':altitude' => '0', ':type' => 'NA', ':city' => 'N/A', ':country' => 'N/A', ':home_link' => '', ':wikipedia_link' => '', ':image' => '', ':image_thumb' => ''); |
|
757 | 757 | try { |
758 | 758 | $Connection = new Connection(); |
759 | 759 | $sth = $Connection->db->prepare($query); |
760 | 760 | $sth->execute($query_values); |
761 | - } catch(PDOException $e) { |
|
761 | + } catch (PDOException $e) { |
|
762 | 762 | return "error : ".$e->getMessage(); |
763 | 763 | } |
764 | 764 | $i++; |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | echo "Download data from ourairports.com...\n"; |
777 | 777 | $delimiter = ','; |
778 | 778 | $out_file = $tmp_dir.'airports.csv'; |
779 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
779 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
780 | 780 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
781 | 781 | echo "Add data from ourairports.com...\n"; |
782 | 782 | |
@@ -787,32 +787,32 @@ discard block |
||
787 | 787 | //$Connection->db->beginTransaction(); |
788 | 788 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
789 | 789 | { |
790 | - if(!$header) $header = $row; |
|
790 | + if (!$header) $header = $row; |
|
791 | 791 | else { |
792 | 792 | $data = array(); |
793 | 793 | $data = array_combine($header, $row); |
794 | 794 | try { |
795 | 795 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao'); |
796 | 796 | $sth->execute(array(':icao' => $data['gps_code'])); |
797 | - } catch(PDOException $e) { |
|
797 | + } catch (PDOException $e) { |
|
798 | 798 | return "error : ".$e->getMessage(); |
799 | 799 | } |
800 | 800 | if ($sth->fetchColumn() > 0) { |
801 | 801 | $query = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
802 | 802 | try { |
803 | 803 | $sth = $Connection->db->prepare($query); |
804 | - $sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type'])); |
|
805 | - } catch(PDOException $e) { |
|
804 | + $sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type'])); |
|
805 | + } catch (PDOException $e) { |
|
806 | 806 | return "error : ".$e->getMessage(); |
807 | 807 | } |
808 | 808 | } else { |
809 | 809 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`) |
810 | 810 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
811 | - $query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
811 | + $query_values = array(':airport_id' => $i, ':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => $data['elevation_ft'], ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
812 | 812 | try { |
813 | 813 | $sth = $Connection->db->prepare($query); |
814 | 814 | $sth->execute($query_values); |
815 | - } catch(PDOException $e) { |
|
815 | + } catch (PDOException $e) { |
|
816 | 816 | return "error : ".$e->getMessage(); |
817 | 817 | } |
818 | 818 | $i++; |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | |
826 | 826 | echo "Download data from another free database...\n"; |
827 | 827 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
828 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
828 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
829 | 829 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
830 | 830 | update_db::unzip($out_file); |
831 | 831 | $header = NULL; |
@@ -837,15 +837,15 @@ discard block |
||
837 | 837 | //$Connection->db->beginTransaction(); |
838 | 838 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
839 | 839 | { |
840 | - if(!$header) $header = $row; |
|
840 | + if (!$header) $header = $row; |
|
841 | 841 | else { |
842 | 842 | $data = $row; |
843 | 843 | |
844 | 844 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
845 | 845 | try { |
846 | 846 | $sth = $Connection->db->prepare($query); |
847 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
848 | - } catch(PDOException $e) { |
|
847 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
848 | + } catch (PDOException $e) { |
|
849 | 849 | return "error : ".$e->getMessage(); |
850 | 850 | } |
851 | 851 | } |
@@ -859,15 +859,15 @@ discard block |
||
859 | 859 | try { |
860 | 860 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'"); |
861 | 861 | $sth->execute(); |
862 | - } catch(PDOException $e) { |
|
862 | + } catch (PDOException $e) { |
|
863 | 863 | return "error : ".$e->getMessage(); |
864 | 864 | } |
865 | 865 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
866 | 866 | $query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
867 | 867 | try { |
868 | 868 | $sth2 = $Connection->db->prepare($query2); |
869 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
870 | - } catch(PDOException $e) { |
|
869 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
870 | + } catch (PDOException $e) { |
|
871 | 871 | return "error : ".$e->getMessage(); |
872 | 872 | } |
873 | 873 | } |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | $Connection = new Connection(); |
892 | 892 | $sth = $Connection->db->prepare($query); |
893 | 893 | $sth->execute(array(':source' => 'translation.csv')); |
894 | - } catch(PDOException $e) { |
|
894 | + } catch (PDOException $e) { |
|
895 | 895 | return "error : ".$e->getMessage(); |
896 | 896 | } |
897 | 897 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
909 | 909 | { |
910 | 910 | $i++; |
911 | - if($i > 12) { |
|
911 | + if ($i > 12) { |
|
912 | 912 | $data = $row; |
913 | 913 | $operator = $data[2]; |
914 | 914 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | //echo substr($operator, 0, 2)."\n";; |
917 | 917 | if (count($airline_array) > 0) { |
918 | 918 | //print_r($airline_array); |
919 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
919 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
920 | 920 | } |
921 | 921 | } |
922 | 922 | |
@@ -924,14 +924,14 @@ discard block |
||
924 | 924 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
925 | 925 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
926 | 926 | if (count($airline_array) > 0) { |
927 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
927 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
931 | 931 | try { |
932 | 932 | $sth = $Connection->db->prepare($query); |
933 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
934 | - } catch(PDOException $e) { |
|
933 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
934 | + } catch (PDOException $e) { |
|
935 | 935 | return "error : ".$e->getMessage(); |
936 | 936 | } |
937 | 937 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | $Connection = new Connection(); |
952 | 952 | $sth = $Connection->db->prepare($query); |
953 | 953 | $sth->execute(array(':source' => 'website_fam')); |
954 | - } catch(PDOException $e) { |
|
954 | + } catch (PDOException $e) { |
|
955 | 955 | return "error : ".$e->getMessage(); |
956 | 956 | } |
957 | 957 | |
@@ -971,8 +971,8 @@ discard block |
||
971 | 971 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
972 | 972 | try { |
973 | 973 | $sth = $Connection->db->prepare($query); |
974 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
975 | - } catch(PDOException $e) { |
|
974 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
975 | + } catch (PDOException $e) { |
|
976 | 976 | return "error : ".$e->getMessage(); |
977 | 977 | } |
978 | 978 | } |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | $Connection = new Connection(); |
996 | 996 | $sth = $Connection->db->prepare($query); |
997 | 997 | $sth->execute(array(':source' => 'website_faa')); |
998 | - } catch(PDOException $e) { |
|
998 | + } catch (PDOException $e) { |
|
999 | 999 | return "error : ".$e->getMessage(); |
1000 | 1000 | } |
1001 | 1001 | |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | $Connection = new Connection(); |
1005 | 1005 | $sth = $Connection->db->prepare($query); |
1006 | 1006 | $sth->execute(array(':source' => 'website_faa')); |
1007 | - } catch(PDOException $e) { |
|
1007 | + } catch (PDOException $e) { |
|
1008 | 1008 | return "error : ".$e->getMessage(); |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1021,8 +1021,8 @@ discard block |
||
1021 | 1021 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
1022 | 1022 | try { |
1023 | 1023 | $sths = $Connection->db->prepare($query_search); |
1024 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
1025 | - } catch(PDOException $e) { |
|
1024 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
1025 | + } catch (PDOException $e) { |
|
1026 | 1026 | return "error s : ".$e->getMessage(); |
1027 | 1027 | } |
1028 | 1028 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | //} |
1036 | 1036 | try { |
1037 | 1037 | $sthi = $Connection->db->prepare($queryi); |
1038 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1039 | - } catch(PDOException $e) { |
|
1038 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1039 | + } catch (PDOException $e) { |
|
1040 | 1040 | return "error u : ".$e->getMessage(); |
1041 | 1041 | } |
1042 | 1042 | } else { |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | try { |
1045 | 1045 | $sthsm = $Connection->db->prepare($query_search_mfr); |
1046 | 1046 | $sthsm->execute(array(':mfr' => $data[2])); |
1047 | - } catch(PDOException $e) { |
|
1047 | + } catch (PDOException $e) { |
|
1048 | 1048 | return "error mfr : ".$e->getMessage(); |
1049 | 1049 | } |
1050 | 1050 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1054,8 +1054,8 @@ discard block |
||
1054 | 1054 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1055 | 1055 | try { |
1056 | 1056 | $sthf = $Connection->db->prepare($queryf); |
1057 | - $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')); |
|
1058 | - } catch(PDOException $e) { |
|
1057 | + $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')); |
|
1058 | + } catch (PDOException $e) { |
|
1059 | 1059 | return "error f : ".$e->getMessage(); |
1060 | 1060 | } |
1061 | 1061 | } |
@@ -1065,13 +1065,13 @@ discard block |
||
1065 | 1065 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1066 | 1066 | try { |
1067 | 1067 | $sth = $Connection->db->prepare($query); |
1068 | - $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')); |
|
1069 | - } catch(PDOException $e) { |
|
1068 | + $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')); |
|
1069 | + } catch (PDOException $e) { |
|
1070 | 1070 | return "error i : ".$e->getMessage(); |
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | } |
1074 | - if ($i % 90 == 0) { |
|
1074 | + if ($i%90 == 0) { |
|
1075 | 1075 | if ($globalTransaction) $Connection->db->commit(); |
1076 | 1076 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1077 | 1077 | } |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | $Connection = new Connection(); |
1091 | 1091 | $sth = $Connection->db->prepare($query); |
1092 | 1092 | $sth->execute(array(':source' => 'website_fam')); |
1093 | - } catch(PDOException $e) { |
|
1093 | + } catch (PDOException $e) { |
|
1094 | 1094 | return "error : ".$e->getMessage(); |
1095 | 1095 | } |
1096 | 1096 | |
@@ -1111,8 +1111,8 @@ discard block |
||
1111 | 1111 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1112 | 1112 | try { |
1113 | 1113 | $sth = $Connection->db->prepare($query); |
1114 | - $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')); |
|
1115 | - } catch(PDOException $e) { |
|
1114 | + $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')); |
|
1115 | + } catch (PDOException $e) { |
|
1116 | 1116 | return "error : ".$e->getMessage(); |
1117 | 1117 | } |
1118 | 1118 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | $Connection = new Connection(); |
1132 | 1132 | $sth = $Connection->db->prepare($query); |
1133 | 1133 | $sth->execute(array(':source' => 'website_fam')); |
1134 | - } catch(PDOException $e) { |
|
1134 | + } catch (PDOException $e) { |
|
1135 | 1135 | return "error : ".$e->getMessage(); |
1136 | 1136 | } |
1137 | 1137 | |
@@ -1147,8 +1147,8 @@ discard block |
||
1147 | 1147 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1148 | 1148 | try { |
1149 | 1149 | $sth = $Connection->db->prepare($query); |
1150 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1151 | - } catch(PDOException $e) { |
|
1150 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1151 | + } catch (PDOException $e) { |
|
1152 | 1152 | print_r($data); |
1153 | 1153 | return "error : ".$e->getMessage(); |
1154 | 1154 | } |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | $Connection = new Connection(); |
1169 | 1169 | $sth = $Connection->db->prepare($query); |
1170 | 1170 | $sth->execute(array(':source' => 'website_fam')); |
1171 | - } catch(PDOException $e) { |
|
1171 | + } catch (PDOException $e) { |
|
1172 | 1172 | return "error : ".$e->getMessage(); |
1173 | 1173 | } |
1174 | 1174 | |
@@ -1188,8 +1188,8 @@ discard block |
||
1188 | 1188 | $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)'; |
1189 | 1189 | try { |
1190 | 1190 | $sth = $Connection->db->prepare($query); |
1191 | - $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')); |
|
1192 | - } catch(PDOException $e) { |
|
1191 | + $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')); |
|
1192 | + } catch (PDOException $e) { |
|
1193 | 1193 | return "error : ".$e->getMessage(); |
1194 | 1194 | } |
1195 | 1195 | } |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | $Connection = new Connection(); |
1209 | 1209 | $sth = $Connection->db->prepare($query); |
1210 | 1210 | $sth->execute(); |
1211 | - } catch(PDOException $e) { |
|
1211 | + } catch (PDOException $e) { |
|
1212 | 1212 | return "error : ".$e->getMessage(); |
1213 | 1213 | } |
1214 | 1214 | |
@@ -1228,8 +1228,8 @@ discard block |
||
1228 | 1228 | $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)'; |
1229 | 1229 | try { |
1230 | 1230 | $sth = $Connection->db->prepare($query); |
1231 | - $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])); |
|
1232 | - } catch(PDOException $e) { |
|
1231 | + $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])); |
|
1232 | + } catch (PDOException $e) { |
|
1233 | 1233 | return "error : ".$e->getMessage(); |
1234 | 1234 | } |
1235 | 1235 | } |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | $Connection = new Connection(); |
1249 | 1249 | $sth = $Connection->db->prepare($query); |
1250 | 1250 | $sth->execute(); |
1251 | - } catch(PDOException $e) { |
|
1251 | + } catch (PDOException $e) { |
|
1252 | 1252 | return "error : ".$e->getMessage(); |
1253 | 1253 | } |
1254 | 1254 | |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | try { |
1265 | 1265 | $sth = $Connection->db->prepare($query); |
1266 | 1266 | $sth->execute(array(':icao' => $icao)); |
1267 | - } catch(PDOException $e) { |
|
1267 | + } catch (PDOException $e) { |
|
1268 | 1268 | return "error : ".$e->getMessage(); |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | return ''; |
1276 | 1276 | } |
1277 | 1277 | |
1278 | - public static function tle($filename,$tletype) { |
|
1278 | + public static function tle($filename, $tletype) { |
|
1279 | 1279 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1280 | 1280 | global $tmp_dir, $globalTransaction; |
1281 | 1281 | //$Spotter = new Spotter(); |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | $Connection = new Connection(); |
1286 | 1286 | $sth = $Connection->db->prepare($query); |
1287 | 1287 | $sth->execute(array(':source' => $filename)); |
1288 | - } catch(PDOException $e) { |
|
1288 | + } catch (PDOException $e) { |
|
1289 | 1289 | return "error : ".$e->getMessage(); |
1290 | 1290 | } |
1291 | 1291 | |
@@ -1310,8 +1310,8 @@ discard block |
||
1310 | 1310 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1311 | 1311 | try { |
1312 | 1312 | $sth = $Connection->db->prepare($query); |
1313 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1314 | - } catch(PDOException $e) { |
|
1313 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1314 | + } catch (PDOException $e) { |
|
1315 | 1315 | return "error : ".$e->getMessage(); |
1316 | 1316 | } |
1317 | 1317 | |
@@ -1331,28 +1331,28 @@ discard block |
||
1331 | 1331 | */ |
1332 | 1332 | private static function table2array($data) { |
1333 | 1333 | $html = str_get_html($data); |
1334 | - $tabledata=array(); |
|
1335 | - foreach($html->find('tr') as $element) |
|
1334 | + $tabledata = array(); |
|
1335 | + foreach ($html->find('tr') as $element) |
|
1336 | 1336 | { |
1337 | 1337 | $td = array(); |
1338 | - foreach( $element->find('th') as $row) |
|
1338 | + foreach ($element->find('th') as $row) |
|
1339 | 1339 | { |
1340 | 1340 | $td [] = trim($row->plaintext); |
1341 | 1341 | } |
1342 | - $td=array_filter($td); |
|
1342 | + $td = array_filter($td); |
|
1343 | 1343 | $tabledata[] = $td; |
1344 | 1344 | |
1345 | 1345 | $td = array(); |
1346 | 1346 | $tdi = array(); |
1347 | - foreach( $element->find('td') as $row) |
|
1347 | + foreach ($element->find('td') as $row) |
|
1348 | 1348 | { |
1349 | 1349 | $td [] = trim($row->plaintext); |
1350 | 1350 | $tdi [] = trim($row->innertext); |
1351 | 1351 | } |
1352 | - $td=array_filter($td); |
|
1353 | - $tdi=array_filter($tdi); |
|
1352 | + $td = array_filter($td); |
|
1353 | + $tdi = array_filter($tdi); |
|
1354 | 1354 | // $tabledata[]=array_merge($td,$tdi); |
1355 | - $tabledata[]=$td; |
|
1355 | + $tabledata[] = $td; |
|
1356 | 1356 | } |
1357 | 1357 | return(array_filter($tabledata)); |
1358 | 1358 | } |
@@ -1425,13 +1425,13 @@ discard block |
||
1425 | 1425 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1426 | 1426 | { |
1427 | 1427 | $i++; |
1428 | - if($i > 3 && count($row) > 2) { |
|
1428 | + if ($i > 3 && count($row) > 2) { |
|
1429 | 1429 | $data = array_values(array_filter($row)); |
1430 | 1430 | $cntdata = count($data); |
1431 | 1431 | if ($cntdata > 10) { |
1432 | 1432 | $value = $data[9]; |
1433 | 1433 | |
1434 | - for ($i =10;$i < $cntdata;$i++) { |
|
1434 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1435 | 1435 | $value .= ' '.$data[$i]; |
1436 | 1436 | } |
1437 | 1437 | $data[9] = $value; |
@@ -1441,8 +1441,8 @@ discard block |
||
1441 | 1441 | $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)'; |
1442 | 1442 | try { |
1443 | 1443 | $sth = $Connection->db->prepare($query); |
1444 | - $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])); |
|
1445 | - } catch(PDOException $e) { |
|
1444 | + $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])); |
|
1445 | + } catch (PDOException $e) { |
|
1446 | 1446 | return "error : ".$e->getMessage(); |
1447 | 1447 | } |
1448 | 1448 | } |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | $Connection = new Connection(); |
1464 | 1464 | $sth = $Connection->db->prepare($query); |
1465 | 1465 | $sth->execute(); |
1466 | - } catch(PDOException $e) { |
|
1466 | + } catch (PDOException $e) { |
|
1467 | 1467 | return "error : ".$e->getMessage(); |
1468 | 1468 | } |
1469 | 1469 | |
@@ -1475,12 +1475,12 @@ discard block |
||
1475 | 1475 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1476 | 1476 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1477 | 1477 | { |
1478 | - if(count($row) > 1) { |
|
1478 | + if (count($row) > 1) { |
|
1479 | 1479 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1480 | 1480 | try { |
1481 | 1481 | $sth = $Connection->db->prepare($query); |
1482 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1483 | - } catch(PDOException $e) { |
|
1482 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1483 | + } catch (PDOException $e) { |
|
1484 | 1484 | return "error : ".$e->getMessage(); |
1485 | 1485 | } |
1486 | 1486 | } |
@@ -1500,21 +1500,21 @@ discard block |
||
1500 | 1500 | try { |
1501 | 1501 | $sth = $Connection->db->prepare($query); |
1502 | 1502 | $sth->execute(); |
1503 | - } catch(PDOException $e) { |
|
1503 | + } catch (PDOException $e) { |
|
1504 | 1504 | return "error : ".$e->getMessage(); |
1505 | 1505 | } |
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | |
1509 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1509 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1510 | 1510 | else { |
1511 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1511 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1512 | 1512 | $query = "CREATE EXTENSION postgis"; |
1513 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1513 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1514 | 1514 | try { |
1515 | 1515 | $sth = $Connection->db->prepare($query); |
1516 | 1516 | $sth->execute(); |
1517 | - } catch(PDOException $e) { |
|
1517 | + } catch (PDOException $e) { |
|
1518 | 1518 | return "error : ".$e->getMessage(); |
1519 | 1519 | } |
1520 | 1520 | } |
@@ -1527,7 +1527,7 @@ discard block |
||
1527 | 1527 | include_once('class.create_db.php'); |
1528 | 1528 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1529 | 1529 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
1530 | - update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
1530 | + update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1531 | 1531 | $error = ''; |
1532 | 1532 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1533 | 1533 | if ($globalDebug) echo "Gunzip..."; |
@@ -1559,14 +1559,14 @@ discard block |
||
1559 | 1559 | try { |
1560 | 1560 | $sth = $Connection->db->prepare($query); |
1561 | 1561 | $sth->execute(); |
1562 | - } catch(PDOException $e) { |
|
1562 | + } catch (PDOException $e) { |
|
1563 | 1563 | echo "error : ".$e->getMessage(); |
1564 | 1564 | } |
1565 | 1565 | } |
1566 | 1566 | if ($globalDBdriver == 'mysql') { |
1567 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1567 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1568 | 1568 | } else { |
1569 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1569 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1570 | 1570 | } |
1571 | 1571 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
1572 | 1572 | return $error; |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
1580 | 1580 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
1581 | 1581 | // 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'); |
1582 | - 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'); |
|
1582 | + 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'); |
|
1583 | 1583 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
1584 | 1584 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
1585 | 1585 | return $error; |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1600 | 1600 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
1601 | 1601 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1602 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1602 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1603 | 1603 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
1604 | 1604 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
1605 | 1605 | if ($error != '') { |
@@ -1612,7 +1612,7 @@ discard block |
||
1612 | 1612 | global $tmp_dir, $globalDebug; |
1613 | 1613 | $error = ''; |
1614 | 1614 | if ($globalDebug) echo "Routes : Download..."; |
1615 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
1615 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1616 | 1616 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1617 | 1617 | if ($globalDebug) echo "Gunzip..."; |
1618 | 1618 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | global $tmp_dir, $globalDebug; |
1629 | 1629 | $error = ''; |
1630 | 1630 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
1631 | - update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
1631 | + update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1632 | 1632 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1633 | 1633 | if ($globalDebug) echo "Gunzip..."; |
1634 | 1634 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | global $tmp_dir, $globalDebug; |
1645 | 1645 | $error = ''; |
1646 | 1646 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
1647 | - update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
1647 | + update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1648 | 1648 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1649 | 1649 | if ($globalDebug) echo "Gunzip..."; |
1650 | 1650 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -1672,7 +1672,7 @@ discard block |
||
1672 | 1672 | */ |
1673 | 1673 | if ($globalDebug) echo "Modes : Download..."; |
1674 | 1674 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
1675 | - update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
1675 | + update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
1676 | 1676 | |
1677 | 1677 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
1678 | 1678 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -1692,7 +1692,7 @@ discard block |
||
1692 | 1692 | public static function update_ModeS_faa() { |
1693 | 1693 | global $tmp_dir, $globalDebug; |
1694 | 1694 | if ($globalDebug) echo "Modes FAA: Download..."; |
1695 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
1695 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
1696 | 1696 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
1697 | 1697 | if ($globalDebug) echo "Unzip..."; |
1698 | 1698 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | public static function update_ModeS_flarm() { |
1709 | 1709 | global $tmp_dir, $globalDebug; |
1710 | 1710 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
1711 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
1711 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
1712 | 1712 | if (file_exists($tmp_dir.'data.fln')) { |
1713 | 1713 | if ($globalDebug) echo "Add to DB..."; |
1714 | 1714 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -1722,7 +1722,7 @@ discard block |
||
1722 | 1722 | public static function update_ModeS_ogn() { |
1723 | 1723 | global $tmp_dir, $globalDebug; |
1724 | 1724 | if ($globalDebug) echo "Modes OGN: Download..."; |
1725 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
1725 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
1726 | 1726 | if (file_exists($tmp_dir.'ogn.csv')) { |
1727 | 1727 | if ($globalDebug) echo "Add to DB..."; |
1728 | 1728 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -1737,201 +1737,201 @@ discard block |
||
1737 | 1737 | global $tmp_dir, $globalDebug, $globalMasterSource; |
1738 | 1738 | |
1739 | 1739 | if ($globalDebug) echo "Owner France: Download..."; |
1740 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
1740 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
1741 | 1741 | if (file_exists($tmp_dir.'owner_f.csv')) { |
1742 | 1742 | if ($globalDebug) echo "Add to DB..."; |
1743 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
1743 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
1744 | 1744 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
1745 | 1745 | if ($error != '') { |
1746 | 1746 | return $error; |
1747 | 1747 | } elseif ($globalDebug) echo "Done\n"; |
1748 | 1748 | |
1749 | 1749 | if ($globalDebug) echo "Owner Ireland: Download..."; |
1750 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
1750 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
1751 | 1751 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
1752 | 1752 | if ($globalDebug) echo "Add to DB..."; |
1753 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
1753 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
1754 | 1754 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
1755 | 1755 | if ($error != '') { |
1756 | 1756 | return $error; |
1757 | 1757 | } elseif ($globalDebug) echo "Done\n"; |
1758 | 1758 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
1759 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
1759 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
1760 | 1760 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
1761 | 1761 | if ($globalDebug) echo "Add to DB..."; |
1762 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
1762 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
1763 | 1763 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
1764 | 1764 | if ($error != '') { |
1765 | 1765 | return $error; |
1766 | 1766 | } elseif ($globalDebug) echo "Done\n"; |
1767 | 1767 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
1768 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
1768 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
1769 | 1769 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
1770 | 1770 | if ($globalDebug) echo "Add to DB..."; |
1771 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
1771 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
1772 | 1772 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
1773 | 1773 | if ($error != '') { |
1774 | 1774 | return $error; |
1775 | 1775 | } elseif ($globalDebug) echo "Done\n"; |
1776 | 1776 | if ($globalDebug) echo "Owner Australia: Download..."; |
1777 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
1777 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
1778 | 1778 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
1779 | 1779 | if ($globalDebug) echo "Add to DB..."; |
1780 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
1780 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
1781 | 1781 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
1782 | 1782 | if ($error != '') { |
1783 | 1783 | return $error; |
1784 | 1784 | } elseif ($globalDebug) echo "Done\n"; |
1785 | 1785 | if ($globalDebug) echo "Owner Austria: Download..."; |
1786 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
1786 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
1787 | 1787 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
1788 | 1788 | if ($globalDebug) echo "Add to DB..."; |
1789 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
1789 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
1790 | 1790 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
1791 | 1791 | if ($error != '') { |
1792 | 1792 | return $error; |
1793 | 1793 | } elseif ($globalDebug) echo "Done\n"; |
1794 | 1794 | if ($globalDebug) echo "Owner Chile: Download..."; |
1795 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
1795 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
1796 | 1796 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
1797 | 1797 | if ($globalDebug) echo "Add to DB..."; |
1798 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
1798 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
1799 | 1799 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
1800 | 1800 | if ($error != '') { |
1801 | 1801 | return $error; |
1802 | 1802 | } elseif ($globalDebug) echo "Done\n"; |
1803 | 1803 | if ($globalDebug) echo "Owner Colombia: Download..."; |
1804 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
1804 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
1805 | 1805 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
1806 | 1806 | if ($globalDebug) echo "Add to DB..."; |
1807 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
1807 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
1808 | 1808 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
1809 | 1809 | if ($error != '') { |
1810 | 1810 | return $error; |
1811 | 1811 | } elseif ($globalDebug) echo "Done\n"; |
1812 | 1812 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
1813 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
1813 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
1814 | 1814 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
1815 | 1815 | if ($globalDebug) echo "Add to DB..."; |
1816 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
1816 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
1817 | 1817 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
1818 | 1818 | if ($error != '') { |
1819 | 1819 | return $error; |
1820 | 1820 | } elseif ($globalDebug) echo "Done\n"; |
1821 | 1821 | if ($globalDebug) echo "Owner Brazil: Download..."; |
1822 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
1822 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
1823 | 1823 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
1824 | 1824 | if ($globalDebug) echo "Add to DB..."; |
1825 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
1825 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
1826 | 1826 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
1827 | 1827 | if ($error != '') { |
1828 | 1828 | return $error; |
1829 | 1829 | } elseif ($globalDebug) echo "Done\n"; |
1830 | 1830 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
1831 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
1831 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
1832 | 1832 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
1833 | 1833 | if ($globalDebug) echo "Add to DB..."; |
1834 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
1834 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
1835 | 1835 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
1836 | 1836 | if ($error != '') { |
1837 | 1837 | return $error; |
1838 | 1838 | } elseif ($globalDebug) echo "Done\n"; |
1839 | 1839 | if ($globalDebug) echo "Owner Croatia: Download..."; |
1840 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
1840 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
1841 | 1841 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
1842 | 1842 | if ($globalDebug) echo "Add to DB..."; |
1843 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
1843 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
1844 | 1844 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
1845 | 1845 | if ($error != '') { |
1846 | 1846 | return $error; |
1847 | 1847 | } elseif ($globalDebug) echo "Done\n"; |
1848 | 1848 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
1849 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
1849 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
1850 | 1850 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
1851 | 1851 | if ($globalDebug) echo "Add to DB..."; |
1852 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
1852 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
1853 | 1853 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
1854 | 1854 | if ($error != '') { |
1855 | 1855 | return $error; |
1856 | 1856 | } elseif ($globalDebug) echo "Done\n"; |
1857 | 1857 | if ($globalDebug) echo "Owner Maldives: Download..."; |
1858 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
1858 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
1859 | 1859 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
1860 | 1860 | if ($globalDebug) echo "Add to DB..."; |
1861 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
1861 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
1862 | 1862 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
1863 | 1863 | if ($error != '') { |
1864 | 1864 | return $error; |
1865 | 1865 | } elseif ($globalDebug) echo "Done\n"; |
1866 | 1866 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
1867 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
1867 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
1868 | 1868 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
1869 | 1869 | if ($globalDebug) echo "Add to DB..."; |
1870 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
1870 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
1871 | 1871 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
1872 | 1872 | if ($error != '') { |
1873 | 1873 | return $error; |
1874 | 1874 | } elseif ($globalDebug) echo "Done\n"; |
1875 | 1875 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
1876 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
1876 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
1877 | 1877 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
1878 | 1878 | if ($globalDebug) echo "Add to DB..."; |
1879 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
1879 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
1880 | 1880 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
1881 | 1881 | if ($error != '') { |
1882 | 1882 | return $error; |
1883 | 1883 | } elseif ($globalDebug) echo "Done\n"; |
1884 | 1884 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
1885 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
1885 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
1886 | 1886 | if (file_exists($tmp_dir.'owner_om.csv')) { |
1887 | 1887 | if ($globalDebug) echo "Add to DB..."; |
1888 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
1888 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
1889 | 1889 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
1890 | 1890 | if ($error != '') { |
1891 | 1891 | return $error; |
1892 | 1892 | } elseif ($globalDebug) echo "Done\n"; |
1893 | 1893 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
1894 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
1894 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
1895 | 1895 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
1896 | 1896 | if ($globalDebug) echo "Add to DB..."; |
1897 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
1897 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
1898 | 1898 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
1899 | 1899 | if ($error != '') { |
1900 | 1900 | return $error; |
1901 | 1901 | } elseif ($globalDebug) echo "Done\n"; |
1902 | 1902 | if ($globalDebug) echo "Owner Iceland: Download..."; |
1903 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
1903 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
1904 | 1904 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
1905 | 1905 | if ($globalDebug) echo "Add to DB..."; |
1906 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
1906 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
1907 | 1907 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
1908 | 1908 | if ($error != '') { |
1909 | 1909 | return $error; |
1910 | 1910 | } elseif ($globalDebug) echo "Done\n"; |
1911 | 1911 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
1912 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
1912 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
1913 | 1913 | if (file_exists($tmp_dir.'owner_m.csv')) { |
1914 | 1914 | if ($globalDebug) echo "Add to DB..."; |
1915 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
1915 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
1916 | 1916 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
1917 | 1917 | if ($error != '') { |
1918 | 1918 | return $error; |
1919 | 1919 | } elseif ($globalDebug) echo "Done\n"; |
1920 | 1920 | if ($globalMasterSource) { |
1921 | 1921 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
1922 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
1922 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
1923 | 1923 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
1924 | 1924 | if ($globalDebug) echo "Add to DB..."; |
1925 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
1925 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
1926 | 1926 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
1927 | 1927 | if ($error != '') { |
1928 | 1928 | return $error; |
1929 | 1929 | } elseif ($globalDebug) echo "Done\n"; |
1930 | 1930 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
1931 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
1931 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
1932 | 1932 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
1933 | 1933 | if ($globalDebug) echo "Add to DB..."; |
1934 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
1934 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
1935 | 1935 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
1936 | 1936 | if ($error != '') { |
1937 | 1937 | return $error; |
@@ -1944,7 +1944,7 @@ discard block |
||
1944 | 1944 | global $tmp_dir, $globalDebug; |
1945 | 1945 | $error = ''; |
1946 | 1946 | if ($globalDebug) echo "Translation : Download..."; |
1947 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
1947 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
1948 | 1948 | if (file_exists($tmp_dir.'translation.zip')) { |
1949 | 1949 | if ($globalDebug) echo "Unzip..."; |
1950 | 1950 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -1960,7 +1960,7 @@ discard block |
||
1960 | 1960 | public static function update_translation_fam() { |
1961 | 1961 | global $tmp_dir, $globalDebug; |
1962 | 1962 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
1963 | - update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
1963 | + update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
1964 | 1964 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
1965 | 1965 | if ($globalDebug) echo "Gunzip..."; |
1966 | 1966 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -1975,7 +1975,7 @@ discard block |
||
1975 | 1975 | public static function update_ModeS_fam() { |
1976 | 1976 | global $tmp_dir, $globalDebug; |
1977 | 1977 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
1978 | - update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
1978 | + update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
1979 | 1979 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
1980 | 1980 | if ($globalDebug) echo "Gunzip..."; |
1981 | 1981 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
@@ -1991,9 +1991,9 @@ discard block |
||
1991 | 1991 | global $tmp_dir, $globalDebug, $globalOwner; |
1992 | 1992 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
1993 | 1993 | if ($globalOwner === TRUE) { |
1994 | - update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
1994 | + update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1995 | 1995 | } else { |
1996 | - update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
1996 | + update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1997 | 1997 | } |
1998 | 1998 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
1999 | 1999 | if ($globalDebug) echo "Gunzip..."; |
@@ -2009,7 +2009,7 @@ discard block |
||
2009 | 2009 | public static function update_routes_fam() { |
2010 | 2010 | global $tmp_dir, $globalDebug; |
2011 | 2011 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2012 | - update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
2012 | + update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2013 | 2013 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2014 | 2014 | if ($globalDebug) echo "Gunzip..."; |
2015 | 2015 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
@@ -2023,13 +2023,13 @@ discard block |
||
2023 | 2023 | } |
2024 | 2024 | public static function update_marine_identity_fam() { |
2025 | 2025 | global $tmp_dir, $globalDebug; |
2026 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2026 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2027 | 2027 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2028 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2028 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2029 | 2029 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2030 | 2030 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2031 | 2031 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2032 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2032 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2033 | 2033 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2034 | 2034 | if ($globalDebug) echo "Gunzip..."; |
2035 | 2035 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
@@ -2049,7 +2049,7 @@ discard block |
||
2049 | 2049 | public static function update_banned_fam() { |
2050 | 2050 | global $tmp_dir, $globalDebug; |
2051 | 2051 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2052 | - update_db::download('http://data.flightairmap.fr/data/ban_eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2052 | + update_db::download('http://data.flightairmap.fr/data/ban_eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2053 | 2053 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2054 | 2054 | //if ($globalDebug) echo "Gunzip..."; |
2055 | 2055 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2068,18 +2068,18 @@ discard block |
||
2068 | 2068 | $error = ''; |
2069 | 2069 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2070 | 2070 | if ($globalDBdriver == 'mysql') { |
2071 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2071 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2072 | 2072 | } else { |
2073 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2073 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2074 | 2074 | } |
2075 | 2075 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2076 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2076 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2077 | 2077 | $airspace_md5 = $airspace_md5_file[0]; |
2078 | 2078 | if (!update_db::check_airspace_version($airspace_md5)) { |
2079 | 2079 | if ($globalDBdriver == 'mysql') { |
2080 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2080 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2081 | 2081 | } else { |
2082 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2082 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2083 | 2083 | } |
2084 | 2084 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2085 | 2085 | if ($globalDebug) echo "Gunzip..."; |
@@ -2091,7 +2091,7 @@ discard block |
||
2091 | 2091 | try { |
2092 | 2092 | $sth = $Connection->db->prepare($query); |
2093 | 2093 | $sth->execute(); |
2094 | - } catch(PDOException $e) { |
|
2094 | + } catch (PDOException $e) { |
|
2095 | 2095 | return "error : ".$e->getMessage(); |
2096 | 2096 | } |
2097 | 2097 | } |
@@ -2109,15 +2109,15 @@ discard block |
||
2109 | 2109 | public static function update_tle() { |
2110 | 2110 | global $tmp_dir, $globalDebug; |
2111 | 2111 | if ($globalDebug) echo "Download TLE : Download..."; |
2112 | - $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', |
|
2113 | - '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', |
|
2114 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
|
2112 | + $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', |
|
2113 | + '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', |
|
2114 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt'); |
|
2115 | 2115 | foreach ($alltle as $filename) { |
2116 | 2116 | if ($globalDebug) echo "downloading ".$filename.'...'; |
2117 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2117 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2118 | 2118 | if (file_exists($tmp_dir.$filename)) { |
2119 | 2119 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
2120 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2120 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2121 | 2121 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2122 | 2122 | if ($error != '') { |
2123 | 2123 | echo $error."\n"; |
@@ -2130,32 +2130,32 @@ discard block |
||
2130 | 2130 | global $tmp_dir, $globalDebug; |
2131 | 2131 | $error = ''; |
2132 | 2132 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
2133 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2133 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2134 | 2134 | if (file_exists($tmp_dir.'models.md5sum')) { |
2135 | 2135 | if ($globalDebug) echo "Check files...\n"; |
2136 | 2136 | $newmodelsdb = array(); |
2137 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2138 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2137 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2138 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2139 | 2139 | $model = trim($row[2]); |
2140 | 2140 | $newmodelsdb[$model] = trim($row[0]); |
2141 | 2141 | } |
2142 | 2142 | } |
2143 | 2143 | $modelsdb = array(); |
2144 | 2144 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2145 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2146 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2145 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2146 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2147 | 2147 | $model = trim($row[2]); |
2148 | 2148 | $modelsdb[$model] = trim($row[0]); |
2149 | 2149 | } |
2150 | 2150 | } |
2151 | 2151 | } |
2152 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2152 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2153 | 2153 | foreach ($diff as $key => $value) { |
2154 | 2154 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2155 | - update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2155 | + update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2156 | 2156 | |
2157 | 2157 | } |
2158 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2158 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2159 | 2159 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2160 | 2160 | if ($error != '') { |
2161 | 2161 | return $error; |
@@ -2167,32 +2167,32 @@ discard block |
||
2167 | 2167 | global $tmp_dir, $globalDebug; |
2168 | 2168 | $error = ''; |
2169 | 2169 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
2170 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
2170 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2171 | 2171 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2172 | 2172 | if ($globalDebug) echo "Check files...\n"; |
2173 | 2173 | $newmodelsdb = array(); |
2174 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2175 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2174 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
2175 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2176 | 2176 | $model = trim($row[2]); |
2177 | 2177 | $newmodelsdb[$model] = trim($row[0]); |
2178 | 2178 | } |
2179 | 2179 | } |
2180 | 2180 | $modelsdb = array(); |
2181 | 2181 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
2182 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2183 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2182 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2183 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2184 | 2184 | $model = trim($row[2]); |
2185 | 2185 | $modelsdb[$model] = trim($row[0]); |
2186 | 2186 | } |
2187 | 2187 | } |
2188 | 2188 | } |
2189 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2189 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2190 | 2190 | foreach ($diff as $key => $value) { |
2191 | 2191 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2192 | - update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2192 | + update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2193 | 2193 | |
2194 | 2194 | } |
2195 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2195 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2196 | 2196 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2197 | 2197 | if ($error != '') { |
2198 | 2198 | return $error; |
@@ -2204,32 +2204,32 @@ discard block |
||
2204 | 2204 | global $tmp_dir, $globalDebug; |
2205 | 2205 | $error = ''; |
2206 | 2206 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
2207 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
2207 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2208 | 2208 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2209 | 2209 | if ($globalDebug) echo "Check files...\n"; |
2210 | 2210 | $newmodelsdb = array(); |
2211 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2212 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2211 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2212 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2213 | 2213 | $model = trim($row[2]); |
2214 | 2214 | $newmodelsdb[$model] = trim($row[0]); |
2215 | 2215 | } |
2216 | 2216 | } |
2217 | 2217 | $modelsdb = array(); |
2218 | 2218 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
2219 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2220 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2219 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2220 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2221 | 2221 | $model = trim($row[2]); |
2222 | 2222 | $modelsdb[$model] = trim($row[0]); |
2223 | 2223 | } |
2224 | 2224 | } |
2225 | 2225 | } |
2226 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2226 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2227 | 2227 | foreach ($diff as $key => $value) { |
2228 | 2228 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
2229 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2229 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2230 | 2230 | |
2231 | 2231 | } |
2232 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2232 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2233 | 2233 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2234 | 2234 | if ($error != '') { |
2235 | 2235 | return $error; |
@@ -2252,8 +2252,8 @@ discard block |
||
2252 | 2252 | */ |
2253 | 2253 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2254 | 2254 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
2255 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2256 | - $result = fread($fh,100000000); |
|
2255 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
2256 | + $result = fread($fh, 100000000); |
|
2257 | 2257 | //echo $result; |
2258 | 2258 | //var_dump(str_get_html($result)); |
2259 | 2259 | //print_r(self::table2array($result)); |
@@ -2271,23 +2271,23 @@ discard block |
||
2271 | 2271 | $Connection = new Connection(); |
2272 | 2272 | $sth = $Connection->db->prepare($query); |
2273 | 2273 | $sth->execute(); |
2274 | - } catch(PDOException $e) { |
|
2274 | + } catch (PDOException $e) { |
|
2275 | 2275 | return "error : ".$e->getMessage(); |
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | $error = ''; |
2279 | 2279 | if ($globalDebug) echo "Notam : Download..."; |
2280 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
2280 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2281 | 2281 | if (file_exists($tmp_dir.'notam.rss')) { |
2282 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
2282 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2283 | 2283 | foreach ($notams['channel']['item'] as $notam) { |
2284 | - $title = explode(':',$notam['title']); |
|
2284 | + $title = explode(':', $notam['title']); |
|
2285 | 2285 | $data['ref'] = trim($title[0]); |
2286 | 2286 | unset($title[0]); |
2287 | - $data['title'] = trim(implode(':',$title)); |
|
2288 | - $description = strip_tags($notam['description'],'<pre>'); |
|
2289 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
2290 | - $q = explode('/',$match[1]); |
|
2287 | + $data['title'] = trim(implode(':', $title)); |
|
2288 | + $description = strip_tags($notam['description'], '<pre>'); |
|
2289 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
2290 | + $q = explode('/', $match[1]); |
|
2291 | 2291 | $data['fir'] = $q[0]; |
2292 | 2292 | $data['code'] = $q[1]; |
2293 | 2293 | $ifrvfr = $q[2]; |
@@ -2303,30 +2303,30 @@ discard block |
||
2303 | 2303 | $data['lower_limit'] = $q[5]; |
2304 | 2304 | $data['upper_limit'] = $q[6]; |
2305 | 2305 | $latlonrad = $q[7]; |
2306 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2307 | - $latitude = $Common->convertDec($las,'latitude'); |
|
2308 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
2306 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
2307 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
2308 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
2309 | 2309 | if ($lac == 'S') $latitude = '-'.$latitude; |
2310 | 2310 | if ($lnc == 'W') $longitude = '-'.$longitude; |
2311 | 2311 | $data['center_latitude'] = $latitude; |
2312 | 2312 | $data['center_longitude'] = $longitude; |
2313 | 2313 | $data['radius'] = intval($radius); |
2314 | 2314 | |
2315 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
2315 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2316 | 2316 | $data['text'] = $match[1]; |
2317 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
2317 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
2318 | 2318 | $fromto = $match[1]; |
2319 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
2319 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2320 | 2320 | $fromall = trim($match[1]); |
2321 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
2321 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2322 | 2322 | $from = trim($match[1]); |
2323 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2324 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
2323 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
2324 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2325 | 2325 | $toall = trim($match[1]); |
2326 | - if (!preg_match(':Permanent:',$toall)) { |
|
2327 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
2326 | + if (!preg_match(':Permanent:', $toall)) { |
|
2327 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2328 | 2328 | $to = trim($match[1]); |
2329 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
2329 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2330 | 2330 | $data['permanent'] = 0; |
2331 | 2331 | } else { |
2332 | 2332 | $data['date_end'] = NULL; |
@@ -2334,7 +2334,7 @@ discard block |
||
2334 | 2334 | } |
2335 | 2335 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2336 | 2336 | $NOTAM = new NOTAM(); |
2337 | - $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']); |
|
2337 | + $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']); |
|
2338 | 2338 | unset($data); |
2339 | 2339 | } |
2340 | 2340 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2357,16 +2357,16 @@ discard block |
||
2357 | 2357 | $Connection = new Connection(); |
2358 | 2358 | $sth = $Connection->db->prepare($query); |
2359 | 2359 | $sth->execute(); |
2360 | - } catch(PDOException $e) { |
|
2360 | + } catch (PDOException $e) { |
|
2361 | 2361 | return "error : ".$e->getMessage(); |
2362 | 2362 | } |
2363 | 2363 | } |
2364 | 2364 | $Common = new Common(); |
2365 | 2365 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2366 | - $airspace_json = json_decode($airspace_lst,true); |
|
2366 | + $airspace_json = json_decode($airspace_lst, true); |
|
2367 | 2367 | foreach ($airspace_json['records'] as $airspace) { |
2368 | 2368 | if ($globalDebug) echo $airspace['name']."...\n"; |
2369 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
2369 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2370 | 2370 | if (file_exists($tmp_dir.$airspace['name'])) { |
2371 | 2371 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
2372 | 2372 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2388,7 +2388,7 @@ discard block |
||
2388 | 2388 | $Connection = new Connection(); |
2389 | 2389 | $sth = $Connection->db->prepare($query); |
2390 | 2390 | $sth->execute(array(':new' => $new, ':old' => $old)); |
2391 | - } catch(PDOException $e) { |
|
2391 | + } catch (PDOException $e) { |
|
2392 | 2392 | return "error : ".$e->getMessage(); |
2393 | 2393 | } |
2394 | 2394 | } |
@@ -2405,7 +2405,7 @@ discard block |
||
2405 | 2405 | $Connection = new Connection(); |
2406 | 2406 | $sth = $Connection->db->prepare($query); |
2407 | 2407 | $sth->execute(); |
2408 | - } catch(PDOException $e) { |
|
2408 | + } catch (PDOException $e) { |
|
2409 | 2409 | return "error : ".$e->getMessage(); |
2410 | 2410 | } |
2411 | 2411 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2420,7 +2420,7 @@ discard block |
||
2420 | 2420 | $Connection = new Connection(); |
2421 | 2421 | $sth = $Connection->db->prepare($query); |
2422 | 2422 | $sth->execute(); |
2423 | - } catch(PDOException $e) { |
|
2423 | + } catch (PDOException $e) { |
|
2424 | 2424 | return "error : ".$e->getMessage(); |
2425 | 2425 | } |
2426 | 2426 | } |
@@ -2431,7 +2431,7 @@ discard block |
||
2431 | 2431 | $Connection = new Connection(); |
2432 | 2432 | $sth = $Connection->db->prepare($query); |
2433 | 2433 | $sth->execute(array(':version' => $version)); |
2434 | - } catch(PDOException $e) { |
|
2434 | + } catch (PDOException $e) { |
|
2435 | 2435 | return "error : ".$e->getMessage(); |
2436 | 2436 | } |
2437 | 2437 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2445,7 +2445,7 @@ discard block |
||
2445 | 2445 | $Connection = new Connection(); |
2446 | 2446 | $sth = $Connection->db->prepare($query); |
2447 | 2447 | $sth->execute(array(':version' => $version)); |
2448 | - } catch(PDOException $e) { |
|
2448 | + } catch (PDOException $e) { |
|
2449 | 2449 | return "error : ".$e->getMessage(); |
2450 | 2450 | } |
2451 | 2451 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2461,7 +2461,7 @@ discard block |
||
2461 | 2461 | $Connection = new Connection(); |
2462 | 2462 | $sth = $Connection->db->prepare($query); |
2463 | 2463 | $sth->execute(array(':version' => $version)); |
2464 | - } catch(PDOException $e) { |
|
2464 | + } catch (PDOException $e) { |
|
2465 | 2465 | return "error : ".$e->getMessage(); |
2466 | 2466 | } |
2467 | 2467 | } |
@@ -2473,7 +2473,7 @@ discard block |
||
2473 | 2473 | $Connection = new Connection(); |
2474 | 2474 | $sth = $Connection->db->prepare($query); |
2475 | 2475 | $sth->execute(array(':version' => $version)); |
2476 | - } catch(PDOException $e) { |
|
2476 | + } catch (PDOException $e) { |
|
2477 | 2477 | return "error : ".$e->getMessage(); |
2478 | 2478 | } |
2479 | 2479 | } |
@@ -2489,7 +2489,7 @@ discard block |
||
2489 | 2489 | $Connection = new Connection(); |
2490 | 2490 | $sth = $Connection->db->prepare($query); |
2491 | 2491 | $sth->execute(); |
2492 | - } catch(PDOException $e) { |
|
2492 | + } catch (PDOException $e) { |
|
2493 | 2493 | return "error : ".$e->getMessage(); |
2494 | 2494 | } |
2495 | 2495 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2504,7 +2504,7 @@ discard block |
||
2504 | 2504 | $Connection = new Connection(); |
2505 | 2505 | $sth = $Connection->db->prepare($query); |
2506 | 2506 | $sth->execute(); |
2507 | - } catch(PDOException $e) { |
|
2507 | + } catch (PDOException $e) { |
|
2508 | 2508 | return "error : ".$e->getMessage(); |
2509 | 2509 | } |
2510 | 2510 | } |
@@ -2519,7 +2519,7 @@ discard block |
||
2519 | 2519 | $Connection = new Connection(); |
2520 | 2520 | $sth = $Connection->db->prepare($query); |
2521 | 2521 | $sth->execute(); |
2522 | - } catch(PDOException $e) { |
|
2522 | + } catch (PDOException $e) { |
|
2523 | 2523 | return "error : ".$e->getMessage(); |
2524 | 2524 | } |
2525 | 2525 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2534,7 +2534,7 @@ discard block |
||
2534 | 2534 | $Connection = new Connection(); |
2535 | 2535 | $sth = $Connection->db->prepare($query); |
2536 | 2536 | $sth->execute(); |
2537 | - } catch(PDOException $e) { |
|
2537 | + } catch (PDOException $e) { |
|
2538 | 2538 | return "error : ".$e->getMessage(); |
2539 | 2539 | } |
2540 | 2540 | } |
@@ -2550,7 +2550,7 @@ discard block |
||
2550 | 2550 | $Connection = new Connection(); |
2551 | 2551 | $sth = $Connection->db->prepare($query); |
2552 | 2552 | $sth->execute(); |
2553 | - } catch(PDOException $e) { |
|
2553 | + } catch (PDOException $e) { |
|
2554 | 2554 | return "error : ".$e->getMessage(); |
2555 | 2555 | } |
2556 | 2556 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2565,7 +2565,7 @@ discard block |
||
2565 | 2565 | $Connection = new Connection(); |
2566 | 2566 | $sth = $Connection->db->prepare($query); |
2567 | 2567 | $sth->execute(); |
2568 | - } catch(PDOException $e) { |
|
2568 | + } catch (PDOException $e) { |
|
2569 | 2569 | return "error : ".$e->getMessage(); |
2570 | 2570 | } |
2571 | 2571 | } |
@@ -2580,7 +2580,7 @@ discard block |
||
2580 | 2580 | $Connection = new Connection(); |
2581 | 2581 | $sth = $Connection->db->prepare($query); |
2582 | 2582 | $sth->execute(); |
2583 | - } catch(PDOException $e) { |
|
2583 | + } catch (PDOException $e) { |
|
2584 | 2584 | return "error : ".$e->getMessage(); |
2585 | 2585 | } |
2586 | 2586 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2595,7 +2595,7 @@ discard block |
||
2595 | 2595 | $Connection = new Connection(); |
2596 | 2596 | $sth = $Connection->db->prepare($query); |
2597 | 2597 | $sth->execute(); |
2598 | - } catch(PDOException $e) { |
|
2598 | + } catch (PDOException $e) { |
|
2599 | 2599 | return "error : ".$e->getMessage(); |
2600 | 2600 | } |
2601 | 2601 | } |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | $Connection = new Connection(); |
2611 | 2611 | $sth = $Connection->db->prepare($query); |
2612 | 2612 | $sth->execute(); |
2613 | - } catch(PDOException $e) { |
|
2613 | + } catch (PDOException $e) { |
|
2614 | 2614 | return "error : ".$e->getMessage(); |
2615 | 2615 | } |
2616 | 2616 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2625,7 +2625,7 @@ discard block |
||
2625 | 2625 | $Connection = new Connection(); |
2626 | 2626 | $sth = $Connection->db->prepare($query); |
2627 | 2627 | $sth->execute(); |
2628 | - } catch(PDOException $e) { |
|
2628 | + } catch (PDOException $e) { |
|
2629 | 2629 | return "error : ".$e->getMessage(); |
2630 | 2630 | } |
2631 | 2631 | } |
@@ -2640,7 +2640,7 @@ discard block |
||
2640 | 2640 | $Connection = new Connection(); |
2641 | 2641 | $sth = $Connection->db->prepare($query); |
2642 | 2642 | $sth->execute(); |
2643 | - } catch(PDOException $e) { |
|
2643 | + } catch (PDOException $e) { |
|
2644 | 2644 | return "error : ".$e->getMessage(); |
2645 | 2645 | } |
2646 | 2646 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2655,7 +2655,7 @@ discard block |
||
2655 | 2655 | $Connection = new Connection(); |
2656 | 2656 | $sth = $Connection->db->prepare($query); |
2657 | 2657 | $sth->execute(); |
2658 | - } catch(PDOException $e) { |
|
2658 | + } catch (PDOException $e) { |
|
2659 | 2659 | return "error : ".$e->getMessage(); |
2660 | 2660 | } |
2661 | 2661 | } |
@@ -2670,7 +2670,7 @@ discard block |
||
2670 | 2670 | $Connection = new Connection(); |
2671 | 2671 | $sth = $Connection->db->prepare($query); |
2672 | 2672 | $sth->execute(); |
2673 | - } catch(PDOException $e) { |
|
2673 | + } catch (PDOException $e) { |
|
2674 | 2674 | return "error : ".$e->getMessage(); |
2675 | 2675 | } |
2676 | 2676 | } |
@@ -2685,7 +2685,7 @@ discard block |
||
2685 | 2685 | $Connection = new Connection(); |
2686 | 2686 | $sth = $Connection->db->prepare($query); |
2687 | 2687 | $sth->execute(); |
2688 | - } catch(PDOException $e) { |
|
2688 | + } catch (PDOException $e) { |
|
2689 | 2689 | return "error : ".$e->getMessage(); |
2690 | 2690 | } |
2691 | 2691 | } |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | curl_setopt($ch, CURLOPT_URL, $url); |
17 | 17 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
18 | 18 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
19 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
19 | + if ($referer != '') { |
|
20 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
21 | + } |
|
20 | 22 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
21 | 23 | curl_setopt($ch, CURLOPT_FILE, $fp); |
22 | 24 | curl_exec($ch); |
@@ -27,12 +29,16 @@ discard block |
||
27 | 29 | public static function gunzip($in_file,$out_file_name = '') { |
28 | 30 | //echo $in_file.' -> '.$out_file_name."\n"; |
29 | 31 | $buffer_size = 4096; // read 4kb at a time |
30 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
32 | + if ($out_file_name == '') { |
|
33 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
34 | + } |
|
31 | 35 | if ($in_file != '' && file_exists($in_file)) { |
32 | 36 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
33 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
34 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
35 | - else { |
|
37 | + if (function_exists('gzopen')) { |
|
38 | + $file = gzopen($in_file,'rb'); |
|
39 | + } elseif (function_exists('gzopen64')) { |
|
40 | + $file = gzopen64($in_file,'rb'); |
|
41 | + } else { |
|
36 | 42 | echo 'gzopen not available'; |
37 | 43 | die; |
38 | 44 | } |
@@ -53,8 +59,12 @@ discard block |
||
53 | 59 | if ($res === TRUE) { |
54 | 60 | $zip->extractTo($path); |
55 | 61 | $zip->close(); |
56 | - } else return false; |
|
57 | - } else return false; |
|
62 | + } else { |
|
63 | + return false; |
|
64 | + } |
|
65 | + } else { |
|
66 | + return false; |
|
67 | + } |
|
58 | 68 | } |
59 | 69 | |
60 | 70 | public static function connect_sqlite($database) { |
@@ -69,7 +79,9 @@ discard block |
||
69 | 79 | public static function retrieve_route_sqlite_to_dest($database_file) { |
70 | 80 | global $globalDebug, $globalTransaction; |
71 | 81 | //$query = 'TRUNCATE TABLE routes'; |
72 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
82 | + if ($globalDebug) { |
|
83 | + echo " - Delete previous routes from DB -"; |
|
84 | + } |
|
73 | 85 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
74 | 86 | $Connection = new Connection(); |
75 | 87 | try { |
@@ -80,7 +92,9 @@ discard block |
||
80 | 92 | return "error : ".$e->getMessage(); |
81 | 93 | } |
82 | 94 | |
83 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
95 | + if ($globalDebug) { |
|
96 | + echo " - Add routes to DB -"; |
|
97 | + } |
|
84 | 98 | update_db::connect_sqlite($database_file); |
85 | 99 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
86 | 100 | $query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID"; |
@@ -95,15 +109,21 @@ discard block |
||
95 | 109 | $Connection = new Connection(); |
96 | 110 | $sth_dest = $Connection->db->prepare($query_dest); |
97 | 111 | try { |
98 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
112 | + if ($globalTransaction) { |
|
113 | + $Connection->db->beginTransaction(); |
|
114 | + } |
|
99 | 115 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
100 | 116 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
101 | 117 | $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
102 | 118 | $sth_dest->execute($query_dest_values); |
103 | 119 | } |
104 | - if ($globalTransaction) $Connection->db->commit(); |
|
120 | + if ($globalTransaction) { |
|
121 | + $Connection->db->commit(); |
|
122 | + } |
|
105 | 123 | } catch(PDOException $e) { |
106 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
124 | + if ($globalTransaction) { |
|
125 | + $Connection->db->rollBack(); |
|
126 | + } |
|
107 | 127 | return "error : ".$e->getMessage(); |
108 | 128 | } |
109 | 129 | return ''; |
@@ -111,7 +131,9 @@ discard block |
||
111 | 131 | public static function retrieve_route_oneworld($database_file) { |
112 | 132 | global $globalDebug, $globalTransaction; |
113 | 133 | //$query = 'TRUNCATE TABLE routes'; |
114 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
134 | + if ($globalDebug) { |
|
135 | + echo " - Delete previous routes from DB -"; |
|
136 | + } |
|
115 | 137 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
116 | 138 | $Connection = new Connection(); |
117 | 139 | try { |
@@ -122,14 +144,18 @@ discard block |
||
122 | 144 | return "error : ".$e->getMessage(); |
123 | 145 | } |
124 | 146 | |
125 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
147 | + if ($globalDebug) { |
|
148 | + echo " - Add routes to DB -"; |
|
149 | + } |
|
126 | 150 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
127 | 151 | $Spotter = new Spotter(); |
128 | 152 | if ($fh = fopen($database_file,"r")) { |
129 | 153 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
130 | 154 | $Connection = new Connection(); |
131 | 155 | $sth_dest = $Connection->db->prepare($query_dest); |
132 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
156 | + if ($globalTransaction) { |
|
157 | + $Connection->db->beginTransaction(); |
|
158 | + } |
|
133 | 159 | while (!feof($fh)) { |
134 | 160 | $line = fgetcsv($fh,9999,','); |
135 | 161 | if ($line[0] != '') { |
@@ -138,13 +164,17 @@ discard block |
||
138 | 164 | $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
139 | 165 | $sth_dest->execute($query_dest_values); |
140 | 166 | } catch(PDOException $e) { |
141 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
167 | + if ($globalTransaction) { |
|
168 | + $Connection->db->rollBack(); |
|
169 | + } |
|
142 | 170 | return "error : ".$e->getMessage(); |
143 | 171 | } |
144 | 172 | } |
145 | 173 | } |
146 | 174 | } |
147 | - if ($globalTransaction) $Connection->db->commit(); |
|
175 | + if ($globalTransaction) { |
|
176 | + $Connection->db->commit(); |
|
177 | + } |
|
148 | 178 | } |
149 | 179 | return ''; |
150 | 180 | } |
@@ -152,7 +182,9 @@ discard block |
||
152 | 182 | public static function retrieve_route_skyteam($database_file) { |
153 | 183 | global $globalDebug, $globalTransaction; |
154 | 184 | //$query = 'TRUNCATE TABLE routes'; |
155 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
185 | + if ($globalDebug) { |
|
186 | + echo " - Delete previous routes from DB -"; |
|
187 | + } |
|
156 | 188 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
157 | 189 | $Connection = new Connection(); |
158 | 190 | try { |
@@ -163,7 +195,9 @@ discard block |
||
163 | 195 | return "error : ".$e->getMessage(); |
164 | 196 | } |
165 | 197 | |
166 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
198 | + if ($globalDebug) { |
|
199 | + echo " - Add routes to DB -"; |
|
200 | + } |
|
167 | 201 | |
168 | 202 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
169 | 203 | $Spotter = new Spotter(); |
@@ -172,7 +206,9 @@ discard block |
||
172 | 206 | $Connection = new Connection(); |
173 | 207 | $sth_dest = $Connection->db->prepare($query_dest); |
174 | 208 | try { |
175 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
209 | + if ($globalTransaction) { |
|
210 | + $Connection->db->beginTransaction(); |
|
211 | + } |
|
176 | 212 | while (!feof($fh)) { |
177 | 213 | $line = fgetcsv($fh,9999,','); |
178 | 214 | if ($line[0] != '') { |
@@ -183,9 +219,13 @@ discard block |
||
183 | 219 | } |
184 | 220 | } |
185 | 221 | } |
186 | - if ($globalTransaction) $Connection->db->commit(); |
|
222 | + if ($globalTransaction) { |
|
223 | + $Connection->db->commit(); |
|
224 | + } |
|
187 | 225 | } catch(PDOException $e) { |
188 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
226 | + if ($globalTransaction) { |
|
227 | + $Connection->db->rollBack(); |
|
228 | + } |
|
189 | 229 | return "error : ".$e->getMessage(); |
190 | 230 | } |
191 | 231 | } |
@@ -228,11 +268,16 @@ discard block |
||
228 | 268 | $sth_dest = $Connection->db->prepare($query_dest); |
229 | 269 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
230 | 270 | try { |
231 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
271 | + if ($globalTransaction) { |
|
272 | + $Connection->db->beginTransaction(); |
|
273 | + } |
|
232 | 274 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
233 | 275 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
234 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
235 | - else $type = null; |
|
276 | + if ($values['UserString4'] == 'M') { |
|
277 | + $type = 'military'; |
|
278 | + } else { |
|
279 | + $type = null; |
|
280 | + } |
|
236 | 281 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
237 | 282 | $sth_dest->execute($query_dest_values); |
238 | 283 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -240,7 +285,9 @@ discard block |
||
240 | 285 | $sth_dest_owner->execute($query_dest_owner_values); |
241 | 286 | } |
242 | 287 | } |
243 | - if ($globalTransaction) $Connection->db->commit(); |
|
288 | + if ($globalTransaction) { |
|
289 | + $Connection->db->commit(); |
|
290 | + } |
|
244 | 291 | } catch(PDOException $e) { |
245 | 292 | return "error : ".$e->getMessage(); |
246 | 293 | } |
@@ -277,7 +324,9 @@ discard block |
||
277 | 324 | $Connection = new Connection(); |
278 | 325 | $sth_dest = $Connection->db->prepare($query_dest); |
279 | 326 | try { |
280 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
327 | + if ($globalTransaction) { |
|
328 | + $Connection->db->beginTransaction(); |
|
329 | + } |
|
281 | 330 | while (!feof($fh)) { |
282 | 331 | $values = array(); |
283 | 332 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -288,7 +337,9 @@ discard block |
||
288 | 337 | // Check if we can find ICAO, else set it to GLID |
289 | 338 | $aircraft_name_split = explode(' ',$aircraft_name); |
290 | 339 | $search_more = ''; |
291 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
340 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
341 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
342 | + } |
|
292 | 343 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
293 | 344 | $sth_search = $Connection->db->prepare($query_search); |
294 | 345 | try { |
@@ -301,7 +352,9 @@ discard block |
||
301 | 352 | } catch(PDOException $e) { |
302 | 353 | return "error : ".$e->getMessage(); |
303 | 354 | } |
304 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
355 | + if (!isset($values['ICAOTypeCode'])) { |
|
356 | + $values['ICAOTypeCode'] = 'GLID'; |
|
357 | + } |
|
305 | 358 | // Add data to db |
306 | 359 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
307 | 360 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
@@ -310,7 +363,9 @@ discard block |
||
310 | 363 | $sth_dest->execute($query_dest_values); |
311 | 364 | } |
312 | 365 | } |
313 | - if ($globalTransaction) $Connection->db->commit(); |
|
366 | + if ($globalTransaction) { |
|
367 | + $Connection->db->commit(); |
|
368 | + } |
|
314 | 369 | } catch(PDOException $e) { |
315 | 370 | return "error : ".$e->getMessage(); |
316 | 371 | } |
@@ -346,7 +401,9 @@ discard block |
||
346 | 401 | $Connection = new Connection(); |
347 | 402 | $sth_dest = $Connection->db->prepare($query_dest); |
348 | 403 | try { |
349 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
404 | + if ($globalTransaction) { |
|
405 | + $Connection->db->beginTransaction(); |
|
406 | + } |
|
350 | 407 | $tmp = fgetcsv($fh,9999,',',"'"); |
351 | 408 | while (!feof($fh)) { |
352 | 409 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -359,13 +416,17 @@ discard block |
||
359 | 416 | // Check if we can find ICAO, else set it to GLID |
360 | 417 | $aircraft_name_split = explode(' ',$aircraft_name); |
361 | 418 | $search_more = ''; |
362 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
419 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
420 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
421 | + } |
|
363 | 422 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
364 | 423 | $sth_search = $Connection->db->prepare($query_search); |
365 | 424 | try { |
366 | 425 | $sth_search->execute(); |
367 | 426 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
368 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
427 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
428 | + $values['ICAOTypeCode'] = $result['icao']; |
|
429 | + } |
|
369 | 430 | } catch(PDOException $e) { |
370 | 431 | return "error : ".$e->getMessage(); |
371 | 432 | } |
@@ -378,7 +439,9 @@ discard block |
||
378 | 439 | $sth_dest->execute($query_dest_values); |
379 | 440 | } |
380 | 441 | } |
381 | - if ($globalTransaction) $Connection->db->commit(); |
|
442 | + if ($globalTransaction) { |
|
443 | + $Connection->db->commit(); |
|
444 | + } |
|
382 | 445 | } catch(PDOException $e) { |
383 | 446 | return "error : ".$e->getMessage(); |
384 | 447 | } |
@@ -417,7 +480,9 @@ discard block |
||
417 | 480 | $sth_dest = $Connection->db->prepare($query_dest); |
418 | 481 | $sth_modes = $Connection->db->prepare($query_modes); |
419 | 482 | try { |
420 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
483 | + if ($globalTransaction) { |
|
484 | + $Connection->db->beginTransaction(); |
|
485 | + } |
|
421 | 486 | $tmp = fgetcsv($fh,9999,',','"'); |
422 | 487 | while (!feof($fh)) { |
423 | 488 | $line = fgetcsv($fh,9999,',','"'); |
@@ -427,16 +492,22 @@ discard block |
||
427 | 492 | $values['registration'] = $line[0]; |
428 | 493 | $values['base'] = $line[4]; |
429 | 494 | $values['owner'] = $line[5]; |
430 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
431 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
495 | + if ($line[6] == '') { |
|
496 | + $values['date_first_reg'] = null; |
|
497 | + } else { |
|
498 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
499 | + } |
|
432 | 500 | $values['cancel'] = $line[7]; |
433 | 501 | } elseif ($country == 'EI') { |
434 | 502 | // TODO : add modeS & reg to aircraft_modes |
435 | 503 | $values['registration'] = $line[0]; |
436 | 504 | $values['base'] = $line[3]; |
437 | 505 | $values['owner'] = $line[2]; |
438 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
439 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
506 | + if ($line[1] == '') { |
|
507 | + $values['date_first_reg'] = null; |
|
508 | + } else { |
|
509 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
510 | + } |
|
440 | 511 | $values['cancel'] = ''; |
441 | 512 | $values['modes'] = $line[7]; |
442 | 513 | $values['icao'] = $line[8]; |
@@ -455,16 +526,22 @@ discard block |
||
455 | 526 | $values['registration'] = $line[3]; |
456 | 527 | $values['base'] = null; |
457 | 528 | $values['owner'] = $line[5]; |
458 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
459 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
529 | + if ($line[18] == '') { |
|
530 | + $values['date_first_reg'] = null; |
|
531 | + } else { |
|
532 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
533 | + } |
|
460 | 534 | $values['cancel'] = ''; |
461 | 535 | } elseif ($country == 'VH') { |
462 | 536 | // TODO : add modeS & reg to aircraft_modes |
463 | 537 | $values['registration'] = $line[0]; |
464 | 538 | $values['base'] = null; |
465 | 539 | $values['owner'] = $line[12]; |
466 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
467 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
540 | + if ($line[28] == '') { |
|
541 | + $values['date_first_reg'] = null; |
|
542 | + } else { |
|
543 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
544 | + } |
|
468 | 545 | |
469 | 546 | $values['cancel'] = $line[39]; |
470 | 547 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -483,29 +560,41 @@ discard block |
||
483 | 560 | $values['registration'] = $line[0]; |
484 | 561 | $values['base'] = null; |
485 | 562 | $values['owner'] = $line[8]; |
486 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
487 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
563 | + if ($line[7] == '') { |
|
564 | + $values['date_first_reg'] = null; |
|
565 | + } else { |
|
566 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
567 | + } |
|
488 | 568 | $values['cancel'] = ''; |
489 | 569 | } elseif ($country == 'PP') { |
490 | 570 | $values['registration'] = $line[0]; |
491 | 571 | $values['base'] = null; |
492 | 572 | $values['owner'] = $line[4]; |
493 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
494 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
573 | + if ($line[6] == '') { |
|
574 | + $values['date_first_reg'] = null; |
|
575 | + } else { |
|
576 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
577 | + } |
|
495 | 578 | $values['cancel'] = $line[7]; |
496 | 579 | } elseif ($country == 'E7') { |
497 | 580 | $values['registration'] = $line[0]; |
498 | 581 | $values['base'] = null; |
499 | 582 | $values['owner'] = $line[4]; |
500 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
501 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
583 | + if ($line[5] == '') { |
|
584 | + $values['date_first_reg'] = null; |
|
585 | + } else { |
|
586 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
587 | + } |
|
502 | 588 | $values['cancel'] = ''; |
503 | 589 | } elseif ($country == '8Q') { |
504 | 590 | $values['registration'] = $line[0]; |
505 | 591 | $values['base'] = null; |
506 | 592 | $values['owner'] = $line[3]; |
507 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
508 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
593 | + if ($line[7] == '') { |
|
594 | + $values['date_first_reg'] = null; |
|
595 | + } else { |
|
596 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
597 | + } |
|
509 | 598 | $values['cancel'] = ''; |
510 | 599 | } elseif ($country == 'ZK') { |
511 | 600 | $values['registration'] = $line[0]; |
@@ -550,7 +639,9 @@ discard block |
||
550 | 639 | $sth_modes->execute($query_modes_values); |
551 | 640 | } |
552 | 641 | } |
553 | - if ($globalTransaction) $Connection->db->commit(); |
|
642 | + if ($globalTransaction) { |
|
643 | + $Connection->db->commit(); |
|
644 | + } |
|
554 | 645 | } catch(PDOException $e) { |
555 | 646 | return "error : ".$e->getMessage(); |
556 | 647 | } |
@@ -684,25 +775,45 @@ discard block |
||
684 | 775 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
685 | 776 | $Connection = new Connection(); |
686 | 777 | $sth_dest = $Connection->db->prepare($query_dest); |
687 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
778 | + if ($globalTransaction) { |
|
779 | + $Connection->db->beginTransaction(); |
|
780 | + } |
|
688 | 781 | |
689 | 782 | $i = 0; |
690 | 783 | while($row = sparql_fetch_array($result)) |
691 | 784 | { |
692 | 785 | if ($i >= 1) { |
693 | 786 | //print_r($row); |
694 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
695 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
696 | - if (!isset($row['type'])) $row['type'] = ''; |
|
697 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
787 | + if (!isset($row['iata'])) { |
|
788 | + $row['iata'] = ''; |
|
789 | + } |
|
790 | + if (!isset($row['icao'])) { |
|
791 | + $row['icao'] = ''; |
|
792 | + } |
|
793 | + if (!isset($row['type'])) { |
|
794 | + $row['type'] = ''; |
|
795 | + } |
|
796 | + if (!isset($row['altitude'])) { |
|
797 | + $row['altitude'] = ''; |
|
798 | + } |
|
698 | 799 | if (isset($row['city_bis'])) { |
699 | 800 | $row['city'] = $row['city_bis']; |
700 | 801 | } |
701 | - if (!isset($row['city'])) $row['city'] = ''; |
|
702 | - if (!isset($row['country'])) $row['country'] = ''; |
|
703 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
704 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
705 | - if (!isset($row['name'])) continue; |
|
802 | + if (!isset($row['city'])) { |
|
803 | + $row['city'] = ''; |
|
804 | + } |
|
805 | + if (!isset($row['country'])) { |
|
806 | + $row['country'] = ''; |
|
807 | + } |
|
808 | + if (!isset($row['homepage'])) { |
|
809 | + $row['homepage'] = ''; |
|
810 | + } |
|
811 | + if (!isset($row['wikipedia_page'])) { |
|
812 | + $row['wikipedia_page'] = ''; |
|
813 | + } |
|
814 | + if (!isset($row['name'])) { |
|
815 | + continue; |
|
816 | + } |
|
706 | 817 | if (!isset($row['image'])) { |
707 | 818 | $row['image'] = ''; |
708 | 819 | $row['image_thumb'] = ''; |
@@ -738,7 +849,9 @@ discard block |
||
738 | 849 | |
739 | 850 | $i++; |
740 | 851 | } |
741 | - if ($globalTransaction) $Connection->db->commit(); |
|
852 | + if ($globalTransaction) { |
|
853 | + $Connection->db->commit(); |
|
854 | + } |
|
742 | 855 | echo "Delete duplicate rows...\n"; |
743 | 856 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
744 | 857 | try { |
@@ -750,7 +863,9 @@ discard block |
||
750 | 863 | } |
751 | 864 | |
752 | 865 | |
753 | - if ($globalDebug) echo "Insert Not available Airport...\n"; |
|
866 | + if ($globalDebug) { |
|
867 | + echo "Insert Not available Airport...\n"; |
|
868 | + } |
|
754 | 869 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
755 | 870 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
756 | 871 | $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
@@ -777,7 +892,9 @@ discard block |
||
777 | 892 | $delimiter = ','; |
778 | 893 | $out_file = $tmp_dir.'airports.csv'; |
779 | 894 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
780 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
895 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
896 | + return FALSE; |
|
897 | + } |
|
781 | 898 | echo "Add data from ourairports.com...\n"; |
782 | 899 | |
783 | 900 | $header = NULL; |
@@ -787,8 +904,9 @@ discard block |
||
787 | 904 | //$Connection->db->beginTransaction(); |
788 | 905 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
789 | 906 | { |
790 | - if(!$header) $header = $row; |
|
791 | - else { |
|
907 | + if(!$header) { |
|
908 | + $header = $row; |
|
909 | + } else { |
|
792 | 910 | $data = array(); |
793 | 911 | $data = array_combine($header, $row); |
794 | 912 | try { |
@@ -826,7 +944,9 @@ discard block |
||
826 | 944 | echo "Download data from another free database...\n"; |
827 | 945 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
828 | 946 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
829 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
947 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
948 | + return FALSE; |
|
949 | + } |
|
830 | 950 | update_db::unzip($out_file); |
831 | 951 | $header = NULL; |
832 | 952 | echo "Add data from another free database...\n"; |
@@ -837,8 +957,9 @@ discard block |
||
837 | 957 | //$Connection->db->beginTransaction(); |
838 | 958 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
839 | 959 | { |
840 | - if(!$header) $header = $row; |
|
841 | - else { |
|
960 | + if(!$header) { |
|
961 | + $header = $row; |
|
962 | + } else { |
|
842 | 963 | $data = $row; |
843 | 964 | |
844 | 965 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
@@ -1014,7 +1135,9 @@ discard block |
||
1014 | 1135 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
1015 | 1136 | { |
1016 | 1137 | $i = 0; |
1017 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1138 | + if ($globalTransaction) { |
|
1139 | + $Connection->db->beginTransaction(); |
|
1140 | + } |
|
1018 | 1141 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1019 | 1142 | { |
1020 | 1143 | if ($i > 0) { |
@@ -1027,7 +1150,9 @@ discard block |
||
1027 | 1150 | } |
1028 | 1151 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
1029 | 1152 | if (!empty($result_search)) { |
1030 | - if ($globalDebug) echo '.'; |
|
1153 | + if ($globalDebug) { |
|
1154 | + echo '.'; |
|
1155 | + } |
|
1031 | 1156 | //if ($globalDBdriver == 'mysql') { |
1032 | 1157 | // $queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao'; |
1033 | 1158 | //} else { |
@@ -1049,8 +1174,12 @@ discard block |
||
1049 | 1174 | } |
1050 | 1175 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
1051 | 1176 | if (!empty($result_search_mfr)) { |
1052 | - if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23]; |
|
1053 | - if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15]; |
|
1177 | + if (trim($data[16]) == '' && trim($data[23]) != '') { |
|
1178 | + $data[16] = $data[23]; |
|
1179 | + } |
|
1180 | + if (trim($data[16]) == '' && trim($data[15]) != '') { |
|
1181 | + $data[16] = $data[15]; |
|
1182 | + } |
|
1054 | 1183 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1055 | 1184 | try { |
1056 | 1185 | $sthf = $Connection->db->prepare($queryf); |
@@ -1061,7 +1190,9 @@ discard block |
||
1061 | 1190 | } |
1062 | 1191 | } |
1063 | 1192 | if (strtotime($data[29]) > time()) { |
1064 | - if ($globalDebug) echo 'i'; |
|
1193 | + if ($globalDebug) { |
|
1194 | + echo 'i'; |
|
1195 | + } |
|
1065 | 1196 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1066 | 1197 | try { |
1067 | 1198 | $sth = $Connection->db->prepare($query); |
@@ -1072,13 +1203,19 @@ discard block |
||
1072 | 1203 | } |
1073 | 1204 | } |
1074 | 1205 | if ($i % 90 == 0) { |
1075 | - if ($globalTransaction) $Connection->db->commit(); |
|
1076 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1206 | + if ($globalTransaction) { |
|
1207 | + $Connection->db->commit(); |
|
1208 | + } |
|
1209 | + if ($globalTransaction) { |
|
1210 | + $Connection->db->beginTransaction(); |
|
1211 | + } |
|
1077 | 1212 | } |
1078 | 1213 | $i++; |
1079 | 1214 | } |
1080 | 1215 | fclose($handle); |
1081 | - if ($globalTransaction) $Connection->db->commit(); |
|
1216 | + if ($globalTransaction) { |
|
1217 | + $Connection->db->commit(); |
|
1218 | + } |
|
1082 | 1219 | } |
1083 | 1220 | print_r($mfr); |
1084 | 1221 | return ''; |
@@ -1103,11 +1240,15 @@ discard block |
||
1103 | 1240 | $i = 0; |
1104 | 1241 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1105 | 1242 | //$Connection->db->beginTransaction(); |
1106 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1243 | + if ($globalTransaction) { |
|
1244 | + $Connection->db->beginTransaction(); |
|
1245 | + } |
|
1107 | 1246 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1108 | 1247 | { |
1109 | 1248 | if ($i > 0) { |
1110 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
1249 | + if ($data[1] == 'NULL') { |
|
1250 | + $data[1] = $data[0]; |
|
1251 | + } |
|
1111 | 1252 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1112 | 1253 | try { |
1113 | 1254 | $sth = $Connection->db->prepare($query); |
@@ -1119,7 +1260,9 @@ discard block |
||
1119 | 1260 | $i++; |
1120 | 1261 | } |
1121 | 1262 | fclose($handle); |
1122 | - if ($globalTransaction) $Connection->db->commit(); |
|
1263 | + if ($globalTransaction) { |
|
1264 | + $Connection->db->commit(); |
|
1265 | + } |
|
1123 | 1266 | } |
1124 | 1267 | return ''; |
1125 | 1268 | } |
@@ -1140,7 +1283,9 @@ discard block |
||
1140 | 1283 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
1141 | 1284 | { |
1142 | 1285 | $i = 0; |
1143 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1286 | + if ($globalTransaction) { |
|
1287 | + $Connection->db->beginTransaction(); |
|
1288 | + } |
|
1144 | 1289 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1145 | 1290 | { |
1146 | 1291 | if ($i > 0) { |
@@ -1156,7 +1301,9 @@ discard block |
||
1156 | 1301 | $i++; |
1157 | 1302 | } |
1158 | 1303 | fclose($handle); |
1159 | - if ($globalTransaction) $Connection->db->commit(); |
|
1304 | + if ($globalTransaction) { |
|
1305 | + $Connection->db->commit(); |
|
1306 | + } |
|
1160 | 1307 | } |
1161 | 1308 | return ''; |
1162 | 1309 | } |
@@ -1181,7 +1328,9 @@ discard block |
||
1181 | 1328 | $i = 0; |
1182 | 1329 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1183 | 1330 | //$Connection->db->beginTransaction(); |
1184 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1331 | + if ($globalTransaction) { |
|
1332 | + $Connection->db->beginTransaction(); |
|
1333 | + } |
|
1185 | 1334 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1186 | 1335 | { |
1187 | 1336 | if ($i > 0) { |
@@ -1196,7 +1345,9 @@ discard block |
||
1196 | 1345 | $i++; |
1197 | 1346 | } |
1198 | 1347 | fclose($handle); |
1199 | - if ($globalTransaction) $Connection->db->commit(); |
|
1348 | + if ($globalTransaction) { |
|
1349 | + $Connection->db->commit(); |
|
1350 | + } |
|
1200 | 1351 | } |
1201 | 1352 | return ''; |
1202 | 1353 | } |
@@ -1221,7 +1372,9 @@ discard block |
||
1221 | 1372 | $i = 0; |
1222 | 1373 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1223 | 1374 | //$Connection->db->beginTransaction(); |
1224 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1375 | + if ($globalTransaction) { |
|
1376 | + $Connection->db->beginTransaction(); |
|
1377 | + } |
|
1225 | 1378 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1226 | 1379 | { |
1227 | 1380 | if ($i > 0) { |
@@ -1236,7 +1389,9 @@ discard block |
||
1236 | 1389 | $i++; |
1237 | 1390 | } |
1238 | 1391 | fclose($handle); |
1239 | - if ($globalTransaction) $Connection->db->commit(); |
|
1392 | + if ($globalTransaction) { |
|
1393 | + $Connection->db->commit(); |
|
1394 | + } |
|
1240 | 1395 | } |
1241 | 1396 | return ''; |
1242 | 1397 | } |
@@ -1255,7 +1410,9 @@ discard block |
||
1255 | 1410 | $Connection = new Connection(); |
1256 | 1411 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
1257 | 1412 | { |
1258 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1413 | + if ($globalTransaction) { |
|
1414 | + $Connection->db->beginTransaction(); |
|
1415 | + } |
|
1259 | 1416 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
1260 | 1417 | { |
1261 | 1418 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1270,7 +1427,9 @@ discard block |
||
1270 | 1427 | } |
1271 | 1428 | } |
1272 | 1429 | fclose($handle); |
1273 | - if ($globalTransaction) $Connection->db->commit(); |
|
1430 | + if ($globalTransaction) { |
|
1431 | + $Connection->db->commit(); |
|
1432 | + } |
|
1274 | 1433 | } |
1275 | 1434 | return ''; |
1276 | 1435 | } |
@@ -1421,7 +1580,9 @@ discard block |
||
1421 | 1580 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1422 | 1581 | { |
1423 | 1582 | $i = 0; |
1424 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1583 | + if ($globalTransaction) { |
|
1584 | + $Connection->db->beginTransaction(); |
|
1585 | + } |
|
1425 | 1586 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1426 | 1587 | { |
1427 | 1588 | $i++; |
@@ -1449,7 +1610,9 @@ discard block |
||
1449 | 1610 | } |
1450 | 1611 | } |
1451 | 1612 | fclose($handle); |
1452 | - if ($globalTransaction) $Connection->db->commit(); |
|
1613 | + if ($globalTransaction) { |
|
1614 | + $Connection->db->commit(); |
|
1615 | + } |
|
1453 | 1616 | } |
1454 | 1617 | return ''; |
1455 | 1618 | } |
@@ -1472,7 +1635,9 @@ discard block |
||
1472 | 1635 | $Connection = new Connection(); |
1473 | 1636 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1474 | 1637 | { |
1475 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1638 | + if ($globalTransaction) { |
|
1639 | + $Connection->db->beginTransaction(); |
|
1640 | + } |
|
1476 | 1641 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1477 | 1642 | { |
1478 | 1643 | if(count($row) > 1) { |
@@ -1486,7 +1651,9 @@ discard block |
||
1486 | 1651 | } |
1487 | 1652 | } |
1488 | 1653 | fclose($handle); |
1489 | - if ($globalTransaction) $Connection->db->commit(); |
|
1654 | + if ($globalTransaction) { |
|
1655 | + $Connection->db->commit(); |
|
1656 | + } |
|
1490 | 1657 | } |
1491 | 1658 | return ''; |
1492 | 1659 | } |
@@ -1506,8 +1673,9 @@ discard block |
||
1506 | 1673 | } |
1507 | 1674 | |
1508 | 1675 | |
1509 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1510 | - else { |
|
1676 | + if ($globalDBdriver == 'mysql') { |
|
1677 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1678 | + } else { |
|
1511 | 1679 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
1512 | 1680 | $query = "CREATE EXTENSION postgis"; |
1513 | 1681 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -1526,20 +1694,30 @@ discard block |
||
1526 | 1694 | global $tmp_dir, $globalDebug; |
1527 | 1695 | include_once('class.create_db.php'); |
1528 | 1696 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1529 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
1697 | + if ($globalDebug) { |
|
1698 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
1699 | + } |
|
1530 | 1700 | update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
1531 | 1701 | $error = ''; |
1532 | 1702 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1533 | - if ($globalDebug) echo "Gunzip..."; |
|
1703 | + if ($globalDebug) { |
|
1704 | + echo "Gunzip..."; |
|
1705 | + } |
|
1534 | 1706 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
1535 | - if ($globalDebug) echo "Add to DB..."; |
|
1707 | + if ($globalDebug) { |
|
1708 | + echo "Add to DB..."; |
|
1709 | + } |
|
1536 | 1710 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
1537 | 1711 | $NOTAM = new NOTAM(); |
1538 | 1712 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
1539 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
1713 | + } else { |
|
1714 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
1715 | + } |
|
1540 | 1716 | if ($error != '') { |
1541 | 1717 | return $error; |
1542 | - } elseif ($globalDebug) echo "Done\n"; |
|
1718 | + } elseif ($globalDebug) { |
|
1719 | + echo "Done\n"; |
|
1720 | + } |
|
1543 | 1721 | return ''; |
1544 | 1722 | } |
1545 | 1723 | |
@@ -1593,67 +1771,111 @@ discard block |
||
1593 | 1771 | //if ($globalDebug) echo "IVAO : Download..."; |
1594 | 1772 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
1595 | 1773 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
1596 | - if ($globalDebug) echo "Unzip..."; |
|
1774 | + if ($globalDebug) { |
|
1775 | + echo "Unzip..."; |
|
1776 | + } |
|
1597 | 1777 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
1598 | - if ($globalDebug) echo "Add to DB..."; |
|
1778 | + if ($globalDebug) { |
|
1779 | + echo "Add to DB..."; |
|
1780 | + } |
|
1599 | 1781 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1600 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
1782 | + if ($globalDebug) { |
|
1783 | + echo "Copy airlines logos to airlines images directory..."; |
|
1784 | + } |
|
1601 | 1785 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1602 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1603 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
1604 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
1786 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
1787 | + $error = "Failed to copy airlines logo."; |
|
1788 | + } |
|
1789 | + } else { |
|
1790 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
1791 | + } |
|
1792 | + } else { |
|
1793 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
1794 | + } |
|
1605 | 1795 | if ($error != '') { |
1606 | 1796 | return $error; |
1607 | - } elseif ($globalDebug) echo "Done\n"; |
|
1797 | + } elseif ($globalDebug) { |
|
1798 | + echo "Done\n"; |
|
1799 | + } |
|
1608 | 1800 | return ''; |
1609 | 1801 | } |
1610 | 1802 | |
1611 | 1803 | public static function update_routes() { |
1612 | 1804 | global $tmp_dir, $globalDebug; |
1613 | 1805 | $error = ''; |
1614 | - if ($globalDebug) echo "Routes : Download..."; |
|
1806 | + if ($globalDebug) { |
|
1807 | + echo "Routes : Download..."; |
|
1808 | + } |
|
1615 | 1809 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
1616 | 1810 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1617 | - if ($globalDebug) echo "Gunzip..."; |
|
1811 | + if ($globalDebug) { |
|
1812 | + echo "Gunzip..."; |
|
1813 | + } |
|
1618 | 1814 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
1619 | - if ($globalDebug) echo "Add to DB..."; |
|
1815 | + if ($globalDebug) { |
|
1816 | + echo "Add to DB..."; |
|
1817 | + } |
|
1620 | 1818 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
1621 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
1819 | + } else { |
|
1820 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
1821 | + } |
|
1622 | 1822 | if ($error != '') { |
1623 | 1823 | return $error; |
1624 | - } elseif ($globalDebug) echo "Done\n"; |
|
1824 | + } elseif ($globalDebug) { |
|
1825 | + echo "Done\n"; |
|
1826 | + } |
|
1625 | 1827 | return ''; |
1626 | 1828 | } |
1627 | 1829 | public static function update_oneworld() { |
1628 | 1830 | global $tmp_dir, $globalDebug; |
1629 | 1831 | $error = ''; |
1630 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
1832 | + if ($globalDebug) { |
|
1833 | + echo "Schedules Oneworld : Download..."; |
|
1834 | + } |
|
1631 | 1835 | update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
1632 | 1836 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1633 | - if ($globalDebug) echo "Gunzip..."; |
|
1837 | + if ($globalDebug) { |
|
1838 | + echo "Gunzip..."; |
|
1839 | + } |
|
1634 | 1840 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
1635 | - if ($globalDebug) echo "Add to DB..."; |
|
1841 | + if ($globalDebug) { |
|
1842 | + echo "Add to DB..."; |
|
1843 | + } |
|
1636 | 1844 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
1637 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
1845 | + } else { |
|
1846 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
1847 | + } |
|
1638 | 1848 | if ($error != '') { |
1639 | 1849 | return $error; |
1640 | - } elseif ($globalDebug) echo "Done\n"; |
|
1850 | + } elseif ($globalDebug) { |
|
1851 | + echo "Done\n"; |
|
1852 | + } |
|
1641 | 1853 | return ''; |
1642 | 1854 | } |
1643 | 1855 | public static function update_skyteam() { |
1644 | 1856 | global $tmp_dir, $globalDebug; |
1645 | 1857 | $error = ''; |
1646 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
1858 | + if ($globalDebug) { |
|
1859 | + echo "Schedules Skyteam : Download..."; |
|
1860 | + } |
|
1647 | 1861 | update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
1648 | 1862 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1649 | - if ($globalDebug) echo "Gunzip..."; |
|
1863 | + if ($globalDebug) { |
|
1864 | + echo "Gunzip..."; |
|
1865 | + } |
|
1650 | 1866 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
1651 | - if ($globalDebug) echo "Add to DB..."; |
|
1867 | + if ($globalDebug) { |
|
1868 | + echo "Add to DB..."; |
|
1869 | + } |
|
1652 | 1870 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
1653 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
1871 | + } else { |
|
1872 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
1873 | + } |
|
1654 | 1874 | if ($error != '') { |
1655 | 1875 | return $error; |
1656 | - } elseif ($globalDebug) echo "Done\n"; |
|
1876 | + } elseif ($globalDebug) { |
|
1877 | + echo "Done\n"; |
|
1878 | + } |
|
1657 | 1879 | return ''; |
1658 | 1880 | } |
1659 | 1881 | public static function update_ModeS() { |
@@ -1670,355 +1892,619 @@ discard block |
||
1670 | 1892 | exit; |
1671 | 1893 | } elseif ($globalDebug) echo "Done\n"; |
1672 | 1894 | */ |
1673 | - if ($globalDebug) echo "Modes : Download..."; |
|
1674 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
1895 | + if ($globalDebug) { |
|
1896 | + echo "Modes : Download..."; |
|
1897 | + } |
|
1898 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
1675 | 1899 | update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
1676 | 1900 | |
1677 | 1901 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
1678 | 1902 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
1679 | - if ($globalDebug) echo "Unzip..."; |
|
1680 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
1903 | + if ($globalDebug) { |
|
1904 | + echo "Unzip..."; |
|
1905 | + } |
|
1906 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
1681 | 1907 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
1682 | - if ($globalDebug) echo "Add to DB..."; |
|
1908 | + if ($globalDebug) { |
|
1909 | + echo "Add to DB..."; |
|
1910 | + } |
|
1683 | 1911 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
1684 | 1912 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
1685 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
1913 | + } else { |
|
1914 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
1915 | + } |
|
1686 | 1916 | if ($error != '') { |
1687 | 1917 | return $error; |
1688 | - } elseif ($globalDebug) echo "Done\n"; |
|
1918 | + } elseif ($globalDebug) { |
|
1919 | + echo "Done\n"; |
|
1920 | + } |
|
1689 | 1921 | return ''; |
1690 | 1922 | } |
1691 | 1923 | |
1692 | 1924 | public static function update_ModeS_faa() { |
1693 | 1925 | global $tmp_dir, $globalDebug; |
1694 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
1926 | + if ($globalDebug) { |
|
1927 | + echo "Modes FAA: Download..."; |
|
1928 | + } |
|
1695 | 1929 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
1696 | 1930 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
1697 | - if ($globalDebug) echo "Unzip..."; |
|
1931 | + if ($globalDebug) { |
|
1932 | + echo "Unzip..."; |
|
1933 | + } |
|
1698 | 1934 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
1699 | - if ($globalDebug) echo "Add to DB..."; |
|
1935 | + if ($globalDebug) { |
|
1936 | + echo "Add to DB..."; |
|
1937 | + } |
|
1700 | 1938 | $error = update_db::modes_faa(); |
1701 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
1939 | + } else { |
|
1940 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
1941 | + } |
|
1702 | 1942 | if ($error != '') { |
1703 | 1943 | return $error; |
1704 | - } elseif ($globalDebug) echo "Done\n"; |
|
1944 | + } elseif ($globalDebug) { |
|
1945 | + echo "Done\n"; |
|
1946 | + } |
|
1705 | 1947 | return ''; |
1706 | 1948 | } |
1707 | 1949 | |
1708 | 1950 | public static function update_ModeS_flarm() { |
1709 | 1951 | global $tmp_dir, $globalDebug; |
1710 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
1952 | + if ($globalDebug) { |
|
1953 | + echo "Modes Flarmnet: Download..."; |
|
1954 | + } |
|
1711 | 1955 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
1712 | 1956 | if (file_exists($tmp_dir.'data.fln')) { |
1713 | - if ($globalDebug) echo "Add to DB..."; |
|
1957 | + if ($globalDebug) { |
|
1958 | + echo "Add to DB..."; |
|
1959 | + } |
|
1714 | 1960 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
1715 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
1961 | + } else { |
|
1962 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
1963 | + } |
|
1716 | 1964 | if ($error != '') { |
1717 | 1965 | return $error; |
1718 | - } elseif ($globalDebug) echo "Done\n"; |
|
1966 | + } elseif ($globalDebug) { |
|
1967 | + echo "Done\n"; |
|
1968 | + } |
|
1719 | 1969 | return ''; |
1720 | 1970 | } |
1721 | 1971 | |
1722 | 1972 | public static function update_ModeS_ogn() { |
1723 | 1973 | global $tmp_dir, $globalDebug; |
1724 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
1974 | + if ($globalDebug) { |
|
1975 | + echo "Modes OGN: Download..."; |
|
1976 | + } |
|
1725 | 1977 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
1726 | 1978 | if (file_exists($tmp_dir.'ogn.csv')) { |
1727 | - if ($globalDebug) echo "Add to DB..."; |
|
1979 | + if ($globalDebug) { |
|
1980 | + echo "Add to DB..."; |
|
1981 | + } |
|
1728 | 1982 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
1729 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
1983 | + } else { |
|
1984 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
1985 | + } |
|
1730 | 1986 | if ($error != '') { |
1731 | 1987 | return $error; |
1732 | - } elseif ($globalDebug) echo "Done\n"; |
|
1988 | + } elseif ($globalDebug) { |
|
1989 | + echo "Done\n"; |
|
1990 | + } |
|
1733 | 1991 | return ''; |
1734 | 1992 | } |
1735 | 1993 | |
1736 | 1994 | public static function update_owner() { |
1737 | 1995 | global $tmp_dir, $globalDebug, $globalMasterSource; |
1738 | 1996 | |
1739 | - if ($globalDebug) echo "Owner France: Download..."; |
|
1997 | + if ($globalDebug) { |
|
1998 | + echo "Owner France: Download..."; |
|
1999 | + } |
|
1740 | 2000 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
1741 | 2001 | if (file_exists($tmp_dir.'owner_f.csv')) { |
1742 | - if ($globalDebug) echo "Add to DB..."; |
|
2002 | + if ($globalDebug) { |
|
2003 | + echo "Add to DB..."; |
|
2004 | + } |
|
1743 | 2005 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
1744 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2006 | + } else { |
|
2007 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2008 | + } |
|
1745 | 2009 | if ($error != '') { |
1746 | 2010 | return $error; |
1747 | - } elseif ($globalDebug) echo "Done\n"; |
|
2011 | + } elseif ($globalDebug) { |
|
2012 | + echo "Done\n"; |
|
2013 | + } |
|
1748 | 2014 | |
1749 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
2015 | + if ($globalDebug) { |
|
2016 | + echo "Owner Ireland: Download..."; |
|
2017 | + } |
|
1750 | 2018 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
1751 | 2019 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
1752 | - if ($globalDebug) echo "Add to DB..."; |
|
2020 | + if ($globalDebug) { |
|
2021 | + echo "Add to DB..."; |
|
2022 | + } |
|
1753 | 2023 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
1754 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2024 | + } else { |
|
2025 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2026 | + } |
|
1755 | 2027 | if ($error != '') { |
1756 | 2028 | return $error; |
1757 | - } elseif ($globalDebug) echo "Done\n"; |
|
1758 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
2029 | + } elseif ($globalDebug) { |
|
2030 | + echo "Done\n"; |
|
2031 | + } |
|
2032 | + if ($globalDebug) { |
|
2033 | + echo "Owner Switzerland: Download..."; |
|
2034 | + } |
|
1759 | 2035 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
1760 | 2036 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
1761 | - if ($globalDebug) echo "Add to DB..."; |
|
2037 | + if ($globalDebug) { |
|
2038 | + echo "Add to DB..."; |
|
2039 | + } |
|
1762 | 2040 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
1763 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2041 | + } else { |
|
2042 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2043 | + } |
|
1764 | 2044 | if ($error != '') { |
1765 | 2045 | return $error; |
1766 | - } elseif ($globalDebug) echo "Done\n"; |
|
1767 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
2046 | + } elseif ($globalDebug) { |
|
2047 | + echo "Done\n"; |
|
2048 | + } |
|
2049 | + if ($globalDebug) { |
|
2050 | + echo "Owner Czech Republic: Download..."; |
|
2051 | + } |
|
1768 | 2052 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
1769 | 2053 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
1770 | - if ($globalDebug) echo "Add to DB..."; |
|
2054 | + if ($globalDebug) { |
|
2055 | + echo "Add to DB..."; |
|
2056 | + } |
|
1771 | 2057 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
1772 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2058 | + } else { |
|
2059 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2060 | + } |
|
1773 | 2061 | if ($error != '') { |
1774 | 2062 | return $error; |
1775 | - } elseif ($globalDebug) echo "Done\n"; |
|
1776 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
2063 | + } elseif ($globalDebug) { |
|
2064 | + echo "Done\n"; |
|
2065 | + } |
|
2066 | + if ($globalDebug) { |
|
2067 | + echo "Owner Australia: Download..."; |
|
2068 | + } |
|
1777 | 2069 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
1778 | 2070 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
1779 | - if ($globalDebug) echo "Add to DB..."; |
|
2071 | + if ($globalDebug) { |
|
2072 | + echo "Add to DB..."; |
|
2073 | + } |
|
1780 | 2074 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
1781 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2075 | + } else { |
|
2076 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2077 | + } |
|
1782 | 2078 | if ($error != '') { |
1783 | 2079 | return $error; |
1784 | - } elseif ($globalDebug) echo "Done\n"; |
|
1785 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
2080 | + } elseif ($globalDebug) { |
|
2081 | + echo "Done\n"; |
|
2082 | + } |
|
2083 | + if ($globalDebug) { |
|
2084 | + echo "Owner Austria: Download..."; |
|
2085 | + } |
|
1786 | 2086 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
1787 | 2087 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
1788 | - if ($globalDebug) echo "Add to DB..."; |
|
2088 | + if ($globalDebug) { |
|
2089 | + echo "Add to DB..."; |
|
2090 | + } |
|
1789 | 2091 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
1790 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2092 | + } else { |
|
2093 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2094 | + } |
|
1791 | 2095 | if ($error != '') { |
1792 | 2096 | return $error; |
1793 | - } elseif ($globalDebug) echo "Done\n"; |
|
1794 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
2097 | + } elseif ($globalDebug) { |
|
2098 | + echo "Done\n"; |
|
2099 | + } |
|
2100 | + if ($globalDebug) { |
|
2101 | + echo "Owner Chile: Download..."; |
|
2102 | + } |
|
1795 | 2103 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
1796 | 2104 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
1797 | - if ($globalDebug) echo "Add to DB..."; |
|
2105 | + if ($globalDebug) { |
|
2106 | + echo "Add to DB..."; |
|
2107 | + } |
|
1798 | 2108 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
1799 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2109 | + } else { |
|
2110 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2111 | + } |
|
1800 | 2112 | if ($error != '') { |
1801 | 2113 | return $error; |
1802 | - } elseif ($globalDebug) echo "Done\n"; |
|
1803 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
2114 | + } elseif ($globalDebug) { |
|
2115 | + echo "Done\n"; |
|
2116 | + } |
|
2117 | + if ($globalDebug) { |
|
2118 | + echo "Owner Colombia: Download..."; |
|
2119 | + } |
|
1804 | 2120 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
1805 | 2121 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
1806 | - if ($globalDebug) echo "Add to DB..."; |
|
2122 | + if ($globalDebug) { |
|
2123 | + echo "Add to DB..."; |
|
2124 | + } |
|
1807 | 2125 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
1808 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2126 | + } else { |
|
2127 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2128 | + } |
|
1809 | 2129 | if ($error != '') { |
1810 | 2130 | return $error; |
1811 | - } elseif ($globalDebug) echo "Done\n"; |
|
1812 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
2131 | + } elseif ($globalDebug) { |
|
2132 | + echo "Done\n"; |
|
2133 | + } |
|
2134 | + if ($globalDebug) { |
|
2135 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
2136 | + } |
|
1813 | 2137 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
1814 | 2138 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
1815 | - if ($globalDebug) echo "Add to DB..."; |
|
2139 | + if ($globalDebug) { |
|
2140 | + echo "Add to DB..."; |
|
2141 | + } |
|
1816 | 2142 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
1817 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2143 | + } else { |
|
2144 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2145 | + } |
|
1818 | 2146 | if ($error != '') { |
1819 | 2147 | return $error; |
1820 | - } elseif ($globalDebug) echo "Done\n"; |
|
1821 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
2148 | + } elseif ($globalDebug) { |
|
2149 | + echo "Done\n"; |
|
2150 | + } |
|
2151 | + if ($globalDebug) { |
|
2152 | + echo "Owner Brazil: Download..."; |
|
2153 | + } |
|
1822 | 2154 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
1823 | 2155 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
1824 | - if ($globalDebug) echo "Add to DB..."; |
|
2156 | + if ($globalDebug) { |
|
2157 | + echo "Add to DB..."; |
|
2158 | + } |
|
1825 | 2159 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
1826 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2160 | + } else { |
|
2161 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2162 | + } |
|
1827 | 2163 | if ($error != '') { |
1828 | 2164 | return $error; |
1829 | - } elseif ($globalDebug) echo "Done\n"; |
|
1830 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
2165 | + } elseif ($globalDebug) { |
|
2166 | + echo "Done\n"; |
|
2167 | + } |
|
2168 | + if ($globalDebug) { |
|
2169 | + echo "Owner Cayman Islands: Download..."; |
|
2170 | + } |
|
1831 | 2171 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
1832 | 2172 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
1833 | - if ($globalDebug) echo "Add to DB..."; |
|
2173 | + if ($globalDebug) { |
|
2174 | + echo "Add to DB..."; |
|
2175 | + } |
|
1834 | 2176 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
1835 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2177 | + } else { |
|
2178 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2179 | + } |
|
1836 | 2180 | if ($error != '') { |
1837 | 2181 | return $error; |
1838 | - } elseif ($globalDebug) echo "Done\n"; |
|
1839 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
2182 | + } elseif ($globalDebug) { |
|
2183 | + echo "Done\n"; |
|
2184 | + } |
|
2185 | + if ($globalDebug) { |
|
2186 | + echo "Owner Croatia: Download..."; |
|
2187 | + } |
|
1840 | 2188 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
1841 | 2189 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
1842 | - if ($globalDebug) echo "Add to DB..."; |
|
2190 | + if ($globalDebug) { |
|
2191 | + echo "Add to DB..."; |
|
2192 | + } |
|
1843 | 2193 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
1844 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2194 | + } else { |
|
2195 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2196 | + } |
|
1845 | 2197 | if ($error != '') { |
1846 | 2198 | return $error; |
1847 | - } elseif ($globalDebug) echo "Done\n"; |
|
1848 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
2199 | + } elseif ($globalDebug) { |
|
2200 | + echo "Done\n"; |
|
2201 | + } |
|
2202 | + if ($globalDebug) { |
|
2203 | + echo "Owner Luxembourg: Download..."; |
|
2204 | + } |
|
1849 | 2205 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
1850 | 2206 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
1851 | - if ($globalDebug) echo "Add to DB..."; |
|
2207 | + if ($globalDebug) { |
|
2208 | + echo "Add to DB..."; |
|
2209 | + } |
|
1852 | 2210 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
1853 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2211 | + } else { |
|
2212 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2213 | + } |
|
1854 | 2214 | if ($error != '') { |
1855 | 2215 | return $error; |
1856 | - } elseif ($globalDebug) echo "Done\n"; |
|
1857 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
2216 | + } elseif ($globalDebug) { |
|
2217 | + echo "Done\n"; |
|
2218 | + } |
|
2219 | + if ($globalDebug) { |
|
2220 | + echo "Owner Maldives: Download..."; |
|
2221 | + } |
|
1858 | 2222 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
1859 | 2223 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
1860 | - if ($globalDebug) echo "Add to DB..."; |
|
2224 | + if ($globalDebug) { |
|
2225 | + echo "Add to DB..."; |
|
2226 | + } |
|
1861 | 2227 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
1862 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2228 | + } else { |
|
2229 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2230 | + } |
|
1863 | 2231 | if ($error != '') { |
1864 | 2232 | return $error; |
1865 | - } elseif ($globalDebug) echo "Done\n"; |
|
1866 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
2233 | + } elseif ($globalDebug) { |
|
2234 | + echo "Done\n"; |
|
2235 | + } |
|
2236 | + if ($globalDebug) { |
|
2237 | + echo "Owner New Zealand: Download..."; |
|
2238 | + } |
|
1867 | 2239 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
1868 | 2240 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
1869 | - if ($globalDebug) echo "Add to DB..."; |
|
2241 | + if ($globalDebug) { |
|
2242 | + echo "Add to DB..."; |
|
2243 | + } |
|
1870 | 2244 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
1871 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2245 | + } else { |
|
2246 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2247 | + } |
|
1872 | 2248 | if ($error != '') { |
1873 | 2249 | return $error; |
1874 | - } elseif ($globalDebug) echo "Done\n"; |
|
1875 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
2250 | + } elseif ($globalDebug) { |
|
2251 | + echo "Done\n"; |
|
2252 | + } |
|
2253 | + if ($globalDebug) { |
|
2254 | + echo "Owner Papua New Guinea: Download..."; |
|
2255 | + } |
|
1876 | 2256 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
1877 | 2257 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
1878 | - if ($globalDebug) echo "Add to DB..."; |
|
2258 | + if ($globalDebug) { |
|
2259 | + echo "Add to DB..."; |
|
2260 | + } |
|
1879 | 2261 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
1880 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2262 | + } else { |
|
2263 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2264 | + } |
|
1881 | 2265 | if ($error != '') { |
1882 | 2266 | return $error; |
1883 | - } elseif ($globalDebug) echo "Done\n"; |
|
1884 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
2267 | + } elseif ($globalDebug) { |
|
2268 | + echo "Done\n"; |
|
2269 | + } |
|
2270 | + if ($globalDebug) { |
|
2271 | + echo "Owner Slovakia: Download..."; |
|
2272 | + } |
|
1885 | 2273 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
1886 | 2274 | if (file_exists($tmp_dir.'owner_om.csv')) { |
1887 | - if ($globalDebug) echo "Add to DB..."; |
|
2275 | + if ($globalDebug) { |
|
2276 | + echo "Add to DB..."; |
|
2277 | + } |
|
1888 | 2278 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
1889 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2279 | + } else { |
|
2280 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2281 | + } |
|
1890 | 2282 | if ($error != '') { |
1891 | 2283 | return $error; |
1892 | - } elseif ($globalDebug) echo "Done\n"; |
|
1893 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
2284 | + } elseif ($globalDebug) { |
|
2285 | + echo "Done\n"; |
|
2286 | + } |
|
2287 | + if ($globalDebug) { |
|
2288 | + echo "Owner Ecuador: Download..."; |
|
2289 | + } |
|
1894 | 2290 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
1895 | 2291 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
1896 | - if ($globalDebug) echo "Add to DB..."; |
|
2292 | + if ($globalDebug) { |
|
2293 | + echo "Add to DB..."; |
|
2294 | + } |
|
1897 | 2295 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
1898 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2296 | + } else { |
|
2297 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2298 | + } |
|
1899 | 2299 | if ($error != '') { |
1900 | 2300 | return $error; |
1901 | - } elseif ($globalDebug) echo "Done\n"; |
|
1902 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
2301 | + } elseif ($globalDebug) { |
|
2302 | + echo "Done\n"; |
|
2303 | + } |
|
2304 | + if ($globalDebug) { |
|
2305 | + echo "Owner Iceland: Download..."; |
|
2306 | + } |
|
1903 | 2307 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
1904 | 2308 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
1905 | - if ($globalDebug) echo "Add to DB..."; |
|
2309 | + if ($globalDebug) { |
|
2310 | + echo "Add to DB..."; |
|
2311 | + } |
|
1906 | 2312 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
1907 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2313 | + } else { |
|
2314 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2315 | + } |
|
1908 | 2316 | if ($error != '') { |
1909 | 2317 | return $error; |
1910 | - } elseif ($globalDebug) echo "Done\n"; |
|
1911 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
2318 | + } elseif ($globalDebug) { |
|
2319 | + echo "Done\n"; |
|
2320 | + } |
|
2321 | + if ($globalDebug) { |
|
2322 | + echo "Owner Isle of Man: Download..."; |
|
2323 | + } |
|
1912 | 2324 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
1913 | 2325 | if (file_exists($tmp_dir.'owner_m.csv')) { |
1914 | - if ($globalDebug) echo "Add to DB..."; |
|
2326 | + if ($globalDebug) { |
|
2327 | + echo "Add to DB..."; |
|
2328 | + } |
|
1915 | 2329 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
1916 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2330 | + } else { |
|
2331 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2332 | + } |
|
1917 | 2333 | if ($error != '') { |
1918 | 2334 | return $error; |
1919 | - } elseif ($globalDebug) echo "Done\n"; |
|
2335 | + } elseif ($globalDebug) { |
|
2336 | + echo "Done\n"; |
|
2337 | + } |
|
1920 | 2338 | if ($globalMasterSource) { |
1921 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
2339 | + if ($globalDebug) { |
|
2340 | + echo "ModeS Netherlands: Download..."; |
|
2341 | + } |
|
1922 | 2342 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
1923 | 2343 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
1924 | - if ($globalDebug) echo "Add to DB..."; |
|
2344 | + if ($globalDebug) { |
|
2345 | + echo "Add to DB..."; |
|
2346 | + } |
|
1925 | 2347 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
1926 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2348 | + } else { |
|
2349 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2350 | + } |
|
1927 | 2351 | if ($error != '') { |
1928 | 2352 | return $error; |
1929 | - } elseif ($globalDebug) echo "Done\n"; |
|
1930 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
2353 | + } elseif ($globalDebug) { |
|
2354 | + echo "Done\n"; |
|
2355 | + } |
|
2356 | + if ($globalDebug) { |
|
2357 | + echo "ModeS Denmark: Download..."; |
|
2358 | + } |
|
1931 | 2359 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
1932 | 2360 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
1933 | - if ($globalDebug) echo "Add to DB..."; |
|
2361 | + if ($globalDebug) { |
|
2362 | + echo "Add to DB..."; |
|
2363 | + } |
|
1934 | 2364 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
1935 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2365 | + } else { |
|
2366 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2367 | + } |
|
1936 | 2368 | if ($error != '') { |
1937 | 2369 | return $error; |
1938 | - } elseif ($globalDebug) echo "Done\n"; |
|
1939 | - } elseif ($globalDebug) echo "Done\n"; |
|
2370 | + } elseif ($globalDebug) { |
|
2371 | + echo "Done\n"; |
|
2372 | + } |
|
2373 | + } elseif ($globalDebug) { |
|
2374 | + echo "Done\n"; |
|
2375 | + } |
|
1940 | 2376 | return ''; |
1941 | 2377 | } |
1942 | 2378 | |
1943 | 2379 | public static function update_translation() { |
1944 | 2380 | global $tmp_dir, $globalDebug; |
1945 | 2381 | $error = ''; |
1946 | - if ($globalDebug) echo "Translation : Download..."; |
|
2382 | + if ($globalDebug) { |
|
2383 | + echo "Translation : Download..."; |
|
2384 | + } |
|
1947 | 2385 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
1948 | 2386 | if (file_exists($tmp_dir.'translation.zip')) { |
1949 | - if ($globalDebug) echo "Unzip..."; |
|
2387 | + if ($globalDebug) { |
|
2388 | + echo "Unzip..."; |
|
2389 | + } |
|
1950 | 2390 | update_db::unzip($tmp_dir.'translation.zip'); |
1951 | - if ($globalDebug) echo "Add to DB..."; |
|
2391 | + if ($globalDebug) { |
|
2392 | + echo "Add to DB..."; |
|
2393 | + } |
|
1952 | 2394 | $error = update_db::translation(); |
1953 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2395 | + } else { |
|
2396 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2397 | + } |
|
1954 | 2398 | if ($error != '') { |
1955 | 2399 | return $error; |
1956 | - } elseif ($globalDebug) echo "Done\n"; |
|
2400 | + } elseif ($globalDebug) { |
|
2401 | + echo "Done\n"; |
|
2402 | + } |
|
1957 | 2403 | return ''; |
1958 | 2404 | } |
1959 | 2405 | |
1960 | 2406 | public static function update_translation_fam() { |
1961 | 2407 | global $tmp_dir, $globalDebug; |
1962 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
2408 | + if ($globalDebug) { |
|
2409 | + echo "Translation from FlightAirMap website : Download..."; |
|
2410 | + } |
|
1963 | 2411 | update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
1964 | 2412 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
1965 | - if ($globalDebug) echo "Gunzip..."; |
|
2413 | + if ($globalDebug) { |
|
2414 | + echo "Gunzip..."; |
|
2415 | + } |
|
1966 | 2416 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
1967 | - if ($globalDebug) echo "Add to DB..."; |
|
2417 | + if ($globalDebug) { |
|
2418 | + echo "Add to DB..."; |
|
2419 | + } |
|
1968 | 2420 | $error = update_db::translation_fam(); |
1969 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2421 | + } else { |
|
2422 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2423 | + } |
|
1970 | 2424 | if ($error != '') { |
1971 | 2425 | return $error; |
1972 | - } elseif ($globalDebug) echo "Done\n"; |
|
2426 | + } elseif ($globalDebug) { |
|
2427 | + echo "Done\n"; |
|
2428 | + } |
|
1973 | 2429 | return ''; |
1974 | 2430 | } |
1975 | 2431 | public static function update_ModeS_fam() { |
1976 | 2432 | global $tmp_dir, $globalDebug; |
1977 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
2433 | + if ($globalDebug) { |
|
2434 | + echo "ModeS from FlightAirMap website : Download..."; |
|
2435 | + } |
|
1978 | 2436 | update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
1979 | 2437 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
1980 | - if ($globalDebug) echo "Gunzip..."; |
|
2438 | + if ($globalDebug) { |
|
2439 | + echo "Gunzip..."; |
|
2440 | + } |
|
1981 | 2441 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
1982 | - if ($globalDebug) echo "Add to DB..."; |
|
2442 | + if ($globalDebug) { |
|
2443 | + echo "Add to DB..."; |
|
2444 | + } |
|
1983 | 2445 | $error = update_db::modes_fam(); |
1984 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2446 | + } else { |
|
2447 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2448 | + } |
|
1985 | 2449 | if ($error != '') { |
1986 | 2450 | return $error; |
1987 | - } elseif ($globalDebug) echo "Done\n"; |
|
2451 | + } elseif ($globalDebug) { |
|
2452 | + echo "Done\n"; |
|
2453 | + } |
|
1988 | 2454 | return ''; |
1989 | 2455 | } |
1990 | 2456 | public static function update_owner_fam() { |
1991 | 2457 | global $tmp_dir, $globalDebug, $globalOwner; |
1992 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
2458 | + if ($globalDebug) { |
|
2459 | + echo "owner from FlightAirMap website : Download..."; |
|
2460 | + } |
|
1993 | 2461 | if ($globalOwner === TRUE) { |
1994 | 2462 | update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
1995 | 2463 | } else { |
1996 | 2464 | update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
1997 | 2465 | } |
1998 | 2466 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
1999 | - if ($globalDebug) echo "Gunzip..."; |
|
2467 | + if ($globalDebug) { |
|
2468 | + echo "Gunzip..."; |
|
2469 | + } |
|
2000 | 2470 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
2001 | - if ($globalDebug) echo "Add to DB..."; |
|
2471 | + if ($globalDebug) { |
|
2472 | + echo "Add to DB..."; |
|
2473 | + } |
|
2002 | 2474 | $error = update_db::owner_fam(); |
2003 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
2475 | + } else { |
|
2476 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
2477 | + } |
|
2004 | 2478 | if ($error != '') { |
2005 | 2479 | return $error; |
2006 | - } elseif ($globalDebug) echo "Done\n"; |
|
2480 | + } elseif ($globalDebug) { |
|
2481 | + echo "Done\n"; |
|
2482 | + } |
|
2007 | 2483 | return ''; |
2008 | 2484 | } |
2009 | 2485 | public static function update_routes_fam() { |
2010 | 2486 | global $tmp_dir, $globalDebug; |
2011 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
2487 | + if ($globalDebug) { |
|
2488 | + echo "Routes from FlightAirMap website : Download..."; |
|
2489 | + } |
|
2012 | 2490 | update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
2013 | 2491 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2014 | - if ($globalDebug) echo "Gunzip..."; |
|
2492 | + if ($globalDebug) { |
|
2493 | + echo "Gunzip..."; |
|
2494 | + } |
|
2015 | 2495 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
2016 | - if ($globalDebug) echo "Add to DB..."; |
|
2496 | + if ($globalDebug) { |
|
2497 | + echo "Add to DB..."; |
|
2498 | + } |
|
2017 | 2499 | $error = update_db::routes_fam(); |
2018 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
2500 | + } else { |
|
2501 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
2502 | + } |
|
2019 | 2503 | if ($error != '') { |
2020 | 2504 | return $error; |
2021 | - } elseif ($globalDebug) echo "Done\n"; |
|
2505 | + } elseif ($globalDebug) { |
|
2506 | + echo "Done\n"; |
|
2507 | + } |
|
2022 | 2508 | return ''; |
2023 | 2509 | } |
2024 | 2510 | public static function update_marine_identity_fam() { |
@@ -2028,14 +2514,22 @@ discard block |
||
2028 | 2514 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
2029 | 2515 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2030 | 2516 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2031 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
2517 | + if ($globalDebug) { |
|
2518 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
2519 | + } |
|
2032 | 2520 | update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
2033 | 2521 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2034 | - if ($globalDebug) echo "Gunzip..."; |
|
2522 | + if ($globalDebug) { |
|
2523 | + echo "Gunzip..."; |
|
2524 | + } |
|
2035 | 2525 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
2036 | - if ($globalDebug) echo "Add to DB..."; |
|
2526 | + if ($globalDebug) { |
|
2527 | + echo "Add to DB..."; |
|
2528 | + } |
|
2037 | 2529 | $error = update_db::marine_identity_fam(); |
2038 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
2530 | + } else { |
|
2531 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
2532 | + } |
|
2039 | 2533 | if ($error != '') { |
2040 | 2534 | return $error; |
2041 | 2535 | } elseif ($globalDebug) { |
@@ -2048,17 +2542,25 @@ discard block |
||
2048 | 2542 | } |
2049 | 2543 | public static function update_banned_fam() { |
2050 | 2544 | global $tmp_dir, $globalDebug; |
2051 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2545 | + if ($globalDebug) { |
|
2546 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2547 | + } |
|
2052 | 2548 | update_db::download('http://data.flightairmap.fr/data/ban_eu.csv',$tmp_dir.'ban_eu.csv'); |
2053 | 2549 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2054 | 2550 | //if ($globalDebug) echo "Gunzip..."; |
2055 | 2551 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
2056 | - if ($globalDebug) echo "Add to DB..."; |
|
2552 | + if ($globalDebug) { |
|
2553 | + echo "Add to DB..."; |
|
2554 | + } |
|
2057 | 2555 | $error = update_db::banned_fam(); |
2058 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
2556 | + } else { |
|
2557 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
2558 | + } |
|
2059 | 2559 | if ($error != '') { |
2060 | 2560 | return $error; |
2061 | - } elseif ($globalDebug) echo "Done\n"; |
|
2561 | + } elseif ($globalDebug) { |
|
2562 | + echo "Done\n"; |
|
2563 | + } |
|
2062 | 2564 | return ''; |
2063 | 2565 | } |
2064 | 2566 | |
@@ -2066,7 +2568,9 @@ discard block |
||
2066 | 2568 | global $tmp_dir, $globalDebug, $globalDBdriver; |
2067 | 2569 | include_once('class.create_db.php'); |
2068 | 2570 | $error = ''; |
2069 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
2571 | + if ($globalDebug) { |
|
2572 | + echo "Airspace from FlightAirMap website : Download..."; |
|
2573 | + } |
|
2070 | 2574 | if ($globalDBdriver == 'mysql') { |
2071 | 2575 | update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
2072 | 2576 | } else { |
@@ -2082,9 +2586,13 @@ discard block |
||
2082 | 2586 | update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
2083 | 2587 | } |
2084 | 2588 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2085 | - if ($globalDebug) echo "Gunzip..."; |
|
2589 | + if ($globalDebug) { |
|
2590 | + echo "Gunzip..."; |
|
2591 | + } |
|
2086 | 2592 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
2087 | - if ($globalDebug) echo "Add to DB..."; |
|
2593 | + if ($globalDebug) { |
|
2594 | + echo "Add to DB..."; |
|
2595 | + } |
|
2088 | 2596 | $Connection = new Connection(); |
2089 | 2597 | if ($Connection->tableExists('airspace')) { |
2090 | 2598 | $query = 'DROP TABLE airspace'; |
@@ -2097,31 +2605,47 @@ discard block |
||
2097 | 2605 | } |
2098 | 2606 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2099 | 2607 | update_db::insert_airspace_version($airspace_md5); |
2100 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
2608 | + } else { |
|
2609 | + $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
2610 | + } |
|
2101 | 2611 | } |
2102 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
2612 | + } else { |
|
2613 | + $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
2614 | + } |
|
2103 | 2615 | if ($error != '') { |
2104 | 2616 | return $error; |
2105 | - } elseif ($globalDebug) echo "Done\n"; |
|
2617 | + } elseif ($globalDebug) { |
|
2618 | + echo "Done\n"; |
|
2619 | + } |
|
2106 | 2620 | return ''; |
2107 | 2621 | } |
2108 | 2622 | |
2109 | 2623 | public static function update_tle() { |
2110 | 2624 | global $tmp_dir, $globalDebug; |
2111 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
2625 | + if ($globalDebug) { |
|
2626 | + echo "Download TLE : Download..."; |
|
2627 | + } |
|
2112 | 2628 | $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', |
2113 | 2629 | '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', |
2114 | 2630 | 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
2115 | 2631 | foreach ($alltle as $filename) { |
2116 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
2632 | + if ($globalDebug) { |
|
2633 | + echo "downloading ".$filename.'...'; |
|
2634 | + } |
|
2117 | 2635 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
2118 | 2636 | if (file_exists($tmp_dir.$filename)) { |
2119 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
2637 | + if ($globalDebug) { |
|
2638 | + echo "Add to DB ".$filename."..."; |
|
2639 | + } |
|
2120 | 2640 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
2121 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
2641 | + } else { |
|
2642 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
2643 | + } |
|
2122 | 2644 | if ($error != '') { |
2123 | 2645 | echo $error."\n"; |
2124 | - } elseif ($globalDebug) echo "Done\n"; |
|
2646 | + } elseif ($globalDebug) { |
|
2647 | + echo "Done\n"; |
|
2648 | + } |
|
2125 | 2649 | } |
2126 | 2650 | return ''; |
2127 | 2651 | } |
@@ -2129,10 +2653,14 @@ discard block |
||
2129 | 2653 | public static function update_models() { |
2130 | 2654 | global $tmp_dir, $globalDebug; |
2131 | 2655 | $error = ''; |
2132 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
2656 | + if ($globalDebug) { |
|
2657 | + echo "Models from FlightAirMap website : Download..."; |
|
2658 | + } |
|
2133 | 2659 | update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
2134 | 2660 | if (file_exists($tmp_dir.'models.md5sum')) { |
2135 | - if ($globalDebug) echo "Check files...\n"; |
|
2661 | + if ($globalDebug) { |
|
2662 | + echo "Check files...\n"; |
|
2663 | + } |
|
2136 | 2664 | $newmodelsdb = array(); |
2137 | 2665 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
2138 | 2666 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2151,25 +2679,35 @@ discard block |
||
2151 | 2679 | } |
2152 | 2680 | $diff = array_diff($newmodelsdb,$modelsdb); |
2153 | 2681 | foreach ($diff as $key => $value) { |
2154 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
2682 | + if ($globalDebug) { |
|
2683 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
2684 | + } |
|
2155 | 2685 | update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
2156 | 2686 | |
2157 | 2687 | } |
2158 | 2688 | update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
2159 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2689 | + } else { |
|
2690 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2691 | + } |
|
2160 | 2692 | if ($error != '') { |
2161 | 2693 | return $error; |
2162 | - } elseif ($globalDebug) echo "Done\n"; |
|
2694 | + } elseif ($globalDebug) { |
|
2695 | + echo "Done\n"; |
|
2696 | + } |
|
2163 | 2697 | return ''; |
2164 | 2698 | } |
2165 | 2699 | |
2166 | 2700 | public static function update_space_models() { |
2167 | 2701 | global $tmp_dir, $globalDebug; |
2168 | 2702 | $error = ''; |
2169 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
2703 | + if ($globalDebug) { |
|
2704 | + echo "Space models from FlightAirMap website : Download..."; |
|
2705 | + } |
|
2170 | 2706 | update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
2171 | 2707 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2172 | - if ($globalDebug) echo "Check files...\n"; |
|
2708 | + if ($globalDebug) { |
|
2709 | + echo "Check files...\n"; |
|
2710 | + } |
|
2173 | 2711 | $newmodelsdb = array(); |
2174 | 2712 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
2175 | 2713 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2188,25 +2726,35 @@ discard block |
||
2188 | 2726 | } |
2189 | 2727 | $diff = array_diff($newmodelsdb,$modelsdb); |
2190 | 2728 | foreach ($diff as $key => $value) { |
2191 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
2729 | + if ($globalDebug) { |
|
2730 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
2731 | + } |
|
2192 | 2732 | update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
2193 | 2733 | |
2194 | 2734 | } |
2195 | 2735 | update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
2196 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2736 | + } else { |
|
2737 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2738 | + } |
|
2197 | 2739 | if ($error != '') { |
2198 | 2740 | return $error; |
2199 | - } elseif ($globalDebug) echo "Done\n"; |
|
2741 | + } elseif ($globalDebug) { |
|
2742 | + echo "Done\n"; |
|
2743 | + } |
|
2200 | 2744 | return ''; |
2201 | 2745 | } |
2202 | 2746 | |
2203 | 2747 | public static function update_vehicules_models() { |
2204 | 2748 | global $tmp_dir, $globalDebug; |
2205 | 2749 | $error = ''; |
2206 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
2750 | + if ($globalDebug) { |
|
2751 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
2752 | + } |
|
2207 | 2753 | update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
2208 | 2754 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2209 | - if ($globalDebug) echo "Check files...\n"; |
|
2755 | + if ($globalDebug) { |
|
2756 | + echo "Check files...\n"; |
|
2757 | + } |
|
2210 | 2758 | $newmodelsdb = array(); |
2211 | 2759 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
2212 | 2760 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2225,15 +2773,21 @@ discard block |
||
2225 | 2773 | } |
2226 | 2774 | $diff = array_diff($newmodelsdb,$modelsdb); |
2227 | 2775 | foreach ($diff as $key => $value) { |
2228 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
2776 | + if ($globalDebug) { |
|
2777 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
2778 | + } |
|
2229 | 2779 | update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
2230 | 2780 | |
2231 | 2781 | } |
2232 | 2782 | update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
2233 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2783 | + } else { |
|
2784 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
2785 | + } |
|
2234 | 2786 | if ($error != '') { |
2235 | 2787 | return $error; |
2236 | - } elseif ($globalDebug) echo "Done\n"; |
|
2788 | + } elseif ($globalDebug) { |
|
2789 | + echo "Done\n"; |
|
2790 | + } |
|
2237 | 2791 | return ''; |
2238 | 2792 | } |
2239 | 2793 | |
@@ -2276,7 +2830,9 @@ discard block |
||
2276 | 2830 | } |
2277 | 2831 | |
2278 | 2832 | $error = ''; |
2279 | - if ($globalDebug) echo "Notam : Download..."; |
|
2833 | + if ($globalDebug) { |
|
2834 | + echo "Notam : Download..."; |
|
2835 | + } |
|
2280 | 2836 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
2281 | 2837 | if (file_exists($tmp_dir.'notam.rss')) { |
2282 | 2838 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -2291,14 +2847,30 @@ discard block |
||
2291 | 2847 | $data['fir'] = $q[0]; |
2292 | 2848 | $data['code'] = $q[1]; |
2293 | 2849 | $ifrvfr = $q[2]; |
2294 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
2295 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
2296 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
2297 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
2298 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
2299 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
2300 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
2301 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
2850 | + if ($ifrvfr == 'IV') { |
|
2851 | + $data['rules'] = 'IFR/VFR'; |
|
2852 | + } |
|
2853 | + if ($ifrvfr == 'I') { |
|
2854 | + $data['rules'] = 'IFR'; |
|
2855 | + } |
|
2856 | + if ($ifrvfr == 'V') { |
|
2857 | + $data['rules'] = 'VFR'; |
|
2858 | + } |
|
2859 | + if ($q[4] == 'A') { |
|
2860 | + $data['scope'] = 'Airport warning'; |
|
2861 | + } |
|
2862 | + if ($q[4] == 'E') { |
|
2863 | + $data['scope'] = 'Enroute warning'; |
|
2864 | + } |
|
2865 | + if ($q[4] == 'W') { |
|
2866 | + $data['scope'] = 'Navigation warning'; |
|
2867 | + } |
|
2868 | + if ($q[4] == 'AE') { |
|
2869 | + $data['scope'] = 'Airport/Enroute warning'; |
|
2870 | + } |
|
2871 | + if ($q[4] == 'AW') { |
|
2872 | + $data['scope'] = 'Airport/Navigation warning'; |
|
2873 | + } |
|
2302 | 2874 | //$data['scope'] = $q[4]; |
2303 | 2875 | $data['lower_limit'] = $q[5]; |
2304 | 2876 | $data['upper_limit'] = $q[6]; |
@@ -2306,8 +2878,12 @@ discard block |
||
2306 | 2878 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
2307 | 2879 | $latitude = $Common->convertDec($las,'latitude'); |
2308 | 2880 | $longitude = $Common->convertDec($lns,'longitude'); |
2309 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
2310 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
2881 | + if ($lac == 'S') { |
|
2882 | + $latitude = '-'.$latitude; |
|
2883 | + } |
|
2884 | + if ($lnc == 'W') { |
|
2885 | + $longitude = '-'.$longitude; |
|
2886 | + } |
|
2311 | 2887 | $data['center_latitude'] = $latitude; |
2312 | 2888 | $data['center_longitude'] = $longitude; |
2313 | 2889 | $data['radius'] = intval($radius); |
@@ -2337,10 +2913,14 @@ discard block |
||
2337 | 2913 | $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']); |
2338 | 2914 | unset($data); |
2339 | 2915 | } |
2340 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
2916 | + } else { |
|
2917 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
2918 | + } |
|
2341 | 2919 | if ($error != '') { |
2342 | 2920 | return $error; |
2343 | - } elseif ($globalDebug) echo "Done\n"; |
|
2921 | + } elseif ($globalDebug) { |
|
2922 | + echo "Done\n"; |
|
2923 | + } |
|
2344 | 2924 | return ''; |
2345 | 2925 | } |
2346 | 2926 | |
@@ -2365,7 +2945,9 @@ discard block |
||
2365 | 2945 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2366 | 2946 | $airspace_json = json_decode($airspace_lst,true); |
2367 | 2947 | foreach ($airspace_json['records'] as $airspace) { |
2368 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
2948 | + if ($globalDebug) { |
|
2949 | + echo $airspace['name']."...\n"; |
|
2950 | + } |
|
2369 | 2951 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
2370 | 2952 | if (file_exists($tmp_dir.$airspace['name'])) { |
2371 | 2953 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -2409,8 +2991,11 @@ discard block |
||
2409 | 2991 | return "error : ".$e->getMessage(); |
2410 | 2992 | } |
2411 | 2993 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2412 | - if ($row['nb'] > 0) return false; |
|
2413 | - else return true; |
|
2994 | + if ($row['nb'] > 0) { |
|
2995 | + return false; |
|
2996 | + } else { |
|
2997 | + return true; |
|
2998 | + } |
|
2414 | 2999 | } |
2415 | 3000 | |
2416 | 3001 | public static function insert_last_update() { |
@@ -2435,8 +3020,11 @@ discard block |
||
2435 | 3020 | return "error : ".$e->getMessage(); |
2436 | 3021 | } |
2437 | 3022 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2438 | - if ($row['nb'] > 0) return true; |
|
2439 | - else return false; |
|
3023 | + if ($row['nb'] > 0) { |
|
3024 | + return true; |
|
3025 | + } else { |
|
3026 | + return false; |
|
3027 | + } |
|
2440 | 3028 | } |
2441 | 3029 | |
2442 | 3030 | public static function check_marine_identity_version($version) { |
@@ -2449,8 +3037,11 @@ discard block |
||
2449 | 3037 | return "error : ".$e->getMessage(); |
2450 | 3038 | } |
2451 | 3039 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2452 | - if ($row['nb'] > 0) return true; |
|
2453 | - else return false; |
|
3040 | + if ($row['nb'] > 0) { |
|
3041 | + return true; |
|
3042 | + } else { |
|
3043 | + return false; |
|
3044 | + } |
|
2454 | 3045 | } |
2455 | 3046 | |
2456 | 3047 | |
@@ -2493,8 +3084,11 @@ discard block |
||
2493 | 3084 | return "error : ".$e->getMessage(); |
2494 | 3085 | } |
2495 | 3086 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2496 | - if ($row['nb'] > 0) return false; |
|
2497 | - else return true; |
|
3087 | + if ($row['nb'] > 0) { |
|
3088 | + return false; |
|
3089 | + } else { |
|
3090 | + return true; |
|
3091 | + } |
|
2498 | 3092 | } |
2499 | 3093 | |
2500 | 3094 | public static function insert_last_notam_update() { |
@@ -2523,8 +3117,11 @@ discard block |
||
2523 | 3117 | return "error : ".$e->getMessage(); |
2524 | 3118 | } |
2525 | 3119 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2526 | - if ($row['nb'] > 0) return false; |
|
2527 | - else return true; |
|
3120 | + if ($row['nb'] > 0) { |
|
3121 | + return false; |
|
3122 | + } else { |
|
3123 | + return true; |
|
3124 | + } |
|
2528 | 3125 | } |
2529 | 3126 | |
2530 | 3127 | public static function insert_last_airspace_update() { |
@@ -2554,8 +3151,11 @@ discard block |
||
2554 | 3151 | return "error : ".$e->getMessage(); |
2555 | 3152 | } |
2556 | 3153 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2557 | - if ($row['nb'] > 0) return false; |
|
2558 | - else return true; |
|
3154 | + if ($row['nb'] > 0) { |
|
3155 | + return false; |
|
3156 | + } else { |
|
3157 | + return true; |
|
3158 | + } |
|
2559 | 3159 | } |
2560 | 3160 | |
2561 | 3161 | public static function insert_last_owner_update() { |
@@ -2584,8 +3184,11 @@ discard block |
||
2584 | 3184 | return "error : ".$e->getMessage(); |
2585 | 3185 | } |
2586 | 3186 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2587 | - if ($row['nb'] > 0) return false; |
|
2588 | - else return true; |
|
3187 | + if ($row['nb'] > 0) { |
|
3188 | + return false; |
|
3189 | + } else { |
|
3190 | + return true; |
|
3191 | + } |
|
2589 | 3192 | } |
2590 | 3193 | |
2591 | 3194 | public static function insert_last_schedules_update() { |
@@ -2614,8 +3217,11 @@ discard block |
||
2614 | 3217 | return "error : ".$e->getMessage(); |
2615 | 3218 | } |
2616 | 3219 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2617 | - if ($row['nb'] > 0) return false; |
|
2618 | - else return true; |
|
3220 | + if ($row['nb'] > 0) { |
|
3221 | + return false; |
|
3222 | + } else { |
|
3223 | + return true; |
|
3224 | + } |
|
2619 | 3225 | } |
2620 | 3226 | |
2621 | 3227 | public static function insert_last_tle_update() { |
@@ -2644,8 +3250,11 @@ discard block |
||
2644 | 3250 | return "error : ".$e->getMessage(); |
2645 | 3251 | } |
2646 | 3252 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2647 | - if ($row['nb'] > 0) return false; |
|
2648 | - else return true; |
|
3253 | + if ($row['nb'] > 0) { |
|
3254 | + return false; |
|
3255 | + } else { |
|
3256 | + return true; |
|
3257 | + } |
|
2649 | 3258 | } |
2650 | 3259 | |
2651 | 3260 | public static function insert_last_marine_identity_update() { |
@@ -4,7 +4,9 @@ |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Airline by Country"); |
7 | -if (!isset($filter_name)) $filter_name = ''; |
|
7 | +if (!isset($filter_name)) { |
|
8 | + $filter_name = ''; |
|
9 | +} |
|
8 | 10 | require_once('header.php'); |
9 | 11 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
10 | 12 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Airline by Country"); |
7 | 7 | if (!isset($filter_name)) $filter_name = ''; |
8 | 8 | require_once('header.php'); |
9 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
10 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
9 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
11 | 11 | include('statistics-sub-menu.php'); |
12 | 12 | |
13 | 13 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | </div> |
19 | 19 | <p>'._("Below are the <strong>Top 10</strong> countries that an airline belongs to.").'</p>'; |
20 | 20 | |
21 | -$airline_array = $Stats->countAllAirlineCountries(true,$filter_name,$year,$month); |
|
21 | +$airline_array = $Stats->countAllAirlineCountries(true, $filter_name, $year, $month); |
|
22 | 22 | if (count($airline_array) > 0) { |
23 | 23 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
24 | 24 | $country_data = ''; |
25 | -foreach($airline_array as $airline_item) |
|
25 | +foreach ($airline_array as $airline_item) |
|
26 | 26 | { |
27 | 27 | $country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],'; |
28 | 28 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | print '</thead>'; |
70 | 70 | print '<tbody>'; |
71 | 71 | $i = 1; |
72 | - foreach($airline_array as $airline_item) |
|
72 | + foreach ($airline_array as $airline_item) |
|
73 | 73 | { |
74 | 74 | print '<tr>'; |
75 | 75 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,7 +5,9 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Airline"); |
7 | 7 | require_once('header.php'); |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
10 | 12 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
11 | 13 | include('statistics-sub-menu.php'); |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Airline"); |
7 | 7 | require_once('header.php'); |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
10 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
9 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
11 | 11 | include('statistics-sub-menu.php'); |
12 | 12 | |
13 | 13 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | </div> |
18 | 18 | <p>'._("Below are the <strong>Top 10</strong> most common airlines.").'</p>'; |
19 | 19 | |
20 | -$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
20 | +$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
21 | 21 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
22 | 22 | $airline_data = ''; |
23 | -foreach($airline_array as $airline_item) |
|
23 | +foreach ($airline_array as $airline_item) |
|
24 | 24 | { |
25 | 25 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
26 | 26 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | print '</thead>'; |
48 | 48 | print '<tbody>'; |
49 | 49 | $i = 1; |
50 | - foreach($airline_array as $airline_item) |
|
50 | + foreach ($airline_array as $airline_item) |
|
51 | 51 | { |
52 | 52 | print '<tr>'; |
53 | 53 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['owner'])) { |
6 | - header('Location: '.$globalURL.'/owner'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/owner'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
@@ -7,22 +7,22 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
17 | 17 | if ($sort != '') { |
18 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
18 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
19 | 19 | } else { |
20 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", '',$filter); |
|
20 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", '', $filter); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | if (!empty($spotter_array)) |
24 | 24 | { |
25 | - $title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['aircraft_owner']); |
|
25 | + $title = sprintf(_("Most Common Aircraft of %s"), $spotter_array[0]['aircraft_owner']); |
|
26 | 26 | require_once('header.php'); |
27 | 27 | print '<div class="info column">'; |
28 | 28 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -33,9 +33,9 @@ discard block |
||
33 | 33 | include('owner-sub-menu.php'); |
34 | 34 | print '<div class="column">'; |
35 | 35 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
36 | - print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
36 | + print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
37 | 37 | |
38 | - $aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner,$filter); |
|
38 | + $aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner, $filter); |
|
39 | 39 | if (!empty($aircraft_array)) |
40 | 40 | { |
41 | 41 | print '<div class="table-responsive">'; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | print '</thead>'; |
48 | 48 | print '<tbody>'; |
49 | 49 | $i = 1; |
50 | - foreach($aircraft_array as $aircraft_item) |
|
50 | + foreach ($aircraft_array as $aircraft_item) |
|
51 | 51 | { |
52 | 52 | print '<tr>'; |
53 | 53 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -12,8 +12,12 @@ |
||
12 | 12 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
13 | 13 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
15 | +if ($year != '') { |
|
16 | + $filter = array_merge($filter,array('year' => $year)); |
|
17 | +} |
|
18 | +if ($month != '') { |
|
19 | + $filter = array_merge($filter,array('month' => $month)); |
|
20 | +} |
|
17 | 21 | if ($sort != '') { |
18 | 22 | $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
19 | 23 | } else { |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['pilot'])) { |
6 | - header('Location: '.$globalURL.'/pilot'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/pilot'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING); |
|
12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING); |
|
12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | -$spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter); |
|
15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
17 | +$spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort, $filter); |
|
18 | 18 | |
19 | 19 | if (!empty($spotter_array)) |
20 | 20 | { |
21 | - $title = sprintf(_("Most Common Time of Day of %s"),$spotter_array[0]['pilot_name']); |
|
21 | + $title = sprintf(_("Most Common Time of Day of %s"), $spotter_array[0]['pilot_name']); |
|
22 | 22 | require_once('header.php'); |
23 | 23 | print '<div class="info column">'; |
24 | 24 | print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>'; |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | include('owner-sub-menu.php'); |
30 | 30 | print '<div class="column">'; |
31 | 31 | print '<h2>'._("Most Common Time of Day").'</h2>'; |
32 | - print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>'; |
|
32 | + print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights piloted by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>'; |
|
33 | 33 | |
34 | - $hour_array = $Spotter->countAllHoursByPilot($pilot,$filter); |
|
34 | + $hour_array = $Spotter->countAllHoursByPilot($pilot, $filter); |
|
35 | 35 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
36 | 36 | print '<div id="chartHour" class="chart" width="100%"></div> |
37 | 37 | <script> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | var data = google.visualization.arrayToDataTable([ |
42 | 42 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
43 | 43 | $hour_data = ''; |
44 | - foreach($hour_array as $hour_item) |
|
44 | + foreach ($hour_array as $hour_item) |
|
45 | 45 | { |
46 | 46 | $hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],'; |
47 | 47 | } |
@@ -12,8 +12,12 @@ |
||
12 | 12 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
13 | 13 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
15 | +if ($year != '') { |
|
16 | + $filter = array_merge($filter,array('year' => $year)); |
|
17 | +} |
|
18 | +if ($month != '') { |
|
19 | + $filter = array_merge($filter,array('month' => $month)); |
|
20 | +} |
|
17 | 21 | $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter); |
18 | 22 | |
19 | 23 | if (!empty($spotter_array)) |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['owner'])) { |
6 | - header('Location: '.$globalURL.'/owner'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/owner'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
17 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
18 | 18 | |
19 | 19 | if (!empty($spotter_array)) |
20 | 20 | { |
21 | - $title = sprintf(_("Most Common Aircraft by Registration of %s"),$spotter_array[0]['aircraft_owner']); |
|
21 | + $title = sprintf(_("Most Common Aircraft by Registration of %s"), $spotter_array[0]['aircraft_owner']); |
|
22 | 22 | require_once('header.php'); |
23 | 23 | print '<div class="info column">'; |
24 | 24 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | include('owner-sub-menu.php'); |
30 | 30 | print '<div class="column">'; |
31 | 31 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
32 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
32 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
33 | 33 | |
34 | - $aircraft_array = $Spotter->countAllAircraftRegistrationByOwner($owner,$filter); |
|
34 | + $aircraft_array = $Spotter->countAllAircraftRegistrationByOwner($owner, $filter); |
|
35 | 35 | |
36 | 36 | if (!empty($aircraft_array)) |
37 | 37 | { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | print '</thead>'; |
48 | 48 | print '<tbody>'; |
49 | 49 | $i = 1; |
50 | - foreach($aircraft_array as $aircraft_item) |
|
50 | + foreach ($aircraft_array as $aircraft_item) |
|
51 | 51 | { |
52 | 52 | print '<tr>'; |
53 | 53 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -12,8 +12,12 @@ |
||
12 | 12 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
13 | 13 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
15 | +if ($year != '') { |
|
16 | + $filter = array_merge($filter,array('year' => $year)); |
|
17 | +} |
|
18 | +if ($month != '') { |
|
19 | + $filter = array_merge($filter,array('month' => $month)); |
|
20 | +} |
|
17 | 21 | $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
18 | 22 | |
19 | 23 | if (!empty($spotter_array)) |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['pilot'])) { |
6 | - header('Location: '.$globalURL.'/pilot'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/pilot'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING); |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING); |
|
11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING); |
|
11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | -$spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter); |
|
15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
17 | +$spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort, $filter); |
|
18 | 18 | |
19 | 19 | if (!empty($spotter_array)) |
20 | 20 | { |
21 | - $title = sprintf(_("Most Common Aircraft by Registration of %s"),$spotter_array[0]['pilot_name']); |
|
21 | + $title = sprintf(_("Most Common Aircraft by Registration of %s"), $spotter_array[0]['pilot_name']); |
|
22 | 22 | require_once('header.php'); |
23 | 23 | print '<div class="info column">'; |
24 | 24 | print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>'; |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | include('pilot-sub-menu.php'); |
30 | 30 | print '<div class="column">'; |
31 | 31 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
32 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>'; |
|
32 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights piloted by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>'; |
|
33 | 33 | |
34 | - $aircraft_array = $Spotter->countAllAircraftRegistrationByPilot($pilot,$filter); |
|
34 | + $aircraft_array = $Spotter->countAllAircraftRegistrationByPilot($pilot, $filter); |
|
35 | 35 | |
36 | 36 | if (!empty($aircraft_array)) |
37 | 37 | { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | print '</thead>'; |
48 | 48 | print '<tbody>'; |
49 | 49 | $i = 1; |
50 | - foreach($aircraft_array as $aircraft_item) |
|
50 | + foreach ($aircraft_array as $aircraft_item) |
|
51 | 51 | { |
52 | 52 | print '<tr>'; |
53 | 53 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -12,8 +12,12 @@ |
||
12 | 12 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
13 | 13 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
15 | +if ($year != '') { |
|
16 | + $filter = array_merge($filter,array('year' => $year)); |
|
17 | +} |
|
18 | +if ($month != '') { |
|
19 | + $filter = array_merge($filter,array('month' => $month)); |
|
20 | +} |
|
17 | 21 | $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter); |
18 | 22 | |
19 | 23 | if (!empty($spotter_array)) |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['owner'])) { |
6 | - header('Location: '.$globalURL.'/owner'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/owner'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
17 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
18 | 18 | |
19 | 19 | if (!empty($spotter_array)) |
20 | 20 | { |
21 | - $title = sprintf(_("Most Common Time of Day of %s"),$spotter_array[0]['aircraft_owner']); |
|
21 | + $title = sprintf(_("Most Common Time of Day of %s"), $spotter_array[0]['aircraft_owner']); |
|
22 | 22 | require_once('header.php'); |
23 | 23 | print '<div class="info column">'; |
24 | 24 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | include('owner-sub-menu.php'); |
30 | 30 | print '<div class="column">'; |
31 | 31 | print '<h2>'._("Most Common Time of Day").'</h2>'; |
32 | - print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
32 | + print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
33 | 33 | |
34 | - $hour_array = $Spotter->countAllHoursByOwner($owner,$filter); |
|
34 | + $hour_array = $Spotter->countAllHoursByOwner($owner, $filter); |
|
35 | 35 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
36 | 36 | print '<div id="chartHour" class="chart" width="100%"></div> |
37 | 37 | <script> |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | var data = google.visualization.arrayToDataTable([ |
42 | 42 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
43 | 43 | $hour_data = ''; |
44 | - foreach($hour_array as $hour_item) |
|
44 | + foreach ($hour_array as $hour_item) |
|
45 | 45 | { |
46 | 46 | $hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],'; |
47 | 47 | } |
@@ -12,8 +12,12 @@ |
||
12 | 12 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
13 | 13 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
14 | 14 | $filter = array(); |
15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
15 | +if ($year != '') { |
|
16 | + $filter = array_merge($filter,array('year' => $year)); |
|
17 | +} |
|
18 | +if ($month != '') { |
|
19 | + $filter = array_merge($filter,array('month' => $month)); |
|
20 | +} |
|
17 | 21 | $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
18 | 22 | |
19 | 23 | if (!empty($spotter_array)) |