@@ -85,38 +85,38 @@ discard block |
||
85 | 85 | try { |
86 | 86 | //$Connection = new Connection(); |
87 | 87 | $sth = $Connection->db->prepare($query); |
88 | - $sth->execute(array(':source' => $database_file)); |
|
89 | - } catch(PDOException $e) { |
|
90 | - return "error : ".$e->getMessage(); |
|
91 | - } |
|
88 | + $sth->execute(array(':source' => $database_file)); |
|
89 | + } catch(PDOException $e) { |
|
90 | + return "error : ".$e->getMessage(); |
|
91 | + } |
|
92 | 92 | |
93 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
94 | - update_db::connect_sqlite($database_file); |
|
93 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
94 | + update_db::connect_sqlite($database_file); |
|
95 | 95 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
96 | 96 | $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"; |
97 | 97 | try { |
98 | - $sth = update_db::$db_sqlite->prepare($query); |
|
99 | - $sth->execute(); |
|
100 | - } catch(PDOException $e) { |
|
101 | - return "error : ".$e->getMessage(); |
|
102 | - } |
|
98 | + $sth = update_db::$db_sqlite->prepare($query); |
|
99 | + $sth->execute(); |
|
100 | + } catch(PDOException $e) { |
|
101 | + return "error : ".$e->getMessage(); |
|
102 | + } |
|
103 | 103 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
104 | 104 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
105 | 105 | $Connection = new Connection(); |
106 | 106 | $sth_dest = $Connection->db->prepare($query_dest); |
107 | 107 | try { |
108 | 108 | if ($globalTransaction) $Connection->db->beginTransaction(); |
109 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
109 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
110 | 110 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
111 | 111 | $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
112 | 112 | $sth_dest->execute($query_dest_values); |
113 | - } |
|
113 | + } |
|
114 | 114 | if ($globalTransaction) $Connection->db->commit(); |
115 | 115 | } catch(PDOException $e) { |
116 | 116 | if ($globalTransaction) $Connection->db->rollBack(); |
117 | 117 | return "error : ".$e->getMessage(); |
118 | 118 | } |
119 | - return ''; |
|
119 | + return ''; |
|
120 | 120 | } |
121 | 121 | public static function retrieve_route_oneworld($database_file) { |
122 | 122 | global $globalDebug, $globalTransaction; |
@@ -127,12 +127,12 @@ discard block |
||
127 | 127 | try { |
128 | 128 | //$Connection = new Connection(); |
129 | 129 | $sth = $Connection->db->prepare($query); |
130 | - $sth->execute(array(':source' => 'oneworld')); |
|
131 | - } catch(PDOException $e) { |
|
132 | - return "error : ".$e->getMessage(); |
|
133 | - } |
|
130 | + $sth->execute(array(':source' => 'oneworld')); |
|
131 | + } catch(PDOException $e) { |
|
132 | + return "error : ".$e->getMessage(); |
|
133 | + } |
|
134 | 134 | |
135 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
135 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
136 | 136 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
137 | 137 | $Spotter = new Spotter(); |
138 | 138 | if ($fh = fopen($database_file,"r")) { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | if ($globalTransaction) $Connection->db->commit(); |
158 | 158 | } |
159 | - return ''; |
|
159 | + return ''; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | public static function retrieve_route_skyteam($database_file) { |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | try { |
169 | 169 | //$Connection = new Connection(); |
170 | 170 | $sth = $Connection->db->prepare($query); |
171 | - $sth->execute(array(':source' => 'skyteam')); |
|
172 | - } catch(PDOException $e) { |
|
173 | - return "error : ".$e->getMessage(); |
|
174 | - } |
|
171 | + $sth->execute(array(':source' => 'skyteam')); |
|
172 | + } catch(PDOException $e) { |
|
173 | + return "error : ".$e->getMessage(); |
|
174 | + } |
|
175 | 175 | |
176 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
176 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
177 | 177 | |
178 | 178 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
179 | 179 | $Spotter = new Spotter(); |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | return "error : ".$e->getMessage(); |
200 | 200 | } |
201 | 201 | } |
202 | - return ''; |
|
202 | + return ''; |
|
203 | 203 | } |
204 | 204 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
205 | 205 | global $globalTransaction; |
@@ -208,27 +208,27 @@ discard block |
||
208 | 208 | try { |
209 | 209 | $Connection = new Connection(); |
210 | 210 | $sth = $Connection->db->prepare($query); |
211 | - $sth->execute(array(':source' => $database_file)); |
|
212 | - } catch(PDOException $e) { |
|
213 | - return "error : ".$e->getMessage(); |
|
214 | - } |
|
211 | + $sth->execute(array(':source' => $database_file)); |
|
212 | + } catch(PDOException $e) { |
|
213 | + return "error : ".$e->getMessage(); |
|
214 | + } |
|
215 | 215 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
216 | 216 | try { |
217 | 217 | $Connection = new Connection(); |
218 | 218 | $sth = $Connection->db->prepare($query); |
219 | - $sth->execute(array(':source' => $database_file)); |
|
220 | - } catch(PDOException $e) { |
|
221 | - return "error : ".$e->getMessage(); |
|
222 | - } |
|
219 | + $sth->execute(array(':source' => $database_file)); |
|
220 | + } catch(PDOException $e) { |
|
221 | + return "error : ".$e->getMessage(); |
|
222 | + } |
|
223 | 223 | |
224 | - update_db::connect_sqlite($database_file); |
|
224 | + update_db::connect_sqlite($database_file); |
|
225 | 225 | $query = 'select * from Aircraft'; |
226 | 226 | try { |
227 | - $sth = update_db::$db_sqlite->prepare($query); |
|
228 | - $sth->execute(); |
|
229 | - } catch(PDOException $e) { |
|
230 | - return "error : ".$e->getMessage(); |
|
231 | - } |
|
227 | + $sth = update_db::$db_sqlite->prepare($query); |
|
228 | + $sth->execute(); |
|
229 | + } catch(PDOException $e) { |
|
230 | + return "error : ".$e->getMessage(); |
|
231 | + } |
|
232 | 232 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
233 | 233 | $query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)'; |
234 | 234 | |
@@ -239,17 +239,17 @@ discard block |
||
239 | 239 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
240 | 240 | try { |
241 | 241 | if ($globalTransaction) $Connection->db->beginTransaction(); |
242 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
242 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
243 | 243 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
244 | 244 | if ($values['UserString4'] == 'M') $type = 'military'; |
245 | 245 | else $type = null; |
246 | 246 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
247 | 247 | $sth_dest->execute($query_dest_values); |
248 | 248 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
249 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
250 | - $sth_dest_owner->execute($query_dest_owner_values); |
|
249 | + $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
250 | + $sth_dest_owner->execute($query_dest_owner_values); |
|
251 | 251 | } |
252 | - } |
|
252 | + } |
|
253 | 253 | if ($globalTransaction) $Connection->db->commit(); |
254 | 254 | } catch(PDOException $e) { |
255 | 255 | return "error : ".$e->getMessage(); |
@@ -260,10 +260,10 @@ discard block |
||
260 | 260 | try { |
261 | 261 | $Connection = new Connection(); |
262 | 262 | $sth = $Connection->db->prepare($query); |
263 | - $sth->execute(array(':source' => $database_file)); |
|
264 | - } catch(PDOException $e) { |
|
265 | - return "error : ".$e->getMessage(); |
|
266 | - } |
|
263 | + $sth->execute(array(':source' => $database_file)); |
|
264 | + } catch(PDOException $e) { |
|
265 | + return "error : ".$e->getMessage(); |
|
266 | + } |
|
267 | 267 | return ''; |
268 | 268 | } |
269 | 269 | |
@@ -275,10 +275,10 @@ discard block |
||
275 | 275 | try { |
276 | 276 | $Connection = new Connection(); |
277 | 277 | $sth = $Connection->db->prepare($query); |
278 | - $sth->execute(array(':source' => $database_file)); |
|
279 | - } catch(PDOException $e) { |
|
280 | - return "error : ".$e->getMessage(); |
|
281 | - } |
|
278 | + $sth->execute(array(':source' => $database_file)); |
|
279 | + } catch(PDOException $e) { |
|
280 | + return "error : ".$e->getMessage(); |
|
281 | + } |
|
282 | 282 | |
283 | 283 | if ($fh = fopen($database_file,"r")) { |
284 | 284 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -288,26 +288,26 @@ discard block |
||
288 | 288 | $sth_dest = $Connection->db->prepare($query_dest); |
289 | 289 | try { |
290 | 290 | if ($globalTransaction) $Connection->db->beginTransaction(); |
291 | - while (!feof($fh)) { |
|
292 | - $values = array(); |
|
293 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
291 | + while (!feof($fh)) { |
|
292 | + $values = array(); |
|
293 | + $line = $Common->hex2str(fgets($fh,9999)); |
|
294 | 294 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
295 | - $values['ModeS'] = substr($line,0,6); |
|
296 | - $values['Registration'] = trim(substr($line,69,6)); |
|
297 | - $aircraft_name = trim(substr($line,48,6)); |
|
298 | - // Check if we can find ICAO, else set it to GLID |
|
299 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
300 | - $search_more = ''; |
|
301 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
302 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
303 | - $sth_search = $Connection->db->prepare($query_search); |
|
295 | + $values['ModeS'] = substr($line,0,6); |
|
296 | + $values['Registration'] = trim(substr($line,69,6)); |
|
297 | + $aircraft_name = trim(substr($line,48,6)); |
|
298 | + // Check if we can find ICAO, else set it to GLID |
|
299 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
300 | + $search_more = ''; |
|
301 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
302 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
303 | + $sth_search = $Connection->db->prepare($query_search); |
|
304 | 304 | try { |
305 | - $sth_search->execute(); |
|
306 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
307 | - //if (count($result) > 0) { |
|
308 | - if (isset($result['icao']) && $result['icao'] != '') { |
|
309 | - $values['ICAOTypeCode'] = $result['icao']; |
|
310 | - } |
|
305 | + $sth_search->execute(); |
|
306 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
307 | + //if (count($result) > 0) { |
|
308 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
309 | + $values['ICAOTypeCode'] = $result['icao']; |
|
310 | + } |
|
311 | 311 | } catch(PDOException $e) { |
312 | 312 | return "error : ".$e->getMessage(); |
313 | 313 | } |
@@ -330,10 +330,10 @@ discard block |
||
330 | 330 | try { |
331 | 331 | $Connection = new Connection(); |
332 | 332 | $sth = $Connection->db->prepare($query); |
333 | - $sth->execute(array(':source' => $database_file)); |
|
334 | - } catch(PDOException $e) { |
|
335 | - return "error : ".$e->getMessage(); |
|
336 | - } |
|
333 | + $sth->execute(array(':source' => $database_file)); |
|
334 | + } catch(PDOException $e) { |
|
335 | + return "error : ".$e->getMessage(); |
|
336 | + } |
|
337 | 337 | return ''; |
338 | 338 | } |
339 | 339 | |
@@ -344,10 +344,10 @@ discard block |
||
344 | 344 | try { |
345 | 345 | $Connection = new Connection(); |
346 | 346 | $sth = $Connection->db->prepare($query); |
347 | - $sth->execute(array(':source' => $database_file)); |
|
348 | - } catch(PDOException $e) { |
|
349 | - return "error : ".$e->getMessage(); |
|
350 | - } |
|
347 | + $sth->execute(array(':source' => $database_file)); |
|
348 | + } catch(PDOException $e) { |
|
349 | + return "error : ".$e->getMessage(); |
|
350 | + } |
|
351 | 351 | |
352 | 352 | if ($fh = fopen($database_file,"r")) { |
353 | 353 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -358,25 +358,25 @@ discard block |
||
358 | 358 | try { |
359 | 359 | if ($globalTransaction) $Connection->db->beginTransaction(); |
360 | 360 | $tmp = fgetcsv($fh,9999,',',"'"); |
361 | - while (!feof($fh)) { |
|
362 | - $line = fgetcsv($fh,9999,',',"'"); |
|
361 | + while (!feof($fh)) { |
|
362 | + $line = fgetcsv($fh,9999,',',"'"); |
|
363 | 363 | |
364 | 364 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
365 | 365 | //print_r($line); |
366 | - $values['ModeS'] = $line[1]; |
|
367 | - $values['Registration'] = $line[3]; |
|
368 | - $values['ICAOTypeCode'] = ''; |
|
369 | - $aircraft_name = $line[2]; |
|
370 | - // Check if we can find ICAO, else set it to GLID |
|
371 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
372 | - $search_more = ''; |
|
373 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
374 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
375 | - $sth_search = $Connection->db->prepare($query_search); |
|
366 | + $values['ModeS'] = $line[1]; |
|
367 | + $values['Registration'] = $line[3]; |
|
368 | + $values['ICAOTypeCode'] = ''; |
|
369 | + $aircraft_name = $line[2]; |
|
370 | + // Check if we can find ICAO, else set it to GLID |
|
371 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
372 | + $search_more = ''; |
|
373 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
374 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
375 | + $sth_search = $Connection->db->prepare($query_search); |
|
376 | 376 | try { |
377 | - $sth_search->execute(); |
|
378 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
379 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
377 | + $sth_search->execute(); |
|
378 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
379 | + if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
380 | 380 | } catch(PDOException $e) { |
381 | 381 | return "error : ".$e->getMessage(); |
382 | 382 | } |
@@ -399,10 +399,10 @@ discard block |
||
399 | 399 | try { |
400 | 400 | $Connection = new Connection(); |
401 | 401 | $sth = $Connection->db->prepare($query); |
402 | - $sth->execute(array(':source' => $database_file)); |
|
403 | - } catch(PDOException $e) { |
|
404 | - return "error : ".$e->getMessage(); |
|
405 | - } |
|
402 | + $sth->execute(array(':source' => $database_file)); |
|
403 | + } catch(PDOException $e) { |
|
404 | + return "error : ".$e->getMessage(); |
|
405 | + } |
|
406 | 406 | return ''; |
407 | 407 | } |
408 | 408 | |
@@ -413,16 +413,16 @@ discard block |
||
413 | 413 | try { |
414 | 414 | $Connection = new Connection(); |
415 | 415 | $sth = $Connection->db->prepare($query); |
416 | - $sth->execute(array(':source' => $database_file)); |
|
417 | - } catch(PDOException $e) { |
|
418 | - return "error : ".$e->getMessage(); |
|
419 | - } |
|
416 | + $sth->execute(array(':source' => $database_file)); |
|
417 | + } catch(PDOException $e) { |
|
418 | + return "error : ".$e->getMessage(); |
|
419 | + } |
|
420 | 420 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
421 | 421 | $Spotter = new Spotter(); |
422 | 422 | if ($fh = fopen($database_file,"r")) { |
423 | 423 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
424 | 424 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
425 | - $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
425 | + $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
426 | 426 | |
427 | 427 | $Connection = new Connection(); |
428 | 428 | $sth_dest = $Connection->db->prepare($query_dest); |
@@ -430,126 +430,126 @@ discard block |
||
430 | 430 | try { |
431 | 431 | if ($globalTransaction) $Connection->db->beginTransaction(); |
432 | 432 | $tmp = fgetcsv($fh,9999,',','"'); |
433 | - while (!feof($fh)) { |
|
434 | - $line = fgetcsv($fh,9999,',','"'); |
|
435 | - $values = array(); |
|
436 | - //print_r($line); |
|
437 | - if ($country == 'F') { |
|
438 | - $values['registration'] = $line[0]; |
|
439 | - $values['base'] = $line[4]; |
|
440 | - $values['owner'] = $line[5]; |
|
441 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
442 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
443 | - $values['cancel'] = $line[7]; |
|
433 | + while (!feof($fh)) { |
|
434 | + $line = fgetcsv($fh,9999,',','"'); |
|
435 | + $values = array(); |
|
436 | + //print_r($line); |
|
437 | + if ($country == 'F') { |
|
438 | + $values['registration'] = $line[0]; |
|
439 | + $values['base'] = $line[4]; |
|
440 | + $values['owner'] = $line[5]; |
|
441 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
442 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
443 | + $values['cancel'] = $line[7]; |
|
444 | 444 | } elseif ($country == 'EI') { |
445 | - // TODO : add modeS & reg to aircraft_modes |
|
446 | - $values['registration'] = $line[0]; |
|
447 | - $values['base'] = $line[3]; |
|
448 | - $values['owner'] = $line[2]; |
|
449 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
451 | - $values['cancel'] = ''; |
|
452 | - $values['modes'] = $line[7]; |
|
453 | - $values['icao'] = $line[8]; |
|
445 | + // TODO : add modeS & reg to aircraft_modes |
|
446 | + $values['registration'] = $line[0]; |
|
447 | + $values['base'] = $line[3]; |
|
448 | + $values['owner'] = $line[2]; |
|
449 | + if ($line[1] == '') $values['date_first_reg'] = null; |
|
450 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
451 | + $values['cancel'] = ''; |
|
452 | + $values['modes'] = $line[7]; |
|
453 | + $values['icao'] = $line[8]; |
|
454 | 454 | |
455 | 455 | } elseif ($country == 'HB') { |
456 | - // TODO : add modeS & reg to aircraft_modes |
|
457 | - $values['registration'] = $line[0]; |
|
458 | - $values['base'] = null; |
|
459 | - $values['owner'] = $line[5]; |
|
460 | - $values['date_first_reg'] = null; |
|
461 | - $values['cancel'] = ''; |
|
462 | - $values['modes'] = $line[4]; |
|
463 | - $values['icao'] = $line[7]; |
|
456 | + // TODO : add modeS & reg to aircraft_modes |
|
457 | + $values['registration'] = $line[0]; |
|
458 | + $values['base'] = null; |
|
459 | + $values['owner'] = $line[5]; |
|
460 | + $values['date_first_reg'] = null; |
|
461 | + $values['cancel'] = ''; |
|
462 | + $values['modes'] = $line[4]; |
|
463 | + $values['icao'] = $line[7]; |
|
464 | 464 | } elseif ($country == 'OK') { |
465 | - // TODO : add modeS & reg to aircraft_modes |
|
466 | - $values['registration'] = $line[3]; |
|
467 | - $values['base'] = null; |
|
468 | - $values['owner'] = $line[5]; |
|
469 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
470 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
471 | - $values['cancel'] = ''; |
|
465 | + // TODO : add modeS & reg to aircraft_modes |
|
466 | + $values['registration'] = $line[3]; |
|
467 | + $values['base'] = null; |
|
468 | + $values['owner'] = $line[5]; |
|
469 | + if ($line[18] == '') $values['date_first_reg'] = null; |
|
470 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
471 | + $values['cancel'] = ''; |
|
472 | 472 | } elseif ($country == 'VH') { |
473 | - // TODO : add modeS & reg to aircraft_modes |
|
474 | - $values['registration'] = $line[0]; |
|
475 | - $values['base'] = null; |
|
476 | - $values['owner'] = $line[12]; |
|
477 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
479 | - |
|
480 | - $values['cancel'] = $line[39]; |
|
473 | + // TODO : add modeS & reg to aircraft_modes |
|
474 | + $values['registration'] = $line[0]; |
|
475 | + $values['base'] = null; |
|
476 | + $values['owner'] = $line[12]; |
|
477 | + if ($line[28] == '') $values['date_first_reg'] = null; |
|
478 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
479 | + |
|
480 | + $values['cancel'] = $line[39]; |
|
481 | 481 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
482 | - $values['registration'] = $line[0]; |
|
483 | - $values['base'] = null; |
|
484 | - $values['owner'] = $line[4]; |
|
485 | - $values['date_first_reg'] = null; |
|
486 | - $values['cancel'] = ''; |
|
482 | + $values['registration'] = $line[0]; |
|
483 | + $values['base'] = null; |
|
484 | + $values['owner'] = $line[4]; |
|
485 | + $values['date_first_reg'] = null; |
|
486 | + $values['cancel'] = ''; |
|
487 | 487 | } elseif ($country == 'CC') { |
488 | - $values['registration'] = $line[0]; |
|
489 | - $values['base'] = null; |
|
490 | - $values['owner'] = $line[6]; |
|
491 | - $values['date_first_reg'] = null; |
|
492 | - $values['cancel'] = ''; |
|
488 | + $values['registration'] = $line[0]; |
|
489 | + $values['base'] = null; |
|
490 | + $values['owner'] = $line[6]; |
|
491 | + $values['date_first_reg'] = null; |
|
492 | + $values['cancel'] = ''; |
|
493 | 493 | } elseif ($country == 'HJ') { |
494 | - $values['registration'] = $line[0]; |
|
495 | - $values['base'] = null; |
|
496 | - $values['owner'] = $line[8]; |
|
497 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
498 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
499 | - $values['cancel'] = ''; |
|
494 | + $values['registration'] = $line[0]; |
|
495 | + $values['base'] = null; |
|
496 | + $values['owner'] = $line[8]; |
|
497 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
498 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
499 | + $values['cancel'] = ''; |
|
500 | 500 | } elseif ($country == 'PP') { |
501 | - $values['registration'] = $line[0]; |
|
502 | - $values['base'] = null; |
|
503 | - $values['owner'] = $line[4]; |
|
504 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
505 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
506 | - $values['cancel'] = $line[7]; |
|
501 | + $values['registration'] = $line[0]; |
|
502 | + $values['base'] = null; |
|
503 | + $values['owner'] = $line[4]; |
|
504 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
505 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
506 | + $values['cancel'] = $line[7]; |
|
507 | 507 | } elseif ($country == 'E7') { |
508 | - $values['registration'] = $line[0]; |
|
509 | - $values['base'] = null; |
|
510 | - $values['owner'] = $line[4]; |
|
511 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
512 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
513 | - $values['cancel'] = ''; |
|
508 | + $values['registration'] = $line[0]; |
|
509 | + $values['base'] = null; |
|
510 | + $values['owner'] = $line[4]; |
|
511 | + if ($line[5] == '') $values['date_first_reg'] = null; |
|
512 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
513 | + $values['cancel'] = ''; |
|
514 | 514 | } elseif ($country == '8Q') { |
515 | - $values['registration'] = $line[0]; |
|
516 | - $values['base'] = null; |
|
517 | - $values['owner'] = $line[3]; |
|
518 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
519 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
520 | - $values['cancel'] = ''; |
|
515 | + $values['registration'] = $line[0]; |
|
516 | + $values['base'] = null; |
|
517 | + $values['owner'] = $line[3]; |
|
518 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
519 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
520 | + $values['cancel'] = ''; |
|
521 | 521 | } elseif ($country == 'ZK') { |
522 | - $values['registration'] = $line[0]; |
|
523 | - $values['base'] = null; |
|
524 | - $values['owner'] = $line[3]; |
|
525 | - $values['date_first_reg'] = null; |
|
526 | - $values['cancel'] = ''; |
|
527 | - $values['modes'] = $line[5]; |
|
528 | - $values['icao'] = $line[9]; |
|
522 | + $values['registration'] = $line[0]; |
|
523 | + $values['base'] = null; |
|
524 | + $values['owner'] = $line[3]; |
|
525 | + $values['date_first_reg'] = null; |
|
526 | + $values['cancel'] = ''; |
|
527 | + $values['modes'] = $line[5]; |
|
528 | + $values['icao'] = $line[9]; |
|
529 | 529 | } elseif ($country == 'M') { |
530 | - $values['registration'] = $line[0]; |
|
531 | - $values['base'] = null; |
|
532 | - $values['owner'] = $line[6]; |
|
533 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
534 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
535 | - $values['modes'] = $line[4]; |
|
536 | - $values['icao'] = $line[10]; |
|
530 | + $values['registration'] = $line[0]; |
|
531 | + $values['base'] = null; |
|
532 | + $values['owner'] = $line[6]; |
|
533 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
534 | + $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
535 | + $values['modes'] = $line[4]; |
|
536 | + $values['icao'] = $line[10]; |
|
537 | 537 | } elseif ($country == 'OY') { |
538 | - $values['registration'] = $line[0]; |
|
539 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
540 | - $values['modes'] = $line[5]; |
|
541 | - $values['icao'] = $line[6]; |
|
538 | + $values['registration'] = $line[0]; |
|
539 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
540 | + $values['modes'] = $line[5]; |
|
541 | + $values['icao'] = $line[6]; |
|
542 | 542 | } elseif ($country == 'PH') { |
543 | - $values['registration'] = $line[0]; |
|
544 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
545 | - $values['modes'] = $line[4]; |
|
546 | - $values['icao'] = $line[5]; |
|
543 | + $values['registration'] = $line[0]; |
|
544 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
545 | + $values['modes'] = $line[4]; |
|
546 | + $values['icao'] = $line[5]; |
|
547 | 547 | } elseif ($country == 'OM' || $country == 'TF') { |
548 | - $values['registration'] = $line[0]; |
|
549 | - $values['base'] = null; |
|
550 | - $values['owner'] = $line[3]; |
|
551 | - $values['date_first_reg'] = null; |
|
552 | - $values['cancel'] = ''; |
|
548 | + $values['registration'] = $line[0]; |
|
549 | + $values['base'] = null; |
|
550 | + $values['owner'] = $line[3]; |
|
551 | + $values['date_first_reg'] = null; |
|
552 | + $values['cancel'] = ''; |
|
553 | 553 | } |
554 | 554 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
555 | 555 | $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
@@ -682,7 +682,7 @@ discard block |
||
682 | 682 | return "error : ".$e->getMessage(); |
683 | 683 | } |
684 | 684 | */ |
685 | - /* |
|
685 | + /* |
|
686 | 686 | $query = 'ALTER TABLE airport DROP INDEX icaoidx'; |
687 | 687 | try { |
688 | 688 | $Connection = new Connection(); |
@@ -927,10 +927,10 @@ discard block |
||
927 | 927 | try { |
928 | 928 | $Connection = new Connection(); |
929 | 929 | $sth = $Connection->db->prepare($query); |
930 | - $sth->execute(array(':source' => 'translation.csv')); |
|
931 | - } catch(PDOException $e) { |
|
932 | - return "error : ".$e->getMessage(); |
|
933 | - } |
|
930 | + $sth->execute(array(':source' => 'translation.csv')); |
|
931 | + } catch(PDOException $e) { |
|
932 | + return "error : ".$e->getMessage(); |
|
933 | + } |
|
934 | 934 | |
935 | 935 | |
936 | 936 | //update_db::unzip($out_file); |
@@ -949,21 +949,21 @@ discard block |
||
949 | 949 | $data = $row; |
950 | 950 | $operator = $data[2]; |
951 | 951 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
952 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
953 | - //echo substr($operator, 0, 2)."\n";; |
|
954 | - if (count($airline_array) > 0) { |
|
952 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
953 | + //echo substr($operator, 0, 2)."\n";; |
|
954 | + if (count($airline_array) > 0) { |
|
955 | 955 | //print_r($airline_array); |
956 | 956 | $operator = $airline_array[0]['icao'].substr($operator,2); |
957 | - } |
|
958 | - } |
|
957 | + } |
|
958 | + } |
|
959 | 959 | |
960 | 960 | $operator_correct = $data[3]; |
961 | 961 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
962 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
963 | - if (count($airline_array) > 0) { |
|
964 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
965 | - } |
|
966 | - } |
|
962 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
963 | + if (count($airline_array) > 0) { |
|
964 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
965 | + } |
|
966 | + } |
|
967 | 967 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
968 | 968 | try { |
969 | 969 | $sth = $Connection->db->prepare($query); |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | //$Connection->db->commit(); |
978 | 978 | } |
979 | 979 | return ''; |
980 | - } |
|
980 | + } |
|
981 | 981 | |
982 | 982 | public static function translation_fam() { |
983 | 983 | global $tmp_dir, $globalTransaction; |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | //$Connection->db->commit(); |
1016 | 1016 | } |
1017 | 1017 | return ''; |
1018 | - } |
|
1018 | + } |
|
1019 | 1019 | |
1020 | 1020 | /* |
1021 | 1021 | * This function use FAA public data. |
@@ -1027,19 +1027,19 @@ discard block |
||
1027 | 1027 | try { |
1028 | 1028 | $Connection = new Connection(); |
1029 | 1029 | $sth = $Connection->db->prepare($query); |
1030 | - $sth->execute(array(':source' => 'website_faa')); |
|
1031 | - } catch(PDOException $e) { |
|
1032 | - return "error : ".$e->getMessage(); |
|
1033 | - } |
|
1030 | + $sth->execute(array(':source' => 'website_faa')); |
|
1031 | + } catch(PDOException $e) { |
|
1032 | + return "error : ".$e->getMessage(); |
|
1033 | + } |
|
1034 | 1034 | |
1035 | 1035 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source"; |
1036 | 1036 | try { |
1037 | 1037 | $Connection = new Connection(); |
1038 | 1038 | $sth = $Connection->db->prepare($query); |
1039 | - $sth->execute(array(':source' => 'website_faa')); |
|
1040 | - } catch(PDOException $e) { |
|
1041 | - return "error : ".$e->getMessage(); |
|
1042 | - } |
|
1039 | + $sth->execute(array(':source' => 'website_faa')); |
|
1040 | + } catch(PDOException $e) { |
|
1041 | + return "error : ".$e->getMessage(); |
|
1042 | + } |
|
1043 | 1043 | |
1044 | 1044 | $delimiter = ","; |
1045 | 1045 | $mfr = array(); |
@@ -1115,17 +1115,17 @@ discard block |
||
1115 | 1115 | } |
1116 | 1116 | //print_r($mfr); |
1117 | 1117 | return ''; |
1118 | - } |
|
1118 | + } |
|
1119 | 1119 | public static function modes_fam() { |
1120 | 1120 | global $tmp_dir, $globalTransaction; |
1121 | 1121 | $query = "DELETE FROM aircraft_modes WHERE Source = '' OR Source = :source"; |
1122 | 1122 | try { |
1123 | 1123 | $Connection = new Connection(); |
1124 | 1124 | $sth = $Connection->db->prepare($query); |
1125 | - $sth->execute(array(':source' => 'website_fam')); |
|
1126 | - } catch(PDOException $e) { |
|
1127 | - return "error : ".$e->getMessage(); |
|
1128 | - } |
|
1125 | + $sth->execute(array(':source' => 'website_fam')); |
|
1126 | + } catch(PDOException $e) { |
|
1127 | + return "error : ".$e->getMessage(); |
|
1128 | + } |
|
1129 | 1129 | |
1130 | 1130 | |
1131 | 1131 | //update_db::unzip($out_file); |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | if ($globalTransaction) $Connection->db->commit(); |
1156 | 1156 | } |
1157 | 1157 | return ''; |
1158 | - } |
|
1158 | + } |
|
1159 | 1159 | |
1160 | 1160 | public static function owner_fam() { |
1161 | 1161 | global $tmp_dir, $globalTransaction; |
@@ -1163,10 +1163,10 @@ discard block |
||
1163 | 1163 | try { |
1164 | 1164 | $Connection = new Connection(); |
1165 | 1165 | $sth = $Connection->db->prepare($query); |
1166 | - $sth->execute(array(':source' => 'website_fam')); |
|
1167 | - } catch(PDOException $e) { |
|
1168 | - return "error : ".$e->getMessage(); |
|
1169 | - } |
|
1166 | + $sth->execute(array(':source' => 'website_fam')); |
|
1167 | + } catch(PDOException $e) { |
|
1168 | + return "error : ".$e->getMessage(); |
|
1169 | + } |
|
1170 | 1170 | |
1171 | 1171 | $delimiter = "\t"; |
1172 | 1172 | $Connection = new Connection(); |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | if ($globalTransaction) $Connection->db->commit(); |
1193 | 1193 | } |
1194 | 1194 | return ''; |
1195 | - } |
|
1195 | + } |
|
1196 | 1196 | |
1197 | 1197 | public static function routes_fam() { |
1198 | 1198 | global $tmp_dir, $globalTransaction, $globalDebug; |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | if ($globalTransaction) $Connection->db->commit(); |
1228 | 1228 | } |
1229 | 1229 | return ''; |
1230 | - } |
|
1230 | + } |
|
1231 | 1231 | |
1232 | 1232 | public static function marine_identity_fam() { |
1233 | 1233 | global $tmp_dir, $globalTransaction; |
@@ -1235,10 +1235,10 @@ discard block |
||
1235 | 1235 | try { |
1236 | 1236 | $Connection = new Connection(); |
1237 | 1237 | $sth = $Connection->db->prepare($query); |
1238 | - $sth->execute(); |
|
1239 | - } catch(PDOException $e) { |
|
1240 | - return "error : ".$e->getMessage(); |
|
1241 | - } |
|
1238 | + $sth->execute(); |
|
1239 | + } catch(PDOException $e) { |
|
1240 | + return "error : ".$e->getMessage(); |
|
1241 | + } |
|
1242 | 1242 | |
1243 | 1243 | |
1244 | 1244 | //update_db::unzip($out_file); |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | if ($globalTransaction) $Connection->db->commit(); |
1269 | 1269 | } |
1270 | 1270 | return ''; |
1271 | - } |
|
1271 | + } |
|
1272 | 1272 | |
1273 | 1273 | public static function satellite_fam() { |
1274 | 1274 | global $tmp_dir, $globalTransaction; |
@@ -1339,7 +1339,7 @@ discard block |
||
1339 | 1339 | if ($globalTransaction) $Connection->db->commit(); |
1340 | 1340 | } |
1341 | 1341 | return ''; |
1342 | - } |
|
1342 | + } |
|
1343 | 1343 | |
1344 | 1344 | public static function tle($filename,$tletype) { |
1345 | 1345 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1350,10 +1350,10 @@ discard block |
||
1350 | 1350 | try { |
1351 | 1351 | $Connection = new Connection(); |
1352 | 1352 | $sth = $Connection->db->prepare($query); |
1353 | - $sth->execute(array(':source' => $filename)); |
|
1354 | - } catch(PDOException $e) { |
|
1355 | - return "error : ".$e->getMessage(); |
|
1356 | - } |
|
1353 | + $sth->execute(array(':source' => $filename)); |
|
1354 | + } catch(PDOException $e) { |
|
1355 | + return "error : ".$e->getMessage(); |
|
1356 | + } |
|
1357 | 1357 | |
1358 | 1358 | $Connection = new Connection(); |
1359 | 1359 | if (($handle = fopen($filename, 'r')) !== FALSE) |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | //$Connection->db->commit(); |
1389 | 1389 | } |
1390 | 1390 | return ''; |
1391 | - } |
|
1391 | + } |
|
1392 | 1392 | |
1393 | 1393 | public static function satellite_ucsdb($filename) { |
1394 | 1394 | global $tmp_dir, $globalTransaction; |
@@ -1637,11 +1637,11 @@ discard block |
||
1637 | 1637 | try { |
1638 | 1638 | $sth = $Connection->db->prepare($query); |
1639 | 1639 | $sth->execute(array( |
1640 | - ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
|
1641 | - ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
|
1642 | - ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
|
1643 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1644 | - ) |
|
1640 | + ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
|
1641 | + ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
|
1642 | + ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
|
1643 | + ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1644 | + ) |
|
1645 | 1645 | ); |
1646 | 1646 | } catch(PDOException $e) { |
1647 | 1647 | return "error : ".$e->getMessage(); |
@@ -1665,13 +1665,13 @@ discard block |
||
1665 | 1665 | //$Connection->db->commit(); |
1666 | 1666 | } |
1667 | 1667 | return ''; |
1668 | - } |
|
1668 | + } |
|
1669 | 1669 | |
1670 | 1670 | /** |
1671 | - * Convert a HTML table to an array |
|
1672 | - * @param String $data HTML page |
|
1673 | - * @return Array array of the tables in HTML page |
|
1674 | - */ |
|
1671 | + * Convert a HTML table to an array |
|
1672 | + * @param String $data HTML page |
|
1673 | + * @return Array array of the tables in HTML page |
|
1674 | + */ |
|
1675 | 1675 | /* |
1676 | 1676 | private static function table2array($data) { |
1677 | 1677 | $html = str_get_html($data); |
@@ -1701,11 +1701,11 @@ discard block |
||
1701 | 1701 | return(array_filter($tabledata)); |
1702 | 1702 | } |
1703 | 1703 | */ |
1704 | - /** |
|
1705 | - * Get data from form result |
|
1706 | - * @param String $url form URL |
|
1707 | - * @return String the result |
|
1708 | - */ |
|
1704 | + /** |
|
1705 | + * Get data from form result |
|
1706 | + * @param String $url form URL |
|
1707 | + * @return String the result |
|
1708 | + */ |
|
1709 | 1709 | /* |
1710 | 1710 | private static function getData($url) { |
1711 | 1711 | $ch = curl_init(); |
@@ -1798,7 +1798,7 @@ discard block |
||
1798 | 1798 | if ($globalTransaction) $Connection->db->commit(); |
1799 | 1799 | } |
1800 | 1800 | return ''; |
1801 | - } |
|
1801 | + } |
|
1802 | 1802 | |
1803 | 1803 | public static function ivao_airlines($filename) { |
1804 | 1804 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1808,10 +1808,10 @@ discard block |
||
1808 | 1808 | try { |
1809 | 1809 | $Connection = new Connection(); |
1810 | 1810 | $sth = $Connection->db->prepare($query); |
1811 | - $sth->execute(); |
|
1812 | - } catch(PDOException $e) { |
|
1813 | - return "error : ".$e->getMessage(); |
|
1814 | - } |
|
1811 | + $sth->execute(); |
|
1812 | + } catch(PDOException $e) { |
|
1813 | + return "error : ".$e->getMessage(); |
|
1814 | + } |
|
1815 | 1815 | |
1816 | 1816 | $header = NULL; |
1817 | 1817 | $delimiter = ':'; |
@@ -1835,7 +1835,7 @@ discard block |
||
1835 | 1835 | if ($globalTransaction) $Connection->db->commit(); |
1836 | 1836 | } |
1837 | 1837 | return ''; |
1838 | - } |
|
1838 | + } |
|
1839 | 1839 | |
1840 | 1840 | public static function update_airspace() { |
1841 | 1841 | global $tmp_dir, $globalDBdriver; |
@@ -1845,11 +1845,11 @@ discard block |
||
1845 | 1845 | $query = 'DROP TABLE airspace'; |
1846 | 1846 | try { |
1847 | 1847 | $sth = $Connection->db->prepare($query); |
1848 | - $sth->execute(); |
|
1849 | - } catch(PDOException $e) { |
|
1848 | + $sth->execute(); |
|
1849 | + } catch(PDOException $e) { |
|
1850 | 1850 | return "error : ".$e->getMessage(); |
1851 | - } |
|
1852 | - } |
|
1851 | + } |
|
1852 | + } |
|
1853 | 1853 | |
1854 | 1854 | |
1855 | 1855 | if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
@@ -1904,10 +1904,10 @@ discard block |
||
1904 | 1904 | $query = 'DROP TABLE countries'; |
1905 | 1905 | try { |
1906 | 1906 | $sth = $Connection->db->prepare($query); |
1907 | - $sth->execute(); |
|
1908 | - } catch(PDOException $e) { |
|
1909 | - echo "error : ".$e->getMessage(); |
|
1910 | - } |
|
1907 | + $sth->execute(); |
|
1908 | + } catch(PDOException $e) { |
|
1909 | + echo "error : ".$e->getMessage(); |
|
1910 | + } |
|
1911 | 1911 | } |
1912 | 1912 | if ($globalDBdriver == 'mysql') { |
1913 | 1913 | update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
@@ -2462,11 +2462,11 @@ discard block |
||
2462 | 2462 | $query = 'DROP TABLE airspace'; |
2463 | 2463 | try { |
2464 | 2464 | $sth = $Connection->db->prepare($query); |
2465 | - $sth->execute(); |
|
2466 | - } catch(PDOException $e) { |
|
2465 | + $sth->execute(); |
|
2466 | + } catch(PDOException $e) { |
|
2467 | 2467 | return "error : ".$e->getMessage(); |
2468 | - } |
|
2469 | - } |
|
2468 | + } |
|
2469 | + } |
|
2470 | 2470 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2471 | 2471 | update_db::insert_airspace_version($airspace_md5); |
2472 | 2472 | } else $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
@@ -2676,12 +2676,12 @@ discard block |
||
2676 | 2676 | echo $data; |
2677 | 2677 | */ |
2678 | 2678 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2679 | - //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
2680 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2681 | - $result = fread($fh,100000000); |
|
2682 | - //echo $result; |
|
2683 | - //var_dump(str_get_html($result)); |
|
2684 | - //print_r(self::table2array($result)); |
|
2679 | + //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
2680 | + $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2681 | + $result = fread($fh,100000000); |
|
2682 | + //echo $result; |
|
2683 | + //var_dump(str_get_html($result)); |
|
2684 | + //print_r(self::table2array($result)); |
|
2685 | 2685 | } |
2686 | 2686 | |
2687 | 2687 | } |
@@ -2695,10 +2695,10 @@ discard block |
||
2695 | 2695 | try { |
2696 | 2696 | $Connection = new Connection(); |
2697 | 2697 | $sth = $Connection->db->prepare($query); |
2698 | - $sth->execute(); |
|
2699 | - } catch(PDOException $e) { |
|
2700 | - return "error : ".$e->getMessage(); |
|
2701 | - } |
|
2698 | + $sth->execute(); |
|
2699 | + } catch(PDOException $e) { |
|
2700 | + return "error : ".$e->getMessage(); |
|
2701 | + } |
|
2702 | 2702 | |
2703 | 2703 | $error = ''; |
2704 | 2704 | if ($globalDebug) echo "Notam : Download..."; |
@@ -2754,8 +2754,8 @@ discard block |
||
2754 | 2754 | $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
2755 | 2755 | $data['permanent'] = 0; |
2756 | 2756 | } else { |
2757 | - $data['date_end'] = NULL; |
|
2758 | - $data['permanent'] = 1; |
|
2757 | + $data['date_end'] = NULL; |
|
2758 | + $data['permanent'] = 1; |
|
2759 | 2759 | } |
2760 | 2760 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2761 | 2761 | $NOTAM = new NOTAM(); |
@@ -2829,13 +2829,13 @@ discard block |
||
2829 | 2829 | try { |
2830 | 2830 | $Connection = new Connection(); |
2831 | 2831 | $sth = $Connection->db->prepare($query); |
2832 | - $sth->execute(); |
|
2833 | - } catch(PDOException $e) { |
|
2834 | - return "error : ".$e->getMessage(); |
|
2835 | - } |
|
2836 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2837 | - if ($row['nb'] > 0) return false; |
|
2838 | - else return true; |
|
2832 | + $sth->execute(); |
|
2833 | + } catch(PDOException $e) { |
|
2834 | + return "error : ".$e->getMessage(); |
|
2835 | + } |
|
2836 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2837 | + if ($row['nb'] > 0) return false; |
|
2838 | + else return true; |
|
2839 | 2839 | } |
2840 | 2840 | |
2841 | 2841 | public static function insert_last_update() { |
@@ -2844,10 +2844,10 @@ discard block |
||
2844 | 2844 | try { |
2845 | 2845 | $Connection = new Connection(); |
2846 | 2846 | $sth = $Connection->db->prepare($query); |
2847 | - $sth->execute(); |
|
2848 | - } catch(PDOException $e) { |
|
2849 | - return "error : ".$e->getMessage(); |
|
2850 | - } |
|
2847 | + $sth->execute(); |
|
2848 | + } catch(PDOException $e) { |
|
2849 | + return "error : ".$e->getMessage(); |
|
2850 | + } |
|
2851 | 2851 | } |
2852 | 2852 | |
2853 | 2853 | public static function check_airspace_version($version) { |
@@ -2855,13 +2855,13 @@ discard block |
||
2855 | 2855 | try { |
2856 | 2856 | $Connection = new Connection(); |
2857 | 2857 | $sth = $Connection->db->prepare($query); |
2858 | - $sth->execute(array(':version' => $version)); |
|
2859 | - } catch(PDOException $e) { |
|
2860 | - return "error : ".$e->getMessage(); |
|
2861 | - } |
|
2862 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2863 | - if ($row['nb'] > 0) return true; |
|
2864 | - else return false; |
|
2858 | + $sth->execute(array(':version' => $version)); |
|
2859 | + } catch(PDOException $e) { |
|
2860 | + return "error : ".$e->getMessage(); |
|
2861 | + } |
|
2862 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2863 | + if ($row['nb'] > 0) return true; |
|
2864 | + else return false; |
|
2865 | 2865 | } |
2866 | 2866 | |
2867 | 2867 | public static function check_geoid_version($version) { |
@@ -2869,13 +2869,13 @@ discard block |
||
2869 | 2869 | try { |
2870 | 2870 | $Connection = new Connection(); |
2871 | 2871 | $sth = $Connection->db->prepare($query); |
2872 | - $sth->execute(array(':version' => $version)); |
|
2873 | - } catch(PDOException $e) { |
|
2874 | - return "error : ".$e->getMessage(); |
|
2875 | - } |
|
2876 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2877 | - if ($row['nb'] > 0) return true; |
|
2878 | - else return false; |
|
2872 | + $sth->execute(array(':version' => $version)); |
|
2873 | + } catch(PDOException $e) { |
|
2874 | + return "error : ".$e->getMessage(); |
|
2875 | + } |
|
2876 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2877 | + if ($row['nb'] > 0) return true; |
|
2878 | + else return false; |
|
2879 | 2879 | } |
2880 | 2880 | |
2881 | 2881 | public static function check_marine_identity_version($version) { |
@@ -2925,10 +2925,10 @@ discard block |
||
2925 | 2925 | try { |
2926 | 2926 | $Connection = new Connection(); |
2927 | 2927 | $sth = $Connection->db->prepare($query); |
2928 | - $sth->execute(array(':version' => $version)); |
|
2929 | - } catch(PDOException $e) { |
|
2930 | - return "error : ".$e->getMessage(); |
|
2931 | - } |
|
2928 | + $sth->execute(array(':version' => $version)); |
|
2929 | + } catch(PDOException $e) { |
|
2930 | + return "error : ".$e->getMessage(); |
|
2931 | + } |
|
2932 | 2932 | } |
2933 | 2933 | |
2934 | 2934 | public static function insert_marine_identity_version($version) { |
@@ -2965,13 +2965,13 @@ discard block |
||
2965 | 2965 | try { |
2966 | 2966 | $Connection = new Connection(); |
2967 | 2967 | $sth = $Connection->db->prepare($query); |
2968 | - $sth->execute(); |
|
2969 | - } catch(PDOException $e) { |
|
2970 | - return "error : ".$e->getMessage(); |
|
2971 | - } |
|
2972 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2973 | - if ($row['nb'] > 0) return false; |
|
2974 | - else return true; |
|
2968 | + $sth->execute(); |
|
2969 | + } catch(PDOException $e) { |
|
2970 | + return "error : ".$e->getMessage(); |
|
2971 | + } |
|
2972 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2973 | + if ($row['nb'] > 0) return false; |
|
2974 | + else return true; |
|
2975 | 2975 | } |
2976 | 2976 | |
2977 | 2977 | public static function insert_last_notam_update() { |
@@ -2980,10 +2980,10 @@ discard block |
||
2980 | 2980 | try { |
2981 | 2981 | $Connection = new Connection(); |
2982 | 2982 | $sth = $Connection->db->prepare($query); |
2983 | - $sth->execute(); |
|
2984 | - } catch(PDOException $e) { |
|
2985 | - return "error : ".$e->getMessage(); |
|
2986 | - } |
|
2983 | + $sth->execute(); |
|
2984 | + } catch(PDOException $e) { |
|
2985 | + return "error : ".$e->getMessage(); |
|
2986 | + } |
|
2987 | 2987 | } |
2988 | 2988 | |
2989 | 2989 | public static function check_last_airspace_update() { |
@@ -2996,13 +2996,13 @@ discard block |
||
2996 | 2996 | try { |
2997 | 2997 | $Connection = new Connection(); |
2998 | 2998 | $sth = $Connection->db->prepare($query); |
2999 | - $sth->execute(); |
|
3000 | - } catch(PDOException $e) { |
|
3001 | - return "error : ".$e->getMessage(); |
|
3002 | - } |
|
3003 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3004 | - if ($row['nb'] > 0) return false; |
|
3005 | - else return true; |
|
2999 | + $sth->execute(); |
|
3000 | + } catch(PDOException $e) { |
|
3001 | + return "error : ".$e->getMessage(); |
|
3002 | + } |
|
3003 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3004 | + if ($row['nb'] > 0) return false; |
|
3005 | + else return true; |
|
3006 | 3006 | } |
3007 | 3007 | |
3008 | 3008 | public static function insert_last_airspace_update() { |
@@ -3011,10 +3011,10 @@ discard block |
||
3011 | 3011 | try { |
3012 | 3012 | $Connection = new Connection(); |
3013 | 3013 | $sth = $Connection->db->prepare($query); |
3014 | - $sth->execute(); |
|
3015 | - } catch(PDOException $e) { |
|
3016 | - return "error : ".$e->getMessage(); |
|
3017 | - } |
|
3014 | + $sth->execute(); |
|
3015 | + } catch(PDOException $e) { |
|
3016 | + return "error : ".$e->getMessage(); |
|
3017 | + } |
|
3018 | 3018 | } |
3019 | 3019 | |
3020 | 3020 | public static function check_last_geoid_update() { |
@@ -3027,13 +3027,13 @@ discard block |
||
3027 | 3027 | try { |
3028 | 3028 | $Connection = new Connection(); |
3029 | 3029 | $sth = $Connection->db->prepare($query); |
3030 | - $sth->execute(); |
|
3031 | - } catch(PDOException $e) { |
|
3032 | - return "error : ".$e->getMessage(); |
|
3033 | - } |
|
3034 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3035 | - if ($row['nb'] > 0) return false; |
|
3036 | - else return true; |
|
3030 | + $sth->execute(); |
|
3031 | + } catch(PDOException $e) { |
|
3032 | + return "error : ".$e->getMessage(); |
|
3033 | + } |
|
3034 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3035 | + if ($row['nb'] > 0) return false; |
|
3036 | + else return true; |
|
3037 | 3037 | } |
3038 | 3038 | |
3039 | 3039 | public static function insert_last_geoid_update() { |
@@ -3042,10 +3042,10 @@ discard block |
||
3042 | 3042 | try { |
3043 | 3043 | $Connection = new Connection(); |
3044 | 3044 | $sth = $Connection->db->prepare($query); |
3045 | - $sth->execute(); |
|
3046 | - } catch(PDOException $e) { |
|
3047 | - return "error : ".$e->getMessage(); |
|
3048 | - } |
|
3045 | + $sth->execute(); |
|
3046 | + } catch(PDOException $e) { |
|
3047 | + return "error : ".$e->getMessage(); |
|
3048 | + } |
|
3049 | 3049 | } |
3050 | 3050 | |
3051 | 3051 | public static function check_last_owner_update() { |
@@ -3058,13 +3058,13 @@ discard block |
||
3058 | 3058 | try { |
3059 | 3059 | $Connection = new Connection(); |
3060 | 3060 | $sth = $Connection->db->prepare($query); |
3061 | - $sth->execute(); |
|
3062 | - } catch(PDOException $e) { |
|
3063 | - return "error : ".$e->getMessage(); |
|
3064 | - } |
|
3065 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3066 | - if ($row['nb'] > 0) return false; |
|
3067 | - else return true; |
|
3061 | + $sth->execute(); |
|
3062 | + } catch(PDOException $e) { |
|
3063 | + return "error : ".$e->getMessage(); |
|
3064 | + } |
|
3065 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3066 | + if ($row['nb'] > 0) return false; |
|
3067 | + else return true; |
|
3068 | 3068 | } |
3069 | 3069 | |
3070 | 3070 | public static function insert_last_owner_update() { |
@@ -3073,10 +3073,10 @@ discard block |
||
3073 | 3073 | try { |
3074 | 3074 | $Connection = new Connection(); |
3075 | 3075 | $sth = $Connection->db->prepare($query); |
3076 | - $sth->execute(); |
|
3077 | - } catch(PDOException $e) { |
|
3078 | - return "error : ".$e->getMessage(); |
|
3079 | - } |
|
3076 | + $sth->execute(); |
|
3077 | + } catch(PDOException $e) { |
|
3078 | + return "error : ".$e->getMessage(); |
|
3079 | + } |
|
3080 | 3080 | } |
3081 | 3081 | public static function check_last_schedules_update() { |
3082 | 3082 | global $globalDBdriver; |
@@ -3088,13 +3088,13 @@ discard block |
||
3088 | 3088 | try { |
3089 | 3089 | $Connection = new Connection(); |
3090 | 3090 | $sth = $Connection->db->prepare($query); |
3091 | - $sth->execute(); |
|
3092 | - } catch(PDOException $e) { |
|
3093 | - return "error : ".$e->getMessage(); |
|
3094 | - } |
|
3095 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3096 | - if ($row['nb'] > 0) return false; |
|
3097 | - else return true; |
|
3091 | + $sth->execute(); |
|
3092 | + } catch(PDOException $e) { |
|
3093 | + return "error : ".$e->getMessage(); |
|
3094 | + } |
|
3095 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
3096 | + if ($row['nb'] > 0) return false; |
|
3097 | + else return true; |
|
3098 | 3098 | } |
3099 | 3099 | |
3100 | 3100 | public static function insert_last_schedules_update() { |
@@ -3274,10 +3274,10 @@ discard block |
||
3274 | 3274 | try { |
3275 | 3275 | $Connection = new Connection(); |
3276 | 3276 | $sth = $Connection->db->prepare($query); |
3277 | - $sth->execute(); |
|
3278 | - } catch(PDOException $e) { |
|
3279 | - return "error : ".$e->getMessage(); |
|
3280 | - } |
|
3277 | + $sth->execute(); |
|
3278 | + } catch(PDOException $e) { |
|
3279 | + return "error : ".$e->getMessage(); |
|
3280 | + } |
|
3281 | 3281 | } |
3282 | 3282 | public static function delete_duplicateowner() { |
3283 | 3283 | global $globalDBdriver; |
@@ -3289,10 +3289,10 @@ discard block |
||
3289 | 3289 | try { |
3290 | 3290 | $Connection = new Connection(); |
3291 | 3291 | $sth = $Connection->db->prepare($query); |
3292 | - $sth->execute(); |
|
3293 | - } catch(PDOException $e) { |
|
3294 | - return "error : ".$e->getMessage(); |
|
3295 | - } |
|
3292 | + $sth->execute(); |
|
3293 | + } catch(PDOException $e) { |
|
3294 | + return "error : ".$e->getMessage(); |
|
3295 | + } |
|
3296 | 3296 | } |
3297 | 3297 | |
3298 | 3298 | public static function update_all() { |