@@ -68,15 +68,15 @@ discard block |
||
68 | 68 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_create') { |
69 | 69 | $dbroot = $_SESSION['database_root']; |
70 | 70 | $dbrootpass = $_SESSION['database_rootpass']; |
71 | - $error .= create_db::create_database($dbroot,$dbrootpass,$globalDBuser,$globalDBpass,$globalDBname,$globalDBdriver,$globalDBhost); |
|
71 | + $error .= create_db::create_database($dbroot, $dbrootpass, $globalDBuser, $globalDBpass, $globalDBname, $globalDBdriver, $globalDBhost); |
|
72 | 72 | sleep(5); |
73 | 73 | if ($error != '') { |
74 | 74 | $_SESSION['error'] = $error; |
75 | 75 | } |
76 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
76 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Create database')); |
|
77 | 77 | $_SESSION['install'] = 'database_import'; |
78 | 78 | $_SESSION['next'] = 'Create and import tables'; |
79 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
79 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
80 | 80 | print json_encode($result); |
81 | 81 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') { |
82 | 82 | if (update_schema::check_version(false) == '0') { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | if ($error != '') { |
89 | 89 | $_SESSION['error'] = $error; |
90 | 90 | } |
91 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
91 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Create and import tables')); |
|
92 | 92 | if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
93 | 93 | $_SESSION['install'] = 'populate'; |
94 | 94 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
@@ -96,84 +96,84 @@ discard block |
||
96 | 96 | $_SESSION['install'] = 'sources'; |
97 | 97 | $_SESSION['next'] = 'Insert data in source table'; |
98 | 98 | } |
99 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
99 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
100 | 100 | print json_encode($result); |
101 | 101 | } else { |
102 | 102 | $error .= update_schema::check_version(true); |
103 | 103 | if ($error != '') { |
104 | 104 | $_SESSION['error'] = $error; |
105 | 105 | } |
106 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
106 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Update schema if needed')); |
|
107 | 107 | $_SESSION['install'] = 'sources'; |
108 | 108 | $_SESSION['next'] = 'Insert data in source table'; |
109 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
109 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
110 | 110 | print json_encode($result); |
111 | 111 | } |
112 | 112 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'waypoints') { |
113 | 113 | include_once('class.update_db.php'); |
114 | 114 | $error .= update_db::update_waypoints(); |
115 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
115 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate waypoints database')); |
|
116 | 116 | |
117 | 117 | $_SESSION['install'] = 'airspace'; |
118 | 118 | $_SESSION['next'] = 'Populate airspace table'; |
119 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
119 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
120 | 120 | print json_encode($result); |
121 | 121 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'airspace') { |
122 | 122 | include_once('class.update_db.php'); |
123 | 123 | $error .= update_db::update_airspace_fam(); |
124 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate airspace database')); |
|
124 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate airspace database')); |
|
125 | 125 | $_SESSION['install'] = 'countries'; |
126 | 126 | $_SESSION['next'] = 'Populate countries table'; |
127 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
127 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
128 | 128 | print json_encode($result); |
129 | 129 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'countries') { |
130 | 130 | include_once('class.update_db.php'); |
131 | 131 | $error .= update_db::update_countries(); |
132 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
132 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate countries database')); |
|
133 | 133 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
134 | 134 | $_SESSION['install'] = 'notam'; |
135 | 135 | $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
136 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
136 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
137 | 137 | print json_encode($result); |
138 | 138 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
139 | 139 | $_SESSION['install'] = 'owner'; |
140 | 140 | $_SESSION['next'] = 'Populate owner table with externals data'; |
141 | 141 | unset($_SESSION['owner']); |
142 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
142 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
143 | 143 | print json_encode($result); |
144 | 144 | } else { |
145 | 145 | $_SESSION['install'] = 'sources'; |
146 | 146 | $_SESSION['next'] = 'Insert data in source table'; |
147 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
147 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
148 | 148 | print json_encode($result); |
149 | 149 | } |
150 | 150 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
151 | 151 | if (!is_writable('tmp')) { |
152 | 152 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
153 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
153 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
154 | 154 | print json_encode($result); |
155 | 155 | } else { |
156 | 156 | include_once('class.update_db.php'); |
157 | 157 | $globalDebug = FALSE; |
158 | 158 | $error .= update_db::update_ModeS_fam(); |
159 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
159 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
160 | 160 | |
161 | 161 | $_SESSION['install'] = 'populate_flarm'; |
162 | 162 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM'; |
163 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
163 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
164 | 164 | print json_encode($result); |
165 | 165 | } |
166 | 166 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') { |
167 | 167 | if (!is_writable('tmp')) { |
168 | 168 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
169 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
169 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
170 | 170 | print json_encode($result); |
171 | 171 | } else { |
172 | 172 | include_once('class.update_db.php'); |
173 | 173 | $globalDebug = FALSE; |
174 | 174 | //$error .= update_db::update_ModeS_flarm(); |
175 | 175 | $error .= update_db::update_ModeS_ogn(); |
176 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
176 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
177 | 177 | |
178 | 178 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
179 | 179 | $_SESSION['install'] = 'vatsim'; |
@@ -193,34 +193,34 @@ discard block |
||
193 | 193 | $_SESSION['install'] = 'routes'; |
194 | 194 | $_SESSION['next'] = 'Populate routes table with externals data'; |
195 | 195 | } |
196 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
196 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
197 | 197 | print json_encode($result); |
198 | 198 | } |
199 | 199 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') { |
200 | 200 | if (!is_writable('tmp')) { |
201 | 201 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
202 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
202 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
203 | 203 | print json_encode($result); |
204 | 204 | } else { |
205 | 205 | include_once('class.update_db.php'); |
206 | 206 | $globalDebug = FALSE; |
207 | 207 | $error .= update_db::update_routes_fam(); |
208 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data')); |
|
208 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate routes table with externals data')); |
|
209 | 209 | $_SESSION['install'] = 'translation'; |
210 | 210 | $_SESSION['next'] = 'Populate translation table with externals data'; |
211 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
211 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
212 | 212 | print json_encode($result); |
213 | 213 | } |
214 | 214 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') { |
215 | 215 | if (!is_writable('tmp')) { |
216 | 216 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
217 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
217 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
218 | 218 | print json_encode($result); |
219 | 219 | } else { |
220 | 220 | include_once('class.update_db.php'); |
221 | 221 | $globalDebug = FALSE; |
222 | 222 | $error .= update_db::update_translation(); |
223 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data')); |
|
223 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate translation table with externals data')); |
|
224 | 224 | |
225 | 225 | if ($_SESSION['waypoints'] == 1) { |
226 | 226 | $_SESSION['install'] = 'waypoints'; |
@@ -237,48 +237,48 @@ discard block |
||
237 | 237 | $_SESSION['install'] = 'sources'; |
238 | 238 | $_SESSION['next'] = 'Insert data in source table'; |
239 | 239 | } |
240 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
240 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
241 | 241 | print json_encode($result); |
242 | 242 | } |
243 | 243 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') { |
244 | 244 | if (!is_writable('tmp')) { |
245 | 245 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
246 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
246 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
247 | 247 | print json_encode($result); |
248 | 248 | } else { |
249 | 249 | include_once('class.update_db.php'); |
250 | 250 | $globalDebug = FALSE; |
251 | 251 | $error = update_db::update_owner_fam(); |
252 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data')); |
|
252 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate owner table with externals data')); |
|
253 | 253 | $_SESSION['install'] = 'sources'; |
254 | 254 | $_SESSION['next'] = 'Insert data in source table'; |
255 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
255 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
256 | 256 | print json_encode($result); |
257 | 257 | } |
258 | 258 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') { |
259 | 259 | if (!is_writable('tmp')) { |
260 | 260 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
261 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
261 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
262 | 262 | print json_encode($result); |
263 | 263 | } else { |
264 | 264 | include_once('class.update_db.php'); |
265 | 265 | $globalDebug = FALSE; |
266 | 266 | if (isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
267 | 267 | $error .= update_db::update_notam(); |
268 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data')); |
|
268 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data')); |
|
269 | 269 | } else { |
270 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)')); |
|
270 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data (no source defined)')); |
|
271 | 271 | } |
272 | 272 | if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
273 | 273 | $_SESSION['install'] = 'owner'; |
274 | 274 | $_SESSION['next'] = 'Populate owner table'; |
275 | 275 | unset($_SESSION['owner']); |
276 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
276 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
277 | 277 | print json_encode($result); |
278 | 278 | } else { |
279 | 279 | $_SESSION['install'] = 'sources'; |
280 | 280 | $_SESSION['next'] = 'Insert data in source table'; |
281 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
281 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
282 | 282 | print json_encode($result); |
283 | 283 | } |
284 | 284 | } |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | $Source = new Source(); |
317 | 317 | $Source->deleteAllLocation(); |
318 | 318 | foreach ($sources as $src) { |
319 | - if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
|
319 | + if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'], $src['latitude'], $src['longitude'], $src['altitude'], $src['city'], $src['country'], $src['source'], 'antenna.png'); |
|
320 | 320 | } |
321 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
321 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert data in source table')); |
|
322 | 322 | unset($_SESSION['sources']); |
323 | 323 | } |
324 | 324 | /* |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | $_SESSION['install'] = 'finish'; |
344 | 344 | $_SESSION['next'] = 'finish'; |
345 | 345 | } |
346 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
346 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
347 | 347 | print json_encode($result); |
348 | 348 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'vatsim') { |
349 | 349 | include_once('../install/class.create_db.php'); |
@@ -353,36 +353,36 @@ discard block |
||
353 | 353 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
354 | 354 | if (file_exists('tmp/ivae_feb2013.zip')) { |
355 | 355 | $error .= update_db::update_IVAO(); |
356 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
356 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
357 | 357 | } else { |
358 | 358 | $error .= update_db::update_vatsim(); |
359 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
359 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
360 | 360 | } |
361 | 361 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
362 | 362 | $error .= update_db::update_vatsim(); |
363 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
363 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
364 | 364 | } elseif (isset($globalIVAO) && $globalIVAO) { |
365 | 365 | if (file_exists('tmp/ivae_feb2013.zip')) { |
366 | 366 | $error .= update_db::update_IVAO(); |
367 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
367 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
368 | 368 | } else { |
369 | 369 | $error .= update_db::update_vatsim(); |
370 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)')); |
|
370 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data (IVAO not found)')); |
|
371 | 371 | } |
372 | 372 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
373 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data')); |
|
373 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert phpVMS data')); |
|
374 | 374 | } |
375 | 375 | //$_SESSION['install'] = 'routes'; |
376 | 376 | //$_SESSION['next'] = 'Populate routes table with externals data'; |
377 | 377 | $_SESSION['install'] = 'finish'; |
378 | 378 | $_SESSION['next'] = 'finish'; |
379 | 379 | |
380 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
380 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
381 | 381 | print json_encode($result); |
382 | 382 | } else { |
383 | 383 | //unset($_SESSION['install']); |
384 | 384 | $_SESSION['error'] = 'Unknwon task : '.$_SESSION['install']; |
385 | - $result = array('error' => 'Unknwon task : '.$_SESSION['install'],'done' => $_SESSION['done'],'next' => 'finish','install' => 'finish'); |
|
385 | + $result = array('error' => 'Unknwon task : '.$_SESSION['install'], 'done' => $_SESSION['done'], 'next' => 'finish', 'install' => 'finish'); |
|
386 | 386 | print json_encode($result); |
387 | 387 | } |
388 | 388 | ?> |
389 | 389 | \ No newline at end of file |
@@ -8,24 +8,24 @@ discard block |
||
8 | 8 | * @param string $filename |
9 | 9 | */ |
10 | 10 | public static function import_file($filename) { |
11 | - $filename = filter_var($filename,FILTER_SANITIZE_STRING); |
|
11 | + $filename = filter_var($filename, FILTER_SANITIZE_STRING); |
|
12 | 12 | $Connection = new Connection(); |
13 | 13 | //Connection::$db->beginTransaction(); |
14 | 14 | $templine = ''; |
15 | - $handle = @fopen($filename,"r"); |
|
15 | + $handle = @fopen($filename, "r"); |
|
16 | 16 | if ($handle) { |
17 | 17 | //$lines = file($filename); |
18 | 18 | //foreach ($lines as $line) |
19 | - while (($line = fgets($handle,4096)) !== false) |
|
19 | + while (($line = fgets($handle, 4096)) !== false) |
|
20 | 20 | { |
21 | - if (substr($line,0,2) == '--' || $line == '') continue; |
|
21 | + if (substr($line, 0, 2) == '--' || $line == '') continue; |
|
22 | 22 | $templine .= $line; |
23 | - if (substr(trim($line), -1,1) == ';') |
|
23 | + if (substr(trim($line), -1, 1) == ';') |
|
24 | 24 | { |
25 | 25 | try { |
26 | 26 | $sth = $Connection->db->prepare($templine); |
27 | 27 | $sth->execute(); |
28 | - } catch(PDOException $e) { |
|
28 | + } catch (PDOException $e) { |
|
29 | 29 | return "error (import ".$filename.") : ".$e->getMessage()."\n"; |
30 | 30 | } |
31 | 31 | $templine = ''; |
@@ -42,21 +42,21 @@ discard block |
||
42 | 42 | $error = ''; |
43 | 43 | $dh = opendir($directory); |
44 | 44 | //foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename) |
45 | - while(false !== ($filename = readdir($dh))) |
|
45 | + while (false !== ($filename = readdir($dh))) |
|
46 | 46 | { |
47 | - if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename); |
|
47 | + if (preg_match('/\.sql$/', $filename)) $error .= create_db::import_file($directory.$filename); |
|
48 | 48 | } |
49 | 49 | return $error; |
50 | 50 | } |
51 | 51 | |
52 | - public static function create_database($root,$root_pass,$user,$pass,$db,$db_type,$host,$port = '') { |
|
53 | - $root = filter_var($root,FILTER_SANITIZE_STRING); |
|
54 | - $root_pass = filter_var($root_pass,FILTER_SANITIZE_STRING); |
|
55 | - $user = filter_var($user,FILTER_SANITIZE_STRING); |
|
56 | - $password = filter_var($pass,FILTER_SANITIZE_STRING); |
|
57 | - $db = filter_var($db,FILTER_SANITIZE_STRING); |
|
58 | - $db_type = filter_var($db_type,FILTER_SANITIZE_STRING); |
|
59 | - $host = filter_var($host,FILTER_SANITIZE_STRING); |
|
52 | + public static function create_database($root, $root_pass, $user, $pass, $db, $db_type, $host, $port = '') { |
|
53 | + $root = filter_var($root, FILTER_SANITIZE_STRING); |
|
54 | + $root_pass = filter_var($root_pass, FILTER_SANITIZE_STRING); |
|
55 | + $user = filter_var($user, FILTER_SANITIZE_STRING); |
|
56 | + $password = filter_var($pass, FILTER_SANITIZE_STRING); |
|
57 | + $db = filter_var($db, FILTER_SANITIZE_STRING); |
|
58 | + $db_type = filter_var($db_type, FILTER_SANITIZE_STRING); |
|
59 | + $host = filter_var($host, FILTER_SANITIZE_STRING); |
|
60 | 60 | if ($db_type == 'mysql' && $port == '') $port = 3306; |
61 | 61 | elseif ($port == '') $port = 5432; |
62 | 62 | // Dirty hack |
@@ -64,8 +64,8 @@ discard block |
||
64 | 64 | $grantright = $_SERVER['SERVER_ADDR']; |
65 | 65 | } else $grantright = 'localhost'; |
66 | 66 | try { |
67 | - if ($host == 'localhost') $dbh = new PDO($db_type.':host=127.0.0.1',$root,$root_pass); |
|
68 | - else $dbh = new PDO($db_type.':host='.$host.';port='.$port,$root,$root_pass); |
|
67 | + if ($host == 'localhost') $dbh = new PDO($db_type.':host=127.0.0.1', $root, $root_pass); |
|
68 | + else $dbh = new PDO($db_type.':host='.$host.';port='.$port, $root, $root_pass); |
|
69 | 69 | $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
70 | 70 | if ($db_type == 'mysql') { |
71 | 71 | $dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $dbh->exec("CREATE USER ".$user." WITH PASSWORD '".$password."'; |
76 | 76 | GRANT ALL PRIVILEGES ON DATABASE ".$db." TO ".$user.";"); |
77 | 77 | } |
78 | - } catch(PDOException $e) { |
|
78 | + } catch (PDOException $e) { |
|
79 | 79 | $dbh = null; |
80 | 80 | return "error : ".$e->getMessage(); |
81 | 81 | } |
@@ -18,7 +18,9 @@ discard block |
||
18 | 18 | //foreach ($lines as $line) |
19 | 19 | while (($line = fgets($handle,4096)) !== false) |
20 | 20 | { |
21 | - if (substr($line,0,2) == '--' || $line == '') continue; |
|
21 | + if (substr($line,0,2) == '--' || $line == '') { |
|
22 | + continue; |
|
23 | + } |
|
22 | 24 | $templine .= $line; |
23 | 25 | if (substr(trim($line), -1,1) == ';') |
24 | 26 | { |
@@ -44,7 +46,9 @@ discard block |
||
44 | 46 | //foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename) |
45 | 47 | while(false !== ($filename = readdir($dh))) |
46 | 48 | { |
47 | - if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename); |
|
49 | + if (preg_match('/\.sql$/',$filename)) { |
|
50 | + $error .= create_db::import_file($directory.$filename); |
|
51 | + } |
|
48 | 52 | } |
49 | 53 | return $error; |
50 | 54 | } |
@@ -57,19 +61,29 @@ discard block |
||
57 | 61 | $db = filter_var($db,FILTER_SANITIZE_STRING); |
58 | 62 | $db_type = filter_var($db_type,FILTER_SANITIZE_STRING); |
59 | 63 | $host = filter_var($host,FILTER_SANITIZE_STRING); |
60 | - if ($db_type == 'mysql' && $port == '') $port = 3306; |
|
61 | - elseif ($port == '') $port = 5432; |
|
64 | + if ($db_type == 'mysql' && $port == '') { |
|
65 | + $port = 3306; |
|
66 | + } elseif ($port == '') { |
|
67 | + $port = 5432; |
|
68 | + } |
|
62 | 69 | // Dirty hack |
63 | 70 | if ($host != 'localhost' && $host != '127.0.0.1') { |
64 | 71 | $grantright = $_SERVER['SERVER_ADDR']; |
65 | - } else $grantright = 'localhost'; |
|
72 | + } else { |
|
73 | + $grantright = 'localhost'; |
|
74 | + } |
|
66 | 75 | try { |
67 | - if ($host == 'localhost') $dbh = new PDO($db_type.':host=127.0.0.1',$root,$root_pass); |
|
68 | - else $dbh = new PDO($db_type.':host='.$host.';port='.$port,$root,$root_pass); |
|
76 | + if ($host == 'localhost') { |
|
77 | + $dbh = new PDO($db_type.':host=127.0.0.1',$root,$root_pass); |
|
78 | + } else { |
|
79 | + $dbh = new PDO($db_type.':host='.$host.';port='.$port,$root,$root_pass); |
|
80 | + } |
|
69 | 81 | $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
70 | 82 | if ($db_type == 'mysql') { |
71 | 83 | $dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); |
72 | - if ($grantright == 'localhost') $dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); |
|
84 | + if ($grantright == 'localhost') { |
|
85 | + $dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); |
|
86 | + } |
|
73 | 87 | } else if ($db_type == 'pgsql') { |
74 | 88 | $dbh->exec("CREATE DATABASE ".$db.";"); |
75 | 89 | $dbh->exec("CREATE USER ".$user." WITH PASSWORD '".$password."'; |
@@ -25,20 +25,20 @@ discard block |
||
25 | 25 | fclose($fp); |
26 | 26 | } |
27 | 27 | |
28 | - public static function gunzip($in_file,$out_file_name = '') { |
|
28 | + public static function gunzip($in_file, $out_file_name = '') { |
|
29 | 29 | //echo $in_file.' -> '.$out_file_name."\n"; |
30 | 30 | $buffer_size = 4096; // read 4kb at a time |
31 | 31 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
32 | 32 | if ($in_file != '' && file_exists($in_file)) { |
33 | 33 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
34 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
35 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
34 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
35 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
36 | 36 | else { |
37 | 37 | echo 'gzopen not available'; |
38 | 38 | die; |
39 | 39 | } |
40 | 40 | $out_file = fopen($out_file_name, 'wb'); |
41 | - while(!gzeof($file)) { |
|
41 | + while (!gzeof($file)) { |
|
42 | 42 | fwrite($out_file, gzread($file, $buffer_size)); |
43 | 43 | } |
44 | 44 | fclose($out_file); |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | try { |
63 | 63 | self::$db_sqlite = new PDO('sqlite:'.$database); |
64 | 64 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
65 | - } catch(PDOException $e) { |
|
65 | + } catch (PDOException $e) { |
|
66 | 66 | return "error : ".$e->getMessage(); |
67 | 67 | } |
68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | //$Connection = new Connection(); |
78 | 78 | $sth = $Connection->db->prepare($query); |
79 | 79 | $sth->execute(array(':source' => $database_file)); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | return "error : ".$e->getMessage(); |
82 | 82 | } |
83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | try { |
89 | 89 | $sth = update_db::$db_sqlite->prepare($query); |
90 | 90 | $sth->execute(); |
91 | - } catch(PDOException $e) { |
|
91 | + } catch (PDOException $e) { |
|
92 | 92 | return "error : ".$e->getMessage(); |
93 | 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)'; |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | if ($globalTransaction) $Connection->db->beginTransaction(); |
100 | 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 | - $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
102 | + $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 | - } catch(PDOException $e) { |
|
106 | + } catch (PDOException $e) { |
|
107 | 107 | if ($globalTransaction) $Connection->db->rollBack(); |
108 | 108 | return "error : ".$e->getMessage(); |
109 | 109 | } |
@@ -119,26 +119,26 @@ discard block |
||
119 | 119 | //$Connection = new Connection(); |
120 | 120 | $sth = $Connection->db->prepare($query); |
121 | 121 | $sth->execute(array(':source' => 'oneworld')); |
122 | - } catch(PDOException $e) { |
|
122 | + } catch (PDOException $e) { |
|
123 | 123 | return "error : ".$e->getMessage(); |
124 | 124 | } |
125 | 125 | |
126 | 126 | if ($globalDebug) echo " - Add routes to DB -"; |
127 | 127 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
128 | 128 | $Spotter = new Spotter(); |
129 | - if ($fh = fopen($database_file,"r")) { |
|
129 | + if ($fh = fopen($database_file, "r")) { |
|
130 | 130 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
131 | 131 | $Connection = new Connection(); |
132 | 132 | $sth_dest = $Connection->db->prepare($query_dest); |
133 | 133 | if ($globalTransaction) $Connection->db->beginTransaction(); |
134 | 134 | while (!feof($fh)) { |
135 | - $line = fgetcsv($fh,9999,','); |
|
135 | + $line = fgetcsv($fh, 9999, ','); |
|
136 | 136 | if ($line[0] != '') { |
137 | 137 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
138 | 138 | try { |
139 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
139 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
140 | 140 | $sth_dest->execute($query_dest_values); |
141 | - } catch(PDOException $e) { |
|
141 | + } catch (PDOException $e) { |
|
142 | 142 | if ($globalTransaction) $Connection->db->rollBack(); |
143 | 143 | return "error : ".$e->getMessage(); |
144 | 144 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | //$Connection = new Connection(); |
161 | 161 | $sth = $Connection->db->prepare($query); |
162 | 162 | $sth->execute(array(':source' => 'skyteam')); |
163 | - } catch(PDOException $e) { |
|
163 | + } catch (PDOException $e) { |
|
164 | 164 | return "error : ".$e->getMessage(); |
165 | 165 | } |
166 | 166 | |
@@ -168,24 +168,24 @@ discard block |
||
168 | 168 | |
169 | 169 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
170 | 170 | $Spotter = new Spotter(); |
171 | - if ($fh = fopen($database_file,"r")) { |
|
171 | + if ($fh = fopen($database_file, "r")) { |
|
172 | 172 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
173 | 173 | $Connection = new Connection(); |
174 | 174 | $sth_dest = $Connection->db->prepare($query_dest); |
175 | 175 | try { |
176 | 176 | if ($globalTransaction) $Connection->db->beginTransaction(); |
177 | 177 | while (!feof($fh)) { |
178 | - $line = fgetcsv($fh,9999,','); |
|
178 | + $line = fgetcsv($fh, 9999, ','); |
|
179 | 179 | if ($line[0] != '') { |
180 | - $datebe = explode(' - ',$line[2]); |
|
180 | + $datebe = explode(' - ', $line[2]); |
|
181 | 181 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
182 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
182 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
183 | 183 | $sth_dest->execute($query_dest_values); |
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | 187 | if ($globalTransaction) $Connection->db->commit(); |
188 | - } catch(PDOException $e) { |
|
188 | + } catch (PDOException $e) { |
|
189 | 189 | if ($globalTransaction) $Connection->db->rollBack(); |
190 | 190 | return "error : ".$e->getMessage(); |
191 | 191 | } |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | $Connection = new Connection(); |
201 | 201 | $sth = $Connection->db->prepare($query); |
202 | 202 | $sth->execute(array(':source' => $database_file)); |
203 | - } catch(PDOException $e) { |
|
203 | + } catch (PDOException $e) { |
|
204 | 204 | return "error : ".$e->getMessage(); |
205 | 205 | } |
206 | 206 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $Connection = new Connection(); |
209 | 209 | $sth = $Connection->db->prepare($query); |
210 | 210 | $sth->execute(array(':source' => $database_file)); |
211 | - } catch(PDOException $e) { |
|
211 | + } catch (PDOException $e) { |
|
212 | 212 | return "error : ".$e->getMessage(); |
213 | 213 | } |
214 | 214 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | try { |
218 | 218 | $sth = update_db::$db_sqlite->prepare($query); |
219 | 219 | $sth->execute(); |
220 | - } catch(PDOException $e) { |
|
220 | + } catch (PDOException $e) { |
|
221 | 221 | return "error : ".$e->getMessage(); |
222 | 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)'; |
@@ -234,15 +234,15 @@ discard block |
||
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 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
237 | + $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']); |
|
240 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
241 | 241 | $sth_dest_owner->execute($query_dest_owner_values); |
242 | 242 | } |
243 | 243 | } |
244 | 244 | if ($globalTransaction) $Connection->db->commit(); |
245 | - } catch(PDOException $e) { |
|
245 | + } catch (PDOException $e) { |
|
246 | 246 | return "error : ".$e->getMessage(); |
247 | 247 | } |
248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $Connection = new Connection(); |
253 | 253 | $sth = $Connection->db->prepare($query); |
254 | 254 | $sth->execute(array(':source' => $database_file)); |
255 | - } catch(PDOException $e) { |
|
255 | + } catch (PDOException $e) { |
|
256 | 256 | return "error : ".$e->getMessage(); |
257 | 257 | } |
258 | 258 | return ''; |
@@ -267,11 +267,11 @@ discard block |
||
267 | 267 | $Connection = new Connection(); |
268 | 268 | $sth = $Connection->db->prepare($query); |
269 | 269 | $sth->execute(array(':source' => $database_file)); |
270 | - } catch(PDOException $e) { |
|
270 | + } catch (PDOException $e) { |
|
271 | 271 | return "error : ".$e->getMessage(); |
272 | 272 | } |
273 | 273 | |
274 | - if ($fh = fopen($database_file,"r")) { |
|
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)'; |
276 | 276 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
277 | 277 | |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | if ($globalTransaction) $Connection->db->beginTransaction(); |
282 | 282 | while (!feof($fh)) { |
283 | 283 | $values = array(); |
284 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
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)); |
|
286 | + $values['ModeS'] = substr($line, 0, 6); |
|
287 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
288 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
289 | 289 | // Check if we can find ICAO, else set it to GLID |
290 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
290 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
291 | 291 | $search_more = ''; |
292 | 292 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
293 | 293 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -299,20 +299,20 @@ discard block |
||
299 | 299 | if (isset($result['icao']) && $result['icao'] != '') { |
300 | 300 | $values['ICAOTypeCode'] = $result['icao']; |
301 | 301 | } |
302 | - } catch(PDOException $e) { |
|
302 | + } catch (PDOException $e) { |
|
303 | 303 | return "error : ".$e->getMessage(); |
304 | 304 | } |
305 | 305 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
306 | 306 | // Add data to db |
307 | 307 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
308 | 308 | //$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']); |
309 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
309 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
310 | 310 | //print_r($query_dest_values); |
311 | 311 | $sth_dest->execute($query_dest_values); |
312 | 312 | } |
313 | 313 | } |
314 | 314 | if ($globalTransaction) $Connection->db->commit(); |
315 | - } catch(PDOException $e) { |
|
315 | + } catch (PDOException $e) { |
|
316 | 316 | return "error : ".$e->getMessage(); |
317 | 317 | } |
318 | 318 | } |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $Connection = new Connection(); |
323 | 323 | $sth = $Connection->db->prepare($query); |
324 | 324 | $sth->execute(array(':source' => $database_file)); |
325 | - } catch(PDOException $e) { |
|
325 | + } catch (PDOException $e) { |
|
326 | 326 | return "error : ".$e->getMessage(); |
327 | 327 | } |
328 | 328 | return ''; |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | $Connection = new Connection(); |
337 | 337 | $sth = $Connection->db->prepare($query); |
338 | 338 | $sth->execute(array(':source' => $database_file)); |
339 | - } catch(PDOException $e) { |
|
339 | + } catch (PDOException $e) { |
|
340 | 340 | return "error : ".$e->getMessage(); |
341 | 341 | } |
342 | 342 | |
343 | - if ($fh = fopen($database_file,"r")) { |
|
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)'; |
345 | 345 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
346 | 346 | |
@@ -348,9 +348,9 @@ discard block |
||
348 | 348 | $sth_dest = $Connection->db->prepare($query_dest); |
349 | 349 | try { |
350 | 350 | if ($globalTransaction) $Connection->db->beginTransaction(); |
351 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
351 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
352 | 352 | while (!feof($fh)) { |
353 | - $line = fgetcsv($fh,9999,',',"'"); |
|
353 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
354 | 354 | |
355 | 355 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
356 | 356 | //print_r($line); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $values['ICAOTypeCode'] = ''; |
360 | 360 | $aircraft_name = $line[2]; |
361 | 361 | // Check if we can find ICAO, else set it to GLID |
362 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
362 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
363 | 363 | $search_more = ''; |
364 | 364 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
365 | 365 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -368,20 +368,20 @@ discard block |
||
368 | 368 | $sth_search->execute(); |
369 | 369 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
370 | 370 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
371 | - } catch(PDOException $e) { |
|
371 | + } catch (PDOException $e) { |
|
372 | 372 | return "error : ".$e->getMessage(); |
373 | 373 | } |
374 | 374 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
375 | 375 | // Add data to db |
376 | 376 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
377 | 377 | //$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']); |
378 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
378 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
379 | 379 | //print_r($query_dest_values); |
380 | 380 | $sth_dest->execute($query_dest_values); |
381 | 381 | } |
382 | 382 | } |
383 | 383 | if ($globalTransaction) $Connection->db->commit(); |
384 | - } catch(PDOException $e) { |
|
384 | + } catch (PDOException $e) { |
|
385 | 385 | return "error : ".$e->getMessage(); |
386 | 386 | } |
387 | 387 | } |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | $Connection = new Connection(); |
392 | 392 | $sth = $Connection->db->prepare($query); |
393 | 393 | $sth->execute(array(':source' => $database_file)); |
394 | - } catch(PDOException $e) { |
|
394 | + } catch (PDOException $e) { |
|
395 | 395 | return "error : ".$e->getMessage(); |
396 | 396 | } |
397 | 397 | return ''; |
398 | 398 | } |
399 | 399 | |
400 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
400 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
401 | 401 | global $globalTransaction, $globalMasterSource; |
402 | 402 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
403 | 403 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -405,12 +405,12 @@ discard block |
||
405 | 405 | $Connection = new Connection(); |
406 | 406 | $sth = $Connection->db->prepare($query); |
407 | 407 | $sth->execute(array(':source' => $database_file)); |
408 | - } catch(PDOException $e) { |
|
408 | + } catch (PDOException $e) { |
|
409 | 409 | return "error : ".$e->getMessage(); |
410 | 410 | } |
411 | 411 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
412 | 412 | $Spotter = new Spotter(); |
413 | - if ($fh = fopen($database_file,"r")) { |
|
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 | 416 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -420,9 +420,9 @@ discard block |
||
420 | 420 | $sth_modes = $Connection->db->prepare($query_modes); |
421 | 421 | try { |
422 | 422 | if ($globalTransaction) $Connection->db->beginTransaction(); |
423 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
423 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
424 | 424 | while (!feof($fh)) { |
425 | - $line = fgetcsv($fh,9999,',','"'); |
|
425 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
426 | 426 | $values = array(); |
427 | 427 | //print_r($line); |
428 | 428 | if ($country == 'F') { |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $values['base'] = $line[4]; |
431 | 431 | $values['owner'] = $line[5]; |
432 | 432 | if ($line[6] == '') $values['date_first_reg'] = null; |
433 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
433 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
434 | 434 | $values['cancel'] = $line[7]; |
435 | 435 | } elseif ($country == 'EI') { |
436 | 436 | // TODO : add modeS & reg to aircraft_modes |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | $values['base'] = $line[3]; |
439 | 439 | $values['owner'] = $line[2]; |
440 | 440 | if ($line[1] == '') $values['date_first_reg'] = null; |
441 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
441 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
442 | 442 | $values['cancel'] = ''; |
443 | 443 | $values['modes'] = $line[7]; |
444 | 444 | $values['icao'] = $line[8]; |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $values['base'] = null; |
459 | 459 | $values['owner'] = $line[5]; |
460 | 460 | if ($line[18] == '') $values['date_first_reg'] = null; |
461 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
461 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
462 | 462 | $values['cancel'] = ''; |
463 | 463 | } elseif ($country == 'VH') { |
464 | 464 | // TODO : add modeS & reg to aircraft_modes |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | $values['base'] = null; |
467 | 467 | $values['owner'] = $line[12]; |
468 | 468 | if ($line[28] == '') $values['date_first_reg'] = null; |
469 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
469 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
470 | 470 | |
471 | 471 | $values['cancel'] = $line[39]; |
472 | 472 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -486,28 +486,28 @@ discard block |
||
486 | 486 | $values['base'] = null; |
487 | 487 | $values['owner'] = $line[8]; |
488 | 488 | if ($line[7] == '') $values['date_first_reg'] = null; |
489 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
489 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
490 | 490 | $values['cancel'] = ''; |
491 | 491 | } elseif ($country == 'PP') { |
492 | 492 | $values['registration'] = $line[0]; |
493 | 493 | $values['base'] = null; |
494 | 494 | $values['owner'] = $line[4]; |
495 | 495 | if ($line[6] == '') $values['date_first_reg'] = null; |
496 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
496 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
497 | 497 | $values['cancel'] = $line[7]; |
498 | 498 | } elseif ($country == 'E7') { |
499 | 499 | $values['registration'] = $line[0]; |
500 | 500 | $values['base'] = null; |
501 | 501 | $values['owner'] = $line[4]; |
502 | 502 | if ($line[5] == '') $values['date_first_reg'] = null; |
503 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
503 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
504 | 504 | $values['cancel'] = ''; |
505 | 505 | } elseif ($country == '8Q') { |
506 | 506 | $values['registration'] = $line[0]; |
507 | 507 | $values['base'] = null; |
508 | 508 | $values['owner'] = $line[3]; |
509 | 509 | if ($line[7] == '') $values['date_first_reg'] = null; |
510 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
510 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
511 | 511 | $values['cancel'] = ''; |
512 | 512 | } elseif ($country == 'ZK') { |
513 | 513 | $values['registration'] = $line[0]; |
@@ -521,18 +521,18 @@ discard block |
||
521 | 521 | $values['registration'] = $line[0]; |
522 | 522 | $values['base'] = null; |
523 | 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])); |
|
524 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
525 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
526 | 526 | $values['modes'] = $line[4]; |
527 | 527 | $values['icao'] = $line[10]; |
528 | 528 | } elseif ($country == 'OY') { |
529 | 529 | $values['registration'] = $line[0]; |
530 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
530 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
531 | 531 | $values['modes'] = $line[5]; |
532 | 532 | $values['icao'] = $line[6]; |
533 | 533 | } elseif ($country == 'PH') { |
534 | 534 | $values['registration'] = $line[0]; |
535 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
535 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
536 | 536 | $values['modes'] = $line[4]; |
537 | 537 | $values['icao'] = $line[5]; |
538 | 538 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -543,17 +543,17 @@ discard block |
||
543 | 543 | $values['cancel'] = ''; |
544 | 544 | } |
545 | 545 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
546 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
546 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
547 | 547 | $sth_dest->execute($query_dest_values); |
548 | 548 | } |
549 | 549 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
550 | 550 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
551 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
551 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
552 | 552 | $sth_modes->execute($query_modes_values); |
553 | 553 | } |
554 | 554 | } |
555 | 555 | if ($globalTransaction) $Connection->db->commit(); |
556 | - } catch(PDOException $e) { |
|
556 | + } catch (PDOException $e) { |
|
557 | 557 | return "error : ".$e->getMessage(); |
558 | 558 | } |
559 | 559 | } |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | if ($globalTransaction) $Connection->db->beginTransaction(); |
692 | 692 | |
693 | 693 | $i = 0; |
694 | - while($row = sparql_fetch_array($result)) |
|
694 | + while ($row = sparql_fetch_array($result)) |
|
695 | 695 | { |
696 | 696 | if ($i >= 1) { |
697 | 697 | //print_r($row); |
@@ -711,33 +711,33 @@ discard block |
||
711 | 711 | $row['image'] = ''; |
712 | 712 | $row['image_thumb'] = ''; |
713 | 713 | } else { |
714 | - $image = str_replace(' ','_',$row['image']); |
|
714 | + $image = str_replace(' ', '_', $row['image']); |
|
715 | 715 | $digest = md5($image); |
716 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
717 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
718 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
719 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
716 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
717 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
718 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
719 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
720 | 720 | } |
721 | 721 | |
722 | - $country = explode('-',$row['country']); |
|
722 | + $country = explode('-', $row['country']); |
|
723 | 723 | $row['country'] = $country[0]; |
724 | 724 | |
725 | 725 | $row['type'] = trim($row['type']); |
726 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
726 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
727 | 727 | $row['type'] = 'military'; |
728 | 728 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
729 | 729 | $row['type'] = 'small_airport'; |
730 | 730 | } |
731 | 731 | |
732 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
733 | - $query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($row['altitude']),':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
732 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
733 | + $query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($row['altitude']), ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
734 | 734 | //print_r($query_dest_values); |
735 | 735 | |
736 | 736 | if ($row['icao'] != '') { |
737 | 737 | try { |
738 | 738 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
739 | 739 | $sth->execute(array(':icao' => $row['icao'])); |
740 | - } catch(PDOException $e) { |
|
740 | + } catch (PDOException $e) { |
|
741 | 741 | return "error : ".$e->getMessage(); |
742 | 742 | } |
743 | 743 | if ($sth->fetchColumn() > 0) { |
@@ -745,15 +745,15 @@ discard block |
||
745 | 745 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
746 | 746 | try { |
747 | 747 | $sth = $Connection->db->prepare($query); |
748 | - $sth->execute(array(':icao' => $row['icao'],':type' => $row['type'])); |
|
749 | - } catch(PDOException $e) { |
|
748 | + $sth->execute(array(':icao' => $row['icao'], ':type' => $row['type'])); |
|
749 | + } catch (PDOException $e) { |
|
750 | 750 | return "error : ".$e->getMessage(); |
751 | 751 | } |
752 | 752 | echo $row['icao'].' : '.$row['type']."\n"; |
753 | 753 | } else { |
754 | 754 | try { |
755 | 755 | $sth_dest->execute($query_dest_values); |
756 | - } catch(PDOException $e) { |
|
756 | + } catch (PDOException $e) { |
|
757 | 757 | return "error : ".$e->getMessage(); |
758 | 758 | } |
759 | 759 | } |
@@ -804,7 +804,7 @@ discard block |
||
804 | 804 | echo "Download data from ourairports.com...\n"; |
805 | 805 | $delimiter = ','; |
806 | 806 | $out_file = $tmp_dir.'airports.csv'; |
807 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
807 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
808 | 808 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
809 | 809 | echo "Add data from ourairports.com...\n"; |
810 | 810 | |
@@ -815,33 +815,33 @@ discard block |
||
815 | 815 | //$Connection->db->beginTransaction(); |
816 | 816 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
817 | 817 | { |
818 | - if(!$header) $header = $row; |
|
818 | + if (!$header) $header = $row; |
|
819 | 819 | else { |
820 | 820 | $data = array(); |
821 | 821 | $data = array_combine($header, $row); |
822 | 822 | try { |
823 | 823 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
824 | 824 | $sth->execute(array(':icao' => $data['ident'])); |
825 | - } catch(PDOException $e) { |
|
825 | + } catch (PDOException $e) { |
|
826 | 826 | return "error : ".$e->getMessage(); |
827 | 827 | } |
828 | 828 | if ($sth->fetchColumn() > 0) { |
829 | 829 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
830 | 830 | try { |
831 | 831 | $sth = $Connection->db->prepare($query); |
832 | - $sth->execute(array(':icao' => $data['ident'],':type' => $data['type'])); |
|
833 | - } catch(PDOException $e) { |
|
832 | + $sth->execute(array(':icao' => $data['ident'], ':type' => $data['type'])); |
|
833 | + } catch (PDOException $e) { |
|
834 | 834 | return "error : ".$e->getMessage(); |
835 | 835 | } |
836 | 836 | } else { |
837 | 837 | if ($data['gps_code'] == $data['ident']) { |
838 | 838 | $query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link) |
839 | 839 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
840 | - $query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
840 | + $query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
841 | 841 | try { |
842 | 842 | $sth = $Connection->db->prepare($query); |
843 | 843 | $sth->execute($query_values); |
844 | - } catch(PDOException $e) { |
|
844 | + } catch (PDOException $e) { |
|
845 | 845 | return "error : ".$e->getMessage(); |
846 | 846 | } |
847 | 847 | $i++; |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | |
857 | 857 | echo "Download data from another free database...\n"; |
858 | 858 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
859 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
859 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
860 | 860 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
861 | 861 | update_db::unzip($out_file); |
862 | 862 | $header = NULL; |
@@ -868,15 +868,15 @@ discard block |
||
868 | 868 | //$Connection->db->beginTransaction(); |
869 | 869 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
870 | 870 | { |
871 | - if(!$header) $header = $row; |
|
871 | + if (!$header) $header = $row; |
|
872 | 872 | else { |
873 | 873 | $data = $row; |
874 | 874 | |
875 | 875 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
876 | 876 | try { |
877 | 877 | $sth = $Connection->db->prepare($query); |
878 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
879 | - } catch(PDOException $e) { |
|
878 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
879 | + } catch (PDOException $e) { |
|
880 | 880 | return "error : ".$e->getMessage(); |
881 | 881 | } |
882 | 882 | } |
@@ -890,15 +890,15 @@ discard block |
||
890 | 890 | try { |
891 | 891 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'"); |
892 | 892 | $sth->execute(); |
893 | - } catch(PDOException $e) { |
|
893 | + } catch (PDOException $e) { |
|
894 | 894 | return "error : ".$e->getMessage(); |
895 | 895 | } |
896 | 896 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
897 | 897 | $query2 = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
898 | 898 | try { |
899 | 899 | $sth2 = $Connection->db->prepare($query2); |
900 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
901 | - } catch(PDOException $e) { |
|
900 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
901 | + } catch (PDOException $e) { |
|
902 | 902 | return "error : ".$e->getMessage(); |
903 | 903 | } |
904 | 904 | } |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | $Connection = new Connection(); |
920 | 920 | $sth = $Connection->db->prepare($query); |
921 | 921 | $sth->execute(array(':source' => 'translation.csv')); |
922 | - } catch(PDOException $e) { |
|
922 | + } catch (PDOException $e) { |
|
923 | 923 | return "error : ".$e->getMessage(); |
924 | 924 | } |
925 | 925 | |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
937 | 937 | { |
938 | 938 | $i++; |
939 | - if($i > 12) { |
|
939 | + if ($i > 12) { |
|
940 | 940 | $data = $row; |
941 | 941 | $operator = $data[2]; |
942 | 942 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | //echo substr($operator, 0, 2)."\n";; |
945 | 945 | if (count($airline_array) > 0) { |
946 | 946 | //print_r($airline_array); |
947 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
947 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
948 | 948 | } |
949 | 949 | } |
950 | 950 | |
@@ -952,14 +952,14 @@ discard block |
||
952 | 952 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
953 | 953 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
954 | 954 | if (count($airline_array) > 0) { |
955 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
955 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
956 | 956 | } |
957 | 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); |
961 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
962 | - } catch(PDOException $e) { |
|
961 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
962 | + } catch (PDOException $e) { |
|
963 | 963 | return "error : ".$e->getMessage(); |
964 | 964 | } |
965 | 965 | } |
@@ -977,7 +977,7 @@ discard block |
||
977 | 977 | $Connection = new Connection(); |
978 | 978 | $sth = $Connection->db->prepare($query); |
979 | 979 | $sth->execute(array(':source' => 'website_fam')); |
980 | - } catch(PDOException $e) { |
|
980 | + } catch (PDOException $e) { |
|
981 | 981 | return "error : ".$e->getMessage(); |
982 | 982 | } |
983 | 983 | //update_db::unzip($out_file); |
@@ -995,8 +995,8 @@ discard block |
||
995 | 995 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
996 | 996 | try { |
997 | 997 | $sth = $Connection->db->prepare($query); |
998 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
999 | - } catch(PDOException $e) { |
|
998 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
999 | + } catch (PDOException $e) { |
|
1000 | 1000 | return "error : ".$e->getMessage(); |
1001 | 1001 | } |
1002 | 1002 | } |
@@ -1019,7 +1019,7 @@ discard block |
||
1019 | 1019 | $Connection = new Connection(); |
1020 | 1020 | $sth = $Connection->db->prepare($query); |
1021 | 1021 | $sth->execute(array(':source' => 'website_faa')); |
1022 | - } catch(PDOException $e) { |
|
1022 | + } catch (PDOException $e) { |
|
1023 | 1023 | return "error : ".$e->getMessage(); |
1024 | 1024 | } |
1025 | 1025 | |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | $Connection = new Connection(); |
1029 | 1029 | $sth = $Connection->db->prepare($query); |
1030 | 1030 | $sth->execute(array(':source' => 'website_faa')); |
1031 | - } catch(PDOException $e) { |
|
1031 | + } catch (PDOException $e) { |
|
1032 | 1032 | return "error : ".$e->getMessage(); |
1033 | 1033 | } |
1034 | 1034 | |
@@ -1045,8 +1045,8 @@ discard block |
||
1045 | 1045 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
1046 | 1046 | try { |
1047 | 1047 | $sths = $Connection->db->prepare($query_search); |
1048 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
1049 | - } catch(PDOException $e) { |
|
1048 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
1049 | + } catch (PDOException $e) { |
|
1050 | 1050 | return "error s : ".$e->getMessage(); |
1051 | 1051 | } |
1052 | 1052 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1059,8 +1059,8 @@ discard block |
||
1059 | 1059 | //} |
1060 | 1060 | try { |
1061 | 1061 | $sthi = $Connection->db->prepare($queryi); |
1062 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1063 | - } catch(PDOException $e) { |
|
1062 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1063 | + } catch (PDOException $e) { |
|
1064 | 1064 | return "error u : ".$e->getMessage(); |
1065 | 1065 | } |
1066 | 1066 | } else { |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | try { |
1069 | 1069 | $sthsm = $Connection->db->prepare($query_search_mfr); |
1070 | 1070 | $sthsm->execute(array(':mfr' => $data[2])); |
1071 | - } catch(PDOException $e) { |
|
1071 | + } catch (PDOException $e) { |
|
1072 | 1072 | return "error mfr : ".$e->getMessage(); |
1073 | 1073 | } |
1074 | 1074 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1078,8 +1078,8 @@ discard block |
||
1078 | 1078 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1079 | 1079 | try { |
1080 | 1080 | $sthf = $Connection->db->prepare($queryf); |
1081 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
1082 | - } catch(PDOException $e) { |
|
1081 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
1082 | + } catch (PDOException $e) { |
|
1083 | 1083 | return "error f : ".$e->getMessage(); |
1084 | 1084 | } |
1085 | 1085 | } |
@@ -1089,13 +1089,13 @@ discard block |
||
1089 | 1089 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1090 | 1090 | try { |
1091 | 1091 | $sth = $Connection->db->prepare($query); |
1092 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
1093 | - } catch(PDOException $e) { |
|
1092 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
1093 | + } catch (PDOException $e) { |
|
1094 | 1094 | return "error i : ".$e->getMessage(); |
1095 | 1095 | } |
1096 | 1096 | } |
1097 | 1097 | } |
1098 | - if ($i % 90 == 0) { |
|
1098 | + if ($i%90 == 0) { |
|
1099 | 1099 | if ($globalTransaction) $Connection->db->commit(); |
1100 | 1100 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1101 | 1101 | } |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | $Connection = new Connection(); |
1115 | 1115 | $sth = $Connection->db->prepare($query); |
1116 | 1116 | $sth->execute(array(':source' => 'website_fam')); |
1117 | - } catch(PDOException $e) { |
|
1117 | + } catch (PDOException $e) { |
|
1118 | 1118 | return "error : ".$e->getMessage(); |
1119 | 1119 | } |
1120 | 1120 | |
@@ -1135,8 +1135,8 @@ discard block |
||
1135 | 1135 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1136 | 1136 | try { |
1137 | 1137 | $sth = $Connection->db->prepare($query); |
1138 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
1139 | - } catch(PDOException $e) { |
|
1138 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
1139 | + } catch (PDOException $e) { |
|
1140 | 1140 | return "error : ".$e->getMessage(); |
1141 | 1141 | } |
1142 | 1142 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | $Connection = new Connection(); |
1156 | 1156 | $sth = $Connection->db->prepare($query); |
1157 | 1157 | $sth->execute(array(':source' => 'website_fam')); |
1158 | - } catch(PDOException $e) { |
|
1158 | + } catch (PDOException $e) { |
|
1159 | 1159 | return "error : ".$e->getMessage(); |
1160 | 1160 | } |
1161 | 1161 | |
@@ -1171,8 +1171,8 @@ discard block |
||
1171 | 1171 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1172 | 1172 | try { |
1173 | 1173 | $sth = $Connection->db->prepare($query); |
1174 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1175 | - } catch(PDOException $e) { |
|
1174 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1175 | + } catch (PDOException $e) { |
|
1176 | 1176 | //print_r($data); |
1177 | 1177 | return "error : ".$e->getMessage(); |
1178 | 1178 | } |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | $Connection = new Connection(); |
1193 | 1193 | $sth = $Connection->db->prepare($query); |
1194 | 1194 | $sth->execute(array(':source' => 'website_fam')); |
1195 | - } catch(PDOException $e) { |
|
1195 | + } catch (PDOException $e) { |
|
1196 | 1196 | return "error : ".$e->getMessage(); |
1197 | 1197 | } |
1198 | 1198 | $delimiter = "\t"; |
@@ -1207,9 +1207,9 @@ discard block |
||
1207 | 1207 | $query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
1208 | 1208 | try { |
1209 | 1209 | $sth = $Connection->db->prepare($query); |
1210 | - $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
1211 | - } catch(PDOException $e) { |
|
1212 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1210 | + $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
1211 | + } catch (PDOException $e) { |
|
1212 | + if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data); |
|
1213 | 1213 | } |
1214 | 1214 | } |
1215 | 1215 | $i++; |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | $Connection = new Connection(); |
1228 | 1228 | $sth = $Connection->db->prepare($query); |
1229 | 1229 | $sth->execute(); |
1230 | - } catch(PDOException $e) { |
|
1230 | + } catch (PDOException $e) { |
|
1231 | 1231 | return "error : ".$e->getMessage(); |
1232 | 1232 | } |
1233 | 1233 | |
@@ -1248,8 +1248,8 @@ discard block |
||
1248 | 1248 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
1249 | 1249 | try { |
1250 | 1250 | $sth = $Connection->db->prepare($query); |
1251 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
1252 | - } catch(PDOException $e) { |
|
1251 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
1252 | + } catch (PDOException $e) { |
|
1253 | 1253 | return "error : ".$e->getMessage(); |
1254 | 1254 | } |
1255 | 1255 | } |
@@ -1268,7 +1268,7 @@ discard block |
||
1268 | 1268 | $Connection = new Connection(); |
1269 | 1269 | $sth = $Connection->db->prepare($query); |
1270 | 1270 | $sth->execute(); |
1271 | - } catch(PDOException $e) { |
|
1271 | + } catch (PDOException $e) { |
|
1272 | 1272 | return "error : ".$e->getMessage(); |
1273 | 1273 | } |
1274 | 1274 | $delimiter = "\t"; |
@@ -1285,8 +1285,8 @@ discard block |
||
1285 | 1285 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1286 | 1286 | try { |
1287 | 1287 | $sth = $Connection->db->prepare($query); |
1288 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1289 | - } catch(PDOException $e) { |
|
1288 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1289 | + } catch (PDOException $e) { |
|
1290 | 1290 | return "error : ".$e->getMessage(); |
1291 | 1291 | } |
1292 | 1292 | } |
@@ -1305,7 +1305,7 @@ discard block |
||
1305 | 1305 | $Connection = new Connection(); |
1306 | 1306 | $sth = $Connection->db->prepare($query); |
1307 | 1307 | $sth->execute(); |
1308 | - } catch(PDOException $e) { |
|
1308 | + } catch (PDOException $e) { |
|
1309 | 1309 | return "error : ".$e->getMessage(); |
1310 | 1310 | } |
1311 | 1311 | |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | try { |
1322 | 1322 | $sth = $Connection->db->prepare($query); |
1323 | 1323 | $sth->execute(array(':icao' => $icao)); |
1324 | - } catch(PDOException $e) { |
|
1324 | + } catch (PDOException $e) { |
|
1325 | 1325 | return "error : ".$e->getMessage(); |
1326 | 1326 | } |
1327 | 1327 | } |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | return ''; |
1333 | 1333 | } |
1334 | 1334 | |
1335 | - public static function tle($filename,$tletype) { |
|
1335 | + public static function tle($filename, $tletype) { |
|
1336 | 1336 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1337 | 1337 | global $tmp_dir, $globalTransaction; |
1338 | 1338 | //$Spotter = new Spotter(); |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | $Connection = new Connection(); |
1343 | 1343 | $sth = $Connection->db->prepare($query); |
1344 | 1344 | $sth->execute(array(':source' => $filename)); |
1345 | - } catch(PDOException $e) { |
|
1345 | + } catch (PDOException $e) { |
|
1346 | 1346 | return "error : ".$e->getMessage(); |
1347 | 1347 | } |
1348 | 1348 | |
@@ -1367,8 +1367,8 @@ discard block |
||
1367 | 1367 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1368 | 1368 | try { |
1369 | 1369 | $sth = $Connection->db->prepare($query); |
1370 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1371 | - } catch(PDOException $e) { |
|
1370 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1371 | + } catch (PDOException $e) { |
|
1372 | 1372 | return "error : ".$e->getMessage(); |
1373 | 1373 | } |
1374 | 1374 | |
@@ -1388,7 +1388,7 @@ discard block |
||
1388 | 1388 | $Connection = new Connection(); |
1389 | 1389 | $sth = $Connection->db->prepare($query); |
1390 | 1390 | $sth->execute(array(':source' => $filename)); |
1391 | - } catch(PDOException $e) { |
|
1391 | + } catch (PDOException $e) { |
|
1392 | 1392 | return "error : ".$e->getMessage(); |
1393 | 1393 | } |
1394 | 1394 | |
@@ -1398,13 +1398,13 @@ discard block |
||
1398 | 1398 | $i = 0; |
1399 | 1399 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1400 | 1400 | //$Connection->db->beginTransaction(); |
1401 | - while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE) |
|
1401 | + while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) |
|
1402 | 1402 | { |
1403 | 1403 | if ($i > 0 && $data[0] != '') { |
1404 | 1404 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1405 | - $period = str_replace(',','',$data[14]); |
|
1406 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1407 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1405 | + $period = str_replace(',', '', $data[14]); |
|
1406 | + if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60; |
|
1407 | + if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18])); |
|
1408 | 1408 | else $launch_date = NULL; |
1409 | 1409 | $data = array_map(function($value) { |
1410 | 1410 | return trim($value) === '' ? null : $value; |
@@ -1414,8 +1414,8 @@ discard block |
||
1414 | 1414 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1415 | 1415 | try { |
1416 | 1416 | $sth = $Connection->db->prepare($query); |
1417 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1418 | - } catch(PDOException $e) { |
|
1417 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1418 | + } catch (PDOException $e) { |
|
1419 | 1419 | return "error : ".$e->getMessage(); |
1420 | 1420 | } |
1421 | 1421 | } |
@@ -1455,7 +1455,7 @@ discard block |
||
1455 | 1455 | 'EGYP' => array('country' => 'Egypt', 'owner' => ''), |
1456 | 1456 | 'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'), |
1457 | 1457 | 'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'), |
1458 | - 'EST' => array('country' => 'Estonia','owner' => ''), |
|
1458 | + 'EST' => array('country' => 'Estonia', 'owner' => ''), |
|
1459 | 1459 | 'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'), |
1460 | 1460 | 'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'), |
1461 | 1461 | 'FGER' => array('country' => 'France/Germany', 'owner' => ''), |
@@ -1578,10 +1578,10 @@ discard block |
||
1578 | 1578 | while (($data = fgets($handle, 1000)) !== FALSE) |
1579 | 1579 | { |
1580 | 1580 | $result = array(); |
1581 | - $result['cospar'] = trim(substr($data,0,11)); |
|
1582 | - $result['norad'] = trim(substr($data,13,6)); |
|
1583 | - $result['operational'] = trim(substr($data,21,1)); |
|
1584 | - $result['name'] = trim(substr($data,23,24)); |
|
1581 | + $result['cospar'] = trim(substr($data, 0, 11)); |
|
1582 | + $result['norad'] = trim(substr($data, 13, 6)); |
|
1583 | + $result['operational'] = trim(substr($data, 21, 1)); |
|
1584 | + $result['name'] = trim(substr($data, 23, 24)); |
|
1585 | 1585 | /* |
1586 | 1586 | * R/B(1) = Rocket body, first stage |
1587 | 1587 | * R/B(2) = Rocket body, second stage |
@@ -1593,20 +1593,20 @@ discard block |
||
1593 | 1593 | * An ampersand (&) indicates two or more objects are attached |
1594 | 1594 | */ |
1595 | 1595 | |
1596 | - $owner_code = trim(substr($data,49,5)); |
|
1596 | + $owner_code = trim(substr($data, 49, 5)); |
|
1597 | 1597 | if ($owner_code != 'TBD') { |
1598 | 1598 | $result['country_owner'] = $satcat_sources[$owner_code]['country']; |
1599 | 1599 | $result['owner'] = $satcat_sources[$owner_code]['owner']; |
1600 | - $result['launch_date'] = trim(substr($data,56,10)); |
|
1601 | - $launch_site_code = trim(substr($data,68,5)); |
|
1600 | + $result['launch_date'] = trim(substr($data, 56, 10)); |
|
1601 | + $launch_site_code = trim(substr($data, 68, 5)); |
|
1602 | 1602 | $result['launch_site'] = $satcat_launch_site[$launch_site_code]; |
1603 | - $result['lifetime'] = trim(substr($data,75,10)); |
|
1604 | - $result['period'] = trim(substr($data,87,7)); |
|
1605 | - $result['inclination'] = trim(substr($data,96,5)); |
|
1606 | - $result['apogee'] = trim(substr($data,103,6)); |
|
1607 | - $result['perigee'] = trim(substr($data,111,6)); |
|
1603 | + $result['lifetime'] = trim(substr($data, 75, 10)); |
|
1604 | + $result['period'] = trim(substr($data, 87, 7)); |
|
1605 | + $result['inclination'] = trim(substr($data, 96, 5)); |
|
1606 | + $result['apogee'] = trim(substr($data, 103, 6)); |
|
1607 | + $result['perigee'] = trim(substr($data, 111, 6)); |
|
1608 | 1608 | //$result['radarcross'] = trim(substr($data,119,8)); |
1609 | - $result['status'] = trim(substr($data,129,3)); |
|
1609 | + $result['status'] = trim(substr($data, 129, 3)); |
|
1610 | 1610 | //print_r($result); |
1611 | 1611 | $result = array_map(function($value) { |
1612 | 1612 | return trim($value) === '' ? null : $value; |
@@ -1619,7 +1619,7 @@ discard block |
||
1619 | 1619 | $sth = $Connection->db->prepare($query); |
1620 | 1620 | $sth->execute(array(':cospar' => $result['cospar'])); |
1621 | 1621 | $exist = $sth->fetchAll(PDO::FETCH_ASSOC); |
1622 | - } catch(PDOException $e) { |
|
1622 | + } catch (PDOException $e) { |
|
1623 | 1623 | return "error : ".$e->getMessage(); |
1624 | 1624 | } |
1625 | 1625 | if (empty($exist)) { |
@@ -1631,10 +1631,10 @@ discard block |
||
1631 | 1631 | ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
1632 | 1632 | ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
1633 | 1633 | ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
1634 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1634 | + ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1635 | 1635 | ) |
1636 | 1636 | ); |
1637 | - } catch(PDOException $e) { |
|
1637 | + } catch (PDOException $e) { |
|
1638 | 1638 | return "error : ".$e->getMessage(); |
1639 | 1639 | } |
1640 | 1640 | } elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) { |
@@ -1642,8 +1642,8 @@ discard block |
||
1642 | 1642 | try { |
1643 | 1643 | $Connection = new Connection(); |
1644 | 1644 | $sth = $Connection->db->prepare($query); |
1645 | - $sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar'])); |
|
1646 | - } catch(PDOException $e) { |
|
1645 | + $sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar'])); |
|
1646 | + } catch (PDOException $e) { |
|
1647 | 1647 | return "error : ".$e->getMessage(); |
1648 | 1648 | } |
1649 | 1649 | } |
@@ -1762,13 +1762,13 @@ discard block |
||
1762 | 1762 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1763 | 1763 | { |
1764 | 1764 | $i++; |
1765 | - if($i > 3 && count($row) > 2) { |
|
1765 | + if ($i > 3 && count($row) > 2) { |
|
1766 | 1766 | $data = array_values(array_filter($row)); |
1767 | 1767 | $cntdata = count($data); |
1768 | 1768 | if ($cntdata > 10) { |
1769 | 1769 | $value = $data[9]; |
1770 | 1770 | |
1771 | - for ($i =10;$i < $cntdata;$i++) { |
|
1771 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1772 | 1772 | $value .= ' '.$data[$i]; |
1773 | 1773 | } |
1774 | 1774 | $data[9] = $value; |
@@ -1778,8 +1778,8 @@ discard block |
||
1778 | 1778 | $query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
1779 | 1779 | try { |
1780 | 1780 | $sth = $Connection->db->prepare($query); |
1781 | - $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1782 | - } catch(PDOException $e) { |
|
1781 | + $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1782 | + } catch (PDOException $e) { |
|
1783 | 1783 | return "error : ".$e->getMessage(); |
1784 | 1784 | } |
1785 | 1785 | } |
@@ -1800,7 +1800,7 @@ discard block |
||
1800 | 1800 | $Connection = new Connection(); |
1801 | 1801 | $sth = $Connection->db->prepare($query); |
1802 | 1802 | $sth->execute(); |
1803 | - } catch(PDOException $e) { |
|
1803 | + } catch (PDOException $e) { |
|
1804 | 1804 | return "error : ".$e->getMessage(); |
1805 | 1805 | } |
1806 | 1806 | |
@@ -1812,12 +1812,12 @@ discard block |
||
1812 | 1812 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1813 | 1813 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1814 | 1814 | { |
1815 | - if(count($row) > 1) { |
|
1815 | + if (count($row) > 1) { |
|
1816 | 1816 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1817 | 1817 | try { |
1818 | 1818 | $sth = $Connection->db->prepare($query); |
1819 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1820 | - } catch(PDOException $e) { |
|
1819 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1820 | + } catch (PDOException $e) { |
|
1821 | 1821 | return "error : ".$e->getMessage(); |
1822 | 1822 | } |
1823 | 1823 | } |
@@ -1837,21 +1837,21 @@ discard block |
||
1837 | 1837 | try { |
1838 | 1838 | $sth = $Connection->db->prepare($query); |
1839 | 1839 | $sth->execute(); |
1840 | - } catch(PDOException $e) { |
|
1840 | + } catch (PDOException $e) { |
|
1841 | 1841 | return "error : ".$e->getMessage(); |
1842 | 1842 | } |
1843 | 1843 | } |
1844 | 1844 | |
1845 | 1845 | |
1846 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1846 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1847 | 1847 | else { |
1848 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1848 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1849 | 1849 | $query = "CREATE EXTENSION postgis"; |
1850 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1850 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1851 | 1851 | try { |
1852 | 1852 | $sth = $Connection->db->prepare($query); |
1853 | 1853 | $sth->execute(); |
1854 | - } catch(PDOException $e) { |
|
1854 | + } catch (PDOException $e) { |
|
1855 | 1855 | return "error : ".$e->getMessage(); |
1856 | 1856 | } |
1857 | 1857 | } |
@@ -1864,7 +1864,7 @@ discard block |
||
1864 | 1864 | include_once('class.create_db.php'); |
1865 | 1865 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1866 | 1866 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
1867 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
1867 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1868 | 1868 | $error = ''; |
1869 | 1869 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1870 | 1870 | if ($globalDebug) echo "Gunzip..."; |
@@ -1896,14 +1896,14 @@ discard block |
||
1896 | 1896 | try { |
1897 | 1897 | $sth = $Connection->db->prepare($query); |
1898 | 1898 | $sth->execute(); |
1899 | - } catch(PDOException $e) { |
|
1899 | + } catch (PDOException $e) { |
|
1900 | 1900 | echo "error : ".$e->getMessage(); |
1901 | 1901 | } |
1902 | 1902 | } |
1903 | 1903 | if ($globalDBdriver == 'mysql') { |
1904 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1904 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1905 | 1905 | } else { |
1906 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1906 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1907 | 1907 | } |
1908 | 1908 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
1909 | 1909 | return $error; |
@@ -1916,7 +1916,7 @@ discard block |
||
1916 | 1916 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
1917 | 1917 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
1918 | 1918 | // update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
1919 | - update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
1919 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
1920 | 1920 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
1921 | 1921 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
1922 | 1922 | return $error; |
@@ -1936,7 +1936,7 @@ discard block |
||
1936 | 1936 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1937 | 1937 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
1938 | 1938 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1939 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1939 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1940 | 1940 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
1941 | 1941 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
1942 | 1942 | if ($error != '') { |
@@ -1949,7 +1949,7 @@ discard block |
||
1949 | 1949 | global $tmp_dir, $globalDebug; |
1950 | 1950 | $error = ''; |
1951 | 1951 | if ($globalDebug) echo "Routes : Download..."; |
1952 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
1952 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1953 | 1953 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1954 | 1954 | if ($globalDebug) echo "Gunzip..."; |
1955 | 1955 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1965,7 +1965,7 @@ discard block |
||
1965 | 1965 | global $tmp_dir, $globalDebug; |
1966 | 1966 | $error = ''; |
1967 | 1967 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
1968 | - update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
1968 | + update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1969 | 1969 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1970 | 1970 | if ($globalDebug) echo "Gunzip..."; |
1971 | 1971 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1981,7 +1981,7 @@ discard block |
||
1981 | 1981 | global $tmp_dir, $globalDebug; |
1982 | 1982 | $error = ''; |
1983 | 1983 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
1984 | - update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
1984 | + update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1985 | 1985 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1986 | 1986 | if ($globalDebug) echo "Gunzip..."; |
1987 | 1987 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -2009,7 +2009,7 @@ discard block |
||
2009 | 2009 | */ |
2010 | 2010 | if ($globalDebug) echo "Modes : Download..."; |
2011 | 2011 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
2012 | - update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
2012 | + update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
2013 | 2013 | |
2014 | 2014 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2015 | 2015 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -2029,7 +2029,7 @@ discard block |
||
2029 | 2029 | public static function update_ModeS_faa() { |
2030 | 2030 | global $tmp_dir, $globalDebug; |
2031 | 2031 | if ($globalDebug) echo "Modes FAA: Download..."; |
2032 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
2032 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
2033 | 2033 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2034 | 2034 | if ($globalDebug) echo "Unzip..."; |
2035 | 2035 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -2045,7 +2045,7 @@ discard block |
||
2045 | 2045 | public static function update_ModeS_flarm() { |
2046 | 2046 | global $tmp_dir, $globalDebug; |
2047 | 2047 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
2048 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
2048 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
2049 | 2049 | if (file_exists($tmp_dir.'data.fln')) { |
2050 | 2050 | if ($globalDebug) echo "Add to DB..."; |
2051 | 2051 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -2059,7 +2059,7 @@ discard block |
||
2059 | 2059 | public static function update_ModeS_ogn() { |
2060 | 2060 | global $tmp_dir, $globalDebug; |
2061 | 2061 | if ($globalDebug) echo "Modes OGN: Download..."; |
2062 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
2062 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
2063 | 2063 | if (file_exists($tmp_dir.'ogn.csv')) { |
2064 | 2064 | if ($globalDebug) echo "Add to DB..."; |
2065 | 2065 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -2074,201 +2074,201 @@ discard block |
||
2074 | 2074 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2075 | 2075 | |
2076 | 2076 | if ($globalDebug) echo "Owner France: Download..."; |
2077 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
2077 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
2078 | 2078 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2079 | 2079 | if ($globalDebug) echo "Add to DB..."; |
2080 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
2080 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
2081 | 2081 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
2082 | 2082 | if ($error != '') { |
2083 | 2083 | return $error; |
2084 | 2084 | } elseif ($globalDebug) echo "Done\n"; |
2085 | 2085 | |
2086 | 2086 | if ($globalDebug) echo "Owner Ireland: Download..."; |
2087 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
2087 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
2088 | 2088 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2089 | 2089 | if ($globalDebug) echo "Add to DB..."; |
2090 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
2090 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
2091 | 2091 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
2092 | 2092 | if ($error != '') { |
2093 | 2093 | return $error; |
2094 | 2094 | } elseif ($globalDebug) echo "Done\n"; |
2095 | 2095 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
2096 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
2096 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
2097 | 2097 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2098 | 2098 | if ($globalDebug) echo "Add to DB..."; |
2099 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
2099 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
2100 | 2100 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
2101 | 2101 | if ($error != '') { |
2102 | 2102 | return $error; |
2103 | 2103 | } elseif ($globalDebug) echo "Done\n"; |
2104 | 2104 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
2105 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
2105 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
2106 | 2106 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2107 | 2107 | if ($globalDebug) echo "Add to DB..."; |
2108 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
2108 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
2109 | 2109 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
2110 | 2110 | if ($error != '') { |
2111 | 2111 | return $error; |
2112 | 2112 | } elseif ($globalDebug) echo "Done\n"; |
2113 | 2113 | if ($globalDebug) echo "Owner Australia: Download..."; |
2114 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
2114 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
2115 | 2115 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2116 | 2116 | if ($globalDebug) echo "Add to DB..."; |
2117 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
2117 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
2118 | 2118 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
2119 | 2119 | if ($error != '') { |
2120 | 2120 | return $error; |
2121 | 2121 | } elseif ($globalDebug) echo "Done\n"; |
2122 | 2122 | if ($globalDebug) echo "Owner Austria: Download..."; |
2123 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
2123 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
2124 | 2124 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2125 | 2125 | if ($globalDebug) echo "Add to DB..."; |
2126 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
2126 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
2127 | 2127 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
2128 | 2128 | if ($error != '') { |
2129 | 2129 | return $error; |
2130 | 2130 | } elseif ($globalDebug) echo "Done\n"; |
2131 | 2131 | if ($globalDebug) echo "Owner Chile: Download..."; |
2132 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
2132 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
2133 | 2133 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2134 | 2134 | if ($globalDebug) echo "Add to DB..."; |
2135 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
2135 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
2136 | 2136 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
2137 | 2137 | if ($error != '') { |
2138 | 2138 | return $error; |
2139 | 2139 | } elseif ($globalDebug) echo "Done\n"; |
2140 | 2140 | if ($globalDebug) echo "Owner Colombia: Download..."; |
2141 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
2141 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
2142 | 2142 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2143 | 2143 | if ($globalDebug) echo "Add to DB..."; |
2144 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
2144 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
2145 | 2145 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
2146 | 2146 | if ($error != '') { |
2147 | 2147 | return $error; |
2148 | 2148 | } elseif ($globalDebug) echo "Done\n"; |
2149 | 2149 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
2150 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
2150 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
2151 | 2151 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2152 | 2152 | if ($globalDebug) echo "Add to DB..."; |
2153 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
2153 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
2154 | 2154 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
2155 | 2155 | if ($error != '') { |
2156 | 2156 | return $error; |
2157 | 2157 | } elseif ($globalDebug) echo "Done\n"; |
2158 | 2158 | if ($globalDebug) echo "Owner Brazil: Download..."; |
2159 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
2159 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
2160 | 2160 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2161 | 2161 | if ($globalDebug) echo "Add to DB..."; |
2162 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
2162 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
2163 | 2163 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
2164 | 2164 | if ($error != '') { |
2165 | 2165 | return $error; |
2166 | 2166 | } elseif ($globalDebug) echo "Done\n"; |
2167 | 2167 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
2168 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
2168 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
2169 | 2169 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2170 | 2170 | if ($globalDebug) echo "Add to DB..."; |
2171 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
2171 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
2172 | 2172 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
2173 | 2173 | if ($error != '') { |
2174 | 2174 | return $error; |
2175 | 2175 | } elseif ($globalDebug) echo "Done\n"; |
2176 | 2176 | if ($globalDebug) echo "Owner Croatia: Download..."; |
2177 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
2177 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
2178 | 2178 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2179 | 2179 | if ($globalDebug) echo "Add to DB..."; |
2180 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
2180 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
2181 | 2181 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
2182 | 2182 | if ($error != '') { |
2183 | 2183 | return $error; |
2184 | 2184 | } elseif ($globalDebug) echo "Done\n"; |
2185 | 2185 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
2186 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
2186 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
2187 | 2187 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2188 | 2188 | if ($globalDebug) echo "Add to DB..."; |
2189 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
2189 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
2190 | 2190 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
2191 | 2191 | if ($error != '') { |
2192 | 2192 | return $error; |
2193 | 2193 | } elseif ($globalDebug) echo "Done\n"; |
2194 | 2194 | if ($globalDebug) echo "Owner Maldives: Download..."; |
2195 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
2195 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
2196 | 2196 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2197 | 2197 | if ($globalDebug) echo "Add to DB..."; |
2198 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
2198 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
2199 | 2199 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
2200 | 2200 | if ($error != '') { |
2201 | 2201 | return $error; |
2202 | 2202 | } elseif ($globalDebug) echo "Done\n"; |
2203 | 2203 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
2204 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
2204 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
2205 | 2205 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2206 | 2206 | if ($globalDebug) echo "Add to DB..."; |
2207 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
2207 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
2208 | 2208 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
2209 | 2209 | if ($error != '') { |
2210 | 2210 | return $error; |
2211 | 2211 | } elseif ($globalDebug) echo "Done\n"; |
2212 | 2212 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
2213 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
2213 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
2214 | 2214 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2215 | 2215 | if ($globalDebug) echo "Add to DB..."; |
2216 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
2216 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
2217 | 2217 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
2218 | 2218 | if ($error != '') { |
2219 | 2219 | return $error; |
2220 | 2220 | } elseif ($globalDebug) echo "Done\n"; |
2221 | 2221 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
2222 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
2222 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
2223 | 2223 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2224 | 2224 | if ($globalDebug) echo "Add to DB..."; |
2225 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
2225 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
2226 | 2226 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
2227 | 2227 | if ($error != '') { |
2228 | 2228 | return $error; |
2229 | 2229 | } elseif ($globalDebug) echo "Done\n"; |
2230 | 2230 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
2231 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
2231 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
2232 | 2232 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2233 | 2233 | if ($globalDebug) echo "Add to DB..."; |
2234 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
2234 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
2235 | 2235 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
2236 | 2236 | if ($error != '') { |
2237 | 2237 | return $error; |
2238 | 2238 | } elseif ($globalDebug) echo "Done\n"; |
2239 | 2239 | if ($globalDebug) echo "Owner Iceland: Download..."; |
2240 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
2240 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
2241 | 2241 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2242 | 2242 | if ($globalDebug) echo "Add to DB..."; |
2243 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
2243 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
2244 | 2244 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
2245 | 2245 | if ($error != '') { |
2246 | 2246 | return $error; |
2247 | 2247 | } elseif ($globalDebug) echo "Done\n"; |
2248 | 2248 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
2249 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
2249 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
2250 | 2250 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2251 | 2251 | if ($globalDebug) echo "Add to DB..."; |
2252 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
2252 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
2253 | 2253 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
2254 | 2254 | if ($error != '') { |
2255 | 2255 | return $error; |
2256 | 2256 | } elseif ($globalDebug) echo "Done\n"; |
2257 | 2257 | if ($globalMasterSource) { |
2258 | 2258 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
2259 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
2259 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
2260 | 2260 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2261 | 2261 | if ($globalDebug) echo "Add to DB..."; |
2262 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
2262 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
2263 | 2263 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
2264 | 2264 | if ($error != '') { |
2265 | 2265 | return $error; |
2266 | 2266 | } elseif ($globalDebug) echo "Done\n"; |
2267 | 2267 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
2268 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
2268 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
2269 | 2269 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2270 | 2270 | if ($globalDebug) echo "Add to DB..."; |
2271 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
2271 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
2272 | 2272 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
2273 | 2273 | if ($error != '') { |
2274 | 2274 | return $error; |
@@ -2281,7 +2281,7 @@ discard block |
||
2281 | 2281 | global $tmp_dir, $globalDebug; |
2282 | 2282 | $error = ''; |
2283 | 2283 | if ($globalDebug) echo "Translation : Download..."; |
2284 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
2284 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
2285 | 2285 | if (file_exists($tmp_dir.'translation.zip')) { |
2286 | 2286 | if ($globalDebug) echo "Unzip..."; |
2287 | 2287 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -2297,7 +2297,7 @@ discard block |
||
2297 | 2297 | public static function update_translation_fam() { |
2298 | 2298 | global $tmp_dir, $globalDebug; |
2299 | 2299 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
2300 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
2300 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
2301 | 2301 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
2302 | 2302 | if ($globalDebug) echo "Gunzip..."; |
2303 | 2303 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -2312,7 +2312,7 @@ discard block |
||
2312 | 2312 | public static function update_ModeS_fam() { |
2313 | 2313 | global $tmp_dir, $globalDebug; |
2314 | 2314 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
2315 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
2315 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
2316 | 2316 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
2317 | 2317 | if ($globalDebug) echo "Gunzip..."; |
2318 | 2318 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
@@ -2328,9 +2328,9 @@ discard block |
||
2328 | 2328 | global $tmp_dir, $globalDebug, $globalOwner; |
2329 | 2329 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
2330 | 2330 | if ($globalOwner === TRUE) { |
2331 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2331 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2332 | 2332 | } else { |
2333 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2333 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2334 | 2334 | } |
2335 | 2335 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
2336 | 2336 | if ($globalDebug) echo "Gunzip..."; |
@@ -2346,7 +2346,7 @@ discard block |
||
2346 | 2346 | public static function update_routes_fam() { |
2347 | 2347 | global $tmp_dir, $globalDebug; |
2348 | 2348 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2349 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
2349 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2350 | 2350 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2351 | 2351 | if ($globalDebug) echo "Gunzip..."; |
2352 | 2352 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
@@ -2360,13 +2360,13 @@ discard block |
||
2360 | 2360 | } |
2361 | 2361 | public static function update_marine_identity_fam() { |
2362 | 2362 | global $tmp_dir, $globalDebug; |
2363 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2363 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2364 | 2364 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2365 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2365 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2366 | 2366 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2367 | 2367 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2368 | 2368 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2369 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2369 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2370 | 2370 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2371 | 2371 | if ($globalDebug) echo "Gunzip..."; |
2372 | 2372 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
@@ -2386,13 +2386,13 @@ discard block |
||
2386 | 2386 | |
2387 | 2387 | public static function update_satellite_fam() { |
2388 | 2388 | global $tmp_dir, $globalDebug; |
2389 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5'); |
|
2389 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5'); |
|
2390 | 2390 | if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) { |
2391 | - $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2391 | + $satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2392 | 2392 | $satellite_md5 = $satellite_md5_file[0]; |
2393 | 2393 | if (!update_db::check_satellite_version($satellite_md5)) { |
2394 | 2394 | if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
2395 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
|
2395 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz'); |
|
2396 | 2396 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2397 | 2397 | if ($globalDebug) echo "Gunzip..."; |
2398 | 2398 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
@@ -2412,7 +2412,7 @@ discard block |
||
2412 | 2412 | public static function update_banned_fam() { |
2413 | 2413 | global $tmp_dir, $globalDebug; |
2414 | 2414 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2415 | - update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2415 | + update_db::download('http://data.flightairmap.com/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2416 | 2416 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2417 | 2417 | //if ($globalDebug) echo "Gunzip..."; |
2418 | 2418 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2431,18 +2431,18 @@ discard block |
||
2431 | 2431 | $error = ''; |
2432 | 2432 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2433 | 2433 | if ($globalDBdriver == 'mysql') { |
2434 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2434 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2435 | 2435 | } else { |
2436 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2436 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2437 | 2437 | } |
2438 | 2438 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2439 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2439 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2440 | 2440 | $airspace_md5 = $airspace_md5_file[0]; |
2441 | 2441 | if (!update_db::check_airspace_version($airspace_md5)) { |
2442 | 2442 | if ($globalDBdriver == 'mysql') { |
2443 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2443 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2444 | 2444 | } else { |
2445 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2445 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2446 | 2446 | } |
2447 | 2447 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2448 | 2448 | if ($globalDebug) echo "Gunzip..."; |
@@ -2454,7 +2454,7 @@ discard block |
||
2454 | 2454 | try { |
2455 | 2455 | $sth = $Connection->db->prepare($query); |
2456 | 2456 | $sth->execute(); |
2457 | - } catch(PDOException $e) { |
|
2457 | + } catch (PDOException $e) { |
|
2458 | 2458 | return "error : ".$e->getMessage(); |
2459 | 2459 | } |
2460 | 2460 | } |
@@ -2473,15 +2473,15 @@ discard block |
||
2473 | 2473 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2474 | 2474 | $error = ''; |
2475 | 2475 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
2476 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2476 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2477 | 2477 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2478 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2478 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2479 | 2479 | $geoid_md5 = $geoid_md5_file[0]; |
2480 | 2480 | if (!update_db::check_geoid_version($geoid_md5)) { |
2481 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2481 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2482 | 2482 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2483 | 2483 | if ($globalDebug) echo "Gunzip..."; |
2484 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2484 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2485 | 2485 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2486 | 2486 | update_db::insert_geoid_version($geoid_md5); |
2487 | 2487 | } |
@@ -2497,15 +2497,15 @@ discard block |
||
2497 | 2497 | public static function update_tle() { |
2498 | 2498 | global $tmp_dir, $globalDebug; |
2499 | 2499 | if ($globalDebug) echo "Download TLE : Download..."; |
2500 | - $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
|
2501 | - 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
|
2502 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
|
2500 | + $alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt', |
|
2501 | + 'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt', |
|
2502 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt', 'visual.txt', 'sarsat.txt', 'argos.txt', 'ses.txt', 'iridium-NEXT.txt', 'beidou.txt'); |
|
2503 | 2503 | foreach ($alltle as $filename) { |
2504 | 2504 | if ($globalDebug) echo "downloading ".$filename.'...'; |
2505 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2505 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2506 | 2506 | if (file_exists($tmp_dir.$filename)) { |
2507 | 2507 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
2508 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2508 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2509 | 2509 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2510 | 2510 | if ($error != '') { |
2511 | 2511 | echo $error."\n"; |
@@ -2517,7 +2517,7 @@ discard block |
||
2517 | 2517 | public static function update_ucsdb() { |
2518 | 2518 | global $tmp_dir, $globalDebug; |
2519 | 2519 | if ($globalDebug) echo "Download UCS DB : Download..."; |
2520 | - update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
2520 | + update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt', $tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
2521 | 2521 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2522 | 2522 | if ($globalDebug) echo "Add to DB..."; |
2523 | 2523 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
@@ -2531,7 +2531,7 @@ discard block |
||
2531 | 2531 | public static function update_celestrak() { |
2532 | 2532 | global $tmp_dir, $globalDebug; |
2533 | 2533 | if ($globalDebug) echo "Download Celestrak DB : Download..."; |
2534 | - update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
|
2534 | + update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt'); |
|
2535 | 2535 | if (file_exists($tmp_dir.'satcat.txt')) { |
2536 | 2536 | if ($globalDebug) echo "Add to DB..."; |
2537 | 2537 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
@@ -2546,32 +2546,32 @@ discard block |
||
2546 | 2546 | global $tmp_dir, $globalDebug; |
2547 | 2547 | $error = ''; |
2548 | 2548 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
2549 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2549 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2550 | 2550 | if (file_exists($tmp_dir.'models.md5sum')) { |
2551 | 2551 | if ($globalDebug) echo "Check files...\n"; |
2552 | 2552 | $newmodelsdb = array(); |
2553 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2554 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2553 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2554 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2555 | 2555 | $model = trim($row[2]); |
2556 | 2556 | $newmodelsdb[$model] = trim($row[0]); |
2557 | 2557 | } |
2558 | 2558 | } |
2559 | 2559 | $modelsdb = array(); |
2560 | 2560 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2561 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2562 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2561 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2562 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2563 | 2563 | $model = trim($row[2]); |
2564 | 2564 | $modelsdb[$model] = trim($row[0]); |
2565 | 2565 | } |
2566 | 2566 | } |
2567 | 2567 | } |
2568 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2568 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2569 | 2569 | foreach ($diff as $key => $value) { |
2570 | 2570 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2571 | - update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2571 | + update_db::download('http://data.flightairmap.com/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2572 | 2572 | |
2573 | 2573 | } |
2574 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2574 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2575 | 2575 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2576 | 2576 | if ($error != '') { |
2577 | 2577 | return $error; |
@@ -2583,32 +2583,32 @@ discard block |
||
2583 | 2583 | global $tmp_dir, $globalDebug; |
2584 | 2584 | $error = ''; |
2585 | 2585 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
2586 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
2586 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2587 | 2587 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2588 | 2588 | if ($globalDebug) echo "Check files...\n"; |
2589 | 2589 | $newmodelsdb = array(); |
2590 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2591 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2590 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
2591 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2592 | 2592 | $model = trim($row[2]); |
2593 | 2593 | $newmodelsdb[$model] = trim($row[0]); |
2594 | 2594 | } |
2595 | 2595 | } |
2596 | 2596 | $modelsdb = array(); |
2597 | 2597 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
2598 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2599 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2598 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2599 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2600 | 2600 | $model = trim($row[2]); |
2601 | 2601 | $modelsdb[$model] = trim($row[0]); |
2602 | 2602 | } |
2603 | 2603 | } |
2604 | 2604 | } |
2605 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2605 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2606 | 2606 | foreach ($diff as $key => $value) { |
2607 | 2607 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2608 | - update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2608 | + update_db::download('http://data.flightairmap.com/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2609 | 2609 | |
2610 | 2610 | } |
2611 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2611 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2612 | 2612 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2613 | 2613 | if ($error != '') { |
2614 | 2614 | return $error; |
@@ -2620,32 +2620,32 @@ discard block |
||
2620 | 2620 | global $tmp_dir, $globalDebug; |
2621 | 2621 | $error = ''; |
2622 | 2622 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
2623 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
2623 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2624 | 2624 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2625 | 2625 | if ($globalDebug) echo "Check files...\n"; |
2626 | 2626 | $newmodelsdb = array(); |
2627 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2628 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2627 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2628 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2629 | 2629 | $model = trim($row[2]); |
2630 | 2630 | $newmodelsdb[$model] = trim($row[0]); |
2631 | 2631 | } |
2632 | 2632 | } |
2633 | 2633 | $modelsdb = array(); |
2634 | 2634 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
2635 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2636 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2635 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2636 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2637 | 2637 | $model = trim($row[2]); |
2638 | 2638 | $modelsdb[$model] = trim($row[0]); |
2639 | 2639 | } |
2640 | 2640 | } |
2641 | 2641 | } |
2642 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2642 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2643 | 2643 | foreach ($diff as $key => $value) { |
2644 | 2644 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
2645 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2645 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2646 | 2646 | |
2647 | 2647 | } |
2648 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2648 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2649 | 2649 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2650 | 2650 | if ($error != '') { |
2651 | 2651 | return $error; |
@@ -2668,8 +2668,8 @@ discard block |
||
2668 | 2668 | */ |
2669 | 2669 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2670 | 2670 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
2671 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2672 | - $result = fread($fh,100000000); |
|
2671 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
2672 | + $result = fread($fh, 100000000); |
|
2673 | 2673 | //echo $result; |
2674 | 2674 | //var_dump(str_get_html($result)); |
2675 | 2675 | //print_r(self::table2array($result)); |
@@ -2687,23 +2687,23 @@ discard block |
||
2687 | 2687 | $Connection = new Connection(); |
2688 | 2688 | $sth = $Connection->db->prepare($query); |
2689 | 2689 | $sth->execute(); |
2690 | - } catch(PDOException $e) { |
|
2690 | + } catch (PDOException $e) { |
|
2691 | 2691 | return "error : ".$e->getMessage(); |
2692 | 2692 | } |
2693 | 2693 | |
2694 | 2694 | $error = ''; |
2695 | 2695 | if ($globalDebug) echo "Notam : Download..."; |
2696 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
2696 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2697 | 2697 | if (file_exists($tmp_dir.'notam.rss')) { |
2698 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
2698 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2699 | 2699 | foreach ($notams['channel']['item'] as $notam) { |
2700 | - $title = explode(':',$notam['title']); |
|
2700 | + $title = explode(':', $notam['title']); |
|
2701 | 2701 | $data['ref'] = trim($title[0]); |
2702 | 2702 | unset($title[0]); |
2703 | - $data['title'] = trim(implode(':',$title)); |
|
2704 | - $description = strip_tags($notam['description'],'<pre>'); |
|
2705 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
2706 | - $q = explode('/',$match[1]); |
|
2703 | + $data['title'] = trim(implode(':', $title)); |
|
2704 | + $description = strip_tags($notam['description'], '<pre>'); |
|
2705 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
2706 | + $q = explode('/', $match[1]); |
|
2707 | 2707 | $data['fir'] = $q[0]; |
2708 | 2708 | $data['code'] = $q[1]; |
2709 | 2709 | $ifrvfr = $q[2]; |
@@ -2719,30 +2719,30 @@ discard block |
||
2719 | 2719 | $data['lower_limit'] = $q[5]; |
2720 | 2720 | $data['upper_limit'] = $q[6]; |
2721 | 2721 | $latlonrad = $q[7]; |
2722 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2723 | - $latitude = $Common->convertDec($las,'latitude'); |
|
2724 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
2722 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
2723 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
2724 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
2725 | 2725 | if ($lac == 'S') $latitude = '-'.$latitude; |
2726 | 2726 | if ($lnc == 'W') $longitude = '-'.$longitude; |
2727 | 2727 | $data['center_latitude'] = $latitude; |
2728 | 2728 | $data['center_longitude'] = $longitude; |
2729 | 2729 | $data['radius'] = intval($radius); |
2730 | 2730 | |
2731 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
2731 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2732 | 2732 | $data['text'] = $match[1]; |
2733 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
2733 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
2734 | 2734 | $fromto = $match[1]; |
2735 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
2735 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2736 | 2736 | $fromall = trim($match[1]); |
2737 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
2737 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2738 | 2738 | $from = trim($match[1]); |
2739 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2740 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
2739 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
2740 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2741 | 2741 | $toall = trim($match[1]); |
2742 | - if (!preg_match(':Permanent:',$toall)) { |
|
2743 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
2742 | + if (!preg_match(':Permanent:', $toall)) { |
|
2743 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2744 | 2744 | $to = trim($match[1]); |
2745 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
2745 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2746 | 2746 | $data['permanent'] = 0; |
2747 | 2747 | } else { |
2748 | 2748 | $data['date_end'] = NULL; |
@@ -2750,7 +2750,7 @@ discard block |
||
2750 | 2750 | } |
2751 | 2751 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2752 | 2752 | $NOTAM = new NOTAM(); |
2753 | - $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
2753 | + $NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
2754 | 2754 | unset($data); |
2755 | 2755 | } |
2756 | 2756 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2773,16 +2773,16 @@ discard block |
||
2773 | 2773 | $Connection = new Connection(); |
2774 | 2774 | $sth = $Connection->db->prepare($query); |
2775 | 2775 | $sth->execute(); |
2776 | - } catch(PDOException $e) { |
|
2776 | + } catch (PDOException $e) { |
|
2777 | 2777 | return "error : ".$e->getMessage(); |
2778 | 2778 | } |
2779 | 2779 | } |
2780 | 2780 | $Common = new Common(); |
2781 | 2781 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2782 | - $airspace_json = json_decode($airspace_lst,true); |
|
2782 | + $airspace_json = json_decode($airspace_lst, true); |
|
2783 | 2783 | foreach ($airspace_json['records'] as $airspace) { |
2784 | 2784 | if ($globalDebug) echo $airspace['name']."...\n"; |
2785 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
2785 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2786 | 2786 | if (file_exists($tmp_dir.$airspace['name'])) { |
2787 | 2787 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
2788 | 2788 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2804,7 +2804,7 @@ discard block |
||
2804 | 2804 | $Connection = new Connection(); |
2805 | 2805 | $sth = $Connection->db->prepare($query); |
2806 | 2806 | $sth->execute(array(':new' => $new, ':old' => $old)); |
2807 | - } catch(PDOException $e) { |
|
2807 | + } catch (PDOException $e) { |
|
2808 | 2808 | return "error : ".$e->getMessage(); |
2809 | 2809 | } |
2810 | 2810 | } |
@@ -2821,7 +2821,7 @@ discard block |
||
2821 | 2821 | $Connection = new Connection(); |
2822 | 2822 | $sth = $Connection->db->prepare($query); |
2823 | 2823 | $sth->execute(); |
2824 | - } catch(PDOException $e) { |
|
2824 | + } catch (PDOException $e) { |
|
2825 | 2825 | return "error : ".$e->getMessage(); |
2826 | 2826 | } |
2827 | 2827 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2836,7 +2836,7 @@ discard block |
||
2836 | 2836 | $Connection = new Connection(); |
2837 | 2837 | $sth = $Connection->db->prepare($query); |
2838 | 2838 | $sth->execute(); |
2839 | - } catch(PDOException $e) { |
|
2839 | + } catch (PDOException $e) { |
|
2840 | 2840 | return "error : ".$e->getMessage(); |
2841 | 2841 | } |
2842 | 2842 | } |
@@ -2847,7 +2847,7 @@ discard block |
||
2847 | 2847 | $Connection = new Connection(); |
2848 | 2848 | $sth = $Connection->db->prepare($query); |
2849 | 2849 | $sth->execute(array(':version' => $version)); |
2850 | - } catch(PDOException $e) { |
|
2850 | + } catch (PDOException $e) { |
|
2851 | 2851 | return "error : ".$e->getMessage(); |
2852 | 2852 | } |
2853 | 2853 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2861,7 +2861,7 @@ discard block |
||
2861 | 2861 | $Connection = new Connection(); |
2862 | 2862 | $sth = $Connection->db->prepare($query); |
2863 | 2863 | $sth->execute(array(':version' => $version)); |
2864 | - } catch(PDOException $e) { |
|
2864 | + } catch (PDOException $e) { |
|
2865 | 2865 | return "error : ".$e->getMessage(); |
2866 | 2866 | } |
2867 | 2867 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2875,7 +2875,7 @@ discard block |
||
2875 | 2875 | $Connection = new Connection(); |
2876 | 2876 | $sth = $Connection->db->prepare($query); |
2877 | 2877 | $sth->execute(array(':version' => $version)); |
2878 | - } catch(PDOException $e) { |
|
2878 | + } catch (PDOException $e) { |
|
2879 | 2879 | return "error : ".$e->getMessage(); |
2880 | 2880 | } |
2881 | 2881 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2889,7 +2889,7 @@ discard block |
||
2889 | 2889 | $Connection = new Connection(); |
2890 | 2890 | $sth = $Connection->db->prepare($query); |
2891 | 2891 | $sth->execute(array(':version' => $version)); |
2892 | - } catch(PDOException $e) { |
|
2892 | + } catch (PDOException $e) { |
|
2893 | 2893 | return "error : ".$e->getMessage(); |
2894 | 2894 | } |
2895 | 2895 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2905,7 +2905,7 @@ discard block |
||
2905 | 2905 | $Connection = new Connection(); |
2906 | 2906 | $sth = $Connection->db->prepare($query); |
2907 | 2907 | $sth->execute(array(':version' => $version)); |
2908 | - } catch(PDOException $e) { |
|
2908 | + } catch (PDOException $e) { |
|
2909 | 2909 | return "error : ".$e->getMessage(); |
2910 | 2910 | } |
2911 | 2911 | } |
@@ -2917,7 +2917,7 @@ discard block |
||
2917 | 2917 | $Connection = new Connection(); |
2918 | 2918 | $sth = $Connection->db->prepare($query); |
2919 | 2919 | $sth->execute(array(':version' => $version)); |
2920 | - } catch(PDOException $e) { |
|
2920 | + } catch (PDOException $e) { |
|
2921 | 2921 | return "error : ".$e->getMessage(); |
2922 | 2922 | } |
2923 | 2923 | } |
@@ -2929,7 +2929,7 @@ discard block |
||
2929 | 2929 | $Connection = new Connection(); |
2930 | 2930 | $sth = $Connection->db->prepare($query); |
2931 | 2931 | $sth->execute(array(':version' => $version)); |
2932 | - } catch(PDOException $e) { |
|
2932 | + } catch (PDOException $e) { |
|
2933 | 2933 | return "error : ".$e->getMessage(); |
2934 | 2934 | } |
2935 | 2935 | } |
@@ -2941,7 +2941,7 @@ discard block |
||
2941 | 2941 | $Connection = new Connection(); |
2942 | 2942 | $sth = $Connection->db->prepare($query); |
2943 | 2943 | $sth->execute(array(':version' => $version)); |
2944 | - } catch(PDOException $e) { |
|
2944 | + } catch (PDOException $e) { |
|
2945 | 2945 | return "error : ".$e->getMessage(); |
2946 | 2946 | } |
2947 | 2947 | } |
@@ -2957,7 +2957,7 @@ discard block |
||
2957 | 2957 | $Connection = new Connection(); |
2958 | 2958 | $sth = $Connection->db->prepare($query); |
2959 | 2959 | $sth->execute(); |
2960 | - } catch(PDOException $e) { |
|
2960 | + } catch (PDOException $e) { |
|
2961 | 2961 | return "error : ".$e->getMessage(); |
2962 | 2962 | } |
2963 | 2963 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2972,7 +2972,7 @@ discard block |
||
2972 | 2972 | $Connection = new Connection(); |
2973 | 2973 | $sth = $Connection->db->prepare($query); |
2974 | 2974 | $sth->execute(); |
2975 | - } catch(PDOException $e) { |
|
2975 | + } catch (PDOException $e) { |
|
2976 | 2976 | return "error : ".$e->getMessage(); |
2977 | 2977 | } |
2978 | 2978 | } |
@@ -2988,7 +2988,7 @@ discard block |
||
2988 | 2988 | $Connection = new Connection(); |
2989 | 2989 | $sth = $Connection->db->prepare($query); |
2990 | 2990 | $sth->execute(); |
2991 | - } catch(PDOException $e) { |
|
2991 | + } catch (PDOException $e) { |
|
2992 | 2992 | return "error : ".$e->getMessage(); |
2993 | 2993 | } |
2994 | 2994 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3003,7 +3003,7 @@ discard block |
||
3003 | 3003 | $Connection = new Connection(); |
3004 | 3004 | $sth = $Connection->db->prepare($query); |
3005 | 3005 | $sth->execute(); |
3006 | - } catch(PDOException $e) { |
|
3006 | + } catch (PDOException $e) { |
|
3007 | 3007 | return "error : ".$e->getMessage(); |
3008 | 3008 | } |
3009 | 3009 | } |
@@ -3019,7 +3019,7 @@ discard block |
||
3019 | 3019 | $Connection = new Connection(); |
3020 | 3020 | $sth = $Connection->db->prepare($query); |
3021 | 3021 | $sth->execute(); |
3022 | - } catch(PDOException $e) { |
|
3022 | + } catch (PDOException $e) { |
|
3023 | 3023 | return "error : ".$e->getMessage(); |
3024 | 3024 | } |
3025 | 3025 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3034,7 +3034,7 @@ discard block |
||
3034 | 3034 | $Connection = new Connection(); |
3035 | 3035 | $sth = $Connection->db->prepare($query); |
3036 | 3036 | $sth->execute(); |
3037 | - } catch(PDOException $e) { |
|
3037 | + } catch (PDOException $e) { |
|
3038 | 3038 | return "error : ".$e->getMessage(); |
3039 | 3039 | } |
3040 | 3040 | } |
@@ -3050,7 +3050,7 @@ discard block |
||
3050 | 3050 | $Connection = new Connection(); |
3051 | 3051 | $sth = $Connection->db->prepare($query); |
3052 | 3052 | $sth->execute(); |
3053 | - } catch(PDOException $e) { |
|
3053 | + } catch (PDOException $e) { |
|
3054 | 3054 | return "error : ".$e->getMessage(); |
3055 | 3055 | } |
3056 | 3056 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3065,7 +3065,7 @@ discard block |
||
3065 | 3065 | $Connection = new Connection(); |
3066 | 3066 | $sth = $Connection->db->prepare($query); |
3067 | 3067 | $sth->execute(); |
3068 | - } catch(PDOException $e) { |
|
3068 | + } catch (PDOException $e) { |
|
3069 | 3069 | return "error : ".$e->getMessage(); |
3070 | 3070 | } |
3071 | 3071 | } |
@@ -3080,7 +3080,7 @@ discard block |
||
3080 | 3080 | $Connection = new Connection(); |
3081 | 3081 | $sth = $Connection->db->prepare($query); |
3082 | 3082 | $sth->execute(); |
3083 | - } catch(PDOException $e) { |
|
3083 | + } catch (PDOException $e) { |
|
3084 | 3084 | return "error : ".$e->getMessage(); |
3085 | 3085 | } |
3086 | 3086 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3095,7 +3095,7 @@ discard block |
||
3095 | 3095 | $Connection = new Connection(); |
3096 | 3096 | $sth = $Connection->db->prepare($query); |
3097 | 3097 | $sth->execute(); |
3098 | - } catch(PDOException $e) { |
|
3098 | + } catch (PDOException $e) { |
|
3099 | 3099 | return "error : ".$e->getMessage(); |
3100 | 3100 | } |
3101 | 3101 | } |
@@ -3111,7 +3111,7 @@ discard block |
||
3111 | 3111 | $Connection = new Connection(); |
3112 | 3112 | $sth = $Connection->db->prepare($query); |
3113 | 3113 | $sth->execute(); |
3114 | - } catch(PDOException $e) { |
|
3114 | + } catch (PDOException $e) { |
|
3115 | 3115 | return "error : ".$e->getMessage(); |
3116 | 3116 | } |
3117 | 3117 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3126,7 +3126,7 @@ discard block |
||
3126 | 3126 | $Connection = new Connection(); |
3127 | 3127 | $sth = $Connection->db->prepare($query); |
3128 | 3128 | $sth->execute(); |
3129 | - } catch(PDOException $e) { |
|
3129 | + } catch (PDOException $e) { |
|
3130 | 3130 | return "error : ".$e->getMessage(); |
3131 | 3131 | } |
3132 | 3132 | } |
@@ -3142,7 +3142,7 @@ discard block |
||
3142 | 3142 | $Connection = new Connection(); |
3143 | 3143 | $sth = $Connection->db->prepare($query); |
3144 | 3144 | $sth->execute(); |
3145 | - } catch(PDOException $e) { |
|
3145 | + } catch (PDOException $e) { |
|
3146 | 3146 | return "error : ".$e->getMessage(); |
3147 | 3147 | } |
3148 | 3148 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3157,7 +3157,7 @@ discard block |
||
3157 | 3157 | $Connection = new Connection(); |
3158 | 3158 | $sth = $Connection->db->prepare($query); |
3159 | 3159 | $sth->execute(); |
3160 | - } catch(PDOException $e) { |
|
3160 | + } catch (PDOException $e) { |
|
3161 | 3161 | return "error : ".$e->getMessage(); |
3162 | 3162 | } |
3163 | 3163 | } |
@@ -3173,7 +3173,7 @@ discard block |
||
3173 | 3173 | $Connection = new Connection(); |
3174 | 3174 | $sth = $Connection->db->prepare($query); |
3175 | 3175 | $sth->execute(); |
3176 | - } catch(PDOException $e) { |
|
3176 | + } catch (PDOException $e) { |
|
3177 | 3177 | return "error : ".$e->getMessage(); |
3178 | 3178 | } |
3179 | 3179 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3188,7 +3188,7 @@ discard block |
||
3188 | 3188 | $Connection = new Connection(); |
3189 | 3189 | $sth = $Connection->db->prepare($query); |
3190 | 3190 | $sth->execute(); |
3191 | - } catch(PDOException $e) { |
|
3191 | + } catch (PDOException $e) { |
|
3192 | 3192 | return "error : ".$e->getMessage(); |
3193 | 3193 | } |
3194 | 3194 | } |
@@ -3204,7 +3204,7 @@ discard block |
||
3204 | 3204 | $Connection = new Connection(); |
3205 | 3205 | $sth = $Connection->db->prepare($query); |
3206 | 3206 | $sth->execute(); |
3207 | - } catch(PDOException $e) { |
|
3207 | + } catch (PDOException $e) { |
|
3208 | 3208 | return "error : ".$e->getMessage(); |
3209 | 3209 | } |
3210 | 3210 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3223,7 +3223,7 @@ discard block |
||
3223 | 3223 | $Connection = new Connection(); |
3224 | 3224 | $sth = $Connection->db->prepare($query); |
3225 | 3225 | $sth->execute(); |
3226 | - } catch(PDOException $e) { |
|
3226 | + } catch (PDOException $e) { |
|
3227 | 3227 | return "error : ".$e->getMessage(); |
3228 | 3228 | } |
3229 | 3229 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3238,7 +3238,7 @@ discard block |
||
3238 | 3238 | $Connection = new Connection(); |
3239 | 3239 | $sth = $Connection->db->prepare($query); |
3240 | 3240 | $sth->execute(); |
3241 | - } catch(PDOException $e) { |
|
3241 | + } catch (PDOException $e) { |
|
3242 | 3242 | return "error : ".$e->getMessage(); |
3243 | 3243 | } |
3244 | 3244 | } |
@@ -3250,7 +3250,7 @@ discard block |
||
3250 | 3250 | $Connection = new Connection(); |
3251 | 3251 | $sth = $Connection->db->prepare($query); |
3252 | 3252 | $sth->execute(); |
3253 | - } catch(PDOException $e) { |
|
3253 | + } catch (PDOException $e) { |
|
3254 | 3254 | return "error : ".$e->getMessage(); |
3255 | 3255 | } |
3256 | 3256 | } |
@@ -3266,7 +3266,7 @@ discard block |
||
3266 | 3266 | $Connection = new Connection(); |
3267 | 3267 | $sth = $Connection->db->prepare($query); |
3268 | 3268 | $sth->execute(); |
3269 | - } catch(PDOException $e) { |
|
3269 | + } catch (PDOException $e) { |
|
3270 | 3270 | return "error : ".$e->getMessage(); |
3271 | 3271 | } |
3272 | 3272 | } |
@@ -3281,7 +3281,7 @@ discard block |
||
3281 | 3281 | $Connection = new Connection(); |
3282 | 3282 | $sth = $Connection->db->prepare($query); |
3283 | 3283 | $sth->execute(); |
3284 | - } catch(PDOException $e) { |
|
3284 | + } catch (PDOException $e) { |
|
3285 | 3285 | return "error : ".$e->getMessage(); |
3286 | 3286 | } |
3287 | 3287 | } |
@@ -17,7 +17,9 @@ discard block |
||
17 | 17 | curl_setopt($ch, CURLOPT_URL, $url); |
18 | 18 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
19 | 19 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
20 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
20 | + if ($referer != '') { |
|
21 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
22 | + } |
|
21 | 23 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
22 | 24 | curl_setopt($ch, CURLOPT_FILE, $fp); |
23 | 25 | curl_exec($ch); |
@@ -28,12 +30,16 @@ discard block |
||
28 | 30 | public static function gunzip($in_file,$out_file_name = '') { |
29 | 31 | //echo $in_file.' -> '.$out_file_name."\n"; |
30 | 32 | $buffer_size = 4096; // read 4kb at a time |
31 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
33 | + if ($out_file_name == '') { |
|
34 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
35 | + } |
|
32 | 36 | if ($in_file != '' && file_exists($in_file)) { |
33 | 37 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
34 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
35 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
36 | - else { |
|
38 | + if (function_exists('gzopen')) { |
|
39 | + $file = gzopen($in_file,'rb'); |
|
40 | + } elseif (function_exists('gzopen64')) { |
|
41 | + $file = gzopen64($in_file,'rb'); |
|
42 | + } else { |
|
37 | 43 | echo 'gzopen not available'; |
38 | 44 | die; |
39 | 45 | } |
@@ -54,8 +60,12 @@ discard block |
||
54 | 60 | if ($res === TRUE) { |
55 | 61 | $zip->extractTo($path); |
56 | 62 | $zip->close(); |
57 | - } else return false; |
|
58 | - } else return false; |
|
63 | + } else { |
|
64 | + return false; |
|
65 | + } |
|
66 | + } else { |
|
67 | + return false; |
|
68 | + } |
|
59 | 69 | } |
60 | 70 | |
61 | 71 | public static function connect_sqlite($database) { |
@@ -70,7 +80,9 @@ discard block |
||
70 | 80 | public static function retrieve_route_sqlite_to_dest($database_file) { |
71 | 81 | global $globalDebug, $globalTransaction; |
72 | 82 | //$query = 'TRUNCATE TABLE routes'; |
73 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
83 | + if ($globalDebug) { |
|
84 | + echo " - Delete previous routes from DB -"; |
|
85 | + } |
|
74 | 86 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
75 | 87 | $Connection = new Connection(); |
76 | 88 | try { |
@@ -81,7 +93,9 @@ discard block |
||
81 | 93 | return "error : ".$e->getMessage(); |
82 | 94 | } |
83 | 95 | |
84 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
96 | + if ($globalDebug) { |
|
97 | + echo " - Add routes to DB -"; |
|
98 | + } |
|
85 | 99 | update_db::connect_sqlite($database_file); |
86 | 100 | //$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 | 101 | $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"; |
@@ -96,15 +110,21 @@ discard block |
||
96 | 110 | $Connection = new Connection(); |
97 | 111 | $sth_dest = $Connection->db->prepare($query_dest); |
98 | 112 | try { |
99 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
113 | + if ($globalTransaction) { |
|
114 | + $Connection->db->beginTransaction(); |
|
115 | + } |
|
100 | 116 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
101 | 117 | //$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 | 118 | $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 | 119 | $sth_dest->execute($query_dest_values); |
104 | 120 | } |
105 | - if ($globalTransaction) $Connection->db->commit(); |
|
121 | + if ($globalTransaction) { |
|
122 | + $Connection->db->commit(); |
|
123 | + } |
|
106 | 124 | } catch(PDOException $e) { |
107 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
125 | + if ($globalTransaction) { |
|
126 | + $Connection->db->rollBack(); |
|
127 | + } |
|
108 | 128 | return "error : ".$e->getMessage(); |
109 | 129 | } |
110 | 130 | return ''; |
@@ -112,7 +132,9 @@ discard block |
||
112 | 132 | public static function retrieve_route_oneworld($database_file) { |
113 | 133 | global $globalDebug, $globalTransaction; |
114 | 134 | //$query = 'TRUNCATE TABLE routes'; |
115 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
135 | + if ($globalDebug) { |
|
136 | + echo " - Delete previous routes from DB -"; |
|
137 | + } |
|
116 | 138 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
117 | 139 | $Connection = new Connection(); |
118 | 140 | try { |
@@ -123,14 +145,18 @@ discard block |
||
123 | 145 | return "error : ".$e->getMessage(); |
124 | 146 | } |
125 | 147 | |
126 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
148 | + if ($globalDebug) { |
|
149 | + echo " - Add routes to DB -"; |
|
150 | + } |
|
127 | 151 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
128 | 152 | $Spotter = new Spotter(); |
129 | 153 | if ($fh = fopen($database_file,"r")) { |
130 | 154 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
131 | 155 | $Connection = new Connection(); |
132 | 156 | $sth_dest = $Connection->db->prepare($query_dest); |
133 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
157 | + if ($globalTransaction) { |
|
158 | + $Connection->db->beginTransaction(); |
|
159 | + } |
|
134 | 160 | while (!feof($fh)) { |
135 | 161 | $line = fgetcsv($fh,9999,','); |
136 | 162 | if ($line[0] != '') { |
@@ -139,13 +165,17 @@ discard block |
||
139 | 165 | $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
140 | 166 | $sth_dest->execute($query_dest_values); |
141 | 167 | } catch(PDOException $e) { |
142 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
168 | + if ($globalTransaction) { |
|
169 | + $Connection->db->rollBack(); |
|
170 | + } |
|
143 | 171 | return "error : ".$e->getMessage(); |
144 | 172 | } |
145 | 173 | } |
146 | 174 | } |
147 | 175 | } |
148 | - if ($globalTransaction) $Connection->db->commit(); |
|
176 | + if ($globalTransaction) { |
|
177 | + $Connection->db->commit(); |
|
178 | + } |
|
149 | 179 | } |
150 | 180 | return ''; |
151 | 181 | } |
@@ -153,7 +183,9 @@ discard block |
||
153 | 183 | public static function retrieve_route_skyteam($database_file) { |
154 | 184 | global $globalDebug, $globalTransaction; |
155 | 185 | //$query = 'TRUNCATE TABLE routes'; |
156 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
186 | + if ($globalDebug) { |
|
187 | + echo " - Delete previous routes from DB -"; |
|
188 | + } |
|
157 | 189 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
158 | 190 | $Connection = new Connection(); |
159 | 191 | try { |
@@ -164,7 +196,9 @@ discard block |
||
164 | 196 | return "error : ".$e->getMessage(); |
165 | 197 | } |
166 | 198 | |
167 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
199 | + if ($globalDebug) { |
|
200 | + echo " - Add routes to DB -"; |
|
201 | + } |
|
168 | 202 | |
169 | 203 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
170 | 204 | $Spotter = new Spotter(); |
@@ -173,7 +207,9 @@ discard block |
||
173 | 207 | $Connection = new Connection(); |
174 | 208 | $sth_dest = $Connection->db->prepare($query_dest); |
175 | 209 | try { |
176 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
210 | + if ($globalTransaction) { |
|
211 | + $Connection->db->beginTransaction(); |
|
212 | + } |
|
177 | 213 | while (!feof($fh)) { |
178 | 214 | $line = fgetcsv($fh,9999,','); |
179 | 215 | if ($line[0] != '') { |
@@ -184,9 +220,13 @@ discard block |
||
184 | 220 | } |
185 | 221 | } |
186 | 222 | } |
187 | - if ($globalTransaction) $Connection->db->commit(); |
|
223 | + if ($globalTransaction) { |
|
224 | + $Connection->db->commit(); |
|
225 | + } |
|
188 | 226 | } catch(PDOException $e) { |
189 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
227 | + if ($globalTransaction) { |
|
228 | + $Connection->db->rollBack(); |
|
229 | + } |
|
190 | 230 | return "error : ".$e->getMessage(); |
191 | 231 | } |
192 | 232 | } |
@@ -229,11 +269,16 @@ discard block |
||
229 | 269 | $sth_dest = $Connection->db->prepare($query_dest); |
230 | 270 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
231 | 271 | try { |
232 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
272 | + if ($globalTransaction) { |
|
273 | + $Connection->db->beginTransaction(); |
|
274 | + } |
|
233 | 275 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
234 | 276 | //$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 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
236 | - else $type = null; |
|
277 | + if ($values['UserString4'] == 'M') { |
|
278 | + $type = 'military'; |
|
279 | + } else { |
|
280 | + $type = null; |
|
281 | + } |
|
237 | 282 | $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 | 283 | $sth_dest->execute($query_dest_values); |
239 | 284 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -241,7 +286,9 @@ discard block |
||
241 | 286 | $sth_dest_owner->execute($query_dest_owner_values); |
242 | 287 | } |
243 | 288 | } |
244 | - if ($globalTransaction) $Connection->db->commit(); |
|
289 | + if ($globalTransaction) { |
|
290 | + $Connection->db->commit(); |
|
291 | + } |
|
245 | 292 | } catch(PDOException $e) { |
246 | 293 | return "error : ".$e->getMessage(); |
247 | 294 | } |
@@ -278,7 +325,9 @@ discard block |
||
278 | 325 | $Connection = new Connection(); |
279 | 326 | $sth_dest = $Connection->db->prepare($query_dest); |
280 | 327 | try { |
281 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
328 | + if ($globalTransaction) { |
|
329 | + $Connection->db->beginTransaction(); |
|
330 | + } |
|
282 | 331 | while (!feof($fh)) { |
283 | 332 | $values = array(); |
284 | 333 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -289,7 +338,9 @@ discard block |
||
289 | 338 | // Check if we can find ICAO, else set it to GLID |
290 | 339 | $aircraft_name_split = explode(' ',$aircraft_name); |
291 | 340 | $search_more = ''; |
292 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
341 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
342 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
343 | + } |
|
293 | 344 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
294 | 345 | $sth_search = $Connection->db->prepare($query_search); |
295 | 346 | try { |
@@ -302,7 +353,9 @@ discard block |
||
302 | 353 | } catch(PDOException $e) { |
303 | 354 | return "error : ".$e->getMessage(); |
304 | 355 | } |
305 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
356 | + if (!isset($values['ICAOTypeCode'])) { |
|
357 | + $values['ICAOTypeCode'] = 'GLID'; |
|
358 | + } |
|
306 | 359 | // Add data to db |
307 | 360 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
308 | 361 | //$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']); |
@@ -311,7 +364,9 @@ discard block |
||
311 | 364 | $sth_dest->execute($query_dest_values); |
312 | 365 | } |
313 | 366 | } |
314 | - if ($globalTransaction) $Connection->db->commit(); |
|
367 | + if ($globalTransaction) { |
|
368 | + $Connection->db->commit(); |
|
369 | + } |
|
315 | 370 | } catch(PDOException $e) { |
316 | 371 | return "error : ".$e->getMessage(); |
317 | 372 | } |
@@ -347,7 +402,9 @@ discard block |
||
347 | 402 | $Connection = new Connection(); |
348 | 403 | $sth_dest = $Connection->db->prepare($query_dest); |
349 | 404 | try { |
350 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
405 | + if ($globalTransaction) { |
|
406 | + $Connection->db->beginTransaction(); |
|
407 | + } |
|
351 | 408 | $tmp = fgetcsv($fh,9999,',',"'"); |
352 | 409 | while (!feof($fh)) { |
353 | 410 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -361,13 +418,17 @@ discard block |
||
361 | 418 | // Check if we can find ICAO, else set it to GLID |
362 | 419 | $aircraft_name_split = explode(' ',$aircraft_name); |
363 | 420 | $search_more = ''; |
364 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
421 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
422 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
423 | + } |
|
365 | 424 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
366 | 425 | $sth_search = $Connection->db->prepare($query_search); |
367 | 426 | try { |
368 | 427 | $sth_search->execute(); |
369 | 428 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
370 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
429 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
430 | + $values['ICAOTypeCode'] = $result['icao']; |
|
431 | + } |
|
371 | 432 | } catch(PDOException $e) { |
372 | 433 | return "error : ".$e->getMessage(); |
373 | 434 | } |
@@ -380,7 +441,9 @@ discard block |
||
380 | 441 | $sth_dest->execute($query_dest_values); |
381 | 442 | } |
382 | 443 | } |
383 | - if ($globalTransaction) $Connection->db->commit(); |
|
444 | + if ($globalTransaction) { |
|
445 | + $Connection->db->commit(); |
|
446 | + } |
|
384 | 447 | } catch(PDOException $e) { |
385 | 448 | return "error : ".$e->getMessage(); |
386 | 449 | } |
@@ -419,7 +482,9 @@ discard block |
||
419 | 482 | $sth_dest = $Connection->db->prepare($query_dest); |
420 | 483 | $sth_modes = $Connection->db->prepare($query_modes); |
421 | 484 | try { |
422 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
485 | + if ($globalTransaction) { |
|
486 | + $Connection->db->beginTransaction(); |
|
487 | + } |
|
423 | 488 | $tmp = fgetcsv($fh,9999,',','"'); |
424 | 489 | while (!feof($fh)) { |
425 | 490 | $line = fgetcsv($fh,9999,',','"'); |
@@ -429,16 +494,22 @@ discard block |
||
429 | 494 | $values['registration'] = $line[0]; |
430 | 495 | $values['base'] = $line[4]; |
431 | 496 | $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])); |
|
497 | + if ($line[6] == '') { |
|
498 | + $values['date_first_reg'] = null; |
|
499 | + } else { |
|
500 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
501 | + } |
|
434 | 502 | $values['cancel'] = $line[7]; |
435 | 503 | } elseif ($country == 'EI') { |
436 | 504 | // TODO : add modeS & reg to aircraft_modes |
437 | 505 | $values['registration'] = $line[0]; |
438 | 506 | $values['base'] = $line[3]; |
439 | 507 | $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])); |
|
508 | + if ($line[1] == '') { |
|
509 | + $values['date_first_reg'] = null; |
|
510 | + } else { |
|
511 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
512 | + } |
|
442 | 513 | $values['cancel'] = ''; |
443 | 514 | $values['modes'] = $line[7]; |
444 | 515 | $values['icao'] = $line[8]; |
@@ -457,16 +528,22 @@ discard block |
||
457 | 528 | $values['registration'] = $line[3]; |
458 | 529 | $values['base'] = null; |
459 | 530 | $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])); |
|
531 | + if ($line[18] == '') { |
|
532 | + $values['date_first_reg'] = null; |
|
533 | + } else { |
|
534 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
535 | + } |
|
462 | 536 | $values['cancel'] = ''; |
463 | 537 | } elseif ($country == 'VH') { |
464 | 538 | // TODO : add modeS & reg to aircraft_modes |
465 | 539 | $values['registration'] = $line[0]; |
466 | 540 | $values['base'] = null; |
467 | 541 | $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])); |
|
542 | + if ($line[28] == '') { |
|
543 | + $values['date_first_reg'] = null; |
|
544 | + } else { |
|
545 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
546 | + } |
|
470 | 547 | |
471 | 548 | $values['cancel'] = $line[39]; |
472 | 549 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -485,29 +562,41 @@ discard block |
||
485 | 562 | $values['registration'] = $line[0]; |
486 | 563 | $values['base'] = null; |
487 | 564 | $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])); |
|
565 | + if ($line[7] == '') { |
|
566 | + $values['date_first_reg'] = null; |
|
567 | + } else { |
|
568 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
569 | + } |
|
490 | 570 | $values['cancel'] = ''; |
491 | 571 | } elseif ($country == 'PP') { |
492 | 572 | $values['registration'] = $line[0]; |
493 | 573 | $values['base'] = null; |
494 | 574 | $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])); |
|
575 | + if ($line[6] == '') { |
|
576 | + $values['date_first_reg'] = null; |
|
577 | + } else { |
|
578 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
579 | + } |
|
497 | 580 | $values['cancel'] = $line[7]; |
498 | 581 | } elseif ($country == 'E7') { |
499 | 582 | $values['registration'] = $line[0]; |
500 | 583 | $values['base'] = null; |
501 | 584 | $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])); |
|
585 | + if ($line[5] == '') { |
|
586 | + $values['date_first_reg'] = null; |
|
587 | + } else { |
|
588 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
589 | + } |
|
504 | 590 | $values['cancel'] = ''; |
505 | 591 | } elseif ($country == '8Q') { |
506 | 592 | $values['registration'] = $line[0]; |
507 | 593 | $values['base'] = null; |
508 | 594 | $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])); |
|
595 | + if ($line[7] == '') { |
|
596 | + $values['date_first_reg'] = null; |
|
597 | + } else { |
|
598 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
599 | + } |
|
511 | 600 | $values['cancel'] = ''; |
512 | 601 | } elseif ($country == 'ZK') { |
513 | 602 | $values['registration'] = $line[0]; |
@@ -552,7 +641,9 @@ discard block |
||
552 | 641 | $sth_modes->execute($query_modes_values); |
553 | 642 | } |
554 | 643 | } |
555 | - if ($globalTransaction) $Connection->db->commit(); |
|
644 | + if ($globalTransaction) { |
|
645 | + $Connection->db->commit(); |
|
646 | + } |
|
556 | 647 | } catch(PDOException $e) { |
557 | 648 | return "error : ".$e->getMessage(); |
558 | 649 | } |
@@ -688,25 +779,45 @@ discard block |
||
688 | 779 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
689 | 780 | $Connection = new Connection(); |
690 | 781 | $sth_dest = $Connection->db->prepare($query_dest); |
691 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
782 | + if ($globalTransaction) { |
|
783 | + $Connection->db->beginTransaction(); |
|
784 | + } |
|
692 | 785 | |
693 | 786 | $i = 0; |
694 | 787 | while($row = sparql_fetch_array($result)) |
695 | 788 | { |
696 | 789 | if ($i >= 1) { |
697 | 790 | //print_r($row); |
698 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
699 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
700 | - if (!isset($row['type'])) $row['type'] = ''; |
|
701 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
791 | + if (!isset($row['iata'])) { |
|
792 | + $row['iata'] = ''; |
|
793 | + } |
|
794 | + if (!isset($row['icao'])) { |
|
795 | + $row['icao'] = ''; |
|
796 | + } |
|
797 | + if (!isset($row['type'])) { |
|
798 | + $row['type'] = ''; |
|
799 | + } |
|
800 | + if (!isset($row['altitude'])) { |
|
801 | + $row['altitude'] = ''; |
|
802 | + } |
|
702 | 803 | if (isset($row['city_bis'])) { |
703 | 804 | $row['city'] = $row['city_bis']; |
704 | 805 | } |
705 | - if (!isset($row['city'])) $row['city'] = ''; |
|
706 | - if (!isset($row['country'])) $row['country'] = ''; |
|
707 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
708 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
709 | - if (!isset($row['name'])) continue; |
|
806 | + if (!isset($row['city'])) { |
|
807 | + $row['city'] = ''; |
|
808 | + } |
|
809 | + if (!isset($row['country'])) { |
|
810 | + $row['country'] = ''; |
|
811 | + } |
|
812 | + if (!isset($row['homepage'])) { |
|
813 | + $row['homepage'] = ''; |
|
814 | + } |
|
815 | + if (!isset($row['wikipedia_page'])) { |
|
816 | + $row['wikipedia_page'] = ''; |
|
817 | + } |
|
818 | + if (!isset($row['name'])) { |
|
819 | + continue; |
|
820 | + } |
|
710 | 821 | if (!isset($row['image'])) { |
711 | 822 | $row['image'] = ''; |
712 | 823 | $row['image_thumb'] = ''; |
@@ -762,7 +873,9 @@ discard block |
||
762 | 873 | |
763 | 874 | $i++; |
764 | 875 | } |
765 | - if ($globalTransaction) $Connection->db->commit(); |
|
876 | + if ($globalTransaction) { |
|
877 | + $Connection->db->commit(); |
|
878 | + } |
|
766 | 879 | /* |
767 | 880 | echo "Delete duplicate rows...\n"; |
768 | 881 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
@@ -805,7 +918,9 @@ discard block |
||
805 | 918 | $delimiter = ','; |
806 | 919 | $out_file = $tmp_dir.'airports.csv'; |
807 | 920 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
808 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
921 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
922 | + return FALSE; |
|
923 | + } |
|
809 | 924 | echo "Add data from ourairports.com...\n"; |
810 | 925 | |
811 | 926 | $header = NULL; |
@@ -815,8 +930,9 @@ discard block |
||
815 | 930 | //$Connection->db->beginTransaction(); |
816 | 931 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
817 | 932 | { |
818 | - if(!$header) $header = $row; |
|
819 | - else { |
|
933 | + if(!$header) { |
|
934 | + $header = $row; |
|
935 | + } else { |
|
820 | 936 | $data = array(); |
821 | 937 | $data = array_combine($header, $row); |
822 | 938 | try { |
@@ -857,7 +973,9 @@ discard block |
||
857 | 973 | echo "Download data from another free database...\n"; |
858 | 974 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
859 | 975 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
860 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
976 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
977 | + return FALSE; |
|
978 | + } |
|
861 | 979 | update_db::unzip($out_file); |
862 | 980 | $header = NULL; |
863 | 981 | echo "Add data from another free database...\n"; |
@@ -868,8 +986,9 @@ discard block |
||
868 | 986 | //$Connection->db->beginTransaction(); |
869 | 987 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
870 | 988 | { |
871 | - if(!$header) $header = $row; |
|
872 | - else { |
|
989 | + if(!$header) { |
|
990 | + $header = $row; |
|
991 | + } else { |
|
873 | 992 | $data = $row; |
874 | 993 | |
875 | 994 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
@@ -1038,7 +1157,9 @@ discard block |
||
1038 | 1157 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
1039 | 1158 | { |
1040 | 1159 | $i = 0; |
1041 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1160 | + if ($globalTransaction) { |
|
1161 | + $Connection->db->beginTransaction(); |
|
1162 | + } |
|
1042 | 1163 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1043 | 1164 | { |
1044 | 1165 | if ($i > 0) { |
@@ -1051,7 +1172,9 @@ discard block |
||
1051 | 1172 | } |
1052 | 1173 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
1053 | 1174 | if (!empty($result_search)) { |
1054 | - if ($globalDebug) echo '.'; |
|
1175 | + if ($globalDebug) { |
|
1176 | + echo '.'; |
|
1177 | + } |
|
1055 | 1178 | //if ($globalDBdriver == 'mysql') { |
1056 | 1179 | // $queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao'; |
1057 | 1180 | //} else { |
@@ -1073,8 +1196,12 @@ discard block |
||
1073 | 1196 | } |
1074 | 1197 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
1075 | 1198 | if (!empty($result_search_mfr)) { |
1076 | - if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23]; |
|
1077 | - if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15]; |
|
1199 | + if (trim($data[16]) == '' && trim($data[23]) != '') { |
|
1200 | + $data[16] = $data[23]; |
|
1201 | + } |
|
1202 | + if (trim($data[16]) == '' && trim($data[15]) != '') { |
|
1203 | + $data[16] = $data[15]; |
|
1204 | + } |
|
1078 | 1205 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1079 | 1206 | try { |
1080 | 1207 | $sthf = $Connection->db->prepare($queryf); |
@@ -1085,7 +1212,9 @@ discard block |
||
1085 | 1212 | } |
1086 | 1213 | } |
1087 | 1214 | if (strtotime($data[29]) > time()) { |
1088 | - if ($globalDebug) echo 'i'; |
|
1215 | + if ($globalDebug) { |
|
1216 | + echo 'i'; |
|
1217 | + } |
|
1089 | 1218 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1090 | 1219 | try { |
1091 | 1220 | $sth = $Connection->db->prepare($query); |
@@ -1096,13 +1225,19 @@ discard block |
||
1096 | 1225 | } |
1097 | 1226 | } |
1098 | 1227 | if ($i % 90 == 0) { |
1099 | - if ($globalTransaction) $Connection->db->commit(); |
|
1100 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1228 | + if ($globalTransaction) { |
|
1229 | + $Connection->db->commit(); |
|
1230 | + } |
|
1231 | + if ($globalTransaction) { |
|
1232 | + $Connection->db->beginTransaction(); |
|
1233 | + } |
|
1101 | 1234 | } |
1102 | 1235 | $i++; |
1103 | 1236 | } |
1104 | 1237 | fclose($handle); |
1105 | - if ($globalTransaction) $Connection->db->commit(); |
|
1238 | + if ($globalTransaction) { |
|
1239 | + $Connection->db->commit(); |
|
1240 | + } |
|
1106 | 1241 | } |
1107 | 1242 | //print_r($mfr); |
1108 | 1243 | return ''; |
@@ -1127,11 +1262,15 @@ discard block |
||
1127 | 1262 | $i = 0; |
1128 | 1263 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1129 | 1264 | //$Connection->db->beginTransaction(); |
1130 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1265 | + if ($globalTransaction) { |
|
1266 | + $Connection->db->beginTransaction(); |
|
1267 | + } |
|
1131 | 1268 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1132 | 1269 | { |
1133 | 1270 | if ($i > 0) { |
1134 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
1271 | + if ($data[1] == 'NULL') { |
|
1272 | + $data[1] = $data[0]; |
|
1273 | + } |
|
1135 | 1274 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1136 | 1275 | try { |
1137 | 1276 | $sth = $Connection->db->prepare($query); |
@@ -1143,7 +1282,9 @@ discard block |
||
1143 | 1282 | $i++; |
1144 | 1283 | } |
1145 | 1284 | fclose($handle); |
1146 | - if ($globalTransaction) $Connection->db->commit(); |
|
1285 | + if ($globalTransaction) { |
|
1286 | + $Connection->db->commit(); |
|
1287 | + } |
|
1147 | 1288 | } |
1148 | 1289 | return ''; |
1149 | 1290 | } |
@@ -1164,7 +1305,9 @@ discard block |
||
1164 | 1305 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
1165 | 1306 | { |
1166 | 1307 | $i = 0; |
1167 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1308 | + if ($globalTransaction) { |
|
1309 | + $Connection->db->beginTransaction(); |
|
1310 | + } |
|
1168 | 1311 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1169 | 1312 | { |
1170 | 1313 | if ($i > 0) { |
@@ -1180,7 +1323,9 @@ discard block |
||
1180 | 1323 | $i++; |
1181 | 1324 | } |
1182 | 1325 | fclose($handle); |
1183 | - if ($globalTransaction) $Connection->db->commit(); |
|
1326 | + if ($globalTransaction) { |
|
1327 | + $Connection->db->commit(); |
|
1328 | + } |
|
1184 | 1329 | } |
1185 | 1330 | return ''; |
1186 | 1331 | } |
@@ -1200,7 +1345,9 @@ discard block |
||
1200 | 1345 | if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE) |
1201 | 1346 | { |
1202 | 1347 | $i = 0; |
1203 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1348 | + if ($globalTransaction) { |
|
1349 | + $Connection->db->beginTransaction(); |
|
1350 | + } |
|
1204 | 1351 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1205 | 1352 | { |
1206 | 1353 | if ($i > 0) { |
@@ -1209,13 +1356,17 @@ discard block |
||
1209 | 1356 | $sth = $Connection->db->prepare($query); |
1210 | 1357 | $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
1211 | 1358 | } catch(PDOException $e) { |
1212 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1359 | + if ($globalDebug) { |
|
1360 | + echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1361 | + } |
|
1213 | 1362 | } |
1214 | 1363 | } |
1215 | 1364 | $i++; |
1216 | 1365 | } |
1217 | 1366 | fclose($handle); |
1218 | - if ($globalTransaction) $Connection->db->commit(); |
|
1367 | + if ($globalTransaction) { |
|
1368 | + $Connection->db->commit(); |
|
1369 | + } |
|
1219 | 1370 | } |
1220 | 1371 | return ''; |
1221 | 1372 | } |
@@ -1240,7 +1391,9 @@ discard block |
||
1240 | 1391 | $i = 0; |
1241 | 1392 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1242 | 1393 | //$Connection->db->beginTransaction(); |
1243 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1394 | + if ($globalTransaction) { |
|
1395 | + $Connection->db->beginTransaction(); |
|
1396 | + } |
|
1244 | 1397 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1245 | 1398 | { |
1246 | 1399 | if ($i > 0) { |
@@ -1256,7 +1409,9 @@ discard block |
||
1256 | 1409 | $i++; |
1257 | 1410 | } |
1258 | 1411 | fclose($handle); |
1259 | - if ($globalTransaction) $Connection->db->commit(); |
|
1412 | + if ($globalTransaction) { |
|
1413 | + $Connection->db->commit(); |
|
1414 | + } |
|
1260 | 1415 | } |
1261 | 1416 | return ''; |
1262 | 1417 | } |
@@ -1276,7 +1431,9 @@ discard block |
||
1276 | 1431 | if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE) |
1277 | 1432 | { |
1278 | 1433 | $i = 0; |
1279 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1434 | + if ($globalTransaction) { |
|
1435 | + $Connection->db->beginTransaction(); |
|
1436 | + } |
|
1280 | 1437 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1281 | 1438 | { |
1282 | 1439 | if ($i > 0) { |
@@ -1293,7 +1450,9 @@ discard block |
||
1293 | 1450 | $i++; |
1294 | 1451 | } |
1295 | 1452 | fclose($handle); |
1296 | - if ($globalTransaction) $Connection->db->commit(); |
|
1453 | + if ($globalTransaction) { |
|
1454 | + $Connection->db->commit(); |
|
1455 | + } |
|
1297 | 1456 | } |
1298 | 1457 | return ''; |
1299 | 1458 | } |
@@ -1312,7 +1471,9 @@ discard block |
||
1312 | 1471 | $Connection = new Connection(); |
1313 | 1472 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
1314 | 1473 | { |
1315 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1474 | + if ($globalTransaction) { |
|
1475 | + $Connection->db->beginTransaction(); |
|
1476 | + } |
|
1316 | 1477 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
1317 | 1478 | { |
1318 | 1479 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1327,7 +1488,9 @@ discard block |
||
1327 | 1488 | } |
1328 | 1489 | } |
1329 | 1490 | fclose($handle); |
1330 | - if ($globalTransaction) $Connection->db->commit(); |
|
1491 | + if ($globalTransaction) { |
|
1492 | + $Connection->db->commit(); |
|
1493 | + } |
|
1331 | 1494 | } |
1332 | 1495 | return ''; |
1333 | 1496 | } |
@@ -1403,9 +1566,14 @@ discard block |
||
1403 | 1566 | if ($i > 0 && $data[0] != '') { |
1404 | 1567 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1405 | 1568 | $period = str_replace(',','',$data[14]); |
1406 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1407 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1408 | - else $launch_date = NULL; |
|
1569 | + if (!empty($period) && strpos($period,'days')) { |
|
1570 | + $period = str_replace(' days','',$period)*24*60; |
|
1571 | + } |
|
1572 | + if ($data[18] != '') { |
|
1573 | + $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1574 | + } else { |
|
1575 | + $launch_date = NULL; |
|
1576 | + } |
|
1409 | 1577 | $data = array_map(function($value) { |
1410 | 1578 | return trim($value) === '' ? null : $value; |
1411 | 1579 | }, $data); |
@@ -1758,7 +1926,9 @@ discard block |
||
1758 | 1926 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1759 | 1927 | { |
1760 | 1928 | $i = 0; |
1761 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1929 | + if ($globalTransaction) { |
|
1930 | + $Connection->db->beginTransaction(); |
|
1931 | + } |
|
1762 | 1932 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1763 | 1933 | { |
1764 | 1934 | $i++; |
@@ -1786,7 +1956,9 @@ discard block |
||
1786 | 1956 | } |
1787 | 1957 | } |
1788 | 1958 | fclose($handle); |
1789 | - if ($globalTransaction) $Connection->db->commit(); |
|
1959 | + if ($globalTransaction) { |
|
1960 | + $Connection->db->commit(); |
|
1961 | + } |
|
1790 | 1962 | } |
1791 | 1963 | return ''; |
1792 | 1964 | } |
@@ -1809,7 +1981,9 @@ discard block |
||
1809 | 1981 | $Connection = new Connection(); |
1810 | 1982 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1811 | 1983 | { |
1812 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
1984 | + if ($globalTransaction) { |
|
1985 | + $Connection->db->beginTransaction(); |
|
1986 | + } |
|
1813 | 1987 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1814 | 1988 | { |
1815 | 1989 | if(count($row) > 1) { |
@@ -1823,7 +1997,9 @@ discard block |
||
1823 | 1997 | } |
1824 | 1998 | } |
1825 | 1999 | fclose($handle); |
1826 | - if ($globalTransaction) $Connection->db->commit(); |
|
2000 | + if ($globalTransaction) { |
|
2001 | + $Connection->db->commit(); |
|
2002 | + } |
|
1827 | 2003 | } |
1828 | 2004 | return ''; |
1829 | 2005 | } |
@@ -1843,8 +2019,9 @@ discard block |
||
1843 | 2019 | } |
1844 | 2020 | |
1845 | 2021 | |
1846 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1847 | - else { |
|
2022 | + if ($globalDBdriver == 'mysql') { |
|
2023 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
2024 | + } else { |
|
1848 | 2025 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
1849 | 2026 | $query = "CREATE EXTENSION postgis"; |
1850 | 2027 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -1863,20 +2040,30 @@ discard block |
||
1863 | 2040 | global $tmp_dir, $globalDebug; |
1864 | 2041 | include_once('class.create_db.php'); |
1865 | 2042 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1866 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
2043 | + if ($globalDebug) { |
|
2044 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
2045 | + } |
|
1867 | 2046 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
1868 | 2047 | $error = ''; |
1869 | 2048 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1870 | - if ($globalDebug) echo "Gunzip..."; |
|
2049 | + if ($globalDebug) { |
|
2050 | + echo "Gunzip..."; |
|
2051 | + } |
|
1871 | 2052 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
1872 | - if ($globalDebug) echo "Add to DB..."; |
|
2053 | + if ($globalDebug) { |
|
2054 | + echo "Add to DB..."; |
|
2055 | + } |
|
1873 | 2056 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
1874 | 2057 | $NOTAM = new NOTAM(); |
1875 | 2058 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
1876 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2059 | + } else { |
|
2060 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2061 | + } |
|
1877 | 2062 | if ($error != '') { |
1878 | 2063 | return $error; |
1879 | - } elseif ($globalDebug) echo "Done\n"; |
|
2064 | + } elseif ($globalDebug) { |
|
2065 | + echo "Done\n"; |
|
2066 | + } |
|
1880 | 2067 | return ''; |
1881 | 2068 | } |
1882 | 2069 | |
@@ -1930,67 +2117,111 @@ discard block |
||
1930 | 2117 | //if ($globalDebug) echo "IVAO : Download..."; |
1931 | 2118 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
1932 | 2119 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
1933 | - if ($globalDebug) echo "Unzip..."; |
|
2120 | + if ($globalDebug) { |
|
2121 | + echo "Unzip..."; |
|
2122 | + } |
|
1934 | 2123 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
1935 | - if ($globalDebug) echo "Add to DB..."; |
|
2124 | + if ($globalDebug) { |
|
2125 | + echo "Add to DB..."; |
|
2126 | + } |
|
1936 | 2127 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1937 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
2128 | + if ($globalDebug) { |
|
2129 | + echo "Copy airlines logos to airlines images directory..."; |
|
2130 | + } |
|
1938 | 2131 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1939 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1940 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
1941 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2132 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
2133 | + $error = "Failed to copy airlines logo."; |
|
2134 | + } |
|
2135 | + } else { |
|
2136 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
2137 | + } |
|
2138 | + } else { |
|
2139 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2140 | + } |
|
1942 | 2141 | if ($error != '') { |
1943 | 2142 | return $error; |
1944 | - } elseif ($globalDebug) echo "Done\n"; |
|
2143 | + } elseif ($globalDebug) { |
|
2144 | + echo "Done\n"; |
|
2145 | + } |
|
1945 | 2146 | return ''; |
1946 | 2147 | } |
1947 | 2148 | |
1948 | 2149 | public static function update_routes() { |
1949 | 2150 | global $tmp_dir, $globalDebug; |
1950 | 2151 | $error = ''; |
1951 | - if ($globalDebug) echo "Routes : Download..."; |
|
2152 | + if ($globalDebug) { |
|
2153 | + echo "Routes : Download..."; |
|
2154 | + } |
|
1952 | 2155 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
1953 | 2156 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1954 | - if ($globalDebug) echo "Gunzip..."; |
|
2157 | + if ($globalDebug) { |
|
2158 | + echo "Gunzip..."; |
|
2159 | + } |
|
1955 | 2160 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
1956 | - if ($globalDebug) echo "Add to DB..."; |
|
2161 | + if ($globalDebug) { |
|
2162 | + echo "Add to DB..."; |
|
2163 | + } |
|
1957 | 2164 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
1958 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2165 | + } else { |
|
2166 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2167 | + } |
|
1959 | 2168 | if ($error != '') { |
1960 | 2169 | return $error; |
1961 | - } elseif ($globalDebug) echo "Done\n"; |
|
2170 | + } elseif ($globalDebug) { |
|
2171 | + echo "Done\n"; |
|
2172 | + } |
|
1962 | 2173 | return ''; |
1963 | 2174 | } |
1964 | 2175 | public static function update_oneworld() { |
1965 | 2176 | global $tmp_dir, $globalDebug; |
1966 | 2177 | $error = ''; |
1967 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
2178 | + if ($globalDebug) { |
|
2179 | + echo "Schedules Oneworld : Download..."; |
|
2180 | + } |
|
1968 | 2181 | update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
1969 | 2182 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1970 | - if ($globalDebug) echo "Gunzip..."; |
|
2183 | + if ($globalDebug) { |
|
2184 | + echo "Gunzip..."; |
|
2185 | + } |
|
1971 | 2186 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
1972 | - if ($globalDebug) echo "Add to DB..."; |
|
2187 | + if ($globalDebug) { |
|
2188 | + echo "Add to DB..."; |
|
2189 | + } |
|
1973 | 2190 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
1974 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2191 | + } else { |
|
2192 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2193 | + } |
|
1975 | 2194 | if ($error != '') { |
1976 | 2195 | return $error; |
1977 | - } elseif ($globalDebug) echo "Done\n"; |
|
2196 | + } elseif ($globalDebug) { |
|
2197 | + echo "Done\n"; |
|
2198 | + } |
|
1978 | 2199 | return ''; |
1979 | 2200 | } |
1980 | 2201 | public static function update_skyteam() { |
1981 | 2202 | global $tmp_dir, $globalDebug; |
1982 | 2203 | $error = ''; |
1983 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
2204 | + if ($globalDebug) { |
|
2205 | + echo "Schedules Skyteam : Download..."; |
|
2206 | + } |
|
1984 | 2207 | update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
1985 | 2208 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1986 | - if ($globalDebug) echo "Gunzip..."; |
|
2209 | + if ($globalDebug) { |
|
2210 | + echo "Gunzip..."; |
|
2211 | + } |
|
1987 | 2212 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
1988 | - if ($globalDebug) echo "Add to DB..."; |
|
2213 | + if ($globalDebug) { |
|
2214 | + echo "Add to DB..."; |
|
2215 | + } |
|
1989 | 2216 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
1990 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2217 | + } else { |
|
2218 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2219 | + } |
|
1991 | 2220 | if ($error != '') { |
1992 | 2221 | return $error; |
1993 | - } elseif ($globalDebug) echo "Done\n"; |
|
2222 | + } elseif ($globalDebug) { |
|
2223 | + echo "Done\n"; |
|
2224 | + } |
|
1994 | 2225 | return ''; |
1995 | 2226 | } |
1996 | 2227 | public static function update_ModeS() { |
@@ -2007,355 +2238,619 @@ discard block |
||
2007 | 2238 | exit; |
2008 | 2239 | } elseif ($globalDebug) echo "Done\n"; |
2009 | 2240 | */ |
2010 | - if ($globalDebug) echo "Modes : Download..."; |
|
2011 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2241 | + if ($globalDebug) { |
|
2242 | + echo "Modes : Download..."; |
|
2243 | + } |
|
2244 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2012 | 2245 | update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
2013 | 2246 | |
2014 | 2247 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2015 | 2248 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
2016 | - if ($globalDebug) echo "Unzip..."; |
|
2017 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2249 | + if ($globalDebug) { |
|
2250 | + echo "Unzip..."; |
|
2251 | + } |
|
2252 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2018 | 2253 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
2019 | - if ($globalDebug) echo "Add to DB..."; |
|
2254 | + if ($globalDebug) { |
|
2255 | + echo "Add to DB..."; |
|
2256 | + } |
|
2020 | 2257 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
2021 | 2258 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
2022 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2259 | + } else { |
|
2260 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2261 | + } |
|
2023 | 2262 | if ($error != '') { |
2024 | 2263 | return $error; |
2025 | - } elseif ($globalDebug) echo "Done\n"; |
|
2264 | + } elseif ($globalDebug) { |
|
2265 | + echo "Done\n"; |
|
2266 | + } |
|
2026 | 2267 | return ''; |
2027 | 2268 | } |
2028 | 2269 | |
2029 | 2270 | public static function update_ModeS_faa() { |
2030 | 2271 | global $tmp_dir, $globalDebug; |
2031 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
2272 | + if ($globalDebug) { |
|
2273 | + echo "Modes FAA: Download..."; |
|
2274 | + } |
|
2032 | 2275 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
2033 | 2276 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2034 | - if ($globalDebug) echo "Unzip..."; |
|
2277 | + if ($globalDebug) { |
|
2278 | + echo "Unzip..."; |
|
2279 | + } |
|
2035 | 2280 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
2036 | - if ($globalDebug) echo "Add to DB..."; |
|
2281 | + if ($globalDebug) { |
|
2282 | + echo "Add to DB..."; |
|
2283 | + } |
|
2037 | 2284 | $error = update_db::modes_faa(); |
2038 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2285 | + } else { |
|
2286 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2287 | + } |
|
2039 | 2288 | if ($error != '') { |
2040 | 2289 | return $error; |
2041 | - } elseif ($globalDebug) echo "Done\n"; |
|
2290 | + } elseif ($globalDebug) { |
|
2291 | + echo "Done\n"; |
|
2292 | + } |
|
2042 | 2293 | return ''; |
2043 | 2294 | } |
2044 | 2295 | |
2045 | 2296 | public static function update_ModeS_flarm() { |
2046 | 2297 | global $tmp_dir, $globalDebug; |
2047 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
2298 | + if ($globalDebug) { |
|
2299 | + echo "Modes Flarmnet: Download..."; |
|
2300 | + } |
|
2048 | 2301 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
2049 | 2302 | if (file_exists($tmp_dir.'data.fln')) { |
2050 | - if ($globalDebug) echo "Add to DB..."; |
|
2303 | + if ($globalDebug) { |
|
2304 | + echo "Add to DB..."; |
|
2305 | + } |
|
2051 | 2306 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
2052 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2307 | + } else { |
|
2308 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2309 | + } |
|
2053 | 2310 | if ($error != '') { |
2054 | 2311 | return $error; |
2055 | - } elseif ($globalDebug) echo "Done\n"; |
|
2312 | + } elseif ($globalDebug) { |
|
2313 | + echo "Done\n"; |
|
2314 | + } |
|
2056 | 2315 | return ''; |
2057 | 2316 | } |
2058 | 2317 | |
2059 | 2318 | public static function update_ModeS_ogn() { |
2060 | 2319 | global $tmp_dir, $globalDebug; |
2061 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
2320 | + if ($globalDebug) { |
|
2321 | + echo "Modes OGN: Download..."; |
|
2322 | + } |
|
2062 | 2323 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
2063 | 2324 | if (file_exists($tmp_dir.'ogn.csv')) { |
2064 | - if ($globalDebug) echo "Add to DB..."; |
|
2325 | + if ($globalDebug) { |
|
2326 | + echo "Add to DB..."; |
|
2327 | + } |
|
2065 | 2328 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
2066 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2329 | + } else { |
|
2330 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2331 | + } |
|
2067 | 2332 | if ($error != '') { |
2068 | 2333 | return $error; |
2069 | - } elseif ($globalDebug) echo "Done\n"; |
|
2334 | + } elseif ($globalDebug) { |
|
2335 | + echo "Done\n"; |
|
2336 | + } |
|
2070 | 2337 | return ''; |
2071 | 2338 | } |
2072 | 2339 | |
2073 | 2340 | public static function update_owner() { |
2074 | 2341 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2075 | 2342 | |
2076 | - if ($globalDebug) echo "Owner France: Download..."; |
|
2343 | + if ($globalDebug) { |
|
2344 | + echo "Owner France: Download..."; |
|
2345 | + } |
|
2077 | 2346 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
2078 | 2347 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2079 | - if ($globalDebug) echo "Add to DB..."; |
|
2348 | + if ($globalDebug) { |
|
2349 | + echo "Add to DB..."; |
|
2350 | + } |
|
2080 | 2351 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
2081 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2352 | + } else { |
|
2353 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2354 | + } |
|
2082 | 2355 | if ($error != '') { |
2083 | 2356 | return $error; |
2084 | - } elseif ($globalDebug) echo "Done\n"; |
|
2357 | + } elseif ($globalDebug) { |
|
2358 | + echo "Done\n"; |
|
2359 | + } |
|
2085 | 2360 | |
2086 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
2361 | + if ($globalDebug) { |
|
2362 | + echo "Owner Ireland: Download..."; |
|
2363 | + } |
|
2087 | 2364 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
2088 | 2365 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2089 | - if ($globalDebug) echo "Add to DB..."; |
|
2366 | + if ($globalDebug) { |
|
2367 | + echo "Add to DB..."; |
|
2368 | + } |
|
2090 | 2369 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
2091 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2370 | + } else { |
|
2371 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2372 | + } |
|
2092 | 2373 | if ($error != '') { |
2093 | 2374 | return $error; |
2094 | - } elseif ($globalDebug) echo "Done\n"; |
|
2095 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
2375 | + } elseif ($globalDebug) { |
|
2376 | + echo "Done\n"; |
|
2377 | + } |
|
2378 | + if ($globalDebug) { |
|
2379 | + echo "Owner Switzerland: Download..."; |
|
2380 | + } |
|
2096 | 2381 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
2097 | 2382 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2098 | - if ($globalDebug) echo "Add to DB..."; |
|
2383 | + if ($globalDebug) { |
|
2384 | + echo "Add to DB..."; |
|
2385 | + } |
|
2099 | 2386 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
2100 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2387 | + } else { |
|
2388 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2389 | + } |
|
2101 | 2390 | if ($error != '') { |
2102 | 2391 | return $error; |
2103 | - } elseif ($globalDebug) echo "Done\n"; |
|
2104 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
2392 | + } elseif ($globalDebug) { |
|
2393 | + echo "Done\n"; |
|
2394 | + } |
|
2395 | + if ($globalDebug) { |
|
2396 | + echo "Owner Czech Republic: Download..."; |
|
2397 | + } |
|
2105 | 2398 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
2106 | 2399 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2107 | - if ($globalDebug) echo "Add to DB..."; |
|
2400 | + if ($globalDebug) { |
|
2401 | + echo "Add to DB..."; |
|
2402 | + } |
|
2108 | 2403 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
2109 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2404 | + } else { |
|
2405 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2406 | + } |
|
2110 | 2407 | if ($error != '') { |
2111 | 2408 | return $error; |
2112 | - } elseif ($globalDebug) echo "Done\n"; |
|
2113 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
2409 | + } elseif ($globalDebug) { |
|
2410 | + echo "Done\n"; |
|
2411 | + } |
|
2412 | + if ($globalDebug) { |
|
2413 | + echo "Owner Australia: Download..."; |
|
2414 | + } |
|
2114 | 2415 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
2115 | 2416 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2116 | - if ($globalDebug) echo "Add to DB..."; |
|
2417 | + if ($globalDebug) { |
|
2418 | + echo "Add to DB..."; |
|
2419 | + } |
|
2117 | 2420 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
2118 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2421 | + } else { |
|
2422 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2423 | + } |
|
2119 | 2424 | if ($error != '') { |
2120 | 2425 | return $error; |
2121 | - } elseif ($globalDebug) echo "Done\n"; |
|
2122 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
2426 | + } elseif ($globalDebug) { |
|
2427 | + echo "Done\n"; |
|
2428 | + } |
|
2429 | + if ($globalDebug) { |
|
2430 | + echo "Owner Austria: Download..."; |
|
2431 | + } |
|
2123 | 2432 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
2124 | 2433 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2125 | - if ($globalDebug) echo "Add to DB..."; |
|
2434 | + if ($globalDebug) { |
|
2435 | + echo "Add to DB..."; |
|
2436 | + } |
|
2126 | 2437 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
2127 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2438 | + } else { |
|
2439 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2440 | + } |
|
2128 | 2441 | if ($error != '') { |
2129 | 2442 | return $error; |
2130 | - } elseif ($globalDebug) echo "Done\n"; |
|
2131 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
2443 | + } elseif ($globalDebug) { |
|
2444 | + echo "Done\n"; |
|
2445 | + } |
|
2446 | + if ($globalDebug) { |
|
2447 | + echo "Owner Chile: Download..."; |
|
2448 | + } |
|
2132 | 2449 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
2133 | 2450 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2134 | - if ($globalDebug) echo "Add to DB..."; |
|
2451 | + if ($globalDebug) { |
|
2452 | + echo "Add to DB..."; |
|
2453 | + } |
|
2135 | 2454 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
2136 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2455 | + } else { |
|
2456 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2457 | + } |
|
2137 | 2458 | if ($error != '') { |
2138 | 2459 | return $error; |
2139 | - } elseif ($globalDebug) echo "Done\n"; |
|
2140 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
2460 | + } elseif ($globalDebug) { |
|
2461 | + echo "Done\n"; |
|
2462 | + } |
|
2463 | + if ($globalDebug) { |
|
2464 | + echo "Owner Colombia: Download..."; |
|
2465 | + } |
|
2141 | 2466 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
2142 | 2467 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2143 | - if ($globalDebug) echo "Add to DB..."; |
|
2468 | + if ($globalDebug) { |
|
2469 | + echo "Add to DB..."; |
|
2470 | + } |
|
2144 | 2471 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
2145 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2472 | + } else { |
|
2473 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2474 | + } |
|
2146 | 2475 | if ($error != '') { |
2147 | 2476 | return $error; |
2148 | - } elseif ($globalDebug) echo "Done\n"; |
|
2149 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
2477 | + } elseif ($globalDebug) { |
|
2478 | + echo "Done\n"; |
|
2479 | + } |
|
2480 | + if ($globalDebug) { |
|
2481 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
2482 | + } |
|
2150 | 2483 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
2151 | 2484 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2152 | - if ($globalDebug) echo "Add to DB..."; |
|
2485 | + if ($globalDebug) { |
|
2486 | + echo "Add to DB..."; |
|
2487 | + } |
|
2153 | 2488 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
2154 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2489 | + } else { |
|
2490 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2491 | + } |
|
2155 | 2492 | if ($error != '') { |
2156 | 2493 | return $error; |
2157 | - } elseif ($globalDebug) echo "Done\n"; |
|
2158 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
2494 | + } elseif ($globalDebug) { |
|
2495 | + echo "Done\n"; |
|
2496 | + } |
|
2497 | + if ($globalDebug) { |
|
2498 | + echo "Owner Brazil: Download..."; |
|
2499 | + } |
|
2159 | 2500 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
2160 | 2501 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2161 | - if ($globalDebug) echo "Add to DB..."; |
|
2502 | + if ($globalDebug) { |
|
2503 | + echo "Add to DB..."; |
|
2504 | + } |
|
2162 | 2505 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
2163 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2506 | + } else { |
|
2507 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2508 | + } |
|
2164 | 2509 | if ($error != '') { |
2165 | 2510 | return $error; |
2166 | - } elseif ($globalDebug) echo "Done\n"; |
|
2167 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
2511 | + } elseif ($globalDebug) { |
|
2512 | + echo "Done\n"; |
|
2513 | + } |
|
2514 | + if ($globalDebug) { |
|
2515 | + echo "Owner Cayman Islands: Download..."; |
|
2516 | + } |
|
2168 | 2517 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
2169 | 2518 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2170 | - if ($globalDebug) echo "Add to DB..."; |
|
2519 | + if ($globalDebug) { |
|
2520 | + echo "Add to DB..."; |
|
2521 | + } |
|
2171 | 2522 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
2172 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2523 | + } else { |
|
2524 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2525 | + } |
|
2173 | 2526 | if ($error != '') { |
2174 | 2527 | return $error; |
2175 | - } elseif ($globalDebug) echo "Done\n"; |
|
2176 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
2528 | + } elseif ($globalDebug) { |
|
2529 | + echo "Done\n"; |
|
2530 | + } |
|
2531 | + if ($globalDebug) { |
|
2532 | + echo "Owner Croatia: Download..."; |
|
2533 | + } |
|
2177 | 2534 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
2178 | 2535 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2179 | - if ($globalDebug) echo "Add to DB..."; |
|
2536 | + if ($globalDebug) { |
|
2537 | + echo "Add to DB..."; |
|
2538 | + } |
|
2180 | 2539 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
2181 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2540 | + } else { |
|
2541 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2542 | + } |
|
2182 | 2543 | if ($error != '') { |
2183 | 2544 | return $error; |
2184 | - } elseif ($globalDebug) echo "Done\n"; |
|
2185 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
2545 | + } elseif ($globalDebug) { |
|
2546 | + echo "Done\n"; |
|
2547 | + } |
|
2548 | + if ($globalDebug) { |
|
2549 | + echo "Owner Luxembourg: Download..."; |
|
2550 | + } |
|
2186 | 2551 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
2187 | 2552 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2188 | - if ($globalDebug) echo "Add to DB..."; |
|
2553 | + if ($globalDebug) { |
|
2554 | + echo "Add to DB..."; |
|
2555 | + } |
|
2189 | 2556 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
2190 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2557 | + } else { |
|
2558 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2559 | + } |
|
2191 | 2560 | if ($error != '') { |
2192 | 2561 | return $error; |
2193 | - } elseif ($globalDebug) echo "Done\n"; |
|
2194 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
2562 | + } elseif ($globalDebug) { |
|
2563 | + echo "Done\n"; |
|
2564 | + } |
|
2565 | + if ($globalDebug) { |
|
2566 | + echo "Owner Maldives: Download..."; |
|
2567 | + } |
|
2195 | 2568 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
2196 | 2569 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2197 | - if ($globalDebug) echo "Add to DB..."; |
|
2570 | + if ($globalDebug) { |
|
2571 | + echo "Add to DB..."; |
|
2572 | + } |
|
2198 | 2573 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
2199 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2574 | + } else { |
|
2575 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2576 | + } |
|
2200 | 2577 | if ($error != '') { |
2201 | 2578 | return $error; |
2202 | - } elseif ($globalDebug) echo "Done\n"; |
|
2203 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
2579 | + } elseif ($globalDebug) { |
|
2580 | + echo "Done\n"; |
|
2581 | + } |
|
2582 | + if ($globalDebug) { |
|
2583 | + echo "Owner New Zealand: Download..."; |
|
2584 | + } |
|
2204 | 2585 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
2205 | 2586 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2206 | - if ($globalDebug) echo "Add to DB..."; |
|
2587 | + if ($globalDebug) { |
|
2588 | + echo "Add to DB..."; |
|
2589 | + } |
|
2207 | 2590 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
2208 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2591 | + } else { |
|
2592 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2593 | + } |
|
2209 | 2594 | if ($error != '') { |
2210 | 2595 | return $error; |
2211 | - } elseif ($globalDebug) echo "Done\n"; |
|
2212 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
2596 | + } elseif ($globalDebug) { |
|
2597 | + echo "Done\n"; |
|
2598 | + } |
|
2599 | + if ($globalDebug) { |
|
2600 | + echo "Owner Papua New Guinea: Download..."; |
|
2601 | + } |
|
2213 | 2602 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
2214 | 2603 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2215 | - if ($globalDebug) echo "Add to DB..."; |
|
2604 | + if ($globalDebug) { |
|
2605 | + echo "Add to DB..."; |
|
2606 | + } |
|
2216 | 2607 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
2217 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2608 | + } else { |
|
2609 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2610 | + } |
|
2218 | 2611 | if ($error != '') { |
2219 | 2612 | return $error; |
2220 | - } elseif ($globalDebug) echo "Done\n"; |
|
2221 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
2613 | + } elseif ($globalDebug) { |
|
2614 | + echo "Done\n"; |
|
2615 | + } |
|
2616 | + if ($globalDebug) { |
|
2617 | + echo "Owner Slovakia: Download..."; |
|
2618 | + } |
|
2222 | 2619 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
2223 | 2620 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2224 | - if ($globalDebug) echo "Add to DB..."; |
|
2621 | + if ($globalDebug) { |
|
2622 | + echo "Add to DB..."; |
|
2623 | + } |
|
2225 | 2624 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
2226 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2625 | + } else { |
|
2626 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2627 | + } |
|
2227 | 2628 | if ($error != '') { |
2228 | 2629 | return $error; |
2229 | - } elseif ($globalDebug) echo "Done\n"; |
|
2230 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
2630 | + } elseif ($globalDebug) { |
|
2631 | + echo "Done\n"; |
|
2632 | + } |
|
2633 | + if ($globalDebug) { |
|
2634 | + echo "Owner Ecuador: Download..."; |
|
2635 | + } |
|
2231 | 2636 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
2232 | 2637 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2233 | - if ($globalDebug) echo "Add to DB..."; |
|
2638 | + if ($globalDebug) { |
|
2639 | + echo "Add to DB..."; |
|
2640 | + } |
|
2234 | 2641 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
2235 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2642 | + } else { |
|
2643 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2644 | + } |
|
2236 | 2645 | if ($error != '') { |
2237 | 2646 | return $error; |
2238 | - } elseif ($globalDebug) echo "Done\n"; |
|
2239 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
2647 | + } elseif ($globalDebug) { |
|
2648 | + echo "Done\n"; |
|
2649 | + } |
|
2650 | + if ($globalDebug) { |
|
2651 | + echo "Owner Iceland: Download..."; |
|
2652 | + } |
|
2240 | 2653 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
2241 | 2654 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2242 | - if ($globalDebug) echo "Add to DB..."; |
|
2655 | + if ($globalDebug) { |
|
2656 | + echo "Add to DB..."; |
|
2657 | + } |
|
2243 | 2658 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
2244 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2659 | + } else { |
|
2660 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2661 | + } |
|
2245 | 2662 | if ($error != '') { |
2246 | 2663 | return $error; |
2247 | - } elseif ($globalDebug) echo "Done\n"; |
|
2248 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
2664 | + } elseif ($globalDebug) { |
|
2665 | + echo "Done\n"; |
|
2666 | + } |
|
2667 | + if ($globalDebug) { |
|
2668 | + echo "Owner Isle of Man: Download..."; |
|
2669 | + } |
|
2249 | 2670 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
2250 | 2671 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2251 | - if ($globalDebug) echo "Add to DB..."; |
|
2672 | + if ($globalDebug) { |
|
2673 | + echo "Add to DB..."; |
|
2674 | + } |
|
2252 | 2675 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
2253 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2676 | + } else { |
|
2677 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2678 | + } |
|
2254 | 2679 | if ($error != '') { |
2255 | 2680 | return $error; |
2256 | - } elseif ($globalDebug) echo "Done\n"; |
|
2681 | + } elseif ($globalDebug) { |
|
2682 | + echo "Done\n"; |
|
2683 | + } |
|
2257 | 2684 | if ($globalMasterSource) { |
2258 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
2685 | + if ($globalDebug) { |
|
2686 | + echo "ModeS Netherlands: Download..."; |
|
2687 | + } |
|
2259 | 2688 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
2260 | 2689 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2261 | - if ($globalDebug) echo "Add to DB..."; |
|
2690 | + if ($globalDebug) { |
|
2691 | + echo "Add to DB..."; |
|
2692 | + } |
|
2262 | 2693 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
2263 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2694 | + } else { |
|
2695 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2696 | + } |
|
2264 | 2697 | if ($error != '') { |
2265 | 2698 | return $error; |
2266 | - } elseif ($globalDebug) echo "Done\n"; |
|
2267 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
2699 | + } elseif ($globalDebug) { |
|
2700 | + echo "Done\n"; |
|
2701 | + } |
|
2702 | + if ($globalDebug) { |
|
2703 | + echo "ModeS Denmark: Download..."; |
|
2704 | + } |
|
2268 | 2705 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
2269 | 2706 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2270 | - if ($globalDebug) echo "Add to DB..."; |
|
2707 | + if ($globalDebug) { |
|
2708 | + echo "Add to DB..."; |
|
2709 | + } |
|
2271 | 2710 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
2272 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2711 | + } else { |
|
2712 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2713 | + } |
|
2273 | 2714 | if ($error != '') { |
2274 | 2715 | return $error; |
2275 | - } elseif ($globalDebug) echo "Done\n"; |
|
2276 | - } elseif ($globalDebug) echo "Done\n"; |
|
2716 | + } elseif ($globalDebug) { |
|
2717 | + echo "Done\n"; |
|
2718 | + } |
|
2719 | + } elseif ($globalDebug) { |
|
2720 | + echo "Done\n"; |
|
2721 | + } |
|
2277 | 2722 | return ''; |
2278 | 2723 | } |
2279 | 2724 | |
2280 | 2725 | public static function update_translation() { |
2281 | 2726 | global $tmp_dir, $globalDebug; |
2282 | 2727 | $error = ''; |
2283 | - if ($globalDebug) echo "Translation : Download..."; |
|
2728 | + if ($globalDebug) { |
|
2729 | + echo "Translation : Download..."; |
|
2730 | + } |
|
2284 | 2731 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
2285 | 2732 | if (file_exists($tmp_dir.'translation.zip')) { |
2286 | - if ($globalDebug) echo "Unzip..."; |
|
2733 | + if ($globalDebug) { |
|
2734 | + echo "Unzip..."; |
|
2735 | + } |
|
2287 | 2736 | update_db::unzip($tmp_dir.'translation.zip'); |
2288 | - if ($globalDebug) echo "Add to DB..."; |
|
2737 | + if ($globalDebug) { |
|
2738 | + echo "Add to DB..."; |
|
2739 | + } |
|
2289 | 2740 | $error = update_db::translation(); |
2290 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2741 | + } else { |
|
2742 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2743 | + } |
|
2291 | 2744 | if ($error != '') { |
2292 | 2745 | return $error; |
2293 | - } elseif ($globalDebug) echo "Done\n"; |
|
2746 | + } elseif ($globalDebug) { |
|
2747 | + echo "Done\n"; |
|
2748 | + } |
|
2294 | 2749 | return ''; |
2295 | 2750 | } |
2296 | 2751 | |
2297 | 2752 | public static function update_translation_fam() { |
2298 | 2753 | global $tmp_dir, $globalDebug; |
2299 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
2754 | + if ($globalDebug) { |
|
2755 | + echo "Translation from FlightAirMap website : Download..."; |
|
2756 | + } |
|
2300 | 2757 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
2301 | 2758 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
2302 | - if ($globalDebug) echo "Gunzip..."; |
|
2759 | + if ($globalDebug) { |
|
2760 | + echo "Gunzip..."; |
|
2761 | + } |
|
2303 | 2762 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
2304 | - if ($globalDebug) echo "Add to DB..."; |
|
2763 | + if ($globalDebug) { |
|
2764 | + echo "Add to DB..."; |
|
2765 | + } |
|
2305 | 2766 | $error = update_db::translation_fam(); |
2306 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2767 | + } else { |
|
2768 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2769 | + } |
|
2307 | 2770 | if ($error != '') { |
2308 | 2771 | return $error; |
2309 | - } elseif ($globalDebug) echo "Done\n"; |
|
2772 | + } elseif ($globalDebug) { |
|
2773 | + echo "Done\n"; |
|
2774 | + } |
|
2310 | 2775 | return ''; |
2311 | 2776 | } |
2312 | 2777 | public static function update_ModeS_fam() { |
2313 | 2778 | global $tmp_dir, $globalDebug; |
2314 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
2779 | + if ($globalDebug) { |
|
2780 | + echo "ModeS from FlightAirMap website : Download..."; |
|
2781 | + } |
|
2315 | 2782 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
2316 | 2783 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
2317 | - if ($globalDebug) echo "Gunzip..."; |
|
2784 | + if ($globalDebug) { |
|
2785 | + echo "Gunzip..."; |
|
2786 | + } |
|
2318 | 2787 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
2319 | - if ($globalDebug) echo "Add to DB..."; |
|
2788 | + if ($globalDebug) { |
|
2789 | + echo "Add to DB..."; |
|
2790 | + } |
|
2320 | 2791 | $error = update_db::modes_fam(); |
2321 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2792 | + } else { |
|
2793 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2794 | + } |
|
2322 | 2795 | if ($error != '') { |
2323 | 2796 | return $error; |
2324 | - } elseif ($globalDebug) echo "Done\n"; |
|
2797 | + } elseif ($globalDebug) { |
|
2798 | + echo "Done\n"; |
|
2799 | + } |
|
2325 | 2800 | return ''; |
2326 | 2801 | } |
2327 | 2802 | public static function update_owner_fam() { |
2328 | 2803 | global $tmp_dir, $globalDebug, $globalOwner; |
2329 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
2804 | + if ($globalDebug) { |
|
2805 | + echo "owner from FlightAirMap website : Download..."; |
|
2806 | + } |
|
2330 | 2807 | if ($globalOwner === TRUE) { |
2331 | 2808 | update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
2332 | 2809 | } else { |
2333 | 2810 | update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
2334 | 2811 | } |
2335 | 2812 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
2336 | - if ($globalDebug) echo "Gunzip..."; |
|
2813 | + if ($globalDebug) { |
|
2814 | + echo "Gunzip..."; |
|
2815 | + } |
|
2337 | 2816 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
2338 | - if ($globalDebug) echo "Add to DB..."; |
|
2817 | + if ($globalDebug) { |
|
2818 | + echo "Add to DB..."; |
|
2819 | + } |
|
2339 | 2820 | $error = update_db::owner_fam(); |
2340 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
2821 | + } else { |
|
2822 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
2823 | + } |
|
2341 | 2824 | if ($error != '') { |
2342 | 2825 | return $error; |
2343 | - } elseif ($globalDebug) echo "Done\n"; |
|
2826 | + } elseif ($globalDebug) { |
|
2827 | + echo "Done\n"; |
|
2828 | + } |
|
2344 | 2829 | return ''; |
2345 | 2830 | } |
2346 | 2831 | public static function update_routes_fam() { |
2347 | 2832 | global $tmp_dir, $globalDebug; |
2348 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
2833 | + if ($globalDebug) { |
|
2834 | + echo "Routes from FlightAirMap website : Download..."; |
|
2835 | + } |
|
2349 | 2836 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
2350 | 2837 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2351 | - if ($globalDebug) echo "Gunzip..."; |
|
2838 | + if ($globalDebug) { |
|
2839 | + echo "Gunzip..."; |
|
2840 | + } |
|
2352 | 2841 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
2353 | - if ($globalDebug) echo "Add to DB..."; |
|
2842 | + if ($globalDebug) { |
|
2843 | + echo "Add to DB..."; |
|
2844 | + } |
|
2354 | 2845 | $error = update_db::routes_fam(); |
2355 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
2846 | + } else { |
|
2847 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
2848 | + } |
|
2356 | 2849 | if ($error != '') { |
2357 | 2850 | return $error; |
2358 | - } elseif ($globalDebug) echo "Done\n"; |
|
2851 | + } elseif ($globalDebug) { |
|
2852 | + echo "Done\n"; |
|
2853 | + } |
|
2359 | 2854 | return ''; |
2360 | 2855 | } |
2361 | 2856 | public static function update_marine_identity_fam() { |
@@ -2365,14 +2860,22 @@ discard block |
||
2365 | 2860 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
2366 | 2861 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2367 | 2862 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2368 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
2863 | + if ($globalDebug) { |
|
2864 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
2865 | + } |
|
2369 | 2866 | update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
2370 | 2867 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2371 | - if ($globalDebug) echo "Gunzip..."; |
|
2868 | + if ($globalDebug) { |
|
2869 | + echo "Gunzip..."; |
|
2870 | + } |
|
2372 | 2871 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
2373 | - if ($globalDebug) echo "Add to DB..."; |
|
2872 | + if ($globalDebug) { |
|
2873 | + echo "Add to DB..."; |
|
2874 | + } |
|
2374 | 2875 | $error = update_db::marine_identity_fam(); |
2375 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
2876 | + } else { |
|
2877 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
2878 | + } |
|
2376 | 2879 | if ($error != '') { |
2377 | 2880 | return $error; |
2378 | 2881 | } elseif ($globalDebug) { |
@@ -2391,14 +2894,22 @@ discard block |
||
2391 | 2894 | $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
2392 | 2895 | $satellite_md5 = $satellite_md5_file[0]; |
2393 | 2896 | if (!update_db::check_satellite_version($satellite_md5)) { |
2394 | - if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
|
2897 | + if ($globalDebug) { |
|
2898 | + echo "Satellite from FlightAirMap website : Download..."; |
|
2899 | + } |
|
2395 | 2900 | update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
2396 | 2901 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2397 | - if ($globalDebug) echo "Gunzip..."; |
|
2902 | + if ($globalDebug) { |
|
2903 | + echo "Gunzip..."; |
|
2904 | + } |
|
2398 | 2905 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
2399 | - if ($globalDebug) echo "Add to DB..."; |
|
2906 | + if ($globalDebug) { |
|
2907 | + echo "Add to DB..."; |
|
2908 | + } |
|
2400 | 2909 | $error = update_db::satellite_fam(); |
2401 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
2910 | + } else { |
|
2911 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
2912 | + } |
|
2402 | 2913 | if ($error != '') { |
2403 | 2914 | return $error; |
2404 | 2915 | } elseif ($globalDebug) { |
@@ -2411,17 +2922,25 @@ discard block |
||
2411 | 2922 | } |
2412 | 2923 | public static function update_banned_fam() { |
2413 | 2924 | global $tmp_dir, $globalDebug; |
2414 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2925 | + if ($globalDebug) { |
|
2926 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
2927 | + } |
|
2415 | 2928 | update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
2416 | 2929 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2417 | 2930 | //if ($globalDebug) echo "Gunzip..."; |
2418 | 2931 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
2419 | - if ($globalDebug) echo "Add to DB..."; |
|
2932 | + if ($globalDebug) { |
|
2933 | + echo "Add to DB..."; |
|
2934 | + } |
|
2420 | 2935 | $error = update_db::banned_fam(); |
2421 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
2936 | + } else { |
|
2937 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
2938 | + } |
|
2422 | 2939 | if ($error != '') { |
2423 | 2940 | return $error; |
2424 | - } elseif ($globalDebug) echo "Done\n"; |
|
2941 | + } elseif ($globalDebug) { |
|
2942 | + echo "Done\n"; |
|
2943 | + } |
|
2425 | 2944 | return ''; |
2426 | 2945 | } |
2427 | 2946 | |
@@ -2429,7 +2948,9 @@ discard block |
||
2429 | 2948 | global $tmp_dir, $globalDebug, $globalDBdriver; |
2430 | 2949 | include_once('class.create_db.php'); |
2431 | 2950 | $error = ''; |
2432 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
2951 | + if ($globalDebug) { |
|
2952 | + echo "Airspace from FlightAirMap website : Download..."; |
|
2953 | + } |
|
2433 | 2954 | if ($globalDBdriver == 'mysql') { |
2434 | 2955 | update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
2435 | 2956 | } else { |
@@ -2445,9 +2966,13 @@ discard block |
||
2445 | 2966 | update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
2446 | 2967 | } |
2447 | 2968 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2448 | - if ($globalDebug) echo "Gunzip..."; |
|
2969 | + if ($globalDebug) { |
|
2970 | + echo "Gunzip..."; |
|
2971 | + } |
|
2449 | 2972 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
2450 | - if ($globalDebug) echo "Add to DB..."; |
|
2973 | + if ($globalDebug) { |
|
2974 | + echo "Add to DB..."; |
|
2975 | + } |
|
2451 | 2976 | $Connection = new Connection(); |
2452 | 2977 | if ($Connection->tableExists('airspace')) { |
2453 | 2978 | $query = 'DROP TABLE airspace'; |
@@ -2460,19 +2985,27 @@ discard block |
||
2460 | 2985 | } |
2461 | 2986 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2462 | 2987 | update_db::insert_airspace_version($airspace_md5); |
2463 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
2988 | + } else { |
|
2989 | + $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
2990 | + } |
|
2464 | 2991 | } |
2465 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
2992 | + } else { |
|
2993 | + $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
2994 | + } |
|
2466 | 2995 | if ($error != '') { |
2467 | 2996 | return $error; |
2468 | - } elseif ($globalDebug) echo "Done\n"; |
|
2997 | + } elseif ($globalDebug) { |
|
2998 | + echo "Done\n"; |
|
2999 | + } |
|
2469 | 3000 | return ''; |
2470 | 3001 | } |
2471 | 3002 | |
2472 | 3003 | public static function update_geoid_fam() { |
2473 | 3004 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2474 | 3005 | $error = ''; |
2475 | - if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
3006 | + if ($globalDebug) { |
|
3007 | + echo "Geoid from FlightAirMap website : Download..."; |
|
3008 | + } |
|
2476 | 3009 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
2477 | 3010 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2478 | 3011 | $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
@@ -2480,75 +3013,113 @@ discard block |
||
2480 | 3013 | if (!update_db::check_geoid_version($geoid_md5)) { |
2481 | 3014 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
2482 | 3015 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2483 | - if ($globalDebug) echo "Gunzip..."; |
|
3016 | + if ($globalDebug) { |
|
3017 | + echo "Gunzip..."; |
|
3018 | + } |
|
2484 | 3019 | update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
2485 | 3020 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2486 | 3021 | update_db::insert_geoid_version($geoid_md5); |
2487 | 3022 | } |
2488 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
3023 | + } else { |
|
3024 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
3025 | + } |
|
2489 | 3026 | } |
2490 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3027 | + } else { |
|
3028 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3029 | + } |
|
2491 | 3030 | if ($error != '') { |
2492 | 3031 | return $error; |
2493 | - } elseif ($globalDebug) echo "Done\n"; |
|
3032 | + } elseif ($globalDebug) { |
|
3033 | + echo "Done\n"; |
|
3034 | + } |
|
2494 | 3035 | return ''; |
2495 | 3036 | } |
2496 | 3037 | |
2497 | 3038 | public static function update_tle() { |
2498 | 3039 | global $tmp_dir, $globalDebug; |
2499 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
3040 | + if ($globalDebug) { |
|
3041 | + echo "Download TLE : Download..."; |
|
3042 | + } |
|
2500 | 3043 | $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
2501 | 3044 | 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
2502 | 3045 | 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
2503 | 3046 | foreach ($alltle as $filename) { |
2504 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
3047 | + if ($globalDebug) { |
|
3048 | + echo "downloading ".$filename.'...'; |
|
3049 | + } |
|
2505 | 3050 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
2506 | 3051 | if (file_exists($tmp_dir.$filename)) { |
2507 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
3052 | + if ($globalDebug) { |
|
3053 | + echo "Add to DB ".$filename."..."; |
|
3054 | + } |
|
2508 | 3055 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
2509 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3056 | + } else { |
|
3057 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3058 | + } |
|
2510 | 3059 | if ($error != '') { |
2511 | 3060 | echo $error."\n"; |
2512 | - } elseif ($globalDebug) echo "Done\n"; |
|
3061 | + } elseif ($globalDebug) { |
|
3062 | + echo "Done\n"; |
|
3063 | + } |
|
2513 | 3064 | } |
2514 | 3065 | return ''; |
2515 | 3066 | } |
2516 | 3067 | |
2517 | 3068 | public static function update_ucsdb() { |
2518 | 3069 | global $tmp_dir, $globalDebug; |
2519 | - if ($globalDebug) echo "Download UCS DB : Download..."; |
|
3070 | + if ($globalDebug) { |
|
3071 | + echo "Download UCS DB : Download..."; |
|
3072 | + } |
|
2520 | 3073 | update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
2521 | 3074 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2522 | - if ($globalDebug) echo "Add to DB..."; |
|
3075 | + if ($globalDebug) { |
|
3076 | + echo "Add to DB..."; |
|
3077 | + } |
|
2523 | 3078 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
2524 | - } else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
3079 | + } else { |
|
3080 | + $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
3081 | + } |
|
2525 | 3082 | if ($error != '') { |
2526 | 3083 | echo $error."\n"; |
2527 | - } elseif ($globalDebug) echo "Done\n"; |
|
3084 | + } elseif ($globalDebug) { |
|
3085 | + echo "Done\n"; |
|
3086 | + } |
|
2528 | 3087 | return ''; |
2529 | 3088 | } |
2530 | 3089 | |
2531 | 3090 | public static function update_celestrak() { |
2532 | 3091 | global $tmp_dir, $globalDebug; |
2533 | - if ($globalDebug) echo "Download Celestrak DB : Download..."; |
|
3092 | + if ($globalDebug) { |
|
3093 | + echo "Download Celestrak DB : Download..."; |
|
3094 | + } |
|
2534 | 3095 | update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
2535 | 3096 | if (file_exists($tmp_dir.'satcat.txt')) { |
2536 | - if ($globalDebug) echo "Add to DB..."; |
|
3097 | + if ($globalDebug) { |
|
3098 | + echo "Add to DB..."; |
|
3099 | + } |
|
2537 | 3100 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
2538 | - } else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3101 | + } else { |
|
3102 | + $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3103 | + } |
|
2539 | 3104 | if ($error != '') { |
2540 | 3105 | echo $error."\n"; |
2541 | - } elseif ($globalDebug) echo "Done\n"; |
|
3106 | + } elseif ($globalDebug) { |
|
3107 | + echo "Done\n"; |
|
3108 | + } |
|
2542 | 3109 | return ''; |
2543 | 3110 | } |
2544 | 3111 | |
2545 | 3112 | public static function update_models() { |
2546 | 3113 | global $tmp_dir, $globalDebug; |
2547 | 3114 | $error = ''; |
2548 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
3115 | + if ($globalDebug) { |
|
3116 | + echo "Models from FlightAirMap website : Download..."; |
|
3117 | + } |
|
2549 | 3118 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
2550 | 3119 | if (file_exists($tmp_dir.'models.md5sum')) { |
2551 | - if ($globalDebug) echo "Check files...\n"; |
|
3120 | + if ($globalDebug) { |
|
3121 | + echo "Check files...\n"; |
|
3122 | + } |
|
2552 | 3123 | $newmodelsdb = array(); |
2553 | 3124 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
2554 | 3125 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2567,25 +3138,35 @@ discard block |
||
2567 | 3138 | } |
2568 | 3139 | $diff = array_diff($newmodelsdb,$modelsdb); |
2569 | 3140 | foreach ($diff as $key => $value) { |
2570 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3141 | + if ($globalDebug) { |
|
3142 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3143 | + } |
|
2571 | 3144 | update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
2572 | 3145 | |
2573 | 3146 | } |
2574 | 3147 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
2575 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3148 | + } else { |
|
3149 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3150 | + } |
|
2576 | 3151 | if ($error != '') { |
2577 | 3152 | return $error; |
2578 | - } elseif ($globalDebug) echo "Done\n"; |
|
3153 | + } elseif ($globalDebug) { |
|
3154 | + echo "Done\n"; |
|
3155 | + } |
|
2579 | 3156 | return ''; |
2580 | 3157 | } |
2581 | 3158 | |
2582 | 3159 | public static function update_space_models() { |
2583 | 3160 | global $tmp_dir, $globalDebug; |
2584 | 3161 | $error = ''; |
2585 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
3162 | + if ($globalDebug) { |
|
3163 | + echo "Space models from FlightAirMap website : Download..."; |
|
3164 | + } |
|
2586 | 3165 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
2587 | 3166 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2588 | - if ($globalDebug) echo "Check files...\n"; |
|
3167 | + if ($globalDebug) { |
|
3168 | + echo "Check files...\n"; |
|
3169 | + } |
|
2589 | 3170 | $newmodelsdb = array(); |
2590 | 3171 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
2591 | 3172 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2604,25 +3185,35 @@ discard block |
||
2604 | 3185 | } |
2605 | 3186 | $diff = array_diff($newmodelsdb,$modelsdb); |
2606 | 3187 | foreach ($diff as $key => $value) { |
2607 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
3188 | + if ($globalDebug) { |
|
3189 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
3190 | + } |
|
2608 | 3191 | update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
2609 | 3192 | |
2610 | 3193 | } |
2611 | 3194 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
2612 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3195 | + } else { |
|
3196 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3197 | + } |
|
2613 | 3198 | if ($error != '') { |
2614 | 3199 | return $error; |
2615 | - } elseif ($globalDebug) echo "Done\n"; |
|
3200 | + } elseif ($globalDebug) { |
|
3201 | + echo "Done\n"; |
|
3202 | + } |
|
2616 | 3203 | return ''; |
2617 | 3204 | } |
2618 | 3205 | |
2619 | 3206 | public static function update_vehicules_models() { |
2620 | 3207 | global $tmp_dir, $globalDebug; |
2621 | 3208 | $error = ''; |
2622 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
3209 | + if ($globalDebug) { |
|
3210 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
3211 | + } |
|
2623 | 3212 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
2624 | 3213 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2625 | - if ($globalDebug) echo "Check files...\n"; |
|
3214 | + if ($globalDebug) { |
|
3215 | + echo "Check files...\n"; |
|
3216 | + } |
|
2626 | 3217 | $newmodelsdb = array(); |
2627 | 3218 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
2628 | 3219 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2641,15 +3232,21 @@ discard block |
||
2641 | 3232 | } |
2642 | 3233 | $diff = array_diff($newmodelsdb,$modelsdb); |
2643 | 3234 | foreach ($diff as $key => $value) { |
2644 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3235 | + if ($globalDebug) { |
|
3236 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3237 | + } |
|
2645 | 3238 | update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
2646 | 3239 | |
2647 | 3240 | } |
2648 | 3241 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
2649 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3242 | + } else { |
|
3243 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3244 | + } |
|
2650 | 3245 | if ($error != '') { |
2651 | 3246 | return $error; |
2652 | - } elseif ($globalDebug) echo "Done\n"; |
|
3247 | + } elseif ($globalDebug) { |
|
3248 | + echo "Done\n"; |
|
3249 | + } |
|
2653 | 3250 | return ''; |
2654 | 3251 | } |
2655 | 3252 | |
@@ -2692,7 +3289,9 @@ discard block |
||
2692 | 3289 | } |
2693 | 3290 | |
2694 | 3291 | $error = ''; |
2695 | - if ($globalDebug) echo "Notam : Download..."; |
|
3292 | + if ($globalDebug) { |
|
3293 | + echo "Notam : Download..."; |
|
3294 | + } |
|
2696 | 3295 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
2697 | 3296 | if (file_exists($tmp_dir.'notam.rss')) { |
2698 | 3297 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -2707,14 +3306,30 @@ discard block |
||
2707 | 3306 | $data['fir'] = $q[0]; |
2708 | 3307 | $data['code'] = $q[1]; |
2709 | 3308 | $ifrvfr = $q[2]; |
2710 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
2711 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
2712 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
2713 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
2714 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
2715 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
2716 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
2717 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
3309 | + if ($ifrvfr == 'IV') { |
|
3310 | + $data['rules'] = 'IFR/VFR'; |
|
3311 | + } |
|
3312 | + if ($ifrvfr == 'I') { |
|
3313 | + $data['rules'] = 'IFR'; |
|
3314 | + } |
|
3315 | + if ($ifrvfr == 'V') { |
|
3316 | + $data['rules'] = 'VFR'; |
|
3317 | + } |
|
3318 | + if ($q[4] == 'A') { |
|
3319 | + $data['scope'] = 'Airport warning'; |
|
3320 | + } |
|
3321 | + if ($q[4] == 'E') { |
|
3322 | + $data['scope'] = 'Enroute warning'; |
|
3323 | + } |
|
3324 | + if ($q[4] == 'W') { |
|
3325 | + $data['scope'] = 'Navigation warning'; |
|
3326 | + } |
|
3327 | + if ($q[4] == 'AE') { |
|
3328 | + $data['scope'] = 'Airport/Enroute warning'; |
|
3329 | + } |
|
3330 | + if ($q[4] == 'AW') { |
|
3331 | + $data['scope'] = 'Airport/Navigation warning'; |
|
3332 | + } |
|
2718 | 3333 | //$data['scope'] = $q[4]; |
2719 | 3334 | $data['lower_limit'] = $q[5]; |
2720 | 3335 | $data['upper_limit'] = $q[6]; |
@@ -2722,8 +3337,12 @@ discard block |
||
2722 | 3337 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
2723 | 3338 | $latitude = $Common->convertDec($las,'latitude'); |
2724 | 3339 | $longitude = $Common->convertDec($lns,'longitude'); |
2725 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
2726 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
3340 | + if ($lac == 'S') { |
|
3341 | + $latitude = '-'.$latitude; |
|
3342 | + } |
|
3343 | + if ($lnc == 'W') { |
|
3344 | + $longitude = '-'.$longitude; |
|
3345 | + } |
|
2727 | 3346 | $data['center_latitude'] = $latitude; |
2728 | 3347 | $data['center_longitude'] = $longitude; |
2729 | 3348 | $data['radius'] = intval($radius); |
@@ -2753,10 +3372,14 @@ discard block |
||
2753 | 3372 | $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
2754 | 3373 | unset($data); |
2755 | 3374 | } |
2756 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3375 | + } else { |
|
3376 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3377 | + } |
|
2757 | 3378 | if ($error != '') { |
2758 | 3379 | return $error; |
2759 | - } elseif ($globalDebug) echo "Done\n"; |
|
3380 | + } elseif ($globalDebug) { |
|
3381 | + echo "Done\n"; |
|
3382 | + } |
|
2760 | 3383 | return ''; |
2761 | 3384 | } |
2762 | 3385 | |
@@ -2781,7 +3404,9 @@ discard block |
||
2781 | 3404 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2782 | 3405 | $airspace_json = json_decode($airspace_lst,true); |
2783 | 3406 | foreach ($airspace_json['records'] as $airspace) { |
2784 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
3407 | + if ($globalDebug) { |
|
3408 | + echo $airspace['name']."...\n"; |
|
3409 | + } |
|
2785 | 3410 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
2786 | 3411 | if (file_exists($tmp_dir.$airspace['name'])) { |
2787 | 3412 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -2825,8 +3450,11 @@ discard block |
||
2825 | 3450 | return "error : ".$e->getMessage(); |
2826 | 3451 | } |
2827 | 3452 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2828 | - if ($row['nb'] > 0) return false; |
|
2829 | - else return true; |
|
3453 | + if ($row['nb'] > 0) { |
|
3454 | + return false; |
|
3455 | + } else { |
|
3456 | + return true; |
|
3457 | + } |
|
2830 | 3458 | } |
2831 | 3459 | |
2832 | 3460 | public static function insert_last_update() { |
@@ -2851,8 +3479,11 @@ discard block |
||
2851 | 3479 | return "error : ".$e->getMessage(); |
2852 | 3480 | } |
2853 | 3481 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2854 | - if ($row['nb'] > 0) return true; |
|
2855 | - else return false; |
|
3482 | + if ($row['nb'] > 0) { |
|
3483 | + return true; |
|
3484 | + } else { |
|
3485 | + return false; |
|
3486 | + } |
|
2856 | 3487 | } |
2857 | 3488 | |
2858 | 3489 | public static function check_geoid_version($version) { |
@@ -2865,8 +3496,11 @@ discard block |
||
2865 | 3496 | return "error : ".$e->getMessage(); |
2866 | 3497 | } |
2867 | 3498 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2868 | - if ($row['nb'] > 0) return true; |
|
2869 | - else return false; |
|
3499 | + if ($row['nb'] > 0) { |
|
3500 | + return true; |
|
3501 | + } else { |
|
3502 | + return false; |
|
3503 | + } |
|
2870 | 3504 | } |
2871 | 3505 | |
2872 | 3506 | public static function check_marine_identity_version($version) { |
@@ -2879,8 +3513,11 @@ discard block |
||
2879 | 3513 | return "error : ".$e->getMessage(); |
2880 | 3514 | } |
2881 | 3515 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2882 | - if ($row['nb'] > 0) return true; |
|
2883 | - else return false; |
|
3516 | + if ($row['nb'] > 0) { |
|
3517 | + return true; |
|
3518 | + } else { |
|
3519 | + return false; |
|
3520 | + } |
|
2884 | 3521 | } |
2885 | 3522 | |
2886 | 3523 | public static function check_satellite_version($version) { |
@@ -2893,8 +3530,11 @@ discard block |
||
2893 | 3530 | return "error : ".$e->getMessage(); |
2894 | 3531 | } |
2895 | 3532 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2896 | - if ($row['nb'] > 0) return true; |
|
2897 | - else return false; |
|
3533 | + if ($row['nb'] > 0) { |
|
3534 | + return true; |
|
3535 | + } else { |
|
3536 | + return false; |
|
3537 | + } |
|
2898 | 3538 | } |
2899 | 3539 | |
2900 | 3540 | |
@@ -2961,8 +3601,11 @@ discard block |
||
2961 | 3601 | return "error : ".$e->getMessage(); |
2962 | 3602 | } |
2963 | 3603 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2964 | - if ($row['nb'] > 0) return false; |
|
2965 | - else return true; |
|
3604 | + if ($row['nb'] > 0) { |
|
3605 | + return false; |
|
3606 | + } else { |
|
3607 | + return true; |
|
3608 | + } |
|
2966 | 3609 | } |
2967 | 3610 | |
2968 | 3611 | public static function insert_last_notam_update() { |
@@ -2992,8 +3635,11 @@ discard block |
||
2992 | 3635 | return "error : ".$e->getMessage(); |
2993 | 3636 | } |
2994 | 3637 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2995 | - if ($row['nb'] > 0) return false; |
|
2996 | - else return true; |
|
3638 | + if ($row['nb'] > 0) { |
|
3639 | + return false; |
|
3640 | + } else { |
|
3641 | + return true; |
|
3642 | + } |
|
2997 | 3643 | } |
2998 | 3644 | |
2999 | 3645 | public static function insert_last_airspace_update() { |
@@ -3023,8 +3669,11 @@ discard block |
||
3023 | 3669 | return "error : ".$e->getMessage(); |
3024 | 3670 | } |
3025 | 3671 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3026 | - if ($row['nb'] > 0) return false; |
|
3027 | - else return true; |
|
3672 | + if ($row['nb'] > 0) { |
|
3673 | + return false; |
|
3674 | + } else { |
|
3675 | + return true; |
|
3676 | + } |
|
3028 | 3677 | } |
3029 | 3678 | |
3030 | 3679 | public static function insert_last_geoid_update() { |
@@ -3054,8 +3703,11 @@ discard block |
||
3054 | 3703 | return "error : ".$e->getMessage(); |
3055 | 3704 | } |
3056 | 3705 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3057 | - if ($row['nb'] > 0) return false; |
|
3058 | - else return true; |
|
3706 | + if ($row['nb'] > 0) { |
|
3707 | + return false; |
|
3708 | + } else { |
|
3709 | + return true; |
|
3710 | + } |
|
3059 | 3711 | } |
3060 | 3712 | |
3061 | 3713 | public static function insert_last_owner_update() { |
@@ -3084,8 +3736,11 @@ discard block |
||
3084 | 3736 | return "error : ".$e->getMessage(); |
3085 | 3737 | } |
3086 | 3738 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3087 | - if ($row['nb'] > 0) return false; |
|
3088 | - else return true; |
|
3739 | + if ($row['nb'] > 0) { |
|
3740 | + return false; |
|
3741 | + } else { |
|
3742 | + return true; |
|
3743 | + } |
|
3089 | 3744 | } |
3090 | 3745 | |
3091 | 3746 | public static function insert_last_schedules_update() { |
@@ -3115,8 +3770,11 @@ discard block |
||
3115 | 3770 | return "error : ".$e->getMessage(); |
3116 | 3771 | } |
3117 | 3772 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3118 | - if ($row['nb'] > 0) return false; |
|
3119 | - else return true; |
|
3773 | + if ($row['nb'] > 0) { |
|
3774 | + return false; |
|
3775 | + } else { |
|
3776 | + return true; |
|
3777 | + } |
|
3120 | 3778 | } |
3121 | 3779 | |
3122 | 3780 | public static function insert_last_tle_update() { |
@@ -3146,8 +3804,11 @@ discard block |
||
3146 | 3804 | return "error : ".$e->getMessage(); |
3147 | 3805 | } |
3148 | 3806 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3149 | - if ($row['nb'] > 0) return false; |
|
3150 | - else return true; |
|
3807 | + if ($row['nb'] > 0) { |
|
3808 | + return false; |
|
3809 | + } else { |
|
3810 | + return true; |
|
3811 | + } |
|
3151 | 3812 | } |
3152 | 3813 | |
3153 | 3814 | public static function insert_last_ucsdb_update() { |
@@ -3177,8 +3838,11 @@ discard block |
||
3177 | 3838 | return "error : ".$e->getMessage(); |
3178 | 3839 | } |
3179 | 3840 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3180 | - if ($row['nb'] > 0) return false; |
|
3181 | - else return true; |
|
3841 | + if ($row['nb'] > 0) { |
|
3842 | + return false; |
|
3843 | + } else { |
|
3844 | + return true; |
|
3845 | + } |
|
3182 | 3846 | } |
3183 | 3847 | |
3184 | 3848 | public static function insert_last_celestrak_update() { |
@@ -3208,8 +3872,11 @@ discard block |
||
3208 | 3872 | return "error : ".$e->getMessage(); |
3209 | 3873 | } |
3210 | 3874 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3211 | - if ($row['nb'] > 0) return false; |
|
3212 | - else return true; |
|
3875 | + if ($row['nb'] > 0) { |
|
3876 | + return false; |
|
3877 | + } else { |
|
3878 | + return true; |
|
3879 | + } |
|
3213 | 3880 | } |
3214 | 3881 | |
3215 | 3882 | public static function check_last_satellite_update() { |
@@ -3227,8 +3894,11 @@ discard block |
||
3227 | 3894 | return "error : ".$e->getMessage(); |
3228 | 3895 | } |
3229 | 3896 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3230 | - if ($row['nb'] > 0) return false; |
|
3231 | - else return true; |
|
3897 | + if ($row['nb'] > 0) { |
|
3898 | + return false; |
|
3899 | + } else { |
|
3900 | + return true; |
|
3901 | + } |
|
3232 | 3902 | } |
3233 | 3903 | |
3234 | 3904 | public static function insert_last_marine_identity_update() { |