@@ -15,11 +15,11 @@ |
||
15 | 15 | |
16 | 16 | |
17 | 17 | /** |
18 | - * Change IATA to ICAO value for ident |
|
19 | - * |
|
20 | - * @param String $ident ident |
|
21 | - * @return String the icao |
|
22 | - */ |
|
18 | + * Change IATA to ICAO value for ident |
|
19 | + * |
|
20 | + * @param String $ident ident |
|
21 | + * @return String the icao |
|
22 | + */ |
|
23 | 23 | public function ident2icao($ident) { |
24 | 24 | $Spotter = new Spotter(); |
25 | 25 | if (!is_numeric(substr($ident, 0, 3))) { |
@@ -90,40 +90,40 @@ |
||
90 | 90 | if (!empty($spotter_array)) { |
91 | 91 | foreach($spotter_array as $spotter_item) { |
92 | 92 | array_push($flights, array( |
93 | - "id" => $spotter_item['spotter_id'], |
|
94 | - "ident" => $spotter_item['ident'], |
|
95 | - "registration" => $spotter_item['registration'], |
|
96 | - "aircraft_icao" => $spotter_item['aircraft_type'], |
|
97 | - "aircraft_name" => $spotter_item['aircraft_name'], |
|
98 | - "aircraft_manufacturer" => $spotter_item['aircraft_manufacturer'], |
|
99 | - "airline_name" => $spotter_item['airline_name'], |
|
100 | - "airline_icao" => $spotter_item['airline_icao'], |
|
101 | - "airline_iata" => $spotter_item['airline_iata'], |
|
102 | - "airline_country" => $spotter_item['airline_country'], |
|
103 | - "airline_callsign" => $spotter_item['airline_callsign'], |
|
104 | - "airline_type" => $spotter_item['airline_type'], |
|
105 | - "departure_airport_city" => $spotter_item['departure_airport_city'], |
|
106 | - "departure_airport_country" => $spotter_item['departure_airport_country'], |
|
107 | - "departure_airport_iata" => $spotter_item['departure_airport_iata'], |
|
108 | - "departure_airport_icao" => $spotter_item['departure_airport_icao'], |
|
109 | - "departure_airport_latitude" => $spotter_item['departure_airport_latitude'], |
|
110 | - "departure_airport_longitude" => $spotter_item['departure_airport_longitude'], |
|
111 | - "departure_airport_altitude" => $spotter_item['departure_airport_altitude'], |
|
112 | - "arrival_airport_city" => $spotter_item['arrival_airport_city'], |
|
113 | - "arrival_airport_country" => $spotter_item['arrival_airport_country'], |
|
114 | - "arrival_airport_iata" => $spotter_item['arrival_airport_iata'], |
|
115 | - "arrival_airport_icao" => $spotter_item['arrival_airport_icao'], |
|
116 | - "arrival_airport_latitude" => $spotter_item['arrival_airport_latitude'], |
|
117 | - "arrival_airport_longitude" => $spotter_item['arrival_airport_longitude'], |
|
118 | - "arrival_airport_altitude" => $spotter_item['arrival_airport_altitude'], |
|
119 | - "latitude" => $spotter_item['latitude'], |
|
120 | - "longitude" => $spotter_item['longitude'], |
|
121 | - "altitude" => $spotter_item['altitude'], |
|
122 | - "ground_speed" => $spotter_item['ground_speed'], |
|
123 | - "heading" => $spotter_item['heading'], |
|
124 | - "heading_name" => $spotter_item['heading_name'], |
|
125 | - "waypoints" => $spotter_item['waypoints'], |
|
126 | - "date" => date("c", strtotime($spotter_item['date_iso_8601'])) |
|
93 | + "id" => $spotter_item['spotter_id'], |
|
94 | + "ident" => $spotter_item['ident'], |
|
95 | + "registration" => $spotter_item['registration'], |
|
96 | + "aircraft_icao" => $spotter_item['aircraft_type'], |
|
97 | + "aircraft_name" => $spotter_item['aircraft_name'], |
|
98 | + "aircraft_manufacturer" => $spotter_item['aircraft_manufacturer'], |
|
99 | + "airline_name" => $spotter_item['airline_name'], |
|
100 | + "airline_icao" => $spotter_item['airline_icao'], |
|
101 | + "airline_iata" => $spotter_item['airline_iata'], |
|
102 | + "airline_country" => $spotter_item['airline_country'], |
|
103 | + "airline_callsign" => $spotter_item['airline_callsign'], |
|
104 | + "airline_type" => $spotter_item['airline_type'], |
|
105 | + "departure_airport_city" => $spotter_item['departure_airport_city'], |
|
106 | + "departure_airport_country" => $spotter_item['departure_airport_country'], |
|
107 | + "departure_airport_iata" => $spotter_item['departure_airport_iata'], |
|
108 | + "departure_airport_icao" => $spotter_item['departure_airport_icao'], |
|
109 | + "departure_airport_latitude" => $spotter_item['departure_airport_latitude'], |
|
110 | + "departure_airport_longitude" => $spotter_item['departure_airport_longitude'], |
|
111 | + "departure_airport_altitude" => $spotter_item['departure_airport_altitude'], |
|
112 | + "arrival_airport_city" => $spotter_item['arrival_airport_city'], |
|
113 | + "arrival_airport_country" => $spotter_item['arrival_airport_country'], |
|
114 | + "arrival_airport_iata" => $spotter_item['arrival_airport_iata'], |
|
115 | + "arrival_airport_icao" => $spotter_item['arrival_airport_icao'], |
|
116 | + "arrival_airport_latitude" => $spotter_item['arrival_airport_latitude'], |
|
117 | + "arrival_airport_longitude" => $spotter_item['arrival_airport_longitude'], |
|
118 | + "arrival_airport_altitude" => $spotter_item['arrival_airport_altitude'], |
|
119 | + "latitude" => $spotter_item['latitude'], |
|
120 | + "longitude" => $spotter_item['longitude'], |
|
121 | + "altitude" => $spotter_item['altitude'], |
|
122 | + "ground_speed" => $spotter_item['ground_speed'], |
|
123 | + "heading" => $spotter_item['heading'], |
|
124 | + "heading_name" => $spotter_item['heading_name'], |
|
125 | + "waypoints" => $spotter_item['waypoints'], |
|
126 | + "date" => date("c", strtotime($spotter_item['date_iso_8601'])) |
|
127 | 127 | )); |
128 | 128 | } |
129 | 129 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | //waypoint plotting |
93 | - /* |
|
93 | + /* |
|
94 | 94 | $output .= '{'; |
95 | 95 | $output .= '"type": "Feature",'; |
96 | 96 | $output .= '"properties": {'; |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | $output_time .= (strtotime($spotter_history['date'])*1000).','; |
270 | 270 | } |
271 | 271 | if (isset($output_time)) { |
272 | - $output_time = substr($output_time, 0, -1); |
|
273 | - $output .= '"time": ['.$output_time.'],'; |
|
272 | + $output_time = substr($output_time, 0, -1); |
|
273 | + $output .= '"time": ['.$output_time.'],'; |
|
274 | 274 | } |
275 | 275 | |
276 | 276 | |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | $output .= '"coordinates": ['; |
285 | 285 | |
286 | 286 | if (isset($output_history)) { |
287 | - $output_history = substr($output_history, 0, -1); |
|
288 | - $output .= $output_history; |
|
287 | + $output_history = substr($output_history, 0, -1); |
|
288 | + $output .= $output_history; |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | $output .= ']'; |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | ?> |
250 | 250 | <div class="more"> |
251 | 251 | <?php |
252 | - /* |
|
252 | + /* |
|
253 | 253 | if ($year != '' && $month != '') { |
254 | 254 | ?> |
255 | 255 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | <?php |
261 | 261 | } |
262 | 262 | */ |
263 | - ?> |
|
263 | + ?> |
|
264 | 264 | </div> |
265 | 265 | </div> |
266 | 266 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | ?> |
295 | 295 | <div class="more"> |
296 | 296 | <?php |
297 | - /* |
|
297 | + /* |
|
298 | 298 | if ($year != '' && $month != '') { |
299 | 299 | ?> |
300 | 300 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | <?php |
306 | 306 | } |
307 | 307 | */ |
308 | - ?> |
|
308 | + ?> |
|
309 | 309 | </div> |
310 | 310 | </div> |
311 | 311 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -404,17 +404,17 @@ discard block |
||
404 | 404 | } |
405 | 405 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
406 | 406 | } else $all = array(); |
407 | - if (empty($all)) { |
|
408 | - $Spotter = new Spotter($this->db); |
|
409 | - $filters = array(); |
|
407 | + if (empty($all)) { |
|
408 | + $Spotter = new Spotter($this->db); |
|
409 | + $filters = array(); |
|
410 | 410 | $filters = array('year' => $year,'month' => $month); |
411 | - if ($filter_name != '') { |
|
412 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
411 | + if ($filter_name != '') { |
|
412 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
413 | 413 | } |
414 | 414 | //$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
415 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
416 | - } |
|
417 | - return $all; |
|
415 | + $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
416 | + } |
|
417 | + return $all; |
|
418 | 418 | } |
419 | 419 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
420 | 420 | global $globalStatsFilters; |
@@ -1611,7 +1611,7 @@ discard block |
||
1611 | 1611 | return "error : ".$e->getMessage(); |
1612 | 1612 | } |
1613 | 1613 | } |
1614 | - /* |
|
1614 | + /* |
|
1615 | 1615 | public function getStatsSource($date,$stats_type = '') { |
1616 | 1616 | if ($stats_type == '') { |
1617 | 1617 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
@@ -76,38 +76,38 @@ discard block |
||
76 | 76 | try { |
77 | 77 | //$Connection = new Connection(); |
78 | 78 | $sth = $Connection->db->prepare($query); |
79 | - $sth->execute(array(':source' => $database_file)); |
|
80 | - } catch(PDOException $e) { |
|
81 | - return "error : ".$e->getMessage(); |
|
82 | - } |
|
79 | + $sth->execute(array(':source' => $database_file)); |
|
80 | + } catch(PDOException $e) { |
|
81 | + return "error : ".$e->getMessage(); |
|
82 | + } |
|
83 | 83 | |
84 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
85 | - update_db::connect_sqlite($database_file); |
|
84 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
85 | + update_db::connect_sqlite($database_file); |
|
86 | 86 | //$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'; |
87 | 87 | $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"; |
88 | 88 | try { |
89 | - $sth = update_db::$db_sqlite->prepare($query); |
|
90 | - $sth->execute(); |
|
91 | - } catch(PDOException $e) { |
|
92 | - return "error : ".$e->getMessage(); |
|
93 | - } |
|
89 | + $sth = update_db::$db_sqlite->prepare($query); |
|
90 | + $sth->execute(); |
|
91 | + } catch(PDOException $e) { |
|
92 | + return "error : ".$e->getMessage(); |
|
93 | + } |
|
94 | 94 | //$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)'; |
95 | 95 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
96 | 96 | $Connection = new Connection(); |
97 | 97 | $sth_dest = $Connection->db->prepare($query_dest); |
98 | 98 | try { |
99 | 99 | if ($globalTransaction) $Connection->db->beginTransaction(); |
100 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
100 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
101 | 101 | //$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); |
102 | 102 | $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); |
103 | 103 | $sth_dest->execute($query_dest_values); |
104 | - } |
|
104 | + } |
|
105 | 105 | if ($globalTransaction) $Connection->db->commit(); |
106 | 106 | } catch(PDOException $e) { |
107 | 107 | if ($globalTransaction) $Connection->db->rollBack(); |
108 | 108 | return "error : ".$e->getMessage(); |
109 | 109 | } |
110 | - return ''; |
|
110 | + return ''; |
|
111 | 111 | } |
112 | 112 | public static function retrieve_route_oneworld($database_file) { |
113 | 113 | global $globalDebug, $globalTransaction; |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | try { |
119 | 119 | //$Connection = new Connection(); |
120 | 120 | $sth = $Connection->db->prepare($query); |
121 | - $sth->execute(array(':source' => 'oneworld')); |
|
122 | - } catch(PDOException $e) { |
|
123 | - return "error : ".$e->getMessage(); |
|
124 | - } |
|
121 | + $sth->execute(array(':source' => 'oneworld')); |
|
122 | + } catch(PDOException $e) { |
|
123 | + return "error : ".$e->getMessage(); |
|
124 | + } |
|
125 | 125 | |
126 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
126 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
127 | 127 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
128 | 128 | $Spotter = new Spotter(); |
129 | 129 | if ($fh = fopen($database_file,"r")) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | if ($globalTransaction) $Connection->db->commit(); |
149 | 149 | } |
150 | - return ''; |
|
150 | + return ''; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | public static function retrieve_route_skyteam($database_file) { |
@@ -159,12 +159,12 @@ discard block |
||
159 | 159 | try { |
160 | 160 | //$Connection = new Connection(); |
161 | 161 | $sth = $Connection->db->prepare($query); |
162 | - $sth->execute(array(':source' => 'skyteam')); |
|
163 | - } catch(PDOException $e) { |
|
164 | - return "error : ".$e->getMessage(); |
|
165 | - } |
|
162 | + $sth->execute(array(':source' => 'skyteam')); |
|
163 | + } catch(PDOException $e) { |
|
164 | + return "error : ".$e->getMessage(); |
|
165 | + } |
|
166 | 166 | |
167 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
167 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
168 | 168 | |
169 | 169 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
170 | 170 | $Spotter = new Spotter(); |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return "error : ".$e->getMessage(); |
191 | 191 | } |
192 | 192 | } |
193 | - return ''; |
|
193 | + return ''; |
|
194 | 194 | } |
195 | 195 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
196 | 196 | global $globalTransaction; |
@@ -199,27 +199,27 @@ discard block |
||
199 | 199 | try { |
200 | 200 | $Connection = new Connection(); |
201 | 201 | $sth = $Connection->db->prepare($query); |
202 | - $sth->execute(array(':source' => $database_file)); |
|
203 | - } catch(PDOException $e) { |
|
204 | - return "error : ".$e->getMessage(); |
|
205 | - } |
|
202 | + $sth->execute(array(':source' => $database_file)); |
|
203 | + } catch(PDOException $e) { |
|
204 | + return "error : ".$e->getMessage(); |
|
205 | + } |
|
206 | 206 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
207 | 207 | try { |
208 | 208 | $Connection = new Connection(); |
209 | 209 | $sth = $Connection->db->prepare($query); |
210 | - $sth->execute(array(':source' => $database_file)); |
|
211 | - } catch(PDOException $e) { |
|
212 | - return "error : ".$e->getMessage(); |
|
213 | - } |
|
210 | + $sth->execute(array(':source' => $database_file)); |
|
211 | + } catch(PDOException $e) { |
|
212 | + return "error : ".$e->getMessage(); |
|
213 | + } |
|
214 | 214 | |
215 | - update_db::connect_sqlite($database_file); |
|
215 | + update_db::connect_sqlite($database_file); |
|
216 | 216 | $query = 'select * from Aircraft'; |
217 | 217 | try { |
218 | - $sth = update_db::$db_sqlite->prepare($query); |
|
219 | - $sth->execute(); |
|
220 | - } catch(PDOException $e) { |
|
221 | - return "error : ".$e->getMessage(); |
|
222 | - } |
|
218 | + $sth = update_db::$db_sqlite->prepare($query); |
|
219 | + $sth->execute(); |
|
220 | + } catch(PDOException $e) { |
|
221 | + return "error : ".$e->getMessage(); |
|
222 | + } |
|
223 | 223 | //$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)'; |
224 | 224 | $query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)'; |
225 | 225 | |
@@ -230,17 +230,17 @@ discard block |
||
230 | 230 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
231 | 231 | try { |
232 | 232 | if ($globalTransaction) $Connection->db->beginTransaction(); |
233 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
233 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
234 | 234 | //$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']); |
235 | 235 | if ($values['UserString4'] == 'M') $type = 'military'; |
236 | 236 | else $type = null; |
237 | 237 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
238 | 238 | $sth_dest->execute($query_dest_values); |
239 | 239 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
240 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
241 | - $sth_dest_owner->execute($query_dest_owner_values); |
|
240 | + $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
241 | + $sth_dest_owner->execute($query_dest_owner_values); |
|
242 | 242 | } |
243 | - } |
|
243 | + } |
|
244 | 244 | if ($globalTransaction) $Connection->db->commit(); |
245 | 245 | } catch(PDOException $e) { |
246 | 246 | return "error : ".$e->getMessage(); |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | try { |
252 | 252 | $Connection = new Connection(); |
253 | 253 | $sth = $Connection->db->prepare($query); |
254 | - $sth->execute(array(':source' => $database_file)); |
|
255 | - } catch(PDOException $e) { |
|
256 | - return "error : ".$e->getMessage(); |
|
257 | - } |
|
254 | + $sth->execute(array(':source' => $database_file)); |
|
255 | + } catch(PDOException $e) { |
|
256 | + return "error : ".$e->getMessage(); |
|
257 | + } |
|
258 | 258 | return ''; |
259 | 259 | } |
260 | 260 | |
@@ -266,10 +266,10 @@ discard block |
||
266 | 266 | try { |
267 | 267 | $Connection = new Connection(); |
268 | 268 | $sth = $Connection->db->prepare($query); |
269 | - $sth->execute(array(':source' => $database_file)); |
|
270 | - } catch(PDOException $e) { |
|
271 | - return "error : ".$e->getMessage(); |
|
272 | - } |
|
269 | + $sth->execute(array(':source' => $database_file)); |
|
270 | + } catch(PDOException $e) { |
|
271 | + return "error : ".$e->getMessage(); |
|
272 | + } |
|
273 | 273 | |
274 | 274 | if ($fh = fopen($database_file,"r")) { |
275 | 275 | //$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)'; |
@@ -279,26 +279,26 @@ discard block |
||
279 | 279 | $sth_dest = $Connection->db->prepare($query_dest); |
280 | 280 | try { |
281 | 281 | if ($globalTransaction) $Connection->db->beginTransaction(); |
282 | - while (!feof($fh)) { |
|
283 | - $values = array(); |
|
284 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
282 | + while (!feof($fh)) { |
|
283 | + $values = array(); |
|
284 | + $line = $Common->hex2str(fgets($fh,9999)); |
|
285 | 285 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
286 | - $values['ModeS'] = substr($line,0,6); |
|
287 | - $values['Registration'] = trim(substr($line,69,6)); |
|
288 | - $aircraft_name = trim(substr($line,48,6)); |
|
289 | - // Check if we can find ICAO, else set it to GLID |
|
290 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
291 | - $search_more = ''; |
|
292 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
293 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
294 | - $sth_search = $Connection->db->prepare($query_search); |
|
286 | + $values['ModeS'] = substr($line,0,6); |
|
287 | + $values['Registration'] = trim(substr($line,69,6)); |
|
288 | + $aircraft_name = trim(substr($line,48,6)); |
|
289 | + // Check if we can find ICAO, else set it to GLID |
|
290 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
291 | + $search_more = ''; |
|
292 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
293 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
294 | + $sth_search = $Connection->db->prepare($query_search); |
|
295 | 295 | try { |
296 | - $sth_search->execute(); |
|
297 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
298 | - //if (count($result) > 0) { |
|
299 | - if (isset($result['icao']) && $result['icao'] != '') { |
|
300 | - $values['ICAOTypeCode'] = $result['icao']; |
|
301 | - } |
|
296 | + $sth_search->execute(); |
|
297 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
298 | + //if (count($result) > 0) { |
|
299 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
300 | + $values['ICAOTypeCode'] = $result['icao']; |
|
301 | + } |
|
302 | 302 | } catch(PDOException $e) { |
303 | 303 | return "error : ".$e->getMessage(); |
304 | 304 | } |
@@ -321,10 +321,10 @@ discard block |
||
321 | 321 | try { |
322 | 322 | $Connection = new Connection(); |
323 | 323 | $sth = $Connection->db->prepare($query); |
324 | - $sth->execute(array(':source' => $database_file)); |
|
325 | - } catch(PDOException $e) { |
|
326 | - return "error : ".$e->getMessage(); |
|
327 | - } |
|
324 | + $sth->execute(array(':source' => $database_file)); |
|
325 | + } catch(PDOException $e) { |
|
326 | + return "error : ".$e->getMessage(); |
|
327 | + } |
|
328 | 328 | return ''; |
329 | 329 | } |
330 | 330 | |
@@ -335,10 +335,10 @@ discard block |
||
335 | 335 | try { |
336 | 336 | $Connection = new Connection(); |
337 | 337 | $sth = $Connection->db->prepare($query); |
338 | - $sth->execute(array(':source' => $database_file)); |
|
339 | - } catch(PDOException $e) { |
|
340 | - return "error : ".$e->getMessage(); |
|
341 | - } |
|
338 | + $sth->execute(array(':source' => $database_file)); |
|
339 | + } catch(PDOException $e) { |
|
340 | + return "error : ".$e->getMessage(); |
|
341 | + } |
|
342 | 342 | |
343 | 343 | if ($fh = fopen($database_file,"r")) { |
344 | 344 | //$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)'; |
@@ -349,25 +349,25 @@ discard block |
||
349 | 349 | try { |
350 | 350 | if ($globalTransaction) $Connection->db->beginTransaction(); |
351 | 351 | $tmp = fgetcsv($fh,9999,',',"'"); |
352 | - while (!feof($fh)) { |
|
353 | - $line = fgetcsv($fh,9999,',',"'"); |
|
352 | + while (!feof($fh)) { |
|
353 | + $line = fgetcsv($fh,9999,',',"'"); |
|
354 | 354 | |
355 | 355 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
356 | 356 | //print_r($line); |
357 | - $values['ModeS'] = $line[1]; |
|
358 | - $values['Registration'] = $line[3]; |
|
359 | - $values['ICAOTypeCode'] = ''; |
|
360 | - $aircraft_name = $line[2]; |
|
361 | - // Check if we can find ICAO, else set it to GLID |
|
362 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
363 | - $search_more = ''; |
|
364 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
365 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
366 | - $sth_search = $Connection->db->prepare($query_search); |
|
357 | + $values['ModeS'] = $line[1]; |
|
358 | + $values['Registration'] = $line[3]; |
|
359 | + $values['ICAOTypeCode'] = ''; |
|
360 | + $aircraft_name = $line[2]; |
|
361 | + // Check if we can find ICAO, else set it to GLID |
|
362 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
363 | + $search_more = ''; |
|
364 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
365 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
366 | + $sth_search = $Connection->db->prepare($query_search); |
|
367 | 367 | try { |
368 | - $sth_search->execute(); |
|
369 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
370 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
368 | + $sth_search->execute(); |
|
369 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
370 | + if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
371 | 371 | } catch(PDOException $e) { |
372 | 372 | return "error : ".$e->getMessage(); |
373 | 373 | } |
@@ -390,10 +390,10 @@ discard block |
||
390 | 390 | try { |
391 | 391 | $Connection = new Connection(); |
392 | 392 | $sth = $Connection->db->prepare($query); |
393 | - $sth->execute(array(':source' => $database_file)); |
|
394 | - } catch(PDOException $e) { |
|
395 | - return "error : ".$e->getMessage(); |
|
396 | - } |
|
393 | + $sth->execute(array(':source' => $database_file)); |
|
394 | + } catch(PDOException $e) { |
|
395 | + return "error : ".$e->getMessage(); |
|
396 | + } |
|
397 | 397 | return ''; |
398 | 398 | } |
399 | 399 | |
@@ -404,16 +404,16 @@ discard block |
||
404 | 404 | try { |
405 | 405 | $Connection = new Connection(); |
406 | 406 | $sth = $Connection->db->prepare($query); |
407 | - $sth->execute(array(':source' => $database_file)); |
|
408 | - } catch(PDOException $e) { |
|
409 | - return "error : ".$e->getMessage(); |
|
410 | - } |
|
407 | + $sth->execute(array(':source' => $database_file)); |
|
408 | + } catch(PDOException $e) { |
|
409 | + return "error : ".$e->getMessage(); |
|
410 | + } |
|
411 | 411 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
412 | 412 | $Spotter = new Spotter(); |
413 | 413 | if ($fh = fopen($database_file,"r")) { |
414 | 414 | //$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)'; |
415 | 415 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
416 | - $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
416 | + $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
417 | 417 | |
418 | 418 | $Connection = new Connection(); |
419 | 419 | $sth_dest = $Connection->db->prepare($query_dest); |
@@ -421,126 +421,126 @@ discard block |
||
421 | 421 | try { |
422 | 422 | if ($globalTransaction) $Connection->db->beginTransaction(); |
423 | 423 | $tmp = fgetcsv($fh,9999,',','"'); |
424 | - while (!feof($fh)) { |
|
425 | - $line = fgetcsv($fh,9999,',','"'); |
|
426 | - $values = array(); |
|
427 | - //print_r($line); |
|
428 | - if ($country == 'F') { |
|
429 | - $values['registration'] = $line[0]; |
|
430 | - $values['base'] = $line[4]; |
|
431 | - $values['owner'] = $line[5]; |
|
432 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
433 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
434 | - $values['cancel'] = $line[7]; |
|
424 | + while (!feof($fh)) { |
|
425 | + $line = fgetcsv($fh,9999,',','"'); |
|
426 | + $values = array(); |
|
427 | + //print_r($line); |
|
428 | + if ($country == 'F') { |
|
429 | + $values['registration'] = $line[0]; |
|
430 | + $values['base'] = $line[4]; |
|
431 | + $values['owner'] = $line[5]; |
|
432 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
433 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
434 | + $values['cancel'] = $line[7]; |
|
435 | 435 | } elseif ($country == 'EI') { |
436 | - // TODO : add modeS & reg to aircraft_modes |
|
437 | - $values['registration'] = $line[0]; |
|
438 | - $values['base'] = $line[3]; |
|
439 | - $values['owner'] = $line[2]; |
|
440 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
441 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
442 | - $values['cancel'] = ''; |
|
443 | - $values['modes'] = $line[7]; |
|
444 | - $values['icao'] = $line[8]; |
|
436 | + // TODO : add modeS & reg to aircraft_modes |
|
437 | + $values['registration'] = $line[0]; |
|
438 | + $values['base'] = $line[3]; |
|
439 | + $values['owner'] = $line[2]; |
|
440 | + if ($line[1] == '') $values['date_first_reg'] = null; |
|
441 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
442 | + $values['cancel'] = ''; |
|
443 | + $values['modes'] = $line[7]; |
|
444 | + $values['icao'] = $line[8]; |
|
445 | 445 | |
446 | 446 | } elseif ($country == 'HB') { |
447 | - // TODO : add modeS & reg to aircraft_modes |
|
448 | - $values['registration'] = $line[0]; |
|
449 | - $values['base'] = null; |
|
450 | - $values['owner'] = $line[5]; |
|
451 | - $values['date_first_reg'] = null; |
|
452 | - $values['cancel'] = ''; |
|
453 | - $values['modes'] = $line[4]; |
|
454 | - $values['icao'] = $line[7]; |
|
447 | + // TODO : add modeS & reg to aircraft_modes |
|
448 | + $values['registration'] = $line[0]; |
|
449 | + $values['base'] = null; |
|
450 | + $values['owner'] = $line[5]; |
|
451 | + $values['date_first_reg'] = null; |
|
452 | + $values['cancel'] = ''; |
|
453 | + $values['modes'] = $line[4]; |
|
454 | + $values['icao'] = $line[7]; |
|
455 | 455 | } elseif ($country == 'OK') { |
456 | - // TODO : add modeS & reg to aircraft_modes |
|
457 | - $values['registration'] = $line[3]; |
|
458 | - $values['base'] = null; |
|
459 | - $values['owner'] = $line[5]; |
|
460 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
461 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
462 | - $values['cancel'] = ''; |
|
456 | + // TODO : add modeS & reg to aircraft_modes |
|
457 | + $values['registration'] = $line[3]; |
|
458 | + $values['base'] = null; |
|
459 | + $values['owner'] = $line[5]; |
|
460 | + if ($line[18] == '') $values['date_first_reg'] = null; |
|
461 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
462 | + $values['cancel'] = ''; |
|
463 | 463 | } elseif ($country == 'VH') { |
464 | - // TODO : add modeS & reg to aircraft_modes |
|
465 | - $values['registration'] = $line[0]; |
|
466 | - $values['base'] = null; |
|
467 | - $values['owner'] = $line[12]; |
|
468 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
469 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
470 | - |
|
471 | - $values['cancel'] = $line[39]; |
|
464 | + // TODO : add modeS & reg to aircraft_modes |
|
465 | + $values['registration'] = $line[0]; |
|
466 | + $values['base'] = null; |
|
467 | + $values['owner'] = $line[12]; |
|
468 | + if ($line[28] == '') $values['date_first_reg'] = null; |
|
469 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
470 | + |
|
471 | + $values['cancel'] = $line[39]; |
|
472 | 472 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
473 | - $values['registration'] = $line[0]; |
|
474 | - $values['base'] = null; |
|
475 | - $values['owner'] = $line[4]; |
|
476 | - $values['date_first_reg'] = null; |
|
477 | - $values['cancel'] = ''; |
|
473 | + $values['registration'] = $line[0]; |
|
474 | + $values['base'] = null; |
|
475 | + $values['owner'] = $line[4]; |
|
476 | + $values['date_first_reg'] = null; |
|
477 | + $values['cancel'] = ''; |
|
478 | 478 | } elseif ($country == 'CC') { |
479 | - $values['registration'] = $line[0]; |
|
480 | - $values['base'] = null; |
|
481 | - $values['owner'] = $line[6]; |
|
482 | - $values['date_first_reg'] = null; |
|
483 | - $values['cancel'] = ''; |
|
479 | + $values['registration'] = $line[0]; |
|
480 | + $values['base'] = null; |
|
481 | + $values['owner'] = $line[6]; |
|
482 | + $values['date_first_reg'] = null; |
|
483 | + $values['cancel'] = ''; |
|
484 | 484 | } elseif ($country == 'HJ') { |
485 | - $values['registration'] = $line[0]; |
|
486 | - $values['base'] = null; |
|
487 | - $values['owner'] = $line[8]; |
|
488 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
489 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
490 | - $values['cancel'] = ''; |
|
485 | + $values['registration'] = $line[0]; |
|
486 | + $values['base'] = null; |
|
487 | + $values['owner'] = $line[8]; |
|
488 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
489 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
490 | + $values['cancel'] = ''; |
|
491 | 491 | } elseif ($country == 'PP') { |
492 | - $values['registration'] = $line[0]; |
|
493 | - $values['base'] = null; |
|
494 | - $values['owner'] = $line[4]; |
|
495 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
496 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
497 | - $values['cancel'] = $line[7]; |
|
492 | + $values['registration'] = $line[0]; |
|
493 | + $values['base'] = null; |
|
494 | + $values['owner'] = $line[4]; |
|
495 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
496 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
497 | + $values['cancel'] = $line[7]; |
|
498 | 498 | } elseif ($country == 'E7') { |
499 | - $values['registration'] = $line[0]; |
|
500 | - $values['base'] = null; |
|
501 | - $values['owner'] = $line[4]; |
|
502 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
503 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
504 | - $values['cancel'] = ''; |
|
499 | + $values['registration'] = $line[0]; |
|
500 | + $values['base'] = null; |
|
501 | + $values['owner'] = $line[4]; |
|
502 | + if ($line[5] == '') $values['date_first_reg'] = null; |
|
503 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
504 | + $values['cancel'] = ''; |
|
505 | 505 | } elseif ($country == '8Q') { |
506 | - $values['registration'] = $line[0]; |
|
507 | - $values['base'] = null; |
|
508 | - $values['owner'] = $line[3]; |
|
509 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
510 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
511 | - $values['cancel'] = ''; |
|
506 | + $values['registration'] = $line[0]; |
|
507 | + $values['base'] = null; |
|
508 | + $values['owner'] = $line[3]; |
|
509 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
510 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
511 | + $values['cancel'] = ''; |
|
512 | 512 | } elseif ($country == 'ZK') { |
513 | - $values['registration'] = $line[0]; |
|
514 | - $values['base'] = null; |
|
515 | - $values['owner'] = $line[3]; |
|
516 | - $values['date_first_reg'] = null; |
|
517 | - $values['cancel'] = ''; |
|
518 | - $values['modes'] = $line[5]; |
|
519 | - $values['icao'] = $line[9]; |
|
513 | + $values['registration'] = $line[0]; |
|
514 | + $values['base'] = null; |
|
515 | + $values['owner'] = $line[3]; |
|
516 | + $values['date_first_reg'] = null; |
|
517 | + $values['cancel'] = ''; |
|
518 | + $values['modes'] = $line[5]; |
|
519 | + $values['icao'] = $line[9]; |
|
520 | 520 | } elseif ($country == 'M') { |
521 | - $values['registration'] = $line[0]; |
|
522 | - $values['base'] = null; |
|
523 | - $values['owner'] = $line[6]; |
|
524 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
525 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
526 | - $values['modes'] = $line[4]; |
|
527 | - $values['icao'] = $line[10]; |
|
521 | + $values['registration'] = $line[0]; |
|
522 | + $values['base'] = null; |
|
523 | + $values['owner'] = $line[6]; |
|
524 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
525 | + $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
526 | + $values['modes'] = $line[4]; |
|
527 | + $values['icao'] = $line[10]; |
|
528 | 528 | } elseif ($country == 'OY') { |
529 | - $values['registration'] = $line[0]; |
|
530 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
531 | - $values['modes'] = $line[5]; |
|
532 | - $values['icao'] = $line[6]; |
|
529 | + $values['registration'] = $line[0]; |
|
530 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
531 | + $values['modes'] = $line[5]; |
|
532 | + $values['icao'] = $line[6]; |
|
533 | 533 | } elseif ($country == 'PH') { |
534 | - $values['registration'] = $line[0]; |
|
535 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
536 | - $values['modes'] = $line[4]; |
|
537 | - $values['icao'] = $line[5]; |
|
534 | + $values['registration'] = $line[0]; |
|
535 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
536 | + $values['modes'] = $line[4]; |
|
537 | + $values['icao'] = $line[5]; |
|
538 | 538 | } elseif ($country == 'OM' || $country == 'TF') { |
539 | - $values['registration'] = $line[0]; |
|
540 | - $values['base'] = null; |
|
541 | - $values['owner'] = $line[3]; |
|
542 | - $values['date_first_reg'] = null; |
|
543 | - $values['cancel'] = ''; |
|
539 | + $values['registration'] = $line[0]; |
|
540 | + $values['base'] = null; |
|
541 | + $values['owner'] = $line[3]; |
|
542 | + $values['date_first_reg'] = null; |
|
543 | + $values['cancel'] = ''; |
|
544 | 544 | } |
545 | 545 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
546 | 546 | $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
@@ -673,7 +673,7 @@ discard block |
||
673 | 673 | return "error : ".$e->getMessage(); |
674 | 674 | } |
675 | 675 | */ |
676 | - /* |
|
676 | + /* |
|
677 | 677 | $query = 'ALTER TABLE airport DROP INDEX icaoidx'; |
678 | 678 | try { |
679 | 679 | $Connection = new Connection(); |
@@ -918,10 +918,10 @@ discard block |
||
918 | 918 | try { |
919 | 919 | $Connection = new Connection(); |
920 | 920 | $sth = $Connection->db->prepare($query); |
921 | - $sth->execute(array(':source' => 'translation.csv')); |
|
922 | - } catch(PDOException $e) { |
|
923 | - return "error : ".$e->getMessage(); |
|
924 | - } |
|
921 | + $sth->execute(array(':source' => 'translation.csv')); |
|
922 | + } catch(PDOException $e) { |
|
923 | + return "error : ".$e->getMessage(); |
|
924 | + } |
|
925 | 925 | |
926 | 926 | |
927 | 927 | //update_db::unzip($out_file); |
@@ -940,21 +940,21 @@ discard block |
||
940 | 940 | $data = $row; |
941 | 941 | $operator = $data[2]; |
942 | 942 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
943 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
944 | - //echo substr($operator, 0, 2)."\n";; |
|
945 | - if (count($airline_array) > 0) { |
|
943 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
944 | + //echo substr($operator, 0, 2)."\n";; |
|
945 | + if (count($airline_array) > 0) { |
|
946 | 946 | //print_r($airline_array); |
947 | 947 | $operator = $airline_array[0]['icao'].substr($operator,2); |
948 | - } |
|
949 | - } |
|
948 | + } |
|
949 | + } |
|
950 | 950 | |
951 | 951 | $operator_correct = $data[3]; |
952 | 952 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
953 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
954 | - if (count($airline_array) > 0) { |
|
955 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
956 | - } |
|
957 | - } |
|
953 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
954 | + if (count($airline_array) > 0) { |
|
955 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
956 | + } |
|
957 | + } |
|
958 | 958 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
959 | 959 | try { |
960 | 960 | $sth = $Connection->db->prepare($query); |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | //$Connection->db->commit(); |
969 | 969 | } |
970 | 970 | return ''; |
971 | - } |
|
971 | + } |
|
972 | 972 | |
973 | 973 | public static function translation_fam() { |
974 | 974 | global $tmp_dir, $globalTransaction; |
@@ -1006,7 +1006,7 @@ discard block |
||
1006 | 1006 | //$Connection->db->commit(); |
1007 | 1007 | } |
1008 | 1008 | return ''; |
1009 | - } |
|
1009 | + } |
|
1010 | 1010 | |
1011 | 1011 | /* |
1012 | 1012 | * This function use FAA public data. |
@@ -1018,19 +1018,19 @@ discard block |
||
1018 | 1018 | try { |
1019 | 1019 | $Connection = new Connection(); |
1020 | 1020 | $sth = $Connection->db->prepare($query); |
1021 | - $sth->execute(array(':source' => 'website_faa')); |
|
1022 | - } catch(PDOException $e) { |
|
1023 | - return "error : ".$e->getMessage(); |
|
1024 | - } |
|
1021 | + $sth->execute(array(':source' => 'website_faa')); |
|
1022 | + } catch(PDOException $e) { |
|
1023 | + return "error : ".$e->getMessage(); |
|
1024 | + } |
|
1025 | 1025 | |
1026 | 1026 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source"; |
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 | $delimiter = ","; |
1036 | 1036 | $mfr = array(); |
@@ -1106,17 +1106,17 @@ discard block |
||
1106 | 1106 | } |
1107 | 1107 | //print_r($mfr); |
1108 | 1108 | return ''; |
1109 | - } |
|
1109 | + } |
|
1110 | 1110 | public static function modes_fam() { |
1111 | 1111 | global $tmp_dir, $globalTransaction; |
1112 | 1112 | $query = "DELETE FROM aircraft_modes WHERE Source = '' OR Source = :source"; |
1113 | 1113 | try { |
1114 | 1114 | $Connection = new Connection(); |
1115 | 1115 | $sth = $Connection->db->prepare($query); |
1116 | - $sth->execute(array(':source' => 'website_fam')); |
|
1117 | - } catch(PDOException $e) { |
|
1118 | - return "error : ".$e->getMessage(); |
|
1119 | - } |
|
1116 | + $sth->execute(array(':source' => 'website_fam')); |
|
1117 | + } catch(PDOException $e) { |
|
1118 | + return "error : ".$e->getMessage(); |
|
1119 | + } |
|
1120 | 1120 | |
1121 | 1121 | |
1122 | 1122 | //update_db::unzip($out_file); |
@@ -1146,7 +1146,7 @@ discard block |
||
1146 | 1146 | if ($globalTransaction) $Connection->db->commit(); |
1147 | 1147 | } |
1148 | 1148 | return ''; |
1149 | - } |
|
1149 | + } |
|
1150 | 1150 | |
1151 | 1151 | public static function owner_fam() { |
1152 | 1152 | global $tmp_dir, $globalTransaction; |
@@ -1154,10 +1154,10 @@ discard block |
||
1154 | 1154 | try { |
1155 | 1155 | $Connection = new Connection(); |
1156 | 1156 | $sth = $Connection->db->prepare($query); |
1157 | - $sth->execute(array(':source' => 'website_fam')); |
|
1158 | - } catch(PDOException $e) { |
|
1159 | - return "error : ".$e->getMessage(); |
|
1160 | - } |
|
1157 | + $sth->execute(array(':source' => 'website_fam')); |
|
1158 | + } catch(PDOException $e) { |
|
1159 | + return "error : ".$e->getMessage(); |
|
1160 | + } |
|
1161 | 1161 | |
1162 | 1162 | $delimiter = "\t"; |
1163 | 1163 | $Connection = new Connection(); |
@@ -1183,7 +1183,7 @@ discard block |
||
1183 | 1183 | if ($globalTransaction) $Connection->db->commit(); |
1184 | 1184 | } |
1185 | 1185 | return ''; |
1186 | - } |
|
1186 | + } |
|
1187 | 1187 | |
1188 | 1188 | public static function routes_fam() { |
1189 | 1189 | global $tmp_dir, $globalTransaction, $globalDebug; |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | if ($globalTransaction) $Connection->db->commit(); |
1219 | 1219 | } |
1220 | 1220 | return ''; |
1221 | - } |
|
1221 | + } |
|
1222 | 1222 | |
1223 | 1223 | public static function marine_identity_fam() { |
1224 | 1224 | global $tmp_dir, $globalTransaction; |
@@ -1226,10 +1226,10 @@ discard block |
||
1226 | 1226 | try { |
1227 | 1227 | $Connection = new Connection(); |
1228 | 1228 | $sth = $Connection->db->prepare($query); |
1229 | - $sth->execute(); |
|
1230 | - } catch(PDOException $e) { |
|
1231 | - return "error : ".$e->getMessage(); |
|
1232 | - } |
|
1229 | + $sth->execute(); |
|
1230 | + } catch(PDOException $e) { |
|
1231 | + return "error : ".$e->getMessage(); |
|
1232 | + } |
|
1233 | 1233 | |
1234 | 1234 | |
1235 | 1235 | //update_db::unzip($out_file); |
@@ -1259,7 +1259,7 @@ discard block |
||
1259 | 1259 | if ($globalTransaction) $Connection->db->commit(); |
1260 | 1260 | } |
1261 | 1261 | return ''; |
1262 | - } |
|
1262 | + } |
|
1263 | 1263 | |
1264 | 1264 | public static function banned_fam() { |
1265 | 1265 | global $tmp_dir, $globalTransaction; |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | if ($globalTransaction) $Connection->db->commit(); |
1294 | 1294 | } |
1295 | 1295 | return ''; |
1296 | - } |
|
1296 | + } |
|
1297 | 1297 | |
1298 | 1298 | public static function tle($filename,$tletype) { |
1299 | 1299 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1304,10 +1304,10 @@ discard block |
||
1304 | 1304 | try { |
1305 | 1305 | $Connection = new Connection(); |
1306 | 1306 | $sth = $Connection->db->prepare($query); |
1307 | - $sth->execute(array(':source' => $filename)); |
|
1308 | - } catch(PDOException $e) { |
|
1309 | - return "error : ".$e->getMessage(); |
|
1310 | - } |
|
1307 | + $sth->execute(array(':source' => $filename)); |
|
1308 | + } catch(PDOException $e) { |
|
1309 | + return "error : ".$e->getMessage(); |
|
1310 | + } |
|
1311 | 1311 | |
1312 | 1312 | $Connection = new Connection(); |
1313 | 1313 | if (($handle = fopen($filename, 'r')) !== FALSE) |
@@ -1342,13 +1342,13 @@ discard block |
||
1342 | 1342 | //$Connection->db->commit(); |
1343 | 1343 | } |
1344 | 1344 | return ''; |
1345 | - } |
|
1345 | + } |
|
1346 | 1346 | |
1347 | 1347 | /** |
1348 | - * Convert a HTML table to an array |
|
1349 | - * @param String $data HTML page |
|
1350 | - * @return Array array of the tables in HTML page |
|
1351 | - */ |
|
1348 | + * Convert a HTML table to an array |
|
1349 | + * @param String $data HTML page |
|
1350 | + * @return Array array of the tables in HTML page |
|
1351 | + */ |
|
1352 | 1352 | /* |
1353 | 1353 | private static function table2array($data) { |
1354 | 1354 | $html = str_get_html($data); |
@@ -1378,11 +1378,11 @@ discard block |
||
1378 | 1378 | return(array_filter($tabledata)); |
1379 | 1379 | } |
1380 | 1380 | */ |
1381 | - /** |
|
1382 | - * Get data from form result |
|
1383 | - * @param String $url form URL |
|
1384 | - * @return String the result |
|
1385 | - */ |
|
1381 | + /** |
|
1382 | + * Get data from form result |
|
1383 | + * @param String $url form URL |
|
1384 | + * @return String the result |
|
1385 | + */ |
|
1386 | 1386 | /* |
1387 | 1387 | private static function getData($url) { |
1388 | 1388 | $ch = curl_init(); |
@@ -1475,7 +1475,7 @@ discard block |
||
1475 | 1475 | if ($globalTransaction) $Connection->db->commit(); |
1476 | 1476 | } |
1477 | 1477 | return ''; |
1478 | - } |
|
1478 | + } |
|
1479 | 1479 | |
1480 | 1480 | public static function ivao_airlines($filename) { |
1481 | 1481 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1485,10 +1485,10 @@ discard block |
||
1485 | 1485 | try { |
1486 | 1486 | $Connection = new Connection(); |
1487 | 1487 | $sth = $Connection->db->prepare($query); |
1488 | - $sth->execute(); |
|
1489 | - } catch(PDOException $e) { |
|
1490 | - return "error : ".$e->getMessage(); |
|
1491 | - } |
|
1488 | + $sth->execute(); |
|
1489 | + } catch(PDOException $e) { |
|
1490 | + return "error : ".$e->getMessage(); |
|
1491 | + } |
|
1492 | 1492 | |
1493 | 1493 | $header = NULL; |
1494 | 1494 | $delimiter = ':'; |
@@ -1512,7 +1512,7 @@ discard block |
||
1512 | 1512 | if ($globalTransaction) $Connection->db->commit(); |
1513 | 1513 | } |
1514 | 1514 | return ''; |
1515 | - } |
|
1515 | + } |
|
1516 | 1516 | |
1517 | 1517 | public static function update_airspace() { |
1518 | 1518 | global $tmp_dir, $globalDBdriver; |
@@ -1522,11 +1522,11 @@ discard block |
||
1522 | 1522 | $query = 'DROP TABLE airspace'; |
1523 | 1523 | try { |
1524 | 1524 | $sth = $Connection->db->prepare($query); |
1525 | - $sth->execute(); |
|
1526 | - } catch(PDOException $e) { |
|
1525 | + $sth->execute(); |
|
1526 | + } catch(PDOException $e) { |
|
1527 | 1527 | return "error : ".$e->getMessage(); |
1528 | - } |
|
1529 | - } |
|
1528 | + } |
|
1529 | + } |
|
1530 | 1530 | |
1531 | 1531 | |
1532 | 1532 | if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
@@ -1581,10 +1581,10 @@ discard block |
||
1581 | 1581 | $query = 'DROP TABLE countries'; |
1582 | 1582 | try { |
1583 | 1583 | $sth = $Connection->db->prepare($query); |
1584 | - $sth->execute(); |
|
1585 | - } catch(PDOException $e) { |
|
1586 | - echo "error : ".$e->getMessage(); |
|
1587 | - } |
|
1584 | + $sth->execute(); |
|
1585 | + } catch(PDOException $e) { |
|
1586 | + echo "error : ".$e->getMessage(); |
|
1587 | + } |
|
1588 | 1588 | } |
1589 | 1589 | if ($globalDBdriver == 'mysql') { |
1590 | 1590 | update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
@@ -2113,11 +2113,11 @@ discard block |
||
2113 | 2113 | $query = 'DROP TABLE airspace'; |
2114 | 2114 | try { |
2115 | 2115 | $sth = $Connection->db->prepare($query); |
2116 | - $sth->execute(); |
|
2117 | - } catch(PDOException $e) { |
|
2116 | + $sth->execute(); |
|
2117 | + } catch(PDOException $e) { |
|
2118 | 2118 | return "error : ".$e->getMessage(); |
2119 | - } |
|
2120 | - } |
|
2119 | + } |
|
2120 | + } |
|
2121 | 2121 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2122 | 2122 | update_db::insert_airspace_version($airspace_md5); |
2123 | 2123 | } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
@@ -2299,12 +2299,12 @@ discard block |
||
2299 | 2299 | echo $data; |
2300 | 2300 | */ |
2301 | 2301 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2302 | - //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
2303 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2304 | - $result = fread($fh,100000000); |
|
2305 | - //echo $result; |
|
2306 | - //var_dump(str_get_html($result)); |
|
2307 | - //print_r(self::table2array($result)); |
|
2302 | + //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
2303 | + $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2304 | + $result = fread($fh,100000000); |
|
2305 | + //echo $result; |
|
2306 | + //var_dump(str_get_html($result)); |
|
2307 | + //print_r(self::table2array($result)); |
|
2308 | 2308 | } |
2309 | 2309 | |
2310 | 2310 | } |
@@ -2318,10 +2318,10 @@ discard block |
||
2318 | 2318 | try { |
2319 | 2319 | $Connection = new Connection(); |
2320 | 2320 | $sth = $Connection->db->prepare($query); |
2321 | - $sth->execute(); |
|
2322 | - } catch(PDOException $e) { |
|
2323 | - return "error : ".$e->getMessage(); |
|
2324 | - } |
|
2321 | + $sth->execute(); |
|
2322 | + } catch(PDOException $e) { |
|
2323 | + return "error : ".$e->getMessage(); |
|
2324 | + } |
|
2325 | 2325 | |
2326 | 2326 | $error = ''; |
2327 | 2327 | if ($globalDebug) echo "Notam : Download..."; |
@@ -2377,8 +2377,8 @@ discard block |
||
2377 | 2377 | $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
2378 | 2378 | $data['permanent'] = 0; |
2379 | 2379 | } else { |
2380 | - $data['date_end'] = NULL; |
|
2381 | - $data['permanent'] = 1; |
|
2380 | + $data['date_end'] = NULL; |
|
2381 | + $data['permanent'] = 1; |
|
2382 | 2382 | } |
2383 | 2383 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2384 | 2384 | $NOTAM = new NOTAM(); |
@@ -2452,13 +2452,13 @@ discard block |
||
2452 | 2452 | try { |
2453 | 2453 | $Connection = new Connection(); |
2454 | 2454 | $sth = $Connection->db->prepare($query); |
2455 | - $sth->execute(); |
|
2456 | - } catch(PDOException $e) { |
|
2457 | - return "error : ".$e->getMessage(); |
|
2458 | - } |
|
2459 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2460 | - if ($row['nb'] > 0) return false; |
|
2461 | - else return true; |
|
2455 | + $sth->execute(); |
|
2456 | + } catch(PDOException $e) { |
|
2457 | + return "error : ".$e->getMessage(); |
|
2458 | + } |
|
2459 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2460 | + if ($row['nb'] > 0) return false; |
|
2461 | + else return true; |
|
2462 | 2462 | } |
2463 | 2463 | |
2464 | 2464 | public static function insert_last_update() { |
@@ -2467,10 +2467,10 @@ discard block |
||
2467 | 2467 | try { |
2468 | 2468 | $Connection = new Connection(); |
2469 | 2469 | $sth = $Connection->db->prepare($query); |
2470 | - $sth->execute(); |
|
2471 | - } catch(PDOException $e) { |
|
2472 | - return "error : ".$e->getMessage(); |
|
2473 | - } |
|
2470 | + $sth->execute(); |
|
2471 | + } catch(PDOException $e) { |
|
2472 | + return "error : ".$e->getMessage(); |
|
2473 | + } |
|
2474 | 2474 | } |
2475 | 2475 | |
2476 | 2476 | public static function check_airspace_version($version) { |
@@ -2478,13 +2478,13 @@ discard block |
||
2478 | 2478 | try { |
2479 | 2479 | $Connection = new Connection(); |
2480 | 2480 | $sth = $Connection->db->prepare($query); |
2481 | - $sth->execute(array(':version' => $version)); |
|
2482 | - } catch(PDOException $e) { |
|
2483 | - return "error : ".$e->getMessage(); |
|
2484 | - } |
|
2485 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2486 | - if ($row['nb'] > 0) return true; |
|
2487 | - else return false; |
|
2481 | + $sth->execute(array(':version' => $version)); |
|
2482 | + } catch(PDOException $e) { |
|
2483 | + return "error : ".$e->getMessage(); |
|
2484 | + } |
|
2485 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2486 | + if ($row['nb'] > 0) return true; |
|
2487 | + else return false; |
|
2488 | 2488 | } |
2489 | 2489 | |
2490 | 2490 | public static function check_geoid_version($version) { |
@@ -2492,13 +2492,13 @@ discard block |
||
2492 | 2492 | try { |
2493 | 2493 | $Connection = new Connection(); |
2494 | 2494 | $sth = $Connection->db->prepare($query); |
2495 | - $sth->execute(array(':version' => $version)); |
|
2496 | - } catch(PDOException $e) { |
|
2497 | - return "error : ".$e->getMessage(); |
|
2498 | - } |
|
2499 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2500 | - if ($row['nb'] > 0) return true; |
|
2501 | - else return false; |
|
2495 | + $sth->execute(array(':version' => $version)); |
|
2496 | + } catch(PDOException $e) { |
|
2497 | + return "error : ".$e->getMessage(); |
|
2498 | + } |
|
2499 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2500 | + if ($row['nb'] > 0) return true; |
|
2501 | + else return false; |
|
2502 | 2502 | } |
2503 | 2503 | |
2504 | 2504 | public static function check_marine_identity_version($version) { |
@@ -2506,13 +2506,13 @@ discard block |
||
2506 | 2506 | try { |
2507 | 2507 | $Connection = new Connection(); |
2508 | 2508 | $sth = $Connection->db->prepare($query); |
2509 | - $sth->execute(array(':version' => $version)); |
|
2510 | - } catch(PDOException $e) { |
|
2511 | - return "error : ".$e->getMessage(); |
|
2512 | - } |
|
2513 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2514 | - if ($row['nb'] > 0) return true; |
|
2515 | - else return false; |
|
2509 | + $sth->execute(array(':version' => $version)); |
|
2510 | + } catch(PDOException $e) { |
|
2511 | + return "error : ".$e->getMessage(); |
|
2512 | + } |
|
2513 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2514 | + if ($row['nb'] > 0) return true; |
|
2515 | + else return false; |
|
2516 | 2516 | } |
2517 | 2517 | |
2518 | 2518 | |
@@ -2534,10 +2534,10 @@ discard block |
||
2534 | 2534 | try { |
2535 | 2535 | $Connection = new Connection(); |
2536 | 2536 | $sth = $Connection->db->prepare($query); |
2537 | - $sth->execute(array(':version' => $version)); |
|
2538 | - } catch(PDOException $e) { |
|
2539 | - return "error : ".$e->getMessage(); |
|
2540 | - } |
|
2537 | + $sth->execute(array(':version' => $version)); |
|
2538 | + } catch(PDOException $e) { |
|
2539 | + return "error : ".$e->getMessage(); |
|
2540 | + } |
|
2541 | 2541 | } |
2542 | 2542 | |
2543 | 2543 | public static function insert_marine_identity_version($version) { |
@@ -2546,10 +2546,10 @@ discard block |
||
2546 | 2546 | try { |
2547 | 2547 | $Connection = new Connection(); |
2548 | 2548 | $sth = $Connection->db->prepare($query); |
2549 | - $sth->execute(array(':version' => $version)); |
|
2550 | - } catch(PDOException $e) { |
|
2551 | - return "error : ".$e->getMessage(); |
|
2552 | - } |
|
2549 | + $sth->execute(array(':version' => $version)); |
|
2550 | + } catch(PDOException $e) { |
|
2551 | + return "error : ".$e->getMessage(); |
|
2552 | + } |
|
2553 | 2553 | } |
2554 | 2554 | |
2555 | 2555 | public static function check_last_notam_update() { |
@@ -2562,13 +2562,13 @@ discard block |
||
2562 | 2562 | try { |
2563 | 2563 | $Connection = new Connection(); |
2564 | 2564 | $sth = $Connection->db->prepare($query); |
2565 | - $sth->execute(); |
|
2566 | - } catch(PDOException $e) { |
|
2567 | - return "error : ".$e->getMessage(); |
|
2568 | - } |
|
2569 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2570 | - if ($row['nb'] > 0) return false; |
|
2571 | - else return true; |
|
2565 | + $sth->execute(); |
|
2566 | + } catch(PDOException $e) { |
|
2567 | + return "error : ".$e->getMessage(); |
|
2568 | + } |
|
2569 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2570 | + if ($row['nb'] > 0) return false; |
|
2571 | + else return true; |
|
2572 | 2572 | } |
2573 | 2573 | |
2574 | 2574 | public static function insert_last_notam_update() { |
@@ -2577,10 +2577,10 @@ discard block |
||
2577 | 2577 | try { |
2578 | 2578 | $Connection = new Connection(); |
2579 | 2579 | $sth = $Connection->db->prepare($query); |
2580 | - $sth->execute(); |
|
2581 | - } catch(PDOException $e) { |
|
2582 | - return "error : ".$e->getMessage(); |
|
2583 | - } |
|
2580 | + $sth->execute(); |
|
2581 | + } catch(PDOException $e) { |
|
2582 | + return "error : ".$e->getMessage(); |
|
2583 | + } |
|
2584 | 2584 | } |
2585 | 2585 | |
2586 | 2586 | public static function check_last_airspace_update() { |
@@ -2593,13 +2593,13 @@ discard block |
||
2593 | 2593 | try { |
2594 | 2594 | $Connection = new Connection(); |
2595 | 2595 | $sth = $Connection->db->prepare($query); |
2596 | - $sth->execute(); |
|
2597 | - } catch(PDOException $e) { |
|
2598 | - return "error : ".$e->getMessage(); |
|
2599 | - } |
|
2600 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2601 | - if ($row['nb'] > 0) return false; |
|
2602 | - else return true; |
|
2596 | + $sth->execute(); |
|
2597 | + } catch(PDOException $e) { |
|
2598 | + return "error : ".$e->getMessage(); |
|
2599 | + } |
|
2600 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2601 | + if ($row['nb'] > 0) return false; |
|
2602 | + else return true; |
|
2603 | 2603 | } |
2604 | 2604 | |
2605 | 2605 | public static function insert_last_airspace_update() { |
@@ -2608,10 +2608,10 @@ discard block |
||
2608 | 2608 | try { |
2609 | 2609 | $Connection = new Connection(); |
2610 | 2610 | $sth = $Connection->db->prepare($query); |
2611 | - $sth->execute(); |
|
2612 | - } catch(PDOException $e) { |
|
2613 | - return "error : ".$e->getMessage(); |
|
2614 | - } |
|
2611 | + $sth->execute(); |
|
2612 | + } catch(PDOException $e) { |
|
2613 | + return "error : ".$e->getMessage(); |
|
2614 | + } |
|
2615 | 2615 | } |
2616 | 2616 | |
2617 | 2617 | public static function check_last_geoid_update() { |
@@ -2624,13 +2624,13 @@ 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 | - } |
|
2631 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2632 | - if ($row['nb'] > 0) return false; |
|
2633 | - else return true; |
|
2627 | + $sth->execute(); |
|
2628 | + } catch(PDOException $e) { |
|
2629 | + return "error : ".$e->getMessage(); |
|
2630 | + } |
|
2631 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2632 | + if ($row['nb'] > 0) return false; |
|
2633 | + else return true; |
|
2634 | 2634 | } |
2635 | 2635 | |
2636 | 2636 | public static function insert_last_geoid_update() { |
@@ -2639,10 +2639,10 @@ 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 | - } |
|
2642 | + $sth->execute(); |
|
2643 | + } catch(PDOException $e) { |
|
2644 | + return "error : ".$e->getMessage(); |
|
2645 | + } |
|
2646 | 2646 | } |
2647 | 2647 | |
2648 | 2648 | public static function check_last_owner_update() { |
@@ -2655,13 +2655,13 @@ discard block |
||
2655 | 2655 | try { |
2656 | 2656 | $Connection = new Connection(); |
2657 | 2657 | $sth = $Connection->db->prepare($query); |
2658 | - $sth->execute(); |
|
2659 | - } catch(PDOException $e) { |
|
2660 | - return "error : ".$e->getMessage(); |
|
2661 | - } |
|
2662 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2663 | - if ($row['nb'] > 0) return false; |
|
2664 | - else return true; |
|
2658 | + $sth->execute(); |
|
2659 | + } catch(PDOException $e) { |
|
2660 | + return "error : ".$e->getMessage(); |
|
2661 | + } |
|
2662 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2663 | + if ($row['nb'] > 0) return false; |
|
2664 | + else return true; |
|
2665 | 2665 | } |
2666 | 2666 | |
2667 | 2667 | public static function insert_last_owner_update() { |
@@ -2670,10 +2670,10 @@ discard block |
||
2670 | 2670 | try { |
2671 | 2671 | $Connection = new Connection(); |
2672 | 2672 | $sth = $Connection->db->prepare($query); |
2673 | - $sth->execute(); |
|
2674 | - } catch(PDOException $e) { |
|
2675 | - return "error : ".$e->getMessage(); |
|
2676 | - } |
|
2673 | + $sth->execute(); |
|
2674 | + } catch(PDOException $e) { |
|
2675 | + return "error : ".$e->getMessage(); |
|
2676 | + } |
|
2677 | 2677 | } |
2678 | 2678 | public static function check_last_schedules_update() { |
2679 | 2679 | global $globalDBdriver; |
@@ -2685,13 +2685,13 @@ discard block |
||
2685 | 2685 | try { |
2686 | 2686 | $Connection = new Connection(); |
2687 | 2687 | $sth = $Connection->db->prepare($query); |
2688 | - $sth->execute(); |
|
2689 | - } catch(PDOException $e) { |
|
2690 | - return "error : ".$e->getMessage(); |
|
2691 | - } |
|
2692 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2693 | - if ($row['nb'] > 0) return false; |
|
2694 | - else return true; |
|
2688 | + $sth->execute(); |
|
2689 | + } catch(PDOException $e) { |
|
2690 | + return "error : ".$e->getMessage(); |
|
2691 | + } |
|
2692 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2693 | + if ($row['nb'] > 0) return false; |
|
2694 | + else return true; |
|
2695 | 2695 | } |
2696 | 2696 | |
2697 | 2697 | public static function insert_last_schedules_update() { |
@@ -2700,10 +2700,10 @@ discard block |
||
2700 | 2700 | try { |
2701 | 2701 | $Connection = new Connection(); |
2702 | 2702 | $sth = $Connection->db->prepare($query); |
2703 | - $sth->execute(); |
|
2704 | - } catch(PDOException $e) { |
|
2705 | - return "error : ".$e->getMessage(); |
|
2706 | - } |
|
2703 | + $sth->execute(); |
|
2704 | + } catch(PDOException $e) { |
|
2705 | + return "error : ".$e->getMessage(); |
|
2706 | + } |
|
2707 | 2707 | } |
2708 | 2708 | public static function check_last_tle_update() { |
2709 | 2709 | global $globalDBdriver; |
@@ -2715,13 +2715,13 @@ discard block |
||
2715 | 2715 | try { |
2716 | 2716 | $Connection = new Connection(); |
2717 | 2717 | $sth = $Connection->db->prepare($query); |
2718 | - $sth->execute(); |
|
2719 | - } catch(PDOException $e) { |
|
2720 | - return "error : ".$e->getMessage(); |
|
2721 | - } |
|
2722 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2723 | - if ($row['nb'] > 0) return false; |
|
2724 | - else return true; |
|
2718 | + $sth->execute(); |
|
2719 | + } catch(PDOException $e) { |
|
2720 | + return "error : ".$e->getMessage(); |
|
2721 | + } |
|
2722 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2723 | + if ($row['nb'] > 0) return false; |
|
2724 | + else return true; |
|
2725 | 2725 | } |
2726 | 2726 | |
2727 | 2727 | public static function insert_last_tle_update() { |
@@ -2730,10 +2730,10 @@ discard block |
||
2730 | 2730 | try { |
2731 | 2731 | $Connection = new Connection(); |
2732 | 2732 | $sth = $Connection->db->prepare($query); |
2733 | - $sth->execute(); |
|
2734 | - } catch(PDOException $e) { |
|
2735 | - return "error : ".$e->getMessage(); |
|
2736 | - } |
|
2733 | + $sth->execute(); |
|
2734 | + } catch(PDOException $e) { |
|
2735 | + return "error : ".$e->getMessage(); |
|
2736 | + } |
|
2737 | 2737 | } |
2738 | 2738 | public static function check_last_marine_identity_update() { |
2739 | 2739 | global $globalDBdriver; |
@@ -2745,13 +2745,13 @@ discard block |
||
2745 | 2745 | try { |
2746 | 2746 | $Connection = new Connection(); |
2747 | 2747 | $sth = $Connection->db->prepare($query); |
2748 | - $sth->execute(); |
|
2749 | - } catch(PDOException $e) { |
|
2750 | - return "error : ".$e->getMessage(); |
|
2751 | - } |
|
2752 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2753 | - if ($row['nb'] > 0) return false; |
|
2754 | - else return true; |
|
2748 | + $sth->execute(); |
|
2749 | + } catch(PDOException $e) { |
|
2750 | + return "error : ".$e->getMessage(); |
|
2751 | + } |
|
2752 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
2753 | + if ($row['nb'] > 0) return false; |
|
2754 | + else return true; |
|
2755 | 2755 | } |
2756 | 2756 | |
2757 | 2757 | public static function insert_last_marine_identity_update() { |
@@ -2760,10 +2760,10 @@ discard block |
||
2760 | 2760 | try { |
2761 | 2761 | $Connection = new Connection(); |
2762 | 2762 | $sth = $Connection->db->prepare($query); |
2763 | - $sth->execute(); |
|
2764 | - } catch(PDOException $e) { |
|
2765 | - return "error : ".$e->getMessage(); |
|
2766 | - } |
|
2763 | + $sth->execute(); |
|
2764 | + } catch(PDOException $e) { |
|
2765 | + return "error : ".$e->getMessage(); |
|
2766 | + } |
|
2767 | 2767 | } |
2768 | 2768 | public static function delete_duplicatemodes() { |
2769 | 2769 | global $globalDBdriver; |
@@ -2775,10 +2775,10 @@ discard block |
||
2775 | 2775 | try { |
2776 | 2776 | $Connection = new Connection(); |
2777 | 2777 | $sth = $Connection->db->prepare($query); |
2778 | - $sth->execute(); |
|
2779 | - } catch(PDOException $e) { |
|
2780 | - return "error : ".$e->getMessage(); |
|
2781 | - } |
|
2778 | + $sth->execute(); |
|
2779 | + } catch(PDOException $e) { |
|
2780 | + return "error : ".$e->getMessage(); |
|
2781 | + } |
|
2782 | 2782 | } |
2783 | 2783 | public static function delete_duplicateowner() { |
2784 | 2784 | global $globalDBdriver; |
@@ -2790,10 +2790,10 @@ discard block |
||
2790 | 2790 | try { |
2791 | 2791 | $Connection = new Connection(); |
2792 | 2792 | $sth = $Connection->db->prepare($query); |
2793 | - $sth->execute(); |
|
2794 | - } catch(PDOException $e) { |
|
2795 | - return "error : ".$e->getMessage(); |
|
2796 | - } |
|
2793 | + $sth->execute(); |
|
2794 | + } catch(PDOException $e) { |
|
2795 | + return "error : ".$e->getMessage(); |
|
2796 | + } |
|
2797 | 2797 | } |
2798 | 2798 | |
2799 | 2799 | public static function update_all() { |
@@ -7,35 +7,35 @@ discard block |
||
7 | 7 | public $latest_schema = 45; |
8 | 8 | |
9 | 9 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
10 | - global $globalNoDB; |
|
11 | - if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
10 | + global $globalNoDB; |
|
11 | + if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
12 | 12 | $this->db = null; |
13 | - } else { |
|
13 | + } else { |
|
14 | 14 | if ($dbc === null) { |
15 | - if ($this->db === null && $dbname === null) { |
|
15 | + if ($this->db === null && $dbname === null) { |
|
16 | 16 | if ($user === null && $pass === null) { |
17 | - $this->createDBConnection(); |
|
17 | + $this->createDBConnection(); |
|
18 | 18 | } else { |
19 | - $this->createDBConnection(null,$user,$pass); |
|
19 | + $this->createDBConnection(null,$user,$pass); |
|
20 | 20 | } |
21 | - } else { |
|
21 | + } else { |
|
22 | 22 | $this->createDBConnection($dbname); |
23 | - } |
|
23 | + } |
|
24 | 24 | } elseif ($dbname === null || $dbname === 'default') { |
25 | - $this->db = $dbc; |
|
26 | - if ($this->connectionExists() === false) { |
|
25 | + $this->db = $dbc; |
|
26 | + if ($this->connectionExists() === false) { |
|
27 | 27 | /* |
28 | 28 | echo 'Restart Connection !!!'."\n"; |
29 | 29 | $e = new \Exception; |
30 | 30 | var_dump($e->getTraceAsString()); |
31 | 31 | */ |
32 | 32 | $this->createDBConnection(); |
33 | - } |
|
33 | + } |
|
34 | 34 | } else { |
35 | - //$this->connectionExists(); |
|
36 | - $this->dbs[$dbname] = $dbc; |
|
35 | + //$this->connectionExists(); |
|
36 | + $this->dbs[$dbname] = $dbc; |
|
37 | + } |
|
37 | 38 | } |
38 | - } |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function db() { |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | - * Creates the database connection |
|
60 | - * |
|
61 | - * @return Boolean of the database connection |
|
62 | - * |
|
63 | - */ |
|
59 | + * Creates the database connection |
|
60 | + * |
|
61 | + * @return Boolean of the database connection |
|
62 | + * |
|
63 | + */ |
|
64 | 64 | |
65 | 65 | public function createDBConnection($DBname = null, $user = null, $pass = null) |
66 | 66 | { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | if($results->rowCount()>0) { |
160 | - return true; |
|
160 | + return true; |
|
161 | 161 | } |
162 | 162 | else return false; |
163 | 163 | } |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | $sum = $sum->fetchColumn(0); |
175 | 175 | } else $sum = 0; |
176 | 176 | if (intval($sum) !== 2) { |
177 | - return false; |
|
177 | + return false; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | } catch(PDOException $e) { |
181 | 181 | if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
182 | - throw $e; |
|
183 | - } |
|
184 | - //echo 'error ! '.$e->getMessage(); |
|
182 | + throw $e; |
|
183 | + } |
|
184 | + //echo 'error ! '.$e->getMessage(); |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | return true; |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | $version = 0; |
286 | 286 | if ($this->tableExists('aircraft')) { |
287 | 287 | if (!$this->tableExists('config')) { |
288 | - $version = '1'; |
|
289 | - return $version; |
|
288 | + $version = '1'; |
|
289 | + return $version; |
|
290 | 290 | } else { |
291 | 291 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
292 | 292 | try { |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | * @return Boolean if latest version or not |
308 | 308 | */ |
309 | 309 | public function latest() { |
310 | - global $globalNoDB; |
|
311 | - if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
312 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
313 | - else return false; |
|
310 | + global $globalNoDB; |
|
311 | + if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
312 | + if ($this->check_schema_version() == $this->latest_schema) return true; |
|
313 | + else return false; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | } |