@@ -46,20 +46,20 @@ discard block |
||
| 46 | 46 | die; |
| 47 | 47 | } |
| 48 | 48 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
| 49 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
| 49 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver')); |
|
| 53 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver')); |
|
| 54 | 54 | //if (isset($options['s'])) $hosts = array($options['s']); |
| 55 | 55 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 56 | 56 | if (isset($options['s'])) { |
| 57 | 57 | $globalSources = array(); |
| 58 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 58 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']); |
|
| 59 | 59 | else $globalSources[] = array('host' => $options['s']); |
| 60 | 60 | } elseif (isset($options['source'])) { |
| 61 | 61 | $globalSources = array(); |
| 62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 62 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']); |
|
| 63 | 63 | else $globalSources[] = array('host' => $options['source']); |
| 64 | 64 | } |
| 65 | 65 | if (isset($options['aprsserverhost'])) { |
@@ -76,28 +76,28 @@ discard block |
||
| 76 | 76 | else $id_source = 1; |
| 77 | 77 | if (isset($globalServer) && $globalServer) { |
| 78 | 78 | if ($globalDebug) echo "Using Server Mode\n"; |
| 79 | - $SI=new SpotterServer(); |
|
| 79 | + $SI = new SpotterServer(); |
|
| 80 | 80 | /* |
| 81 | 81 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
| 82 | 82 | $SI = new adsb2aprs(); |
| 83 | 83 | $SI->connect(); |
| 84 | 84 | */ |
| 85 | -} else $SI=new SpotterImport($Connection->db); |
|
| 85 | +} else $SI = new SpotterImport($Connection->db); |
|
| 86 | 86 | if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
| 87 | 87 | if (isset($globalMarine) && $globalMarine) { |
| 88 | 88 | $AIS = new AIS(); |
| 89 | 89 | $MI = new MarineImport($Connection->db); |
| 90 | 90 | } |
| 91 | 91 | //$APRS=new APRS($Connection->db); |
| 92 | -$SBS=new SBS(); |
|
| 93 | -$ACARS=new ACARS($Connection->db); |
|
| 94 | -$Source=new Source($Connection->db); |
|
| 95 | -$Common=new Common(); |
|
| 92 | +$SBS = new SBS(); |
|
| 93 | +$ACARS = new ACARS($Connection->db); |
|
| 94 | +$Source = new Source($Connection->db); |
|
| 95 | +$Common = new Common(); |
|
| 96 | 96 | date_default_timezone_set('UTC'); |
| 97 | 97 | //$servertz = system('date +%Z'); |
| 98 | 98 | // signal handler - playing nice with sockets and dump1090 |
| 99 | 99 | if (function_exists('pcntl_fork')) { |
| 100 | - pcntl_signal(SIGINT, function() { |
|
| 100 | + pcntl_signal(SIGINT, function() { |
|
| 101 | 101 | global $sockets; |
| 102 | 102 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
| 103 | 103 | die("Bye!\n"); |
@@ -113,30 +113,30 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | function connect_all($hosts) { |
| 115 | 115 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
| 116 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
| 116 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; |
|
| 117 | 117 | $reset++; |
| 118 | 118 | if ($globalDebug) echo 'Connect to all...'."\n"; |
| 119 | 119 | foreach ($hosts as $id => $value) { |
| 120 | 120 | $host = $value['host']; |
| 121 | 121 | $globalSources[$id]['last_exec'] = 0; |
| 122 | 122 | // Here we check type of source(s) |
| 123 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
| 124 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 123 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
| 124 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
| 125 | 125 | //$formats[$id] = 'deltadbtxt'; |
| 126 | 126 | $globalSources[$id]['format'] = 'deltadbtxt'; |
| 127 | 127 | //$last_exec['deltadbtxt'] = 0; |
| 128 | 128 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
| 129 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 129 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
| 130 | 130 | //$formats[$id] = 'vatsimtxt'; |
| 131 | 131 | $globalSources[$id]['format'] = 'vatsimtxt'; |
| 132 | 132 | //$last_exec['vatsimtxt'] = 0; |
| 133 | 133 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
| 134 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 134 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
| 135 | 135 | //$formats[$id] = 'aircraftlistjson'; |
| 136 | 136 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
| 137 | 137 | //$last_exec['aircraftlistjson'] = 0; |
| 138 | 138 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
| 139 | - } else if (preg_match('/opensky/i',$host)) { |
|
| 139 | + } else if (preg_match('/opensky/i', $host)) { |
|
| 140 | 140 | //$formats[$id] = 'aircraftlistjson'; |
| 141 | 141 | $globalSources[$id]['format'] = 'opensky'; |
| 142 | 142 | //$last_exec['aircraftlistjson'] = 0; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | exit(0); |
| 154 | 154 | } |
| 155 | 155 | */ |
| 156 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 156 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
| 157 | 157 | //$formats[$id] = 'planeupdatefaa'; |
| 158 | 158 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
| 159 | 159 | //$last_exec['planeupdatefaa'] = 0; |
@@ -162,29 +162,29 @@ discard block |
||
| 162 | 162 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 163 | 163 | exit(0); |
| 164 | 164 | } |
| 165 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 165 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
| 166 | 166 | //$formats[$id] = 'phpvmacars'; |
| 167 | 167 | $globalSources[$id]['format'] = 'phpvmacars'; |
| 168 | 168 | //$last_exec['phpvmacars'] = 0; |
| 169 | 169 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
| 170 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 170 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
| 171 | 171 | //$formats[$id] = 'phpvmacars'; |
| 172 | 172 | $globalSources[$id]['format'] = 'vam'; |
| 173 | 173 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
| 174 | - } else if (preg_match('/whazzup/i',$host)) { |
|
| 174 | + } else if (preg_match('/whazzup/i', $host)) { |
|
| 175 | 175 | //$formats[$id] = 'whazzup'; |
| 176 | 176 | $globalSources[$id]['format'] = 'whazzup'; |
| 177 | 177 | //$last_exec['whazzup'] = 0; |
| 178 | 178 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
| 179 | - } else if (preg_match('/airwhere/i',$host)) { |
|
| 179 | + } else if (preg_match('/airwhere/i', $host)) { |
|
| 180 | 180 | $globalSources[$id]['format'] = 'airwhere'; |
| 181 | 181 | if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
| 182 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
| 182 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
| 183 | 183 | //$formats[$id] = 'pirepsjson'; |
| 184 | 184 | $globalSources[$id]['format'] = 'pirepsjson'; |
| 185 | 185 | //$last_exec['pirepsjson'] = 0; |
| 186 | 186 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
| 187 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 187 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
| 188 | 188 | //$formats[$id] = 'fr24json'; |
| 189 | 189 | $globalSources[$id]['format'] = 'fr24json'; |
| 190 | 190 | //$last_exec['fr24json'] = 0; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 194 | 194 | exit(0); |
| 195 | 195 | } |
| 196 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
| 196 | + } else if (preg_match(':myshiptracking.com/:i', $host)) { |
|
| 197 | 197 | //$formats[$id] = 'fr24json'; |
| 198 | 198 | $globalSources[$id]['format'] = 'myshiptracking'; |
| 199 | 199 | //$last_exec['fr24json'] = 0; |
@@ -203,22 +203,22 @@ discard block |
||
| 203 | 203 | exit(0); |
| 204 | 204 | } |
| 205 | 205 | //} else if (preg_match('/10001/',$host)) { |
| 206 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 206 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 207 | 207 | //$formats[$id] = 'tsv'; |
| 208 | 208 | $globalSources[$id]['format'] = 'tsv'; |
| 209 | 209 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
| 210 | 210 | } |
| 211 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 211 | + } elseif (filter_var($host, FILTER_VALIDATE_URL)) { |
|
| 212 | 212 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
| 213 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
| 213 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); |
|
| 214 | 214 | if ($idf !== false) { |
| 215 | 215 | $httpfeeds[$id] = $idf; |
| 216 | 216 | if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
| 217 | 217 | } |
| 218 | 218 | elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
| 219 | 219 | } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
| 220 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 221 | - $hostport = explode(':',$host); |
|
| 220 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
| 221 | + $hostport = explode(':', $host); |
|
| 222 | 222 | if (isset($hostport[1])) { |
| 223 | 223 | $port = $hostport[1]; |
| 224 | 224 | $hostn = $hostport[0]; |
@@ -228,19 +228,19 @@ discard block |
||
| 228 | 228 | } |
| 229 | 229 | $Common = new Common(); |
| 230 | 230 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
| 231 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
| 231 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); |
|
| 232 | 232 | } else { |
| 233 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 233 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); |
|
| 234 | 234 | } |
| 235 | 235 | if ($s) { |
| 236 | 236 | $sockets[$id] = $s; |
| 237 | 237 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
| 238 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
| 238 | + if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { |
|
| 239 | 239 | //$formats[$id] = 'aprs'; |
| 240 | 240 | $globalSources[$id]['format'] = 'aprs'; |
| 241 | 241 | //$aprs_connect = 0; |
| 242 | 242 | //$use_aprs = true; |
| 243 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
| 243 | + } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
| 244 | 244 | $globalSources[$id]['format'] = 'vrstcp'; |
| 245 | 245 | } elseif ($port == '10001') { |
| 246 | 246 | //$formats[$id] = 'tsv'; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
| 280 | 280 | else $timeout = 20; |
| 281 | 281 | $errno = ''; |
| 282 | -$errstr=''; |
|
| 282 | +$errstr = ''; |
|
| 283 | 283 | |
| 284 | 284 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 285 | 285 | /* Initiate connections to all the hosts simultaneously */ |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | //connect_all($globalSources); |
| 288 | 288 | |
| 289 | 289 | if (isset($globalProxy) && $globalProxy) { |
| 290 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
| 290 | + $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); |
|
| 291 | 291 | } else { |
| 292 | 292 | $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
| 293 | 293 | } |
@@ -314,16 +314,16 @@ discard block |
||
| 314 | 314 | |
| 315 | 315 | if ($use_aprs) { |
| 316 | 316 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
| 317 | - $APRS=new APRS(); |
|
| 317 | + $APRS = new APRS(); |
|
| 318 | 318 | $aprs_connect = 0; |
| 319 | 319 | $aprs_keep = 120; |
| 320 | 320 | $aprs_last_tx = time(); |
| 321 | 321 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
| 322 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 322 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
| 323 | 323 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
| 324 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 324 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
| 325 | 325 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
| 326 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 326 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 327 | 327 | if ($aprs_full) $aprs_filter = ''; |
| 328 | 328 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
| 329 | 329 | else $aprs_pass = '-1'; |
@@ -337,12 +337,12 @@ discard block |
||
| 337 | 337 | sleep(1); |
| 338 | 338 | if ($globalDebug) echo "SCAN MODE \n\n"; |
| 339 | 339 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
| 340 | -$endtime = time()+$globalCronEnd; |
|
| 340 | +$endtime = time() + $globalCronEnd; |
|
| 341 | 341 | $i = 1; |
| 342 | 342 | $tt = array(); |
| 343 | 343 | // Delete all ATC |
| 344 | 344 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
| 345 | - $ATC=new ATC($Connection->db); |
|
| 345 | + $ATC = new ATC($Connection->db); |
|
| 346 | 346 | } |
| 347 | 347 | if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 348 | 348 | $ATC->deleteAll(); |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | |
| 351 | 351 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 352 | 352 | while ($i > 0) { |
| 353 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 353 | + if (!$globalDaemon) $i = $endtime - time(); |
|
| 354 | 354 | // Delete old ATC |
| 355 | 355 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 356 | 356 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | } |
| 365 | 365 | if ($max != $globalMinFetch) { |
| 366 | 366 | if ($globalDebug) echo 'Sleeping...'."\n"; |
| 367 | - sleep($globalMinFetch-$max+2); |
|
| 367 | + sleep($globalMinFetch - $max + 2); |
|
| 368 | 368 | } |
| 369 | 369 | } |
| 370 | 370 | |
@@ -377,8 +377,8 @@ discard block |
||
| 377 | 377 | //$buffer = $Common->getData($hosts[$id]); |
| 378 | 378 | $buffer = $Common->getData($value['host']); |
| 379 | 379 | if ($buffer != '') $reset = 0; |
| 380 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 381 | - $buffer = explode('\n',$buffer); |
|
| 380 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 381 | + $buffer = explode('\n', $buffer); |
|
| 382 | 382 | foreach ($buffer as $line) { |
| 383 | 383 | if ($line != '' && count($line) > 7) { |
| 384 | 384 | $line = explode(',', $line); |
@@ -406,11 +406,11 @@ discard block |
||
| 406 | 406 | $last_exec[$id]['last'] = time(); |
| 407 | 407 | } elseif ($value['format'] == 'aisnmeatxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
| 408 | 408 | date_default_timezone_set('CET'); |
| 409 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
| 409 | + $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); |
|
| 410 | 410 | date_default_timezone_set('UTC'); |
| 411 | 411 | if ($buffer != '') $reset = 0; |
| 412 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 413 | - $buffer = explode('\n',$buffer); |
|
| 412 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 413 | + $buffer = explode('\n', $buffer); |
|
| 414 | 414 | foreach ($buffer as $line) { |
| 415 | 415 | if ($line != '') { |
| 416 | 416 | //echo "'".$line."'\n"; |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
| 429 | 429 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
| 430 | 430 | if (isset($ais_data['timestamp'])) { |
| 431 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
| 431 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
| 432 | 432 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
| 433 | 433 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
| 434 | 434 | $add = true; |
@@ -451,12 +451,12 @@ discard block |
||
| 451 | 451 | $w = $e = null; |
| 452 | 452 | |
| 453 | 453 | if (isset($arr[$id])) { |
| 454 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
| 454 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
| 455 | 455 | if ($nn > 0) { |
| 456 | 456 | foreach ($httpfeeds as $feed) { |
| 457 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
| 458 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 459 | - $buffer = explode('\n',$buffer); |
|
| 457 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
| 458 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 459 | + $buffer = explode('\n', $buffer); |
|
| 460 | 460 | foreach ($buffer as $line) { |
| 461 | 461 | if ($line != '') { |
| 462 | 462 | $ais_data = $AIS->parse_line(trim($line)); |
@@ -474,9 +474,9 @@ discard block |
||
| 474 | 474 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
| 475 | 475 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
| 476 | 476 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
| 477 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 477 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
| 478 | 478 | if (isset($ais_data['timestamp'])) { |
| 479 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
| 479 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
| 480 | 480 | } else { |
| 481 | 481 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 482 | 482 | } |
@@ -502,10 +502,10 @@ discard block |
||
| 502 | 502 | } |
| 503 | 503 | } |
| 504 | 504 | } elseif ($value['format'] == 'myshiptracking' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
| 505 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 505 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
| 506 | 506 | if ($buffer != '') { |
| 507 | 507 | //echo $buffer; |
| 508 | - $all_data = json_decode($buffer,true); |
|
| 508 | + $all_data = json_decode($buffer, true); |
|
| 509 | 509 | //print_r($all_data); |
| 510 | 510 | if (isset($all_data[0]['DATA'])) { |
| 511 | 511 | foreach ($all_data[0]['DATA'] as $line) { |
@@ -520,7 +520,7 @@ discard block |
||
| 520 | 520 | // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
| 521 | 521 | $data['imo'] = $line['IMO']; |
| 522 | 522 | //$data['arrival_code'] = $ais_data['destination']; |
| 523 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
| 523 | + $data['datetime'] = date('Y-m-d H:i:s', $line['T']); |
|
| 524 | 524 | $data['format_source'] = 'myshiptracking'; |
| 525 | 525 | $data['id_source'] = $id_source; |
| 526 | 526 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -532,9 +532,9 @@ discard block |
||
| 532 | 532 | } |
| 533 | 533 | $last_exec[$id]['last'] = time(); |
| 534 | 534 | } elseif ($value['format'] == 'boatbeaconapp' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
| 535 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
| 535 | + $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); |
|
| 536 | 536 | if ($buffer != '') { |
| 537 | - $all_data = json_decode($buffer,true); |
|
| 537 | + $all_data = json_decode($buffer, true); |
|
| 538 | 538 | if (isset($all_data[0]['mmsi'])) { |
| 539 | 539 | foreach ($all_data as $line) { |
| 540 | 540 | if ($line != '') { |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | } elseif ($value['format'] == 'boatnerd' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
| 564 | 564 | $buffer = $Common->getData($value['host']); |
| 565 | 565 | if ($buffer != '') { |
| 566 | - $all_data = json_decode($buffer,true); |
|
| 566 | + $all_data = json_decode($buffer, true); |
|
| 567 | 567 | if (isset($all_data['features'][0]['id'])) { |
| 568 | 568 | foreach ($all_data['features'] as $line) { |
| 569 | 569 | $data = array(); |
@@ -591,27 +591,27 @@ discard block |
||
| 591 | 591 | $last_exec[$id]['last'] = time(); |
| 592 | 592 | } elseif ($value['format'] == 'shipplotter' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
| 593 | 593 | echo 'download...'; |
| 594 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
| 594 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); |
|
| 595 | 595 | echo 'done !'."\n"; |
| 596 | 596 | if ($buffer != '') $reset = 0; |
| 597 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 598 | - $buffer = explode('\n',$buffer); |
|
| 597 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 598 | + $buffer = explode('\n', $buffer); |
|
| 599 | 599 | foreach ($buffer as $line) { |
| 600 | 600 | if ($line != '') { |
| 601 | 601 | $data = array(); |
| 602 | - $data['mmsi'] = (int)substr($line,0,9); |
|
| 603 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
| 602 | + $data['mmsi'] = (int) substr($line, 0, 9); |
|
| 603 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); |
|
| 604 | 604 | //$data['status'] = substr($line,21,2); |
| 605 | 605 | //$data['type'] = substr($line,24,3); |
| 606 | - $data['latitude'] = substr($line,29,9); |
|
| 607 | - $data['longitude'] = substr($line,41,9); |
|
| 608 | - $data['speed'] = round(substr($line,51,5)); |
|
| 606 | + $data['latitude'] = substr($line, 29, 9); |
|
| 607 | + $data['longitude'] = substr($line, 41, 9); |
|
| 608 | + $data['speed'] = round(substr($line, 51, 5)); |
|
| 609 | 609 | //$data['course'] = substr($line,57,5); |
| 610 | - $data['heading'] = round(substr($line,63,3)); |
|
| 610 | + $data['heading'] = round(substr($line, 63, 3)); |
|
| 611 | 611 | //$data['draft'] = substr($line,67,4); |
| 612 | 612 | //$data['length'] = substr($line,72,3); |
| 613 | 613 | //$data['beam'] = substr($line,76,2); |
| 614 | - $data['ident'] = trim(utf8_encode(substr($line,79,20))); |
|
| 614 | + $data['ident'] = trim(utf8_encode(substr($line, 79, 20))); |
|
| 615 | 615 | //$data['callsign'] = trim(substr($line,100,7); |
| 616 | 616 | //$data['dest'] = substr($line,108,20); |
| 617 | 617 | //$data['etaDate'] = substr($line,129,5); |
@@ -630,8 +630,8 @@ discard block |
||
| 630 | 630 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) { |
| 631 | 631 | //$buffer = $Common->getData($hosts[$id]); |
| 632 | 632 | $buffer = $Common->getData($value['host']); |
| 633 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 634 | - $buffer = explode('\n',$buffer); |
|
| 633 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
| 634 | + $buffer = explode('\n', $buffer); |
|
| 635 | 635 | $reset = 0; |
| 636 | 636 | foreach ($buffer as $line) { |
| 637 | 637 | if ($line != '') { |
@@ -642,7 +642,7 @@ discard block |
||
| 642 | 642 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
| 643 | 643 | $data['pilot_id'] = $line[1]; |
| 644 | 644 | $data['pilot_name'] = $line[2]; |
| 645 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
|
| 645 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); |
|
| 646 | 646 | $data['ident'] = $line[0]; // ident |
| 647 | 647 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
| 648 | 648 | $data['speed'] = $line[8]; // speed |
@@ -658,7 +658,7 @@ discard block |
||
| 658 | 658 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
| 659 | 659 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
| 660 | 660 | $data['departure_airport_icao'] = $line[11]; |
| 661 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 661 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
| 662 | 662 | $data['arrival_airport_icao'] = $line[13]; |
| 663 | 663 | $data['frequency'] = $line[4]; |
| 664 | 664 | $data['type'] = $line[18]; |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | $data['id_source'] = $id_source; |
| 668 | 668 | //$data['arrival_airport_time'] = ; |
| 669 | 669 | if ($line[9] != '') { |
| 670 | - $aircraft_data = explode('/',$line[9]); |
|
| 670 | + $aircraft_data = explode('/', $line[9]); |
|
| 671 | 671 | if (isset($aircraft_data[1])) { |
| 672 | 672 | $data['aircraft_icao'] = $aircraft_data[1]; |
| 673 | 673 | } |
@@ -682,9 +682,9 @@ discard block |
||
| 682 | 682 | if ($line[3] == 'PILOT') $SI->add($data); |
| 683 | 683 | elseif ($line[3] == 'ATC') { |
| 684 | 684 | //print_r($data); |
| 685 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
| 686 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
| 687 | - $typec = substr($data['ident'],-3); |
|
| 685 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
| 686 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
| 687 | + $typec = substr($data['ident'], -3); |
|
| 688 | 688 | if ($typec == 'APP') $data['type'] = 'Approach'; |
| 689 | 689 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
| 690 | 690 | elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
@@ -696,8 +696,8 @@ discard block |
||
| 696 | 696 | elseif ($data['type'] == '') $data['type'] = 'Observer'; |
| 697 | 697 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
| 698 | 698 | if (isset($ATC)) { |
| 699 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
| 700 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
| 699 | + if (count($ATC->getByIdent($data['ident'], $data['format_source'])) > 0) echo $ATC->update($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
| 700 | + else echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
| 701 | 701 | } |
| 702 | 702 | } |
| 703 | 703 | unset($data); |
@@ -708,24 +708,24 @@ discard block |
||
| 708 | 708 | //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
| 709 | 709 | $last_exec[$id]['last'] = time(); |
| 710 | 710 | } elseif ($value['format'] == 'airwhere' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 711 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
| 711 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20'); |
|
| 712 | 712 | if ($buffer != '') { |
| 713 | 713 | $all_data = simplexml_load_string($buffer); |
| 714 | - foreach($all_data->children() as $childdata) { |
|
| 714 | + foreach ($all_data->children() as $childdata) { |
|
| 715 | 715 | $data = array(); |
| 716 | 716 | $line = $childdata; |
| 717 | 717 | //$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT); |
| 718 | - $data['id'] = date('Ymd').(int)$line['pktPilotID']; |
|
| 719 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
|
| 720 | - $data['latitude'] = (float)$line['pktLatitude']; |
|
| 721 | - $data['longitude'] = (float)$line['pktLongitude']; |
|
| 722 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
| 723 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
| 724 | - $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
|
| 718 | + $data['id'] = date('Ymd').(int) $line['pktPilotID']; |
|
| 719 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST')); |
|
| 720 | + $data['latitude'] = (float) $line['pktLatitude']; |
|
| 721 | + $data['longitude'] = (float) $line['pktLongitude']; |
|
| 722 | + if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack']; |
|
| 723 | + if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed']; |
|
| 724 | + $data['altitude'] = round((int) $line['pktAltitude']*3.28084); |
|
| 725 | 725 | $data['altitude_relative'] = 'AMSL'; |
| 726 | - $data['pilot_id'] = (int)$line['pktPilotID']; |
|
| 726 | + $data['pilot_id'] = (int) $line['pktPilotID']; |
|
| 727 | 727 | $data['aircraft_icao'] = 'PARAGLIDER'; |
| 728 | - $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
| 728 | + $pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
| 729 | 729 | if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
| 730 | 730 | $data['format_source'] = $value['format']; |
| 731 | 731 | $SI->add($data); |
@@ -733,31 +733,31 @@ discard block |
||
| 733 | 733 | } |
| 734 | 734 | } |
| 735 | 735 | $Source->deleteOldLocationByType('gs'); |
| 736 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
| 736 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20'); |
|
| 737 | 737 | if ($buffer != '') { |
| 738 | 738 | $all_data = simplexml_load_string($buffer); |
| 739 | - foreach($all_data->children() as $childdata) { |
|
| 739 | + foreach ($all_data->children() as $childdata) { |
|
| 740 | 740 | $data = array(); |
| 741 | 741 | $line = $childdata; |
| 742 | - $data['id'] = (int)$line['gsID']; |
|
| 743 | - $data['latitude'] = (float)$line['gsLatitude']; |
|
| 744 | - $data['longitude'] = (float)$line['gsLongitude']; |
|
| 745 | - $data['altitude'] = round((int)$line['gsHeight']*3.28084); |
|
| 742 | + $data['id'] = (int) $line['gsID']; |
|
| 743 | + $data['latitude'] = (float) $line['gsLatitude']; |
|
| 744 | + $data['longitude'] = (float) $line['gsLongitude']; |
|
| 745 | + $data['altitude'] = round((int) $line['gsHeight']*3.28084); |
|
| 746 | 746 | $data['altitude_relative'] = 'AMSL'; |
| 747 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST')); |
|
| 747 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST')); |
|
| 748 | 748 | if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) { |
| 749 | - $Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
| 749 | + $Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
| 750 | 750 | } else { |
| 751 | - $Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
| 751 | + $Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
| 752 | 752 | } |
| 753 | 753 | unset($data); |
| 754 | 754 | } |
| 755 | 755 | } |
| 756 | 756 | $last_exec[$id]['last'] = time(); |
| 757 | 757 | } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 758 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 758 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
| 759 | 759 | if ($buffer != '') { |
| 760 | - $all_data = json_decode($buffer,true); |
|
| 760 | + $all_data = json_decode($buffer, true); |
|
| 761 | 761 | if (isset($all_data['acList'])) { |
| 762 | 762 | $reset = 0; |
| 763 | 763 | foreach ($all_data['acList'] as $line) { |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | $data['emergency'] = ''; // emergency |
| 775 | 775 | if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
| 776 | 776 | |
| 777 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 777 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
| 778 | 778 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 779 | 779 | |
| 780 | 780 | //$data['datetime'] = date('Y-m-d H:i:s'); |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | $data['verticalrate'] = $line['vrt']; // verticale rate |
| 801 | 801 | $data['squawk'] = $line['squawk']; // squawk |
| 802 | 802 | $data['emergency'] = ''; // emergency |
| 803 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 803 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
| 804 | 804 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 805 | 805 | $data['format_source'] = 'aircraftlistjson'; |
| 806 | 806 | $data['id_source'] = $id_source; |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
| 817 | 817 | } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 818 | 818 | $buffer = $Common->getData($value['host']); |
| 819 | - $all_data = json_decode($buffer,true); |
|
| 819 | + $all_data = json_decode($buffer, true); |
|
| 820 | 820 | if (isset($all_data['planes'])) { |
| 821 | 821 | $reset = 0; |
| 822 | 822 | foreach ($all_data['planes'] as $key => $line) { |
@@ -833,12 +833,12 @@ discard block |
||
| 833 | 833 | $data['emergency'] = ''; // emergency |
| 834 | 834 | $data['registration'] = $line[2]; |
| 835 | 835 | $data['aircraft_icao'] = $line[0]; |
| 836 | - $deparr = explode('-',$line[1]); |
|
| 836 | + $deparr = explode('-', $line[1]); |
|
| 837 | 837 | if (count($deparr) == 2) { |
| 838 | 838 | $data['departure_airport_icao'] = $deparr[0]; |
| 839 | 839 | $data['arrival_airport_icao'] = $deparr[1]; |
| 840 | 840 | } |
| 841 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 841 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
| 842 | 842 | $data['format_source'] = 'planeupdatefaa'; |
| 843 | 843 | $data['id_source'] = $id_source; |
| 844 | 844 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | $last_exec[$id]['last'] = time(); |
| 852 | 852 | } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 853 | 853 | $buffer = $Common->getData($value['host']); |
| 854 | - $all_data = json_decode($buffer,true); |
|
| 854 | + $all_data = json_decode($buffer, true); |
|
| 855 | 855 | if (isset($all_data['states'])) { |
| 856 | 856 | $reset = 0; |
| 857 | 857 | foreach ($all_data['states'] as $key => $line) { |
@@ -868,7 +868,7 @@ discard block |
||
| 868 | 868 | //$data['emergency'] = ''; // emergency |
| 869 | 869 | //$data['registration'] = $line[2]; |
| 870 | 870 | //$data['aircraft_icao'] = $line[0]; |
| 871 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 871 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
| 872 | 872 | $data['format_source'] = 'opensky'; |
| 873 | 873 | $data['id_source'] = $id_source; |
| 874 | 874 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 883 | 883 | //$buffer = $Common->getData($hosts[$id]); |
| 884 | 884 | $buffer = $Common->getData($value['host']); |
| 885 | - $all_data = json_decode($buffer,true); |
|
| 885 | + $all_data = json_decode($buffer, true); |
|
| 886 | 886 | if (!empty($all_data)) $reset = 0; |
| 887 | 887 | foreach ($all_data as $key => $line) { |
| 888 | 888 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
@@ -915,11 +915,11 @@ discard block |
||
| 915 | 915 | //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
| 916 | 916 | } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 917 | 917 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
| 918 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 918 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
| 919 | 919 | //echo $buffer; |
| 920 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 921 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 922 | - $all_data = json_decode($buffer,true); |
|
| 920 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
| 921 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
| 922 | + $all_data = json_decode($buffer, true); |
|
| 923 | 923 | if (json_last_error() != JSON_ERROR_NONE) { |
| 924 | 924 | die(json_last_error_msg()); |
| 925 | 925 | } |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | //$data['departure_airport_iata'] = $line[11]; |
| 943 | 943 | //$data['arrival_airport_iata'] = $line[12]; |
| 944 | 944 | //$data['emergency'] = ''; // emergency |
| 945 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
| 945 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
| 946 | 946 | $data['format_source'] = 'radarvirtueljson'; |
| 947 | 947 | $data['id_source'] = $id_source; |
| 948 | 948 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -958,14 +958,14 @@ discard block |
||
| 958 | 958 | } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 959 | 959 | //$buffer = $Common->getData($hosts[$id]); |
| 960 | 960 | $buffer = $Common->getData($value['host'].'?'.time()); |
| 961 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
| 961 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
| 962 | 962 | |
| 963 | 963 | if (isset($all_data['pireps'])) { |
| 964 | 964 | $reset = 0; |
| 965 | 965 | foreach ($all_data['pireps'] as $line) { |
| 966 | 966 | $data = array(); |
| 967 | 967 | $data['id'] = $line['id']; |
| 968 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 968 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
| 969 | 969 | $data['ident'] = $line['callsign']; // ident |
| 970 | 970 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
| 971 | 971 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -995,9 +995,9 @@ discard block |
||
| 995 | 995 | $SI->add($data); |
| 996 | 996 | // print_r($data); |
| 997 | 997 | } elseif ($line['icon'] == 'ct') { |
| 998 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
| 999 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
| 1000 | - $typec = substr($data['ident'],-3); |
|
| 998 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
| 999 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
| 1000 | + $typec = substr($data['ident'], -3); |
|
| 1001 | 1001 | $data['type'] = ''; |
| 1002 | 1002 | if ($typec == 'APP') $data['type'] = 'Approach'; |
| 1003 | 1003 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
| 1009 | 1009 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
| 1010 | 1010 | else $data['type'] = 'Observer'; |
| 1011 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
| 1011 | + if (isset($ATC)) echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']); |
|
| 1012 | 1012 | } |
| 1013 | 1013 | unset($data); |
| 1014 | 1014 | } |
@@ -1020,14 +1020,14 @@ discard block |
||
| 1020 | 1020 | //$buffer = $Common->getData($hosts[$id]); |
| 1021 | 1021 | if ($globalDebug) echo 'Get Data...'."\n"; |
| 1022 | 1022 | $buffer = $Common->getData($value['host']); |
| 1023 | - $all_data = json_decode($buffer,true); |
|
| 1023 | + $all_data = json_decode($buffer, true); |
|
| 1024 | 1024 | if ($buffer != '' && is_array($all_data)) { |
| 1025 | 1025 | $reset = 0; |
| 1026 | 1026 | foreach ($all_data as $line) { |
| 1027 | 1027 | $data = array(); |
| 1028 | 1028 | //$data['id'] = $line['id']; // id not usable |
| 1029 | 1029 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
| 1030 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 1030 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
| 1031 | 1031 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
| 1032 | 1032 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
| 1033 | 1033 | $data['ident'] = $line['flightnum']; // ident |
@@ -1042,7 +1042,7 @@ discard block |
||
| 1042 | 1042 | //$data['datetime'] = $line['lastupdate']; |
| 1043 | 1043 | //$data['last_update'] = $line['lastupdate']; |
| 1044 | 1044 | if (isset($value['timezone'])) { |
| 1045 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
| 1045 | + $datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone'])); |
|
| 1046 | 1046 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1047 | 1047 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1048 | 1048 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1055,14 +1055,14 @@ discard block |
||
| 1055 | 1055 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
| 1056 | 1056 | if (isset($line['aircraftname'])) { |
| 1057 | 1057 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 1058 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
| 1059 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
| 1058 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
| 1059 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
| 1060 | 1060 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
| 1061 | 1061 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
| 1062 | 1062 | else { |
| 1063 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 1064 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1065 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1063 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
| 1064 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); |
|
| 1065 | + else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); |
|
| 1066 | 1066 | } |
| 1067 | 1067 | } |
| 1068 | 1068 | if (isset($line['route'])) $data['waypoints'] = $line['route']; |
@@ -1082,14 +1082,14 @@ discard block |
||
| 1082 | 1082 | //$buffer = $Common->getData($hosts[$id]); |
| 1083 | 1083 | if ($globalDebug) echo 'Get Data...'."\n"; |
| 1084 | 1084 | $buffer = $Common->getData($value['host']); |
| 1085 | - $all_data = json_decode($buffer,true); |
|
| 1085 | + $all_data = json_decode($buffer, true); |
|
| 1086 | 1086 | if ($buffer != '' && is_array($all_data)) { |
| 1087 | 1087 | $reset = 0; |
| 1088 | 1088 | foreach ($all_data as $line) { |
| 1089 | 1089 | $data = array(); |
| 1090 | 1090 | //$data['id'] = $line['id']; // id not usable |
| 1091 | 1091 | $data['id'] = trim($line['flight_id']); |
| 1092 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 1092 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
| 1093 | 1093 | $data['pilot_name'] = $line['pilot_name']; |
| 1094 | 1094 | $data['pilot_id'] = $line['pilot_id']; |
| 1095 | 1095 | $data['ident'] = trim($line['callsign']); // ident |
@@ -1141,11 +1141,11 @@ discard block |
||
| 1141 | 1141 | //$value = $formats[$nb]; |
| 1142 | 1142 | $format = $globalSources[$nb]['format']; |
| 1143 | 1143 | if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
| 1144 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
|
| 1144 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); |
|
| 1145 | 1145 | } elseif ($format == 'vrstcp') { |
| 1146 | 1146 | $buffer = @socket_read($r, 6000); |
| 1147 | 1147 | } else { |
| 1148 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
| 1148 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
| 1149 | 1149 | } |
| 1150 | 1150 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
| 1151 | 1151 | //echo $buffer."\n"; |
@@ -1154,8 +1154,8 @@ discard block |
||
| 1154 | 1154 | $error = false; |
| 1155 | 1155 | //$SI::del(); |
| 1156 | 1156 | if ($format == 'vrstcp') { |
| 1157 | - $buffer = explode('},{',$buffer); |
|
| 1158 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 1157 | + $buffer = explode('},{', $buffer); |
|
| 1158 | + } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
| 1159 | 1159 | // SBS format is CSV format |
| 1160 | 1160 | if ($buffer !== FALSE && $buffer != '') { |
| 1161 | 1161 | $tt[$format] = 0; |
@@ -1189,13 +1189,13 @@ discard block |
||
| 1189 | 1189 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
| 1190 | 1190 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
| 1191 | 1191 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
| 1192 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1192 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
| 1193 | 1193 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
| 1194 | 1194 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 1195 | 1195 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
| 1196 | 1196 | |
| 1197 | 1197 | if (isset($ais_data['timestamp'])) { |
| 1198 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
| 1198 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
| 1199 | 1199 | } else { |
| 1200 | 1200 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1201 | 1201 | } |
@@ -1206,10 +1206,10 @@ discard block |
||
| 1206 | 1206 | } elseif ($format == 'flightgearsp') { |
| 1207 | 1207 | //echo $buffer."\n"; |
| 1208 | 1208 | if (strlen($buffer) > 5) { |
| 1209 | - $line = explode(',',$buffer); |
|
| 1209 | + $line = explode(',', $buffer); |
|
| 1210 | 1210 | $data = array(); |
| 1211 | 1211 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
| 1212 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
| 1212 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
| 1213 | 1213 | $data['ident'] = $line[6]; |
| 1214 | 1214 | $data['aircraft_name'] = $line[7]; |
| 1215 | 1215 | $data['longitude'] = $line[1]; |
@@ -1226,16 +1226,16 @@ discard block |
||
| 1226 | 1226 | } elseif ($format == 'acars') { |
| 1227 | 1227 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
| 1228 | 1228 | $ACARS->add(trim($buffer)); |
| 1229 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 1229 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
| 1230 | 1230 | $ACARS->deleteLiveAcarsData(); |
| 1231 | 1231 | } elseif ($format == 'flightgearmp') { |
| 1232 | - if (substr($buffer,0,1) != '#') { |
|
| 1232 | + if (substr($buffer, 0, 1) != '#') { |
|
| 1233 | 1233 | $data = array(); |
| 1234 | 1234 | //echo $buffer."\n"; |
| 1235 | - $line = explode(' ',$buffer); |
|
| 1235 | + $line = explode(' ', $buffer); |
|
| 1236 | 1236 | if (count($line) == 11) { |
| 1237 | - $userserver = explode('@',$line[0]); |
|
| 1238 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 1237 | + $userserver = explode('@', $line[0]); |
|
| 1238 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
| 1239 | 1239 | $data['ident'] = $userserver[0]; |
| 1240 | 1240 | $data['registration'] = $userserver[0]; |
| 1241 | 1241 | $data['latitude'] = $line[4]; |
@@ -1243,8 +1243,8 @@ discard block |
||
| 1243 | 1243 | $data['altitude'] = $line[6]; |
| 1244 | 1244 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1245 | 1245 | $aircraft_type = $line[10]; |
| 1246 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 1247 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 1246 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
| 1247 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
| 1248 | 1248 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
| 1249 | 1249 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
| 1250 | 1250 | } |
@@ -1253,8 +1253,8 @@ discard block |
||
| 1253 | 1253 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
| 1254 | 1254 | die; |
| 1255 | 1255 | } elseif ($format == 'vrstcp') { |
| 1256 | - foreach($buffer as $all_data) { |
|
| 1257 | - $line = json_decode('{'.$all_data.'}',true); |
|
| 1256 | + foreach ($buffer as $all_data) { |
|
| 1257 | + $line = json_decode('{'.$all_data.'}', true); |
|
| 1258 | 1258 | $data = array(); |
| 1259 | 1259 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
| 1260 | 1260 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -1280,16 +1280,16 @@ discard block |
||
| 1280 | 1280 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
| 1281 | 1281 | unset($data); |
| 1282 | 1282 | } |
| 1283 | - } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
|
| 1283 | + } elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') { |
|
| 1284 | 1284 | $line = explode("\t", $buffer); |
| 1285 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
| 1285 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
| 1286 | 1286 | $key = $line[$k]; |
| 1287 | - $lined[$key] = $line[$k+1]; |
|
| 1287 | + $lined[$key] = $line[$k + 1]; |
|
| 1288 | 1288 | } |
| 1289 | 1289 | if (count($lined) > 3) { |
| 1290 | 1290 | $data['hex'] = $lined['hexid']; |
| 1291 | 1291 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
| 1292 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 1292 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
| 1293 | 1293 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
| 1294 | 1294 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
| 1295 | 1295 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -1308,22 +1308,22 @@ discard block |
||
| 1308 | 1308 | } else $error = true; |
| 1309 | 1309 | } elseif ($format == 'aprs' && $use_aprs) { |
| 1310 | 1310 | if ($aprs_connect == 0) { |
| 1311 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
| 1311 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
| 1312 | 1312 | $aprs_connect = 1; |
| 1313 | 1313 | } |
| 1314 | 1314 | |
| 1315 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 1315 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
| 1316 | 1316 | $aprs_last_tx = time(); |
| 1317 | 1317 | $data_aprs = "# Keep alive"; |
| 1318 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
| 1318 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | 1321 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
| 1322 | 1322 | //echo 'APRS data : '.$buffer."\n"; |
| 1323 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
| 1324 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
| 1323 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
| 1324 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
| 1325 | 1325 | //echo $buffer."\n"; |
| 1326 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 1326 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
| 1327 | 1327 | $line = $APRS->parse($buffer); |
| 1328 | 1328 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
| 1329 | 1329 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
@@ -1338,7 +1338,7 @@ discard block |
||
| 1338 | 1338 | if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; |
| 1339 | 1339 | if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; |
| 1340 | 1340 | if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; |
| 1341 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1341 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
| 1342 | 1342 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 1343 | 1343 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1344 | 1344 | if (isset($line['ident'])) $data['ident'] = $line['ident']; |
@@ -1385,9 +1385,9 @@ discard block |
||
| 1385 | 1385 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
| 1386 | 1386 | $Source->deleteOldLocationByType('gs'); |
| 1387 | 1387 | if (count($Source->getLocationInfoByName($data['ident'])) > 0) { |
| 1388 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
| 1388 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
| 1389 | 1389 | } else { |
| 1390 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
| 1390 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
| 1391 | 1391 | } |
| 1392 | 1392 | } else { |
| 1393 | 1393 | echo '/!\ Not added'."\n"; |
@@ -1400,7 +1400,7 @@ discard block |
||
| 1400 | 1400 | } |
| 1401 | 1401 | |
| 1402 | 1402 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
| 1403 | - $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
|
| 1403 | + $Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']); |
|
| 1404 | 1404 | } |
| 1405 | 1405 | /* |
| 1406 | 1406 | elseif (is_array($line) && $globalDebug && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] == 'Car' || $line['symbol'] == 'Ambulance' || $line['symbol'] == 'Van' || $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || $line['symbol'] == 'Motorcycle')) { |
@@ -1487,7 +1487,7 @@ discard block |
||
| 1487 | 1487 | connect_all($sourceee); |
| 1488 | 1488 | $sourceee = array(); |
| 1489 | 1489 | //connect_all($globalSources); |
| 1490 | - $tt[$format]=0; |
|
| 1490 | + $tt[$format] = 0; |
|
| 1491 | 1491 | break; |
| 1492 | 1492 | } |
| 1493 | 1493 | } |
@@ -1496,14 +1496,14 @@ discard block |
||
| 1496 | 1496 | } else { |
| 1497 | 1497 | $error = socket_strerror(socket_last_error()); |
| 1498 | 1498 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 1499 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 1499 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
| 1500 | 1500 | if (isset($globalDebug)) echo "Restarting...\n"; |
| 1501 | 1501 | // Restart the script if possible |
| 1502 | 1502 | if (is_array($sockets)) { |
| 1503 | 1503 | if ($globalDebug) echo "Shutdown all sockets..."; |
| 1504 | 1504 | |
| 1505 | 1505 | foreach ($sockets as $sock) { |
| 1506 | - @socket_shutdown($sock,2); |
|
| 1506 | + @socket_shutdown($sock, 2); |
|
| 1507 | 1507 | @socket_close($sock); |
| 1508 | 1508 | } |
| 1509 | 1509 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | require_once(dirname(__FILE__).'/class.create_db.php'); |
| 11 | 11 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
| 12 | 12 | require_once(dirname(__FILE__).'/class.settings.php'); |
| 13 | -$title="Install"; |
|
| 13 | +$title = "Install"; |
|
| 14 | 14 | require(dirname(__FILE__).'/../require/settings.php'); |
| 15 | 15 | require(dirname(__FILE__).'/header.php'); |
| 16 | 16 | |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | if (!extension_loaded('curl')) { |
| 70 | 70 | $error[] = "Curl is not loaded."; |
| 71 | 71 | } |
| 72 | -if(function_exists('apache_get_modules') ){ |
|
| 73 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
| 72 | +if (function_exists('apache_get_modules')) { |
|
| 73 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
| 74 | 74 | $error[] = "mod_rewrite is not available."; |
| 75 | 75 | } |
| 76 | 76 | /* |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
| 87 | 87 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
| 88 | 88 | if (function_exists('get_headers')) { |
| 89 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
| 90 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
| 89 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
| 90 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
| 91 | 91 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -452,13 +452,13 @@ discard block |
||
| 452 | 452 | ?> |
| 453 | 453 | <tr> |
| 454 | 454 | <?php |
| 455 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
| 455 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
| 456 | 456 | ?> |
| 457 | 457 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 458 | 458 | <td><input type="number" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
| 459 | 459 | <?php |
| 460 | 460 | } else { |
| 461 | - $hostport = explode(':',$source['host']); |
|
| 461 | + $hostport = explode(':', $source['host']); |
|
| 462 | 462 | if (isset($hostport[1])) { |
| 463 | 463 | $host = $hostport[0]; |
| 464 | 464 | $port = $hostport[1]; |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | <select name="timezone[]" id="timezone"> |
| 504 | 504 | <?php |
| 505 | 505 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
| 506 | - foreach($timezonelist as $timezone){ |
|
| 506 | + foreach ($timezonelist as $timezone) { |
|
| 507 | 507 | if (isset($source['timezone']) && $source['timezone'] == $timezone) { |
| 508 | 508 | print '<option selected>'.$timezone.'</option>'; |
| 509 | 509 | } elseif (!isset($source['timezone']) && $timezone == 'UTC') { |
@@ -553,7 +553,7 @@ discard block |
||
| 553 | 553 | <select name="timezone[]" id="timezone"> |
| 554 | 554 | <?php |
| 555 | 555 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
| 556 | - foreach($timezonelist as $timezone){ |
|
| 556 | + foreach ($timezonelist as $timezone) { |
|
| 557 | 557 | if ($timezone == 'UTC') { |
| 558 | 558 | print '<option selected>'.$timezone.'</option>'; |
| 559 | 559 | } else print '<option>'.$timezone.'</option>'; |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | <br /> |
| 866 | 866 | <p> |
| 867 | 867 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 868 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 868 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
| 869 | 869 | </p> |
| 870 | 870 | <br /> |
| 871 | 871 | <p> |
@@ -921,14 +921,14 @@ discard block |
||
| 921 | 921 | $error = ''; |
| 922 | 922 | |
| 923 | 923 | if (isset($_POST['dbtype'])) { |
| 924 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
| 925 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
| 926 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
| 927 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
| 928 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
| 929 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
| 930 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
| 931 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
| 924 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
| 925 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
| 926 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
| 927 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
| 928 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
| 929 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
| 930 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
| 931 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
| 932 | 932 | |
| 933 | 933 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
| 934 | 934 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -948,49 +948,49 @@ discard block |
||
| 948 | 948 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
| 949 | 949 | */ |
| 950 | 950 | |
| 951 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
| 951 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
| 952 | 952 | |
| 953 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
| 954 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
| 955 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
| 956 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
| 957 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
| 953 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
| 954 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
| 955 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
| 956 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
| 957 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
| 958 | 958 | |
| 959 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
| 960 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
| 961 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
| 962 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
| 963 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
| 964 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
| 965 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
| 966 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
| 967 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
| 968 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
| 959 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
| 960 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
| 961 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
| 962 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
| 963 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
| 964 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
| 965 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
| 966 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
| 967 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
| 968 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
| 969 | 969 | |
| 970 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
| 971 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
| 972 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
| 973 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
| 974 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
| 975 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
| 970 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
| 971 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
| 972 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
| 973 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
| 974 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
| 975 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
| 976 | 976 | |
| 977 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
| 978 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
| 977 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
| 978 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
| 979 | 979 | |
| 980 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
| 981 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
| 982 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
| 980 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
| 981 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
| 982 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
| 983 | 983 | |
| 984 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
| 984 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
| 985 | 985 | if ($acars == 'acars') { |
| 986 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
| 986 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
| 987 | 987 | } else { |
| 988 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
| 988 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
| 989 | 989 | } |
| 990 | 990 | |
| 991 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
| 992 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
| 993 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
| 991 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
| 992 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
| 993 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
| 994 | 994 | |
| 995 | 995 | $source_name = $_POST['source_name']; |
| 996 | 996 | $source_latitude = $_POST['source_latitude']; |
@@ -1004,8 +1004,8 @@ discard block |
||
| 1004 | 1004 | |
| 1005 | 1005 | $sources = array(); |
| 1006 | 1006 | foreach ($source_name as $keys => $name) { |
| 1007 | - 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]); |
|
| 1008 | - 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]); |
|
| 1007 | + 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]); |
|
| 1008 | + 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]); |
|
| 1009 | 1009 | } |
| 1010 | 1010 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
| 1011 | 1011 | |
@@ -1018,24 +1018,24 @@ discard block |
||
| 1018 | 1018 | $sbsurl = $_POST['sbsurl']; |
| 1019 | 1019 | */ |
| 1020 | 1020 | |
| 1021 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
| 1022 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
| 1023 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
| 1024 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
| 1025 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
| 1026 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
| 1027 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
| 1028 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
| 1021 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
| 1022 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
| 1023 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
| 1024 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
| 1025 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
| 1026 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
| 1027 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
| 1028 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
| 1029 | 1029 | |
| 1030 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
| 1031 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1032 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1033 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
| 1034 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1035 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1036 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
| 1037 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1038 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1030 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
| 1031 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
| 1032 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
| 1033 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
| 1034 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
| 1035 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
| 1036 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
| 1037 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
| 1038 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
| 1039 | 1039 | |
| 1040 | 1040 | /* |
| 1041 | 1041 | $globalSBS1Hosts = array(); |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | } |
| 1052 | 1052 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
| 1053 | 1053 | */ |
| 1054 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
| 1054 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
| 1055 | 1055 | $host = $_POST['host']; |
| 1056 | 1056 | $port = $_POST['port']; |
| 1057 | 1057 | $name = $_POST['name']; |
@@ -1068,100 +1068,100 @@ discard block |
||
| 1068 | 1068 | else $cov = 'FALSE'; |
| 1069 | 1069 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
| 1070 | 1070 | else $arch = 'FALSE'; |
| 1071 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezone[$key]); |
|
| 1071 | + if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezone[$key]); |
|
| 1072 | 1072 | if ($format[$key] == 'airwhere') $forcepilots = true; |
| 1073 | 1073 | } |
| 1074 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
| 1074 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
| 1075 | 1075 | |
| 1076 | 1076 | /* |
| 1077 | 1077 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
| 1078 | 1078 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
| 1079 | 1079 | */ |
| 1080 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
| 1081 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
| 1082 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
| 1080 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
| 1081 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
| 1082 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
| 1083 | 1083 | |
| 1084 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
| 1085 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
| 1084 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
| 1085 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
| 1086 | 1086 | |
| 1087 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
| 1088 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
| 1087 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
| 1088 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
| 1089 | 1089 | |
| 1090 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
| 1091 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
| 1092 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
| 1093 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
| 1090 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
| 1091 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
| 1092 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
| 1093 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
| 1094 | 1094 | |
| 1095 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
| 1096 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
| 1097 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
| 1095 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
| 1096 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
| 1097 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
| 1098 | 1098 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1099 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
| 1100 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1099 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
| 1100 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
| 1101 | 1101 | |
| 1102 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
| 1103 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
| 1104 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
| 1105 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
| 1106 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
| 1107 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
| 1108 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
| 1109 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
| 1102 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
| 1103 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
| 1104 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
| 1105 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
| 1106 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
| 1107 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
| 1108 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
| 1109 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
| 1110 | 1110 | |
| 1111 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
| 1112 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
| 1111 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
| 1112 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
| 1113 | 1113 | |
| 1114 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1115 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
| 1114 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1115 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
| 1116 | 1116 | |
| 1117 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
| 1117 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
| 1118 | 1118 | if ($archiveyear == "archiveyear") { |
| 1119 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
| 1119 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
| 1120 | 1120 | } else { |
| 1121 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
| 1121 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
| 1122 | 1122 | } |
| 1123 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1124 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
| 1125 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
| 1126 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
| 1123 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1124 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
| 1125 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
| 1126 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
| 1127 | 1127 | |
| 1128 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
| 1129 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
| 1130 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
| 1131 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
| 1128 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
| 1129 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
| 1130 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
| 1131 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
| 1132 | 1132 | |
| 1133 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
| 1134 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
| 1135 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
| 1133 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
| 1134 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
| 1135 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
| 1136 | 1136 | |
| 1137 | 1137 | // Create in settings.php keys not yet configurable if not already here |
| 1138 | 1138 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1139 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1139 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
| 1140 | 1140 | |
| 1141 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
| 1141 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
| 1142 | 1142 | if ($resetyearstats == 'resetyearstats') { |
| 1143 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
| 1143 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
| 1144 | 1144 | } else { |
| 1145 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
| 1145 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
| 1148 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
| 1149 | 1149 | if ($archive == 'archive') { |
| 1150 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
| 1150 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
| 1151 | 1151 | } else { |
| 1152 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
| 1152 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
| 1153 | 1153 | } |
| 1154 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
| 1154 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
| 1155 | 1155 | if ($daemon == 'daemon') { |
| 1156 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
| 1156 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
| 1157 | 1157 | } else { |
| 1158 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
| 1158 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
| 1159 | 1159 | } |
| 1160 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
| 1160 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
| 1161 | 1161 | if ($schedules == 'schedules') { |
| 1162 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
| 1162 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
| 1163 | 1163 | } else { |
| 1164 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
| 1164 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
| 1165 | 1165 | } |
| 1166 | 1166 | |
| 1167 | 1167 | /* |
@@ -1172,227 +1172,227 @@ discard block |
||
| 1172 | 1172 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
| 1173 | 1173 | } |
| 1174 | 1174 | */ |
| 1175 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
| 1176 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1177 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1178 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1179 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1175 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
| 1176 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
| 1177 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
| 1178 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
| 1179 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
| 1180 | 1180 | $va = false; |
| 1181 | 1181 | if ($globalivao == 'ivao') { |
| 1182 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
| 1182 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
| 1183 | 1183 | $va = true; |
| 1184 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1184 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
| 1185 | 1185 | if ($globalvatsim == 'vatsim') { |
| 1186 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
| 1186 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
| 1187 | 1187 | $va = true; |
| 1188 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1188 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
| 1189 | 1189 | if ($globalphpvms == 'phpvms') { |
| 1190 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
| 1190 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
| 1191 | 1191 | $va = true; |
| 1192 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1192 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
| 1193 | 1193 | if ($globalvam == 'vam') { |
| 1194 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
| 1194 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
| 1195 | 1195 | $va = true; |
| 1196 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1196 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
| 1197 | 1197 | if ($va) { |
| 1198 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
| 1199 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1198 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
| 1199 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
| 1200 | 1200 | if ($globalva == 'va' || $va) { |
| 1201 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
| 1202 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1201 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
| 1202 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
| 1203 | 1203 | } else { |
| 1204 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
| 1205 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1206 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1204 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
| 1205 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
| 1206 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | 1209 | |
| 1210 | 1210 | |
| 1211 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
| 1211 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
| 1212 | 1212 | if ($notam == 'notam') { |
| 1213 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
| 1213 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
| 1214 | 1214 | } else { |
| 1215 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
| 1215 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
| 1216 | 1216 | } |
| 1217 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
| 1217 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
| 1218 | 1218 | if ($owner == 'owner') { |
| 1219 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
| 1219 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
| 1220 | 1220 | } else { |
| 1221 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
| 1221 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
| 1222 | 1222 | } |
| 1223 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
| 1223 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
| 1224 | 1224 | if ($map3d == 'map3d') { |
| 1225 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
| 1225 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
| 1226 | 1226 | } else { |
| 1227 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
| 1227 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
| 1228 | 1228 | } |
| 1229 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
| 1229 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
| 1230 | 1230 | if ($crash == 'crash') { |
| 1231 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
| 1231 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
| 1232 | 1232 | } else { |
| 1233 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
| 1233 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
| 1234 | 1234 | } |
| 1235 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
| 1235 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
| 1236 | 1236 | if ($mapsatellites == 'mapsatellites') { |
| 1237 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
| 1237 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
| 1238 | 1238 | } else { |
| 1239 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
| 1239 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
| 1240 | 1240 | } |
| 1241 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
| 1241 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
| 1242 | 1242 | if ($map3ddefault == 'map3ddefault') { |
| 1243 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
| 1243 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
| 1244 | 1244 | } else { |
| 1245 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
| 1245 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
| 1246 | 1246 | } |
| 1247 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
| 1247 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
| 1248 | 1248 | if ($translate == 'translate') { |
| 1249 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
| 1249 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
| 1250 | 1250 | } else { |
| 1251 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
| 1251 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
| 1252 | 1252 | } |
| 1253 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
| 1253 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
| 1254 | 1254 | if ($realairlines == 'realairlines') { |
| 1255 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
| 1255 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
| 1256 | 1256 | } else { |
| 1257 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
| 1257 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
| 1258 | 1258 | } |
| 1259 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
| 1259 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
| 1260 | 1260 | if ($estimation == 'estimation') { |
| 1261 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
| 1261 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
| 1262 | 1262 | } else { |
| 1263 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
| 1263 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
| 1264 | 1264 | } |
| 1265 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
| 1265 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
| 1266 | 1266 | if ($metar == 'metar') { |
| 1267 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
| 1267 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
| 1268 | 1268 | } else { |
| 1269 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
| 1269 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
| 1270 | 1270 | } |
| 1271 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
| 1271 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
| 1272 | 1272 | if ($metarcycle == 'metarcycle') { |
| 1273 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
| 1273 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
| 1274 | 1274 | } else { |
| 1275 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
| 1275 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
| 1276 | 1276 | } |
| 1277 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
| 1277 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
| 1278 | 1278 | if ($fork == 'fork') { |
| 1279 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
| 1279 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
| 1280 | 1280 | } else { |
| 1281 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
| 1281 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
| 1284 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
| 1285 | 1285 | if ($colormap == 'colormap') { |
| 1286 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
| 1286 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
| 1287 | 1287 | } else { |
| 1288 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
| 1288 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | 1291 | if (isset($_POST['aircrafticoncolor'])) { |
| 1292 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
| 1293 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
| 1292 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
| 1293 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
| 1294 | 1294 | } |
| 1295 | 1295 | |
| 1296 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
| 1297 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
| 1296 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
| 1297 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
| 1298 | 1298 | |
| 1299 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
| 1300 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
| 1301 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
| 1302 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
| 1303 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
| 1304 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
| 1299 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
| 1300 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
| 1301 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
| 1302 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
| 1303 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
| 1304 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
| 1305 | 1305 | |
| 1306 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
| 1306 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
| 1307 | 1307 | if ($mappopup == 'mappopup') { |
| 1308 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
| 1308 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
| 1309 | 1309 | } else { |
| 1310 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
| 1310 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
| 1311 | 1311 | } |
| 1312 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
| 1312 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
| 1313 | 1313 | if ($airportpopup == 'airportpopup') { |
| 1314 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
| 1314 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
| 1315 | 1315 | } else { |
| 1316 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
| 1316 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
| 1317 | 1317 | } |
| 1318 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
| 1318 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
| 1319 | 1319 | if ($maphistory == 'maphistory') { |
| 1320 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
| 1320 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
| 1321 | 1321 | } else { |
| 1322 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
| 1322 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
| 1323 | 1323 | } |
| 1324 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
| 1324 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
| 1325 | 1325 | if ($maptooltip == 'maptooltip') { |
| 1326 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
| 1326 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
| 1327 | 1327 | } else { |
| 1328 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
| 1328 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
| 1329 | 1329 | } |
| 1330 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
| 1330 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
| 1331 | 1331 | if ($flightroute == 'flightroute') { |
| 1332 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
| 1332 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
| 1333 | 1333 | } else { |
| 1334 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
| 1334 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
| 1335 | 1335 | } |
| 1336 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
| 1336 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
| 1337 | 1337 | if ($flightremainingroute == 'flightremainingroute') { |
| 1338 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
| 1338 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
| 1339 | 1339 | } else { |
| 1340 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
| 1340 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
| 1341 | 1341 | } |
| 1342 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
| 1342 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
| 1343 | 1343 | if ($allflights == 'allflights') { |
| 1344 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
| 1344 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
| 1345 | 1345 | } else { |
| 1346 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
| 1346 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
| 1347 | 1347 | } |
| 1348 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
| 1348 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
| 1349 | 1349 | if ($bbox == 'bbox') { |
| 1350 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
| 1350 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
| 1351 | 1351 | } else { |
| 1352 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
| 1352 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
| 1353 | 1353 | } |
| 1354 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
| 1354 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
| 1355 | 1355 | if ($groundaltitude == 'groundaltitude') { |
| 1356 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
| 1356 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
| 1357 | 1357 | } else { |
| 1358 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
| 1358 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
| 1359 | 1359 | } |
| 1360 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
| 1360 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
| 1361 | 1361 | if ($waypoints == 'waypoints') { |
| 1362 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
| 1362 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
| 1363 | 1363 | } else { |
| 1364 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
| 1364 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
| 1365 | 1365 | } |
| 1366 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
| 1366 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
| 1367 | 1367 | if ($geoid == 'geoid') { |
| 1368 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
| 1368 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
| 1369 | 1369 | } else { |
| 1370 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
| 1370 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
| 1371 | 1371 | } |
| 1372 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
| 1373 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
| 1372 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
| 1373 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
| 1374 | 1374 | |
| 1375 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
| 1375 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
| 1376 | 1376 | if ($noairlines == 'noairlines') { |
| 1377 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
| 1377 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
| 1378 | 1378 | } else { |
| 1379 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
| 1379 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
| 1380 | 1380 | } |
| 1381 | 1381 | |
| 1382 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1382 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
| 1383 | 1383 | |
| 1384 | 1384 | // Set some defaults values... |
| 1385 | 1385 | if (!isset($globalAircraftImageSources)) { |
| 1386 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 1387 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1386 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
| 1387 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1388 | 1388 | } |
| 1389 | 1389 | |
| 1390 | 1390 | if (!isset($globalSchedulesSources)) { |
| 1391 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
| 1392 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1391 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
| 1392 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
| 1395 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
| 1396 | 1396 | |
| 1397 | 1397 | if ($error == '') settings::modify_settings($settings); |
| 1398 | 1398 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -25,20 +25,20 @@ discard block |
||
| 25 | 25 | fclose($fp); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public static function gunzip($in_file,$out_file_name = '') { |
|
| 28 | + public static function gunzip($in_file, $out_file_name = '') { |
|
| 29 | 29 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 30 | 30 | $buffer_size = 4096; // read 4kb at a time |
| 31 | 31 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
| 32 | 32 | if ($in_file != '' && file_exists($in_file)) { |
| 33 | 33 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 34 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 35 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 34 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
| 35 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
| 36 | 36 | else { |
| 37 | 37 | echo 'gzopen not available'; |
| 38 | 38 | die; |
| 39 | 39 | } |
| 40 | 40 | $out_file = fopen($out_file_name, 'wb'); |
| 41 | - while(!gzeof($file)) { |
|
| 41 | + while (!gzeof($file)) { |
|
| 42 | 42 | fwrite($out_file, gzread($file, $buffer_size)); |
| 43 | 43 | } |
| 44 | 44 | fclose($out_file); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | try { |
| 63 | 63 | self::$db_sqlite = new PDO('sqlite:'.$database); |
| 64 | 64 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 65 | - } catch(PDOException $e) { |
|
| 65 | + } catch (PDOException $e) { |
|
| 66 | 66 | return "error : ".$e->getMessage(); |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | //$Connection = new Connection(); |
| 78 | 78 | $sth = $Connection->db->prepare($query); |
| 79 | 79 | $sth->execute(array(':source' => $database_file)); |
| 80 | - } catch(PDOException $e) { |
|
| 80 | + } catch (PDOException $e) { |
|
| 81 | 81 | return "error : ".$e->getMessage(); |
| 82 | 82 | } |
| 83 | 83 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | try { |
| 89 | 89 | $sth = update_db::$db_sqlite->prepare($query); |
| 90 | 90 | $sth->execute(); |
| 91 | - } catch(PDOException $e) { |
|
| 91 | + } catch (PDOException $e) { |
|
| 92 | 92 | return "error : ".$e->getMessage(); |
| 93 | 93 | } |
| 94 | 94 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -99,11 +99,11 @@ discard block |
||
| 99 | 99 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 100 | 100 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 101 | 101 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
| 102 | - $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
| 102 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
| 103 | 103 | $sth_dest->execute($query_dest_values); |
| 104 | 104 | } |
| 105 | 105 | if ($globalTransaction) $Connection->db->commit(); |
| 106 | - } catch(PDOException $e) { |
|
| 106 | + } catch (PDOException $e) { |
|
| 107 | 107 | if ($globalTransaction) $Connection->db->rollBack(); |
| 108 | 108 | return "error : ".$e->getMessage(); |
| 109 | 109 | } |
@@ -119,26 +119,26 @@ discard block |
||
| 119 | 119 | //$Connection = new Connection(); |
| 120 | 120 | $sth = $Connection->db->prepare($query); |
| 121 | 121 | $sth->execute(array(':source' => 'oneworld')); |
| 122 | - } catch(PDOException $e) { |
|
| 122 | + } catch (PDOException $e) { |
|
| 123 | 123 | return "error : ".$e->getMessage(); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | if ($globalDebug) echo " - Add routes to DB -"; |
| 127 | 127 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 128 | 128 | $Spotter = new Spotter(); |
| 129 | - if ($fh = fopen($database_file,"r")) { |
|
| 129 | + if ($fh = fopen($database_file, "r")) { |
|
| 130 | 130 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
| 131 | 131 | $Connection = new Connection(); |
| 132 | 132 | $sth_dest = $Connection->db->prepare($query_dest); |
| 133 | 133 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 134 | 134 | while (!feof($fh)) { |
| 135 | - $line = fgetcsv($fh,9999,','); |
|
| 135 | + $line = fgetcsv($fh, 9999, ','); |
|
| 136 | 136 | if ($line[0] != '') { |
| 137 | 137 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
| 138 | 138 | try { |
| 139 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
| 139 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
| 140 | 140 | $sth_dest->execute($query_dest_values); |
| 141 | - } catch(PDOException $e) { |
|
| 141 | + } catch (PDOException $e) { |
|
| 142 | 142 | if ($globalTransaction) $Connection->db->rollBack(); |
| 143 | 143 | return "error : ".$e->getMessage(); |
| 144 | 144 | } |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | //$Connection = new Connection(); |
| 161 | 161 | $sth = $Connection->db->prepare($query); |
| 162 | 162 | $sth->execute(array(':source' => 'skyteam')); |
| 163 | - } catch(PDOException $e) { |
|
| 163 | + } catch (PDOException $e) { |
|
| 164 | 164 | return "error : ".$e->getMessage(); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -168,24 +168,24 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 170 | 170 | $Spotter = new Spotter(); |
| 171 | - if ($fh = fopen($database_file,"r")) { |
|
| 171 | + if ($fh = fopen($database_file, "r")) { |
|
| 172 | 172 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
| 173 | 173 | $Connection = new Connection(); |
| 174 | 174 | $sth_dest = $Connection->db->prepare($query_dest); |
| 175 | 175 | try { |
| 176 | 176 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 177 | 177 | while (!feof($fh)) { |
| 178 | - $line = fgetcsv($fh,9999,','); |
|
| 178 | + $line = fgetcsv($fh, 9999, ','); |
|
| 179 | 179 | if ($line[0] != '') { |
| 180 | - $datebe = explode(' - ',$line[2]); |
|
| 180 | + $datebe = explode(' - ', $line[2]); |
|
| 181 | 181 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
| 182 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
| 182 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
| 183 | 183 | $sth_dest->execute($query_dest_values); |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | if ($globalTransaction) $Connection->db->commit(); |
| 188 | - } catch(PDOException $e) { |
|
| 188 | + } catch (PDOException $e) { |
|
| 189 | 189 | if ($globalTransaction) $Connection->db->rollBack(); |
| 190 | 190 | return "error : ".$e->getMessage(); |
| 191 | 191 | } |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $Connection = new Connection(); |
| 201 | 201 | $sth = $Connection->db->prepare($query); |
| 202 | 202 | $sth->execute(array(':source' => $database_file)); |
| 203 | - } catch(PDOException $e) { |
|
| 203 | + } catch (PDOException $e) { |
|
| 204 | 204 | return "error : ".$e->getMessage(); |
| 205 | 205 | } |
| 206 | 206 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $Connection = new Connection(); |
| 209 | 209 | $sth = $Connection->db->prepare($query); |
| 210 | 210 | $sth->execute(array(':source' => $database_file)); |
| 211 | - } catch(PDOException $e) { |
|
| 211 | + } catch (PDOException $e) { |
|
| 212 | 212 | return "error : ".$e->getMessage(); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | try { |
| 218 | 218 | $sth = update_db::$db_sqlite->prepare($query); |
| 219 | 219 | $sth->execute(); |
| 220 | - } catch(PDOException $e) { |
|
| 220 | + } catch (PDOException $e) { |
|
| 221 | 221 | return "error : ".$e->getMessage(); |
| 222 | 222 | } |
| 223 | 223 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -234,15 +234,15 @@ discard block |
||
| 234 | 234 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
| 235 | 235 | if ($values['UserString4'] == 'M') $type = 'military'; |
| 236 | 236 | else $type = null; |
| 237 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
| 237 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
| 238 | 238 | $sth_dest->execute($query_dest_values); |
| 239 | 239 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
| 240 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 240 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
| 241 | 241 | $sth_dest_owner->execute($query_dest_owner_values); |
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | if ($globalTransaction) $Connection->db->commit(); |
| 245 | - } catch(PDOException $e) { |
|
| 245 | + } catch (PDOException $e) { |
|
| 246 | 246 | return "error : ".$e->getMessage(); |
| 247 | 247 | } |
| 248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | $Connection = new Connection(); |
| 253 | 253 | $sth = $Connection->db->prepare($query); |
| 254 | 254 | $sth->execute(array(':source' => $database_file)); |
| 255 | - } catch(PDOException $e) { |
|
| 255 | + } catch (PDOException $e) { |
|
| 256 | 256 | return "error : ".$e->getMessage(); |
| 257 | 257 | } |
| 258 | 258 | return ''; |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | $Connection = new Connection(); |
| 268 | 268 | $sth = $Connection->db->prepare($query); |
| 269 | 269 | $sth->execute(array(':source' => $database_file)); |
| 270 | - } catch(PDOException $e) { |
|
| 270 | + } catch (PDOException $e) { |
|
| 271 | 271 | return "error : ".$e->getMessage(); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if ($fh = fopen($database_file,"r")) { |
|
| 274 | + if ($fh = fopen($database_file, "r")) { |
|
| 275 | 275 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 276 | 276 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
| 277 | 277 | |
@@ -281,13 +281,13 @@ discard block |
||
| 281 | 281 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 282 | 282 | while (!feof($fh)) { |
| 283 | 283 | $values = array(); |
| 284 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
| 284 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
| 285 | 285 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 286 | - $values['ModeS'] = substr($line,0,6); |
|
| 287 | - $values['Registration'] = trim(substr($line,69,6)); |
|
| 288 | - $aircraft_name = trim(substr($line,48,6)); |
|
| 286 | + $values['ModeS'] = substr($line, 0, 6); |
|
| 287 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
| 288 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
| 289 | 289 | // Check if we can find ICAO, else set it to GLID |
| 290 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 290 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 291 | 291 | $search_more = ''; |
| 292 | 292 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 293 | 293 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -299,20 +299,20 @@ discard block |
||
| 299 | 299 | if (isset($result['icao']) && $result['icao'] != '') { |
| 300 | 300 | $values['ICAOTypeCode'] = $result['icao']; |
| 301 | 301 | } |
| 302 | - } catch(PDOException $e) { |
|
| 302 | + } catch (PDOException $e) { |
|
| 303 | 303 | return "error : ".$e->getMessage(); |
| 304 | 304 | } |
| 305 | 305 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 306 | 306 | // Add data to db |
| 307 | 307 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
| 308 | 308 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
| 309 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
| 309 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
| 310 | 310 | //print_r($query_dest_values); |
| 311 | 311 | $sth_dest->execute($query_dest_values); |
| 312 | 312 | } |
| 313 | 313 | } |
| 314 | 314 | if ($globalTransaction) $Connection->db->commit(); |
| 315 | - } catch(PDOException $e) { |
|
| 315 | + } catch (PDOException $e) { |
|
| 316 | 316 | return "error : ".$e->getMessage(); |
| 317 | 317 | } |
| 318 | 318 | } |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | $Connection = new Connection(); |
| 323 | 323 | $sth = $Connection->db->prepare($query); |
| 324 | 324 | $sth->execute(array(':source' => $database_file)); |
| 325 | - } catch(PDOException $e) { |
|
| 325 | + } catch (PDOException $e) { |
|
| 326 | 326 | return "error : ".$e->getMessage(); |
| 327 | 327 | } |
| 328 | 328 | return ''; |
@@ -336,11 +336,11 @@ discard block |
||
| 336 | 336 | $Connection = new Connection(); |
| 337 | 337 | $sth = $Connection->db->prepare($query); |
| 338 | 338 | $sth->execute(array(':source' => $database_file)); |
| 339 | - } catch(PDOException $e) { |
|
| 339 | + } catch (PDOException $e) { |
|
| 340 | 340 | return "error : ".$e->getMessage(); |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - if ($fh = fopen($database_file,"r")) { |
|
| 343 | + if ($fh = fopen($database_file, "r")) { |
|
| 344 | 344 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 345 | 345 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
| 346 | 346 | |
@@ -348,9 +348,9 @@ discard block |
||
| 348 | 348 | $sth_dest = $Connection->db->prepare($query_dest); |
| 349 | 349 | try { |
| 350 | 350 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 351 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
| 351 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
| 352 | 352 | while (!feof($fh)) { |
| 353 | - $line = fgetcsv($fh,9999,',',"'"); |
|
| 353 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
| 354 | 354 | |
| 355 | 355 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 356 | 356 | //print_r($line); |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | $values['ICAOTypeCode'] = ''; |
| 360 | 360 | $aircraft_name = $line[2]; |
| 361 | 361 | // Check if we can find ICAO, else set it to GLID |
| 362 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 362 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 363 | 363 | $search_more = ''; |
| 364 | 364 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 365 | 365 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -368,20 +368,20 @@ discard block |
||
| 368 | 368 | $sth_search->execute(); |
| 369 | 369 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 370 | 370 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
| 371 | - } catch(PDOException $e) { |
|
| 371 | + } catch (PDOException $e) { |
|
| 372 | 372 | return "error : ".$e->getMessage(); |
| 373 | 373 | } |
| 374 | 374 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 375 | 375 | // Add data to db |
| 376 | 376 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
| 377 | 377 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
| 378 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
| 378 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
| 379 | 379 | //print_r($query_dest_values); |
| 380 | 380 | $sth_dest->execute($query_dest_values); |
| 381 | 381 | } |
| 382 | 382 | } |
| 383 | 383 | if ($globalTransaction) $Connection->db->commit(); |
| 384 | - } catch(PDOException $e) { |
|
| 384 | + } catch (PDOException $e) { |
|
| 385 | 385 | return "error : ".$e->getMessage(); |
| 386 | 386 | } |
| 387 | 387 | } |
@@ -391,13 +391,13 @@ discard block |
||
| 391 | 391 | $Connection = new Connection(); |
| 392 | 392 | $sth = $Connection->db->prepare($query); |
| 393 | 393 | $sth->execute(array(':source' => $database_file)); |
| 394 | - } catch(PDOException $e) { |
|
| 394 | + } catch (PDOException $e) { |
|
| 395 | 395 | return "error : ".$e->getMessage(); |
| 396 | 396 | } |
| 397 | 397 | return ''; |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
| 400 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
| 401 | 401 | global $globalTransaction, $globalMasterSource; |
| 402 | 402 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
| 403 | 403 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -405,12 +405,12 @@ discard block |
||
| 405 | 405 | $Connection = new Connection(); |
| 406 | 406 | $sth = $Connection->db->prepare($query); |
| 407 | 407 | $sth->execute(array(':source' => $database_file)); |
| 408 | - } catch(PDOException $e) { |
|
| 408 | + } catch (PDOException $e) { |
|
| 409 | 409 | return "error : ".$e->getMessage(); |
| 410 | 410 | } |
| 411 | 411 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 412 | 412 | $Spotter = new Spotter(); |
| 413 | - if ($fh = fopen($database_file,"r")) { |
|
| 413 | + if ($fh = fopen($database_file, "r")) { |
|
| 414 | 414 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 415 | 415 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 416 | 416 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -420,9 +420,9 @@ discard block |
||
| 420 | 420 | $sth_modes = $Connection->db->prepare($query_modes); |
| 421 | 421 | try { |
| 422 | 422 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 423 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
| 423 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
| 424 | 424 | while (!feof($fh)) { |
| 425 | - $line = fgetcsv($fh,9999,',','"'); |
|
| 425 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
| 426 | 426 | $values = array(); |
| 427 | 427 | //print_r($line); |
| 428 | 428 | if ($country == 'F') { |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $values['base'] = $line[4]; |
| 431 | 431 | $values['owner'] = $line[5]; |
| 432 | 432 | if ($line[6] == '') $values['date_first_reg'] = null; |
| 433 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 433 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 434 | 434 | $values['cancel'] = $line[7]; |
| 435 | 435 | } elseif ($country == 'EI') { |
| 436 | 436 | // TODO : add modeS & reg to aircraft_modes |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | $values['base'] = $line[3]; |
| 439 | 439 | $values['owner'] = $line[2]; |
| 440 | 440 | if ($line[1] == '') $values['date_first_reg'] = null; |
| 441 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 441 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
| 442 | 442 | $values['cancel'] = ''; |
| 443 | 443 | $values['modes'] = $line[7]; |
| 444 | 444 | $values['icao'] = $line[8]; |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | $values['base'] = null; |
| 459 | 459 | $values['owner'] = $line[5]; |
| 460 | 460 | if ($line[18] == '') $values['date_first_reg'] = null; |
| 461 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 461 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
| 462 | 462 | $values['cancel'] = ''; |
| 463 | 463 | } elseif ($country == 'VH') { |
| 464 | 464 | // TODO : add modeS & reg to aircraft_modes |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | $values['base'] = null; |
| 467 | 467 | $values['owner'] = $line[12]; |
| 468 | 468 | if ($line[28] == '') $values['date_first_reg'] = null; |
| 469 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 469 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
| 470 | 470 | |
| 471 | 471 | $values['cancel'] = $line[39]; |
| 472 | 472 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -486,28 +486,28 @@ discard block |
||
| 486 | 486 | $values['base'] = null; |
| 487 | 487 | $values['owner'] = $line[8]; |
| 488 | 488 | if ($line[7] == '') $values['date_first_reg'] = null; |
| 489 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 489 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 490 | 490 | $values['cancel'] = ''; |
| 491 | 491 | } elseif ($country == 'PP') { |
| 492 | 492 | $values['registration'] = $line[0]; |
| 493 | 493 | $values['base'] = null; |
| 494 | 494 | $values['owner'] = $line[4]; |
| 495 | 495 | if ($line[6] == '') $values['date_first_reg'] = null; |
| 496 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 496 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 497 | 497 | $values['cancel'] = $line[7]; |
| 498 | 498 | } elseif ($country == 'E7') { |
| 499 | 499 | $values['registration'] = $line[0]; |
| 500 | 500 | $values['base'] = null; |
| 501 | 501 | $values['owner'] = $line[4]; |
| 502 | 502 | if ($line[5] == '') $values['date_first_reg'] = null; |
| 503 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 503 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
| 504 | 504 | $values['cancel'] = ''; |
| 505 | 505 | } elseif ($country == '8Q') { |
| 506 | 506 | $values['registration'] = $line[0]; |
| 507 | 507 | $values['base'] = null; |
| 508 | 508 | $values['owner'] = $line[3]; |
| 509 | 509 | if ($line[7] == '') $values['date_first_reg'] = null; |
| 510 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 510 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 511 | 511 | $values['cancel'] = ''; |
| 512 | 512 | } elseif ($country == 'ZK') { |
| 513 | 513 | $values['registration'] = $line[0]; |
@@ -521,18 +521,18 @@ discard block |
||
| 521 | 521 | $values['registration'] = $line[0]; |
| 522 | 522 | $values['base'] = null; |
| 523 | 523 | $values['owner'] = $line[6]; |
| 524 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 525 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
| 524 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
| 525 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
| 526 | 526 | $values['modes'] = $line[4]; |
| 527 | 527 | $values['icao'] = $line[10]; |
| 528 | 528 | } elseif ($country == 'OY') { |
| 529 | 529 | $values['registration'] = $line[0]; |
| 530 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
| 530 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
| 531 | 531 | $values['modes'] = $line[5]; |
| 532 | 532 | $values['icao'] = $line[6]; |
| 533 | 533 | } elseif ($country == 'PH') { |
| 534 | 534 | $values['registration'] = $line[0]; |
| 535 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
| 535 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
| 536 | 536 | $values['modes'] = $line[4]; |
| 537 | 537 | $values['icao'] = $line[5]; |
| 538 | 538 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -543,17 +543,17 @@ discard block |
||
| 543 | 543 | $values['cancel'] = ''; |
| 544 | 544 | } |
| 545 | 545 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
| 546 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
| 546 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
| 547 | 547 | $sth_dest->execute($query_dest_values); |
| 548 | 548 | } |
| 549 | 549 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
| 550 | 550 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
| 551 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
| 551 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
| 552 | 552 | $sth_modes->execute($query_modes_values); |
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | 555 | if ($globalTransaction) $Connection->db->commit(); |
| 556 | - } catch(PDOException $e) { |
|
| 556 | + } catch (PDOException $e) { |
|
| 557 | 557 | return "error : ".$e->getMessage(); |
| 558 | 558 | } |
| 559 | 559 | } |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | $Connection = new Connection(); |
| 669 | 669 | $sth = $Connection->db->prepare($query); |
| 670 | 670 | $sth->execute(); |
| 671 | - } catch(PDOException $e) { |
|
| 671 | + } catch (PDOException $e) { |
|
| 672 | 672 | return "error : ".$e->getMessage(); |
| 673 | 673 | } |
| 674 | 674 | |
@@ -678,7 +678,7 @@ discard block |
||
| 678 | 678 | $Connection = new Connection(); |
| 679 | 679 | $sth = $Connection->db->prepare($query); |
| 680 | 680 | $sth->execute(); |
| 681 | - } catch(PDOException $e) { |
|
| 681 | + } catch (PDOException $e) { |
|
| 682 | 682 | return "error : ".$e->getMessage(); |
| 683 | 683 | } |
| 684 | 684 | |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 690 | 690 | |
| 691 | 691 | $i = 0; |
| 692 | - while($row = sparql_fetch_array($result)) |
|
| 692 | + while ($row = sparql_fetch_array($result)) |
|
| 693 | 693 | { |
| 694 | 694 | if ($i >= 1) { |
| 695 | 695 | //print_r($row); |
@@ -709,31 +709,31 @@ discard block |
||
| 709 | 709 | $row['image'] = ''; |
| 710 | 710 | $row['image_thumb'] = ''; |
| 711 | 711 | } else { |
| 712 | - $image = str_replace(' ','_',$row['image']); |
|
| 712 | + $image = str_replace(' ', '_', $row['image']); |
|
| 713 | 713 | $digest = md5($image); |
| 714 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
| 715 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
| 716 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
| 717 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
| 714 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
| 715 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
| 716 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
| 717 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | - $country = explode('-',$row['country']); |
|
| 720 | + $country = explode('-', $row['country']); |
|
| 721 | 721 | $row['country'] = $country[0]; |
| 722 | 722 | |
| 723 | 723 | $row['type'] = trim($row['type']); |
| 724 | - 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'])) { |
|
| 724 | + 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'])) { |
|
| 725 | 725 | $row['type'] = 'Military'; |
| 726 | 726 | } 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') { |
| 727 | 727 | $row['type'] = 'small_airport'; |
| 728 | 728 | } |
| 729 | 729 | |
| 730 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
| 731 | - $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $row['altitude'],':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
| 730 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
| 731 | + $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']); |
|
| 732 | 732 | //print_r($query_dest_values); |
| 733 | 733 | |
| 734 | 734 | try { |
| 735 | 735 | $sth_dest->execute($query_dest_values); |
| 736 | - } catch(PDOException $e) { |
|
| 736 | + } catch (PDOException $e) { |
|
| 737 | 737 | return "error : ".$e->getMessage(); |
| 738 | 738 | } |
| 739 | 739 | } |
@@ -747,7 +747,7 @@ discard block |
||
| 747 | 747 | $Connection = new Connection(); |
| 748 | 748 | $sth = $Connection->db->prepare($query); |
| 749 | 749 | $sth->execute(); |
| 750 | - } catch(PDOException $e) { |
|
| 750 | + } catch (PDOException $e) { |
|
| 751 | 751 | return "error : ".$e->getMessage(); |
| 752 | 752 | } |
| 753 | 753 | |
@@ -755,12 +755,12 @@ discard block |
||
| 755 | 755 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
| 756 | 756 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
| 757 | 757 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
| 758 | - $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' => ''); |
|
| 758 | + $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' => ''); |
|
| 759 | 759 | try { |
| 760 | 760 | $Connection = new Connection(); |
| 761 | 761 | $sth = $Connection->db->prepare($query); |
| 762 | 762 | $sth->execute($query_values); |
| 763 | - } catch(PDOException $e) { |
|
| 763 | + } catch (PDOException $e) { |
|
| 764 | 764 | return "error : ".$e->getMessage(); |
| 765 | 765 | } |
| 766 | 766 | $i++; |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | echo "Download data from ourairports.com...\n"; |
| 779 | 779 | $delimiter = ','; |
| 780 | 780 | $out_file = $tmp_dir.'airports.csv'; |
| 781 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
| 781 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
| 782 | 782 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 783 | 783 | echo "Add data from ourairports.com...\n"; |
| 784 | 784 | |
@@ -789,32 +789,32 @@ discard block |
||
| 789 | 789 | //$Connection->db->beginTransaction(); |
| 790 | 790 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 791 | 791 | { |
| 792 | - if(!$header) $header = $row; |
|
| 792 | + if (!$header) $header = $row; |
|
| 793 | 793 | else { |
| 794 | 794 | $data = array(); |
| 795 | 795 | $data = array_combine($header, $row); |
| 796 | 796 | try { |
| 797 | 797 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao'); |
| 798 | 798 | $sth->execute(array(':icao' => $data['gps_code'])); |
| 799 | - } catch(PDOException $e) { |
|
| 799 | + } catch (PDOException $e) { |
|
| 800 | 800 | return "error : ".$e->getMessage(); |
| 801 | 801 | } |
| 802 | 802 | if ($sth->fetchColumn() > 0) { |
| 803 | 803 | $query = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
| 804 | 804 | try { |
| 805 | 805 | $sth = $Connection->db->prepare($query); |
| 806 | - $sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type'])); |
|
| 807 | - } catch(PDOException $e) { |
|
| 806 | + $sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type'])); |
|
| 807 | + } catch (PDOException $e) { |
|
| 808 | 808 | return "error : ".$e->getMessage(); |
| 809 | 809 | } |
| 810 | 810 | } else { |
| 811 | 811 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`) |
| 812 | 812 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
| 813 | - $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']); |
|
| 813 | + $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']); |
|
| 814 | 814 | try { |
| 815 | 815 | $sth = $Connection->db->prepare($query); |
| 816 | 816 | $sth->execute($query_values); |
| 817 | - } catch(PDOException $e) { |
|
| 817 | + } catch (PDOException $e) { |
|
| 818 | 818 | return "error : ".$e->getMessage(); |
| 819 | 819 | } |
| 820 | 820 | $i++; |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | |
| 828 | 828 | echo "Download data from another free database...\n"; |
| 829 | 829 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 830 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
| 830 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
| 831 | 831 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 832 | 832 | update_db::unzip($out_file); |
| 833 | 833 | $header = NULL; |
@@ -839,15 +839,15 @@ discard block |
||
| 839 | 839 | //$Connection->db->beginTransaction(); |
| 840 | 840 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 841 | 841 | { |
| 842 | - if(!$header) $header = $row; |
|
| 842 | + if (!$header) $header = $row; |
|
| 843 | 843 | else { |
| 844 | 844 | $data = $row; |
| 845 | 845 | |
| 846 | 846 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
| 847 | 847 | try { |
| 848 | 848 | $sth = $Connection->db->prepare($query); |
| 849 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
| 850 | - } catch(PDOException $e) { |
|
| 849 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
| 850 | + } catch (PDOException $e) { |
|
| 851 | 851 | return "error : ".$e->getMessage(); |
| 852 | 852 | } |
| 853 | 853 | } |
@@ -861,15 +861,15 @@ discard block |
||
| 861 | 861 | try { |
| 862 | 862 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'"); |
| 863 | 863 | $sth->execute(); |
| 864 | - } catch(PDOException $e) { |
|
| 864 | + } catch (PDOException $e) { |
|
| 865 | 865 | return "error : ".$e->getMessage(); |
| 866 | 866 | } |
| 867 | 867 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 868 | 868 | $query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
| 869 | 869 | try { |
| 870 | 870 | $sth2 = $Connection->db->prepare($query2); |
| 871 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
| 872 | - } catch(PDOException $e) { |
|
| 871 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
| 872 | + } catch (PDOException $e) { |
|
| 873 | 873 | return "error : ".$e->getMessage(); |
| 874 | 874 | } |
| 875 | 875 | } |
@@ -893,7 +893,7 @@ discard block |
||
| 893 | 893 | $Connection = new Connection(); |
| 894 | 894 | $sth = $Connection->db->prepare($query); |
| 895 | 895 | $sth->execute(array(':source' => 'translation.csv')); |
| 896 | - } catch(PDOException $e) { |
|
| 896 | + } catch (PDOException $e) { |
|
| 897 | 897 | return "error : ".$e->getMessage(); |
| 898 | 898 | } |
| 899 | 899 | |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 911 | 911 | { |
| 912 | 912 | $i++; |
| 913 | - if($i > 12) { |
|
| 913 | + if ($i > 12) { |
|
| 914 | 914 | $data = $row; |
| 915 | 915 | $operator = $data[2]; |
| 916 | 916 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -918,7 +918,7 @@ discard block |
||
| 918 | 918 | //echo substr($operator, 0, 2)."\n";; |
| 919 | 919 | if (count($airline_array) > 0) { |
| 920 | 920 | //print_r($airline_array); |
| 921 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
| 921 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
| 922 | 922 | } |
| 923 | 923 | } |
| 924 | 924 | |
@@ -926,14 +926,14 @@ discard block |
||
| 926 | 926 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
| 927 | 927 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
| 928 | 928 | if (count($airline_array) > 0) { |
| 929 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 929 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
| 930 | 930 | } |
| 931 | 931 | } |
| 932 | 932 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 933 | 933 | try { |
| 934 | 934 | $sth = $Connection->db->prepare($query); |
| 935 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 936 | - } catch(PDOException $e) { |
|
| 935 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 936 | + } catch (PDOException $e) { |
|
| 937 | 937 | return "error : ".$e->getMessage(); |
| 938 | 938 | } |
| 939 | 939 | } |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | $Connection = new Connection(); |
| 954 | 954 | $sth = $Connection->db->prepare($query); |
| 955 | 955 | $sth->execute(array(':source' => 'website_fam')); |
| 956 | - } catch(PDOException $e) { |
|
| 956 | + } catch (PDOException $e) { |
|
| 957 | 957 | return "error : ".$e->getMessage(); |
| 958 | 958 | } |
| 959 | 959 | |
@@ -973,8 +973,8 @@ discard block |
||
| 973 | 973 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 974 | 974 | try { |
| 975 | 975 | $sth = $Connection->db->prepare($query); |
| 976 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 977 | - } catch(PDOException $e) { |
|
| 976 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 977 | + } catch (PDOException $e) { |
|
| 978 | 978 | return "error : ".$e->getMessage(); |
| 979 | 979 | } |
| 980 | 980 | } |
@@ -997,7 +997,7 @@ discard block |
||
| 997 | 997 | $Connection = new Connection(); |
| 998 | 998 | $sth = $Connection->db->prepare($query); |
| 999 | 999 | $sth->execute(array(':source' => 'website_faa')); |
| 1000 | - } catch(PDOException $e) { |
|
| 1000 | + } catch (PDOException $e) { |
|
| 1001 | 1001 | return "error : ".$e->getMessage(); |
| 1002 | 1002 | } |
| 1003 | 1003 | |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | $Connection = new Connection(); |
| 1007 | 1007 | $sth = $Connection->db->prepare($query); |
| 1008 | 1008 | $sth->execute(array(':source' => 'website_faa')); |
| 1009 | - } catch(PDOException $e) { |
|
| 1009 | + } catch (PDOException $e) { |
|
| 1010 | 1010 | return "error : ".$e->getMessage(); |
| 1011 | 1011 | } |
| 1012 | 1012 | |
@@ -1023,8 +1023,8 @@ discard block |
||
| 1023 | 1023 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
| 1024 | 1024 | try { |
| 1025 | 1025 | $sths = $Connection->db->prepare($query_search); |
| 1026 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
| 1027 | - } catch(PDOException $e) { |
|
| 1026 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
| 1027 | + } catch (PDOException $e) { |
|
| 1028 | 1028 | return "error s : ".$e->getMessage(); |
| 1029 | 1029 | } |
| 1030 | 1030 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1037,8 +1037,8 @@ discard block |
||
| 1037 | 1037 | //} |
| 1038 | 1038 | try { |
| 1039 | 1039 | $sthi = $Connection->db->prepare($queryi); |
| 1040 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
| 1041 | - } catch(PDOException $e) { |
|
| 1040 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
| 1041 | + } catch (PDOException $e) { |
|
| 1042 | 1042 | return "error u : ".$e->getMessage(); |
| 1043 | 1043 | } |
| 1044 | 1044 | } else { |
@@ -1046,7 +1046,7 @@ discard block |
||
| 1046 | 1046 | try { |
| 1047 | 1047 | $sthsm = $Connection->db->prepare($query_search_mfr); |
| 1048 | 1048 | $sthsm->execute(array(':mfr' => $data[2])); |
| 1049 | - } catch(PDOException $e) { |
|
| 1049 | + } catch (PDOException $e) { |
|
| 1050 | 1050 | return "error mfr : ".$e->getMessage(); |
| 1051 | 1051 | } |
| 1052 | 1052 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1056,8 +1056,8 @@ discard block |
||
| 1056 | 1056 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
| 1057 | 1057 | try { |
| 1058 | 1058 | $sthf = $Connection->db->prepare($queryf); |
| 1059 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
| 1060 | - } catch(PDOException $e) { |
|
| 1059 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
| 1060 | + } catch (PDOException $e) { |
|
| 1061 | 1061 | return "error f : ".$e->getMessage(); |
| 1062 | 1062 | } |
| 1063 | 1063 | } |
@@ -1067,13 +1067,13 @@ discard block |
||
| 1067 | 1067 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 1068 | 1068 | try { |
| 1069 | 1069 | $sth = $Connection->db->prepare($query); |
| 1070 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
| 1071 | - } catch(PDOException $e) { |
|
| 1070 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
| 1071 | + } catch (PDOException $e) { |
|
| 1072 | 1072 | return "error i : ".$e->getMessage(); |
| 1073 | 1073 | } |
| 1074 | 1074 | } |
| 1075 | 1075 | } |
| 1076 | - if ($i % 90 == 0) { |
|
| 1076 | + if ($i%90 == 0) { |
|
| 1077 | 1077 | if ($globalTransaction) $Connection->db->commit(); |
| 1078 | 1078 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1079 | 1079 | } |
@@ -1092,7 +1092,7 @@ discard block |
||
| 1092 | 1092 | $Connection = new Connection(); |
| 1093 | 1093 | $sth = $Connection->db->prepare($query); |
| 1094 | 1094 | $sth->execute(array(':source' => 'website_fam')); |
| 1095 | - } catch(PDOException $e) { |
|
| 1095 | + } catch (PDOException $e) { |
|
| 1096 | 1096 | return "error : ".$e->getMessage(); |
| 1097 | 1097 | } |
| 1098 | 1098 | |
@@ -1113,8 +1113,8 @@ discard block |
||
| 1113 | 1113 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
| 1114 | 1114 | try { |
| 1115 | 1115 | $sth = $Connection->db->prepare($query); |
| 1116 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
| 1117 | - } catch(PDOException $e) { |
|
| 1116 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
| 1117 | + } catch (PDOException $e) { |
|
| 1118 | 1118 | return "error : ".$e->getMessage(); |
| 1119 | 1119 | } |
| 1120 | 1120 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | $Connection = new Connection(); |
| 1134 | 1134 | $sth = $Connection->db->prepare($query); |
| 1135 | 1135 | $sth->execute(array(':source' => 'website_fam')); |
| 1136 | - } catch(PDOException $e) { |
|
| 1136 | + } catch (PDOException $e) { |
|
| 1137 | 1137 | return "error : ".$e->getMessage(); |
| 1138 | 1138 | } |
| 1139 | 1139 | |
@@ -1149,8 +1149,8 @@ discard block |
||
| 1149 | 1149 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
| 1150 | 1150 | try { |
| 1151 | 1151 | $sth = $Connection->db->prepare($query); |
| 1152 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
| 1153 | - } catch(PDOException $e) { |
|
| 1152 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
| 1153 | + } catch (PDOException $e) { |
|
| 1154 | 1154 | print_r($data); |
| 1155 | 1155 | return "error : ".$e->getMessage(); |
| 1156 | 1156 | } |
@@ -1170,7 +1170,7 @@ discard block |
||
| 1170 | 1170 | $Connection = new Connection(); |
| 1171 | 1171 | $sth = $Connection->db->prepare($query); |
| 1172 | 1172 | $sth->execute(array(':source' => 'website_fam')); |
| 1173 | - } catch(PDOException $e) { |
|
| 1173 | + } catch (PDOException $e) { |
|
| 1174 | 1174 | return "error : ".$e->getMessage(); |
| 1175 | 1175 | } |
| 1176 | 1176 | |
@@ -1190,8 +1190,8 @@ discard block |
||
| 1190 | 1190 | $query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
| 1191 | 1191 | try { |
| 1192 | 1192 | $sth = $Connection->db->prepare($query); |
| 1193 | - $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
| 1194 | - } catch(PDOException $e) { |
|
| 1193 | + $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
| 1194 | + } catch (PDOException $e) { |
|
| 1195 | 1195 | return "error : ".$e->getMessage(); |
| 1196 | 1196 | } |
| 1197 | 1197 | } |
@@ -1210,7 +1210,7 @@ discard block |
||
| 1210 | 1210 | $Connection = new Connection(); |
| 1211 | 1211 | $sth = $Connection->db->prepare($query); |
| 1212 | 1212 | $sth->execute(); |
| 1213 | - } catch(PDOException $e) { |
|
| 1213 | + } catch (PDOException $e) { |
|
| 1214 | 1214 | return "error : ".$e->getMessage(); |
| 1215 | 1215 | } |
| 1216 | 1216 | |
@@ -1231,8 +1231,8 @@ discard block |
||
| 1231 | 1231 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
| 1232 | 1232 | try { |
| 1233 | 1233 | $sth = $Connection->db->prepare($query); |
| 1234 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
| 1235 | - } catch(PDOException $e) { |
|
| 1234 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
| 1235 | + } catch (PDOException $e) { |
|
| 1236 | 1236 | return "error : ".$e->getMessage(); |
| 1237 | 1237 | } |
| 1238 | 1238 | } |
@@ -1251,7 +1251,7 @@ discard block |
||
| 1251 | 1251 | $Connection = new Connection(); |
| 1252 | 1252 | $sth = $Connection->db->prepare($query); |
| 1253 | 1253 | $sth->execute(); |
| 1254 | - } catch(PDOException $e) { |
|
| 1254 | + } catch (PDOException $e) { |
|
| 1255 | 1255 | return "error : ".$e->getMessage(); |
| 1256 | 1256 | } |
| 1257 | 1257 | |
@@ -1267,7 +1267,7 @@ discard block |
||
| 1267 | 1267 | try { |
| 1268 | 1268 | $sth = $Connection->db->prepare($query); |
| 1269 | 1269 | $sth->execute(array(':icao' => $icao)); |
| 1270 | - } catch(PDOException $e) { |
|
| 1270 | + } catch (PDOException $e) { |
|
| 1271 | 1271 | return "error : ".$e->getMessage(); |
| 1272 | 1272 | } |
| 1273 | 1273 | } |
@@ -1278,7 +1278,7 @@ discard block |
||
| 1278 | 1278 | return ''; |
| 1279 | 1279 | } |
| 1280 | 1280 | |
| 1281 | - public static function tle($filename,$tletype) { |
|
| 1281 | + public static function tle($filename, $tletype) { |
|
| 1282 | 1282 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 1283 | 1283 | global $tmp_dir, $globalTransaction; |
| 1284 | 1284 | //$Spotter = new Spotter(); |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | $Connection = new Connection(); |
| 1289 | 1289 | $sth = $Connection->db->prepare($query); |
| 1290 | 1290 | $sth->execute(array(':source' => $filename)); |
| 1291 | - } catch(PDOException $e) { |
|
| 1291 | + } catch (PDOException $e) { |
|
| 1292 | 1292 | return "error : ".$e->getMessage(); |
| 1293 | 1293 | } |
| 1294 | 1294 | |
@@ -1313,8 +1313,8 @@ discard block |
||
| 1313 | 1313 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
| 1314 | 1314 | try { |
| 1315 | 1315 | $sth = $Connection->db->prepare($query); |
| 1316 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
| 1317 | - } catch(PDOException $e) { |
|
| 1316 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
| 1317 | + } catch (PDOException $e) { |
|
| 1318 | 1318 | return "error : ".$e->getMessage(); |
| 1319 | 1319 | } |
| 1320 | 1320 | |
@@ -1334,28 +1334,28 @@ discard block |
||
| 1334 | 1334 | */ |
| 1335 | 1335 | private static function table2array($data) { |
| 1336 | 1336 | $html = str_get_html($data); |
| 1337 | - $tabledata=array(); |
|
| 1338 | - foreach($html->find('tr') as $element) |
|
| 1337 | + $tabledata = array(); |
|
| 1338 | + foreach ($html->find('tr') as $element) |
|
| 1339 | 1339 | { |
| 1340 | 1340 | $td = array(); |
| 1341 | - foreach( $element->find('th') as $row) |
|
| 1341 | + foreach ($element->find('th') as $row) |
|
| 1342 | 1342 | { |
| 1343 | 1343 | $td [] = trim($row->plaintext); |
| 1344 | 1344 | } |
| 1345 | - $td=array_filter($td); |
|
| 1345 | + $td = array_filter($td); |
|
| 1346 | 1346 | $tabledata[] = $td; |
| 1347 | 1347 | |
| 1348 | 1348 | $td = array(); |
| 1349 | 1349 | $tdi = array(); |
| 1350 | - foreach( $element->find('td') as $row) |
|
| 1350 | + foreach ($element->find('td') as $row) |
|
| 1351 | 1351 | { |
| 1352 | 1352 | $td [] = trim($row->plaintext); |
| 1353 | 1353 | $tdi [] = trim($row->innertext); |
| 1354 | 1354 | } |
| 1355 | - $td=array_filter($td); |
|
| 1356 | - $tdi=array_filter($tdi); |
|
| 1355 | + $td = array_filter($td); |
|
| 1356 | + $tdi = array_filter($tdi); |
|
| 1357 | 1357 | // $tabledata[]=array_merge($td,$tdi); |
| 1358 | - $tabledata[]=$td; |
|
| 1358 | + $tabledata[] = $td; |
|
| 1359 | 1359 | } |
| 1360 | 1360 | return(array_filter($tabledata)); |
| 1361 | 1361 | } |
@@ -1428,13 +1428,13 @@ discard block |
||
| 1428 | 1428 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1429 | 1429 | { |
| 1430 | 1430 | $i++; |
| 1431 | - if($i > 3 && count($row) > 2) { |
|
| 1431 | + if ($i > 3 && count($row) > 2) { |
|
| 1432 | 1432 | $data = array_values(array_filter($row)); |
| 1433 | 1433 | $cntdata = count($data); |
| 1434 | 1434 | if ($cntdata > 10) { |
| 1435 | 1435 | $value = $data[9]; |
| 1436 | 1436 | |
| 1437 | - for ($i =10;$i < $cntdata;$i++) { |
|
| 1437 | + for ($i = 10; $i < $cntdata; $i++) { |
|
| 1438 | 1438 | $value .= ' '.$data[$i]; |
| 1439 | 1439 | } |
| 1440 | 1440 | $data[9] = $value; |
@@ -1444,8 +1444,8 @@ discard block |
||
| 1444 | 1444 | $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)'; |
| 1445 | 1445 | try { |
| 1446 | 1446 | $sth = $Connection->db->prepare($query); |
| 1447 | - $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])); |
|
| 1448 | - } catch(PDOException $e) { |
|
| 1447 | + $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])); |
|
| 1448 | + } catch (PDOException $e) { |
|
| 1449 | 1449 | return "error : ".$e->getMessage(); |
| 1450 | 1450 | } |
| 1451 | 1451 | } |
@@ -1466,7 +1466,7 @@ discard block |
||
| 1466 | 1466 | $Connection = new Connection(); |
| 1467 | 1467 | $sth = $Connection->db->prepare($query); |
| 1468 | 1468 | $sth->execute(); |
| 1469 | - } catch(PDOException $e) { |
|
| 1469 | + } catch (PDOException $e) { |
|
| 1470 | 1470 | return "error : ".$e->getMessage(); |
| 1471 | 1471 | } |
| 1472 | 1472 | |
@@ -1478,12 +1478,12 @@ discard block |
||
| 1478 | 1478 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1479 | 1479 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1480 | 1480 | { |
| 1481 | - if(count($row) > 1) { |
|
| 1481 | + if (count($row) > 1) { |
|
| 1482 | 1482 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
| 1483 | 1483 | try { |
| 1484 | 1484 | $sth = $Connection->db->prepare($query); |
| 1485 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
| 1486 | - } catch(PDOException $e) { |
|
| 1485 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
| 1486 | + } catch (PDOException $e) { |
|
| 1487 | 1487 | return "error : ".$e->getMessage(); |
| 1488 | 1488 | } |
| 1489 | 1489 | } |
@@ -1503,21 +1503,21 @@ discard block |
||
| 1503 | 1503 | try { |
| 1504 | 1504 | $sth = $Connection->db->prepare($query); |
| 1505 | 1505 | $sth->execute(); |
| 1506 | - } catch(PDOException $e) { |
|
| 1506 | + } catch (PDOException $e) { |
|
| 1507 | 1507 | return "error : ".$e->getMessage(); |
| 1508 | 1508 | } |
| 1509 | 1509 | } |
| 1510 | 1510 | |
| 1511 | 1511 | |
| 1512 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1512 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 1513 | 1513 | else { |
| 1514 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1514 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 1515 | 1515 | $query = "CREATE EXTENSION postgis"; |
| 1516 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
| 1516 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
| 1517 | 1517 | try { |
| 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 | } |
@@ -1530,7 +1530,7 @@ discard block |
||
| 1530 | 1530 | include_once('class.create_db.php'); |
| 1531 | 1531 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
| 1532 | 1532 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
| 1533 | - update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
| 1533 | + update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
| 1534 | 1534 | $error = ''; |
| 1535 | 1535 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
| 1536 | 1536 | if ($globalDebug) echo "Gunzip..."; |
@@ -1562,14 +1562,14 @@ discard block |
||
| 1562 | 1562 | try { |
| 1563 | 1563 | $sth = $Connection->db->prepare($query); |
| 1564 | 1564 | $sth->execute(); |
| 1565 | - } catch(PDOException $e) { |
|
| 1565 | + } catch (PDOException $e) { |
|
| 1566 | 1566 | echo "error : ".$e->getMessage(); |
| 1567 | 1567 | } |
| 1568 | 1568 | } |
| 1569 | 1569 | if ($globalDBdriver == 'mysql') { |
| 1570 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 1570 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 1571 | 1571 | } else { |
| 1572 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 1572 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 1573 | 1573 | } |
| 1574 | 1574 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
| 1575 | 1575 | return $error; |
@@ -1582,7 +1582,7 @@ discard block |
||
| 1582 | 1582 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
| 1583 | 1583 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
| 1584 | 1584 | // 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'); |
| 1585 | - 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'); |
|
| 1585 | + 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'); |
|
| 1586 | 1586 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
| 1587 | 1587 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
| 1588 | 1588 | return $error; |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 1603 | 1603 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
| 1604 | 1604 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 1605 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 1605 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 1606 | 1606 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
| 1607 | 1607 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
| 1608 | 1608 | if ($error != '') { |
@@ -1615,7 +1615,7 @@ discard block |
||
| 1615 | 1615 | global $tmp_dir, $globalDebug; |
| 1616 | 1616 | $error = ''; |
| 1617 | 1617 | if ($globalDebug) echo "Routes : Download..."; |
| 1618 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
| 1618 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
| 1619 | 1619 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 1620 | 1620 | if ($globalDebug) echo "Gunzip..."; |
| 1621 | 1621 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1631,7 +1631,7 @@ discard block |
||
| 1631 | 1631 | global $tmp_dir, $globalDebug; |
| 1632 | 1632 | $error = ''; |
| 1633 | 1633 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
| 1634 | - update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
| 1634 | + update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
| 1635 | 1635 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
| 1636 | 1636 | if ($globalDebug) echo "Gunzip..."; |
| 1637 | 1637 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1647,7 +1647,7 @@ discard block |
||
| 1647 | 1647 | global $tmp_dir, $globalDebug; |
| 1648 | 1648 | $error = ''; |
| 1649 | 1649 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
| 1650 | - update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
| 1650 | + update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
| 1651 | 1651 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
| 1652 | 1652 | if ($globalDebug) echo "Gunzip..."; |
| 1653 | 1653 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -1675,7 +1675,7 @@ discard block |
||
| 1675 | 1675 | */ |
| 1676 | 1676 | if ($globalDebug) echo "Modes : Download..."; |
| 1677 | 1677 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
| 1678 | - update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
| 1678 | + update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
| 1679 | 1679 | |
| 1680 | 1680 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 1681 | 1681 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -1695,7 +1695,7 @@ discard block |
||
| 1695 | 1695 | public static function update_ModeS_faa() { |
| 1696 | 1696 | global $tmp_dir, $globalDebug; |
| 1697 | 1697 | if ($globalDebug) echo "Modes FAA: Download..."; |
| 1698 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
| 1698 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
| 1699 | 1699 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
| 1700 | 1700 | if ($globalDebug) echo "Unzip..."; |
| 1701 | 1701 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -1711,7 +1711,7 @@ discard block |
||
| 1711 | 1711 | public static function update_ModeS_flarm() { |
| 1712 | 1712 | global $tmp_dir, $globalDebug; |
| 1713 | 1713 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
| 1714 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
| 1714 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
| 1715 | 1715 | if (file_exists($tmp_dir.'data.fln')) { |
| 1716 | 1716 | if ($globalDebug) echo "Add to DB..."; |
| 1717 | 1717 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -1725,7 +1725,7 @@ discard block |
||
| 1725 | 1725 | public static function update_ModeS_ogn() { |
| 1726 | 1726 | global $tmp_dir, $globalDebug; |
| 1727 | 1727 | if ($globalDebug) echo "Modes OGN: Download..."; |
| 1728 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
| 1728 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
| 1729 | 1729 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 1730 | 1730 | if ($globalDebug) echo "Add to DB..."; |
| 1731 | 1731 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -1740,201 +1740,201 @@ discard block |
||
| 1740 | 1740 | global $tmp_dir, $globalDebug, $globalMasterSource; |
| 1741 | 1741 | |
| 1742 | 1742 | if ($globalDebug) echo "Owner France: Download..."; |
| 1743 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
| 1743 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
| 1744 | 1744 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 1745 | 1745 | if ($globalDebug) echo "Add to DB..."; |
| 1746 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
| 1746 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
| 1747 | 1747 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
| 1748 | 1748 | if ($error != '') { |
| 1749 | 1749 | return $error; |
| 1750 | 1750 | } elseif ($globalDebug) echo "Done\n"; |
| 1751 | 1751 | |
| 1752 | 1752 | if ($globalDebug) echo "Owner Ireland: Download..."; |
| 1753 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
| 1753 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
| 1754 | 1754 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 1755 | 1755 | if ($globalDebug) echo "Add to DB..."; |
| 1756 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
| 1756 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
| 1757 | 1757 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
| 1758 | 1758 | if ($error != '') { |
| 1759 | 1759 | return $error; |
| 1760 | 1760 | } elseif ($globalDebug) echo "Done\n"; |
| 1761 | 1761 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
| 1762 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
| 1762 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
| 1763 | 1763 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 1764 | 1764 | if ($globalDebug) echo "Add to DB..."; |
| 1765 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
| 1765 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
| 1766 | 1766 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
| 1767 | 1767 | if ($error != '') { |
| 1768 | 1768 | return $error; |
| 1769 | 1769 | } elseif ($globalDebug) echo "Done\n"; |
| 1770 | 1770 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
| 1771 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
| 1771 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
| 1772 | 1772 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 1773 | 1773 | if ($globalDebug) echo "Add to DB..."; |
| 1774 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
| 1774 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
| 1775 | 1775 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
| 1776 | 1776 | if ($error != '') { |
| 1777 | 1777 | return $error; |
| 1778 | 1778 | } elseif ($globalDebug) echo "Done\n"; |
| 1779 | 1779 | if ($globalDebug) echo "Owner Australia: Download..."; |
| 1780 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
| 1780 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
| 1781 | 1781 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 1782 | 1782 | if ($globalDebug) echo "Add to DB..."; |
| 1783 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
| 1783 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
| 1784 | 1784 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
| 1785 | 1785 | if ($error != '') { |
| 1786 | 1786 | return $error; |
| 1787 | 1787 | } elseif ($globalDebug) echo "Done\n"; |
| 1788 | 1788 | if ($globalDebug) echo "Owner Austria: Download..."; |
| 1789 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
| 1789 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
| 1790 | 1790 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 1791 | 1791 | if ($globalDebug) echo "Add to DB..."; |
| 1792 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
| 1792 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
| 1793 | 1793 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
| 1794 | 1794 | if ($error != '') { |
| 1795 | 1795 | return $error; |
| 1796 | 1796 | } elseif ($globalDebug) echo "Done\n"; |
| 1797 | 1797 | if ($globalDebug) echo "Owner Chile: Download..."; |
| 1798 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
| 1798 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
| 1799 | 1799 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 1800 | 1800 | if ($globalDebug) echo "Add to DB..."; |
| 1801 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
| 1801 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
| 1802 | 1802 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
| 1803 | 1803 | if ($error != '') { |
| 1804 | 1804 | return $error; |
| 1805 | 1805 | } elseif ($globalDebug) echo "Done\n"; |
| 1806 | 1806 | if ($globalDebug) echo "Owner Colombia: Download..."; |
| 1807 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
| 1807 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
| 1808 | 1808 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 1809 | 1809 | if ($globalDebug) echo "Add to DB..."; |
| 1810 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
| 1810 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
| 1811 | 1811 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
| 1812 | 1812 | if ($error != '') { |
| 1813 | 1813 | return $error; |
| 1814 | 1814 | } elseif ($globalDebug) echo "Done\n"; |
| 1815 | 1815 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
| 1816 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
| 1816 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
| 1817 | 1817 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 1818 | 1818 | if ($globalDebug) echo "Add to DB..."; |
| 1819 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
| 1819 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
| 1820 | 1820 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
| 1821 | 1821 | if ($error != '') { |
| 1822 | 1822 | return $error; |
| 1823 | 1823 | } elseif ($globalDebug) echo "Done\n"; |
| 1824 | 1824 | if ($globalDebug) echo "Owner Brazil: Download..."; |
| 1825 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
| 1825 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
| 1826 | 1826 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 1827 | 1827 | if ($globalDebug) echo "Add to DB..."; |
| 1828 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
| 1828 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
| 1829 | 1829 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
| 1830 | 1830 | if ($error != '') { |
| 1831 | 1831 | return $error; |
| 1832 | 1832 | } elseif ($globalDebug) echo "Done\n"; |
| 1833 | 1833 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
| 1834 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
| 1834 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
| 1835 | 1835 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 1836 | 1836 | if ($globalDebug) echo "Add to DB..."; |
| 1837 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
| 1837 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
| 1838 | 1838 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
| 1839 | 1839 | if ($error != '') { |
| 1840 | 1840 | return $error; |
| 1841 | 1841 | } elseif ($globalDebug) echo "Done\n"; |
| 1842 | 1842 | if ($globalDebug) echo "Owner Croatia: Download..."; |
| 1843 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
| 1843 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
| 1844 | 1844 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 1845 | 1845 | if ($globalDebug) echo "Add to DB..."; |
| 1846 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
| 1846 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
| 1847 | 1847 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
| 1848 | 1848 | if ($error != '') { |
| 1849 | 1849 | return $error; |
| 1850 | 1850 | } elseif ($globalDebug) echo "Done\n"; |
| 1851 | 1851 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
| 1852 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
| 1852 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
| 1853 | 1853 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 1854 | 1854 | if ($globalDebug) echo "Add to DB..."; |
| 1855 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
| 1855 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
| 1856 | 1856 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
| 1857 | 1857 | if ($error != '') { |
| 1858 | 1858 | return $error; |
| 1859 | 1859 | } elseif ($globalDebug) echo "Done\n"; |
| 1860 | 1860 | if ($globalDebug) echo "Owner Maldives: Download..."; |
| 1861 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
| 1861 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
| 1862 | 1862 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 1863 | 1863 | if ($globalDebug) echo "Add to DB..."; |
| 1864 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
| 1864 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
| 1865 | 1865 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
| 1866 | 1866 | if ($error != '') { |
| 1867 | 1867 | return $error; |
| 1868 | 1868 | } elseif ($globalDebug) echo "Done\n"; |
| 1869 | 1869 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
| 1870 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
| 1870 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
| 1871 | 1871 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 1872 | 1872 | if ($globalDebug) echo "Add to DB..."; |
| 1873 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
| 1873 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
| 1874 | 1874 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
| 1875 | 1875 | if ($error != '') { |
| 1876 | 1876 | return $error; |
| 1877 | 1877 | } elseif ($globalDebug) echo "Done\n"; |
| 1878 | 1878 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
| 1879 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
| 1879 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
| 1880 | 1880 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 1881 | 1881 | if ($globalDebug) echo "Add to DB..."; |
| 1882 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
| 1882 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
| 1883 | 1883 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
| 1884 | 1884 | if ($error != '') { |
| 1885 | 1885 | return $error; |
| 1886 | 1886 | } elseif ($globalDebug) echo "Done\n"; |
| 1887 | 1887 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
| 1888 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
| 1888 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
| 1889 | 1889 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 1890 | 1890 | if ($globalDebug) echo "Add to DB..."; |
| 1891 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
| 1891 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
| 1892 | 1892 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
| 1893 | 1893 | if ($error != '') { |
| 1894 | 1894 | return $error; |
| 1895 | 1895 | } elseif ($globalDebug) echo "Done\n"; |
| 1896 | 1896 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
| 1897 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
| 1897 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
| 1898 | 1898 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 1899 | 1899 | if ($globalDebug) echo "Add to DB..."; |
| 1900 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
| 1900 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
| 1901 | 1901 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
| 1902 | 1902 | if ($error != '') { |
| 1903 | 1903 | return $error; |
| 1904 | 1904 | } elseif ($globalDebug) echo "Done\n"; |
| 1905 | 1905 | if ($globalDebug) echo "Owner Iceland: Download..."; |
| 1906 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
| 1906 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
| 1907 | 1907 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 1908 | 1908 | if ($globalDebug) echo "Add to DB..."; |
| 1909 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
| 1909 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
| 1910 | 1910 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
| 1911 | 1911 | if ($error != '') { |
| 1912 | 1912 | return $error; |
| 1913 | 1913 | } elseif ($globalDebug) echo "Done\n"; |
| 1914 | 1914 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
| 1915 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
| 1915 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
| 1916 | 1916 | if (file_exists($tmp_dir.'owner_m.csv')) { |
| 1917 | 1917 | if ($globalDebug) echo "Add to DB..."; |
| 1918 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
| 1918 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
| 1919 | 1919 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
| 1920 | 1920 | if ($error != '') { |
| 1921 | 1921 | return $error; |
| 1922 | 1922 | } elseif ($globalDebug) echo "Done\n"; |
| 1923 | 1923 | if ($globalMasterSource) { |
| 1924 | 1924 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
| 1925 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
| 1925 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
| 1926 | 1926 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
| 1927 | 1927 | if ($globalDebug) echo "Add to DB..."; |
| 1928 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
| 1928 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
| 1929 | 1929 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
| 1930 | 1930 | if ($error != '') { |
| 1931 | 1931 | return $error; |
| 1932 | 1932 | } elseif ($globalDebug) echo "Done\n"; |
| 1933 | 1933 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
| 1934 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
| 1934 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
| 1935 | 1935 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
| 1936 | 1936 | if ($globalDebug) echo "Add to DB..."; |
| 1937 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
| 1937 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
| 1938 | 1938 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
| 1939 | 1939 | if ($error != '') { |
| 1940 | 1940 | return $error; |
@@ -1947,7 +1947,7 @@ discard block |
||
| 1947 | 1947 | global $tmp_dir, $globalDebug; |
| 1948 | 1948 | $error = ''; |
| 1949 | 1949 | if ($globalDebug) echo "Translation : Download..."; |
| 1950 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
| 1950 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
| 1951 | 1951 | if (file_exists($tmp_dir.'translation.zip')) { |
| 1952 | 1952 | if ($globalDebug) echo "Unzip..."; |
| 1953 | 1953 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -1963,7 +1963,7 @@ discard block |
||
| 1963 | 1963 | public static function update_translation_fam() { |
| 1964 | 1964 | global $tmp_dir, $globalDebug; |
| 1965 | 1965 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
| 1966 | - update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
| 1966 | + update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
| 1967 | 1967 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
| 1968 | 1968 | if ($globalDebug) echo "Gunzip..."; |
| 1969 | 1969 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -1978,7 +1978,7 @@ discard block |
||
| 1978 | 1978 | public static function update_ModeS_fam() { |
| 1979 | 1979 | global $tmp_dir, $globalDebug; |
| 1980 | 1980 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
| 1981 | - update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
| 1981 | + update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
| 1982 | 1982 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
| 1983 | 1983 | if ($globalDebug) echo "Gunzip..."; |
| 1984 | 1984 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
@@ -1994,9 +1994,9 @@ discard block |
||
| 1994 | 1994 | global $tmp_dir, $globalDebug, $globalOwner; |
| 1995 | 1995 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
| 1996 | 1996 | if ($globalOwner === TRUE) { |
| 1997 | - update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
| 1997 | + update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
| 1998 | 1998 | } else { |
| 1999 | - update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
| 1999 | + update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
| 2000 | 2000 | } |
| 2001 | 2001 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
| 2002 | 2002 | if ($globalDebug) echo "Gunzip..."; |
@@ -2012,7 +2012,7 @@ discard block |
||
| 2012 | 2012 | public static function update_routes_fam() { |
| 2013 | 2013 | global $tmp_dir, $globalDebug; |
| 2014 | 2014 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
| 2015 | - update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
| 2015 | + update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
| 2016 | 2016 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
| 2017 | 2017 | if ($globalDebug) echo "Gunzip..."; |
| 2018 | 2018 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
@@ -2026,13 +2026,13 @@ discard block |
||
| 2026 | 2026 | } |
| 2027 | 2027 | public static function update_marine_identity_fam() { |
| 2028 | 2028 | global $tmp_dir, $globalDebug; |
| 2029 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
| 2029 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
| 2030 | 2030 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
| 2031 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
| 2031 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
| 2032 | 2032 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
| 2033 | 2033 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
| 2034 | 2034 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
| 2035 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
| 2035 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
| 2036 | 2036 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
| 2037 | 2037 | if ($globalDebug) echo "Gunzip..."; |
| 2038 | 2038 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
@@ -2052,7 +2052,7 @@ discard block |
||
| 2052 | 2052 | public static function update_banned_fam() { |
| 2053 | 2053 | global $tmp_dir, $globalDebug; |
| 2054 | 2054 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
| 2055 | - update_db::download('http://data.flightairmap.fr/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
| 2055 | + update_db::download('http://data.flightairmap.fr/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
| 2056 | 2056 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
| 2057 | 2057 | //if ($globalDebug) echo "Gunzip..."; |
| 2058 | 2058 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2071,18 +2071,18 @@ discard block |
||
| 2071 | 2071 | $error = ''; |
| 2072 | 2072 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
| 2073 | 2073 | if ($globalDBdriver == 'mysql') { |
| 2074 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
| 2074 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
| 2075 | 2075 | } else { |
| 2076 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
| 2076 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
| 2077 | 2077 | } |
| 2078 | 2078 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
| 2079 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
| 2079 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
| 2080 | 2080 | $airspace_md5 = $airspace_md5_file[0]; |
| 2081 | 2081 | if (!update_db::check_airspace_version($airspace_md5)) { |
| 2082 | 2082 | if ($globalDBdriver == 'mysql') { |
| 2083 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
| 2083 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
| 2084 | 2084 | } else { |
| 2085 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
| 2085 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
| 2086 | 2086 | } |
| 2087 | 2087 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
| 2088 | 2088 | if ($globalDebug) echo "Gunzip..."; |
@@ -2094,7 +2094,7 @@ discard block |
||
| 2094 | 2094 | try { |
| 2095 | 2095 | $sth = $Connection->db->prepare($query); |
| 2096 | 2096 | $sth->execute(); |
| 2097 | - } catch(PDOException $e) { |
|
| 2097 | + } catch (PDOException $e) { |
|
| 2098 | 2098 | return "error : ".$e->getMessage(); |
| 2099 | 2099 | } |
| 2100 | 2100 | } |
@@ -2113,15 +2113,15 @@ discard block |
||
| 2113 | 2113 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
| 2114 | 2114 | $error = ''; |
| 2115 | 2115 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
| 2116 | - update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
| 2116 | + update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
| 2117 | 2117 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
| 2118 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
| 2118 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
| 2119 | 2119 | $geoid_md5 = $geoid_md5_file[0]; |
| 2120 | 2120 | if (!update_db::check_geoid_version($geoid_md5)) { |
| 2121 | - update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
| 2121 | + update_db::download('http://data.flightairmap.fr/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
| 2122 | 2122 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
| 2123 | 2123 | if ($globalDebug) echo "Gunzip..."; |
| 2124 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
| 2124 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
| 2125 | 2125 | update_db::insert_geoid_version($geoid_md5); |
| 2126 | 2126 | } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
| 2127 | 2127 | } |
@@ -2135,15 +2135,15 @@ discard block |
||
| 2135 | 2135 | public static function update_tle() { |
| 2136 | 2136 | global $tmp_dir, $globalDebug; |
| 2137 | 2137 | if ($globalDebug) echo "Download TLE : Download..."; |
| 2138 | - $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
|
| 2139 | - 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
|
| 2140 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
|
| 2138 | + $alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt', |
|
| 2139 | + 'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt', |
|
| 2140 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt'); |
|
| 2141 | 2141 | foreach ($alltle as $filename) { |
| 2142 | 2142 | if ($globalDebug) echo "downloading ".$filename.'...'; |
| 2143 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
| 2143 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
| 2144 | 2144 | if (file_exists($tmp_dir.$filename)) { |
| 2145 | 2145 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
| 2146 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
| 2146 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
| 2147 | 2147 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
| 2148 | 2148 | if ($error != '') { |
| 2149 | 2149 | echo $error."\n"; |
@@ -2156,32 +2156,32 @@ discard block |
||
| 2156 | 2156 | global $tmp_dir, $globalDebug; |
| 2157 | 2157 | $error = ''; |
| 2158 | 2158 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
| 2159 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
| 2159 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
| 2160 | 2160 | if (file_exists($tmp_dir.'models.md5sum')) { |
| 2161 | 2161 | if ($globalDebug) echo "Check files...\n"; |
| 2162 | 2162 | $newmodelsdb = array(); |
| 2163 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
| 2164 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2163 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
| 2164 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2165 | 2165 | $model = trim($row[2]); |
| 2166 | 2166 | $newmodelsdb[$model] = trim($row[0]); |
| 2167 | 2167 | } |
| 2168 | 2168 | } |
| 2169 | 2169 | $modelsdb = array(); |
| 2170 | 2170 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
| 2171 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
| 2172 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2171 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
| 2172 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2173 | 2173 | $model = trim($row[2]); |
| 2174 | 2174 | $modelsdb[$model] = trim($row[0]); |
| 2175 | 2175 | } |
| 2176 | 2176 | } |
| 2177 | 2177 | } |
| 2178 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2178 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2179 | 2179 | foreach ($diff as $key => $value) { |
| 2180 | 2180 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
| 2181 | - update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
| 2181 | + update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
| 2182 | 2182 | |
| 2183 | 2183 | } |
| 2184 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
| 2184 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
| 2185 | 2185 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2186 | 2186 | if ($error != '') { |
| 2187 | 2187 | return $error; |
@@ -2193,32 +2193,32 @@ discard block |
||
| 2193 | 2193 | global $tmp_dir, $globalDebug; |
| 2194 | 2194 | $error = ''; |
| 2195 | 2195 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
| 2196 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
| 2196 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
| 2197 | 2197 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
| 2198 | 2198 | if ($globalDebug) echo "Check files...\n"; |
| 2199 | 2199 | $newmodelsdb = array(); |
| 2200 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
| 2201 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2200 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
| 2201 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2202 | 2202 | $model = trim($row[2]); |
| 2203 | 2203 | $newmodelsdb[$model] = trim($row[0]); |
| 2204 | 2204 | } |
| 2205 | 2205 | } |
| 2206 | 2206 | $modelsdb = array(); |
| 2207 | 2207 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
| 2208 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
| 2209 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2208 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
| 2209 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2210 | 2210 | $model = trim($row[2]); |
| 2211 | 2211 | $modelsdb[$model] = trim($row[0]); |
| 2212 | 2212 | } |
| 2213 | 2213 | } |
| 2214 | 2214 | } |
| 2215 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2215 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2216 | 2216 | foreach ($diff as $key => $value) { |
| 2217 | 2217 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
| 2218 | - update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
| 2218 | + update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
| 2219 | 2219 | |
| 2220 | 2220 | } |
| 2221 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
| 2221 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
| 2222 | 2222 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2223 | 2223 | if ($error != '') { |
| 2224 | 2224 | return $error; |
@@ -2230,32 +2230,32 @@ discard block |
||
| 2230 | 2230 | global $tmp_dir, $globalDebug; |
| 2231 | 2231 | $error = ''; |
| 2232 | 2232 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
| 2233 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
| 2233 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
| 2234 | 2234 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
| 2235 | 2235 | if ($globalDebug) echo "Check files...\n"; |
| 2236 | 2236 | $newmodelsdb = array(); |
| 2237 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
| 2238 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2237 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
| 2238 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2239 | 2239 | $model = trim($row[2]); |
| 2240 | 2240 | $newmodelsdb[$model] = trim($row[0]); |
| 2241 | 2241 | } |
| 2242 | 2242 | } |
| 2243 | 2243 | $modelsdb = array(); |
| 2244 | 2244 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
| 2245 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
| 2246 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2245 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
| 2246 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2247 | 2247 | $model = trim($row[2]); |
| 2248 | 2248 | $modelsdb[$model] = trim($row[0]); |
| 2249 | 2249 | } |
| 2250 | 2250 | } |
| 2251 | 2251 | } |
| 2252 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2252 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2253 | 2253 | foreach ($diff as $key => $value) { |
| 2254 | 2254 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
| 2255 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
| 2255 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
| 2256 | 2256 | |
| 2257 | 2257 | } |
| 2258 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
| 2258 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
| 2259 | 2259 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2260 | 2260 | if ($error != '') { |
| 2261 | 2261 | return $error; |
@@ -2278,8 +2278,8 @@ discard block |
||
| 2278 | 2278 | */ |
| 2279 | 2279 | if (file_exists($tmp_dir.'aircrafts.html')) { |
| 2280 | 2280 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
| 2281 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 2282 | - $result = fread($fh,100000000); |
|
| 2281 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
| 2282 | + $result = fread($fh, 100000000); |
|
| 2283 | 2283 | //echo $result; |
| 2284 | 2284 | //var_dump(str_get_html($result)); |
| 2285 | 2285 | //print_r(self::table2array($result)); |
@@ -2297,23 +2297,23 @@ discard block |
||
| 2297 | 2297 | $Connection = new Connection(); |
| 2298 | 2298 | $sth = $Connection->db->prepare($query); |
| 2299 | 2299 | $sth->execute(); |
| 2300 | - } catch(PDOException $e) { |
|
| 2300 | + } catch (PDOException $e) { |
|
| 2301 | 2301 | return "error : ".$e->getMessage(); |
| 2302 | 2302 | } |
| 2303 | 2303 | |
| 2304 | 2304 | $error = ''; |
| 2305 | 2305 | if ($globalDebug) echo "Notam : Download..."; |
| 2306 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
| 2306 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
| 2307 | 2307 | if (file_exists($tmp_dir.'notam.rss')) { |
| 2308 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
| 2308 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
| 2309 | 2309 | foreach ($notams['channel']['item'] as $notam) { |
| 2310 | - $title = explode(':',$notam['title']); |
|
| 2310 | + $title = explode(':', $notam['title']); |
|
| 2311 | 2311 | $data['ref'] = trim($title[0]); |
| 2312 | 2312 | unset($title[0]); |
| 2313 | - $data['title'] = trim(implode(':',$title)); |
|
| 2314 | - $description = strip_tags($notam['description'],'<pre>'); |
|
| 2315 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
| 2316 | - $q = explode('/',$match[1]); |
|
| 2313 | + $data['title'] = trim(implode(':', $title)); |
|
| 2314 | + $description = strip_tags($notam['description'], '<pre>'); |
|
| 2315 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
| 2316 | + $q = explode('/', $match[1]); |
|
| 2317 | 2317 | $data['fir'] = $q[0]; |
| 2318 | 2318 | $data['code'] = $q[1]; |
| 2319 | 2319 | $ifrvfr = $q[2]; |
@@ -2329,30 +2329,30 @@ discard block |
||
| 2329 | 2329 | $data['lower_limit'] = $q[5]; |
| 2330 | 2330 | $data['upper_limit'] = $q[6]; |
| 2331 | 2331 | $latlonrad = $q[7]; |
| 2332 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
| 2333 | - $latitude = $Common->convertDec($las,'latitude'); |
|
| 2334 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
| 2332 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
| 2333 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
| 2334 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
| 2335 | 2335 | if ($lac == 'S') $latitude = '-'.$latitude; |
| 2336 | 2336 | if ($lnc == 'W') $longitude = '-'.$longitude; |
| 2337 | 2337 | $data['center_latitude'] = $latitude; |
| 2338 | 2338 | $data['center_longitude'] = $longitude; |
| 2339 | 2339 | $data['radius'] = intval($radius); |
| 2340 | 2340 | |
| 2341 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
| 2341 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
| 2342 | 2342 | $data['text'] = $match[1]; |
| 2343 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
| 2343 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
| 2344 | 2344 | $fromto = $match[1]; |
| 2345 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
| 2345 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
| 2346 | 2346 | $fromall = trim($match[1]); |
| 2347 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
| 2347 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
| 2348 | 2348 | $from = trim($match[1]); |
| 2349 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
| 2350 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
| 2349 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
| 2350 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
| 2351 | 2351 | $toall = trim($match[1]); |
| 2352 | - if (!preg_match(':Permanent:',$toall)) { |
|
| 2353 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
| 2352 | + if (!preg_match(':Permanent:', $toall)) { |
|
| 2353 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
| 2354 | 2354 | $to = trim($match[1]); |
| 2355 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
| 2355 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
| 2356 | 2356 | $data['permanent'] = 0; |
| 2357 | 2357 | } else { |
| 2358 | 2358 | $data['date_end'] = NULL; |
@@ -2360,7 +2360,7 @@ discard block |
||
| 2360 | 2360 | } |
| 2361 | 2361 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 2362 | 2362 | $NOTAM = new NOTAM(); |
| 2363 | - $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']); |
|
| 2363 | + $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']); |
|
| 2364 | 2364 | unset($data); |
| 2365 | 2365 | } |
| 2366 | 2366 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2383,16 +2383,16 @@ discard block |
||
| 2383 | 2383 | $Connection = new Connection(); |
| 2384 | 2384 | $sth = $Connection->db->prepare($query); |
| 2385 | 2385 | $sth->execute(); |
| 2386 | - } catch(PDOException $e) { |
|
| 2386 | + } catch (PDOException $e) { |
|
| 2387 | 2387 | return "error : ".$e->getMessage(); |
| 2388 | 2388 | } |
| 2389 | 2389 | } |
| 2390 | 2390 | $Common = new Common(); |
| 2391 | 2391 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
| 2392 | - $airspace_json = json_decode($airspace_lst,true); |
|
| 2392 | + $airspace_json = json_decode($airspace_lst, true); |
|
| 2393 | 2393 | foreach ($airspace_json['records'] as $airspace) { |
| 2394 | 2394 | if ($globalDebug) echo $airspace['name']."...\n"; |
| 2395 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
| 2395 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
| 2396 | 2396 | if (file_exists($tmp_dir.$airspace['name'])) { |
| 2397 | 2397 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
| 2398 | 2398 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2414,7 +2414,7 @@ discard block |
||
| 2414 | 2414 | $Connection = new Connection(); |
| 2415 | 2415 | $sth = $Connection->db->prepare($query); |
| 2416 | 2416 | $sth->execute(array(':new' => $new, ':old' => $old)); |
| 2417 | - } catch(PDOException $e) { |
|
| 2417 | + } catch (PDOException $e) { |
|
| 2418 | 2418 | return "error : ".$e->getMessage(); |
| 2419 | 2419 | } |
| 2420 | 2420 | } |
@@ -2431,7 +2431,7 @@ discard block |
||
| 2431 | 2431 | $Connection = new Connection(); |
| 2432 | 2432 | $sth = $Connection->db->prepare($query); |
| 2433 | 2433 | $sth->execute(); |
| 2434 | - } catch(PDOException $e) { |
|
| 2434 | + } catch (PDOException $e) { |
|
| 2435 | 2435 | return "error : ".$e->getMessage(); |
| 2436 | 2436 | } |
| 2437 | 2437 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2446,7 +2446,7 @@ discard block |
||
| 2446 | 2446 | $Connection = new Connection(); |
| 2447 | 2447 | $sth = $Connection->db->prepare($query); |
| 2448 | 2448 | $sth->execute(); |
| 2449 | - } catch(PDOException $e) { |
|
| 2449 | + } catch (PDOException $e) { |
|
| 2450 | 2450 | return "error : ".$e->getMessage(); |
| 2451 | 2451 | } |
| 2452 | 2452 | } |
@@ -2457,7 +2457,7 @@ discard block |
||
| 2457 | 2457 | $Connection = new Connection(); |
| 2458 | 2458 | $sth = $Connection->db->prepare($query); |
| 2459 | 2459 | $sth->execute(array(':version' => $version)); |
| 2460 | - } catch(PDOException $e) { |
|
| 2460 | + } catch (PDOException $e) { |
|
| 2461 | 2461 | return "error : ".$e->getMessage(); |
| 2462 | 2462 | } |
| 2463 | 2463 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2471,7 +2471,7 @@ discard block |
||
| 2471 | 2471 | $Connection = new Connection(); |
| 2472 | 2472 | $sth = $Connection->db->prepare($query); |
| 2473 | 2473 | $sth->execute(array(':version' => $version)); |
| 2474 | - } catch(PDOException $e) { |
|
| 2474 | + } catch (PDOException $e) { |
|
| 2475 | 2475 | return "error : ".$e->getMessage(); |
| 2476 | 2476 | } |
| 2477 | 2477 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2485,7 +2485,7 @@ discard block |
||
| 2485 | 2485 | $Connection = new Connection(); |
| 2486 | 2486 | $sth = $Connection->db->prepare($query); |
| 2487 | 2487 | $sth->execute(array(':version' => $version)); |
| 2488 | - } catch(PDOException $e) { |
|
| 2488 | + } catch (PDOException $e) { |
|
| 2489 | 2489 | return "error : ".$e->getMessage(); |
| 2490 | 2490 | } |
| 2491 | 2491 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2501,7 +2501,7 @@ discard block |
||
| 2501 | 2501 | $Connection = new Connection(); |
| 2502 | 2502 | $sth = $Connection->db->prepare($query); |
| 2503 | 2503 | $sth->execute(array(':version' => $version)); |
| 2504 | - } catch(PDOException $e) { |
|
| 2504 | + } catch (PDOException $e) { |
|
| 2505 | 2505 | return "error : ".$e->getMessage(); |
| 2506 | 2506 | } |
| 2507 | 2507 | } |
@@ -2513,7 +2513,7 @@ discard block |
||
| 2513 | 2513 | $Connection = new Connection(); |
| 2514 | 2514 | $sth = $Connection->db->prepare($query); |
| 2515 | 2515 | $sth->execute(array(':version' => $version)); |
| 2516 | - } catch(PDOException $e) { |
|
| 2516 | + } catch (PDOException $e) { |
|
| 2517 | 2517 | return "error : ".$e->getMessage(); |
| 2518 | 2518 | } |
| 2519 | 2519 | } |
@@ -2525,7 +2525,7 @@ discard block |
||
| 2525 | 2525 | $Connection = new Connection(); |
| 2526 | 2526 | $sth = $Connection->db->prepare($query); |
| 2527 | 2527 | $sth->execute(array(':version' => $version)); |
| 2528 | - } catch(PDOException $e) { |
|
| 2528 | + } catch (PDOException $e) { |
|
| 2529 | 2529 | return "error : ".$e->getMessage(); |
| 2530 | 2530 | } |
| 2531 | 2531 | } |
@@ -2541,7 +2541,7 @@ discard block |
||
| 2541 | 2541 | $Connection = new Connection(); |
| 2542 | 2542 | $sth = $Connection->db->prepare($query); |
| 2543 | 2543 | $sth->execute(); |
| 2544 | - } catch(PDOException $e) { |
|
| 2544 | + } catch (PDOException $e) { |
|
| 2545 | 2545 | return "error : ".$e->getMessage(); |
| 2546 | 2546 | } |
| 2547 | 2547 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2556,7 +2556,7 @@ discard block |
||
| 2556 | 2556 | $Connection = new Connection(); |
| 2557 | 2557 | $sth = $Connection->db->prepare($query); |
| 2558 | 2558 | $sth->execute(); |
| 2559 | - } catch(PDOException $e) { |
|
| 2559 | + } catch (PDOException $e) { |
|
| 2560 | 2560 | return "error : ".$e->getMessage(); |
| 2561 | 2561 | } |
| 2562 | 2562 | } |
@@ -2572,7 +2572,7 @@ discard block |
||
| 2572 | 2572 | $Connection = new Connection(); |
| 2573 | 2573 | $sth = $Connection->db->prepare($query); |
| 2574 | 2574 | $sth->execute(); |
| 2575 | - } catch(PDOException $e) { |
|
| 2575 | + } catch (PDOException $e) { |
|
| 2576 | 2576 | return "error : ".$e->getMessage(); |
| 2577 | 2577 | } |
| 2578 | 2578 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2587,7 +2587,7 @@ discard block |
||
| 2587 | 2587 | $Connection = new Connection(); |
| 2588 | 2588 | $sth = $Connection->db->prepare($query); |
| 2589 | 2589 | $sth->execute(); |
| 2590 | - } catch(PDOException $e) { |
|
| 2590 | + } catch (PDOException $e) { |
|
| 2591 | 2591 | return "error : ".$e->getMessage(); |
| 2592 | 2592 | } |
| 2593 | 2593 | } |
@@ -2603,7 +2603,7 @@ discard block |
||
| 2603 | 2603 | $Connection = new Connection(); |
| 2604 | 2604 | $sth = $Connection->db->prepare($query); |
| 2605 | 2605 | $sth->execute(); |
| 2606 | - } catch(PDOException $e) { |
|
| 2606 | + } catch (PDOException $e) { |
|
| 2607 | 2607 | return "error : ".$e->getMessage(); |
| 2608 | 2608 | } |
| 2609 | 2609 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2618,7 +2618,7 @@ discard block |
||
| 2618 | 2618 | $Connection = new Connection(); |
| 2619 | 2619 | $sth = $Connection->db->prepare($query); |
| 2620 | 2620 | $sth->execute(); |
| 2621 | - } catch(PDOException $e) { |
|
| 2621 | + } catch (PDOException $e) { |
|
| 2622 | 2622 | return "error : ".$e->getMessage(); |
| 2623 | 2623 | } |
| 2624 | 2624 | } |
@@ -2634,7 +2634,7 @@ discard block |
||
| 2634 | 2634 | $Connection = new Connection(); |
| 2635 | 2635 | $sth = $Connection->db->prepare($query); |
| 2636 | 2636 | $sth->execute(); |
| 2637 | - } catch(PDOException $e) { |
|
| 2637 | + } catch (PDOException $e) { |
|
| 2638 | 2638 | return "error : ".$e->getMessage(); |
| 2639 | 2639 | } |
| 2640 | 2640 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2649,7 +2649,7 @@ discard block |
||
| 2649 | 2649 | $Connection = new Connection(); |
| 2650 | 2650 | $sth = $Connection->db->prepare($query); |
| 2651 | 2651 | $sth->execute(); |
| 2652 | - } catch(PDOException $e) { |
|
| 2652 | + } catch (PDOException $e) { |
|
| 2653 | 2653 | return "error : ".$e->getMessage(); |
| 2654 | 2654 | } |
| 2655 | 2655 | } |
@@ -2664,7 +2664,7 @@ discard block |
||
| 2664 | 2664 | $Connection = new Connection(); |
| 2665 | 2665 | $sth = $Connection->db->prepare($query); |
| 2666 | 2666 | $sth->execute(); |
| 2667 | - } catch(PDOException $e) { |
|
| 2667 | + } catch (PDOException $e) { |
|
| 2668 | 2668 | return "error : ".$e->getMessage(); |
| 2669 | 2669 | } |
| 2670 | 2670 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2679,7 +2679,7 @@ discard block |
||
| 2679 | 2679 | $Connection = new Connection(); |
| 2680 | 2680 | $sth = $Connection->db->prepare($query); |
| 2681 | 2681 | $sth->execute(); |
| 2682 | - } catch(PDOException $e) { |
|
| 2682 | + } catch (PDOException $e) { |
|
| 2683 | 2683 | return "error : ".$e->getMessage(); |
| 2684 | 2684 | } |
| 2685 | 2685 | } |
@@ -2694,7 +2694,7 @@ discard block |
||
| 2694 | 2694 | $Connection = new Connection(); |
| 2695 | 2695 | $sth = $Connection->db->prepare($query); |
| 2696 | 2696 | $sth->execute(); |
| 2697 | - } catch(PDOException $e) { |
|
| 2697 | + } catch (PDOException $e) { |
|
| 2698 | 2698 | return "error : ".$e->getMessage(); |
| 2699 | 2699 | } |
| 2700 | 2700 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2709,7 +2709,7 @@ discard block |
||
| 2709 | 2709 | $Connection = new Connection(); |
| 2710 | 2710 | $sth = $Connection->db->prepare($query); |
| 2711 | 2711 | $sth->execute(); |
| 2712 | - } catch(PDOException $e) { |
|
| 2712 | + } catch (PDOException $e) { |
|
| 2713 | 2713 | return "error : ".$e->getMessage(); |
| 2714 | 2714 | } |
| 2715 | 2715 | } |
@@ -2724,7 +2724,7 @@ discard block |
||
| 2724 | 2724 | $Connection = new Connection(); |
| 2725 | 2725 | $sth = $Connection->db->prepare($query); |
| 2726 | 2726 | $sth->execute(); |
| 2727 | - } catch(PDOException $e) { |
|
| 2727 | + } catch (PDOException $e) { |
|
| 2728 | 2728 | return "error : ".$e->getMessage(); |
| 2729 | 2729 | } |
| 2730 | 2730 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2739,7 +2739,7 @@ discard block |
||
| 2739 | 2739 | $Connection = new Connection(); |
| 2740 | 2740 | $sth = $Connection->db->prepare($query); |
| 2741 | 2741 | $sth->execute(); |
| 2742 | - } catch(PDOException $e) { |
|
| 2742 | + } catch (PDOException $e) { |
|
| 2743 | 2743 | return "error : ".$e->getMessage(); |
| 2744 | 2744 | } |
| 2745 | 2745 | } |
@@ -2754,7 +2754,7 @@ discard block |
||
| 2754 | 2754 | $Connection = new Connection(); |
| 2755 | 2755 | $sth = $Connection->db->prepare($query); |
| 2756 | 2756 | $sth->execute(); |
| 2757 | - } catch(PDOException $e) { |
|
| 2757 | + } catch (PDOException $e) { |
|
| 2758 | 2758 | return "error : ".$e->getMessage(); |
| 2759 | 2759 | } |
| 2760 | 2760 | } |
@@ -2769,7 +2769,7 @@ discard block |
||
| 2769 | 2769 | $Connection = new Connection(); |
| 2770 | 2770 | $sth = $Connection->db->prepare($query); |
| 2771 | 2771 | $sth->execute(); |
| 2772 | - } catch(PDOException $e) { |
|
| 2772 | + } catch (PDOException $e) { |
|
| 2773 | 2773 | return "error : ".$e->getMessage(); |
| 2774 | 2774 | } |
| 2775 | 2775 | } |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | $currentdate = date('Y-m-d'); |
| 35 | 35 | $sourcestat = $Stats->getStatsSource($currentdate); |
| 36 | 36 | if (!empty($sourcestat)) { |
| 37 | - foreach($sourcestat as $srcst) { |
|
| 37 | + foreach ($sourcestat as $srcst) { |
|
| 38 | 38 | $type = $srcst['stats_type']; |
| 39 | 39 | if ($type == 'polar' || $type == 'hist') { |
| 40 | 40 | $source = $srcst['source_name']; |
| 41 | 41 | $data = $srcst['source_data']; |
| 42 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 42 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
@@ -51,14 +51,14 @@ discard block |
||
| 51 | 51 | if (isset($globalGeoid) && $globalGeoid) { |
| 52 | 52 | try { |
| 53 | 53 | $GeoidClass = new GeoidHeight(); |
| 54 | - } catch(Exception $e) { |
|
| 54 | + } catch (Exception $e) { |
|
| 55 | 55 | if ($globalDebug) echo "Can't calculate geoid : $e \n"; |
| 56 | 56 | $GeoidClass = FALSE; |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | - public function get_Schedule($id,$ident) { |
|
| 61 | + public function get_Schedule($id, $ident) { |
|
| 62 | 62 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
| 63 | 63 | // Get schedule here, so it's done only one time |
| 64 | 64 | |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | $schedule = $Schedule->fetchSchedule($operator); |
| 84 | 84 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 85 | 85 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
| 86 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 87 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 86 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 87 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 88 | 88 | // Should also check if route schedule = route from DB |
| 89 | 89 | if ($schedule['DepartureAirportIATA'] != '') { |
| 90 | 90 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 107 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
| 108 | 108 | } |
| 109 | 109 | } else $scheduleexist = true; |
| 110 | 110 | } else $scheduleexist = true; |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | if ($scheduleexist) { |
| 113 | 113 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
| 114 | 114 | $sch = $Schedule->getSchedule($operator); |
| 115 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
| 115 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport' => $sch['arrival_airport_icao'], 'departure_airport' => $sch['departure_airport_icao'], 'departure_airport_time' => $sch['departure_airport_time'], 'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
| 116 | 116 | } |
| 117 | 117 | $Spotter->db = null; |
| 118 | 118 | $Schedule->db = null; |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 140 | 140 | $Spotter = new Spotter($this->db); |
| 141 | 141 | $real_arrival = $this->arrival($key); |
| 142 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 142 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $airport_time = ''; |
| 154 | 154 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
| 155 | 155 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 156 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 156 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
| 157 | 157 | if (isset($closestAirports[0])) { |
| 158 | 158 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 159 | 159 | $airport_icao = $closestAirports[0]['icao']; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | break; |
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 171 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
| 172 | 172 | $airport_icao = $closestAirports[0]['icao']; |
| 173 | 173 | $airport_time = $this->all_flights[$key]['datetime']; |
| 174 | 174 | } else { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } else { |
| 182 | 182 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
| 183 | 183 | } |
| 184 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 184 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 193 | 193 | foreach ($this->all_flights as $key => $flight) { |
| 194 | 194 | if (isset($flight['lastupdate'])) { |
| 195 | - if ($flight['lastupdate'] < (time()-5900)) { |
|
| 195 | + if ($flight['lastupdate'] < (time() - 5900)) { |
|
| 196 | 196 | $this->delKey($key); |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $real_arrival = $this->arrival($key); |
| 209 | 209 | $Spotter = new Spotter($this->db); |
| 210 | 210 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 211 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 211 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
| 212 | 212 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 213 | 213 | } |
| 214 | 214 | } |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | $send = false; |
| 242 | 242 | |
| 243 | 243 | // SBS format is CSV format |
| 244 | - if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
| 244 | + if (is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
| 245 | 245 | //print_r($line); |
| 246 | 246 | if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
| 247 | 247 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
@@ -277,25 +277,25 @@ discard block |
||
| 277 | 277 | if (!isset($this->all_flights[$id])) { |
| 278 | 278 | if ($globalDebug) echo 'New flight...'."\n"; |
| 279 | 279 | $this->all_flights[$id] = array(); |
| 280 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 281 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
| 282 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 280 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 281 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'altitude_previous' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true, 'source_type' => '')); |
|
| 282 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
| 283 | 283 | if (!isset($line['id'])) { |
| 284 | 284 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 285 | 285 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
| 286 | 286 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 287 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 287 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 288 | 288 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 289 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 289 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 290 | 290 | if ($globalAllFlights !== FALSE) $dataFound = true; |
| 291 | 291 | } |
| 292 | 292 | if (isset($line['source_type']) && $line['source_type'] != '') { |
| 293 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
| 293 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type'])); |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | //print_r($this->all_flights); |
| 297 | 297 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
| 298 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
| 298 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex']))); |
|
| 299 | 299 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 300 | 300 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 301 | 301 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -304,27 +304,27 @@ discard block |
||
| 304 | 304 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 305 | 305 | $Spotter = new Spotter($this->db); |
| 306 | 306 | if (isset($this->all_flights[$id]['source_type'])) { |
| 307 | - $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
|
| 307 | + $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']); |
|
| 308 | 308 | } else { |
| 309 | 309 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
| 310 | 310 | } |
| 311 | 311 | $Spotter->db = null; |
| 312 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 313 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 312 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 313 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 314 | 314 | } |
| 315 | 315 | } |
| 316 | 316 | if ($globalAllFlights !== FALSE) $dataFound = true; |
| 317 | 317 | if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
| 318 | 318 | } |
| 319 | 319 | if (isset($line['id']) && !isset($line['hex'])) { |
| 320 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
| 320 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => '')); |
|
| 321 | 321 | } |
| 322 | 322 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
| 323 | 323 | $icao = $line['aircraft_icao']; |
| 324 | 324 | $Spotter = new Spotter($this->db); |
| 325 | 325 | if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
| 326 | 326 | $Spotter->db = null; |
| 327 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
|
| 327 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao)); |
|
| 328 | 328 | } |
| 329 | 329 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) { |
| 330 | 330 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | $Spotter = new Spotter($this->db); |
| 333 | 333 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 334 | 334 | $Spotter->db = null; |
| 335 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 335 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
@@ -340,15 +340,15 @@ discard block |
||
| 340 | 340 | elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
| 341 | 341 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
| 342 | 342 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
| 343 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 343 | + if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 344 | 344 | } |
| 345 | 345 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
| 346 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
| 346 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
| 347 | 347 | } |
| 348 | 348 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 349 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
| 349 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
| 350 | 350 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 351 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
| 351 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
| 352 | 352 | } else { |
| 353 | 353 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 354 | 354 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -359,31 +359,31 @@ discard block |
||
| 359 | 359 | */ |
| 360 | 360 | return ''; |
| 361 | 361 | } |
| 362 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
| 362 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
| 363 | 363 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n"; |
| 364 | 364 | return ''; |
| 365 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
| 365 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
| 366 | 366 | if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n"; |
| 367 | 367 | return ''; |
| 368 | 368 | } elseif (!isset($line['datetime'])) { |
| 369 | 369 | date_default_timezone_set('UTC'); |
| 370 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 370 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
| 371 | 371 | } else { |
| 372 | 372 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
| 373 | 373 | return ''; |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
| 377 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 377 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
| 378 | 378 | } |
| 379 | 379 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 380 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 380 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
| 381 | 381 | } |
| 382 | 382 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 383 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
| 383 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => trim($line['pilot_id']))); |
|
| 384 | 384 | } |
| 385 | 385 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 386 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
| 386 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => trim($line['pilot_name']))); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
@@ -391,13 +391,13 @@ discard block |
||
| 391 | 391 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
| 392 | 392 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 393 | 393 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
| 394 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 395 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 396 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 397 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 398 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 394 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 395 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 396 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 397 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 398 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 399 | 399 | } else { |
| 400 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 400 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
| 401 | 401 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 402 | 402 | $timeelapsed = microtime(true); |
| 403 | 403 | $Spotter = new Spotter($this->db); |
@@ -407,13 +407,13 @@ discard block |
||
| 407 | 407 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 408 | 408 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 409 | 409 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 410 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 410 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
| 411 | 411 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 412 | 412 | $Spotter->db = null; |
| 413 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 413 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 416 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
| 417 | 417 | |
| 418 | 418 | /* |
| 419 | 419 | if (!isset($line['id'])) { |
@@ -423,25 +423,25 @@ discard block |
||
| 423 | 423 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 424 | 424 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 425 | 425 | */ |
| 426 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 426 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 427 | 427 | |
| 428 | 428 | //$putinarchive = true; |
| 429 | 429 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
| 430 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 430 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 431 | 431 | } |
| 432 | 432 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
| 433 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 433 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 434 | 434 | } |
| 435 | 435 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
| 436 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 436 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
| 437 | 437 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
| 438 | 438 | $timeelapsed = microtime(true); |
| 439 | 439 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 440 | 440 | $Spotter = new Spotter($this->db); |
| 441 | 441 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 442 | 442 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 443 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 444 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 443 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
| 444 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 445 | 445 | } |
| 446 | 446 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 447 | 447 | $timeelapsed = microtime(true); |
@@ -455,35 +455,35 @@ discard block |
||
| 455 | 455 | $Translation->db = null; |
| 456 | 456 | } |
| 457 | 457 | $Spotter->db = null; |
| 458 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 458 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 459 | 459 | } |
| 460 | 460 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 461 | 461 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
| 462 | 462 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
| 463 | 463 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
| 464 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 464 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
| 465 | 465 | } |
| 466 | 466 | } |
| 467 | 467 | if (!isset($globalFork)) $globalFork = TRUE; |
| 468 | 468 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 469 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 469 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) { |
| 475 | 475 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 476 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 477 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 476 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
| 477 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
| 478 | 478 | //$dataFound = true; |
| 479 | 479 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 480 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 480 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
| 481 | 481 | if ($distance > 1000 && $distance < 10000) { |
| 482 | 482 | // use datetime |
| 483 | 483 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 484 | 484 | $speed = $speed*3.6; |
| 485 | 485 | if ($speed < 1000) { |
| 486 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 486 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
| 487 | 487 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
| 488 | 488 | } else { |
| 489 | 489 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
@@ -498,9 +498,9 @@ discard block |
||
| 498 | 498 | if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
| 499 | 499 | return false; |
| 500 | 500 | } |
| 501 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 501 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
| 502 | 502 | else unset($timediff); |
| 503 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
| 503 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time() - $this->all_flights[$id]['time_last_archive_coord']); |
|
| 504 | 504 | else unset($timediff_archive); |
| 505 | 505 | if ($this->tmd > 5 |
| 506 | 506 | || (isset($line['format_source']) |
@@ -524,14 +524,14 @@ discard block |
||
| 524 | 524 | || ($timediff > 30 |
| 525 | 525 | && isset($this->all_flights[$id]['latitude']) |
| 526 | 526 | && isset($this->all_flights[$id]['longitude']) |
| 527 | - && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
| 527 | + && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')) |
|
| 528 | 528 | ) |
| 529 | 529 | ) { |
| 530 | 530 | |
| 531 | 531 | if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) { |
| 532 | 532 | if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
| 533 | 533 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
| 534 | - || !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 534 | + || !$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
| 535 | 535 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 536 | 536 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 537 | 537 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -541,11 +541,11 @@ discard block |
||
| 541 | 541 | $timeelapsed = microtime(true); |
| 542 | 542 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 543 | 543 | $Spotter = new Spotter($this->db); |
| 544 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 544 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
| 545 | 545 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
| 546 | 546 | else $this->all_flights[$id]['over_country'] = ''; |
| 547 | 547 | $Spotter->db = null; |
| 548 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 548 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 549 | 549 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 550 | 550 | } |
| 551 | 551 | } |
@@ -571,13 +571,13 @@ discard block |
||
| 571 | 571 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 572 | 572 | } |
| 573 | 573 | //if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
| 574 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
|
| 574 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > 0.0001)) { |
|
| 575 | 575 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
| 576 | 576 | $dataFound = true; |
| 577 | 577 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 578 | 578 | } |
| 579 | 579 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 580 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
| 580 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
| 581 | 581 | /* |
| 582 | 582 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
| 583 | 583 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -599,13 +599,13 @@ discard block |
||
| 599 | 599 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 600 | 600 | } |
| 601 | 601 | //if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
| 602 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
|
| 602 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > 0.0001)) { |
|
| 603 | 603 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
| 604 | 604 | $dataFound = true; |
| 605 | 605 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 606 | 606 | } |
| 607 | 607 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 608 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
| 608 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
| 609 | 609 | /* |
| 610 | 610 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
| 611 | 611 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -623,46 +623,46 @@ discard block |
||
| 623 | 623 | } else if ($globalDebug && $timediff > 30) { |
| 624 | 624 | $this->tmd = $this->tmd + 1; |
| 625 | 625 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 626 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
| 627 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
| 626 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
| 627 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
| 628 | 628 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 629 | 629 | } |
| 630 | 630 | } |
| 631 | 631 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 632 | 632 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
| 633 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 633 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
| 634 | 634 | } |
| 635 | 635 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 636 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 636 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
| 637 | 637 | //$dataFound = true; |
| 638 | 638 | } |
| 639 | 639 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 640 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 640 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
| 641 | 641 | } |
| 642 | 642 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 643 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 643 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
| 644 | 644 | } |
| 645 | 645 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 646 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 646 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
| 647 | 647 | //$dataFound = true; |
| 648 | 648 | } |
| 649 | 649 | if (isset($line['ground']) && $line['ground'] != '') { |
| 650 | 650 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
| 651 | 651 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 652 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 653 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 654 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 655 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 656 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 652 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 653 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 654 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 655 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 656 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 657 | 657 | } |
| 658 | 658 | if ($line['ground'] != 1) $line['ground'] = 0; |
| 659 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 659 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
| 660 | 660 | //$dataFound = true; |
| 661 | 661 | } |
| 662 | 662 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 663 | 663 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
| 664 | 664 | if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
| 665 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 665 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 666 | 666 | $highlight = ''; |
| 667 | 667 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
| 668 | 668 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -671,66 +671,66 @@ discard block |
||
| 671 | 671 | $timeelapsed = microtime(true); |
| 672 | 672 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 673 | 673 | $Spotter = new Spotter($this->db); |
| 674 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 674 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
| 675 | 675 | $Spotter->db = null; |
| 676 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 676 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 677 | 677 | } |
| 678 | 678 | //$putinarchive = true; |
| 679 | 679 | //$highlight = ''; |
| 680 | 680 | } |
| 681 | 681 | |
| 682 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 682 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 683 | 683 | //$dataFound = true; |
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 687 | 687 | if (isset($line['altitude_relative']) && isset($GeoidClass) && is_object($GeoidClass)) { |
| 688 | 688 | if ($line['altitude_relative'] == 'AMSL' || $line['altitude_relative'] == 'MSL') { |
| 689 | - $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'])*3.28084,2); |
|
| 689 | + $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'])*3.28084, 2); |
|
| 690 | 690 | //if ($globalDebug) echo '=> Set altitude to WGS84 Ellipsoid, add '.$geoid.' to '.$line['altitude']."\n"; |
| 691 | 691 | $line['altitude'] = $line['altitude'] + $geoid; |
| 692 | 692 | } |
| 693 | 693 | } |
| 694 | 694 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 695 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
| 696 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
| 697 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
| 695 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
| 696 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
| 697 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
| 698 | 698 | //$dataFound = true; |
| 699 | 699 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 700 | 700 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
| 701 | 701 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
| 702 | 702 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
| 703 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 704 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 705 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 706 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 707 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 703 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 704 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 705 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 706 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 707 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 708 | 708 | } |
| 709 | 709 | } |
| 710 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
| 710 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_previous' => $line['altitude'])); |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 714 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 714 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | if (isset($line['heading']) && $line['heading'] != '') { |
| 718 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 719 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 720 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 718 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 719 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
| 720 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
| 721 | 721 | //$dataFound = true; |
| 722 | 722 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 723 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 724 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 725 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 723 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 724 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
| 725 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
| 726 | 726 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['id']." : ".$heading."\n"; |
| 727 | 727 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 728 | 728 | // If not enough messages and ACARS set heading to 0 |
| 729 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 729 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
| 730 | 730 | } |
| 731 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 732 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 733 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalMinupdate) $dataFound = false; |
|
| 731 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 732 | + elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 733 | + elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalMinupdate) $dataFound = false; |
|
| 734 | 734 | |
| 735 | 735 | // print_r($this->all_flights[$id]); |
| 736 | 736 | //gets the callsign from the last hour |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
| 742 | 742 | $this->all_flights[$id]['lastupdate'] = time(); |
| 743 | 743 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
| 744 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 744 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 745 | 745 | //print_r($this->all_flights); |
| 746 | 746 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
| 747 | 747 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -752,61 +752,61 @@ discard block |
||
| 752 | 752 | $SpotterLive = new SpotterLive($this->db); |
| 753 | 753 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
| 754 | 754 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 755 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 755 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 756 | 756 | } elseif (isset($line['id'])) { |
| 757 | 757 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 758 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 758 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 759 | 759 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 760 | 760 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 761 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 761 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 762 | 762 | } else $recent_ident = ''; |
| 763 | - $SpotterLive->db=null; |
|
| 763 | + $SpotterLive->db = null; |
|
| 764 | 764 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 765 | 765 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 766 | 766 | } else $recent_ident = ''; |
| 767 | 767 | } else { |
| 768 | 768 | $recent_ident = ''; |
| 769 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
| 769 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
| 770 | 770 | } |
| 771 | 771 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 772 | - if($recent_ident == "") |
|
| 772 | + if ($recent_ident == "") |
|
| 773 | 773 | { |
| 774 | 774 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 775 | 775 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 776 | 776 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 777 | 777 | //adds the spotter data for the archive |
| 778 | 778 | $ignoreImport = false; |
| 779 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 779 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 780 | 780 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 781 | 781 | $ignoreImport = true; |
| 782 | 782 | } |
| 783 | 783 | } |
| 784 | 784 | if (count($globalAirportAccept) > 0) { |
| 785 | 785 | $ignoreImport = true; |
| 786 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 786 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 787 | 787 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 788 | 788 | $ignoreImport = false; |
| 789 | 789 | } |
| 790 | 790 | } |
| 791 | 791 | } |
| 792 | 792 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 793 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 794 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 793 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 794 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
| 795 | 795 | $ignoreImport = true; |
| 796 | 796 | } |
| 797 | 797 | } |
| 798 | 798 | } |
| 799 | 799 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 800 | 800 | $ignoreImport = true; |
| 801 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 802 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 801 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 802 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
| 803 | 803 | $ignoreImport = false; |
| 804 | 804 | } |
| 805 | 805 | } |
| 806 | 806 | } |
| 807 | 807 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 808 | 808 | $ignoreImport = true; |
| 809 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 809 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 810 | 810 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 811 | 811 | $ignoreImport = false; |
| 812 | 812 | } |
@@ -818,32 +818,32 @@ discard block |
||
| 818 | 818 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
| 819 | 819 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
| 820 | 820 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
| 821 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 821 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 822 | 822 | $timeelapsed = microtime(true); |
| 823 | 823 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 824 | 824 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 825 | 825 | $Spotter = new Spotter($this->db); |
| 826 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
| 826 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['source_type']); |
|
| 827 | 827 | $Spotter->db = null; |
| 828 | 828 | if ($globalDebug && isset($result)) echo $result."\n"; |
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 831 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 832 | 832 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 833 | 833 | |
| 834 | 834 | // Add source stat in DB |
| 835 | 835 | $Stats = new Stats($this->db); |
| 836 | 836 | if (!empty($this->stats)) { |
| 837 | 837 | if ($globalDebug) echo 'Add source stats : '; |
| 838 | - foreach($this->stats as $date => $data) { |
|
| 839 | - foreach($data as $source => $sourced) { |
|
| 838 | + foreach ($this->stats as $date => $data) { |
|
| 839 | + foreach ($data as $source => $sourced) { |
|
| 840 | 840 | //print_r($sourced); |
| 841 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 842 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 841 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
| 842 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
| 843 | 843 | if (isset($sourced['msg'])) { |
| 844 | 844 | if (time() - $sourced['msg']['date'] > 10) { |
| 845 | 845 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
| 846 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 846 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
| 847 | 847 | unset($this->stats[$date][$source]['msg']); |
| 848 | 848 | } |
| 849 | 849 | } |
@@ -881,14 +881,14 @@ discard block |
||
| 881 | 881 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 882 | 882 | $SpotterLive = new SpotterLive($this->db); |
| 883 | 883 | $SpotterLive->deleteLiveSpotterData(); |
| 884 | - $SpotterLive->db=null; |
|
| 884 | + $SpotterLive->db = null; |
|
| 885 | 885 | } |
| 886 | 886 | } |
| 887 | 887 | if ($globalDebug) echo " Done\n"; |
| 888 | 888 | $this->last_delete = time(); |
| 889 | 889 | } |
| 890 | 890 | } else { |
| 891 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
| 891 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
| 892 | 892 | $this->all_flights[$id]['id'] = $recent_ident; |
| 893 | 893 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 894 | 894 | } |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 897 | 897 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 898 | 898 | $Spotter = new Spotter($this->db); |
| 899 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
| 899 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
| 900 | 900 | $Spotter->db = null; |
| 901 | 901 | } |
| 902 | 902 | } |
@@ -922,37 +922,37 @@ discard block |
||
| 922 | 922 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 923 | 923 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 924 | 924 | |
| 925 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 925 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 926 | 926 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 927 | 927 | $ignoreImport = true; |
| 928 | 928 | } |
| 929 | 929 | } |
| 930 | 930 | if (count($globalAirportAccept) > 0) { |
| 931 | 931 | $ignoreImport = true; |
| 932 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 932 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 933 | 933 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 934 | 934 | $ignoreImport = false; |
| 935 | 935 | } |
| 936 | 936 | } |
| 937 | 937 | } |
| 938 | 938 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 939 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 940 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 939 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 940 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
| 941 | 941 | $ignoreImport = true; |
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | 944 | } |
| 945 | 945 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 946 | 946 | $ignoreImport = true; |
| 947 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 948 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 947 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 948 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
| 949 | 949 | $ignoreImport = false; |
| 950 | 950 | } |
| 951 | 951 | } |
| 952 | 952 | } |
| 953 | 953 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 954 | 954 | $ignoreImport = true; |
| 955 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 955 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 956 | 956 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 957 | 957 | $ignoreImport = false; |
| 958 | 958 | } |
@@ -960,23 +960,23 @@ discard block |
||
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | if (!$ignoreImport) { |
| 963 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 964 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 963 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 964 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 965 | 965 | $timeelapsed = microtime(true); |
| 966 | 966 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
| 967 | 967 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 968 | 968 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 969 | 969 | $SpotterLive = new SpotterLive($this->db); |
| 970 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
| 970 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
| 971 | 971 | $SpotterLive->db = null; |
| 972 | 972 | if ($globalDebug) echo $result."\n"; |
| 973 | 973 | } |
| 974 | 974 | } |
| 975 | 975 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
| 976 | - $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
| 976 | + $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
| 977 | 977 | } |
| 978 | 978 | $this->all_flights[$id]['putinarchive'] = false; |
| 979 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 979 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 980 | 980 | |
| 981 | 981 | // Put statistics in $this->stats variable |
| 982 | 982 | //if ($line['format_source'] != 'aprs') { |
@@ -995,19 +995,19 @@ discard block |
||
| 995 | 995 | $latitude = $globalCenterLatitude; |
| 996 | 996 | $longitude = $globalCenterLongitude; |
| 997 | 997 | } |
| 998 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
| 998 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
| 999 | 999 | } else { |
| 1000 | 1000 | $latitude = $this->source_location[$source]['latitude']; |
| 1001 | 1001 | $longitude = $this->source_location[$source]['longitude']; |
| 1002 | 1002 | } |
| 1003 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 1003 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 1004 | 1004 | //$stats_heading = $stats_heading%22.5; |
| 1005 | 1005 | $stats_heading = round($stats_heading/22.5); |
| 1006 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 1006 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 1007 | 1007 | $current_date = date('Y-m-d'); |
| 1008 | 1008 | if ($stats_heading == 16) $stats_heading = 0; |
| 1009 | 1009 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 1010 | - for ($i=0;$i<=15;$i++) { |
|
| 1010 | + for ($i = 0; $i <= 15; $i++) { |
|
| 1011 | 1011 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
| 1012 | 1012 | } |
| 1013 | 1013 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -1022,9 +1022,9 @@ discard block |
||
| 1022 | 1022 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 1023 | 1023 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 1024 | 1024 | end($this->stats[$current_date][$source]['hist']); |
| 1025 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 1025 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
| 1026 | 1026 | } else $mini = 0; |
| 1027 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
| 1027 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
| 1028 | 1028 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 1029 | 1029 | } |
| 1030 | 1030 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | $this->all_flights[$id]['lastupdate'] = time(); |
| 1038 | 1038 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
| 1039 | 1039 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 1040 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1040 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
| 1041 | 1041 | //$this->del(); |
| 1042 | 1042 | |
| 1043 | 1043 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * Translated to PHP of GeographicLib/src/Geoid.cpp |
| 12 | 12 | * by Ycarus <[email protected]> in 2017 |
| 13 | 13 | */ |
| 14 | -class GeoidHeight { |
|
| 14 | +class GeoidHeight { |
|
| 15 | 15 | private $c0 = 240; |
| 16 | 16 | private $c3 = [[9, -18, -88, 0, 96, 90, 0, 0, -60, -20], [-9, 18, 8, 0, -96, 30, 0, 0, 60, -20], [9, -88, -18, 90, 96, 0, -20, -60, 0, 0], [186, -42, -42, -150, -96, -150, 60, 60, 60, 60], [54, 162, -78, 30, -24, -90, -60, 60, -60, 60], [-9, -32, 18, 30, 24, 0, 20, -60, 0, 0], [-9, 8, 18, 30, -96, 0, -20, 60, 0, 0], [54, -78, 162, -90, -24, 30, 60, -60, 60, -60], [-54, 78, 78, 90, 144, 90, -60, -60, -60, -60], [9, -8, -18, -30, -24, 0, 20, 60, 0, 0], [-9, 18, -32, 0, 24, 30, 0, 0, -60, 20], [9, -18, -8, 0, -24, -30, 0, 0, 60, 20]]; |
| 17 | 17 | private $c0n = 372; |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | private $iy = null; |
| 31 | 31 | private $t = null; |
| 32 | 32 | |
| 33 | - public function __construct($name='') { |
|
| 33 | + public function __construct($name = '') { |
|
| 34 | 34 | global $globalGeoidSource; |
| 35 | 35 | //if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm'; |
| 36 | 36 | if ($name == '') { |
@@ -38,35 +38,35 @@ discard block |
||
| 38 | 38 | else $name = dirname(__FILE__).'/../data/egm96-15.pgm'; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - $f = @fopen($name,"r"); |
|
| 41 | + $f = @fopen($name, "r"); |
|
| 42 | 42 | if ($f === FALSE) { |
| 43 | 43 | throw new Exception("Can't open ".$name); |
| 44 | 44 | } |
| 45 | - $line = fgets($f,4096); |
|
| 45 | + $line = fgets($f, 4096); |
|
| 46 | 46 | if (trim($line) != 'P5') { |
| 47 | 47 | throw new Exception('No PGM header'); |
| 48 | 48 | } |
| 49 | 49 | $headerlen = strlen($line); |
| 50 | 50 | while (true) { |
| 51 | - $line = fgets($f,4096); |
|
| 51 | + $line = fgets($f, 4096); |
|
| 52 | 52 | if ((strlen($line) == 0)) { |
| 53 | 53 | throw new Exception('EOF before end of file header'); |
| 54 | 54 | } |
| 55 | 55 | $headerlen += strlen($line); |
| 56 | - if (strpos($line,'# Offset ') !== FALSE) { |
|
| 56 | + if (strpos($line, '# Offset ') !== FALSE) { |
|
| 57 | 57 | $this->offset = substr($line, 9); |
| 58 | - } else if (strpos($line,'# Scale ') !== FALSE) { |
|
| 58 | + } else if (strpos($line, '# Scale ') !== FALSE) { |
|
| 59 | 59 | $this->scale = substr($line, 8); |
| 60 | - } else if ((strpos($line,'#') === FALSE)) { |
|
| 61 | - list($this->width, $this->height) = preg_split('/\s+/',$line); |
|
| 60 | + } else if ((strpos($line, '#') === FALSE)) { |
|
| 61 | + list($this->width, $this->height) = preg_split('/\s+/', $line); |
|
| 62 | 62 | break; |
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | - $line = fgets($f,4096); |
|
| 65 | + $line = fgets($f, 4096); |
|
| 66 | 66 | $headerlen += strlen($line); |
| 67 | - $levels = (int)$line; |
|
| 68 | - $this->width = (int)$this->width; |
|
| 69 | - $this->height = (int)$this->height; |
|
| 67 | + $levels = (int) $line; |
|
| 68 | + $this->width = (int) $this->width; |
|
| 69 | + $this->height = (int) $this->height; |
|
| 70 | 70 | if (($levels != 65535)) { |
| 71 | 71 | throw new Exception('PGM file must have 65535 gray levels ('.$levels.')'); |
| 72 | 72 | } |
@@ -81,42 +81,42 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | $fullsize = filesize($name); |
| 84 | - if ((($fullsize - $headerlen) != (($this->width * $this->height) * 2))) { |
|
| 84 | + if ((($fullsize - $headerlen) != (($this->width*$this->height)*2))) { |
|
| 85 | 85 | throw new Exception('File has the wrong length'); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | $this->headerlen = $headerlen; |
| 89 | - $this->raw= $f; |
|
| 90 | - $this->rlonres = ($this->width / 360.0); |
|
| 91 | - $this->rlatres = (($this->height - 1) / 180.0); |
|
| 89 | + $this->raw = $f; |
|
| 90 | + $this->rlonres = ($this->width/360.0); |
|
| 91 | + $this->rlatres = (($this->height - 1)/180.0); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - private function _rawval($ix,$iy) { |
|
| 94 | + private function _rawval($ix, $iy) { |
|
| 95 | 95 | if (($iy < 0)) { |
| 96 | 96 | $iy = -$iy; |
| 97 | - $ix += ($this->width / 2); |
|
| 97 | + $ix += ($this->width/2); |
|
| 98 | 98 | } else if (($iy >= $this->height)) { |
| 99 | - $iy = ((2 * ($this->height - 1)) - $iy); |
|
| 100 | - $ix += ($this->width / 2); |
|
| 99 | + $iy = ((2*($this->height - 1)) - $iy); |
|
| 100 | + $ix += ($this->width/2); |
|
| 101 | 101 | } |
| 102 | 102 | if (($ix < 0)) { |
| 103 | 103 | $ix += $this->width; |
| 104 | 104 | } else if (($ix >= $this->width)) { |
| 105 | 105 | $ix -= $this->width; |
| 106 | 106 | } |
| 107 | - $k = ((($iy * $this->width) + $ix) * 2) + $this->headerlen; |
|
| 108 | - fseek($this->raw,$k); |
|
| 109 | - return unpack('n',fread($this->raw,2))[1]; |
|
| 107 | + $k = ((($iy*$this->width) + $ix)*2) + $this->headerlen; |
|
| 108 | + fseek($this->raw, $k); |
|
| 109 | + return unpack('n', fread($this->raw, 2))[1]; |
|
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - public function get($lat,$lon,$cubic=true) { |
|
| 112 | + public function get($lat, $lon, $cubic = true) { |
|
| 113 | 113 | if (($lon < 0)) { |
| 114 | 114 | $lon += 360; |
| 115 | 115 | } |
| 116 | - $fy = ((90 - $lat) * $this->rlatres); |
|
| 117 | - $fx = ($lon * $this->rlonres); |
|
| 118 | - $iy = (int)$fy; |
|
| 119 | - $ix = (int)$fx; |
|
| 116 | + $fy = ((90 - $lat)*$this->rlatres); |
|
| 117 | + $fx = ($lon*$this->rlonres); |
|
| 118 | + $iy = (int) $fy; |
|
| 119 | + $ix = (int) $fx; |
|
| 120 | 120 | $fx -= $ix; |
| 121 | 121 | $fy -= $iy; |
| 122 | 122 | if (($iy == ($this->height - 1))) { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $c3x = $this->c3; |
| 143 | 143 | $c0x = $this->c0; |
| 144 | 144 | } |
| 145 | - for ($i = 0; $i < 10;++$i) { |
|
| 145 | + for ($i = 0; $i < 10; ++$i) { |
|
| 146 | 146 | $t[$i] = 0; |
| 147 | 147 | for ($j = 0; $j < 12; ++$j) { |
| 148 | 148 | $t[$i] += $v[$j]*$c3x[$j][$i]; |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | $this->t = $t; |
| 154 | 154 | } |
| 155 | 155 | if (!($cubic)) { |
| 156 | - $a = (((1 - $fx) * $v00) + ($fx * $v01)); |
|
| 157 | - $b = (((1 - $fx) * $v10) + ($fx * $v11)); |
|
| 158 | - $h = (((1 - $fy) * $a) + ($fy * $b)); |
|
| 156 | + $a = (((1 - $fx)*$v00) + ($fx*$v01)); |
|
| 157 | + $b = (((1 - $fx)*$v10) + ($fx*$v11)); |
|
| 158 | + $h = (((1 - $fy)*$a) + ($fy*$b)); |
|
| 159 | 159 | } else { |
| 160 | 160 | $t = $this->t; |
| 161 | - $h = (($t[0] + ($fx * ($t[1] + ($fx * ($t[3] + ($fx * $t[6])))))) + ($fy * (($t[2] + ($fx * ($t[4] + ($fx * $t[7])))) + ($fy * (($t[5] + ($fx * $t[8])) + ($fy * $t[9])))))); |
|
| 161 | + $h = (($t[0] + ($fx*($t[1] + ($fx*($t[3] + ($fx*$t[6])))))) + ($fy*(($t[2] + ($fx*($t[4] + ($fx*$t[7])))) + ($fy*(($t[5] + ($fx*$t[8])) + ($fy*$t[9])))))); |
|
| 162 | 162 | } |
| 163 | - return ((float)$this->offset + ((float)$this->scale * (float)$h)); |
|
| 163 | + return ((float) $this->offset + ((float) $this->scale*(float) $h)); |
|
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | /* |