@@ -55,23 +55,23 @@ discard block |
||
| 55 | 55 | $min = true; |
| 56 | 56 | $allhistory = false; |
| 57 | 57 | $filter['source'] = array(); |
| 58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 64 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 67 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 58 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 60 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 61 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
| 62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 63 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
| 64 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
| 65 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
| 66 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
| 67 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
| 68 | 68 | |
| 69 | 69 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 70 | 70 | $min = true; |
| 71 | 71 | } else $min = false; |
| 72 | 72 | |
| 73 | 73 | if (isset($_GET['ident'])) { |
| 74 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
| 74 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
| 75 | 75 | if ($tracker) { |
| 76 | 76 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
| 77 | 77 | } elseif ($marine) { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | $allhistory = true; |
| 87 | 87 | } elseif (isset($_GET['flightaware_id'])) { |
| 88 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 88 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 89 | 89 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
| 90 | 90 | if (empty($spotter_array)) { |
| 91 | 91 | $from_archive = true; |
@@ -93,44 +93,44 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | $allhistory = true; |
| 95 | 95 | } elseif (isset($_GET['famtrack_id'])) { |
| 96 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
| 96 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
| 97 | 97 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
| 98 | 98 | $allhistory = true; |
| 99 | 99 | } elseif (isset($_GET['fammarine_id'])) { |
| 100 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
| 100 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
| 101 | 101 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
| 102 | 102 | $allhistory = true; |
| 103 | 103 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
| 104 | 104 | //} elseif (isset($_GET['coord'])) { |
| 105 | 105 | $usecoord = true; |
| 106 | - $coord = explode(',',$_GET['coord']); |
|
| 106 | + $coord = explode(',', $_GET['coord']); |
|
| 107 | 107 | if ($tracker) { |
| 108 | - $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
|
| 108 | + $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter); |
|
| 109 | 109 | } elseif ($marine) { |
| 110 | - $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
|
| 110 | + $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter); |
|
| 111 | 111 | } else { |
| 112 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
| 112 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
| 113 | 113 | } |
| 114 | 114 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
| 115 | 115 | $usecoord = true; |
| 116 | - $coord = explode(',',$_GET['coord']); |
|
| 116 | + $coord = explode(',', $_GET['coord']); |
|
| 117 | 117 | if ($tracker) { |
| 118 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
| 118 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
| 119 | 119 | } elseif ($marine) { |
| 120 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
| 120 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
| 121 | 121 | } else { |
| 122 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
| 122 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
| 123 | 123 | } |
| 124 | 124 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
| 125 | 125 | $from_archive = true; |
| 126 | 126 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 127 | 127 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 128 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 129 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 130 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 131 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 132 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 133 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
| 128 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 129 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 130 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 131 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 132 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 133 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
| 134 | 134 | } elseif ($min) { |
| 135 | 135 | if ($tracker) { |
| 136 | 136 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -142,17 +142,17 @@ discard block |
||
| 142 | 142 | # $min = true; |
| 143 | 143 | } else { |
| 144 | 144 | if ($tracker) { |
| 145 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
| 145 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
| 146 | 146 | } elseif ($marine) { |
| 147 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
| 147 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
| 148 | 148 | } else { |
| 149 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
| 149 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | if ($usecoord) { |
| 154 | 154 | if (isset($_GET['archive'])) { |
| 155 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 155 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 156 | 156 | } else { |
| 157 | 157 | if ($tracker) { |
| 158 | 158 | $flightcnt = $TrackerLive->getLiveSpotterCount($filter); |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | if ($flightcnt == '') $flightcnt = 0; |
| 166 | 166 | } else $flightcnt = 0; |
| 167 | 167 | |
| 168 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 168 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 169 | 169 | |
| 170 | 170 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
| 171 | 171 | else $usenextlatlon = true; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 183 | 183 | { |
| 184 | 184 | $output .= '"features": ['; |
| 185 | - foreach($spotter_array as $spotter_item) |
|
| 185 | + foreach ($spotter_array as $spotter_item) |
|
| 186 | 186 | { |
| 187 | 187 | $j++; |
| 188 | 188 | date_default_timezone_set('UTC'); |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 240 | 240 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 241 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 242 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 241 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
| 242 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
| 243 | 243 | //" |
| 244 | 244 | } else { |
| 245 | 245 | if ($compress) $output .= '"c": "NA",'; |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
| 249 | 249 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 250 | 250 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 251 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
| 251 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
| 252 | 252 | } elseif (isset($spotter_item['aircraft_type'])) { |
| 253 | 253 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
| 254 | 254 | } elseif (!$min) { |
@@ -389,16 +389,16 @@ discard block |
||
| 389 | 389 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
| 390 | 390 | |
| 391 | 391 | if (isset($archivespeed)) { |
| 392 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
| 392 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
| 393 | 393 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 394 | 394 | } elseif ($usenextlatlon) { |
| 395 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
| 395 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
| 396 | 396 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | if (!$min) $output .= '"image": "'.$image.'",'; |
| 400 | 400 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 401 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
| 401 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
| 402 | 402 | } |
| 403 | 403 | if (isset($spotter_item['image_source_website'])) { |
| 404 | 404 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
| 421 | 421 | } |
| 422 | 422 | if (isset($spotter_item['acars'])) { |
| 423 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
| 423 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
| 424 | 424 | } |
| 425 | 425 | // type when not aircraft ? |
| 426 | 426 | if (isset($spotter_item['type'])) { |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | |
| 499 | 499 | } |
| 500 | 500 | */ |
| 501 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
| 501 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
| 502 | 502 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
| 503 | 503 | |
| 504 | 504 | if ( |
@@ -506,11 +506,11 @@ discard block |
||
| 506 | 506 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
| 507 | 507 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
| 508 | 508 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
| 509 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 509 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 510 | 510 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
| 511 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
| 511 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
| 512 | 512 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
| 513 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
| 513 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
| 514 | 514 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
| 515 | 515 | ) { |
| 516 | 516 | if ($tracker) { |
@@ -547,9 +547,9 @@ discard block |
||
| 547 | 547 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
| 548 | 548 | } |
| 549 | 549 | $output_history .= '['; |
| 550 | - $output_history .= $spotter_history['longitude'].', '; |
|
| 551 | - $output_history .= $spotter_history['latitude'].', '; |
|
| 552 | - $output_history .= $spotter_history['altitude']*30.48; |
|
| 550 | + $output_history .= $spotter_history['longitude'].', '; |
|
| 551 | + $output_history .= $spotter_history['latitude'].', '; |
|
| 552 | + $output_history .= $spotter_history['altitude']*30.48; |
|
| 553 | 553 | $output_history .= '],'; |
| 554 | 554 | /* |
| 555 | 555 | if ($from_archive === false) { |
@@ -567,8 +567,8 @@ discard block |
||
| 567 | 567 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
| 568 | 568 | } else $d = true; |
| 569 | 569 | $output_history .= '['; |
| 570 | - $output_history .= $spotter_history['longitude'].', '; |
|
| 571 | - $output_history .= $spotter_history['latitude']; |
|
| 570 | + $output_history .= $spotter_history['longitude'].', '; |
|
| 571 | + $output_history .= $spotter_history['latitude']; |
|
| 572 | 572 | $output_history .= '],'; |
| 573 | 573 | /* |
| 574 | 574 | if ($from_archive === false) { |
@@ -584,9 +584,9 @@ discard block |
||
| 584 | 584 | |
| 585 | 585 | if ($from_archive === false) { |
| 586 | 586 | $output_historyd = '['; |
| 587 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
| 588 | - $output_historyd .= $spotter_item['latitude']; |
|
| 589 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 587 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
| 588 | + $output_historyd .= $spotter_item['latitude']; |
|
| 589 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 590 | 590 | $output_historyd .= '],'; |
| 591 | 591 | //$output_history = $output_historyd.$output_history; |
| 592 | 592 | $output_history = $output_history.$output_historyd; |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | } |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 603 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 604 | 604 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
| 605 | 605 | && (isset($spotter_item['departure_airport']) |
| 606 | 606 | && $spotter_item['departure_airport'] != 'NA' |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | |
| 635 | 635 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 636 | 636 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 637 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 637 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 638 | 638 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
| 639 | 639 | && (isset($spotter_item['arrival_airport']) |
| 640 | 640 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | $output = substr($output, 0, -1); |
| 666 | 666 | $output .= ']'; |
| 667 | 667 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 668 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
| 668 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
| 669 | 669 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
| 670 | 670 | $output .= '"fc": "'.$j.'"'; |
| 671 | 671 | } else { |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $ch = curl_init(); |
| 17 | 17 | curl_setopt($ch, CURLOPT_URL, $url); |
| 18 | 18 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
| 19 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
| 19 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
| 20 | 20 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -34,20 +34,20 @@ discard block |
||
| 34 | 34 | fclose($fp); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public static function gunzip($in_file,$out_file_name = '') { |
|
| 37 | + public static function gunzip($in_file, $out_file_name = '') { |
|
| 38 | 38 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 39 | 39 | $buffer_size = 4096; // read 4kb at a time |
| 40 | 40 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
| 41 | 41 | if ($in_file != '' && file_exists($in_file)) { |
| 42 | 42 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 43 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 44 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 43 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
| 44 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
| 45 | 45 | else { |
| 46 | 46 | echo 'gzopen not available'; |
| 47 | 47 | die; |
| 48 | 48 | } |
| 49 | 49 | $out_file = fopen($out_file_name, 'wb'); |
| 50 | - while(!gzeof($file)) { |
|
| 50 | + while (!gzeof($file)) { |
|
| 51 | 51 | fwrite($out_file, gzread($file, $buffer_size)); |
| 52 | 52 | } |
| 53 | 53 | fclose($out_file); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | try { |
| 72 | 72 | self::$db_sqlite = new PDO('sqlite:'.$database); |
| 73 | 73 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 74 | - } catch(PDOException $e) { |
|
| 74 | + } catch (PDOException $e) { |
|
| 75 | 75 | return "error : ".$e->getMessage(); |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | //$Connection = new Connection(); |
| 87 | 87 | $sth = $Connection->db->prepare($query); |
| 88 | 88 | $sth->execute(array(':source' => $database_file)); |
| 89 | - } catch(PDOException $e) { |
|
| 89 | + } catch (PDOException $e) { |
|
| 90 | 90 | return "error : ".$e->getMessage(); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | try { |
| 98 | 98 | $sth = update_db::$db_sqlite->prepare($query); |
| 99 | 99 | $sth->execute(); |
| 100 | - } catch(PDOException $e) { |
|
| 100 | + } catch (PDOException $e) { |
|
| 101 | 101 | return "error : ".$e->getMessage(); |
| 102 | 102 | } |
| 103 | 103 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 109 | 109 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 110 | 110 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
| 111 | - $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); |
|
| 111 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
| 112 | 112 | $sth_dest->execute($query_dest_values); |
| 113 | 113 | } |
| 114 | 114 | if ($globalTransaction) $Connection->db->commit(); |
| 115 | - } catch(PDOException $e) { |
|
| 115 | + } catch (PDOException $e) { |
|
| 116 | 116 | if ($globalTransaction) $Connection->db->rollBack(); |
| 117 | 117 | return "error : ".$e->getMessage(); |
| 118 | 118 | } |
@@ -128,26 +128,26 @@ discard block |
||
| 128 | 128 | //$Connection = new Connection(); |
| 129 | 129 | $sth = $Connection->db->prepare($query); |
| 130 | 130 | $sth->execute(array(':source' => 'oneworld')); |
| 131 | - } catch(PDOException $e) { |
|
| 131 | + } catch (PDOException $e) { |
|
| 132 | 132 | return "error : ".$e->getMessage(); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if ($globalDebug) echo " - Add routes to DB -"; |
| 136 | 136 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 137 | 137 | $Spotter = new Spotter(); |
| 138 | - if ($fh = fopen($database_file,"r")) { |
|
| 138 | + if ($fh = fopen($database_file, "r")) { |
|
| 139 | 139 | $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)'; |
| 140 | 140 | $Connection = new Connection(); |
| 141 | 141 | $sth_dest = $Connection->db->prepare($query_dest); |
| 142 | 142 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 143 | 143 | while (!feof($fh)) { |
| 144 | - $line = fgetcsv($fh,9999,','); |
|
| 144 | + $line = fgetcsv($fh, 9999, ','); |
|
| 145 | 145 | if ($line[0] != '') { |
| 146 | 146 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
| 147 | 147 | try { |
| 148 | - $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'); |
|
| 148 | + $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'); |
|
| 149 | 149 | $sth_dest->execute($query_dest_values); |
| 150 | - } catch(PDOException $e) { |
|
| 150 | + } catch (PDOException $e) { |
|
| 151 | 151 | if ($globalTransaction) $Connection->db->rollBack(); |
| 152 | 152 | return "error : ".$e->getMessage(); |
| 153 | 153 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | //$Connection = new Connection(); |
| 170 | 170 | $sth = $Connection->db->prepare($query); |
| 171 | 171 | $sth->execute(array(':source' => 'skyteam')); |
| 172 | - } catch(PDOException $e) { |
|
| 172 | + } catch (PDOException $e) { |
|
| 173 | 173 | return "error : ".$e->getMessage(); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -177,24 +177,24 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 179 | 179 | $Spotter = new Spotter(); |
| 180 | - if ($fh = fopen($database_file,"r")) { |
|
| 180 | + if ($fh = fopen($database_file, "r")) { |
|
| 181 | 181 | $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)'; |
| 182 | 182 | $Connection = new Connection(); |
| 183 | 183 | $sth_dest = $Connection->db->prepare($query_dest); |
| 184 | 184 | try { |
| 185 | 185 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 186 | 186 | while (!feof($fh)) { |
| 187 | - $line = fgetcsv($fh,9999,','); |
|
| 187 | + $line = fgetcsv($fh, 9999, ','); |
|
| 188 | 188 | if ($line[0] != '') { |
| 189 | - $datebe = explode(' - ',$line[2]); |
|
| 189 | + $datebe = explode(' - ', $line[2]); |
|
| 190 | 190 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
| 191 | - $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'); |
|
| 191 | + $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'); |
|
| 192 | 192 | $sth_dest->execute($query_dest_values); |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | if ($globalTransaction) $Connection->db->commit(); |
| 197 | - } catch(PDOException $e) { |
|
| 197 | + } catch (PDOException $e) { |
|
| 198 | 198 | if ($globalTransaction) $Connection->db->rollBack(); |
| 199 | 199 | return "error : ".$e->getMessage(); |
| 200 | 200 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $Connection = new Connection(); |
| 210 | 210 | $sth = $Connection->db->prepare($query); |
| 211 | 211 | $sth->execute(array(':source' => $database_file)); |
| 212 | - } catch(PDOException $e) { |
|
| 212 | + } catch (PDOException $e) { |
|
| 213 | 213 | return "error : ".$e->getMessage(); |
| 214 | 214 | } |
| 215 | 215 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $Connection = new Connection(); |
| 218 | 218 | $sth = $Connection->db->prepare($query); |
| 219 | 219 | $sth->execute(array(':source' => $database_file)); |
| 220 | - } catch(PDOException $e) { |
|
| 220 | + } catch (PDOException $e) { |
|
| 221 | 221 | return "error : ".$e->getMessage(); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | try { |
| 227 | 227 | $sth = update_db::$db_sqlite->prepare($query); |
| 228 | 228 | $sth->execute(); |
| 229 | - } catch(PDOException $e) { |
|
| 229 | + } catch (PDOException $e) { |
|
| 230 | 230 | return "error : ".$e->getMessage(); |
| 231 | 231 | } |
| 232 | 232 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -243,15 +243,15 @@ discard block |
||
| 243 | 243 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
| 244 | 244 | if ($values['UserString4'] == 'M') $type = 'military'; |
| 245 | 245 | else $type = null; |
| 246 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
| 246 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
| 247 | 247 | $sth_dest->execute($query_dest_values); |
| 248 | 248 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
| 249 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 249 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
| 250 | 250 | $sth_dest_owner->execute($query_dest_owner_values); |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | if ($globalTransaction) $Connection->db->commit(); |
| 254 | - } catch(PDOException $e) { |
|
| 254 | + } catch (PDOException $e) { |
|
| 255 | 255 | return "error : ".$e->getMessage(); |
| 256 | 256 | } |
| 257 | 257 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $Connection = new Connection(); |
| 262 | 262 | $sth = $Connection->db->prepare($query); |
| 263 | 263 | $sth->execute(array(':source' => $database_file)); |
| 264 | - } catch(PDOException $e) { |
|
| 264 | + } catch (PDOException $e) { |
|
| 265 | 265 | return "error : ".$e->getMessage(); |
| 266 | 266 | } |
| 267 | 267 | return ''; |
@@ -276,11 +276,11 @@ discard block |
||
| 276 | 276 | $Connection = new Connection(); |
| 277 | 277 | $sth = $Connection->db->prepare($query); |
| 278 | 278 | $sth->execute(array(':source' => $database_file)); |
| 279 | - } catch(PDOException $e) { |
|
| 279 | + } catch (PDOException $e) { |
|
| 280 | 280 | return "error : ".$e->getMessage(); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - if ($fh = fopen($database_file,"r")) { |
|
| 283 | + if ($fh = fopen($database_file, "r")) { |
|
| 284 | 284 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 285 | 285 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
| 286 | 286 | |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 291 | 291 | while (!feof($fh)) { |
| 292 | 292 | $values = array(); |
| 293 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
| 293 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
| 294 | 294 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 295 | - $values['ModeS'] = substr($line,0,6); |
|
| 296 | - $values['Registration'] = trim(substr($line,69,6)); |
|
| 297 | - $aircraft_name = trim(substr($line,48,6)); |
|
| 295 | + $values['ModeS'] = substr($line, 0, 6); |
|
| 296 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
| 297 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
| 298 | 298 | // Check if we can find ICAO, else set it to GLID |
| 299 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 299 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 300 | 300 | $search_more = ''; |
| 301 | 301 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 302 | 302 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -308,20 +308,20 @@ discard block |
||
| 308 | 308 | if (isset($result['icao']) && $result['icao'] != '') { |
| 309 | 309 | $values['ICAOTypeCode'] = $result['icao']; |
| 310 | 310 | } |
| 311 | - } catch(PDOException $e) { |
|
| 311 | + } catch (PDOException $e) { |
|
| 312 | 312 | return "error : ".$e->getMessage(); |
| 313 | 313 | } |
| 314 | 314 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 315 | 315 | // Add data to db |
| 316 | 316 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
| 317 | 317 | //$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']); |
| 318 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
| 318 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
| 319 | 319 | //print_r($query_dest_values); |
| 320 | 320 | $sth_dest->execute($query_dest_values); |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | if ($globalTransaction) $Connection->db->commit(); |
| 324 | - } catch(PDOException $e) { |
|
| 324 | + } catch (PDOException $e) { |
|
| 325 | 325 | return "error : ".$e->getMessage(); |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $Connection = new Connection(); |
| 332 | 332 | $sth = $Connection->db->prepare($query); |
| 333 | 333 | $sth->execute(array(':source' => $database_file)); |
| 334 | - } catch(PDOException $e) { |
|
| 334 | + } catch (PDOException $e) { |
|
| 335 | 335 | return "error : ".$e->getMessage(); |
| 336 | 336 | } |
| 337 | 337 | return ''; |
@@ -345,11 +345,11 @@ discard block |
||
| 345 | 345 | $Connection = new Connection(); |
| 346 | 346 | $sth = $Connection->db->prepare($query); |
| 347 | 347 | $sth->execute(array(':source' => $database_file)); |
| 348 | - } catch(PDOException $e) { |
|
| 348 | + } catch (PDOException $e) { |
|
| 349 | 349 | return "error : ".$e->getMessage(); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if ($fh = fopen($database_file,"r")) { |
|
| 352 | + if ($fh = fopen($database_file, "r")) { |
|
| 353 | 353 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 354 | 354 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
| 355 | 355 | |
@@ -357,9 +357,9 @@ discard block |
||
| 357 | 357 | $sth_dest = $Connection->db->prepare($query_dest); |
| 358 | 358 | try { |
| 359 | 359 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 360 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
| 360 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
| 361 | 361 | while (!feof($fh)) { |
| 362 | - $line = fgetcsv($fh,9999,',',"'"); |
|
| 362 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
| 363 | 363 | |
| 364 | 364 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 365 | 365 | //print_r($line); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | $values['ICAOTypeCode'] = ''; |
| 369 | 369 | $aircraft_name = $line[2]; |
| 370 | 370 | // Check if we can find ICAO, else set it to GLID |
| 371 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 371 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 372 | 372 | $search_more = ''; |
| 373 | 373 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 374 | 374 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -377,20 +377,20 @@ discard block |
||
| 377 | 377 | $sth_search->execute(); |
| 378 | 378 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 379 | 379 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
| 380 | - } catch(PDOException $e) { |
|
| 380 | + } catch (PDOException $e) { |
|
| 381 | 381 | return "error : ".$e->getMessage(); |
| 382 | 382 | } |
| 383 | 383 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 384 | 384 | // Add data to db |
| 385 | 385 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
| 386 | 386 | //$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']); |
| 387 | - $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'); |
|
| 387 | + $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'); |
|
| 388 | 388 | //print_r($query_dest_values); |
| 389 | 389 | $sth_dest->execute($query_dest_values); |
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | if ($globalTransaction) $Connection->db->commit(); |
| 393 | - } catch(PDOException $e) { |
|
| 393 | + } catch (PDOException $e) { |
|
| 394 | 394 | return "error : ".$e->getMessage(); |
| 395 | 395 | } |
| 396 | 396 | } |
@@ -400,13 +400,13 @@ discard block |
||
| 400 | 400 | $Connection = new Connection(); |
| 401 | 401 | $sth = $Connection->db->prepare($query); |
| 402 | 402 | $sth->execute(array(':source' => $database_file)); |
| 403 | - } catch(PDOException $e) { |
|
| 403 | + } catch (PDOException $e) { |
|
| 404 | 404 | return "error : ".$e->getMessage(); |
| 405 | 405 | } |
| 406 | 406 | return ''; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
| 409 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
| 410 | 410 | global $globalTransaction, $globalMasterSource; |
| 411 | 411 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
| 412 | 412 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -414,12 +414,12 @@ discard block |
||
| 414 | 414 | $Connection = new Connection(); |
| 415 | 415 | $sth = $Connection->db->prepare($query); |
| 416 | 416 | $sth->execute(array(':source' => $database_file)); |
| 417 | - } catch(PDOException $e) { |
|
| 417 | + } catch (PDOException $e) { |
|
| 418 | 418 | return "error : ".$e->getMessage(); |
| 419 | 419 | } |
| 420 | 420 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 421 | 421 | $Spotter = new Spotter(); |
| 422 | - if ($fh = fopen($database_file,"r")) { |
|
| 422 | + if ($fh = fopen($database_file, "r")) { |
|
| 423 | 423 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 424 | 424 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 425 | 425 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -429,9 +429,9 @@ discard block |
||
| 429 | 429 | $sth_modes = $Connection->db->prepare($query_modes); |
| 430 | 430 | try { |
| 431 | 431 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 432 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
| 432 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
| 433 | 433 | while (!feof($fh)) { |
| 434 | - $line = fgetcsv($fh,9999,',','"'); |
|
| 434 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
| 435 | 435 | $values = array(); |
| 436 | 436 | //print_r($line); |
| 437 | 437 | if ($country == 'F') { |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $values['base'] = $line[4]; |
| 440 | 440 | $values['owner'] = $line[5]; |
| 441 | 441 | if ($line[6] == '') $values['date_first_reg'] = null; |
| 442 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 442 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 443 | 443 | $values['cancel'] = $line[7]; |
| 444 | 444 | } elseif ($country == 'EI') { |
| 445 | 445 | // TODO : add modeS & reg to aircraft_modes |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $values['base'] = $line[3]; |
| 448 | 448 | $values['owner'] = $line[2]; |
| 449 | 449 | if ($line[1] == '') $values['date_first_reg'] = null; |
| 450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 450 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
| 451 | 451 | $values['cancel'] = ''; |
| 452 | 452 | $values['modes'] = $line[7]; |
| 453 | 453 | $values['icao'] = $line[8]; |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | $values['base'] = null; |
| 468 | 468 | $values['owner'] = $line[5]; |
| 469 | 469 | if ($line[18] == '') $values['date_first_reg'] = null; |
| 470 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 470 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
| 471 | 471 | $values['cancel'] = ''; |
| 472 | 472 | } elseif ($country == 'VH') { |
| 473 | 473 | // TODO : add modeS & reg to aircraft_modes |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $values['base'] = null; |
| 476 | 476 | $values['owner'] = $line[12]; |
| 477 | 477 | if ($line[28] == '') $values['date_first_reg'] = null; |
| 478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 478 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
| 479 | 479 | |
| 480 | 480 | $values['cancel'] = $line[39]; |
| 481 | 481 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -495,28 +495,28 @@ discard block |
||
| 495 | 495 | $values['base'] = null; |
| 496 | 496 | $values['owner'] = $line[8]; |
| 497 | 497 | if ($line[7] == '') $values['date_first_reg'] = null; |
| 498 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 498 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 499 | 499 | $values['cancel'] = ''; |
| 500 | 500 | } elseif ($country == 'PP') { |
| 501 | 501 | $values['registration'] = $line[0]; |
| 502 | 502 | $values['base'] = null; |
| 503 | 503 | $values['owner'] = $line[4]; |
| 504 | 504 | if ($line[6] == '') $values['date_first_reg'] = null; |
| 505 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 505 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 506 | 506 | $values['cancel'] = $line[7]; |
| 507 | 507 | } elseif ($country == 'E7') { |
| 508 | 508 | $values['registration'] = $line[0]; |
| 509 | 509 | $values['base'] = null; |
| 510 | 510 | $values['owner'] = $line[4]; |
| 511 | 511 | if ($line[5] == '') $values['date_first_reg'] = null; |
| 512 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 512 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
| 513 | 513 | $values['cancel'] = ''; |
| 514 | 514 | } elseif ($country == '8Q') { |
| 515 | 515 | $values['registration'] = $line[0]; |
| 516 | 516 | $values['base'] = null; |
| 517 | 517 | $values['owner'] = $line[3]; |
| 518 | 518 | if ($line[7] == '') $values['date_first_reg'] = null; |
| 519 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 519 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 520 | 520 | $values['cancel'] = ''; |
| 521 | 521 | } elseif ($country == 'ZK') { |
| 522 | 522 | $values['registration'] = $line[0]; |
@@ -530,18 +530,18 @@ discard block |
||
| 530 | 530 | $values['registration'] = $line[0]; |
| 531 | 531 | $values['base'] = null; |
| 532 | 532 | $values['owner'] = $line[6]; |
| 533 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 534 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
| 533 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
| 534 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
| 535 | 535 | $values['modes'] = $line[4]; |
| 536 | 536 | $values['icao'] = $line[10]; |
| 537 | 537 | } elseif ($country == 'OY') { |
| 538 | 538 | $values['registration'] = $line[0]; |
| 539 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
| 539 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
| 540 | 540 | $values['modes'] = $line[5]; |
| 541 | 541 | $values['icao'] = $line[6]; |
| 542 | 542 | } elseif ($country == 'PH') { |
| 543 | 543 | $values['registration'] = $line[0]; |
| 544 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
| 544 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
| 545 | 545 | $values['modes'] = $line[4]; |
| 546 | 546 | $values['icao'] = $line[5]; |
| 547 | 547 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -552,17 +552,17 @@ discard block |
||
| 552 | 552 | $values['cancel'] = ''; |
| 553 | 553 | } |
| 554 | 554 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
| 555 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
| 555 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
| 556 | 556 | $sth_dest->execute($query_dest_values); |
| 557 | 557 | } |
| 558 | 558 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
| 559 | 559 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
| 560 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
| 560 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
| 561 | 561 | $sth_modes->execute($query_modes_values); |
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | 564 | if ($globalTransaction) $Connection->db->commit(); |
| 565 | - } catch(PDOException $e) { |
|
| 565 | + } catch (PDOException $e) { |
|
| 566 | 566 | return "error : ".$e->getMessage(); |
| 567 | 567 | } |
| 568 | 568 | } |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 701 | 701 | |
| 702 | 702 | $i = 0; |
| 703 | - while($row = sparql_fetch_array($result)) |
|
| 703 | + while ($row = sparql_fetch_array($result)) |
|
| 704 | 704 | { |
| 705 | 705 | if ($i >= 1) { |
| 706 | 706 | //print_r($row); |
@@ -720,33 +720,33 @@ discard block |
||
| 720 | 720 | $row['image'] = ''; |
| 721 | 721 | $row['image_thumb'] = ''; |
| 722 | 722 | } else { |
| 723 | - $image = str_replace(' ','_',$row['image']); |
|
| 723 | + $image = str_replace(' ', '_', $row['image']); |
|
| 724 | 724 | $digest = md5($image); |
| 725 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
| 726 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
| 727 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
| 728 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
| 725 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
| 726 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
| 727 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
| 728 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - $country = explode('-',$row['country']); |
|
| 731 | + $country = explode('-', $row['country']); |
|
| 732 | 732 | $row['country'] = $country[0]; |
| 733 | 733 | |
| 734 | 734 | $row['type'] = trim($row['type']); |
| 735 | - 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'])) { |
|
| 735 | + 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'])) { |
|
| 736 | 736 | $row['type'] = 'military'; |
| 737 | 737 | } 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') { |
| 738 | 738 | $row['type'] = 'small_airport'; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
| 742 | - $query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($row['altitude']),':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
| 741 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
| 742 | + $query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($row['altitude']), ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
| 743 | 743 | //print_r($query_dest_values); |
| 744 | 744 | |
| 745 | 745 | if ($row['icao'] != '') { |
| 746 | 746 | try { |
| 747 | 747 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
| 748 | 748 | $sth->execute(array(':icao' => $row['icao'])); |
| 749 | - } catch(PDOException $e) { |
|
| 749 | + } catch (PDOException $e) { |
|
| 750 | 750 | return "error : ".$e->getMessage(); |
| 751 | 751 | } |
| 752 | 752 | if ($sth->fetchColumn() > 0) { |
@@ -754,15 +754,15 @@ discard block |
||
| 754 | 754 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
| 755 | 755 | try { |
| 756 | 756 | $sth = $Connection->db->prepare($query); |
| 757 | - $sth->execute(array(':icao' => $row['icao'],':type' => $row['type'])); |
|
| 758 | - } catch(PDOException $e) { |
|
| 757 | + $sth->execute(array(':icao' => $row['icao'], ':type' => $row['type'])); |
|
| 758 | + } catch (PDOException $e) { |
|
| 759 | 759 | return "error : ".$e->getMessage(); |
| 760 | 760 | } |
| 761 | 761 | echo $row['icao'].' : '.$row['type']."\n"; |
| 762 | 762 | } else { |
| 763 | 763 | try { |
| 764 | 764 | $sth_dest->execute($query_dest_values); |
| 765 | - } catch(PDOException $e) { |
|
| 765 | + } catch (PDOException $e) { |
|
| 766 | 766 | return "error : ".$e->getMessage(); |
| 767 | 767 | } |
| 768 | 768 | } |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | echo "Download data from ourairports.com...\n"; |
| 814 | 814 | $delimiter = ','; |
| 815 | 815 | $out_file = $tmp_dir.'airports.csv'; |
| 816 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
| 816 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
| 817 | 817 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 818 | 818 | echo "Add data from ourairports.com...\n"; |
| 819 | 819 | |
@@ -824,33 +824,33 @@ discard block |
||
| 824 | 824 | //$Connection->db->beginTransaction(); |
| 825 | 825 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 826 | 826 | { |
| 827 | - if(!$header) $header = $row; |
|
| 827 | + if (!$header) $header = $row; |
|
| 828 | 828 | else { |
| 829 | 829 | $data = array(); |
| 830 | 830 | $data = array_combine($header, $row); |
| 831 | 831 | try { |
| 832 | 832 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
| 833 | 833 | $sth->execute(array(':icao' => $data['ident'])); |
| 834 | - } catch(PDOException $e) { |
|
| 834 | + } catch (PDOException $e) { |
|
| 835 | 835 | return "error : ".$e->getMessage(); |
| 836 | 836 | } |
| 837 | 837 | if ($sth->fetchColumn() > 0) { |
| 838 | 838 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
| 839 | 839 | try { |
| 840 | 840 | $sth = $Connection->db->prepare($query); |
| 841 | - $sth->execute(array(':icao' => $data['ident'],':type' => $data['type'])); |
|
| 842 | - } catch(PDOException $e) { |
|
| 841 | + $sth->execute(array(':icao' => $data['ident'], ':type' => $data['type'])); |
|
| 842 | + } catch (PDOException $e) { |
|
| 843 | 843 | return "error : ".$e->getMessage(); |
| 844 | 844 | } |
| 845 | 845 | } else { |
| 846 | 846 | if ($data['gps_code'] == $data['ident']) { |
| 847 | 847 | $query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link) |
| 848 | 848 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
| 849 | - $query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
| 849 | + $query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
| 850 | 850 | try { |
| 851 | 851 | $sth = $Connection->db->prepare($query); |
| 852 | 852 | $sth->execute($query_values); |
| 853 | - } catch(PDOException $e) { |
|
| 853 | + } catch (PDOException $e) { |
|
| 854 | 854 | return "error : ".$e->getMessage(); |
| 855 | 855 | } |
| 856 | 856 | $i++; |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | |
| 866 | 866 | echo "Download data from another free database...\n"; |
| 867 | 867 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 868 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
| 868 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
| 869 | 869 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 870 | 870 | update_db::unzip($out_file); |
| 871 | 871 | $header = NULL; |
@@ -877,15 +877,15 @@ discard block |
||
| 877 | 877 | //$Connection->db->beginTransaction(); |
| 878 | 878 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 879 | 879 | { |
| 880 | - if(!$header) $header = $row; |
|
| 880 | + if (!$header) $header = $row; |
|
| 881 | 881 | else { |
| 882 | 882 | $data = $row; |
| 883 | 883 | |
| 884 | 884 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
| 885 | 885 | try { |
| 886 | 886 | $sth = $Connection->db->prepare($query); |
| 887 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
| 888 | - } catch(PDOException $e) { |
|
| 887 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
| 888 | + } catch (PDOException $e) { |
|
| 889 | 889 | return "error : ".$e->getMessage(); |
| 890 | 890 | } |
| 891 | 891 | } |
@@ -899,15 +899,15 @@ discard block |
||
| 899 | 899 | try { |
| 900 | 900 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'"); |
| 901 | 901 | $sth->execute(); |
| 902 | - } catch(PDOException $e) { |
|
| 902 | + } catch (PDOException $e) { |
|
| 903 | 903 | return "error : ".$e->getMessage(); |
| 904 | 904 | } |
| 905 | 905 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 906 | 906 | $query2 = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
| 907 | 907 | try { |
| 908 | 908 | $sth2 = $Connection->db->prepare($query2); |
| 909 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
| 910 | - } catch(PDOException $e) { |
|
| 909 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
| 910 | + } catch (PDOException $e) { |
|
| 911 | 911 | return "error : ".$e->getMessage(); |
| 912 | 912 | } |
| 913 | 913 | } |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | $Connection = new Connection(); |
| 929 | 929 | $sth = $Connection->db->prepare($query); |
| 930 | 930 | $sth->execute(array(':source' => 'translation.csv')); |
| 931 | - } catch(PDOException $e) { |
|
| 931 | + } catch (PDOException $e) { |
|
| 932 | 932 | return "error : ".$e->getMessage(); |
| 933 | 933 | } |
| 934 | 934 | |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 946 | 946 | { |
| 947 | 947 | $i++; |
| 948 | - if($i > 12) { |
|
| 948 | + if ($i > 12) { |
|
| 949 | 949 | $data = $row; |
| 950 | 950 | $operator = $data[2]; |
| 951 | 951 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | //echo substr($operator, 0, 2)."\n";; |
| 954 | 954 | if (count($airline_array) > 0) { |
| 955 | 955 | //print_r($airline_array); |
| 956 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
| 956 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
| 957 | 957 | } |
| 958 | 958 | } |
| 959 | 959 | |
@@ -961,14 +961,14 @@ discard block |
||
| 961 | 961 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
| 962 | 962 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
| 963 | 963 | if (count($airline_array) > 0) { |
| 964 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 964 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
| 965 | 965 | } |
| 966 | 966 | } |
| 967 | 967 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 968 | 968 | try { |
| 969 | 969 | $sth = $Connection->db->prepare($query); |
| 970 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 971 | - } catch(PDOException $e) { |
|
| 970 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 971 | + } catch (PDOException $e) { |
|
| 972 | 972 | return "error : ".$e->getMessage(); |
| 973 | 973 | } |
| 974 | 974 | } |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | $Connection = new Connection(); |
| 987 | 987 | $sth = $Connection->db->prepare($query); |
| 988 | 988 | $sth->execute(array(':source' => 'website_fam')); |
| 989 | - } catch(PDOException $e) { |
|
| 989 | + } catch (PDOException $e) { |
|
| 990 | 990 | return "error : ".$e->getMessage(); |
| 991 | 991 | } |
| 992 | 992 | //update_db::unzip($out_file); |
@@ -1004,8 +1004,8 @@ discard block |
||
| 1004 | 1004 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 1005 | 1005 | try { |
| 1006 | 1006 | $sth = $Connection->db->prepare($query); |
| 1007 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 1008 | - } catch(PDOException $e) { |
|
| 1007 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 1008 | + } catch (PDOException $e) { |
|
| 1009 | 1009 | return "error : ".$e->getMessage(); |
| 1010 | 1010 | } |
| 1011 | 1011 | } |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | $Connection = new Connection(); |
| 1029 | 1029 | $sth = $Connection->db->prepare($query); |
| 1030 | 1030 | $sth->execute(array(':source' => 'website_faa')); |
| 1031 | - } catch(PDOException $e) { |
|
| 1031 | + } catch (PDOException $e) { |
|
| 1032 | 1032 | return "error : ".$e->getMessage(); |
| 1033 | 1033 | } |
| 1034 | 1034 | |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | $Connection = new Connection(); |
| 1038 | 1038 | $sth = $Connection->db->prepare($query); |
| 1039 | 1039 | $sth->execute(array(':source' => 'website_faa')); |
| 1040 | - } catch(PDOException $e) { |
|
| 1040 | + } catch (PDOException $e) { |
|
| 1041 | 1041 | return "error : ".$e->getMessage(); |
| 1042 | 1042 | } |
| 1043 | 1043 | |
@@ -1054,8 +1054,8 @@ discard block |
||
| 1054 | 1054 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
| 1055 | 1055 | try { |
| 1056 | 1056 | $sths = $Connection->db->prepare($query_search); |
| 1057 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
| 1058 | - } catch(PDOException $e) { |
|
| 1057 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
| 1058 | + } catch (PDOException $e) { |
|
| 1059 | 1059 | return "error s : ".$e->getMessage(); |
| 1060 | 1060 | } |
| 1061 | 1061 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1068,8 +1068,8 @@ discard block |
||
| 1068 | 1068 | //} |
| 1069 | 1069 | try { |
| 1070 | 1070 | $sthi = $Connection->db->prepare($queryi); |
| 1071 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
| 1072 | - } catch(PDOException $e) { |
|
| 1071 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
| 1072 | + } catch (PDOException $e) { |
|
| 1073 | 1073 | return "error u : ".$e->getMessage(); |
| 1074 | 1074 | } |
| 1075 | 1075 | } else { |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | try { |
| 1078 | 1078 | $sthsm = $Connection->db->prepare($query_search_mfr); |
| 1079 | 1079 | $sthsm->execute(array(':mfr' => $data[2])); |
| 1080 | - } catch(PDOException $e) { |
|
| 1080 | + } catch (PDOException $e) { |
|
| 1081 | 1081 | return "error mfr : ".$e->getMessage(); |
| 1082 | 1082 | } |
| 1083 | 1083 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1087,8 +1087,8 @@ discard block |
||
| 1087 | 1087 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
| 1088 | 1088 | try { |
| 1089 | 1089 | $sthf = $Connection->db->prepare($queryf); |
| 1090 | - $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')); |
|
| 1091 | - } catch(PDOException $e) { |
|
| 1090 | + $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')); |
|
| 1091 | + } catch (PDOException $e) { |
|
| 1092 | 1092 | return "error f : ".$e->getMessage(); |
| 1093 | 1093 | } |
| 1094 | 1094 | } |
@@ -1098,13 +1098,13 @@ discard block |
||
| 1098 | 1098 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 1099 | 1099 | try { |
| 1100 | 1100 | $sth = $Connection->db->prepare($query); |
| 1101 | - $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')); |
|
| 1102 | - } catch(PDOException $e) { |
|
| 1101 | + $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')); |
|
| 1102 | + } catch (PDOException $e) { |
|
| 1103 | 1103 | return "error i : ".$e->getMessage(); |
| 1104 | 1104 | } |
| 1105 | 1105 | } |
| 1106 | 1106 | } |
| 1107 | - if ($i % 90 == 0) { |
|
| 1107 | + if ($i%90 == 0) { |
|
| 1108 | 1108 | if ($globalTransaction) $Connection->db->commit(); |
| 1109 | 1109 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1110 | 1110 | } |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | $Connection = new Connection(); |
| 1124 | 1124 | $sth = $Connection->db->prepare($query); |
| 1125 | 1125 | $sth->execute(array(':source' => 'website_fam')); |
| 1126 | - } catch(PDOException $e) { |
|
| 1126 | + } catch (PDOException $e) { |
|
| 1127 | 1127 | return "error : ".$e->getMessage(); |
| 1128 | 1128 | } |
| 1129 | 1129 | |
@@ -1144,8 +1144,8 @@ discard block |
||
| 1144 | 1144 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
| 1145 | 1145 | try { |
| 1146 | 1146 | $sth = $Connection->db->prepare($query); |
| 1147 | - $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')); |
|
| 1148 | - } catch(PDOException $e) { |
|
| 1147 | + $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')); |
|
| 1148 | + } catch (PDOException $e) { |
|
| 1149 | 1149 | return "error : ".$e->getMessage(); |
| 1150 | 1150 | } |
| 1151 | 1151 | } |
@@ -1164,7 +1164,7 @@ discard block |
||
| 1164 | 1164 | $Connection = new Connection(); |
| 1165 | 1165 | $sth = $Connection->db->prepare($query); |
| 1166 | 1166 | $sth->execute(array(':source' => 'website_fam')); |
| 1167 | - } catch(PDOException $e) { |
|
| 1167 | + } catch (PDOException $e) { |
|
| 1168 | 1168 | return "error : ".$e->getMessage(); |
| 1169 | 1169 | } |
| 1170 | 1170 | |
@@ -1180,8 +1180,8 @@ discard block |
||
| 1180 | 1180 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
| 1181 | 1181 | try { |
| 1182 | 1182 | $sth = $Connection->db->prepare($query); |
| 1183 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
| 1184 | - } catch(PDOException $e) { |
|
| 1183 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
| 1184 | + } catch (PDOException $e) { |
|
| 1185 | 1185 | //print_r($data); |
| 1186 | 1186 | return "error : ".$e->getMessage(); |
| 1187 | 1187 | } |
@@ -1201,7 +1201,7 @@ discard block |
||
| 1201 | 1201 | $Connection = new Connection(); |
| 1202 | 1202 | $sth = $Connection->db->prepare($query); |
| 1203 | 1203 | $sth->execute(array(':source' => 'website_fam')); |
| 1204 | - } catch(PDOException $e) { |
|
| 1204 | + } catch (PDOException $e) { |
|
| 1205 | 1205 | return "error : ".$e->getMessage(); |
| 1206 | 1206 | } |
| 1207 | 1207 | $delimiter = "\t"; |
@@ -1216,9 +1216,9 @@ discard block |
||
| 1216 | 1216 | $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)'; |
| 1217 | 1217 | try { |
| 1218 | 1218 | $sth = $Connection->db->prepare($query); |
| 1219 | - $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')); |
|
| 1220 | - } catch(PDOException $e) { |
|
| 1221 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
| 1219 | + $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')); |
|
| 1220 | + } catch (PDOException $e) { |
|
| 1221 | + if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data); |
|
| 1222 | 1222 | } |
| 1223 | 1223 | } |
| 1224 | 1224 | $i++; |
@@ -1236,7 +1236,7 @@ discard block |
||
| 1236 | 1236 | $Connection = new Connection(); |
| 1237 | 1237 | $sth = $Connection->db->prepare($query); |
| 1238 | 1238 | $sth->execute(); |
| 1239 | - } catch(PDOException $e) { |
|
| 1239 | + } catch (PDOException $e) { |
|
| 1240 | 1240 | return "error : ".$e->getMessage(); |
| 1241 | 1241 | } |
| 1242 | 1242 | |
@@ -1257,8 +1257,8 @@ discard block |
||
| 1257 | 1257 | $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)'; |
| 1258 | 1258 | try { |
| 1259 | 1259 | $sth = $Connection->db->prepare($query); |
| 1260 | - $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])); |
|
| 1261 | - } catch(PDOException $e) { |
|
| 1260 | + $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])); |
|
| 1261 | + } catch (PDOException $e) { |
|
| 1262 | 1262 | return "error : ".$e->getMessage(); |
| 1263 | 1263 | } |
| 1264 | 1264 | } |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | $Connection = new Connection(); |
| 1278 | 1278 | $sth = $Connection->db->prepare($query); |
| 1279 | 1279 | $sth->execute(); |
| 1280 | - } catch(PDOException $e) { |
|
| 1280 | + } catch (PDOException $e) { |
|
| 1281 | 1281 | return "error : ".$e->getMessage(); |
| 1282 | 1282 | } |
| 1283 | 1283 | $delimiter = "\t"; |
@@ -1294,8 +1294,8 @@ discard block |
||
| 1294 | 1294 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
| 1295 | 1295 | try { |
| 1296 | 1296 | $sth = $Connection->db->prepare($query); |
| 1297 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
| 1298 | - } catch(PDOException $e) { |
|
| 1297 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
| 1298 | + } catch (PDOException $e) { |
|
| 1299 | 1299 | return "error : ".$e->getMessage(); |
| 1300 | 1300 | } |
| 1301 | 1301 | } |
@@ -1314,7 +1314,7 @@ discard block |
||
| 1314 | 1314 | $Connection = new Connection(); |
| 1315 | 1315 | $sth = $Connection->db->prepare($query); |
| 1316 | 1316 | $sth->execute(); |
| 1317 | - } catch(PDOException $e) { |
|
| 1317 | + } catch (PDOException $e) { |
|
| 1318 | 1318 | return "error : ".$e->getMessage(); |
| 1319 | 1319 | } |
| 1320 | 1320 | |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | try { |
| 1331 | 1331 | $sth = $Connection->db->prepare($query); |
| 1332 | 1332 | $sth->execute(array(':icao' => $icao)); |
| 1333 | - } catch(PDOException $e) { |
|
| 1333 | + } catch (PDOException $e) { |
|
| 1334 | 1334 | return "error : ".$e->getMessage(); |
| 1335 | 1335 | } |
| 1336 | 1336 | } |
@@ -1341,7 +1341,7 @@ discard block |
||
| 1341 | 1341 | return ''; |
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | - public static function tle($filename,$tletype) { |
|
| 1344 | + public static function tle($filename, $tletype) { |
|
| 1345 | 1345 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 1346 | 1346 | global $tmp_dir, $globalTransaction; |
| 1347 | 1347 | //$Spotter = new Spotter(); |
@@ -1351,7 +1351,7 @@ discard block |
||
| 1351 | 1351 | $Connection = new Connection(); |
| 1352 | 1352 | $sth = $Connection->db->prepare($query); |
| 1353 | 1353 | $sth->execute(array(':source' => $filename)); |
| 1354 | - } catch(PDOException $e) { |
|
| 1354 | + } catch (PDOException $e) { |
|
| 1355 | 1355 | return "error : ".$e->getMessage(); |
| 1356 | 1356 | } |
| 1357 | 1357 | |
@@ -1376,8 +1376,8 @@ discard block |
||
| 1376 | 1376 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
| 1377 | 1377 | try { |
| 1378 | 1378 | $sth = $Connection->db->prepare($query); |
| 1379 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
| 1380 | - } catch(PDOException $e) { |
|
| 1379 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
| 1380 | + } catch (PDOException $e) { |
|
| 1381 | 1381 | return "error : ".$e->getMessage(); |
| 1382 | 1382 | } |
| 1383 | 1383 | |
@@ -1397,7 +1397,7 @@ discard block |
||
| 1397 | 1397 | $Connection = new Connection(); |
| 1398 | 1398 | $sth = $Connection->db->prepare($query); |
| 1399 | 1399 | $sth->execute(array(':source' => $filename)); |
| 1400 | - } catch(PDOException $e) { |
|
| 1400 | + } catch (PDOException $e) { |
|
| 1401 | 1401 | return "error : ".$e->getMessage(); |
| 1402 | 1402 | } |
| 1403 | 1403 | |
@@ -1407,13 +1407,13 @@ discard block |
||
| 1407 | 1407 | $i = 0; |
| 1408 | 1408 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
| 1409 | 1409 | //$Connection->db->beginTransaction(); |
| 1410 | - while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE) |
|
| 1410 | + while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) |
|
| 1411 | 1411 | { |
| 1412 | 1412 | if ($i > 0 && $data[0] != '') { |
| 1413 | 1413 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
| 1414 | - $period = str_replace(',','',$data[14]); |
|
| 1415 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
| 1416 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1414 | + $period = str_replace(',', '', $data[14]); |
|
| 1415 | + if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60; |
|
| 1416 | + if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18])); |
|
| 1417 | 1417 | else $launch_date = NULL; |
| 1418 | 1418 | $data = array_map(function($value) { |
| 1419 | 1419 | return trim($value) === '' ? null : $value; |
@@ -1423,8 +1423,8 @@ discard block |
||
| 1423 | 1423 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
| 1424 | 1424 | try { |
| 1425 | 1425 | $sth = $Connection->db->prepare($query); |
| 1426 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
| 1427 | - } catch(PDOException $e) { |
|
| 1426 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
| 1427 | + } catch (PDOException $e) { |
|
| 1428 | 1428 | return "error : ".$e->getMessage(); |
| 1429 | 1429 | } |
| 1430 | 1430 | } |
@@ -1464,7 +1464,7 @@ discard block |
||
| 1464 | 1464 | 'EGYP' => array('country' => 'Egypt', 'owner' => ''), |
| 1465 | 1465 | 'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'), |
| 1466 | 1466 | 'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'), |
| 1467 | - 'EST' => array('country' => 'Estonia','owner' => ''), |
|
| 1467 | + 'EST' => array('country' => 'Estonia', 'owner' => ''), |
|
| 1468 | 1468 | 'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'), |
| 1469 | 1469 | 'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'), |
| 1470 | 1470 | 'FGER' => array('country' => 'France/Germany', 'owner' => ''), |
@@ -1587,10 +1587,10 @@ discard block |
||
| 1587 | 1587 | while (($data = fgets($handle, 1000)) !== FALSE) |
| 1588 | 1588 | { |
| 1589 | 1589 | $result = array(); |
| 1590 | - $result['cospar'] = trim(substr($data,0,11)); |
|
| 1591 | - $result['norad'] = trim(substr($data,13,6)); |
|
| 1592 | - $result['operational'] = trim(substr($data,21,1)); |
|
| 1593 | - $result['name'] = trim(substr($data,23,24)); |
|
| 1590 | + $result['cospar'] = trim(substr($data, 0, 11)); |
|
| 1591 | + $result['norad'] = trim(substr($data, 13, 6)); |
|
| 1592 | + $result['operational'] = trim(substr($data, 21, 1)); |
|
| 1593 | + $result['name'] = trim(substr($data, 23, 24)); |
|
| 1594 | 1594 | /* |
| 1595 | 1595 | * R/B(1) = Rocket body, first stage |
| 1596 | 1596 | * R/B(2) = Rocket body, second stage |
@@ -1602,20 +1602,20 @@ discard block |
||
| 1602 | 1602 | * An ampersand (&) indicates two or more objects are attached |
| 1603 | 1603 | */ |
| 1604 | 1604 | |
| 1605 | - $owner_code = trim(substr($data,49,5)); |
|
| 1605 | + $owner_code = trim(substr($data, 49, 5)); |
|
| 1606 | 1606 | if ($owner_code != 'TBD') { |
| 1607 | 1607 | $result['country_owner'] = $satcat_sources[$owner_code]['country']; |
| 1608 | 1608 | $result['owner'] = $satcat_sources[$owner_code]['owner']; |
| 1609 | - $result['launch_date'] = trim(substr($data,56,10)); |
|
| 1610 | - $launch_site_code = trim(substr($data,68,5)); |
|
| 1609 | + $result['launch_date'] = trim(substr($data, 56, 10)); |
|
| 1610 | + $launch_site_code = trim(substr($data, 68, 5)); |
|
| 1611 | 1611 | $result['launch_site'] = $satcat_launch_site[$launch_site_code]; |
| 1612 | - $result['lifetime'] = trim(substr($data,75,10)); |
|
| 1613 | - $result['period'] = trim(substr($data,87,7)); |
|
| 1614 | - $result['inclination'] = trim(substr($data,96,5)); |
|
| 1615 | - $result['apogee'] = trim(substr($data,103,6)); |
|
| 1616 | - $result['perigee'] = trim(substr($data,111,6)); |
|
| 1612 | + $result['lifetime'] = trim(substr($data, 75, 10)); |
|
| 1613 | + $result['period'] = trim(substr($data, 87, 7)); |
|
| 1614 | + $result['inclination'] = trim(substr($data, 96, 5)); |
|
| 1615 | + $result['apogee'] = trim(substr($data, 103, 6)); |
|
| 1616 | + $result['perigee'] = trim(substr($data, 111, 6)); |
|
| 1617 | 1617 | //$result['radarcross'] = trim(substr($data,119,8)); |
| 1618 | - $result['status'] = trim(substr($data,129,3)); |
|
| 1618 | + $result['status'] = trim(substr($data, 129, 3)); |
|
| 1619 | 1619 | //print_r($result); |
| 1620 | 1620 | $result = array_map(function($value) { |
| 1621 | 1621 | return trim($value) === '' ? null : $value; |
@@ -1628,7 +1628,7 @@ discard block |
||
| 1628 | 1628 | $sth = $Connection->db->prepare($query); |
| 1629 | 1629 | $sth->execute(array(':cospar' => $result['cospar'])); |
| 1630 | 1630 | $exist = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1631 | - } catch(PDOException $e) { |
|
| 1631 | + } catch (PDOException $e) { |
|
| 1632 | 1632 | return "error : ".$e->getMessage(); |
| 1633 | 1633 | } |
| 1634 | 1634 | if (empty($exist)) { |
@@ -1640,10 +1640,10 @@ discard block |
||
| 1640 | 1640 | ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
| 1641 | 1641 | ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
| 1642 | 1642 | ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
| 1643 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
| 1643 | + ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
| 1644 | 1644 | ) |
| 1645 | 1645 | ); |
| 1646 | - } catch(PDOException $e) { |
|
| 1646 | + } catch (PDOException $e) { |
|
| 1647 | 1647 | return "error : ".$e->getMessage(); |
| 1648 | 1648 | } |
| 1649 | 1649 | } elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) { |
@@ -1651,8 +1651,8 @@ discard block |
||
| 1651 | 1651 | try { |
| 1652 | 1652 | $Connection = new Connection(); |
| 1653 | 1653 | $sth = $Connection->db->prepare($query); |
| 1654 | - $sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar'])); |
|
| 1655 | - } catch(PDOException $e) { |
|
| 1654 | + $sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar'])); |
|
| 1655 | + } catch (PDOException $e) { |
|
| 1656 | 1656 | return "error : ".$e->getMessage(); |
| 1657 | 1657 | } |
| 1658 | 1658 | } |
@@ -1771,13 +1771,13 @@ discard block |
||
| 1771 | 1771 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1772 | 1772 | { |
| 1773 | 1773 | $i++; |
| 1774 | - if($i > 3 && count($row) > 2) { |
|
| 1774 | + if ($i > 3 && count($row) > 2) { |
|
| 1775 | 1775 | $data = array_values(array_filter($row)); |
| 1776 | 1776 | $cntdata = count($data); |
| 1777 | 1777 | if ($cntdata > 10) { |
| 1778 | 1778 | $value = $data[9]; |
| 1779 | 1779 | |
| 1780 | - for ($i =10;$i < $cntdata;$i++) { |
|
| 1780 | + for ($i = 10; $i < $cntdata; $i++) { |
|
| 1781 | 1781 | $value .= ' '.$data[$i]; |
| 1782 | 1782 | } |
| 1783 | 1783 | $data[9] = $value; |
@@ -1787,8 +1787,8 @@ discard block |
||
| 1787 | 1787 | $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)'; |
| 1788 | 1788 | try { |
| 1789 | 1789 | $sth = $Connection->db->prepare($query); |
| 1790 | - $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])); |
|
| 1791 | - } catch(PDOException $e) { |
|
| 1790 | + $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])); |
|
| 1791 | + } catch (PDOException $e) { |
|
| 1792 | 1792 | return "error : ".$e->getMessage(); |
| 1793 | 1793 | } |
| 1794 | 1794 | } |
@@ -1809,7 +1809,7 @@ discard block |
||
| 1809 | 1809 | $Connection = new Connection(); |
| 1810 | 1810 | $sth = $Connection->db->prepare($query); |
| 1811 | 1811 | $sth->execute(); |
| 1812 | - } catch(PDOException $e) { |
|
| 1812 | + } catch (PDOException $e) { |
|
| 1813 | 1813 | return "error : ".$e->getMessage(); |
| 1814 | 1814 | } |
| 1815 | 1815 | |
@@ -1821,12 +1821,12 @@ discard block |
||
| 1821 | 1821 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1822 | 1822 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1823 | 1823 | { |
| 1824 | - if(count($row) > 1) { |
|
| 1824 | + if (count($row) > 1) { |
|
| 1825 | 1825 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
| 1826 | 1826 | try { |
| 1827 | 1827 | $sth = $Connection->db->prepare($query); |
| 1828 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
| 1829 | - } catch(PDOException $e) { |
|
| 1828 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
| 1829 | + } catch (PDOException $e) { |
|
| 1830 | 1830 | return "error : ".$e->getMessage(); |
| 1831 | 1831 | } |
| 1832 | 1832 | } |
@@ -1846,21 +1846,21 @@ discard block |
||
| 1846 | 1846 | try { |
| 1847 | 1847 | $sth = $Connection->db->prepare($query); |
| 1848 | 1848 | $sth->execute(); |
| 1849 | - } catch(PDOException $e) { |
|
| 1849 | + } catch (PDOException $e) { |
|
| 1850 | 1850 | return "error : ".$e->getMessage(); |
| 1851 | 1851 | } |
| 1852 | 1852 | } |
| 1853 | 1853 | |
| 1854 | 1854 | |
| 1855 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1855 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 1856 | 1856 | else { |
| 1857 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1857 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 1858 | 1858 | $query = "CREATE EXTENSION postgis"; |
| 1859 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
| 1859 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
| 1860 | 1860 | try { |
| 1861 | 1861 | $sth = $Connection->db->prepare($query); |
| 1862 | 1862 | $sth->execute(); |
| 1863 | - } catch(PDOException $e) { |
|
| 1863 | + } catch (PDOException $e) { |
|
| 1864 | 1864 | return "error : ".$e->getMessage(); |
| 1865 | 1865 | } |
| 1866 | 1866 | } |
@@ -1873,11 +1873,11 @@ discard block |
||
| 1873 | 1873 | include_once('class.create_db.php'); |
| 1874 | 1874 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
| 1875 | 1875 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
| 1876 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
| 1877 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
|
| 1876 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
| 1877 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5', $tmp_dir.'notam.txt.gz.md5'); |
|
| 1878 | 1878 | $error = ''; |
| 1879 | 1879 | if (file_exists($tmp_dir.'notam.txt.gz') && file_exists($tmp_dir.'notam.txt.gz.md5')) { |
| 1880 | - $notam_md5_file = explode(' ',file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
| 1880 | + $notam_md5_file = explode(' ', file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
| 1881 | 1881 | $notam_md5 = $notam_md5_file[0]; |
| 1882 | 1882 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
| 1883 | 1883 | if ($globalDebug) echo "Gunzip..."; |
@@ -1910,14 +1910,14 @@ discard block |
||
| 1910 | 1910 | try { |
| 1911 | 1911 | $sth = $Connection->db->prepare($query); |
| 1912 | 1912 | $sth->execute(); |
| 1913 | - } catch(PDOException $e) { |
|
| 1913 | + } catch (PDOException $e) { |
|
| 1914 | 1914 | echo "error : ".$e->getMessage(); |
| 1915 | 1915 | } |
| 1916 | 1916 | } |
| 1917 | 1917 | if ($globalDBdriver == 'mysql') { |
| 1918 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 1918 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 1919 | 1919 | } else { |
| 1920 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 1920 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 1921 | 1921 | } |
| 1922 | 1922 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
| 1923 | 1923 | return $error; |
@@ -1930,7 +1930,7 @@ discard block |
||
| 1930 | 1930 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
| 1931 | 1931 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
| 1932 | 1932 | // 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'); |
| 1933 | - 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'); |
|
| 1933 | + 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'); |
|
| 1934 | 1934 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
| 1935 | 1935 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
| 1936 | 1936 | return $error; |
@@ -1951,7 +1951,7 @@ discard block |
||
| 1951 | 1951 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 1952 | 1952 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
| 1953 | 1953 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 1954 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 1954 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 1955 | 1955 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
| 1956 | 1956 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
| 1957 | 1957 | } else $error = "ZIP module not loaded but required for IVAO."; |
@@ -1965,7 +1965,7 @@ discard block |
||
| 1965 | 1965 | global $tmp_dir, $globalDebug; |
| 1966 | 1966 | $error = ''; |
| 1967 | 1967 | if ($globalDebug) echo "Routes : Download..."; |
| 1968 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
| 1968 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
| 1969 | 1969 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 1970 | 1970 | if ($globalDebug) echo "Gunzip..."; |
| 1971 | 1971 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1981,7 +1981,7 @@ discard block |
||
| 1981 | 1981 | global $tmp_dir, $globalDebug; |
| 1982 | 1982 | $error = ''; |
| 1983 | 1983 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
| 1984 | - update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
| 1984 | + update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
| 1985 | 1985 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
| 1986 | 1986 | if ($globalDebug) echo "Gunzip..."; |
| 1987 | 1987 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1997,7 +1997,7 @@ discard block |
||
| 1997 | 1997 | global $tmp_dir, $globalDebug; |
| 1998 | 1998 | $error = ''; |
| 1999 | 1999 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
| 2000 | - update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
| 2000 | + update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
| 2001 | 2001 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
| 2002 | 2002 | if ($globalDebug) echo "Gunzip..."; |
| 2003 | 2003 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -2025,7 +2025,7 @@ discard block |
||
| 2025 | 2025 | */ |
| 2026 | 2026 | if ($globalDebug) echo "Modes : Download..."; |
| 2027 | 2027 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
| 2028 | - update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
| 2028 | + update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
| 2029 | 2029 | |
| 2030 | 2030 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 2031 | 2031 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -2045,7 +2045,7 @@ discard block |
||
| 2045 | 2045 | public static function update_ModeS_faa() { |
| 2046 | 2046 | global $tmp_dir, $globalDebug; |
| 2047 | 2047 | if ($globalDebug) echo "Modes FAA: Download..."; |
| 2048 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
| 2048 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
| 2049 | 2049 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
| 2050 | 2050 | if ($globalDebug) echo "Unzip..."; |
| 2051 | 2051 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -2061,7 +2061,7 @@ discard block |
||
| 2061 | 2061 | public static function update_ModeS_flarm() { |
| 2062 | 2062 | global $tmp_dir, $globalDebug; |
| 2063 | 2063 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
| 2064 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
| 2064 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
| 2065 | 2065 | if (file_exists($tmp_dir.'data.fln')) { |
| 2066 | 2066 | if ($globalDebug) echo "Add to DB..."; |
| 2067 | 2067 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -2075,7 +2075,7 @@ discard block |
||
| 2075 | 2075 | public static function update_ModeS_ogn() { |
| 2076 | 2076 | global $tmp_dir, $globalDebug; |
| 2077 | 2077 | if ($globalDebug) echo "Modes OGN: Download..."; |
| 2078 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
| 2078 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
| 2079 | 2079 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 2080 | 2080 | if ($globalDebug) echo "Add to DB..."; |
| 2081 | 2081 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -2090,201 +2090,201 @@ discard block |
||
| 2090 | 2090 | global $tmp_dir, $globalDebug, $globalMasterSource; |
| 2091 | 2091 | |
| 2092 | 2092 | if ($globalDebug) echo "Owner France: Download..."; |
| 2093 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
| 2093 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
| 2094 | 2094 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 2095 | 2095 | if ($globalDebug) echo "Add to DB..."; |
| 2096 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
| 2096 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
| 2097 | 2097 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
| 2098 | 2098 | if ($error != '') { |
| 2099 | 2099 | return $error; |
| 2100 | 2100 | } elseif ($globalDebug) echo "Done\n"; |
| 2101 | 2101 | |
| 2102 | 2102 | if ($globalDebug) echo "Owner Ireland: Download..."; |
| 2103 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
| 2103 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
| 2104 | 2104 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 2105 | 2105 | if ($globalDebug) echo "Add to DB..."; |
| 2106 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
| 2106 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
| 2107 | 2107 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
| 2108 | 2108 | if ($error != '') { |
| 2109 | 2109 | return $error; |
| 2110 | 2110 | } elseif ($globalDebug) echo "Done\n"; |
| 2111 | 2111 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
| 2112 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
| 2112 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
| 2113 | 2113 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 2114 | 2114 | if ($globalDebug) echo "Add to DB..."; |
| 2115 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
| 2115 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
| 2116 | 2116 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
| 2117 | 2117 | if ($error != '') { |
| 2118 | 2118 | return $error; |
| 2119 | 2119 | } elseif ($globalDebug) echo "Done\n"; |
| 2120 | 2120 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
| 2121 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
| 2121 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
| 2122 | 2122 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 2123 | 2123 | if ($globalDebug) echo "Add to DB..."; |
| 2124 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
| 2124 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
| 2125 | 2125 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
| 2126 | 2126 | if ($error != '') { |
| 2127 | 2127 | return $error; |
| 2128 | 2128 | } elseif ($globalDebug) echo "Done\n"; |
| 2129 | 2129 | if ($globalDebug) echo "Owner Australia: Download..."; |
| 2130 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
| 2130 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
| 2131 | 2131 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 2132 | 2132 | if ($globalDebug) echo "Add to DB..."; |
| 2133 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
| 2133 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
| 2134 | 2134 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
| 2135 | 2135 | if ($error != '') { |
| 2136 | 2136 | return $error; |
| 2137 | 2137 | } elseif ($globalDebug) echo "Done\n"; |
| 2138 | 2138 | if ($globalDebug) echo "Owner Austria: Download..."; |
| 2139 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
| 2139 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
| 2140 | 2140 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 2141 | 2141 | if ($globalDebug) echo "Add to DB..."; |
| 2142 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
| 2142 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
| 2143 | 2143 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
| 2144 | 2144 | if ($error != '') { |
| 2145 | 2145 | return $error; |
| 2146 | 2146 | } elseif ($globalDebug) echo "Done\n"; |
| 2147 | 2147 | if ($globalDebug) echo "Owner Chile: Download..."; |
| 2148 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
| 2148 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
| 2149 | 2149 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 2150 | 2150 | if ($globalDebug) echo "Add to DB..."; |
| 2151 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
| 2151 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
| 2152 | 2152 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
| 2153 | 2153 | if ($error != '') { |
| 2154 | 2154 | return $error; |
| 2155 | 2155 | } elseif ($globalDebug) echo "Done\n"; |
| 2156 | 2156 | if ($globalDebug) echo "Owner Colombia: Download..."; |
| 2157 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
| 2157 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
| 2158 | 2158 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 2159 | 2159 | if ($globalDebug) echo "Add to DB..."; |
| 2160 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
| 2160 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
| 2161 | 2161 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
| 2162 | 2162 | if ($error != '') { |
| 2163 | 2163 | return $error; |
| 2164 | 2164 | } elseif ($globalDebug) echo "Done\n"; |
| 2165 | 2165 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
| 2166 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
| 2166 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
| 2167 | 2167 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 2168 | 2168 | if ($globalDebug) echo "Add to DB..."; |
| 2169 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
| 2169 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
| 2170 | 2170 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
| 2171 | 2171 | if ($error != '') { |
| 2172 | 2172 | return $error; |
| 2173 | 2173 | } elseif ($globalDebug) echo "Done\n"; |
| 2174 | 2174 | if ($globalDebug) echo "Owner Brazil: Download..."; |
| 2175 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
| 2175 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
| 2176 | 2176 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 2177 | 2177 | if ($globalDebug) echo "Add to DB..."; |
| 2178 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
| 2178 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
| 2179 | 2179 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
| 2180 | 2180 | if ($error != '') { |
| 2181 | 2181 | return $error; |
| 2182 | 2182 | } elseif ($globalDebug) echo "Done\n"; |
| 2183 | 2183 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
| 2184 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
| 2184 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
| 2185 | 2185 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 2186 | 2186 | if ($globalDebug) echo "Add to DB..."; |
| 2187 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
| 2187 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
| 2188 | 2188 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
| 2189 | 2189 | if ($error != '') { |
| 2190 | 2190 | return $error; |
| 2191 | 2191 | } elseif ($globalDebug) echo "Done\n"; |
| 2192 | 2192 | if ($globalDebug) echo "Owner Croatia: Download..."; |
| 2193 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
| 2193 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
| 2194 | 2194 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 2195 | 2195 | if ($globalDebug) echo "Add to DB..."; |
| 2196 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
| 2196 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
| 2197 | 2197 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
| 2198 | 2198 | if ($error != '') { |
| 2199 | 2199 | return $error; |
| 2200 | 2200 | } elseif ($globalDebug) echo "Done\n"; |
| 2201 | 2201 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
| 2202 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
| 2202 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
| 2203 | 2203 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 2204 | 2204 | if ($globalDebug) echo "Add to DB..."; |
| 2205 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
| 2205 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
| 2206 | 2206 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
| 2207 | 2207 | if ($error != '') { |
| 2208 | 2208 | return $error; |
| 2209 | 2209 | } elseif ($globalDebug) echo "Done\n"; |
| 2210 | 2210 | if ($globalDebug) echo "Owner Maldives: Download..."; |
| 2211 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
| 2211 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
| 2212 | 2212 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 2213 | 2213 | if ($globalDebug) echo "Add to DB..."; |
| 2214 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
| 2214 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
| 2215 | 2215 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
| 2216 | 2216 | if ($error != '') { |
| 2217 | 2217 | return $error; |
| 2218 | 2218 | } elseif ($globalDebug) echo "Done\n"; |
| 2219 | 2219 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
| 2220 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
| 2220 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
| 2221 | 2221 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 2222 | 2222 | if ($globalDebug) echo "Add to DB..."; |
| 2223 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
| 2223 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
| 2224 | 2224 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
| 2225 | 2225 | if ($error != '') { |
| 2226 | 2226 | return $error; |
| 2227 | 2227 | } elseif ($globalDebug) echo "Done\n"; |
| 2228 | 2228 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
| 2229 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
| 2229 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
| 2230 | 2230 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 2231 | 2231 | if ($globalDebug) echo "Add to DB..."; |
| 2232 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
| 2232 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
| 2233 | 2233 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
| 2234 | 2234 | if ($error != '') { |
| 2235 | 2235 | return $error; |
| 2236 | 2236 | } elseif ($globalDebug) echo "Done\n"; |
| 2237 | 2237 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
| 2238 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
| 2238 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
| 2239 | 2239 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 2240 | 2240 | if ($globalDebug) echo "Add to DB..."; |
| 2241 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
| 2241 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
| 2242 | 2242 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
| 2243 | 2243 | if ($error != '') { |
| 2244 | 2244 | return $error; |
| 2245 | 2245 | } elseif ($globalDebug) echo "Done\n"; |
| 2246 | 2246 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
| 2247 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
| 2247 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
| 2248 | 2248 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 2249 | 2249 | if ($globalDebug) echo "Add to DB..."; |
| 2250 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
| 2250 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
| 2251 | 2251 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
| 2252 | 2252 | if ($error != '') { |
| 2253 | 2253 | return $error; |
| 2254 | 2254 | } elseif ($globalDebug) echo "Done\n"; |
| 2255 | 2255 | if ($globalDebug) echo "Owner Iceland: Download..."; |
| 2256 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
| 2256 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
| 2257 | 2257 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 2258 | 2258 | if ($globalDebug) echo "Add to DB..."; |
| 2259 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
| 2259 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
| 2260 | 2260 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
| 2261 | 2261 | if ($error != '') { |
| 2262 | 2262 | return $error; |
| 2263 | 2263 | } elseif ($globalDebug) echo "Done\n"; |
| 2264 | 2264 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
| 2265 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
| 2265 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
| 2266 | 2266 | if (file_exists($tmp_dir.'owner_m.csv')) { |
| 2267 | 2267 | if ($globalDebug) echo "Add to DB..."; |
| 2268 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
| 2268 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
| 2269 | 2269 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
| 2270 | 2270 | if ($error != '') { |
| 2271 | 2271 | return $error; |
| 2272 | 2272 | } elseif ($globalDebug) echo "Done\n"; |
| 2273 | 2273 | if ($globalMasterSource) { |
| 2274 | 2274 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
| 2275 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
| 2275 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
| 2276 | 2276 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
| 2277 | 2277 | if ($globalDebug) echo "Add to DB..."; |
| 2278 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
| 2278 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
| 2279 | 2279 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
| 2280 | 2280 | if ($error != '') { |
| 2281 | 2281 | return $error; |
| 2282 | 2282 | } elseif ($globalDebug) echo "Done\n"; |
| 2283 | 2283 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
| 2284 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
| 2284 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
| 2285 | 2285 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
| 2286 | 2286 | if ($globalDebug) echo "Add to DB..."; |
| 2287 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
| 2287 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
| 2288 | 2288 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
| 2289 | 2289 | if ($error != '') { |
| 2290 | 2290 | return $error; |
@@ -2297,7 +2297,7 @@ discard block |
||
| 2297 | 2297 | global $tmp_dir, $globalDebug; |
| 2298 | 2298 | $error = ''; |
| 2299 | 2299 | if ($globalDebug) echo "Translation : Download..."; |
| 2300 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
| 2300 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
| 2301 | 2301 | if (file_exists($tmp_dir.'translation.zip')) { |
| 2302 | 2302 | if ($globalDebug) echo "Unzip..."; |
| 2303 | 2303 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -2313,10 +2313,10 @@ discard block |
||
| 2313 | 2313 | public static function update_translation_fam() { |
| 2314 | 2314 | global $tmp_dir, $globalDebug; |
| 2315 | 2315 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
| 2316 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
| 2317 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
|
| 2316 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
| 2317 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5', $tmp_dir.'translation.tsv.gz.md5'); |
|
| 2318 | 2318 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
| 2319 | - $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
| 2319 | + $translation_md5_file = explode(' ', file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
| 2320 | 2320 | $translation_md5 = $translation_md5_file[0]; |
| 2321 | 2321 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
| 2322 | 2322 | if ($globalDebug) echo "Gunzip..."; |
@@ -2333,10 +2333,10 @@ discard block |
||
| 2333 | 2333 | public static function update_ModeS_fam() { |
| 2334 | 2334 | global $tmp_dir, $globalDebug; |
| 2335 | 2335 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
| 2336 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
| 2337 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
|
| 2336 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
| 2337 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5', $tmp_dir.'modes.tsv.gz.md5'); |
|
| 2338 | 2338 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
| 2339 | - $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
| 2339 | + $modes_md5_file = explode(' ', file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
| 2340 | 2340 | $modes_md5 = $modes_md5_file[0]; |
| 2341 | 2341 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
| 2342 | 2342 | if ($globalDebug) echo "Gunzip..."; |
@@ -2354,14 +2354,14 @@ discard block |
||
| 2354 | 2354 | global $tmp_dir, $globalDebug, $globalOwner; |
| 2355 | 2355 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
| 2356 | 2356 | if ($globalOwner === TRUE) { |
| 2357 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
| 2358 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
| 2357 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
| 2358 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
| 2359 | 2359 | } else { |
| 2360 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
| 2361 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
| 2360 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
| 2361 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
| 2362 | 2362 | } |
| 2363 | 2363 | if (file_exists($tmp_dir.'owners.tsv.gz') && file_exists($tmp_dir.'owners.tsv.gz.md5')) { |
| 2364 | - $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
| 2364 | + $owners_md5_file = explode(' ', file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
| 2365 | 2365 | $owners_md5 = $owners_md5_file[0]; |
| 2366 | 2366 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
| 2367 | 2367 | if ($globalDebug) echo "Gunzip..."; |
@@ -2378,10 +2378,10 @@ discard block |
||
| 2378 | 2378 | public static function update_routes_fam() { |
| 2379 | 2379 | global $tmp_dir, $globalDebug; |
| 2380 | 2380 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
| 2381 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
| 2382 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
|
| 2381 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
| 2382 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5', $tmp_dir.'routes.tsv.gz.md5'); |
|
| 2383 | 2383 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
| 2384 | - $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
| 2384 | + $routes_md5_file = explode(' ', file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
| 2385 | 2385 | $routes_md5 = $routes_md5_file[0]; |
| 2386 | 2386 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
| 2387 | 2387 | if ($globalDebug) echo "Gunzip..."; |
@@ -2397,13 +2397,13 @@ discard block |
||
| 2397 | 2397 | } |
| 2398 | 2398 | public static function update_marine_identity_fam() { |
| 2399 | 2399 | global $tmp_dir, $globalDebug; |
| 2400 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
| 2400 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
| 2401 | 2401 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
| 2402 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
| 2402 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
| 2403 | 2403 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
| 2404 | 2404 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
| 2405 | 2405 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
| 2406 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
| 2406 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
| 2407 | 2407 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
| 2408 | 2408 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
| 2409 | 2409 | if ($globalDebug) echo "Gunzip..."; |
@@ -2425,13 +2425,13 @@ discard block |
||
| 2425 | 2425 | |
| 2426 | 2426 | public static function update_satellite_fam() { |
| 2427 | 2427 | global $tmp_dir, $globalDebug; |
| 2428 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5'); |
|
| 2428 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5'); |
|
| 2429 | 2429 | if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) { |
| 2430 | - $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
| 2430 | + $satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
| 2431 | 2431 | $satellite_md5 = $satellite_md5_file[0]; |
| 2432 | 2432 | if (!update_db::check_satellite_version($satellite_md5)) { |
| 2433 | 2433 | if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
| 2434 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
|
| 2434 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz'); |
|
| 2435 | 2435 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
| 2436 | 2436 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
| 2437 | 2437 | if ($globalDebug) echo "Gunzip..."; |
@@ -2453,7 +2453,7 @@ discard block |
||
| 2453 | 2453 | public static function update_banned_fam() { |
| 2454 | 2454 | global $tmp_dir, $globalDebug; |
| 2455 | 2455 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
| 2456 | - update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
| 2456 | + update_db::download('http://data.flightairmap.com/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
| 2457 | 2457 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
| 2458 | 2458 | //if ($globalDebug) echo "Gunzip..."; |
| 2459 | 2459 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2472,18 +2472,18 @@ discard block |
||
| 2472 | 2472 | $error = ''; |
| 2473 | 2473 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
| 2474 | 2474 | if ($globalDBdriver == 'mysql') { |
| 2475 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
| 2475 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
| 2476 | 2476 | } else { |
| 2477 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
| 2477 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
| 2478 | 2478 | } |
| 2479 | 2479 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
| 2480 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
| 2480 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
| 2481 | 2481 | $airspace_md5 = $airspace_md5_file[0]; |
| 2482 | 2482 | if (!update_db::check_airspace_version($airspace_md5)) { |
| 2483 | 2483 | if ($globalDBdriver == 'mysql') { |
| 2484 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
| 2484 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
| 2485 | 2485 | } else { |
| 2486 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
| 2486 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
| 2487 | 2487 | } |
| 2488 | 2488 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
| 2489 | 2489 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
@@ -2496,7 +2496,7 @@ discard block |
||
| 2496 | 2496 | try { |
| 2497 | 2497 | $sth = $Connection->db->prepare($query); |
| 2498 | 2498 | $sth->execute(); |
| 2499 | - } catch(PDOException $e) { |
|
| 2499 | + } catch (PDOException $e) { |
|
| 2500 | 2500 | return "error : ".$e->getMessage(); |
| 2501 | 2501 | } |
| 2502 | 2502 | } |
@@ -2516,16 +2516,16 @@ discard block |
||
| 2516 | 2516 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
| 2517 | 2517 | $error = ''; |
| 2518 | 2518 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
| 2519 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
| 2519 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
| 2520 | 2520 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
| 2521 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
| 2521 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
| 2522 | 2522 | $geoid_md5 = $geoid_md5_file[0]; |
| 2523 | 2523 | if (!update_db::check_geoid_version($geoid_md5)) { |
| 2524 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
| 2524 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
| 2525 | 2525 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
| 2526 | 2526 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
| 2527 | 2527 | if ($globalDebug) echo "Gunzip..."; |
| 2528 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
| 2528 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
| 2529 | 2529 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
| 2530 | 2530 | update_db::insert_geoid_version($geoid_md5); |
| 2531 | 2531 | } |
@@ -2542,15 +2542,15 @@ discard block |
||
| 2542 | 2542 | public static function update_tle() { |
| 2543 | 2543 | global $tmp_dir, $globalDebug; |
| 2544 | 2544 | if ($globalDebug) echo "Download TLE : Download..."; |
| 2545 | - $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', |
|
| 2546 | - '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', |
|
| 2547 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
|
| 2545 | + $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', |
|
| 2546 | + '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', |
|
| 2547 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt', 'visual.txt', 'sarsat.txt', 'argos.txt', 'ses.txt', 'iridium-NEXT.txt', 'beidou.txt'); |
|
| 2548 | 2548 | foreach ($alltle as $filename) { |
| 2549 | 2549 | if ($globalDebug) echo "downloading ".$filename.'...'; |
| 2550 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
| 2550 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
| 2551 | 2551 | if (file_exists($tmp_dir.$filename)) { |
| 2552 | 2552 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
| 2553 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
| 2553 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
| 2554 | 2554 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
| 2555 | 2555 | if ($error != '') { |
| 2556 | 2556 | echo $error."\n"; |
@@ -2562,7 +2562,7 @@ discard block |
||
| 2562 | 2562 | public static function update_ucsdb() { |
| 2563 | 2563 | global $tmp_dir, $globalDebug; |
| 2564 | 2564 | if ($globalDebug) echo "Download UCS DB : Download..."; |
| 2565 | - update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
| 2565 | + update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt', $tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
| 2566 | 2566 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
| 2567 | 2567 | if ($globalDebug) echo "Add to DB..."; |
| 2568 | 2568 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
@@ -2576,7 +2576,7 @@ discard block |
||
| 2576 | 2576 | public static function update_celestrak() { |
| 2577 | 2577 | global $tmp_dir, $globalDebug; |
| 2578 | 2578 | if ($globalDebug) echo "Download Celestrak DB : Download..."; |
| 2579 | - update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
|
| 2579 | + update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt'); |
|
| 2580 | 2580 | if (file_exists($tmp_dir.'satcat.txt')) { |
| 2581 | 2581 | if ($globalDebug) echo "Add to DB..."; |
| 2582 | 2582 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
@@ -2591,32 +2591,32 @@ discard block |
||
| 2591 | 2591 | global $tmp_dir, $globalDebug; |
| 2592 | 2592 | $error = ''; |
| 2593 | 2593 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
| 2594 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
| 2594 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
| 2595 | 2595 | if (file_exists($tmp_dir.'models.md5sum')) { |
| 2596 | 2596 | if ($globalDebug) echo "Check files...\n"; |
| 2597 | 2597 | $newmodelsdb = array(); |
| 2598 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
| 2599 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2598 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
| 2599 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2600 | 2600 | $model = trim($row[2]); |
| 2601 | 2601 | $newmodelsdb[$model] = trim($row[0]); |
| 2602 | 2602 | } |
| 2603 | 2603 | } |
| 2604 | 2604 | $modelsdb = array(); |
| 2605 | 2605 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
| 2606 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
| 2607 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2606 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
| 2607 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2608 | 2608 | $model = trim($row[2]); |
| 2609 | 2609 | $modelsdb[$model] = trim($row[0]); |
| 2610 | 2610 | } |
| 2611 | 2611 | } |
| 2612 | 2612 | } |
| 2613 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2613 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2614 | 2614 | foreach ($diff as $key => $value) { |
| 2615 | 2615 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
| 2616 | - update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
| 2616 | + update_db::download('http://data.flightairmap.com/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
| 2617 | 2617 | |
| 2618 | 2618 | } |
| 2619 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
| 2619 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
| 2620 | 2620 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2621 | 2621 | if ($error != '') { |
| 2622 | 2622 | return $error; |
@@ -2628,32 +2628,32 @@ discard block |
||
| 2628 | 2628 | global $tmp_dir, $globalDebug; |
| 2629 | 2629 | $error = ''; |
| 2630 | 2630 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
| 2631 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
| 2631 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
| 2632 | 2632 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
| 2633 | 2633 | if ($globalDebug) echo "Check files...\n"; |
| 2634 | 2634 | $newmodelsdb = array(); |
| 2635 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
| 2636 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2635 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
| 2636 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2637 | 2637 | $model = trim($row[2]); |
| 2638 | 2638 | $newmodelsdb[$model] = trim($row[0]); |
| 2639 | 2639 | } |
| 2640 | 2640 | } |
| 2641 | 2641 | $modelsdb = array(); |
| 2642 | 2642 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
| 2643 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
| 2644 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2643 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
| 2644 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2645 | 2645 | $model = trim($row[2]); |
| 2646 | 2646 | $modelsdb[$model] = trim($row[0]); |
| 2647 | 2647 | } |
| 2648 | 2648 | } |
| 2649 | 2649 | } |
| 2650 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2650 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2651 | 2651 | foreach ($diff as $key => $value) { |
| 2652 | 2652 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
| 2653 | - update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
| 2653 | + update_db::download('http://data.flightairmap.com/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
| 2654 | 2654 | |
| 2655 | 2655 | } |
| 2656 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
| 2656 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
| 2657 | 2657 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2658 | 2658 | if ($error != '') { |
| 2659 | 2659 | return $error; |
@@ -2665,32 +2665,32 @@ discard block |
||
| 2665 | 2665 | global $tmp_dir, $globalDebug; |
| 2666 | 2666 | $error = ''; |
| 2667 | 2667 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
| 2668 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
| 2668 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
| 2669 | 2669 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
| 2670 | 2670 | if ($globalDebug) echo "Check files...\n"; |
| 2671 | 2671 | $newmodelsdb = array(); |
| 2672 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
| 2673 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2672 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
| 2673 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2674 | 2674 | $model = trim($row[2]); |
| 2675 | 2675 | $newmodelsdb[$model] = trim($row[0]); |
| 2676 | 2676 | } |
| 2677 | 2677 | } |
| 2678 | 2678 | $modelsdb = array(); |
| 2679 | 2679 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
| 2680 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
| 2681 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2680 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
| 2681 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2682 | 2682 | $model = trim($row[2]); |
| 2683 | 2683 | $modelsdb[$model] = trim($row[0]); |
| 2684 | 2684 | } |
| 2685 | 2685 | } |
| 2686 | 2686 | } |
| 2687 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2687 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2688 | 2688 | foreach ($diff as $key => $value) { |
| 2689 | 2689 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
| 2690 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
| 2690 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
| 2691 | 2691 | |
| 2692 | 2692 | } |
| 2693 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
| 2693 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
| 2694 | 2694 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2695 | 2695 | if ($error != '') { |
| 2696 | 2696 | return $error; |
@@ -2713,8 +2713,8 @@ discard block |
||
| 2713 | 2713 | */ |
| 2714 | 2714 | if (file_exists($tmp_dir.'aircrafts.html')) { |
| 2715 | 2715 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
| 2716 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 2717 | - $result = fread($fh,100000000); |
|
| 2716 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
| 2717 | + $result = fread($fh, 100000000); |
|
| 2718 | 2718 | //echo $result; |
| 2719 | 2719 | //var_dump(str_get_html($result)); |
| 2720 | 2720 | //print_r(self::table2array($result)); |
@@ -2732,23 +2732,23 @@ discard block |
||
| 2732 | 2732 | $Connection = new Connection(); |
| 2733 | 2733 | $sth = $Connection->db->prepare($query); |
| 2734 | 2734 | $sth->execute(); |
| 2735 | - } catch(PDOException $e) { |
|
| 2735 | + } catch (PDOException $e) { |
|
| 2736 | 2736 | return "error : ".$e->getMessage(); |
| 2737 | 2737 | } |
| 2738 | 2738 | |
| 2739 | 2739 | $error = ''; |
| 2740 | 2740 | if ($globalDebug) echo "Notam : Download..."; |
| 2741 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
| 2741 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
| 2742 | 2742 | if (file_exists($tmp_dir.'notam.rss')) { |
| 2743 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
| 2743 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
| 2744 | 2744 | foreach ($notams['channel']['item'] as $notam) { |
| 2745 | - $title = explode(':',$notam['title']); |
|
| 2745 | + $title = explode(':', $notam['title']); |
|
| 2746 | 2746 | $data['ref'] = trim($title[0]); |
| 2747 | 2747 | unset($title[0]); |
| 2748 | - $data['title'] = trim(implode(':',$title)); |
|
| 2749 | - $description = strip_tags($notam['description'],'<pre>'); |
|
| 2750 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
| 2751 | - $q = explode('/',$match[1]); |
|
| 2748 | + $data['title'] = trim(implode(':', $title)); |
|
| 2749 | + $description = strip_tags($notam['description'], '<pre>'); |
|
| 2750 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
| 2751 | + $q = explode('/', $match[1]); |
|
| 2752 | 2752 | $data['fir'] = $q[0]; |
| 2753 | 2753 | $data['code'] = $q[1]; |
| 2754 | 2754 | $ifrvfr = $q[2]; |
@@ -2764,30 +2764,30 @@ discard block |
||
| 2764 | 2764 | $data['lower_limit'] = $q[5]; |
| 2765 | 2765 | $data['upper_limit'] = $q[6]; |
| 2766 | 2766 | $latlonrad = $q[7]; |
| 2767 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
| 2768 | - $latitude = $Common->convertDec($las,'latitude'); |
|
| 2769 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
| 2767 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
| 2768 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
| 2769 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
| 2770 | 2770 | if ($lac == 'S') $latitude = '-'.$latitude; |
| 2771 | 2771 | if ($lnc == 'W') $longitude = '-'.$longitude; |
| 2772 | 2772 | $data['center_latitude'] = $latitude; |
| 2773 | 2773 | $data['center_longitude'] = $longitude; |
| 2774 | 2774 | $data['radius'] = intval($radius); |
| 2775 | 2775 | |
| 2776 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
| 2776 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
| 2777 | 2777 | $data['text'] = $match[1]; |
| 2778 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
| 2778 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
| 2779 | 2779 | $fromto = $match[1]; |
| 2780 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
| 2780 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
| 2781 | 2781 | $fromall = trim($match[1]); |
| 2782 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
| 2782 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
| 2783 | 2783 | $from = trim($match[1]); |
| 2784 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
| 2785 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
| 2784 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
| 2785 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
| 2786 | 2786 | $toall = trim($match[1]); |
| 2787 | - if (!preg_match(':Permanent:',$toall)) { |
|
| 2788 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
| 2787 | + if (!preg_match(':Permanent:', $toall)) { |
|
| 2788 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
| 2789 | 2789 | $to = trim($match[1]); |
| 2790 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
| 2790 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
| 2791 | 2791 | $data['permanent'] = 0; |
| 2792 | 2792 | } else { |
| 2793 | 2793 | $data['date_end'] = NULL; |
@@ -2795,7 +2795,7 @@ discard block |
||
| 2795 | 2795 | } |
| 2796 | 2796 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 2797 | 2797 | $NOTAM = new NOTAM(); |
| 2798 | - $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']); |
|
| 2798 | + $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']); |
|
| 2799 | 2799 | unset($data); |
| 2800 | 2800 | } |
| 2801 | 2801 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2818,16 +2818,16 @@ discard block |
||
| 2818 | 2818 | $Connection = new Connection(); |
| 2819 | 2819 | $sth = $Connection->db->prepare($query); |
| 2820 | 2820 | $sth->execute(); |
| 2821 | - } catch(PDOException $e) { |
|
| 2821 | + } catch (PDOException $e) { |
|
| 2822 | 2822 | return "error : ".$e->getMessage(); |
| 2823 | 2823 | } |
| 2824 | 2824 | } |
| 2825 | 2825 | $Common = new Common(); |
| 2826 | 2826 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
| 2827 | - $airspace_json = json_decode($airspace_lst,true); |
|
| 2827 | + $airspace_json = json_decode($airspace_lst, true); |
|
| 2828 | 2828 | foreach ($airspace_json['records'] as $airspace) { |
| 2829 | 2829 | if ($globalDebug) echo $airspace['name']."...\n"; |
| 2830 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
| 2830 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
| 2831 | 2831 | if (file_exists($tmp_dir.$airspace['name'])) { |
| 2832 | 2832 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
| 2833 | 2833 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2849,7 +2849,7 @@ discard block |
||
| 2849 | 2849 | $Connection = new Connection(); |
| 2850 | 2850 | $sth = $Connection->db->prepare($query); |
| 2851 | 2851 | $sth->execute(array(':new' => $new, ':old' => $old)); |
| 2852 | - } catch(PDOException $e) { |
|
| 2852 | + } catch (PDOException $e) { |
|
| 2853 | 2853 | return "error : ".$e->getMessage(); |
| 2854 | 2854 | } |
| 2855 | 2855 | } |
@@ -2866,7 +2866,7 @@ discard block |
||
| 2866 | 2866 | $Connection = new Connection(); |
| 2867 | 2867 | $sth = $Connection->db->prepare($query); |
| 2868 | 2868 | $sth->execute(); |
| 2869 | - } catch(PDOException $e) { |
|
| 2869 | + } catch (PDOException $e) { |
|
| 2870 | 2870 | return "error : ".$e->getMessage(); |
| 2871 | 2871 | } |
| 2872 | 2872 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2881,7 +2881,7 @@ discard block |
||
| 2881 | 2881 | $Connection = new Connection(); |
| 2882 | 2882 | $sth = $Connection->db->prepare($query); |
| 2883 | 2883 | $sth->execute(); |
| 2884 | - } catch(PDOException $e) { |
|
| 2884 | + } catch (PDOException $e) { |
|
| 2885 | 2885 | return "error : ".$e->getMessage(); |
| 2886 | 2886 | } |
| 2887 | 2887 | } |
@@ -2892,7 +2892,7 @@ discard block |
||
| 2892 | 2892 | $Connection = new Connection(); |
| 2893 | 2893 | $sth = $Connection->db->prepare($query); |
| 2894 | 2894 | $sth->execute(array(':version' => $version)); |
| 2895 | - } catch(PDOException $e) { |
|
| 2895 | + } catch (PDOException $e) { |
|
| 2896 | 2896 | return "error : ".$e->getMessage(); |
| 2897 | 2897 | } |
| 2898 | 2898 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2906,7 +2906,7 @@ discard block |
||
| 2906 | 2906 | $Connection = new Connection(); |
| 2907 | 2907 | $sth = $Connection->db->prepare($query); |
| 2908 | 2908 | $sth->execute(array(':version' => $version)); |
| 2909 | - } catch(PDOException $e) { |
|
| 2909 | + } catch (PDOException $e) { |
|
| 2910 | 2910 | return "error : ".$e->getMessage(); |
| 2911 | 2911 | } |
| 2912 | 2912 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2920,7 +2920,7 @@ discard block |
||
| 2920 | 2920 | $Connection = new Connection(); |
| 2921 | 2921 | $sth = $Connection->db->prepare($query); |
| 2922 | 2922 | $sth->execute(array(':version' => $version)); |
| 2923 | - } catch(PDOException $e) { |
|
| 2923 | + } catch (PDOException $e) { |
|
| 2924 | 2924 | return "error : ".$e->getMessage(); |
| 2925 | 2925 | } |
| 2926 | 2926 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2934,7 +2934,7 @@ discard block |
||
| 2934 | 2934 | $Connection = new Connection(); |
| 2935 | 2935 | $sth = $Connection->db->prepare($query); |
| 2936 | 2936 | $sth->execute(array(':version' => $version)); |
| 2937 | - } catch(PDOException $e) { |
|
| 2937 | + } catch (PDOException $e) { |
|
| 2938 | 2938 | return "error : ".$e->getMessage(); |
| 2939 | 2939 | } |
| 2940 | 2940 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2950,7 +2950,7 @@ discard block |
||
| 2950 | 2950 | $Connection = new Connection(); |
| 2951 | 2951 | $sth = $Connection->db->prepare($query); |
| 2952 | 2952 | $sth->execute(array(':version' => $version)); |
| 2953 | - } catch(PDOException $e) { |
|
| 2953 | + } catch (PDOException $e) { |
|
| 2954 | 2954 | return "error : ".$e->getMessage(); |
| 2955 | 2955 | } |
| 2956 | 2956 | } |
@@ -2962,7 +2962,7 @@ discard block |
||
| 2962 | 2962 | $Connection = new Connection(); |
| 2963 | 2963 | $sth = $Connection->db->prepare($query); |
| 2964 | 2964 | $sth->execute(array(':version' => $version)); |
| 2965 | - } catch(PDOException $e) { |
|
| 2965 | + } catch (PDOException $e) { |
|
| 2966 | 2966 | return "error : ".$e->getMessage(); |
| 2967 | 2967 | } |
| 2968 | 2968 | } |
@@ -2974,7 +2974,7 @@ discard block |
||
| 2974 | 2974 | $Connection = new Connection(); |
| 2975 | 2975 | $sth = $Connection->db->prepare($query); |
| 2976 | 2976 | $sth->execute(array(':version' => $version)); |
| 2977 | - } catch(PDOException $e) { |
|
| 2977 | + } catch (PDOException $e) { |
|
| 2978 | 2978 | return "error : ".$e->getMessage(); |
| 2979 | 2979 | } |
| 2980 | 2980 | } |
@@ -2986,7 +2986,7 @@ discard block |
||
| 2986 | 2986 | $Connection = new Connection(); |
| 2987 | 2987 | $sth = $Connection->db->prepare($query); |
| 2988 | 2988 | $sth->execute(array(':version' => $version)); |
| 2989 | - } catch(PDOException $e) { |
|
| 2989 | + } catch (PDOException $e) { |
|
| 2990 | 2990 | return "error : ".$e->getMessage(); |
| 2991 | 2991 | } |
| 2992 | 2992 | } |
@@ -3002,7 +3002,7 @@ discard block |
||
| 3002 | 3002 | $Connection = new Connection(); |
| 3003 | 3003 | $sth = $Connection->db->prepare($query); |
| 3004 | 3004 | $sth->execute(); |
| 3005 | - } catch(PDOException $e) { |
|
| 3005 | + } catch (PDOException $e) { |
|
| 3006 | 3006 | return "error : ".$e->getMessage(); |
| 3007 | 3007 | } |
| 3008 | 3008 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3017,7 +3017,7 @@ discard block |
||
| 3017 | 3017 | $Connection = new Connection(); |
| 3018 | 3018 | $sth = $Connection->db->prepare($query); |
| 3019 | 3019 | $sth->execute(); |
| 3020 | - } catch(PDOException $e) { |
|
| 3020 | + } catch (PDOException $e) { |
|
| 3021 | 3021 | return "error : ".$e->getMessage(); |
| 3022 | 3022 | } |
| 3023 | 3023 | } |
@@ -3033,7 +3033,7 @@ discard block |
||
| 3033 | 3033 | $Connection = new Connection(); |
| 3034 | 3034 | $sth = $Connection->db->prepare($query); |
| 3035 | 3035 | $sth->execute(); |
| 3036 | - } catch(PDOException $e) { |
|
| 3036 | + } catch (PDOException $e) { |
|
| 3037 | 3037 | return "error : ".$e->getMessage(); |
| 3038 | 3038 | } |
| 3039 | 3039 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3048,7 +3048,7 @@ discard block |
||
| 3048 | 3048 | $Connection = new Connection(); |
| 3049 | 3049 | $sth = $Connection->db->prepare($query); |
| 3050 | 3050 | $sth->execute(); |
| 3051 | - } catch(PDOException $e) { |
|
| 3051 | + } catch (PDOException $e) { |
|
| 3052 | 3052 | return "error : ".$e->getMessage(); |
| 3053 | 3053 | } |
| 3054 | 3054 | } |
@@ -3064,7 +3064,7 @@ discard block |
||
| 3064 | 3064 | $Connection = new Connection(); |
| 3065 | 3065 | $sth = $Connection->db->prepare($query); |
| 3066 | 3066 | $sth->execute(); |
| 3067 | - } catch(PDOException $e) { |
|
| 3067 | + } catch (PDOException $e) { |
|
| 3068 | 3068 | return "error : ".$e->getMessage(); |
| 3069 | 3069 | } |
| 3070 | 3070 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3079,7 +3079,7 @@ discard block |
||
| 3079 | 3079 | $Connection = new Connection(); |
| 3080 | 3080 | $sth = $Connection->db->prepare($query); |
| 3081 | 3081 | $sth->execute(); |
| 3082 | - } catch(PDOException $e) { |
|
| 3082 | + } catch (PDOException $e) { |
|
| 3083 | 3083 | return "error : ".$e->getMessage(); |
| 3084 | 3084 | } |
| 3085 | 3085 | } |
@@ -3095,7 +3095,7 @@ discard block |
||
| 3095 | 3095 | $Connection = new Connection(); |
| 3096 | 3096 | $sth = $Connection->db->prepare($query); |
| 3097 | 3097 | $sth->execute(); |
| 3098 | - } catch(PDOException $e) { |
|
| 3098 | + } catch (PDOException $e) { |
|
| 3099 | 3099 | return "error : ".$e->getMessage(); |
| 3100 | 3100 | } |
| 3101 | 3101 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3110,7 +3110,7 @@ discard block |
||
| 3110 | 3110 | $Connection = new Connection(); |
| 3111 | 3111 | $sth = $Connection->db->prepare($query); |
| 3112 | 3112 | $sth->execute(); |
| 3113 | - } catch(PDOException $e) { |
|
| 3113 | + } catch (PDOException $e) { |
|
| 3114 | 3114 | return "error : ".$e->getMessage(); |
| 3115 | 3115 | } |
| 3116 | 3116 | } |
@@ -3125,7 +3125,7 @@ discard block |
||
| 3125 | 3125 | $Connection = new Connection(); |
| 3126 | 3126 | $sth = $Connection->db->prepare($query); |
| 3127 | 3127 | $sth->execute(); |
| 3128 | - } catch(PDOException $e) { |
|
| 3128 | + } catch (PDOException $e) { |
|
| 3129 | 3129 | return "error : ".$e->getMessage(); |
| 3130 | 3130 | } |
| 3131 | 3131 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3140,7 +3140,7 @@ discard block |
||
| 3140 | 3140 | $Connection = new Connection(); |
| 3141 | 3141 | $sth = $Connection->db->prepare($query); |
| 3142 | 3142 | $sth->execute(); |
| 3143 | - } catch(PDOException $e) { |
|
| 3143 | + } catch (PDOException $e) { |
|
| 3144 | 3144 | return "error : ".$e->getMessage(); |
| 3145 | 3145 | } |
| 3146 | 3146 | } |
@@ -3156,7 +3156,7 @@ discard block |
||
| 3156 | 3156 | $Connection = new Connection(); |
| 3157 | 3157 | $sth = $Connection->db->prepare($query); |
| 3158 | 3158 | $sth->execute(); |
| 3159 | - } catch(PDOException $e) { |
|
| 3159 | + } catch (PDOException $e) { |
|
| 3160 | 3160 | return "error : ".$e->getMessage(); |
| 3161 | 3161 | } |
| 3162 | 3162 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3171,7 +3171,7 @@ discard block |
||
| 3171 | 3171 | $Connection = new Connection(); |
| 3172 | 3172 | $sth = $Connection->db->prepare($query); |
| 3173 | 3173 | $sth->execute(); |
| 3174 | - } catch(PDOException $e) { |
|
| 3174 | + } catch (PDOException $e) { |
|
| 3175 | 3175 | return "error : ".$e->getMessage(); |
| 3176 | 3176 | } |
| 3177 | 3177 | } |
@@ -3187,7 +3187,7 @@ discard block |
||
| 3187 | 3187 | $Connection = new Connection(); |
| 3188 | 3188 | $sth = $Connection->db->prepare($query); |
| 3189 | 3189 | $sth->execute(); |
| 3190 | - } catch(PDOException $e) { |
|
| 3190 | + } catch (PDOException $e) { |
|
| 3191 | 3191 | return "error : ".$e->getMessage(); |
| 3192 | 3192 | } |
| 3193 | 3193 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3202,7 +3202,7 @@ discard block |
||
| 3202 | 3202 | $Connection = new Connection(); |
| 3203 | 3203 | $sth = $Connection->db->prepare($query); |
| 3204 | 3204 | $sth->execute(); |
| 3205 | - } catch(PDOException $e) { |
|
| 3205 | + } catch (PDOException $e) { |
|
| 3206 | 3206 | return "error : ".$e->getMessage(); |
| 3207 | 3207 | } |
| 3208 | 3208 | } |
@@ -3218,7 +3218,7 @@ discard block |
||
| 3218 | 3218 | $Connection = new Connection(); |
| 3219 | 3219 | $sth = $Connection->db->prepare($query); |
| 3220 | 3220 | $sth->execute(); |
| 3221 | - } catch(PDOException $e) { |
|
| 3221 | + } catch (PDOException $e) { |
|
| 3222 | 3222 | return "error : ".$e->getMessage(); |
| 3223 | 3223 | } |
| 3224 | 3224 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3233,7 +3233,7 @@ discard block |
||
| 3233 | 3233 | $Connection = new Connection(); |
| 3234 | 3234 | $sth = $Connection->db->prepare($query); |
| 3235 | 3235 | $sth->execute(); |
| 3236 | - } catch(PDOException $e) { |
|
| 3236 | + } catch (PDOException $e) { |
|
| 3237 | 3237 | return "error : ".$e->getMessage(); |
| 3238 | 3238 | } |
| 3239 | 3239 | } |
@@ -3249,7 +3249,7 @@ discard block |
||
| 3249 | 3249 | $Connection = new Connection(); |
| 3250 | 3250 | $sth = $Connection->db->prepare($query); |
| 3251 | 3251 | $sth->execute(); |
| 3252 | - } catch(PDOException $e) { |
|
| 3252 | + } catch (PDOException $e) { |
|
| 3253 | 3253 | return "error : ".$e->getMessage(); |
| 3254 | 3254 | } |
| 3255 | 3255 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3268,7 +3268,7 @@ discard block |
||
| 3268 | 3268 | $Connection = new Connection(); |
| 3269 | 3269 | $sth = $Connection->db->prepare($query); |
| 3270 | 3270 | $sth->execute(); |
| 3271 | - } catch(PDOException $e) { |
|
| 3271 | + } catch (PDOException $e) { |
|
| 3272 | 3272 | return "error : ".$e->getMessage(); |
| 3273 | 3273 | } |
| 3274 | 3274 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3283,7 +3283,7 @@ discard block |
||
| 3283 | 3283 | $Connection = new Connection(); |
| 3284 | 3284 | $sth = $Connection->db->prepare($query); |
| 3285 | 3285 | $sth->execute(); |
| 3286 | - } catch(PDOException $e) { |
|
| 3286 | + } catch (PDOException $e) { |
|
| 3287 | 3287 | return "error : ".$e->getMessage(); |
| 3288 | 3288 | } |
| 3289 | 3289 | } |
@@ -3295,7 +3295,7 @@ discard block |
||
| 3295 | 3295 | $Connection = new Connection(); |
| 3296 | 3296 | $sth = $Connection->db->prepare($query); |
| 3297 | 3297 | $sth->execute(); |
| 3298 | - } catch(PDOException $e) { |
|
| 3298 | + } catch (PDOException $e) { |
|
| 3299 | 3299 | return "error : ".$e->getMessage(); |
| 3300 | 3300 | } |
| 3301 | 3301 | } |
@@ -3311,7 +3311,7 @@ discard block |
||
| 3311 | 3311 | $Connection = new Connection(); |
| 3312 | 3312 | $sth = $Connection->db->prepare($query); |
| 3313 | 3313 | $sth->execute(); |
| 3314 | - } catch(PDOException $e) { |
|
| 3314 | + } catch (PDOException $e) { |
|
| 3315 | 3315 | return "error : ".$e->getMessage(); |
| 3316 | 3316 | } |
| 3317 | 3317 | } |
@@ -3326,7 +3326,7 @@ discard block |
||
| 3326 | 3326 | $Connection = new Connection(); |
| 3327 | 3327 | $sth = $Connection->db->prepare($query); |
| 3328 | 3328 | $sth->execute(); |
| 3329 | - } catch(PDOException $e) { |
|
| 3329 | + } catch (PDOException $e) { |
|
| 3330 | 3330 | return "error : ".$e->getMessage(); |
| 3331 | 3331 | } |
| 3332 | 3332 | } |
@@ -17,62 +17,62 @@ discard block |
||
| 17 | 17 | * @param Array $filter the filter |
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
| 23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
| 26 | 26 | } else { |
| 27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | if (isset($filter[0]['source'])) { |
| 31 | - $filters = array_merge($filters,$filter); |
|
| 31 | + $filters = array_merge($filters, $filter); |
|
| 32 | 32 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 34 | 34 | $filter_query_join = ''; |
| 35 | 35 | $filter_query_where = ''; |
| 36 | - foreach($filters as $flt) { |
|
| 36 | + foreach ($filters as $flt) { |
|
| 37 | 37 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 38 | 38 | if ($flt['airlines'][0] != '') { |
| 39 | 39 | if (isset($flt['source'])) { |
| 40 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 40 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 41 | 41 | } else { |
| 42 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 42 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 47 | 47 | if (isset($flt['source'])) { |
| 48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 49 | 49 | } else { |
| 50 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 50 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 54 | 54 | if (isset($flt['source'])) { |
| 55 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 55 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 56 | 56 | } else { |
| 57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
| 61 | 61 | if (isset($flt['source'])) { |
| 62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 63 | 63 | } else { |
| 64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
| 68 | 68 | if (isset($flt['source'])) { |
| 69 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
| 69 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 74 | 74 | if ($filter['airlines'][0] != '') { |
| 75 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
| 75 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
| 83 | 83 | } |
| 84 | 84 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 85 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
| 85 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
| 86 | 86 | } |
| 87 | 87 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 88 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 88 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 89 | 89 | } |
| 90 | 90 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 91 | 91 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -114,15 +114,15 @@ discard block |
||
| 114 | 114 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
| 117 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
| 118 | 118 | } |
| 119 | 119 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 120 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 120 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 121 | 121 | } |
| 122 | 122 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 123 | 123 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 124 | 124 | if ($filter_query_where != '') { |
| 125 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 125 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 126 | 126 | } |
| 127 | 127 | $filter_query = $filter_query_join.$filter_query_where; |
| 128 | 128 | return $filter_query; |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | if ($limit != '') |
| 146 | 146 | { |
| 147 | 147 | $limit_array = explode(',', $limit); |
| 148 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 149 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 148 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 149 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 150 | 150 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 151 | 151 | { |
| 152 | 152 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } else { |
| 171 | 171 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
| 172 | 172 | } |
| 173 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 173 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 174 | 174 | |
| 175 | 175 | return $spotter_array; |
| 176 | 176 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | { |
| 186 | 186 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 187 | 187 | date_default_timezone_set('UTC'); |
| 188 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 188 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 189 | 189 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 190 | 190 | if ($globalDBdriver == 'mysql') { |
| 191 | 191 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | try { |
| 209 | 209 | $sth = $this->db->prepare($query); |
| 210 | 210 | $sth->execute(); |
| 211 | - } catch(PDOException $e) { |
|
| 211 | + } catch (PDOException $e) { |
|
| 212 | 212 | echo $e->getMessage(); |
| 213 | 213 | die; |
| 214 | 214 | } |
@@ -222,17 +222,17 @@ discard block |
||
| 222 | 222 | * @return Array the spotter information |
| 223 | 223 | * |
| 224 | 224 | */ |
| 225 | - public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false) |
|
| 225 | + public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false) |
|
| 226 | 226 | { |
| 227 | 227 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
| 228 | 228 | date_default_timezone_set('UTC'); |
| 229 | 229 | if (is_array($coord) && !empty($coord)) { |
| 230 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 231 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 232 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 233 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 230 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 231 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 232 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 233 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 234 | 234 | } |
| 235 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 235 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 236 | 236 | |
| 237 | 237 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
| 238 | 238 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAicraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | try { |
| 294 | 294 | $sth = $this->db->prepare($query); |
| 295 | 295 | $sth->execute(); |
| 296 | - } catch(PDOException $e) { |
|
| 296 | + } catch (PDOException $e) { |
|
| 297 | 297 | echo $e->getMessage(); |
| 298 | 298 | die; |
| 299 | 299 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | public function getLiveSpotterCount($filter = array()) |
| 311 | 311 | { |
| 312 | 312 | global $globalDBdriver, $globalLiveInterval; |
| 313 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 313 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 314 | 314 | |
| 315 | 315 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 316 | 316 | if ($globalDBdriver == 'mysql') { |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | try { |
| 324 | 324 | $sth = $this->db->prepare($query); |
| 325 | 325 | $sth->execute(); |
| 326 | - } catch(PDOException $e) { |
|
| 326 | + } catch (PDOException $e) { |
|
| 327 | 327 | echo $e->getMessage(); |
| 328 | 328 | die; |
| 329 | 329 | } |
@@ -346,10 +346,10 @@ discard block |
||
| 346 | 346 | $filter_query = $this->getFilter($filter); |
| 347 | 347 | |
| 348 | 348 | if (is_array($coord)) { |
| 349 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 350 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 351 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 352 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 349 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 350 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 351 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 352 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 353 | 353 | } else return array(); |
| 354 | 354 | if ($globalDBdriver == 'mysql') { |
| 355 | 355 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -372,23 +372,23 @@ discard block |
||
| 372 | 372 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 373 | 373 | $Spotter = new Spotter($this->db); |
| 374 | 374 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 375 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 375 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 376 | 376 | |
| 377 | 377 | if (is_array($coord)) { |
| 378 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 379 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 380 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 381 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 378 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 379 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 380 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 381 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 382 | 382 | } else return array(); |
| 383 | 383 | if ($globalDBdriver == 'mysql') { |
| 384 | 384 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 385 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 385 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 386 | 386 | FROM spotter_live |
| 387 | 387 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
| 388 | 388 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
| 389 | 389 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0'; |
| 390 | 390 | } else { |
| 391 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 391 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 392 | 392 | FROM spotter_live |
| 393 | 393 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 394 | 394 | FROM spotter_live l |
@@ -400,14 +400,14 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | } else { |
| 402 | 402 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 403 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 403 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 404 | 404 | FROM spotter_live |
| 405 | 405 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
| 406 | 406 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
| 407 | 407 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 408 | 408 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
| 409 | 409 | } else { |
| 410 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 410 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 411 | 411 | FROM spotter_live |
| 412 | 412 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 413 | 413 | FROM spotter_live l |
@@ -422,7 +422,7 @@ discard block |
||
| 422 | 422 | try { |
| 423 | 423 | $sth = $this->db->prepare($query); |
| 424 | 424 | $sth->execute(); |
| 425 | - } catch(PDOException $e) { |
|
| 425 | + } catch (PDOException $e) { |
|
| 426 | 426 | echo $e->getMessage(); |
| 427 | 427 | die; |
| 428 | 428 | } |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | if ($interval == '1m') |
| 472 | 472 | { |
| 473 | 473 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 474 | - } else if ($interval == '15m'){ |
|
| 474 | + } else if ($interval == '15m') { |
|
| 475 | 475 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
| 476 | 476 | } |
| 477 | 477 | } |
@@ -479,14 +479,14 @@ discard block |
||
| 479 | 479 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 480 | 480 | } |
| 481 | 481 | |
| 482 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 482 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 483 | 483 | WHERE spotter_live.latitude <> '' |
| 484 | 484 | AND spotter_live.longitude <> '' |
| 485 | 485 | ".$additional_query." |
| 486 | 486 | HAVING distance < :radius |
| 487 | 487 | ORDER BY distance"; |
| 488 | 488 | |
| 489 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 489 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 490 | 490 | |
| 491 | 491 | return $spotter_array; |
| 492 | 492 | } |
@@ -504,9 +504,9 @@ discard block |
||
| 504 | 504 | date_default_timezone_set('UTC'); |
| 505 | 505 | |
| 506 | 506 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 507 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 507 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 508 | 508 | |
| 509 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 509 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 510 | 510 | |
| 511 | 511 | return $spotter_array; |
| 512 | 512 | } |
@@ -517,16 +517,16 @@ discard block |
||
| 517 | 517 | * @return Array the spotter information |
| 518 | 518 | * |
| 519 | 519 | */ |
| 520 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
| 520 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
| 521 | 521 | { |
| 522 | 522 | $Spotter = new Spotter($this->db); |
| 523 | 523 | date_default_timezone_set('UTC'); |
| 524 | 524 | |
| 525 | 525 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 526 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 526 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 527 | 527 | |
| 528 | - $date = date('c',$date); |
|
| 529 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 528 | + $date = date('c', $date); |
|
| 529 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 530 | 530 | |
| 531 | 531 | return $spotter_array; |
| 532 | 532 | } |
@@ -542,8 +542,8 @@ discard block |
||
| 542 | 542 | $Spotter = new Spotter($this->db); |
| 543 | 543 | date_default_timezone_set('UTC'); |
| 544 | 544 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 545 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 546 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 545 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 546 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 547 | 547 | return $spotter_array; |
| 548 | 548 | } |
| 549 | 549 | |
@@ -553,15 +553,15 @@ discard block |
||
| 553 | 553 | * @return Array the spotter information |
| 554 | 554 | * |
| 555 | 555 | */ |
| 556 | - public function getDateLiveSpotterDataById($id,$date) |
|
| 556 | + public function getDateLiveSpotterDataById($id, $date) |
|
| 557 | 557 | { |
| 558 | 558 | $Spotter = new Spotter($this->db); |
| 559 | 559 | date_default_timezone_set('UTC'); |
| 560 | 560 | |
| 561 | 561 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 562 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 563 | - $date = date('c',$date); |
|
| 564 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 562 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 563 | + $date = date('c', $date); |
|
| 564 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 565 | 565 | return $spotter_array; |
| 566 | 566 | } |
| 567 | 567 | |
@@ -577,13 +577,13 @@ discard block |
||
| 577 | 577 | date_default_timezone_set('UTC'); |
| 578 | 578 | |
| 579 | 579 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 580 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 580 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 581 | 581 | |
| 582 | 582 | try { |
| 583 | 583 | |
| 584 | 584 | $sth = $this->db->prepare($query); |
| 585 | 585 | $sth->execute(array(':ident' => $ident)); |
| 586 | - } catch(PDOException $e) { |
|
| 586 | + } catch (PDOException $e) { |
|
| 587 | 587 | echo $e->getMessage(); |
| 588 | 588 | die; |
| 589 | 589 | } |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | * @return Array the spotter information |
| 599 | 599 | * |
| 600 | 600 | */ |
| 601 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
| 601 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
| 602 | 602 | { |
| 603 | 603 | global $globalDBdriver, $globalLiveInterval; |
| 604 | 604 | date_default_timezone_set('UTC'); |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | try { |
| 618 | 618 | $sth = $this->db->prepare($query); |
| 619 | 619 | $sth->execute(array(':id' => $id)); |
| 620 | - } catch(PDOException $e) { |
|
| 620 | + } catch (PDOException $e) { |
|
| 621 | 621 | echo $e->getMessage(); |
| 622 | 622 | die; |
| 623 | 623 | } |
@@ -635,12 +635,12 @@ discard block |
||
| 635 | 635 | { |
| 636 | 636 | date_default_timezone_set('UTC'); |
| 637 | 637 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 638 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 638 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 639 | 639 | try { |
| 640 | 640 | |
| 641 | 641 | $sth = $this->db->prepare($query); |
| 642 | 642 | $sth->execute(array(':ident' => $ident)); |
| 643 | - } catch(PDOException $e) { |
|
| 643 | + } catch (PDOException $e) { |
|
| 644 | 644 | echo $e->getMessage(); |
| 645 | 645 | die; |
| 646 | 646 | } |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | |
| 671 | 671 | $sth = $this->db->prepare($query); |
| 672 | 672 | $sth->execute(); |
| 673 | - } catch(PDOException $e) { |
|
| 673 | + } catch (PDOException $e) { |
|
| 674 | 674 | return "error"; |
| 675 | 675 | } |
| 676 | 676 | |
@@ -693,14 +693,14 @@ discard block |
||
| 693 | 693 | |
| 694 | 694 | $sth = $this->db->prepare($query); |
| 695 | 695 | $sth->execute(); |
| 696 | - } catch(PDOException $e) { |
|
| 696 | + } catch (PDOException $e) { |
|
| 697 | 697 | return "error"; |
| 698 | 698 | } |
| 699 | 699 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 700 | 700 | $i = 0; |
| 701 | - $j =0; |
|
| 701 | + $j = 0; |
|
| 702 | 702 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 703 | - foreach($all as $row) |
|
| 703 | + foreach ($all as $row) |
|
| 704 | 704 | { |
| 705 | 705 | $i++; |
| 706 | 706 | $j++; |
@@ -708,9 +708,9 @@ discard block |
||
| 708 | 708 | if ($globalDebug) echo "."; |
| 709 | 709 | try { |
| 710 | 710 | |
| 711 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 711 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 712 | 712 | $sth->execute(); |
| 713 | - } catch(PDOException $e) { |
|
| 713 | + } catch (PDOException $e) { |
|
| 714 | 714 | return "error"; |
| 715 | 715 | } |
| 716 | 716 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -721,9 +721,9 @@ discard block |
||
| 721 | 721 | if ($i > 0) { |
| 722 | 722 | try { |
| 723 | 723 | |
| 724 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 724 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 725 | 725 | $sth->execute(); |
| 726 | - } catch(PDOException $e) { |
|
| 726 | + } catch (PDOException $e) { |
|
| 727 | 727 | return "error"; |
| 728 | 728 | } |
| 729 | 729 | } |
@@ -736,7 +736,7 @@ discard block |
||
| 736 | 736 | |
| 737 | 737 | $sth = $this->db->prepare($query); |
| 738 | 738 | $sth->execute(); |
| 739 | - } catch(PDOException $e) { |
|
| 739 | + } catch (PDOException $e) { |
|
| 740 | 740 | return "error"; |
| 741 | 741 | } |
| 742 | 742 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -784,13 +784,13 @@ discard block |
||
| 784 | 784 | public function deleteLiveSpotterDataByIdent($ident) |
| 785 | 785 | { |
| 786 | 786 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 787 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 787 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 788 | 788 | |
| 789 | 789 | try { |
| 790 | 790 | |
| 791 | 791 | $sth = $this->db->prepare($query); |
| 792 | 792 | $sth->execute(array(':ident' => $ident)); |
| 793 | - } catch(PDOException $e) { |
|
| 793 | + } catch (PDOException $e) { |
|
| 794 | 794 | return "error"; |
| 795 | 795 | } |
| 796 | 796 | |
@@ -806,13 +806,13 @@ discard block |
||
| 806 | 806 | public function deleteLiveSpotterDataById($id) |
| 807 | 807 | { |
| 808 | 808 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 809 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 809 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 810 | 810 | |
| 811 | 811 | try { |
| 812 | 812 | |
| 813 | 813 | $sth = $this->db->prepare($query); |
| 814 | 814 | $sth->execute(array(':id' => $id)); |
| 815 | - } catch(PDOException $e) { |
|
| 815 | + } catch (PDOException $e) { |
|
| 816 | 816 | return "error"; |
| 817 | 817 | } |
| 818 | 818 | |
@@ -830,13 +830,13 @@ discard block |
||
| 830 | 830 | { |
| 831 | 831 | global $globalDBdriver, $globalTimezone; |
| 832 | 832 | if ($globalDBdriver == 'mysql') { |
| 833 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 833 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 834 | 834 | WHERE spotter_live.ident = :ident |
| 835 | 835 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 836 | 836 | AND spotter_live.date < UTC_TIMESTAMP()'; |
| 837 | 837 | $query_data = array(':ident' => $ident); |
| 838 | 838 | } else { |
| 839 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 839 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 840 | 840 | WHERE spotter_live.ident = :ident |
| 841 | 841 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 842 | 842 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -845,8 +845,8 @@ discard block |
||
| 845 | 845 | |
| 846 | 846 | $sth = $this->db->prepare($query); |
| 847 | 847 | $sth->execute($query_data); |
| 848 | - $ident_result=''; |
|
| 849 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 848 | + $ident_result = ''; |
|
| 849 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 850 | 850 | { |
| 851 | 851 | $ident_result = $row['ident']; |
| 852 | 852 | } |
@@ -863,13 +863,13 @@ discard block |
||
| 863 | 863 | { |
| 864 | 864 | global $globalDBdriver, $globalTimezone; |
| 865 | 865 | if ($globalDBdriver == 'mysql') { |
| 866 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 866 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 867 | 867 | WHERE spotter_live.ident = :ident |
| 868 | 868 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 869 | 869 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 870 | 870 | $query_data = array(':ident' => $ident); |
| 871 | 871 | } else { |
| 872 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 872 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 873 | 873 | WHERE spotter_live.ident = :ident |
| 874 | 874 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 875 | 875 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -878,8 +878,8 @@ discard block |
||
| 878 | 878 | |
| 879 | 879 | $sth = $this->db->prepare($query); |
| 880 | 880 | $sth->execute($query_data); |
| 881 | - $ident_result=''; |
|
| 882 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 881 | + $ident_result = ''; |
|
| 882 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 883 | 883 | { |
| 884 | 884 | $ident_result = $row['flightaware_id']; |
| 885 | 885 | } |
@@ -896,13 +896,13 @@ discard block |
||
| 896 | 896 | { |
| 897 | 897 | global $globalDBdriver, $globalTimezone; |
| 898 | 898 | if ($globalDBdriver == 'mysql') { |
| 899 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 899 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 900 | 900 | WHERE spotter_live.flightaware_id = :id |
| 901 | 901 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 902 | 902 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 903 | 903 | $query_data = array(':id' => $id); |
| 904 | 904 | } else { |
| 905 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 905 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 906 | 906 | WHERE spotter_live.flightaware_id = :id |
| 907 | 907 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 908 | 908 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -911,8 +911,8 @@ discard block |
||
| 911 | 911 | |
| 912 | 912 | $sth = $this->db->prepare($query); |
| 913 | 913 | $sth->execute($query_data); |
| 914 | - $ident_result=''; |
|
| 915 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 914 | + $ident_result = ''; |
|
| 915 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 916 | 916 | { |
| 917 | 917 | $ident_result = $row['flightaware_id']; |
| 918 | 918 | } |
@@ -929,13 +929,13 @@ discard block |
||
| 929 | 929 | { |
| 930 | 930 | global $globalDBdriver, $globalTimezone; |
| 931 | 931 | if ($globalDBdriver == 'mysql') { |
| 932 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 932 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 933 | 933 | WHERE spotter_live.ModeS = :modes |
| 934 | 934 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 935 | 935 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 936 | 936 | $query_data = array(':modes' => $modes); |
| 937 | 937 | } else { |
| 938 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 938 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 939 | 939 | WHERE spotter_live.ModeS = :modes |
| 940 | 940 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
| 941 | 941 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -944,8 +944,8 @@ discard block |
||
| 944 | 944 | |
| 945 | 945 | $sth = $this->db->prepare($query); |
| 946 | 946 | $sth->execute($query_data); |
| 947 | - $ident_result=''; |
|
| 948 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 947 | + $ident_result = ''; |
|
| 948 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 949 | 949 | { |
| 950 | 950 | //$ident_result = $row['spotter_live_id']; |
| 951 | 951 | $ident_result = $row['flightaware_id']; |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | * @return String success or false |
| 965 | 965 | * |
| 966 | 966 | */ |
| 967 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 967 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 968 | 968 | { |
| 969 | 969 | global $globalURL, $globalArchive, $globalDebug; |
| 970 | 970 | $Common = new Common(); |
@@ -1064,27 +1064,27 @@ discard block |
||
| 1064 | 1064 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 1065 | 1065 | |
| 1066 | 1066 | |
| 1067 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 1068 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1069 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 1070 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1071 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1072 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1073 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1074 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 1075 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1076 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1077 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 1078 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1079 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 1080 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 1081 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 1082 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 1083 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 1084 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 1085 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 1086 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 1087 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 1067 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 1068 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1069 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 1070 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1071 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1072 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1073 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1074 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 1075 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1076 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1077 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 1078 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1079 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 1080 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 1081 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 1082 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 1083 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 1084 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 1085 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 1086 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 1087 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 1088 | 1088 | |
| 1089 | 1089 | $airline_name = ''; |
| 1090 | 1090 | $airline_icao = ''; |
@@ -1106,10 +1106,10 @@ discard block |
||
| 1106 | 1106 | $arrival_airport_country = ''; |
| 1107 | 1107 | |
| 1108 | 1108 | |
| 1109 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 1110 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 1111 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1112 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1109 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 1110 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 1111 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 1112 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 1113 | 1113 | |
| 1114 | 1114 | $query = ''; |
| 1115 | 1115 | if ($globalArchive) { |
@@ -1120,19 +1120,19 @@ discard block |
||
| 1120 | 1120 | $query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) |
| 1121 | 1121 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)'; |
| 1122 | 1122 | |
| 1123 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real); |
|
| 1123 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real); |
|
| 1124 | 1124 | try { |
| 1125 | 1125 | |
| 1126 | 1126 | $sth = $this->db->prepare($query); |
| 1127 | 1127 | $sth->execute($query_values); |
| 1128 | 1128 | $sth->closeCursor(); |
| 1129 | - } catch(PDOException $e) { |
|
| 1129 | + } catch (PDOException $e) { |
|
| 1130 | 1130 | return "error : ".$e->getMessage(); |
| 1131 | 1131 | } |
| 1132 | 1132 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1133 | 1133 | if ($globalDebug) echo '(Add to SBS archive : '; |
| 1134 | 1134 | $SpotterArchive = new SpotterArchive($this->db); |
| 1135 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 1135 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
| 1136 | 1136 | if ($globalDebug) echo $result.')'; |
| 1137 | 1137 | } elseif ($globalDebug && $putinarchive !== true) { |
| 1138 | 1138 | echo '(Not adding to archive)'; |
@@ -1145,7 +1145,7 @@ discard block |
||
| 1145 | 1145 | |
| 1146 | 1146 | public function getOrderBy() |
| 1147 | 1147 | { |
| 1148 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 1148 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 1149 | 1149 | return $orderby; |
| 1150 | 1150 | } |
| 1151 | 1151 | |
@@ -17,33 +17,33 @@ discard block |
||
| 17 | 17 | * @param Array $filter the filter |
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
| 23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
| 26 | 26 | } else { |
| 27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | if (isset($filter[0]['source'])) { |
| 31 | - $filters = array_merge($filters,$filter); |
|
| 31 | + $filters = array_merge($filters, $filter); |
|
| 32 | 32 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 34 | 34 | $filter_query_join = ''; |
| 35 | 35 | $filter_query_where = ''; |
| 36 | - foreach($filters as $flt) { |
|
| 36 | + foreach ($filters as $flt) { |
|
| 37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 38 | 38 | if (isset($flt['source'])) { |
| 39 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
| 39 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
| 40 | 40 | } else { |
| 41 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
| 41 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 47 | 47 | } |
| 48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
| 75 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
| 76 | 76 | } |
| 77 | 77 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 78 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 78 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 79 | 79 | } |
| 80 | 80 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 81 | 81 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 82 | 82 | if ($filter_query_where != '') { |
| 83 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 83 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 84 | 84 | } |
| 85 | 85 | $filter_query = $filter_query_join.$filter_query_where; |
| 86 | 86 | return $filter_query; |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | if ($limit != '') |
| 104 | 104 | { |
| 105 | 105 | $limit_array = explode(',', $limit); |
| 106 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 107 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 107 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 108 | 108 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 109 | 109 | { |
| 110 | 110 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | } else { |
| 128 | 128 | $query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query; |
| 129 | 129 | } |
| 130 | - $spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 130 | + $spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 131 | 131 | |
| 132 | 132 | return $spotter_array; |
| 133 | 133 | } |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | global $globalDBdriver, $globalLiveInterval; |
| 144 | 144 | date_default_timezone_set('UTC'); |
| 145 | 145 | |
| 146 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 146 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 147 | 147 | |
| 148 | 148 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 149 | 149 | if ($globalDBdriver == 'mysql') { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | try { |
| 162 | 162 | $sth = $this->db->prepare($query); |
| 163 | 163 | $sth->execute(); |
| 164 | - } catch(PDOException $e) { |
|
| 164 | + } catch (PDOException $e) { |
|
| 165 | 165 | echo $e->getMessage(); |
| 166 | 166 | die; |
| 167 | 167 | } |
@@ -176,23 +176,23 @@ discard block |
||
| 176 | 176 | * @return Array the spotter information |
| 177 | 177 | * |
| 178 | 178 | */ |
| 179 | - public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false) |
|
| 179 | + public function getMinLastLiveTrackerData($coord, $filter = array(), $limit = false) |
|
| 180 | 180 | { |
| 181 | 181 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit; |
| 182 | 182 | date_default_timezone_set('UTC'); |
| 183 | 183 | if (is_array($coord) && !empty($coord)) { |
| 184 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 185 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 186 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 187 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 184 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 185 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 186 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 187 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 188 | 188 | } |
| 189 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 189 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 190 | 190 | |
| 191 | 191 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 192 | 192 | if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300'; |
| 193 | 193 | if ($globalDBdriver == 'mysql') { |
| 194 | 194 | if (isset($globalArchive) && $globalArchive) { |
| 195 | - $query = "SELECT * FROM ( |
|
| 195 | + $query = "SELECT * FROM ( |
|
| 196 | 196 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
| 197 | 197 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
| 198 | 198 | if (isset($maxlat)) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | } else { |
| 216 | 216 | if (isset($globalArchive) && $globalArchive) { |
| 217 | - $query = "SELECT * FROM ( |
|
| 217 | + $query = "SELECT * FROM ( |
|
| 218 | 218 | SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source |
| 219 | 219 | FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid "; |
| 220 | 220 | if (isset($maxlat)) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | try { |
| 239 | 239 | $sth = $this->db->prepare($query); |
| 240 | 240 | $sth->execute(); |
| 241 | - } catch(PDOException $e) { |
|
| 241 | + } catch (PDOException $e) { |
|
| 242 | 242 | echo $e->getMessage(); |
| 243 | 243 | die; |
| 244 | 244 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | public function getLiveTrackerCount($filter = array()) |
| 256 | 256 | { |
| 257 | 257 | global $globalDBdriver, $globalLiveInterval; |
| 258 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 258 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 259 | 259 | |
| 260 | 260 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 261 | 261 | if ($globalDBdriver == 'mysql') { |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | try { |
| 267 | 267 | $sth = $this->db->prepare($query); |
| 268 | 268 | $sth->execute(); |
| 269 | - } catch(PDOException $e) { |
|
| 269 | + } catch (PDOException $e) { |
|
| 270 | 270 | echo $e->getMessage(); |
| 271 | 271 | die; |
| 272 | 272 | } |
@@ -289,10 +289,10 @@ discard block |
||
| 289 | 289 | $filter_query = $this->getFilter($filter); |
| 290 | 290 | |
| 291 | 291 | if (is_array($coord)) { |
| 292 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 293 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 294 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 295 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 292 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 293 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 294 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 295 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 296 | 296 | } else return array(); |
| 297 | 297 | if ($globalDBdriver == 'mysql') { |
| 298 | 298 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
@@ -317,17 +317,17 @@ discard block |
||
| 317 | 317 | $filter_query = $this->getFilter($filter); |
| 318 | 318 | |
| 319 | 319 | if (is_array($coord)) { |
| 320 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 321 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 322 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 323 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 320 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 321 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 322 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 323 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 324 | 324 | } else return array(); |
| 325 | 325 | if ($globalDBdriver == 'mysql') { |
| 326 | 326 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
| 327 | 327 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
| 328 | 328 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
| 329 | 329 | } else { |
| 330 | - $query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
| 330 | + $query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
| 331 | 331 | FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date l.latitude BETWEEN ".$minlat." AND ".$maxlat." AND l.longitude BETWEEN ".$minlong." AND ".$maxlong." GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query." tracker_live.latitude <> '0' AND tracker_live.longitude <> '0'"; |
| 332 | 332 | } |
| 333 | 333 | $spotter_array = $Spotter->getDataFromDB($query); |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | if ($interval == '1m') |
| 376 | 376 | { |
| 377 | 377 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
| 378 | - } else if ($interval == '15m'){ |
|
| 378 | + } else if ($interval == '15m') { |
|
| 379 | 379 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
| 380 | 380 | } |
| 381 | 381 | } |
@@ -383,14 +383,14 @@ discard block |
||
| 383 | 383 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
| 386 | + $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
| 387 | 387 | WHERE tracker_live.latitude <> '' |
| 388 | 388 | AND tracker_live.longitude <> '' |
| 389 | 389 | ".$additional_query." |
| 390 | 390 | HAVING distance < :radius |
| 391 | 391 | ORDER BY distance"; |
| 392 | 392 | |
| 393 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 393 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 394 | 394 | |
| 395 | 395 | return $spotter_array; |
| 396 | 396 | } |
@@ -408,9 +408,9 @@ discard block |
||
| 408 | 408 | date_default_timezone_set('UTC'); |
| 409 | 409 | |
| 410 | 410 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 411 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 411 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 412 | 412 | |
| 413 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 413 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 414 | 414 | |
| 415 | 415 | return $spotter_array; |
| 416 | 416 | } |
@@ -421,16 +421,16 @@ discard block |
||
| 421 | 421 | * @return Array the spotter information |
| 422 | 422 | * |
| 423 | 423 | */ |
| 424 | - public function getDateLiveTrackerDataByIdent($ident,$date) |
|
| 424 | + public function getDateLiveTrackerDataByIdent($ident, $date) |
|
| 425 | 425 | { |
| 426 | 426 | $Tracker = new Tracker($this->db); |
| 427 | 427 | date_default_timezone_set('UTC'); |
| 428 | 428 | |
| 429 | 429 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 430 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 430 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 431 | 431 | |
| 432 | - $date = date('c',$date); |
|
| 433 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 432 | + $date = date('c', $date); |
|
| 433 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 434 | 434 | |
| 435 | 435 | return $spotter_array; |
| 436 | 436 | } |
@@ -447,9 +447,9 @@ discard block |
||
| 447 | 447 | date_default_timezone_set('UTC'); |
| 448 | 448 | |
| 449 | 449 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 450 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 450 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 451 | 451 | |
| 452 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 452 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 453 | 453 | |
| 454 | 454 | return $spotter_array; |
| 455 | 455 | } |
@@ -460,15 +460,15 @@ discard block |
||
| 460 | 460 | * @return Array the spotter information |
| 461 | 461 | * |
| 462 | 462 | */ |
| 463 | - public function getDateLiveTrackerDataById($id,$date) |
|
| 463 | + public function getDateLiveTrackerDataById($id, $date) |
|
| 464 | 464 | { |
| 465 | 465 | $Tracker = new Tracker($this->db); |
| 466 | 466 | date_default_timezone_set('UTC'); |
| 467 | 467 | |
| 468 | 468 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 469 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 470 | - $date = date('c',$date); |
|
| 471 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 469 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
| 470 | + $date = date('c', $date); |
|
| 471 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 472 | 472 | |
| 473 | 473 | return $spotter_array; |
| 474 | 474 | } |
@@ -485,13 +485,13 @@ discard block |
||
| 485 | 485 | date_default_timezone_set('UTC'); |
| 486 | 486 | |
| 487 | 487 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 488 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
| 488 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
| 489 | 489 | |
| 490 | 490 | try { |
| 491 | 491 | |
| 492 | 492 | $sth = $this->db->prepare($query); |
| 493 | 493 | $sth->execute(array(':ident' => $ident)); |
| 494 | - } catch(PDOException $e) { |
|
| 494 | + } catch (PDOException $e) { |
|
| 495 | 495 | echo $e->getMessage(); |
| 496 | 496 | die; |
| 497 | 497 | } |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | * @return Array the spotter information |
| 507 | 507 | * |
| 508 | 508 | */ |
| 509 | - public function getAllLiveTrackerDataById($id,$liveinterval = false) |
|
| 509 | + public function getAllLiveTrackerDataById($id, $liveinterval = false) |
|
| 510 | 510 | { |
| 511 | 511 | global $globalDBdriver, $globalLiveInterval; |
| 512 | 512 | date_default_timezone_set('UTC'); |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | try { |
| 526 | 526 | $sth = $this->db->prepare($query); |
| 527 | 527 | $sth->execute(array(':id' => $id)); |
| 528 | - } catch(PDOException $e) { |
|
| 528 | + } catch (PDOException $e) { |
|
| 529 | 529 | echo $e->getMessage(); |
| 530 | 530 | die; |
| 531 | 531 | } |
@@ -543,12 +543,12 @@ discard block |
||
| 543 | 543 | { |
| 544 | 544 | date_default_timezone_set('UTC'); |
| 545 | 545 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 546 | - $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
| 546 | + $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
| 547 | 547 | try { |
| 548 | 548 | |
| 549 | 549 | $sth = $this->db->prepare($query); |
| 550 | 550 | $sth->execute(array(':ident' => $ident)); |
| 551 | - } catch(PDOException $e) { |
|
| 551 | + } catch (PDOException $e) { |
|
| 552 | 552 | echo $e->getMessage(); |
| 553 | 553 | die; |
| 554 | 554 | } |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | |
| 579 | 579 | $sth = $this->db->prepare($query); |
| 580 | 580 | $sth->execute(); |
| 581 | - } catch(PDOException $e) { |
|
| 581 | + } catch (PDOException $e) { |
|
| 582 | 582 | return "error"; |
| 583 | 583 | } |
| 584 | 584 | |
@@ -601,14 +601,14 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | $sth = $this->db->prepare($query); |
| 603 | 603 | $sth->execute(); |
| 604 | - } catch(PDOException $e) { |
|
| 604 | + } catch (PDOException $e) { |
|
| 605 | 605 | return "error"; |
| 606 | 606 | } |
| 607 | 607 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
| 608 | 608 | $i = 0; |
| 609 | - $j =0; |
|
| 609 | + $j = 0; |
|
| 610 | 610 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 611 | - foreach($all as $row) |
|
| 611 | + foreach ($all as $row) |
|
| 612 | 612 | { |
| 613 | 613 | $i++; |
| 614 | 614 | $j++; |
@@ -616,9 +616,9 @@ discard block |
||
| 616 | 616 | if ($globalDebug) echo "."; |
| 617 | 617 | try { |
| 618 | 618 | |
| 619 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 619 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 620 | 620 | $sth->execute(); |
| 621 | - } catch(PDOException $e) { |
|
| 621 | + } catch (PDOException $e) { |
|
| 622 | 622 | return "error"; |
| 623 | 623 | } |
| 624 | 624 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | if ($i > 0) { |
| 630 | 630 | try { |
| 631 | 631 | |
| 632 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 632 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 633 | 633 | $sth->execute(); |
| 634 | - } catch(PDOException $e) { |
|
| 634 | + } catch (PDOException $e) { |
|
| 635 | 635 | return "error"; |
| 636 | 636 | } |
| 637 | 637 | } |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | |
| 645 | 645 | $sth = $this->db->prepare($query); |
| 646 | 646 | $sth->execute(); |
| 647 | - } catch(PDOException $e) { |
|
| 647 | + } catch (PDOException $e) { |
|
| 648 | 648 | return "error"; |
| 649 | 649 | } |
| 650 | 650 | /* $query_delete = "DELETE FROM tracker_live WHERE famtrackid IN ("; |
@@ -692,13 +692,13 @@ discard block |
||
| 692 | 692 | public function deleteLiveTrackerDataByIdent($ident) |
| 693 | 693 | { |
| 694 | 694 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 695 | - $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
| 695 | + $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
| 696 | 696 | |
| 697 | 697 | try { |
| 698 | 698 | |
| 699 | 699 | $sth = $this->db->prepare($query); |
| 700 | 700 | $sth->execute(array(':ident' => $ident)); |
| 701 | - } catch(PDOException $e) { |
|
| 701 | + } catch (PDOException $e) { |
|
| 702 | 702 | return "error"; |
| 703 | 703 | } |
| 704 | 704 | |
@@ -714,13 +714,13 @@ discard block |
||
| 714 | 714 | public function deleteLiveTrackerDataById($id) |
| 715 | 715 | { |
| 716 | 716 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 717 | - $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
| 717 | + $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
| 718 | 718 | |
| 719 | 719 | try { |
| 720 | 720 | |
| 721 | 721 | $sth = $this->db->prepare($query); |
| 722 | 722 | $sth->execute(array(':id' => $id)); |
| 723 | - } catch(PDOException $e) { |
|
| 723 | + } catch (PDOException $e) { |
|
| 724 | 724 | return "error"; |
| 725 | 725 | } |
| 726 | 726 | |
@@ -738,13 +738,13 @@ discard block |
||
| 738 | 738 | { |
| 739 | 739 | global $globalDBdriver, $globalTimezone; |
| 740 | 740 | if ($globalDBdriver == 'mysql') { |
| 741 | - $query = 'SELECT tracker_live.ident FROM tracker_live |
|
| 741 | + $query = 'SELECT tracker_live.ident FROM tracker_live |
|
| 742 | 742 | WHERE tracker_live.ident = :ident |
| 743 | 743 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 744 | 744 | AND tracker_live.date < UTC_TIMESTAMP()'; |
| 745 | 745 | $query_data = array(':ident' => $ident); |
| 746 | 746 | } else { |
| 747 | - $query = "SELECT tracker_live.ident FROM tracker_live |
|
| 747 | + $query = "SELECT tracker_live.ident FROM tracker_live |
|
| 748 | 748 | WHERE tracker_live.ident = :ident |
| 749 | 749 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 750 | 750 | AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -753,8 +753,8 @@ discard block |
||
| 753 | 753 | |
| 754 | 754 | $sth = $this->db->prepare($query); |
| 755 | 755 | $sth->execute($query_data); |
| 756 | - $ident_result=''; |
|
| 757 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 756 | + $ident_result = ''; |
|
| 757 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 758 | 758 | { |
| 759 | 759 | $ident_result = $row['ident']; |
| 760 | 760 | } |
@@ -771,13 +771,13 @@ discard block |
||
| 771 | 771 | { |
| 772 | 772 | global $globalDBdriver, $globalTimezone; |
| 773 | 773 | if ($globalDBdriver == 'mysql') { |
| 774 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 774 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 775 | 775 | WHERE tracker_live.ident = :ident |
| 776 | 776 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 777 | 777 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
| 778 | 778 | $query_data = array(':ident' => $ident); |
| 779 | 779 | } else { |
| 780 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 780 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 781 | 781 | WHERE tracker_live.ident = :ident |
| 782 | 782 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 783 | 783 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -786,8 +786,8 @@ discard block |
||
| 786 | 786 | |
| 787 | 787 | $sth = $this->db->prepare($query); |
| 788 | 788 | $sth->execute($query_data); |
| 789 | - $ident_result=''; |
|
| 790 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 789 | + $ident_result = ''; |
|
| 790 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 791 | 791 | { |
| 792 | 792 | $ident_result = $row['famtrackid']; |
| 793 | 793 | } |
@@ -804,13 +804,13 @@ discard block |
||
| 804 | 804 | { |
| 805 | 805 | global $globalDBdriver, $globalTimezone; |
| 806 | 806 | if ($globalDBdriver == 'mysql') { |
| 807 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 807 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 808 | 808 | WHERE tracker_live.famtrackid = :id |
| 809 | 809 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 810 | 810 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
| 811 | 811 | $query_data = array(':id' => $id); |
| 812 | 812 | } else { |
| 813 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 813 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
| 814 | 814 | WHERE tracker_live.famtrackid = :id |
| 815 | 815 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 816 | 816 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -819,8 +819,8 @@ discard block |
||
| 819 | 819 | |
| 820 | 820 | $sth = $this->db->prepare($query); |
| 821 | 821 | $sth->execute($query_data); |
| 822 | - $ident_result=''; |
|
| 823 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 822 | + $ident_result = ''; |
|
| 823 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 824 | 824 | { |
| 825 | 825 | $ident_result = $row['famtrackid']; |
| 826 | 826 | } |
@@ -838,7 +838,7 @@ discard block |
||
| 838 | 838 | * @return String success or false |
| 839 | 839 | * |
| 840 | 840 | */ |
| 841 | - public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 841 | + public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 842 | 842 | { |
| 843 | 843 | global $globalURL, $globalArchive, $globalDebug; |
| 844 | 844 | $Common = new Common(); |
@@ -897,21 +897,21 @@ discard block |
||
| 897 | 897 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 898 | 898 | |
| 899 | 899 | |
| 900 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
| 901 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 902 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 903 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 904 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 905 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 906 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 907 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 908 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 909 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 910 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
| 911 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 912 | - |
|
| 913 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 914 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 900 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
| 901 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 902 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 903 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 904 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 905 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 906 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 907 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 908 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 909 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 910 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
| 911 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 912 | + |
|
| 913 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 914 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 915 | 915 | |
| 916 | 916 | $query = ''; |
| 917 | 917 | if ($globalArchive) { |
@@ -921,12 +921,12 @@ discard block |
||
| 921 | 921 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
| 922 | 922 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
| 923 | 923 | |
| 924 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type); |
|
| 924 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type); |
|
| 925 | 925 | try { |
| 926 | 926 | |
| 927 | 927 | $sth = $this->db->prepare($query); |
| 928 | 928 | $sth->execute($query_values); |
| 929 | - } catch(PDOException $e) { |
|
| 929 | + } catch (PDOException $e) { |
|
| 930 | 930 | return "error : ".$e->getMessage(); |
| 931 | 931 | } |
| 932 | 932 | /* |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 937 | 937 | if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
| 938 | 938 | $TrackerArchive = new TrackerArchive($this->db); |
| 939 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
| 939 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country); |
|
| 940 | 940 | if ($globalDebug) echo $result.')'; |
| 941 | 941 | } |
| 942 | 942 | |
@@ -946,7 +946,7 @@ discard block |
||
| 946 | 946 | |
| 947 | 947 | public function getOrderBy() |
| 948 | 948 | { |
| 949 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
| 949 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
| 950 | 950 | return $orderby; |
| 951 | 951 | } |
| 952 | 952 | |
@@ -17,33 +17,33 @@ discard block |
||
| 17 | 17 | * @param Array $filter the filter |
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
| 23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
| 26 | 26 | } else { |
| 27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | if (isset($filter[0]['source'])) { |
| 31 | - $filters = array_merge($filters,$filter); |
|
| 31 | + $filters = array_merge($filters, $filter); |
|
| 32 | 32 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 34 | 34 | $filter_query_join = ''; |
| 35 | 35 | $filter_query_where = ''; |
| 36 | - foreach($filters as $flt) { |
|
| 36 | + foreach ($filters as $flt) { |
|
| 37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 38 | 38 | if (isset($flt['source'])) { |
| 39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 40 | 40 | } else { |
| 41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 47 | 47 | } |
| 48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -72,15 +72,15 @@ discard block |
||
| 72 | 72 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
| 75 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
| 76 | 76 | } |
| 77 | 77 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 78 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 78 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 79 | 79 | } |
| 80 | 80 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 81 | 81 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 82 | 82 | if ($filter_query_where != '') { |
| 83 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 83 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 84 | 84 | } |
| 85 | 85 | $filter_query = $filter_query_join.$filter_query_where; |
| 86 | 86 | return $filter_query; |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | if ($limit != '') |
| 104 | 104 | { |
| 105 | 105 | $limit_array = explode(',', $limit); |
| 106 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 107 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 107 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 108 | 108 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 109 | 109 | { |
| 110 | 110 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 120 | 120 | } |
| 121 | 121 | } |
| 122 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
| 122 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
| 123 | 123 | |
| 124 | 124 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 125 | 125 | if ($globalDBdriver == 'mysql') { |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | } else { |
| 129 | 129 | $query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query; |
| 130 | 130 | } |
| 131 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 131 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 132 | 132 | |
| 133 | 133 | return $spotter_array; |
| 134 | 134 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | global $globalDBdriver, $globalLiveInterval; |
| 145 | 145 | date_default_timezone_set('UTC'); |
| 146 | 146 | |
| 147 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 147 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 148 | 148 | |
| 149 | 149 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 150 | 150 | if ($globalDBdriver == 'mysql') { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | try { |
| 159 | 159 | $sth = $this->db->prepare($query); |
| 160 | 160 | $sth->execute(); |
| 161 | - } catch(PDOException $e) { |
|
| 161 | + } catch (PDOException $e) { |
|
| 162 | 162 | echo $e->getMessage(); |
| 163 | 163 | die; |
| 164 | 164 | } |
@@ -173,17 +173,17 @@ discard block |
||
| 173 | 173 | * @return Array the spotter information |
| 174 | 174 | * |
| 175 | 175 | */ |
| 176 | - public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false) |
|
| 176 | + public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false) |
|
| 177 | 177 | { |
| 178 | 178 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit; |
| 179 | 179 | date_default_timezone_set('UTC'); |
| 180 | 180 | if (is_array($coord) && !empty($coord)) { |
| 181 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 182 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 183 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 184 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 181 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 182 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 183 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 184 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 185 | 185 | } |
| 186 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 186 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 187 | 187 | |
| 188 | 188 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 189 | 189 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | try { |
| 233 | 233 | $sth = $this->db->prepare($query); |
| 234 | 234 | $sth->execute(); |
| 235 | - } catch(PDOException $e) { |
|
| 235 | + } catch (PDOException $e) { |
|
| 236 | 236 | echo $e->getMessage(); |
| 237 | 237 | die; |
| 238 | 238 | } |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | public function getLiveMarineCount($filter = array()) |
| 250 | 250 | { |
| 251 | 251 | global $globalDBdriver, $globalLiveInterval; |
| 252 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 252 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 253 | 253 | |
| 254 | 254 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 255 | 255 | if ($globalDBdriver == 'mysql') { |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | try { |
| 261 | 261 | $sth = $this->db->prepare($query); |
| 262 | 262 | $sth->execute(); |
| 263 | - } catch(PDOException $e) { |
|
| 263 | + } catch (PDOException $e) { |
|
| 264 | 264 | echo $e->getMessage(); |
| 265 | 265 | die; |
| 266 | 266 | } |
@@ -283,10 +283,10 @@ discard block |
||
| 283 | 283 | $filter_query = $this->getFilter($filter); |
| 284 | 284 | |
| 285 | 285 | if (is_array($coord)) { |
| 286 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 287 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 288 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 289 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 286 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 287 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 288 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 289 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 290 | 290 | } else return array(); |
| 291 | 291 | if ($globalDBdriver == 'mysql') { |
| 292 | 292 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query; |
@@ -311,17 +311,17 @@ discard block |
||
| 311 | 311 | $filter_query = $this->getFilter($filter); |
| 312 | 312 | |
| 313 | 313 | if (is_array($coord)) { |
| 314 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 315 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 316 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 317 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 314 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 315 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 316 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 317 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 318 | 318 | } else return array(); |
| 319 | 319 | if ($globalDBdriver == 'mysql') { |
| 320 | 320 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 321 | 321 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
| 322 | 322 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 323 | 323 | } else { |
| 324 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
| 324 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
| 325 | 325 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 326 | 326 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 327 | 327 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | if ($interval == '1m') |
| 371 | 371 | { |
| 372 | 372 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
| 373 | - } else if ($interval == '15m'){ |
|
| 373 | + } else if ($interval == '15m') { |
|
| 374 | 374 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -378,14 +378,14 @@ discard block |
||
| 378 | 378 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
| 379 | 379 | } |
| 380 | 380 | |
| 381 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 381 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 382 | 382 | WHERE marine_live.latitude <> '' |
| 383 | 383 | AND marine_live.longitude <> '' |
| 384 | 384 | ".$additional_query." |
| 385 | 385 | HAVING distance < :radius |
| 386 | 386 | ORDER BY distance"; |
| 387 | 387 | |
| 388 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 388 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 389 | 389 | |
| 390 | 390 | return $spotter_array; |
| 391 | 391 | } |
@@ -403,9 +403,9 @@ discard block |
||
| 403 | 403 | date_default_timezone_set('UTC'); |
| 404 | 404 | |
| 405 | 405 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 406 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 406 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 407 | 407 | |
| 408 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 408 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 409 | 409 | |
| 410 | 410 | return $spotter_array; |
| 411 | 411 | } |
@@ -416,16 +416,16 @@ discard block |
||
| 416 | 416 | * @return Array the spotter information |
| 417 | 417 | * |
| 418 | 418 | */ |
| 419 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
| 419 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
| 420 | 420 | { |
| 421 | 421 | $Marine = new Marine($this->db); |
| 422 | 422 | date_default_timezone_set('UTC'); |
| 423 | 423 | |
| 424 | 424 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 425 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 425 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 426 | 426 | |
| 427 | - $date = date('c',$date); |
|
| 428 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 427 | + $date = date('c', $date); |
|
| 428 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 429 | 429 | |
| 430 | 430 | return $spotter_array; |
| 431 | 431 | } |
@@ -442,9 +442,9 @@ discard block |
||
| 442 | 442 | date_default_timezone_set('UTC'); |
| 443 | 443 | |
| 444 | 444 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 445 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 445 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 446 | 446 | |
| 447 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 447 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 448 | 448 | |
| 449 | 449 | return $spotter_array; |
| 450 | 450 | } |
@@ -455,15 +455,15 @@ discard block |
||
| 455 | 455 | * @return Array the spotter information |
| 456 | 456 | * |
| 457 | 457 | */ |
| 458 | - public function getDateLiveMarineDataById($id,$date) |
|
| 458 | + public function getDateLiveMarineDataById($id, $date) |
|
| 459 | 459 | { |
| 460 | 460 | $Marine = new Marine($this->db); |
| 461 | 461 | date_default_timezone_set('UTC'); |
| 462 | 462 | |
| 463 | 463 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 464 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 465 | - $date = date('c',$date); |
|
| 466 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 464 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 465 | + $date = date('c', $date); |
|
| 466 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 467 | 467 | |
| 468 | 468 | return $spotter_array; |
| 469 | 469 | } |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | * @return Array the spotter information |
| 476 | 476 | * |
| 477 | 477 | */ |
| 478 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
| 478 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
| 479 | 479 | { |
| 480 | 480 | global $globalDBdriver, $globalLiveInterval; |
| 481 | 481 | date_default_timezone_set('UTC'); |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | try { |
| 495 | 495 | $sth = $this->db->prepare($query); |
| 496 | 496 | $sth->execute(array(':id' => $id)); |
| 497 | - } catch(PDOException $e) { |
|
| 497 | + } catch (PDOException $e) { |
|
| 498 | 498 | echo $e->getMessage(); |
| 499 | 499 | die; |
| 500 | 500 | } |
@@ -512,12 +512,12 @@ discard block |
||
| 512 | 512 | { |
| 513 | 513 | date_default_timezone_set('UTC'); |
| 514 | 514 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 515 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
| 515 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
| 516 | 516 | try { |
| 517 | 517 | |
| 518 | 518 | $sth = $this->db->prepare($query); |
| 519 | 519 | $sth->execute(array(':ident' => $ident)); |
| 520 | - } catch(PDOException $e) { |
|
| 520 | + } catch (PDOException $e) { |
|
| 521 | 521 | echo $e->getMessage(); |
| 522 | 522 | die; |
| 523 | 523 | } |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | |
| 548 | 548 | $sth = $this->db->prepare($query); |
| 549 | 549 | $sth->execute(); |
| 550 | - } catch(PDOException $e) { |
|
| 550 | + } catch (PDOException $e) { |
|
| 551 | 551 | return "error"; |
| 552 | 552 | } |
| 553 | 553 | |
@@ -570,14 +570,14 @@ discard block |
||
| 570 | 570 | |
| 571 | 571 | $sth = $this->db->prepare($query); |
| 572 | 572 | $sth->execute(); |
| 573 | - } catch(PDOException $e) { |
|
| 573 | + } catch (PDOException $e) { |
|
| 574 | 574 | return "error"; |
| 575 | 575 | } |
| 576 | 576 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
| 577 | 577 | $i = 0; |
| 578 | - $j =0; |
|
| 578 | + $j = 0; |
|
| 579 | 579 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 580 | - foreach($all as $row) |
|
| 580 | + foreach ($all as $row) |
|
| 581 | 581 | { |
| 582 | 582 | $i++; |
| 583 | 583 | $j++; |
@@ -585,9 +585,9 @@ discard block |
||
| 585 | 585 | if ($globalDebug) echo "."; |
| 586 | 586 | try { |
| 587 | 587 | |
| 588 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 588 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 589 | 589 | $sth->execute(); |
| 590 | - } catch(PDOException $e) { |
|
| 590 | + } catch (PDOException $e) { |
|
| 591 | 591 | return "error"; |
| 592 | 592 | } |
| 593 | 593 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -598,9 +598,9 @@ discard block |
||
| 598 | 598 | if ($i > 0) { |
| 599 | 599 | try { |
| 600 | 600 | |
| 601 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 601 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 602 | 602 | $sth->execute(); |
| 603 | - } catch(PDOException $e) { |
|
| 603 | + } catch (PDOException $e) { |
|
| 604 | 604 | return "error"; |
| 605 | 605 | } |
| 606 | 606 | } |
@@ -613,7 +613,7 @@ discard block |
||
| 613 | 613 | |
| 614 | 614 | $sth = $this->db->prepare($query); |
| 615 | 615 | $sth->execute(); |
| 616 | - } catch(PDOException $e) { |
|
| 616 | + } catch (PDOException $e) { |
|
| 617 | 617 | return "error"; |
| 618 | 618 | } |
| 619 | 619 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -661,13 +661,13 @@ discard block |
||
| 661 | 661 | public function deleteLiveMarineDataByIdent($ident) |
| 662 | 662 | { |
| 663 | 663 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 664 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
| 664 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
| 665 | 665 | |
| 666 | 666 | try { |
| 667 | 667 | |
| 668 | 668 | $sth = $this->db->prepare($query); |
| 669 | 669 | $sth->execute(array(':ident' => $ident)); |
| 670 | - } catch(PDOException $e) { |
|
| 670 | + } catch (PDOException $e) { |
|
| 671 | 671 | return "error"; |
| 672 | 672 | } |
| 673 | 673 | |
@@ -683,13 +683,13 @@ discard block |
||
| 683 | 683 | public function deleteLiveMarineDataById($id) |
| 684 | 684 | { |
| 685 | 685 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 686 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
| 686 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
| 687 | 687 | |
| 688 | 688 | try { |
| 689 | 689 | |
| 690 | 690 | $sth = $this->db->prepare($query); |
| 691 | 691 | $sth->execute(array(':id' => $id)); |
| 692 | - } catch(PDOException $e) { |
|
| 692 | + } catch (PDOException $e) { |
|
| 693 | 693 | return "error"; |
| 694 | 694 | } |
| 695 | 695 | |
@@ -707,13 +707,13 @@ discard block |
||
| 707 | 707 | { |
| 708 | 708 | global $globalDBdriver, $globalTimezone; |
| 709 | 709 | if ($globalDBdriver == 'mysql') { |
| 710 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
| 710 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
| 711 | 711 | WHERE marine_live.ident = :ident |
| 712 | 712 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 713 | 713 | AND marine_live.date < UTC_TIMESTAMP()'; |
| 714 | 714 | $query_data = array(':ident' => $ident); |
| 715 | 715 | } else { |
| 716 | - $query = "SELECT marine_live.ident FROM marine_live |
|
| 716 | + $query = "SELECT marine_live.ident FROM marine_live |
|
| 717 | 717 | WHERE marine_live.ident = :ident |
| 718 | 718 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 719 | 719 | AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -722,8 +722,8 @@ discard block |
||
| 722 | 722 | |
| 723 | 723 | $sth = $this->db->prepare($query); |
| 724 | 724 | $sth->execute($query_data); |
| 725 | - $ident_result=''; |
|
| 726 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 725 | + $ident_result = ''; |
|
| 726 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 727 | 727 | { |
| 728 | 728 | $ident_result = $row['ident']; |
| 729 | 729 | } |
@@ -740,13 +740,13 @@ discard block |
||
| 740 | 740 | { |
| 741 | 741 | global $globalDBdriver, $globalTimezone; |
| 742 | 742 | if ($globalDBdriver == 'mysql') { |
| 743 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 743 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 744 | 744 | WHERE marine_live.ident = :ident |
| 745 | 745 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 746 | 746 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 747 | 747 | $query_data = array(':ident' => $ident); |
| 748 | 748 | } else { |
| 749 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 749 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 750 | 750 | WHERE marine_live.ident = :ident |
| 751 | 751 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 752 | 752 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -755,8 +755,8 @@ discard block |
||
| 755 | 755 | |
| 756 | 756 | $sth = $this->db->prepare($query); |
| 757 | 757 | $sth->execute($query_data); |
| 758 | - $ident_result=''; |
|
| 759 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 758 | + $ident_result = ''; |
|
| 759 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 760 | 760 | { |
| 761 | 761 | $ident_result = $row['fammarine_id']; |
| 762 | 762 | } |
@@ -773,13 +773,13 @@ discard block |
||
| 773 | 773 | { |
| 774 | 774 | global $globalDBdriver, $globalTimezone; |
| 775 | 775 | if ($globalDBdriver == 'mysql') { |
| 776 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 776 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 777 | 777 | WHERE marine_live.fammarine_id = :id |
| 778 | 778 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 779 | 779 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 780 | 780 | $query_data = array(':id' => $id); |
| 781 | 781 | } else { |
| 782 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 782 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 783 | 783 | WHERE marine_live.fammarine_id = :id |
| 784 | 784 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 785 | 785 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -788,8 +788,8 @@ discard block |
||
| 788 | 788 | |
| 789 | 789 | $sth = $this->db->prepare($query); |
| 790 | 790 | $sth->execute($query_data); |
| 791 | - $ident_result=''; |
|
| 792 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 791 | + $ident_result = ''; |
|
| 792 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 793 | 793 | { |
| 794 | 794 | $ident_result = $row['fammarine_id']; |
| 795 | 795 | } |
@@ -806,13 +806,13 @@ discard block |
||
| 806 | 806 | { |
| 807 | 807 | global $globalDBdriver, $globalTimezone; |
| 808 | 808 | if ($globalDBdriver == 'mysql') { |
| 809 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
| 809 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
| 810 | 810 | WHERE marine_live.mmsi = :mmsi |
| 811 | 811 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 812 | 812 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 813 | 813 | $query_data = array(':mmsi' => $mmsi); |
| 814 | 814 | } else { |
| 815 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
| 815 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
| 816 | 816 | WHERE marine_live.mmsi = :mmsi |
| 817 | 817 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 818 | 818 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -821,8 +821,8 @@ discard block |
||
| 821 | 821 | |
| 822 | 822 | $sth = $this->db->prepare($query); |
| 823 | 823 | $sth->execute($query_data); |
| 824 | - $ident_result=''; |
|
| 825 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 824 | + $ident_result = ''; |
|
| 825 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 826 | 826 | { |
| 827 | 827 | $ident_result = $row['fammarine_id']; |
| 828 | 828 | } |
@@ -840,7 +840,7 @@ discard block |
||
| 840 | 840 | * @return String success or false |
| 841 | 841 | * |
| 842 | 842 | */ |
| 843 | - public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 843 | + public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 844 | 844 | { |
| 845 | 845 | global $globalURL, $globalArchive, $globalDebug; |
| 846 | 846 | $Common = new Common(); |
@@ -892,26 +892,26 @@ discard block |
||
| 892 | 892 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 893 | 893 | |
| 894 | 894 | |
| 895 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
| 896 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 897 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 898 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 899 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 900 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 901 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 902 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 903 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 904 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 905 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
| 906 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
| 907 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
| 908 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 909 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
| 910 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
| 895 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
| 896 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 897 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 898 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 899 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 900 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 901 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 902 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 903 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 904 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 905 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
| 906 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
| 907 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
| 908 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 909 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
| 910 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
| 911 | 911 | |
| 912 | 912 | |
| 913 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 914 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 913 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 914 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 915 | 915 | if ($arrival_date == '') $arrival_date = NULL; |
| 916 | 916 | $query = ''; |
| 917 | 917 | if ($globalArchive) { |
@@ -921,18 +921,18 @@ discard block |
||
| 921 | 921 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) |
| 922 | 922 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)'; |
| 923 | 923 | |
| 924 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
| 924 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
| 925 | 925 | try { |
| 926 | 926 | $sth = $this->db->prepare($query); |
| 927 | 927 | $sth->execute($query_values); |
| 928 | - } catch(PDOException $e) { |
|
| 928 | + } catch (PDOException $e) { |
|
| 929 | 929 | return "error : ".$e->getMessage(); |
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 933 | 933 | if ($globalDebug) echo '(Add to Marine archive : '; |
| 934 | 934 | $MarineArchive = new MarineArchive($this->db); |
| 935 | - $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country); |
|
| 935 | + $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $noarchive, $format_source, $source_name, $over_country); |
|
| 936 | 936 | if ($globalDebug) echo $result.')'; |
| 937 | 937 | } |
| 938 | 938 | return "success"; |
@@ -940,7 +940,7 @@ discard block |
||
| 940 | 940 | |
| 941 | 941 | public function getOrderBy() |
| 942 | 942 | { |
| 943 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
| 943 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
| 944 | 944 | return $orderby; |
| 945 | 945 | } |
| 946 | 946 | |
@@ -48,11 +48,11 @@ discard block |
||
| 48 | 48 | $s3 = sin($bank/2); |
| 49 | 49 | $c1c2 = $c1*$c2; |
| 50 | 50 | $s1s2 = $s1*$s2; |
| 51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 51 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
| 52 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
| 53 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 54 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 55 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
| 56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
| 57 | 57 | |
| 58 | 58 | } |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | $min = false; |
| 74 | 74 | $allhistory = false; |
| 75 | 75 | $filter['source'] = array(); |
| 76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 82 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 83 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 84 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 85 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 77 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 79 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
| 80 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 81 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
| 82 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
| 83 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
| 84 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
| 85 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
| 86 | 86 | /* |
| 87 | 87 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 88 | 88 | $min = true; |
@@ -129,12 +129,12 @@ discard block |
||
| 129 | 129 | $from_archive = true; |
| 130 | 130 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 131 | 131 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 132 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 133 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 134 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 135 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 136 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 137 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
| 132 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 133 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 134 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 135 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 136 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 137 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
| 138 | 138 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
| 139 | 139 | $from_archive = true; |
| 140 | 140 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -144,34 +144,34 @@ discard block |
||
| 144 | 144 | $begindate = $_COOKIE['archive_begin']; |
| 145 | 145 | $enddate = $_COOKIE['archive_end']; |
| 146 | 146 | |
| 147 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
| 148 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 149 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 147 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
| 148 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 149 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 150 | 150 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
| 151 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
| 151 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
| 152 | 152 | } elseif ($tracker) { |
| 153 | 153 | $coord = array(); |
| 154 | 154 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 155 | - $coord = explode(',',$_GET['coord']); |
|
| 155 | + $coord = explode(',', $_GET['coord']); |
|
| 156 | 156 | } |
| 157 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
| 157 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
| 158 | 158 | } elseif ($marine) { |
| 159 | 159 | $coord = array(); |
| 160 | 160 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 161 | - $coord = explode(',',$_GET['coord']); |
|
| 161 | + $coord = explode(',', $_GET['coord']); |
|
| 162 | 162 | } |
| 163 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
| 163 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
| 164 | 164 | } else { |
| 165 | 165 | $coord = array(); |
| 166 | 166 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
| 167 | - $coord = explode(',',$_GET['coord']); |
|
| 167 | + $coord = explode(',', $_GET['coord']); |
|
| 168 | 168 | } |
| 169 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
| 169 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
| 170 | 170 | } |
| 171 | 171 | //print_r($spotter_array); |
| 172 | 172 | if (!empty($spotter_array) && isset($coord)) { |
| 173 | 173 | if (isset($_GET['archive'])) { |
| 174 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 174 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 175 | 175 | } elseif ($tracker) { |
| 176 | 176 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
| 177 | 177 | } elseif ($marine) { |
@@ -182,15 +182,15 @@ discard block |
||
| 182 | 182 | if ($flightcnt == '') $flightcnt = 0; |
| 183 | 183 | } else $flightcnt = 0; |
| 184 | 184 | |
| 185 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 185 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 186 | 186 | $minitime = time(); |
| 187 | 187 | $maxitime = 0; |
| 188 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
| 188 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
| 189 | 189 | $modelsdb = array(); |
| 190 | 190 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
| 191 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
| 192 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
| 193 | - if (isset($row[1]) ){ |
|
| 191 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
| 192 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
| 193 | + if (isset($row[1])) { |
|
| 194 | 194 | $model = $row[0]; |
| 195 | 195 | $modelsdb[$model] = $row[1]; |
| 196 | 196 | } |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | $output .= '},'; |
| 227 | 227 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 228 | 228 | { |
| 229 | - foreach($spotter_array as $spotter_item) |
|
| 229 | + foreach ($spotter_array as $spotter_item) |
|
| 230 | 230 | { |
| 231 | 231 | $j++; |
| 232 | 232 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -258,11 +258,11 @@ discard block |
||
| 258 | 258 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
| 259 | 259 | $output .= '"format": "'.$spotter_item['format_source'].'",'; |
| 260 | 260 | if ($tracker) { |
| 261 | - $output.= '"type": "tracker"'; |
|
| 261 | + $output .= '"type": "tracker"'; |
|
| 262 | 262 | } elseif ($marine) { |
| 263 | - $output.= '"type": "marine"'; |
|
| 263 | + $output .= '"type": "marine"'; |
|
| 264 | 264 | } else { |
| 265 | - $output.= '"type": "flight"'; |
|
| 265 | + $output .= '"type": "flight"'; |
|
| 266 | 266 | } |
| 267 | 267 | $output .= '},'; |
| 268 | 268 | |
@@ -606,8 +606,8 @@ discard block |
||
| 606 | 606 | $output .= '},'; |
| 607 | 607 | } |
| 608 | 608 | } |
| 609 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
| 610 | - else $output = str_replace('%onground%','false',$output); |
|
| 609 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
| 610 | + else $output = str_replace('%onground%', 'false', $output); |
|
| 611 | 611 | |
| 612 | 612 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
| 613 | 613 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -622,7 +622,7 @@ discard block |
||
| 622 | 622 | $output .= '"cartographicDegrees": ['; |
| 623 | 623 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
| 624 | 624 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
| 625 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 625 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 626 | 626 | $output .= $spotter_item['longitude'].', '; |
| 627 | 627 | $output .= $spotter_item['latitude']; |
| 628 | 628 | $prevlong = $spotter_item['longitude']; |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
| 651 | 651 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
| 652 | 652 | } else { |
| 653 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 653 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 654 | 654 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
| 655 | 655 | if ($spotter_item['ground_speed'] == 0) { |
| 656 | 656 | $output .= $prevlong.', '; |
@@ -690,15 +690,15 @@ discard block |
||
| 690 | 690 | } |
| 691 | 691 | $output .= ']'; |
| 692 | 692 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 693 | - if ((time()-$globalLiveInterval) > $minitime) { |
|
| 694 | - if (time()-$globalLiveInterval > $maxitime) { |
|
| 695 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
| 693 | + if ((time() - $globalLiveInterval) > $minitime) { |
|
| 694 | + if (time() - $globalLiveInterval > $maxitime) { |
|
| 695 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
| 696 | 696 | } else { |
| 697 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
| 697 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
| 698 | 698 | } |
| 699 | 699 | } |
| 700 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 701 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 702 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
| 700 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
| 701 | +} else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
| 702 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
| 703 | 703 | print $output; |
| 704 | 704 | ?> |