@@ -68,14 +68,14 @@ 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 | if ($error != '') { |
| 73 | 73 | $_SESSION['error'] = $error; |
| 74 | 74 | } |
| 75 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
| 75 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Create database')); |
|
| 76 | 76 | $_SESSION['install'] = 'database_import'; |
| 77 | 77 | $_SESSION['next'] = 'Create and import tables'; |
| 78 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 78 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 79 | 79 | print json_encode($result); |
| 80 | 80 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') { |
| 81 | 81 | if (update_schema::check_version(false) == '0') { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | if ($error != '') { |
| 88 | 88 | $_SESSION['error'] = $error; |
| 89 | 89 | } |
| 90 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
| 90 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Create and import tables')); |
|
| 91 | 91 | if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
| 92 | 92 | $_SESSION['install'] = 'populate'; |
| 93 | 93 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
@@ -95,84 +95,84 @@ discard block |
||
| 95 | 95 | $_SESSION['install'] = 'sources'; |
| 96 | 96 | $_SESSION['next'] = 'Insert data in source table'; |
| 97 | 97 | } |
| 98 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 98 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 99 | 99 | print json_encode($result); |
| 100 | 100 | } else { |
| 101 | 101 | $error .= update_schema::check_version(true); |
| 102 | 102 | if ($error != '') { |
| 103 | 103 | $_SESSION['error'] = $error; |
| 104 | 104 | } |
| 105 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
| 105 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Update schema if needed')); |
|
| 106 | 106 | $_SESSION['install'] = 'sources'; |
| 107 | 107 | $_SESSION['next'] = 'Insert data in source table'; |
| 108 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 108 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 109 | 109 | print json_encode($result); |
| 110 | 110 | } |
| 111 | 111 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'waypoints') { |
| 112 | 112 | include_once('class.update_db.php'); |
| 113 | 113 | $error .= update_db::update_waypoints(); |
| 114 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
| 114 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate waypoints database')); |
|
| 115 | 115 | |
| 116 | 116 | $_SESSION['install'] = 'airspace'; |
| 117 | 117 | $_SESSION['next'] = 'Populate airspace table'; |
| 118 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 118 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 119 | 119 | print json_encode($result); |
| 120 | 120 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'airspace') { |
| 121 | 121 | include_once('class.update_db.php'); |
| 122 | 122 | $error .= update_db::update_airspace(); |
| 123 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate airspace database')); |
|
| 123 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate airspace database')); |
|
| 124 | 124 | $_SESSION['install'] = 'countries'; |
| 125 | 125 | $_SESSION['next'] = 'Populate countries table'; |
| 126 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 126 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 127 | 127 | print json_encode($result); |
| 128 | 128 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'countries') { |
| 129 | 129 | include_once('class.update_db.php'); |
| 130 | 130 | $error .= update_db::update_countries(); |
| 131 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
| 131 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate countries database')); |
|
| 132 | 132 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
| 133 | 133 | $_SESSION['install'] = 'notam'; |
| 134 | 134 | $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
| 135 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 135 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 136 | 136 | print json_encode($result); |
| 137 | 137 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
| 138 | 138 | $_SESSION['install'] = 'owner'; |
| 139 | 139 | $_SESSION['next'] = 'Populate owner table with externals data'; |
| 140 | 140 | unset($_SESSION['owner']); |
| 141 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 141 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 142 | 142 | print json_encode($result); |
| 143 | 143 | } else { |
| 144 | 144 | $_SESSION['install'] = 'sources'; |
| 145 | 145 | $_SESSION['next'] = 'Insert data in source table'; |
| 146 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 146 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 147 | 147 | print json_encode($result); |
| 148 | 148 | } |
| 149 | 149 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
| 150 | 150 | if (!is_writable('tmp')) { |
| 151 | 151 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
| 152 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 152 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 153 | 153 | print json_encode($result); |
| 154 | 154 | } else { |
| 155 | 155 | include_once('class.update_db.php'); |
| 156 | 156 | $globalDebug = FALSE; |
| 157 | 157 | $error .= update_db::update_ModeS(); |
| 158 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
| 158 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
| 159 | 159 | |
| 160 | 160 | $_SESSION['install'] = 'populate_flarm'; |
| 161 | 161 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM'; |
| 162 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 162 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 163 | 163 | print json_encode($result); |
| 164 | 164 | } |
| 165 | 165 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') { |
| 166 | 166 | if (!is_writable('tmp')) { |
| 167 | 167 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
| 168 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 168 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 169 | 169 | print json_encode($result); |
| 170 | 170 | } else { |
| 171 | 171 | include_once('class.update_db.php'); |
| 172 | 172 | $globalDebug = FALSE; |
| 173 | 173 | $error .= update_db::update_ModeS_flarm(); |
| 174 | 174 | $error .= update_db::update_ModeS_ogn(); |
| 175 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
| 175 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
| 176 | 176 | |
| 177 | 177 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
| 178 | 178 | $_SESSION['install'] = 'vatsim'; |
@@ -192,34 +192,34 @@ discard block |
||
| 192 | 192 | $_SESSION['install'] = 'routes'; |
| 193 | 193 | $_SESSION['next'] = 'Populate routes table with externals data'; |
| 194 | 194 | } |
| 195 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 195 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 196 | 196 | print json_encode($result); |
| 197 | 197 | } |
| 198 | 198 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') { |
| 199 | 199 | if (!is_writable('tmp')) { |
| 200 | 200 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
| 201 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 201 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 202 | 202 | print json_encode($result); |
| 203 | 203 | } else { |
| 204 | 204 | include_once('class.update_db.php'); |
| 205 | 205 | $globalDebug = FALSE; |
| 206 | 206 | $error .= update_db::update_routes(); |
| 207 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data')); |
|
| 207 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate routes table with externals data')); |
|
| 208 | 208 | $_SESSION['install'] = 'translation'; |
| 209 | 209 | $_SESSION['next'] = 'Populate translation table with externals data'; |
| 210 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 210 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 211 | 211 | print json_encode($result); |
| 212 | 212 | } |
| 213 | 213 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') { |
| 214 | 214 | if (!is_writable('tmp')) { |
| 215 | 215 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
| 216 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 216 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 217 | 217 | print json_encode($result); |
| 218 | 218 | } else { |
| 219 | 219 | include_once('class.update_db.php'); |
| 220 | 220 | $globalDebug = FALSE; |
| 221 | 221 | $error .= update_db::update_translation(); |
| 222 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data')); |
|
| 222 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate translation table with externals data')); |
|
| 223 | 223 | |
| 224 | 224 | if ($_SESSION['waypoints'] == 1) { |
| 225 | 225 | $_SESSION['install'] = 'waypoints'; |
@@ -236,48 +236,48 @@ discard block |
||
| 236 | 236 | $_SESSION['install'] = 'sources'; |
| 237 | 237 | $_SESSION['next'] = 'Insert data in source table'; |
| 238 | 238 | } |
| 239 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 239 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 240 | 240 | print json_encode($result); |
| 241 | 241 | } |
| 242 | 242 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') { |
| 243 | 243 | if (!is_writable('tmp')) { |
| 244 | 244 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
| 245 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 245 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 246 | 246 | print json_encode($result); |
| 247 | 247 | } else { |
| 248 | 248 | include_once('class.update_db.php'); |
| 249 | 249 | $globalDebug = FALSE; |
| 250 | 250 | $error = update_db::update_owner(); |
| 251 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data')); |
|
| 251 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate owner table with externals data')); |
|
| 252 | 252 | $_SESSION['install'] = 'sources'; |
| 253 | 253 | $_SESSION['next'] = 'Insert data in source table'; |
| 254 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 254 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 255 | 255 | print json_encode($result); |
| 256 | 256 | } |
| 257 | 257 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') { |
| 258 | 258 | if (!is_writable('tmp')) { |
| 259 | 259 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
| 260 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 260 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 261 | 261 | print json_encode($result); |
| 262 | 262 | } else { |
| 263 | 263 | include_once('class.update_db.php'); |
| 264 | 264 | $globalDebug = FALSE; |
| 265 | 265 | if (isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
| 266 | 266 | $error .= update_db::update_notam(); |
| 267 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data')); |
|
| 267 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data')); |
|
| 268 | 268 | } else { |
| 269 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)')); |
|
| 269 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data (no source defined)')); |
|
| 270 | 270 | } |
| 271 | 271 | if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
| 272 | 272 | $_SESSION['install'] = 'owner'; |
| 273 | 273 | $_SESSION['next'] = 'Populate owner table'; |
| 274 | 274 | unset($_SESSION['owner']); |
| 275 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 275 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 276 | 276 | print json_encode($result); |
| 277 | 277 | } else { |
| 278 | 278 | $_SESSION['install'] = 'sources'; |
| 279 | 279 | $_SESSION['next'] = 'Insert data in source table'; |
| 280 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 280 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 281 | 281 | print json_encode($result); |
| 282 | 282 | } |
| 283 | 283 | } |
@@ -315,9 +315,9 @@ discard block |
||
| 315 | 315 | $Source = new Source(); |
| 316 | 316 | $Source->deleteAllLocation(); |
| 317 | 317 | foreach ($sources as $src) { |
| 318 | - if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
|
| 318 | + 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 | 319 | } |
| 320 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
| 320 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert data in source table')); |
|
| 321 | 321 | unset($_SESSION['sources']); |
| 322 | 322 | } |
| 323 | 323 | /* |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $_SESSION['install'] = 'finish'; |
| 343 | 343 | $_SESSION['next'] = 'finish'; |
| 344 | 344 | } |
| 345 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 345 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 346 | 346 | print json_encode($result); |
| 347 | 347 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'vatsim') { |
| 348 | 348 | include_once('../install/class.create_db.php'); |
@@ -352,36 +352,36 @@ discard block |
||
| 352 | 352 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
| 353 | 353 | if (file_exists('tmp/ivae_feb2013.zip')) { |
| 354 | 354 | $error .= update_db::update_IVAO(); |
| 355 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
| 355 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
| 356 | 356 | } else { |
| 357 | 357 | $error .= update_db::update_vatsim(); |
| 358 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
| 358 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
| 359 | 359 | } |
| 360 | 360 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
| 361 | 361 | $error .= update_db::update_vatsim(); |
| 362 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
| 362 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
| 363 | 363 | } elseif (isset($globalIVAO) && $globalIVAO) { |
| 364 | 364 | if (file_exists('tmp/ivae_feb2013.zip')) { |
| 365 | 365 | $error .= update_db::update_IVAO(); |
| 366 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
| 366 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
| 367 | 367 | } else { |
| 368 | 368 | $error .= update_db::update_vatsim(); |
| 369 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)')); |
|
| 369 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data (IVAO not found)')); |
|
| 370 | 370 | } |
| 371 | 371 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
| 372 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data')); |
|
| 372 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert phpVMS data')); |
|
| 373 | 373 | } |
| 374 | 374 | //$_SESSION['install'] = 'routes'; |
| 375 | 375 | //$_SESSION['next'] = 'Populate routes table with externals data'; |
| 376 | 376 | $_SESSION['install'] = 'finish'; |
| 377 | 377 | $_SESSION['next'] = 'finish'; |
| 378 | 378 | |
| 379 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 379 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
| 380 | 380 | print json_encode($result); |
| 381 | 381 | } else { |
| 382 | 382 | //unset($_SESSION['install']); |
| 383 | 383 | $_SESSION['error'] = 'Unknwon task : '.$_SESSION['install']; |
| 384 | - $result = array('error' => 'Unknwon task : '.$_SESSION['install'],'done' => $_SESSION['done'],'next' => 'finish','install' => 'finish'); |
|
| 384 | + $result = array('error' => 'Unknwon task : '.$_SESSION['install'], 'done' => $_SESSION['done'], 'next' => 'finish', 'install' => 'finish'); |
|
| 385 | 385 | print json_encode($result); |
| 386 | 386 | } |
| 387 | 387 | ?> |
| 388 | 388 | \ No newline at end of file |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | require_once(dirname(__FILE__).'/class.create_db.php'); |
| 13 | 13 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
| 14 | 14 | require_once(dirname(__FILE__).'/class.settings.php'); |
| 15 | -$title="Install"; |
|
| 15 | +$title = "Install"; |
|
| 16 | 16 | require(dirname(__FILE__).'/header.php'); |
| 17 | 17 | require(dirname(__FILE__).'/../require/settings.php'); |
| 18 | 18 | |
@@ -66,8 +66,8 @@ discard block |
||
| 66 | 66 | if (!extension_loaded('curl')) { |
| 67 | 67 | $error[] = "Curl is not loaded."; |
| 68 | 68 | } |
| 69 | -if(function_exists('apache_get_modules') ){ |
|
| 70 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
| 69 | +if (function_exists('apache_get_modules')) { |
|
| 70 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
| 71 | 71 | $error[] = "mod_rewrite is not available."; |
| 72 | 72 | } |
| 73 | 73 | if (!isset($_SERVER['HTACCESS'])) { |
@@ -499,13 +499,13 @@ discard block |
||
| 499 | 499 | ?> |
| 500 | 500 | <tr> |
| 501 | 501 | <?php |
| 502 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
| 502 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
| 503 | 503 | ?> |
| 504 | 504 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 505 | 505 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
| 506 | 506 | <?php |
| 507 | 507 | } else { |
| 508 | - $hostport = explode(':',$source['host']); |
|
| 508 | + $hostport = explode(':', $source['host']); |
|
| 509 | 509 | if (isset($hostport[1])) { |
| 510 | 510 | $host = $hostport[0]; |
| 511 | 511 | $port = $hostport[1]; |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | <br /> |
| 788 | 788 | <p> |
| 789 | 789 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 790 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 790 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
| 791 | 791 | </p> |
| 792 | 792 | <br /> |
| 793 | 793 | <p> |
@@ -833,14 +833,14 @@ discard block |
||
| 833 | 833 | $error = ''; |
| 834 | 834 | |
| 835 | 835 | if (isset($_POST['dbtype'])) { |
| 836 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
| 837 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
| 838 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
| 839 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
| 840 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
| 841 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
| 842 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
| 843 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
| 836 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
| 837 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
| 838 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
| 839 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
| 840 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
| 841 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
| 842 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
| 843 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
| 844 | 844 | |
| 845 | 845 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
| 846 | 846 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -860,48 +860,48 @@ discard block |
||
| 860 | 860 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
| 861 | 861 | */ |
| 862 | 862 | |
| 863 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
| 863 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
| 864 | 864 | |
| 865 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
| 866 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
| 867 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
| 868 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
| 869 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
| 865 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
| 866 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
| 867 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
| 868 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
| 869 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
| 870 | 870 | |
| 871 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
| 872 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
| 873 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
| 874 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
| 875 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
| 876 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
| 877 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
| 878 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
| 879 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey)); |
|
| 871 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
| 872 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
| 873 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
| 874 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
| 875 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
| 876 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
| 877 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
| 878 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
| 879 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey)); |
|
| 880 | 880 | |
| 881 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
| 882 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
| 883 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
| 884 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
| 885 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
| 886 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
| 881 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
| 882 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
| 883 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
| 884 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
| 885 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
| 886 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
| 887 | 887 | |
| 888 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
| 889 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
| 888 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
| 889 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
| 890 | 890 | |
| 891 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
| 892 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
| 893 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
| 891 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
| 892 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
| 893 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
| 894 | 894 | |
| 895 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
| 895 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
| 896 | 896 | if ($acars == 'acars') { |
| 897 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
| 897 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
| 898 | 898 | } else { |
| 899 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
| 899 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
| 903 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
| 904 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
| 902 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
| 903 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
| 904 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
| 905 | 905 | |
| 906 | 906 | $source_name = $_POST['source_name']; |
| 907 | 907 | $source_latitude = $_POST['source_latitude']; |
@@ -915,8 +915,8 @@ discard block |
||
| 915 | 915 | |
| 916 | 916 | $sources = array(); |
| 917 | 917 | foreach ($source_name as $keys => $name) { |
| 918 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 919 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 918 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
| 919 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
| 920 | 920 | } |
| 921 | 921 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
| 922 | 922 | |
@@ -929,12 +929,12 @@ discard block |
||
| 929 | 929 | $sbsurl = $_POST['sbsurl']; |
| 930 | 930 | */ |
| 931 | 931 | |
| 932 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
| 933 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
| 934 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
| 935 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
| 936 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
| 937 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
| 932 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
| 933 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
| 934 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
| 935 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
| 936 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
| 937 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
| 938 | 938 | |
| 939 | 939 | /* |
| 940 | 940 | $globalSBS1Hosts = array(); |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | } |
| 951 | 951 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
| 952 | 952 | */ |
| 953 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
| 953 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
| 954 | 954 | $host = $_POST['host']; |
| 955 | 955 | $port = $_POST['port']; |
| 956 | 956 | $name = $_POST['name']; |
@@ -960,88 +960,88 @@ discard block |
||
| 960 | 960 | foreach ($host as $key => $h) { |
| 961 | 961 | if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
| 962 | 962 | else $cov = 'FALSE'; |
| 963 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov); |
|
| 963 | + if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov); |
|
| 964 | 964 | } |
| 965 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
| 965 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
| 966 | 966 | |
| 967 | - $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
|
| 968 | - $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
|
| 967 | + $sbstimeout = filter_input(INPUT_POST, 'sbstimeout', FILTER_SANITIZE_NUMBER_INT); |
|
| 968 | + $settings = array_merge($settings, array('globalSourcesTimeOut' => $sbstimeout)); |
|
| 969 | 969 | |
| 970 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
| 971 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
| 972 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
| 970 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
| 971 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
| 972 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
| 973 | 973 | |
| 974 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
| 975 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
| 974 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
| 975 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
| 976 | 976 | |
| 977 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
| 978 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
| 979 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
| 980 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
| 977 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
| 978 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
| 979 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
| 980 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
| 981 | 981 | |
| 982 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
| 983 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
| 984 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
| 982 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
| 983 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
| 984 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
| 985 | 985 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 986 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
| 987 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 986 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
| 987 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
| 988 | 988 | |
| 989 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
| 990 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
| 991 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
| 992 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
| 993 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
| 994 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
| 995 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
| 996 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
| 989 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
| 990 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
| 991 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
| 992 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
| 993 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
| 994 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
| 995 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
| 996 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
| 997 | 997 | |
| 998 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
| 999 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
| 998 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
| 999 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
| 1000 | 1000 | |
| 1001 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1002 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
| 1001 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1002 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
| 1003 | 1003 | |
| 1004 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
| 1004 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
| 1005 | 1005 | if ($archiveyear == "archiveyear") { |
| 1006 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
| 1006 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
| 1007 | 1007 | } else { |
| 1008 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
| 1008 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
| 1009 | 1009 | } |
| 1010 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1011 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
| 1012 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1013 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
| 1010 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1011 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
| 1012 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1013 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
| 1014 | 1014 | |
| 1015 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
| 1016 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
| 1017 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
| 1018 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
| 1015 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
| 1016 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
| 1017 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
| 1018 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
| 1019 | 1019 | |
| 1020 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
| 1021 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
| 1022 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
| 1020 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
| 1021 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
| 1022 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
| 1023 | 1023 | |
| 1024 | 1024 | // Create in settings.php keys not yet configurable if not already here |
| 1025 | 1025 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1026 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1026 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
| 1027 | 1027 | |
| 1028 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
| 1028 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
| 1029 | 1029 | if ($archive == 'archive') { |
| 1030 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
| 1030 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
| 1031 | 1031 | } else { |
| 1032 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
| 1032 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
| 1033 | 1033 | } |
| 1034 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
| 1034 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
| 1035 | 1035 | if ($daemon == 'daemon') { |
| 1036 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
| 1036 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
| 1037 | 1037 | } else { |
| 1038 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
| 1038 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
| 1039 | 1039 | } |
| 1040 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
| 1040 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
| 1041 | 1041 | if ($schedules == 'schedules') { |
| 1042 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
| 1042 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
| 1043 | 1043 | } else { |
| 1044 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
| 1044 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | /* |
@@ -1052,132 +1052,132 @@ discard block |
||
| 1052 | 1052 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
| 1053 | 1053 | } |
| 1054 | 1054 | */ |
| 1055 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
| 1056 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1057 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1058 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1059 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1055 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
| 1056 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
| 1057 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
| 1058 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
| 1059 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
| 1060 | 1060 | if ($globalivao == 'ivao') { |
| 1061 | 1061 | //$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE')); |
| 1062 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
| 1063 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1062 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
| 1063 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
| 1064 | 1064 | if ($globalvatsim == 'vatsim') { |
| 1065 | 1065 | //$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE')); |
| 1066 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
| 1067 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1066 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
| 1067 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
| 1068 | 1068 | if ($globalphpvms == 'phpvms') { |
| 1069 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
| 1070 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1069 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
| 1070 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
| 1071 | 1071 | if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') { |
| 1072 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
| 1073 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1072 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
| 1073 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
| 1074 | 1074 | |
| 1075 | 1075 | |
| 1076 | 1076 | |
| 1077 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
| 1077 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
| 1078 | 1078 | if ($notam == 'notam') { |
| 1079 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
| 1079 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
| 1080 | 1080 | } else { |
| 1081 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
| 1081 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
| 1082 | 1082 | } |
| 1083 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
| 1083 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
| 1084 | 1084 | if ($owner == 'owner') { |
| 1085 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
| 1085 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
| 1086 | 1086 | } else { |
| 1087 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
| 1087 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
| 1088 | 1088 | } |
| 1089 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
| 1089 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
| 1090 | 1090 | if ($translate == 'translate') { |
| 1091 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
| 1091 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
| 1092 | 1092 | } else { |
| 1093 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
| 1093 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
| 1094 | 1094 | } |
| 1095 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
| 1095 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
| 1096 | 1096 | if ($estimation == 'estimation') { |
| 1097 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
| 1097 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
| 1098 | 1098 | } else { |
| 1099 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
| 1099 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
| 1100 | 1100 | } |
| 1101 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
| 1101 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
| 1102 | 1102 | if ($metar == 'metar') { |
| 1103 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
| 1103 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
| 1104 | 1104 | } else { |
| 1105 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
| 1105 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
| 1106 | 1106 | } |
| 1107 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
| 1107 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
| 1108 | 1108 | if ($metarcycle == 'metarcycle') { |
| 1109 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
| 1109 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
| 1110 | 1110 | } else { |
| 1111 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
| 1111 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
| 1112 | 1112 | } |
| 1113 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
| 1113 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
| 1114 | 1114 | if ($fork == 'fork') { |
| 1115 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
| 1115 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
| 1116 | 1116 | } else { |
| 1117 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
| 1117 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
| 1120 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
| 1121 | 1121 | if ($colormap == 'colormap') { |
| 1122 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
| 1122 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
| 1123 | 1123 | } else { |
| 1124 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
| 1124 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
| 1125 | 1125 | } |
| 1126 | 1126 | |
| 1127 | 1127 | if (isset($_POST['aircrafticoncolor'])) { |
| 1128 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
| 1129 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
| 1128 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
| 1129 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
| 1130 | 1130 | } |
| 1131 | 1131 | |
| 1132 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
| 1133 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
| 1132 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
| 1133 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
| 1134 | 1134 | |
| 1135 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
| 1136 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
| 1137 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
| 1138 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
| 1139 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
| 1140 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
| 1135 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
| 1136 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
| 1137 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
| 1138 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
| 1139 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
| 1140 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
| 1141 | 1141 | |
| 1142 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
| 1142 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
| 1143 | 1143 | if ($mappopup == 'mappopup') { |
| 1144 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
| 1144 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
| 1145 | 1145 | } else { |
| 1146 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
| 1146 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
| 1147 | 1147 | } |
| 1148 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
| 1148 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
| 1149 | 1149 | if ($airportpopup == 'airportpopup') { |
| 1150 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
| 1150 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
| 1151 | 1151 | } else { |
| 1152 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
| 1152 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
| 1153 | 1153 | } |
| 1154 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
| 1154 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
| 1155 | 1155 | if ($maphistory == 'maphistory') { |
| 1156 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
| 1156 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
| 1157 | 1157 | } else { |
| 1158 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
| 1158 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
| 1159 | 1159 | } |
| 1160 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
| 1160 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
| 1161 | 1161 | if ($flightroute == 'flightroute') { |
| 1162 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
| 1162 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
| 1163 | 1163 | } else { |
| 1164 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
| 1164 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
| 1165 | 1165 | } |
| 1166 | 1166 | |
| 1167 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1167 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
| 1168 | 1168 | |
| 1169 | 1169 | // Set some defaults values... |
| 1170 | 1170 | if (!isset($globalAircraftImageSources)) { |
| 1171 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 1172 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1171 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
| 1172 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | 1175 | if (!isset($globalSchedulesSources)) { |
| 1176 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
| 1177 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1176 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
| 1177 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | |
| 1180 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
| 1180 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
| 1181 | 1181 | |
| 1182 | 1182 | if ($error == '') settings::modify_settings($settings); |
| 1183 | 1183 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -117,44 +117,71 @@ discard block |
||
| 117 | 117 | </div> |
| 118 | 118 | <p> |
| 119 | 119 | <label for="dbhost">Database hostname</label> |
| 120 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
| 120 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
| 121 | + print $globalDBhost; |
|
| 122 | +} |
|
| 123 | +?>" /> |
|
| 121 | 124 | </p> |
| 122 | 125 | <p> |
| 123 | 126 | <label for="dbport">Database port</label> |
| 124 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
| 127 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
| 128 | + print $globalDBport; |
|
| 129 | +} |
|
| 130 | +?>" /> |
|
| 125 | 131 | </p> |
| 126 | 132 | <p> |
| 127 | 133 | <label for="dbname">Database name</label> |
| 128 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
| 134 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
| 135 | + print $globalDBname; |
|
| 136 | +} |
|
| 137 | +?>" /> |
|
| 129 | 138 | </p> |
| 130 | 139 | <p> |
| 131 | 140 | <label for="dbuser">Database user</label> |
| 132 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
| 141 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
| 142 | + print $globalDBuser; |
|
| 143 | +} |
|
| 144 | +?>" /> |
|
| 133 | 145 | </p> |
| 134 | 146 | <p> |
| 135 | 147 | <label for="dbuserpass">Database user password</label> |
| 136 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
| 148 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
| 149 | + print $globalDBpass; |
|
| 150 | +} |
|
| 151 | +?>" /> |
|
| 137 | 152 | </p> |
| 138 | 153 | </fieldset> |
| 139 | 154 | <fieldset> |
| 140 | 155 | <legend>Site configuration</legend> |
| 141 | 156 | <p> |
| 142 | 157 | <label for="sitename">Site name</label> |
| 143 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
| 158 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
| 159 | + print $globalName; |
|
| 160 | +} |
|
| 161 | +?>" /> |
|
| 144 | 162 | </p> |
| 145 | 163 | <p> |
| 146 | 164 | <label for="siteurl">Site directory</label> |
| 147 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
| 165 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
| 166 | + print $globalURL; |
|
| 167 | +} |
|
| 168 | +?>" /> |
|
| 148 | 169 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
| 149 | 170 | </p> |
| 150 | 171 | <p> |
| 151 | 172 | <label for="timezone">Timezone</label> |
| 152 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
| 173 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
| 174 | + print $globalTimezone; |
|
| 175 | +} |
|
| 176 | +?>" /> |
|
| 153 | 177 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
| 154 | 178 | </p> |
| 155 | 179 | <p> |
| 156 | 180 | <label for="language">Language</label> |
| 157 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
| 181 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
| 182 | + print $globalLanguage; |
|
| 183 | +} |
|
| 184 | +?>" /> |
|
| 158 | 185 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
| 159 | 186 | </p> |
| 160 | 187 | </fieldset> |
@@ -175,18 +202,27 @@ discard block |
||
| 175 | 202 | <div id="mapbox_data"> |
| 176 | 203 | <p> |
| 177 | 204 | <label for="mapboxid">Mapbox id</label> |
| 178 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
| 205 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
| 206 | + print $globalMapboxId; |
|
| 207 | +} |
|
| 208 | +?>" /> |
|
| 179 | 209 | </p> |
| 180 | 210 | <p> |
| 181 | 211 | <label for="mapboxtoken">Mapbox token</label> |
| 182 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
| 212 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
| 213 | + print $globalMapboxToken; |
|
| 214 | +} |
|
| 215 | +?>" /> |
|
| 183 | 216 | </p> |
| 184 | 217 | </div> |
| 185 | 218 | <br /> |
| 186 | 219 | <div id="google_data"> |
| 187 | 220 | <p> |
| 188 | 221 | <label for="googlekey">Google API key</label> |
| 189 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
| 222 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
| 223 | + print $globalGoogleAPIKey; |
|
| 224 | +} |
|
| 225 | +?>" /> |
|
| 190 | 226 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
| 191 | 227 | </p> |
| 192 | 228 | </div> |
@@ -194,7 +230,10 @@ discard block |
||
| 194 | 230 | <div id="bing_data"> |
| 195 | 231 | <p> |
| 196 | 232 | <label for="bingkey">Bing Map key</label> |
| 197 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
| 233 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
| 234 | + print $globalBingMapKey; |
|
| 235 | +} |
|
| 236 | +?>" /> |
|
| 198 | 237 | <p class="help-block">Get a key <a href="https://msdn.microsoft.com/en-us/library/ff428642.aspx">here</a></p> |
| 199 | 238 | </p> |
| 200 | 239 | </div> |
@@ -202,7 +241,10 @@ discard block |
||
| 202 | 241 | <div id="mapquest_data"> |
| 203 | 242 | <p> |
| 204 | 243 | <label for="mapquestkey">MapQuest key</label> |
| 205 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
| 244 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
| 245 | + print $globalMapQuestKey; |
|
| 246 | +} |
|
| 247 | +?>" /> |
|
| 206 | 248 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
| 207 | 249 | </p> |
| 208 | 250 | </div> |
@@ -210,11 +252,17 @@ discard block |
||
| 210 | 252 | <div id="here_data"> |
| 211 | 253 | <p> |
| 212 | 254 | <label for="hereappid">Here App_Id</label> |
| 213 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
| 255 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
| 256 | + print $globalHereappId; |
|
| 257 | +} |
|
| 258 | +?>" /> |
|
| 214 | 259 | </p> |
| 215 | 260 | <p> |
| 216 | 261 | <label for="hereappcode">Here App_Code</label> |
| 217 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
| 262 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
| 263 | + print $globalHereappCode; |
|
| 264 | +} |
|
| 265 | +?>" /> |
|
| 218 | 266 | </p> |
| 219 | 267 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
| 220 | 268 | </div> |
@@ -223,42 +271,86 @@ discard block |
||
| 223 | 271 | <legend>Coverage area</legend> |
| 224 | 272 | <p> |
| 225 | 273 | <label for="latitudemax">The maximum latitude (north)</label> |
| 226 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
| 274 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
| 275 | + print $globalLatitudeMax; |
|
| 276 | +} |
|
| 277 | +?>" /> |
|
| 227 | 278 | </p> |
| 228 | 279 | <p> |
| 229 | 280 | <label for="latitudemin">The minimum latitude (south)</label> |
| 230 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
| 281 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
| 282 | + print $globalLatitudeMin; |
|
| 283 | +} |
|
| 284 | +?>" /> |
|
| 231 | 285 | </p> |
| 232 | 286 | <p> |
| 233 | 287 | <label for="longitudemax">The maximum longitude (west)</label> |
| 234 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
| 288 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
| 289 | + print $globalLongitudeMax; |
|
| 290 | +} |
|
| 291 | +?>" /> |
|
| 235 | 292 | </p> |
| 236 | 293 | <p> |
| 237 | 294 | <label for="longitudemin">The minimum longitude (east)</label> |
| 238 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
| 295 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
| 296 | + print $globalLongitudeMin; |
|
| 297 | +} |
|
| 298 | +?>" /> |
|
| 239 | 299 | </p> |
| 240 | 300 | <p> |
| 241 | 301 | <label for="latitudecenter">The latitude center</label> |
| 242 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
| 302 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
| 303 | + print $globalCenterLatitude; |
|
| 304 | +} |
|
| 305 | +?>" /> |
|
| 243 | 306 | </p> |
| 244 | 307 | <p> |
| 245 | 308 | <label for="longitudecenter">The longitude center</label> |
| 246 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
| 309 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
| 310 | + print $globalCenterLongitude; |
|
| 311 | +} |
|
| 312 | +?>" /> |
|
| 247 | 313 | </p> |
| 248 | 314 | <p> |
| 249 | 315 | <label for="livezoom">Default Zoom on live map</label> |
| 250 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
| 316 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
| 317 | + print $globalLiveZoom; |
|
| 318 | +} else { |
|
| 319 | + print '9'; |
|
| 320 | +} |
|
| 321 | +?>" /> |
|
| 251 | 322 | </p> |
| 252 | 323 | <p> |
| 253 | 324 | <label for="squawk_country">Country for squawk usage</label> |
| 254 | 325 | <select name="squawk_country" id="squawk_country"> |
| 255 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
| 256 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
| 257 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
| 258 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
| 259 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
| 260 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
| 261 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
| 326 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
| 327 | + print ' selected '; |
|
| 328 | +} |
|
| 329 | +?>>UK</option> |
|
| 330 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
| 331 | + print ' selected '; |
|
| 332 | +} |
|
| 333 | +?>>NZ</option> |
|
| 334 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
| 335 | + print ' selected '; |
|
| 336 | +} |
|
| 337 | +?>>US</option> |
|
| 338 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
| 339 | + print ' selected '; |
|
| 340 | +} |
|
| 341 | +?>>AU</option> |
|
| 342 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
| 343 | + print ' selected '; |
|
| 344 | +} |
|
| 345 | +?>>NL</option> |
|
| 346 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
| 347 | + print ' selected '; |
|
| 348 | +} |
|
| 349 | +?>>FR</option> |
|
| 350 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
| 351 | + print ' selected '; |
|
| 352 | +} |
|
| 353 | +?>>TR</option> |
|
| 262 | 354 | </select> |
| 263 | 355 | </p> |
| 264 | 356 | </fieldset> |
@@ -267,15 +359,24 @@ discard block |
||
| 267 | 359 | <p><i>Only put in DB flights that are inside a circle</i></p> |
| 268 | 360 | <p> |
| 269 | 361 | <label for="latitude">Center latitude</label> |
| 270 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
| 362 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
| 363 | + echo $globalDistanceIgnore['latitude']; |
|
| 364 | +} |
|
| 365 | +?>" /> |
|
| 271 | 366 | </p> |
| 272 | 367 | <p> |
| 273 | 368 | <label for="longitude">Center longitude</label> |
| 274 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
| 369 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
| 370 | + echo $globalDistanceIgnore['longitude']; |
|
| 371 | +} |
|
| 372 | +?>" /> |
|
| 275 | 373 | </p> |
| 276 | 374 | <p> |
| 277 | 375 | <label for="Distance">Distance (in km)</label> |
| 278 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
| 376 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
| 377 | + echo $globalDistanceIgnore['distance']; |
|
| 378 | +} |
|
| 379 | +?>" /> |
|
| 279 | 380 | </p> |
| 280 | 381 | </fieldset> |
| 281 | 382 | <fieldset> |
@@ -364,11 +465,17 @@ discard block |
||
| 364 | 465 | <div id="flightaware_data"> |
| 365 | 466 | <p> |
| 366 | 467 | <label for="flightawareusername">FlightAware username</label> |
| 367 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 468 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 469 | + print $globalFlightAwareUsername; |
|
| 470 | +} |
|
| 471 | +?>" /> |
|
| 368 | 472 | </p> |
| 369 | 473 | <p> |
| 370 | 474 | <label for="flightawarepassword">FlightAware password/API key</label> |
| 371 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 475 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 476 | + print $globalFlightAwarePassword; |
|
| 477 | +} |
|
| 478 | +?>" /> |
|
| 372 | 479 | </p> |
| 373 | 480 | </div> |
| 374 | 481 | --> |
@@ -521,20 +628,56 @@ discard block |
||
| 521 | 628 | ?> |
| 522 | 629 | <td> |
| 523 | 630 | <select name="format[]" id="format"> |
| 524 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
| 525 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
| 526 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
| 527 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
| 528 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
| 529 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
| 530 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
| 531 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server</option> |
|
| 532 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
| 533 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
| 631 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
| 632 | + print 'selected'; |
|
| 633 | +} |
|
| 634 | +?>>Auto</option> |
|
| 635 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
| 636 | + print 'selected'; |
|
| 637 | +} |
|
| 638 | +?>>SBS</option> |
|
| 639 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
| 640 | + print 'selected'; |
|
| 641 | +} |
|
| 642 | +?>>TSV</option> |
|
| 643 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
| 644 | + print 'selected'; |
|
| 645 | +} |
|
| 646 | +?>>Raw</option> |
|
| 647 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 648 | + print 'selected'; |
|
| 649 | +} |
|
| 650 | +?>>APRS</option> |
|
| 651 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
| 652 | + print 'selected'; |
|
| 653 | +} |
|
| 654 | +?>>Radarcape deltadb.txt</option> |
|
| 655 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
| 656 | + print 'selected'; |
|
| 657 | +} |
|
| 658 | +?>>Vatsim</option> |
|
| 659 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
| 660 | + print 'selected'; |
|
| 661 | +} |
|
| 662 | +?>>Virtual Radar Server</option> |
|
| 663 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 664 | + print 'selected'; |
|
| 665 | +} |
|
| 666 | +?>>phpVMS</option> |
|
| 667 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
| 668 | + print 'selected'; |
|
| 669 | +} |
|
| 670 | +?>>IVAO</option> |
|
| 534 | 671 | </select> |
| 535 | 672 | </td> |
| 536 | - <td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /></td> |
|
| 537 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
| 673 | + <td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
| 674 | + print $source['name']; |
|
| 675 | +} |
|
| 676 | +?>" /></td> |
|
| 677 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
| 678 | + print 'checked'; |
|
| 679 | +} |
|
| 680 | +?> /></td> |
|
| 538 | 681 | <td><input type="button" id="delhost" value="Delete" onclick="deleteRow(this)" /> <input type="button" id="addhost" value="Add" onclick="insRow()" /></td> |
| 539 | 682 | </tr> |
| 540 | 683 | <?php |
@@ -573,11 +716,17 @@ discard block |
||
| 573 | 716 | <p>Listen UDP server for acarsdec/acarsdeco2/...</p> |
| 574 | 717 | <p> |
| 575 | 718 | <label for="acarshost">ACARS UDP host</label> |
| 576 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
| 719 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
| 720 | + print $globalACARSHost; |
|
| 721 | +} |
|
| 722 | +?>" /> |
|
| 577 | 723 | </p> |
| 578 | 724 | <p> |
| 579 | 725 | <label for="acarsport">ACARS UDP port</label> |
| 580 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
| 726 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
| 727 | + print $globalACARSPort; |
|
| 728 | +} |
|
| 729 | +?>" /> |
|
| 581 | 730 | </p> |
| 582 | 731 | </fieldset> |
| 583 | 732 | </div> |
@@ -631,12 +780,18 @@ discard block |
||
| 631 | 780 | <div id="schedules_options"> |
| 632 | 781 | <p> |
| 633 | 782 | <label for="britishairways">British Airways API Key</label> |
| 634 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
| 783 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
| 784 | + print $globalBritishAirwaysKey; |
|
| 785 | +} |
|
| 786 | +?>" /> |
|
| 635 | 787 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
| 636 | 788 | </p> |
| 637 | 789 | <p> |
| 638 | 790 | <label for="transavia">Transavia Test API Consumer Key</label> |
| 639 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
| 791 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
| 792 | + print $globalTransaviaKey; |
|
| 793 | +} |
|
| 794 | +?>" /> |
|
| 640 | 795 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
| 641 | 796 | </p> |
| 642 | 797 | <p> |
@@ -644,10 +799,16 @@ discard block |
||
| 644 | 799 | <b>Lufthansa API Key</b> |
| 645 | 800 | <p> |
| 646 | 801 | <label for="lufthansakey">Key</label> |
| 647 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
| 802 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
| 803 | + print $globalLufthansaKey['key']; |
|
| 804 | +} |
|
| 805 | +?>" /> |
|
| 648 | 806 | </p><p> |
| 649 | 807 | <label for="lufthansasecret">Secret</label> |
| 650 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
| 808 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
| 809 | + print $globalLufthansaKey['secret']; |
|
| 810 | +} |
|
| 811 | +?>" /> |
|
| 651 | 812 | </p> |
| 652 | 813 | </div> |
| 653 | 814 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -667,7 +828,10 @@ discard block |
||
| 667 | 828 | </p> |
| 668 | 829 | <p> |
| 669 | 830 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
| 670 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
| 831 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
| 832 | + print $globalNOTAMSource; |
|
| 833 | +} |
|
| 834 | +?>" /> |
|
| 671 | 835 | </p> |
| 672 | 836 | <br /> |
| 673 | 837 | <p> |
@@ -682,14 +846,20 @@ discard block |
||
| 682 | 846 | <div id="metarsrc"> |
| 683 | 847 | <p> |
| 684 | 848 | <label for="metarsource">URL of your METAR source</label> |
| 685 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
| 849 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
| 850 | + print $globalMETARurl; |
|
| 851 | +} |
|
| 852 | +?>" /> |
|
| 686 | 853 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
| 687 | 854 | </p> |
| 688 | 855 | </div> |
| 689 | 856 | <br /> |
| 690 | 857 | <p> |
| 691 | 858 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
| 692 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
| 859 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
| 860 | + print $globalBitlyAccessToken; |
|
| 861 | +} |
|
| 862 | +?>" /> |
|
| 693 | 863 | </p> |
| 694 | 864 | <br /> |
| 695 | 865 | <p> |
@@ -703,7 +873,12 @@ discard block |
||
| 703 | 873 | </p> |
| 704 | 874 | <p> |
| 705 | 875 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
| 706 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '0'; ?>" /> |
|
| 876 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
| 877 | + print $globalArchiveMonths; |
|
| 878 | +} else { |
|
| 879 | + echo '0'; |
|
| 880 | +} |
|
| 881 | +?>" /> |
|
| 707 | 882 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
| 708 | 883 | </p> |
| 709 | 884 | <p> |
@@ -713,12 +888,22 @@ discard block |
||
| 713 | 888 | </p> |
| 714 | 889 | <p> |
| 715 | 890 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
| 716 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '0'; ?>" /> |
|
| 891 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
| 892 | + print $globalArchiveKeepMonths; |
|
| 893 | +} else { |
|
| 894 | + echo '0'; |
|
| 895 | +} |
|
| 896 | +?>" /> |
|
| 717 | 897 | <p class="help-block">0 to disable</p> |
| 718 | 898 | </p> |
| 719 | 899 | <p> |
| 720 | 900 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
| 721 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '0'; ?>" /> |
|
| 901 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
| 902 | + print $globalArchiveKeepTrackMonths; |
|
| 903 | +} else { |
|
| 904 | + echo '0'; |
|
| 905 | +} |
|
| 906 | +?>" /> |
|
| 722 | 907 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
| 723 | 908 | </p> |
| 724 | 909 | <br /> |
@@ -727,7 +912,12 @@ discard block |
||
| 727 | 912 | <input type="checkbox" name="daemon" id="daemon" value="daemon"<?php if ((isset($globalDaemon) && $globalDaemon) || !isset($globalDaemon)) { ?> checked="checked"<?php } ?> onClick="daemon_js()" /> |
| 728 | 913 | <div id="cronends"> |
| 729 | 914 | <label for="cronend">Run script for xx seconds</label> |
| 730 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
| 915 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
| 916 | + print $globalCronEnd; |
|
| 917 | +} else { |
|
| 918 | + print '0'; |
|
| 919 | +} |
|
| 920 | +?>" /> |
|
| 731 | 921 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
| 732 | 922 | </div> |
| 733 | 923 | <p class="help-block">Uncheck if the script is running as cron job</p> |
@@ -768,26 +958,49 @@ discard block |
||
| 768 | 958 | <br /> |
| 769 | 959 | <p> |
| 770 | 960 | <label for="refresh">Show flights detected since xxx seconds</label> |
| 771 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
| 961 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
| 962 | + echo $globalLiveInterval; |
|
| 963 | +} else { |
|
| 964 | + echo '200'; |
|
| 965 | +} |
|
| 966 | +?>" /> |
|
| 772 | 967 | </p> |
| 773 | 968 | <p> |
| 774 | 969 | <label for="maprefresh">Live map refresh (in seconds)</label> |
| 775 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
| 970 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
| 971 | + echo $globalMapRefresh; |
|
| 972 | +} else { |
|
| 973 | + echo '30'; |
|
| 974 | +} |
|
| 975 | +?>" /> |
|
| 776 | 976 | </p> |
| 777 | 977 | <p> |
| 778 | 978 | <label for="mapidle">Map idle timeout (in minutes)</label> |
| 779 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
| 979 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
| 980 | + echo $globalMapIdleTimeout; |
|
| 981 | +} else { |
|
| 982 | + echo '30'; |
|
| 983 | +} |
|
| 984 | +?>" /> |
|
| 780 | 985 | <p class="help-block">0 to disable</p> |
| 781 | 986 | </p> |
| 782 | 987 | <br /> |
| 783 | 988 | <p> |
| 784 | 989 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
| 785 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
| 990 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
| 991 | + echo $globalClosestMinDist; |
|
| 992 | +} else { |
|
| 993 | + echo '50'; |
|
| 994 | +} |
|
| 995 | +?>" /> |
|
| 786 | 996 | </p> |
| 787 | 997 | <br /> |
| 788 | 998 | <p> |
| 789 | 999 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 790 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1000 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
| 1001 | + echo $globalAircraftSize; |
|
| 1002 | +} |
|
| 1003 | +?>" /> |
|
| 791 | 1004 | </p> |
| 792 | 1005 | <br /> |
| 793 | 1006 | <p> |
@@ -795,7 +1008,12 @@ discard block |
||
| 795 | 1008 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 796 | 1009 | ?> |
| 797 | 1010 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
| 798 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
| 1011 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
| 1012 | + echo $globalAircraftIconColor; |
|
| 1013 | +} else { |
|
| 1014 | + echo '1a3151'; |
|
| 1015 | +} |
|
| 1016 | +?>" /> |
|
| 799 | 1017 | <?php |
| 800 | 1018 | if (!is_writable('../cache')) { |
| 801 | 1019 | ?> |
@@ -813,8 +1031,18 @@ discard block |
||
| 813 | 1031 | <p> |
| 814 | 1032 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
| 815 | 1033 | <div class="range"> |
| 816 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
| 817 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
| 1034 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
| 1035 | + echo $globalAirportZoom; |
|
| 1036 | +} else { |
|
| 1037 | + echo '7'; |
|
| 1038 | +} |
|
| 1039 | +?>" /> |
|
| 1040 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
| 1041 | + echo $globalAirportZoom; |
|
| 1042 | +} else { |
|
| 1043 | + echo '7'; |
|
| 1044 | +} |
|
| 1045 | +?></output> |
|
| 818 | 1046 | </div> |
| 819 | 1047 | </p> |
| 820 | 1048 | </fieldset> |
@@ -842,8 +1070,12 @@ discard block |
||
| 842 | 1070 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
| 843 | 1071 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
| 844 | 1072 | |
| 845 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
| 846 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1073 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
| 1074 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1075 | + } |
|
| 1076 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
| 1077 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1078 | + } |
|
| 847 | 1079 | |
| 848 | 1080 | $_SESSION['database_root'] = $dbroot; |
| 849 | 1081 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -910,15 +1142,23 @@ discard block |
||
| 910 | 1142 | $source_city = $_POST['source_city']; |
| 911 | 1143 | $source_country = $_POST['source_country']; |
| 912 | 1144 | $source_ref = $_POST['source_ref']; |
| 913 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
| 914 | - else $source_id = array(); |
|
| 1145 | + if (isset($source_id)) { |
|
| 1146 | + $source_id = $_POST['source_id']; |
|
| 1147 | + } else { |
|
| 1148 | + $source_id = array(); |
|
| 1149 | + } |
|
| 915 | 1150 | |
| 916 | 1151 | $sources = array(); |
| 917 | 1152 | foreach ($source_name as $keys => $name) { |
| 918 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 919 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1153 | + if (isset($source_id[$keys])) { |
|
| 1154 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1155 | + } else { |
|
| 1156 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1157 | + } |
|
| 1158 | + } |
|
| 1159 | + if (count($sources) > 0) { |
|
| 1160 | + $_SESSION['sources'] = $sources; |
|
| 920 | 1161 | } |
| 921 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
| 922 | 1162 | |
| 923 | 1163 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
| 924 | 1164 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -958,9 +1198,14 @@ discard block |
||
| 958 | 1198 | $sourcestats = $_POST['sourcestats']; |
| 959 | 1199 | $gSources = array(); |
| 960 | 1200 | foreach ($host as $key => $h) { |
| 961 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
| 962 | - else $cov = 'FALSE'; |
|
| 963 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov); |
|
| 1201 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
| 1202 | + $cov = 'TRUE'; |
|
| 1203 | + } else { |
|
| 1204 | + $cov = 'FALSE'; |
|
| 1205 | + } |
|
| 1206 | + if ($h != '') { |
|
| 1207 | + $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov); |
|
| 1208 | + } |
|
| 964 | 1209 | } |
| 965 | 1210 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
| 966 | 1211 | |
@@ -984,7 +1229,9 @@ discard block |
||
| 984 | 1229 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
| 985 | 1230 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 986 | 1231 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
| 987 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1232 | + } else { |
|
| 1233 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1234 | + } |
|
| 988 | 1235 | |
| 989 | 1236 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
| 990 | 1237 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1023,7 +1270,9 @@ discard block |
||
| 1023 | 1270 | |
| 1024 | 1271 | // Create in settings.php keys not yet configurable if not already here |
| 1025 | 1272 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1026 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1273 | + if (!isset($globalDebug)) { |
|
| 1274 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1275 | + } |
|
| 1027 | 1276 | |
| 1028 | 1277 | $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
| 1029 | 1278 | if ($archive == 'archive') { |
@@ -1053,24 +1302,38 @@ discard block |
||
| 1053 | 1302 | } |
| 1054 | 1303 | */ |
| 1055 | 1304 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
| 1056 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1057 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1058 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1059 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1305 | + if ($globalsbs == 'sbs') { |
|
| 1306 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1307 | + } else { |
|
| 1308 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1309 | + } |
|
| 1310 | + if ($globalaprs == 'aprs') { |
|
| 1311 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1312 | + } else { |
|
| 1313 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1314 | + } |
|
| 1060 | 1315 | if ($globalivao == 'ivao') { |
| 1061 | 1316 | //$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE')); |
| 1062 | 1317 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
| 1063 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1318 | + } else { |
|
| 1319 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1320 | + } |
|
| 1064 | 1321 | if ($globalvatsim == 'vatsim') { |
| 1065 | 1322 | //$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE')); |
| 1066 | 1323 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
| 1067 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1324 | + } else { |
|
| 1325 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1326 | + } |
|
| 1068 | 1327 | if ($globalphpvms == 'phpvms') { |
| 1069 | 1328 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
| 1070 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1329 | + } else { |
|
| 1330 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1331 | + } |
|
| 1071 | 1332 | if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') { |
| 1072 | 1333 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
| 1073 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1334 | + } else { |
|
| 1335 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1336 | + } |
|
| 1074 | 1337 | |
| 1075 | 1338 | |
| 1076 | 1339 | |
@@ -1164,7 +1427,9 @@ discard block |
||
| 1164 | 1427 | $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
| 1165 | 1428 | } |
| 1166 | 1429 | |
| 1167 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1430 | + if (!isset($globalTransaction)) { |
|
| 1431 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1432 | + } |
|
| 1168 | 1433 | |
| 1169 | 1434 | // Set some defaults values... |
| 1170 | 1435 | if (!isset($globalAircraftImageSources)) { |
@@ -1179,15 +1444,23 @@ discard block |
||
| 1179 | 1444 | |
| 1180 | 1445 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
| 1181 | 1446 | |
| 1182 | - if ($error == '') settings::modify_settings($settings); |
|
| 1183 | - if ($error == '') settings::comment_settings($settings_comment); |
|
| 1447 | + if ($error == '') { |
|
| 1448 | + settings::modify_settings($settings); |
|
| 1449 | + } |
|
| 1450 | + if ($error == '') { |
|
| 1451 | + settings::comment_settings($settings_comment); |
|
| 1452 | + } |
|
| 1184 | 1453 | if ($error != '') { |
| 1185 | 1454 | print '<div class="info column">'.$error.'</div>'; |
| 1186 | 1455 | require('../footer.php'); |
| 1187 | 1456 | exit; |
| 1188 | 1457 | } else { |
| 1189 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
| 1190 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
| 1458 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
| 1459 | + $_SESSION['waypoints'] = 1; |
|
| 1460 | + } |
|
| 1461 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
| 1462 | + $_SESSION['owner'] = 1; |
|
| 1463 | + } |
|
| 1191 | 1464 | if (isset($_POST['createdb'])) { |
| 1192 | 1465 | $_SESSION['install'] = 'database_create'; |
| 1193 | 1466 | } else { |
@@ -1216,12 +1489,16 @@ discard block |
||
| 1216 | 1489 | $pop = false; |
| 1217 | 1490 | foreach ($_SESSION['done'] as $done) { |
| 1218 | 1491 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
| 1219 | - if ($done == 'Create database') $pop = true; |
|
| 1492 | + if ($done == 'Create database') { |
|
| 1493 | + $pop = true; |
|
| 1494 | + } |
|
| 1220 | 1495 | } |
| 1221 | 1496 | if ($pop) { |
| 1222 | 1497 | sleep(5); |
| 1223 | 1498 | print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
| 1224 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 1499 | + } else { |
|
| 1500 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 1501 | + } |
|
| 1225 | 1502 | print '</div></ul>'; |
| 1226 | 1503 | print '<div id="error"></div>'; |
| 1227 | 1504 | /* foreach ($_SESSION['done'] as $done) { |
@@ -23,16 +23,16 @@ discard block |
||
| 23 | 23 | curl_close($ch); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public static function gunzip($in_file,$out_file_name = '') { |
|
| 26 | + public static function gunzip($in_file, $out_file_name = '') { |
|
| 27 | 27 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 28 | 28 | $buffer_size = 4096; // read 4kb at a time |
| 29 | 29 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
| 30 | 30 | if ($in_file != '' && file_exists($in_file)) { |
| 31 | 31 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 32 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 33 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 32 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
| 33 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
| 34 | 34 | $out_file = fopen($out_file_name, 'wb'); |
| 35 | - while(!gzeof($file)) { |
|
| 35 | + while (!gzeof($file)) { |
|
| 36 | 36 | fwrite($out_file, gzread($file, $buffer_size)); |
| 37 | 37 | } |
| 38 | 38 | fclose($out_file); |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | try { |
| 57 | 57 | self::$db_sqlite = new PDO('sqlite:'.$database); |
| 58 | 58 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 59 | - } catch(PDOException $e) { |
|
| 59 | + } catch (PDOException $e) { |
|
| 60 | 60 | return "error : ".$e->getMessage(); |
| 61 | 61 | } |
| 62 | 62 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | //$Connection = new Connection(); |
| 72 | 72 | $sth = $Connection->db->prepare($query); |
| 73 | 73 | $sth->execute(array(':source' => $database_file)); |
| 74 | - } catch(PDOException $e) { |
|
| 74 | + } catch (PDOException $e) { |
|
| 75 | 75 | return "error : ".$e->getMessage(); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | try { |
| 83 | 83 | $sth = update_db::$db_sqlite->prepare($query); |
| 84 | 84 | $sth->execute(); |
| 85 | - } catch(PDOException $e) { |
|
| 85 | + } catch (PDOException $e) { |
|
| 86 | 86 | return "error : ".$e->getMessage(); |
| 87 | 87 | } |
| 88 | 88 | //$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)'; |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 94 | 94 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 95 | 95 | //$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); |
| 96 | - $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); |
|
| 96 | + $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); |
|
| 97 | 97 | $sth_dest->execute($query_dest_values); |
| 98 | 98 | } |
| 99 | 99 | if ($globalTransaction) $Connection->db->commit(); |
| 100 | - } catch(PDOException $e) { |
|
| 100 | + } catch (PDOException $e) { |
|
| 101 | 101 | if ($globalTransaction) $Connection->db->rollBack(); |
| 102 | 102 | return "error : ".$e->getMessage(); |
| 103 | 103 | } |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | $Connection = new Connection(); |
| 112 | 112 | $sth = $Connection->db->prepare($query); |
| 113 | 113 | $sth->execute(array(':source' => $database_file)); |
| 114 | - } catch(PDOException $e) { |
|
| 114 | + } catch (PDOException $e) { |
|
| 115 | 115 | return "error : ".$e->getMessage(); |
| 116 | 116 | } |
| 117 | 117 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $Connection = new Connection(); |
| 120 | 120 | $sth = $Connection->db->prepare($query); |
| 121 | 121 | $sth->execute(array(':source' => $database_file)); |
| 122 | - } catch(PDOException $e) { |
|
| 122 | + } catch (PDOException $e) { |
|
| 123 | 123 | return "error : ".$e->getMessage(); |
| 124 | 124 | } |
| 125 | 125 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | try { |
| 129 | 129 | $sth = update_db::$db_sqlite->prepare($query); |
| 130 | 130 | $sth->execute(); |
| 131 | - } catch(PDOException $e) { |
|
| 131 | + } catch (PDOException $e) { |
|
| 132 | 132 | return "error : ".$e->getMessage(); |
| 133 | 133 | } |
| 134 | 134 | //$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)'; |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | //$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']); |
| 146 | 146 | if ($values['UserString4'] == 'M') $type = 'military'; |
| 147 | 147 | else $type = null; |
| 148 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
| 148 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
| 149 | 149 | $sth_dest->execute($query_dest_values); |
| 150 | 150 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
| 151 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 151 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
| 152 | 152 | $sth_dest_owner->execute($query_dest_owner_values); |
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | if ($globalTransaction) $Connection->db->commit(); |
| 156 | - } catch(PDOException $e) { |
|
| 156 | + } catch (PDOException $e) { |
|
| 157 | 157 | return "error : ".$e->getMessage(); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $Connection = new Connection(); |
| 163 | 163 | $sth = $Connection->db->prepare($query); |
| 164 | 164 | $sth->execute(array(':source' => $database_file)); |
| 165 | - } catch(PDOException $e) { |
|
| 165 | + } catch (PDOException $e) { |
|
| 166 | 166 | return "error : ".$e->getMessage(); |
| 167 | 167 | } |
| 168 | 168 | return ''; |
@@ -177,11 +177,11 @@ discard block |
||
| 177 | 177 | $Connection = new Connection(); |
| 178 | 178 | $sth = $Connection->db->prepare($query); |
| 179 | 179 | $sth->execute(array(':source' => $database_file)); |
| 180 | - } catch(PDOException $e) { |
|
| 180 | + } catch (PDOException $e) { |
|
| 181 | 181 | return "error : ".$e->getMessage(); |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - if ($fh = fopen($database_file,"r")) { |
|
| 184 | + if ($fh = fopen($database_file, "r")) { |
|
| 185 | 185 | //$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)'; |
| 186 | 186 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)'; |
| 187 | 187 | |
@@ -190,13 +190,13 @@ discard block |
||
| 190 | 190 | try { |
| 191 | 191 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 192 | 192 | while (!feof($fh)) { |
| 193 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
| 193 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
| 194 | 194 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 195 | - $values['ModeS'] = substr($line,0,6); |
|
| 196 | - $values['Registration'] = trim(substr($line,69,6)); |
|
| 197 | - $aircraft_name = trim(substr($line,48,6)); |
|
| 195 | + $values['ModeS'] = substr($line, 0, 6); |
|
| 196 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
| 197 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
| 198 | 198 | // Check if we can find ICAO, else set it to GLID |
| 199 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 199 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 200 | 200 | $search_more = ''; |
| 201 | 201 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 202 | 202 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -208,20 +208,20 @@ discard block |
||
| 208 | 208 | if (isset($result['icao']) && $result['icao'] != '') { |
| 209 | 209 | $values['ICAOTypeCode'] = $result['icao']; |
| 210 | 210 | } |
| 211 | - } catch(PDOException $e) { |
|
| 211 | + } catch (PDOException $e) { |
|
| 212 | 212 | return "error : ".$e->getMessage(); |
| 213 | 213 | } |
| 214 | 214 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 215 | 215 | // Add data to db |
| 216 | 216 | if ($values['ModeS'] != '' && $values['Registration'] != '' && $values['Registration'] != '0000') { |
| 217 | 217 | //$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']); |
| 218 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file); |
|
| 218 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file); |
|
| 219 | 219 | //print_r($query_dest_values); |
| 220 | 220 | $sth_dest->execute($query_dest_values); |
| 221 | 221 | } |
| 222 | 222 | } |
| 223 | 223 | if ($globalTransaction) $Connection->db->commit(); |
| 224 | - } catch(PDOException $e) { |
|
| 224 | + } catch (PDOException $e) { |
|
| 225 | 225 | return "error : ".$e->getMessage(); |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $Connection = new Connection(); |
| 232 | 232 | $sth = $Connection->db->prepare($query); |
| 233 | 233 | $sth->execute(array(':source' => $database_file)); |
| 234 | - } catch(PDOException $e) { |
|
| 234 | + } catch (PDOException $e) { |
|
| 235 | 235 | return "error : ".$e->getMessage(); |
| 236 | 236 | } |
| 237 | 237 | return ''; |
@@ -245,11 +245,11 @@ discard block |
||
| 245 | 245 | $Connection = new Connection(); |
| 246 | 246 | $sth = $Connection->db->prepare($query); |
| 247 | 247 | $sth->execute(array(':source' => $database_file)); |
| 248 | - } catch(PDOException $e) { |
|
| 248 | + } catch (PDOException $e) { |
|
| 249 | 249 | return "error : ".$e->getMessage(); |
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - if ($fh = fopen($database_file,"r")) { |
|
| 252 | + if ($fh = fopen($database_file, "r")) { |
|
| 253 | 253 | //$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)'; |
| 254 | 254 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)'; |
| 255 | 255 | |
@@ -257,9 +257,9 @@ discard block |
||
| 257 | 257 | $sth_dest = $Connection->db->prepare($query_dest); |
| 258 | 258 | try { |
| 259 | 259 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 260 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
| 260 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
| 261 | 261 | while (!feof($fh)) { |
| 262 | - $line = fgetcsv($fh,9999,',',"'"); |
|
| 262 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
| 263 | 263 | |
| 264 | 264 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 265 | 265 | //print_r($line); |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $values['Registration'] = $line[3]; |
| 268 | 268 | $aircraft_name = $line[2]; |
| 269 | 269 | // Check if we can find ICAO, else set it to GLID |
| 270 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 270 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 271 | 271 | $search_more = ''; |
| 272 | 272 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 273 | 273 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -276,20 +276,20 @@ discard block |
||
| 276 | 276 | $sth_search->execute(); |
| 277 | 277 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 278 | 278 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
| 279 | - } catch(PDOException $e) { |
|
| 279 | + } catch (PDOException $e) { |
|
| 280 | 280 | return "error : ".$e->getMessage(); |
| 281 | 281 | } |
| 282 | 282 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 283 | 283 | // Add data to db |
| 284 | 284 | if ($values['ModeS'] != '' && $values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
| 285 | 285 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
| 286 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file); |
|
| 286 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file); |
|
| 287 | 287 | //print_r($query_dest_values); |
| 288 | 288 | $sth_dest->execute($query_dest_values); |
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | if ($globalTransaction) $Connection->db->commit(); |
| 292 | - } catch(PDOException $e) { |
|
| 292 | + } catch (PDOException $e) { |
|
| 293 | 293 | return "error : ".$e->getMessage(); |
| 294 | 294 | } |
| 295 | 295 | } |
@@ -299,13 +299,13 @@ discard block |
||
| 299 | 299 | $Connection = new Connection(); |
| 300 | 300 | $sth = $Connection->db->prepare($query); |
| 301 | 301 | $sth->execute(array(':source' => $database_file)); |
| 302 | - } catch(PDOException $e) { |
|
| 302 | + } catch (PDOException $e) { |
|
| 303 | 303 | return "error : ".$e->getMessage(); |
| 304 | 304 | } |
| 305 | 305 | return ''; |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
| 308 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
| 309 | 309 | global $globalTransaction; |
| 310 | 310 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
| 311 | 311 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -313,11 +313,11 @@ discard block |
||
| 313 | 313 | $Connection = new Connection(); |
| 314 | 314 | $sth = $Connection->db->prepare($query); |
| 315 | 315 | $sth->execute(array(':source' => $database_file)); |
| 316 | - } catch(PDOException $e) { |
|
| 316 | + } catch (PDOException $e) { |
|
| 317 | 317 | return "error : ".$e->getMessage(); |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if ($fh = fopen($database_file,"r")) { |
|
| 320 | + if ($fh = fopen($database_file, "r")) { |
|
| 321 | 321 | //$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)'; |
| 322 | 322 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 323 | 323 | |
@@ -325,16 +325,16 @@ discard block |
||
| 325 | 325 | $sth_dest = $Connection->db->prepare($query_dest); |
| 326 | 326 | try { |
| 327 | 327 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 328 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
| 328 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
| 329 | 329 | while (!feof($fh)) { |
| 330 | - $line = fgetcsv($fh,9999,',','"'); |
|
| 330 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
| 331 | 331 | //print_r($line); |
| 332 | 332 | if ($country == 'F') { |
| 333 | 333 | $values['registration'] = $line[0]; |
| 334 | 334 | $values['base'] = $line[4]; |
| 335 | 335 | $values['owner'] = $line[5]; |
| 336 | 336 | if ($line[6] == '') $values['date_first_reg'] = ''; |
| 337 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 337 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 338 | 338 | $values['cancel'] = $line[7]; |
| 339 | 339 | } elseif ($country == 'EI') { |
| 340 | 340 | // TODO : add modeS & reg to aircraft_modes |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | $values['base'] = $line[3]; |
| 343 | 343 | $values['owner'] = $line[2]; |
| 344 | 344 | if ($line[1] == '') $values['date_first_reg'] = ''; |
| 345 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 345 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
| 346 | 346 | $values['cancel'] = ''; |
| 347 | 347 | } elseif ($country == 'HB') { |
| 348 | 348 | // TODO : add modeS & reg to aircraft_modes |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | $values['base'] = null; |
| 358 | 358 | $values['owner'] = $line[5]; |
| 359 | 359 | if ($line[18] == '') $values['date_first_reg'] = ''; |
| 360 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 360 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
| 361 | 361 | $values['cancel'] = ''; |
| 362 | 362 | } elseif ($country == 'VH') { |
| 363 | 363 | // TODO : add modeS & reg to aircraft_modes |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | $values['base'] = null; |
| 366 | 366 | $values['owner'] = $line[12]; |
| 367 | 367 | if ($line[28] == '') $values['date_first_reg'] = ''; |
| 368 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 368 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
| 369 | 369 | |
| 370 | 370 | $values['cancel'] = $line[39]; |
| 371 | 371 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -385,28 +385,28 @@ discard block |
||
| 385 | 385 | $values['base'] = null; |
| 386 | 386 | $values['owner'] = $line[8]; |
| 387 | 387 | if ($line[7] == '') $values['date_first_reg'] = ''; |
| 388 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 388 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 389 | 389 | $values['cancel'] = ''; |
| 390 | 390 | } elseif ($country == 'PP') { |
| 391 | 391 | $values['registration'] = $line[0]; |
| 392 | 392 | $values['base'] = null; |
| 393 | 393 | $values['owner'] = $line[4]; |
| 394 | 394 | if ($line[6] == '') $values['date_first_reg'] = ''; |
| 395 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 395 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 396 | 396 | $values['cancel'] = $line[7]; |
| 397 | 397 | } elseif ($country == 'E7') { |
| 398 | 398 | $values['registration'] = $line[0]; |
| 399 | 399 | $values['base'] = null; |
| 400 | 400 | $values['owner'] = $line[4]; |
| 401 | 401 | if ($line[5] == '') $values['date_first_reg'] = ''; |
| 402 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 402 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
| 403 | 403 | $values['cancel'] = ''; |
| 404 | 404 | } elseif ($country == '8Q') { |
| 405 | 405 | $values['registration'] = $line[0]; |
| 406 | 406 | $values['base'] = null; |
| 407 | 407 | $values['owner'] = $line[3]; |
| 408 | 408 | if ($line[7] == '') $values['date_first_reg'] = ''; |
| 409 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 409 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 410 | 410 | $values['cancel'] = ''; |
| 411 | 411 | } elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') { |
| 412 | 412 | $values['registration'] = $line[0]; |
@@ -416,12 +416,12 @@ discard block |
||
| 416 | 416 | $values['cancel'] = ''; |
| 417 | 417 | } |
| 418 | 418 | if ($values['cancel'] == '' && $values['registration'] != null) { |
| 419 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
| 419 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
| 420 | 420 | $sth_dest->execute($query_dest_values); |
| 421 | 421 | } |
| 422 | 422 | } |
| 423 | 423 | if ($globalTransaction) $Connection->db->commit(); |
| 424 | - } catch(PDOException $e) { |
|
| 424 | + } catch (PDOException $e) { |
|
| 425 | 425 | return "error : ".$e->getMessage(); |
| 426 | 426 | } |
| 427 | 427 | } |
@@ -536,7 +536,7 @@ discard block |
||
| 536 | 536 | $Connection = new Connection(); |
| 537 | 537 | $sth = $Connection->db->prepare($query); |
| 538 | 538 | $sth->execute(); |
| 539 | - } catch(PDOException $e) { |
|
| 539 | + } catch (PDOException $e) { |
|
| 540 | 540 | return "error : ".$e->getMessage(); |
| 541 | 541 | } |
| 542 | 542 | |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | $Connection = new Connection(); |
| 547 | 547 | $sth = $Connection->db->prepare($query); |
| 548 | 548 | $sth->execute(); |
| 549 | - } catch(PDOException $e) { |
|
| 549 | + } catch (PDOException $e) { |
|
| 550 | 550 | return "error : ".$e->getMessage(); |
| 551 | 551 | } |
| 552 | 552 | |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 558 | 558 | |
| 559 | 559 | $i = 0; |
| 560 | - while($row = sparql_fetch_array($result)) |
|
| 560 | + while ($row = sparql_fetch_array($result)) |
|
| 561 | 561 | { |
| 562 | 562 | if ($i >= 1) { |
| 563 | 563 | //print_r($row); |
@@ -577,31 +577,31 @@ discard block |
||
| 577 | 577 | $row['image'] = ''; |
| 578 | 578 | $row['image_thumb'] = ''; |
| 579 | 579 | } else { |
| 580 | - $image = str_replace(' ','_',$row['image']); |
|
| 580 | + $image = str_replace(' ', '_', $row['image']); |
|
| 581 | 581 | $digest = md5($image); |
| 582 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
| 583 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
| 584 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
| 585 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
| 582 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
| 583 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
| 584 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
| 585 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
| 586 | 586 | } |
| 587 | 587 | |
| 588 | - $country = explode('-',$row['country']); |
|
| 588 | + $country = explode('-', $row['country']); |
|
| 589 | 589 | $row['country'] = $country[0]; |
| 590 | 590 | |
| 591 | 591 | $row['type'] = trim($row['type']); |
| 592 | - 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'])) { |
|
| 592 | + 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'])) { |
|
| 593 | 593 | $row['type'] = 'Military'; |
| 594 | 594 | } 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') { |
| 595 | 595 | $row['type'] = 'small_airport'; |
| 596 | 596 | } |
| 597 | 597 | |
| 598 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
| 599 | - $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $row['altitude'],':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
| 598 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
| 599 | + $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => $row['altitude'], ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
| 600 | 600 | //print_r($query_dest_values); |
| 601 | 601 | |
| 602 | 602 | try { |
| 603 | 603 | $sth_dest->execute($query_dest_values); |
| 604 | - } catch(PDOException $e) { |
|
| 604 | + } catch (PDOException $e) { |
|
| 605 | 605 | return "error : ".$e->getMessage(); |
| 606 | 606 | } |
| 607 | 607 | } |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | $Connection = new Connection(); |
| 616 | 616 | $sth = $Connection->db->prepare($query); |
| 617 | 617 | $sth->execute(); |
| 618 | - } catch(PDOException $e) { |
|
| 618 | + } catch (PDOException $e) { |
|
| 619 | 619 | return "error : ".$e->getMessage(); |
| 620 | 620 | } |
| 621 | 621 | |
@@ -623,12 +623,12 @@ discard block |
||
| 623 | 623 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
| 624 | 624 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
| 625 | 625 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
| 626 | - $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
|
| 626 | + $query_values = array(':airport_id' => $i, ':name' => 'Not available', ':iata' => 'NA', ':icao' => 'NA', ':latitude' => '0', ':longitude' => '0', ':altitude' => '0', ':type' => 'NA', ':city' => 'N/A', ':country' => 'N/A', ':home_link' => '', ':wikipedia_link' => '', ':image' => '', ':image_thumb' => ''); |
|
| 627 | 627 | try { |
| 628 | 628 | $Connection = new Connection(); |
| 629 | 629 | $sth = $Connection->db->prepare($query); |
| 630 | 630 | $sth->execute($query_values); |
| 631 | - } catch(PDOException $e) { |
|
| 631 | + } catch (PDOException $e) { |
|
| 632 | 632 | return "error : ".$e->getMessage(); |
| 633 | 633 | } |
| 634 | 634 | $i++; |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | echo "Download data from ourairports.com...\n"; |
| 647 | 647 | $delimiter = ','; |
| 648 | 648 | $out_file = $tmp_dir.'airports.csv'; |
| 649 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
| 649 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
| 650 | 650 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 651 | 651 | echo "Add data from ourairports.com...\n"; |
| 652 | 652 | |
@@ -657,32 +657,32 @@ discard block |
||
| 657 | 657 | //$Connection->db->beginTransaction(); |
| 658 | 658 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 659 | 659 | { |
| 660 | - if(!$header) $header = $row; |
|
| 660 | + if (!$header) $header = $row; |
|
| 661 | 661 | else { |
| 662 | 662 | $data = array(); |
| 663 | 663 | $data = array_combine($header, $row); |
| 664 | 664 | try { |
| 665 | 665 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao'); |
| 666 | 666 | $sth->execute(array(':icao' => $data['gps_code'])); |
| 667 | - } catch(PDOException $e) { |
|
| 667 | + } catch (PDOException $e) { |
|
| 668 | 668 | return "error : ".$e->getMessage(); |
| 669 | 669 | } |
| 670 | 670 | if ($sth->fetchColumn() > 0) { |
| 671 | 671 | $query = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
| 672 | 672 | try { |
| 673 | 673 | $sth = $Connection->db->prepare($query); |
| 674 | - $sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type'])); |
|
| 675 | - } catch(PDOException $e) { |
|
| 674 | + $sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type'])); |
|
| 675 | + } catch (PDOException $e) { |
|
| 676 | 676 | return "error : ".$e->getMessage(); |
| 677 | 677 | } |
| 678 | 678 | } else { |
| 679 | 679 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`) |
| 680 | 680 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
| 681 | - $query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
| 681 | + $query_values = array(':airport_id' => $i, ':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => $data['elevation_ft'], ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
| 682 | 682 | try { |
| 683 | 683 | $sth = $Connection->db->prepare($query); |
| 684 | 684 | $sth->execute($query_values); |
| 685 | - } catch(PDOException $e) { |
|
| 685 | + } catch (PDOException $e) { |
|
| 686 | 686 | return "error : ".$e->getMessage(); |
| 687 | 687 | } |
| 688 | 688 | $i++; |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | |
| 696 | 696 | echo "Download data from another free database...\n"; |
| 697 | 697 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 698 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
| 698 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
| 699 | 699 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 700 | 700 | update_db::unzip($out_file); |
| 701 | 701 | $header = NULL; |
@@ -707,15 +707,15 @@ discard block |
||
| 707 | 707 | //$Connection->db->beginTransaction(); |
| 708 | 708 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 709 | 709 | { |
| 710 | - if(!$header) $header = $row; |
|
| 710 | + if (!$header) $header = $row; |
|
| 711 | 711 | else { |
| 712 | 712 | $data = $row; |
| 713 | 713 | |
| 714 | 714 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
| 715 | 715 | try { |
| 716 | 716 | $sth = $Connection->db->prepare($query); |
| 717 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
| 718 | - } catch(PDOException $e) { |
|
| 717 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
| 718 | + } catch (PDOException $e) { |
|
| 719 | 719 | return "error : ".$e->getMessage(); |
| 720 | 720 | } |
| 721 | 721 | } |
@@ -729,15 +729,15 @@ discard block |
||
| 729 | 729 | try { |
| 730 | 730 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'"); |
| 731 | 731 | $sth->execute(); |
| 732 | - } catch(PDOException $e) { |
|
| 732 | + } catch (PDOException $e) { |
|
| 733 | 733 | return "error : ".$e->getMessage(); |
| 734 | 734 | } |
| 735 | 735 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 736 | 736 | $query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
| 737 | 737 | try { |
| 738 | 738 | $sth2 = $Connection->db->prepare($query2); |
| 739 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
| 740 | - } catch(PDOException $e) { |
|
| 739 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
| 740 | + } catch (PDOException $e) { |
|
| 741 | 741 | return "error : ".$e->getMessage(); |
| 742 | 742 | } |
| 743 | 743 | } |
@@ -761,7 +761,7 @@ discard block |
||
| 761 | 761 | $Connection = new Connection(); |
| 762 | 762 | $sth = $Connection->db->prepare($query); |
| 763 | 763 | $sth->execute(array(':source' => 'translation.csv')); |
| 764 | - } catch(PDOException $e) { |
|
| 764 | + } catch (PDOException $e) { |
|
| 765 | 765 | return "error : ".$e->getMessage(); |
| 766 | 766 | } |
| 767 | 767 | |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 779 | 779 | { |
| 780 | 780 | $i++; |
| 781 | - if($i > 12) { |
|
| 781 | + if ($i > 12) { |
|
| 782 | 782 | $data = $row; |
| 783 | 783 | $operator = $data[2]; |
| 784 | 784 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | //echo substr($operator, 0, 2)."\n";; |
| 787 | 787 | if (count($airline_array) > 0) { |
| 788 | 788 | //print_r($airline_array); |
| 789 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
| 789 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
| 790 | 790 | } |
| 791 | 791 | } |
| 792 | 792 | |
@@ -794,14 +794,14 @@ discard block |
||
| 794 | 794 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
| 795 | 795 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
| 796 | 796 | if (count($airline_array) > 0) { |
| 797 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 797 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
| 798 | 798 | } |
| 799 | 799 | } |
| 800 | 800 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 801 | 801 | try { |
| 802 | 802 | $sth = $Connection->db->prepare($query); |
| 803 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 804 | - } catch(PDOException $e) { |
|
| 803 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 804 | + } catch (PDOException $e) { |
|
| 805 | 805 | return "error : ".$e->getMessage(); |
| 806 | 806 | } |
| 807 | 807 | } |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | $Connection = new Connection(); |
| 822 | 822 | $sth = $Connection->db->prepare($query); |
| 823 | 823 | $sth->execute(array(':source' => 'website_fam')); |
| 824 | - } catch(PDOException $e) { |
|
| 824 | + } catch (PDOException $e) { |
|
| 825 | 825 | return "error : ".$e->getMessage(); |
| 826 | 826 | } |
| 827 | 827 | |
@@ -841,8 +841,8 @@ discard block |
||
| 841 | 841 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 842 | 842 | try { |
| 843 | 843 | $sth = $Connection->db->prepare($query); |
| 844 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 845 | - } catch(PDOException $e) { |
|
| 844 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 845 | + } catch (PDOException $e) { |
|
| 846 | 846 | return "error : ".$e->getMessage(); |
| 847 | 847 | } |
| 848 | 848 | } |
@@ -861,28 +861,28 @@ discard block |
||
| 861 | 861 | */ |
| 862 | 862 | private static function table2array($data) { |
| 863 | 863 | $html = str_get_html($data); |
| 864 | - $tabledata=array(); |
|
| 865 | - foreach($html->find('tr') as $element) |
|
| 864 | + $tabledata = array(); |
|
| 865 | + foreach ($html->find('tr') as $element) |
|
| 866 | 866 | { |
| 867 | 867 | $td = array(); |
| 868 | - foreach( $element->find('th') as $row) |
|
| 868 | + foreach ($element->find('th') as $row) |
|
| 869 | 869 | { |
| 870 | 870 | $td [] = trim($row->plaintext); |
| 871 | 871 | } |
| 872 | - $td=array_filter($td); |
|
| 872 | + $td = array_filter($td); |
|
| 873 | 873 | $tabledata[] = $td; |
| 874 | 874 | |
| 875 | 875 | $td = array(); |
| 876 | 876 | $tdi = array(); |
| 877 | - foreach( $element->find('td') as $row) |
|
| 877 | + foreach ($element->find('td') as $row) |
|
| 878 | 878 | { |
| 879 | 879 | $td [] = trim($row->plaintext); |
| 880 | 880 | $tdi [] = trim($row->innertext); |
| 881 | 881 | } |
| 882 | - $td=array_filter($td); |
|
| 883 | - $tdi=array_filter($tdi); |
|
| 882 | + $td = array_filter($td); |
|
| 883 | + $tdi = array_filter($tdi); |
|
| 884 | 884 | // $tabledata[]=array_merge($td,$tdi); |
| 885 | - $tabledata[]=$td; |
|
| 885 | + $tabledata[] = $td; |
|
| 886 | 886 | } |
| 887 | 887 | return(array_filter($tabledata)); |
| 888 | 888 | } |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | $Connection = new Connection(); |
| 951 | 951 | $sth = $Connection->db->prepare($query); |
| 952 | 952 | $sth->execute(); |
| 953 | - } catch(PDOException $e) { |
|
| 953 | + } catch (PDOException $e) { |
|
| 954 | 954 | return "error : ".$e->getMessage(); |
| 955 | 955 | } |
| 956 | 956 | |
@@ -966,13 +966,13 @@ discard block |
||
| 966 | 966 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 967 | 967 | { |
| 968 | 968 | $i++; |
| 969 | - if($i > 3 && count($row) > 2) { |
|
| 969 | + if ($i > 3 && count($row) > 2) { |
|
| 970 | 970 | $data = array_values(array_filter($row)); |
| 971 | 971 | $cntdata = count($data); |
| 972 | 972 | if ($cntdata > 10) { |
| 973 | 973 | $value = $data[9]; |
| 974 | 974 | |
| 975 | - for ($i =10;$i < $cntdata;$i++) { |
|
| 975 | + for ($i = 10; $i < $cntdata; $i++) { |
|
| 976 | 976 | $value .= ' '.$data[$i]; |
| 977 | 977 | } |
| 978 | 978 | $data[9] = $value; |
@@ -982,8 +982,8 @@ discard block |
||
| 982 | 982 | $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)'; |
| 983 | 983 | try { |
| 984 | 984 | $sth = $Connection->db->prepare($query); |
| 985 | - $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])); |
|
| 986 | - } catch(PDOException $e) { |
|
| 985 | + $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])); |
|
| 986 | + } catch (PDOException $e) { |
|
| 987 | 987 | return "error : ".$e->getMessage(); |
| 988 | 988 | } |
| 989 | 989 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | $Connection = new Connection(); |
| 1004 | 1004 | $sth = $Connection->db->prepare($query); |
| 1005 | 1005 | $sth->execute(); |
| 1006 | - } catch(PDOException $e) { |
|
| 1006 | + } catch (PDOException $e) { |
|
| 1007 | 1007 | return "error : ".$e->getMessage(); |
| 1008 | 1008 | } |
| 1009 | 1009 | |
@@ -1015,12 +1015,12 @@ discard block |
||
| 1015 | 1015 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1016 | 1016 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1017 | 1017 | { |
| 1018 | - if(count($row) > 1) { |
|
| 1018 | + if (count($row) > 1) { |
|
| 1019 | 1019 | $query = "INSERT INTO airlines (name,icao,active) VALUES (:name, :icao, 'Y')"; |
| 1020 | 1020 | try { |
| 1021 | 1021 | $sth = $Connection->db->prepare($query); |
| 1022 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
| 1023 | - } catch(PDOException $e) { |
|
| 1022 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
| 1023 | + } catch (PDOException $e) { |
|
| 1024 | 1024 | return "error : ".$e->getMessage(); |
| 1025 | 1025 | } |
| 1026 | 1026 | } |
@@ -1034,15 +1034,15 @@ discard block |
||
| 1034 | 1034 | public static function update_airspace() { |
| 1035 | 1035 | global $tmp_dir, $globalDBdriver; |
| 1036 | 1036 | include_once('class.create_db.php'); |
| 1037 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1037 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 1038 | 1038 | else { |
| 1039 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1039 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 1040 | 1040 | $query = "CREATE EXTENSION postgis"; |
| 1041 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
| 1041 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
| 1042 | 1042 | try { |
| 1043 | 1043 | $sth = $Connection->db->prepare($query); |
| 1044 | 1044 | $sth->execute(); |
| 1045 | - } catch(PDOException $e) { |
|
| 1045 | + } catch (PDOException $e) { |
|
| 1046 | 1046 | return "error : ".$e->getMessage(); |
| 1047 | 1047 | } |
| 1048 | 1048 | } |
@@ -1066,14 +1066,14 @@ discard block |
||
| 1066 | 1066 | try { |
| 1067 | 1067 | $sth = $Connection->db->prepare($query); |
| 1068 | 1068 | $sth->execute(); |
| 1069 | - } catch(PDOException $e) { |
|
| 1069 | + } catch (PDOException $e) { |
|
| 1070 | 1070 | echo "error : ".$e->getMessage(); |
| 1071 | 1071 | } |
| 1072 | 1072 | } |
| 1073 | 1073 | if ($globalDBdriver == 'mysql') { |
| 1074 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 1074 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 1075 | 1075 | } else { |
| 1076 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 1076 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 1077 | 1077 | } |
| 1078 | 1078 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
| 1079 | 1079 | return $error; |
@@ -1086,7 +1086,7 @@ discard block |
||
| 1086 | 1086 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
| 1087 | 1087 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
| 1088 | 1088 | // 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'); |
| 1089 | - 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'); |
|
| 1089 | + 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'); |
|
| 1090 | 1090 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
| 1091 | 1091 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
| 1092 | 1092 | return $error; |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 1107 | 1107 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
| 1108 | 1108 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 1109 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 1109 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 1110 | 1110 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
| 1111 | 1111 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
| 1112 | 1112 | if ($error != '') { |
@@ -1119,7 +1119,7 @@ discard block |
||
| 1119 | 1119 | global $tmp_dir, $globalDebug; |
| 1120 | 1120 | $error = ''; |
| 1121 | 1121 | if ($globalDebug) echo "Routes : Download..."; |
| 1122 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
| 1122 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
| 1123 | 1123 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 1124 | 1124 | if ($globalDebug) echo "Gunzip..."; |
| 1125 | 1125 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1146,7 +1146,7 @@ discard block |
||
| 1146 | 1146 | } elseif ($globalDebug) echo "Done\n"; |
| 1147 | 1147 | */ |
| 1148 | 1148 | if ($globalDebug) echo "Modes : Download..."; |
| 1149 | - update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 1149 | + update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip', $tmp_dir.'basestation_latest.zip', 'http://planebase.biz/bstnsqb'); |
|
| 1150 | 1150 | if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 1151 | 1151 | if ($globalDebug) echo "Unzip..."; |
| 1152 | 1152 | update_db::unzip($tmp_dir.'basestation_latest.zip'); |
@@ -1162,7 +1162,7 @@ discard block |
||
| 1162 | 1162 | public static function update_ModeS_flarm() { |
| 1163 | 1163 | global $tmp_dir, $globalDebug; |
| 1164 | 1164 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
| 1165 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
| 1165 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
| 1166 | 1166 | if (file_exists($tmp_dir.'data.fln')) { |
| 1167 | 1167 | if ($globalDebug) echo "Add to DB..."; |
| 1168 | 1168 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -1176,7 +1176,7 @@ discard block |
||
| 1176 | 1176 | public static function update_ModeS_ogn() { |
| 1177 | 1177 | global $tmp_dir, $globalDebug; |
| 1178 | 1178 | if ($globalDebug) echo "Modes OGN: Download..."; |
| 1179 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
| 1179 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
| 1180 | 1180 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 1181 | 1181 | if ($globalDebug) echo "Add to DB..."; |
| 1182 | 1182 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -1191,173 +1191,173 @@ discard block |
||
| 1191 | 1191 | global $tmp_dir, $globalDebug; |
| 1192 | 1192 | |
| 1193 | 1193 | if ($globalDebug) echo "Owner France: Download..."; |
| 1194 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
| 1194 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
| 1195 | 1195 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 1196 | 1196 | if ($globalDebug) echo "Add to DB..."; |
| 1197 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
| 1197 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
| 1198 | 1198 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
| 1199 | 1199 | if ($error != '') { |
| 1200 | 1200 | return $error; |
| 1201 | 1201 | } elseif ($globalDebug) echo "Done\n"; |
| 1202 | 1202 | |
| 1203 | 1203 | if ($globalDebug) echo "Owner Ireland: Download..."; |
| 1204 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
| 1204 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
| 1205 | 1205 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 1206 | 1206 | if ($globalDebug) echo "Add to DB..."; |
| 1207 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
| 1207 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
| 1208 | 1208 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
| 1209 | 1209 | if ($error != '') { |
| 1210 | 1210 | return $error; |
| 1211 | 1211 | } elseif ($globalDebug) echo "Done\n"; |
| 1212 | 1212 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
| 1213 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
| 1213 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
| 1214 | 1214 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 1215 | 1215 | if ($globalDebug) echo "Add to DB..."; |
| 1216 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
| 1216 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
| 1217 | 1217 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
| 1218 | 1218 | if ($error != '') { |
| 1219 | 1219 | return $error; |
| 1220 | 1220 | } elseif ($globalDebug) echo "Done\n"; |
| 1221 | 1221 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
| 1222 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
| 1222 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
| 1223 | 1223 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 1224 | 1224 | if ($globalDebug) echo "Add to DB..."; |
| 1225 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
| 1225 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
| 1226 | 1226 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
| 1227 | 1227 | if ($error != '') { |
| 1228 | 1228 | return $error; |
| 1229 | 1229 | } elseif ($globalDebug) echo "Done\n"; |
| 1230 | 1230 | if ($globalDebug) echo "Owner Australia: Download..."; |
| 1231 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
| 1231 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
| 1232 | 1232 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 1233 | 1233 | if ($globalDebug) echo "Add to DB..."; |
| 1234 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
| 1234 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
| 1235 | 1235 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
| 1236 | 1236 | if ($error != '') { |
| 1237 | 1237 | return $error; |
| 1238 | 1238 | } elseif ($globalDebug) echo "Done\n"; |
| 1239 | 1239 | if ($globalDebug) echo "Owner Austria: Download..."; |
| 1240 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
| 1240 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
| 1241 | 1241 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 1242 | 1242 | if ($globalDebug) echo "Add to DB..."; |
| 1243 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
| 1243 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
| 1244 | 1244 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
| 1245 | 1245 | if ($error != '') { |
| 1246 | 1246 | return $error; |
| 1247 | 1247 | } elseif ($globalDebug) echo "Done\n"; |
| 1248 | 1248 | if ($globalDebug) echo "Owner Chile: Download..."; |
| 1249 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
| 1249 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
| 1250 | 1250 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 1251 | 1251 | if ($globalDebug) echo "Add to DB..."; |
| 1252 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
| 1252 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
| 1253 | 1253 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
| 1254 | 1254 | if ($error != '') { |
| 1255 | 1255 | return $error; |
| 1256 | 1256 | } elseif ($globalDebug) echo "Done\n"; |
| 1257 | 1257 | if ($globalDebug) echo "Owner Colombia: Download..."; |
| 1258 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
| 1258 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
| 1259 | 1259 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 1260 | 1260 | if ($globalDebug) echo "Add to DB..."; |
| 1261 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
| 1261 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
| 1262 | 1262 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
| 1263 | 1263 | if ($error != '') { |
| 1264 | 1264 | return $error; |
| 1265 | 1265 | } elseif ($globalDebug) echo "Done\n"; |
| 1266 | 1266 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
| 1267 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
| 1267 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
| 1268 | 1268 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 1269 | 1269 | if ($globalDebug) echo "Add to DB..."; |
| 1270 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
| 1270 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
| 1271 | 1271 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
| 1272 | 1272 | if ($error != '') { |
| 1273 | 1273 | return $error; |
| 1274 | 1274 | } elseif ($globalDebug) echo "Done\n"; |
| 1275 | 1275 | if ($globalDebug) echo "Owner Brazil: Download..."; |
| 1276 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
| 1276 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
| 1277 | 1277 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 1278 | 1278 | if ($globalDebug) echo "Add to DB..."; |
| 1279 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
| 1279 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
| 1280 | 1280 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
| 1281 | 1281 | if ($error != '') { |
| 1282 | 1282 | return $error; |
| 1283 | 1283 | } elseif ($globalDebug) echo "Done\n"; |
| 1284 | 1284 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
| 1285 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
| 1285 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
| 1286 | 1286 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 1287 | 1287 | if ($globalDebug) echo "Add to DB..."; |
| 1288 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
| 1288 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
| 1289 | 1289 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
| 1290 | 1290 | if ($error != '') { |
| 1291 | 1291 | return $error; |
| 1292 | 1292 | } elseif ($globalDebug) echo "Done\n"; |
| 1293 | 1293 | if ($globalDebug) echo "Owner Croatia: Download..."; |
| 1294 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
| 1294 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
| 1295 | 1295 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 1296 | 1296 | if ($globalDebug) echo "Add to DB..."; |
| 1297 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
| 1297 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
| 1298 | 1298 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
| 1299 | 1299 | if ($error != '') { |
| 1300 | 1300 | return $error; |
| 1301 | 1301 | } elseif ($globalDebug) echo "Done\n"; |
| 1302 | 1302 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
| 1303 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
| 1303 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
| 1304 | 1304 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 1305 | 1305 | if ($globalDebug) echo "Add to DB..."; |
| 1306 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
| 1306 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
| 1307 | 1307 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
| 1308 | 1308 | if ($error != '') { |
| 1309 | 1309 | return $error; |
| 1310 | 1310 | } elseif ($globalDebug) echo "Done\n"; |
| 1311 | 1311 | if ($globalDebug) echo "Owner Maldives: Download..."; |
| 1312 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
| 1312 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
| 1313 | 1313 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 1314 | 1314 | if ($globalDebug) echo "Add to DB..."; |
| 1315 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
| 1315 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
| 1316 | 1316 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
| 1317 | 1317 | if ($error != '') { |
| 1318 | 1318 | return $error; |
| 1319 | 1319 | } elseif ($globalDebug) echo "Done\n"; |
| 1320 | 1320 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
| 1321 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
| 1321 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
| 1322 | 1322 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 1323 | 1323 | if ($globalDebug) echo "Add to DB..."; |
| 1324 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
| 1324 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
| 1325 | 1325 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
| 1326 | 1326 | if ($error != '') { |
| 1327 | 1327 | return $error; |
| 1328 | 1328 | } elseif ($globalDebug) echo "Done\n"; |
| 1329 | 1329 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
| 1330 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
| 1330 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
| 1331 | 1331 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 1332 | 1332 | if ($globalDebug) echo "Add to DB..."; |
| 1333 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
| 1333 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
| 1334 | 1334 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
| 1335 | 1335 | if ($error != '') { |
| 1336 | 1336 | return $error; |
| 1337 | 1337 | } elseif ($globalDebug) echo "Done\n"; |
| 1338 | 1338 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
| 1339 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
| 1339 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
| 1340 | 1340 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 1341 | 1341 | if ($globalDebug) echo "Add to DB..."; |
| 1342 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
| 1342 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
| 1343 | 1343 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
| 1344 | 1344 | if ($error != '') { |
| 1345 | 1345 | return $error; |
| 1346 | 1346 | } elseif ($globalDebug) echo "Done\n"; |
| 1347 | 1347 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
| 1348 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
| 1348 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
| 1349 | 1349 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 1350 | 1350 | if ($globalDebug) echo "Add to DB..."; |
| 1351 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
| 1351 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
| 1352 | 1352 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
| 1353 | 1353 | if ($error != '') { |
| 1354 | 1354 | return $error; |
| 1355 | 1355 | } elseif ($globalDebug) echo "Done\n"; |
| 1356 | 1356 | if ($globalDebug) echo "Owner Iceland: Download..."; |
| 1357 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
| 1357 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
| 1358 | 1358 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 1359 | 1359 | if ($globalDebug) echo "Add to DB..."; |
| 1360 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
| 1360 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
| 1361 | 1361 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
| 1362 | 1362 | if ($error != '') { |
| 1363 | 1363 | return $error; |
@@ -1369,7 +1369,7 @@ discard block |
||
| 1369 | 1369 | global $tmp_dir, $globalDebug; |
| 1370 | 1370 | $error = ''; |
| 1371 | 1371 | if ($globalDebug) echo "Translation : Download..."; |
| 1372 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
| 1372 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
| 1373 | 1373 | if (file_exists($tmp_dir.'translation.zip')) { |
| 1374 | 1374 | if ($globalDebug) echo "Unzip..."; |
| 1375 | 1375 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -1386,7 +1386,7 @@ discard block |
||
| 1386 | 1386 | global $tmp_dir, $globalDebug; |
| 1387 | 1387 | $error = ''; |
| 1388 | 1388 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
| 1389 | - update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
| 1389 | + update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
| 1390 | 1390 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
| 1391 | 1391 | if ($globalDebug) echo "Gunzip..."; |
| 1392 | 1392 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -1414,8 +1414,8 @@ discard block |
||
| 1414 | 1414 | */ |
| 1415 | 1415 | if (file_exists($tmp_dir.'aircrafts.html')) { |
| 1416 | 1416 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
| 1417 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 1418 | - $result = fread($fh,100000000); |
|
| 1417 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
| 1418 | + $result = fread($fh, 100000000); |
|
| 1419 | 1419 | //echo $result; |
| 1420 | 1420 | //var_dump(str_get_html($result)); |
| 1421 | 1421 | //print_r(self::table2array($result)); |
@@ -1433,23 +1433,23 @@ discard block |
||
| 1433 | 1433 | $Connection = new Connection(); |
| 1434 | 1434 | $sth = $Connection->db->prepare($query); |
| 1435 | 1435 | $sth->execute(); |
| 1436 | - } catch(PDOException $e) { |
|
| 1436 | + } catch (PDOException $e) { |
|
| 1437 | 1437 | return "error : ".$e->getMessage(); |
| 1438 | 1438 | } |
| 1439 | 1439 | |
| 1440 | 1440 | $error = ''; |
| 1441 | 1441 | if ($globalDebug) echo "Notam : Download..."; |
| 1442 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
| 1442 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
| 1443 | 1443 | if (file_exists($tmp_dir.'notam.rss')) { |
| 1444 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
| 1444 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
| 1445 | 1445 | foreach ($notams['channel']['item'] as $notam) { |
| 1446 | - $title = explode(':',$notam['title']); |
|
| 1446 | + $title = explode(':', $notam['title']); |
|
| 1447 | 1447 | $data['ref'] = trim($title[0]); |
| 1448 | 1448 | unset($title[0]); |
| 1449 | - $data['title'] = trim(implode(':',$title)); |
|
| 1450 | - $description = strip_tags($notam['description'],'<pre>'); |
|
| 1451 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
| 1452 | - $q = explode('/',$match[1]); |
|
| 1449 | + $data['title'] = trim(implode(':', $title)); |
|
| 1450 | + $description = strip_tags($notam['description'], '<pre>'); |
|
| 1451 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
| 1452 | + $q = explode('/', $match[1]); |
|
| 1453 | 1453 | $data['fir'] = $q[0]; |
| 1454 | 1454 | $data['code'] = $q[1]; |
| 1455 | 1455 | $ifrvfr = $q[2]; |
@@ -1465,30 +1465,30 @@ discard block |
||
| 1465 | 1465 | $data['lower_limit'] = $q[5]; |
| 1466 | 1466 | $data['upper_limit'] = $q[6]; |
| 1467 | 1467 | $latlonrad = $q[7]; |
| 1468 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
| 1469 | - $latitude = $Common->convertDec($las,'latitude'); |
|
| 1470 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
| 1468 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
| 1469 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
| 1470 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
| 1471 | 1471 | if ($lac == 'S') $latitude = '-'.$latitude; |
| 1472 | 1472 | if ($lnc == 'W') $longitude = '-'.$longitude; |
| 1473 | 1473 | $data['center_latitude'] = $latitude; |
| 1474 | 1474 | $data['center_longitude'] = $longitude; |
| 1475 | 1475 | $data['radius'] = intval($radius); |
| 1476 | 1476 | |
| 1477 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
| 1477 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
| 1478 | 1478 | $data['text'] = $match[1]; |
| 1479 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
| 1479 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
| 1480 | 1480 | $fromto = $match[1]; |
| 1481 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
| 1481 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
| 1482 | 1482 | $fromall = trim($match[1]); |
| 1483 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
| 1483 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
| 1484 | 1484 | $from = trim($match[1]); |
| 1485 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
| 1486 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
| 1485 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
| 1486 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
| 1487 | 1487 | $toall = trim($match[1]); |
| 1488 | - if (!preg_match(':Permanent:',$toall)) { |
|
| 1489 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
| 1488 | + if (!preg_match(':Permanent:', $toall)) { |
|
| 1489 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
| 1490 | 1490 | $to = trim($match[1]); |
| 1491 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
| 1491 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
| 1492 | 1492 | $data['permanent'] = 0; |
| 1493 | 1493 | } else { |
| 1494 | 1494 | $data['date_end'] = NULL; |
@@ -1496,7 +1496,7 @@ discard block |
||
| 1496 | 1496 | } |
| 1497 | 1497 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 1498 | 1498 | $NOTAM = new NOTAM(); |
| 1499 | - $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']); |
|
| 1499 | + $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']); |
|
| 1500 | 1500 | unset($data); |
| 1501 | 1501 | } |
| 1502 | 1502 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -1517,7 +1517,7 @@ discard block |
||
| 1517 | 1517 | $Connection = new Connection(); |
| 1518 | 1518 | $sth = $Connection->db->prepare($query); |
| 1519 | 1519 | $sth->execute(); |
| 1520 | - } catch(PDOException $e) { |
|
| 1520 | + } catch (PDOException $e) { |
|
| 1521 | 1521 | return "error : ".$e->getMessage(); |
| 1522 | 1522 | } |
| 1523 | 1523 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1532,7 +1532,7 @@ discard block |
||
| 1532 | 1532 | $Connection = new Connection(); |
| 1533 | 1533 | $sth = $Connection->db->prepare($query); |
| 1534 | 1534 | $sth->execute(); |
| 1535 | - } catch(PDOException $e) { |
|
| 1535 | + } catch (PDOException $e) { |
|
| 1536 | 1536 | return "error : ".$e->getMessage(); |
| 1537 | 1537 | } |
| 1538 | 1538 | } |
@@ -1548,7 +1548,7 @@ discard block |
||
| 1548 | 1548 | $Connection = new Connection(); |
| 1549 | 1549 | $sth = $Connection->db->prepare($query); |
| 1550 | 1550 | $sth->execute(); |
| 1551 | - } catch(PDOException $e) { |
|
| 1551 | + } catch (PDOException $e) { |
|
| 1552 | 1552 | return "error : ".$e->getMessage(); |
| 1553 | 1553 | } |
| 1554 | 1554 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | $Connection = new Connection(); |
| 1564 | 1564 | $sth = $Connection->db->prepare($query); |
| 1565 | 1565 | $sth->execute(); |
| 1566 | - } catch(PDOException $e) { |
|
| 1566 | + } catch (PDOException $e) { |
|
| 1567 | 1567 | return "error : ".$e->getMessage(); |
| 1568 | 1568 | } |
| 1569 | 1569 | } |
@@ -1579,7 +1579,7 @@ discard block |
||
| 1579 | 1579 | $Connection = new Connection(); |
| 1580 | 1580 | $sth = $Connection->db->prepare($query); |
| 1581 | 1581 | $sth->execute(); |
| 1582 | - } catch(PDOException $e) { |
|
| 1582 | + } catch (PDOException $e) { |
|
| 1583 | 1583 | return "error : ".$e->getMessage(); |
| 1584 | 1584 | } |
| 1585 | 1585 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -1594,7 +1594,7 @@ discard block |
||
| 1594 | 1594 | $Connection = new Connection(); |
| 1595 | 1595 | $sth = $Connection->db->prepare($query); |
| 1596 | 1596 | $sth->execute(); |
| 1597 | - } catch(PDOException $e) { |
|
| 1597 | + } catch (PDOException $e) { |
|
| 1598 | 1598 | return "error : ".$e->getMessage(); |
| 1599 | 1599 | } |
| 1600 | 1600 | } |
@@ -48,19 +48,27 @@ discard block |
||
| 48 | 48 | $globalDBSname = $globalDBname; |
| 49 | 49 | $globalDBSuser = $globalDBuser; |
| 50 | 50 | $globalDBSpass = $globalDBpass; |
| 51 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport = '') $globalDBSport = 3306; |
|
| 52 | - else $globalDBSport = $globalDBport; |
|
| 51 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport = '') { |
|
| 52 | + $globalDBSport = 3306; |
|
| 53 | + } else { |
|
| 54 | + $globalDBSport = $globalDBport; |
|
| 55 | + } |
|
| 53 | 56 | } else { |
| 54 | 57 | $globalDBSdriver = $globalDB[$DBname]['driver']; |
| 55 | 58 | $globalDBShost = $globalDB[$DBname]['host']; |
| 56 | 59 | $globalDBSname = $globalDB[$DBname]['name']; |
| 57 | 60 | $globalDBSuser = $globalDB[$DBname]['user']; |
| 58 | 61 | $globalDBSpass = $globalDB[$DBname]['pass']; |
| 59 | - if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port']; |
|
| 60 | - else $globalDBSport = 3306; |
|
| 62 | + if (isset($globalDB[$DBname]['port'])) { |
|
| 63 | + $globalDBSport = $globalDB[$DBname]['port']; |
|
| 64 | + } else { |
|
| 65 | + $globalDBSport = 3306; |
|
| 66 | + } |
|
| 61 | 67 | } |
| 62 | 68 | // Set number of try to connect to DB |
| 63 | - if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5; |
|
| 69 | + if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) { |
|
| 70 | + $globalDBretry = 5; |
|
| 71 | + } |
|
| 64 | 72 | $i = 0; |
| 65 | 73 | while (true) { |
| 66 | 74 | try { |
@@ -69,10 +77,16 @@ discard block |
||
| 69 | 77 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 70 | 78 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 71 | 79 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
| 72 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 73 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 74 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 75 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 80 | + if (!isset($globalDBTimeOut)) { |
|
| 81 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 82 | + } else { |
|
| 83 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 84 | + } |
|
| 85 | + if (!isset($globalDBPersistent)) { |
|
| 86 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 87 | + } else { |
|
| 88 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 89 | + } |
|
| 76 | 90 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 77 | 91 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
| 78 | 92 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -83,22 +97,34 @@ discard block |
||
| 83 | 97 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 84 | 98 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 85 | 99 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
| 86 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 87 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 88 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 89 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 100 | + if (!isset($globalDBTimeOut)) { |
|
| 101 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 102 | + } else { |
|
| 103 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 104 | + } |
|
| 105 | + if (!isset($globalDBPersistent)) { |
|
| 106 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 107 | + } else { |
|
| 108 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 109 | + } |
|
| 90 | 110 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 91 | 111 | } |
| 92 | 112 | break; |
| 93 | 113 | } catch(PDOException $e) { |
| 94 | 114 | $i++; |
| 95 | - if (isset($globalDebug) && $globalDebug) echo $e->getMessage()."\n"; |
|
| 115 | + if (isset($globalDebug) && $globalDebug) { |
|
| 116 | + echo $e->getMessage()."\n"; |
|
| 117 | + } |
|
| 96 | 118 | //exit; |
| 97 | - if ($i > $globalDBretry) return false; |
|
| 119 | + if ($i > $globalDBretry) { |
|
| 120 | + return false; |
|
| 121 | + } |
|
| 98 | 122 | //return false; |
| 99 | 123 | } |
| 100 | 124 | } |
| 101 | - if ($DBname === 'default') $this->db = $this->dbs['default']; |
|
| 125 | + if ($DBname === 'default') { |
|
| 126 | + $this->db = $this->dbs['default']; |
|
| 127 | + } |
|
| 102 | 128 | return true; |
| 103 | 129 | } |
| 104 | 130 | |
@@ -110,7 +136,9 @@ discard block |
||
| 110 | 136 | } elseif ($globalDBdriver == 'pgsql') { |
| 111 | 137 | $query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'"; |
| 112 | 138 | } |
| 113 | - if ($this->db == NULL) return false; |
|
| 139 | + if ($this->db == NULL) { |
|
| 140 | + return false; |
|
| 141 | + } |
|
| 114 | 142 | try { |
| 115 | 143 | //$Connection = new Connection(); |
| 116 | 144 | $results = $this->db->query($query); |
@@ -119,21 +147,28 @@ discard block |
||
| 119 | 147 | } |
| 120 | 148 | if($results->rowCount()>0) { |
| 121 | 149 | return true; |
| 150 | + } else { |
|
| 151 | + return false; |
|
| 122 | 152 | } |
| 123 | - else return false; |
|
| 124 | 153 | } |
| 125 | 154 | |
| 126 | 155 | public function connectionExists() |
| 127 | 156 | { |
| 128 | 157 | global $globalDBdriver, $globalDBCheckConnection; |
| 129 | - if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true; |
|
| 158 | + if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) { |
|
| 159 | + return true; |
|
| 160 | + } |
|
| 130 | 161 | $query = "SELECT 1 + 1"; |
| 131 | - if ($this->db == NULL) return false; |
|
| 162 | + if ($this->db == NULL) { |
|
| 163 | + return false; |
|
| 164 | + } |
|
| 132 | 165 | try { |
| 133 | 166 | $sum = @$this->db->query($query); |
| 134 | 167 | if ($sum instanceof \PDOStatement) { |
| 135 | 168 | $sum = $sum->fetchColumn(0); |
| 136 | - } else $sum = 0; |
|
| 169 | + } else { |
|
| 170 | + $sum = 0; |
|
| 171 | + } |
|
| 137 | 172 | if (intval($sum) !== 2) { |
| 138 | 173 | return false; |
| 139 | 174 | } |
@@ -167,8 +202,9 @@ discard block |
||
| 167 | 202 | } |
| 168 | 203 | if($results->rowCount()>0) { |
| 169 | 204 | return true; |
| 205 | + } else { |
|
| 206 | + return false; |
|
| 170 | 207 | } |
| 171 | - else return false; |
|
| 172 | 208 | } |
| 173 | 209 | |
| 174 | 210 | /* |
@@ -207,7 +243,9 @@ discard block |
||
| 207 | 243 | $colcnt = $results->columnCount(); |
| 208 | 244 | for ($i = 0; $i < $colcnt; $i++) { |
| 209 | 245 | $col = $results->getColumnMeta($i); |
| 210 | - if ($name == $col['name']) return true; |
|
| 246 | + if ($name == $col['name']) { |
|
| 247 | + return true; |
|
| 248 | + } |
|
| 211 | 249 | } |
| 212 | 250 | return false; |
| 213 | 251 | } |
@@ -234,7 +272,9 @@ discard block |
||
| 234 | 272 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 235 | 273 | return $result['value']; |
| 236 | 274 | } |
| 237 | - } else return $version; |
|
| 275 | + } else { |
|
| 276 | + return $version; |
|
| 277 | + } |
|
| 238 | 278 | } |
| 239 | 279 | |
| 240 | 280 | /* |
@@ -242,8 +282,11 @@ discard block |
||
| 242 | 282 | * @return Boolean if latest version or not |
| 243 | 283 | */ |
| 244 | 284 | public function latest() { |
| 245 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 246 | - else return false; |
|
| 285 | + if ($this->check_schema_version() == $this->latest_schema) { |
|
| 286 | + return true; |
|
| 287 | + } else { |
|
| 288 | + return false; |
|
| 289 | + } |
|
| 247 | 290 | } |
| 248 | 291 | |
| 249 | 292 | } |