| @@ -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,11 +144,11 @@ 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 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($filter); | 
| 154 | 154 |  } elseif ($marine) { | 
| @@ -159,7 +159,7 @@ discard block | ||
| 159 | 159 | //print_r($spotter_array); | 
| 160 | 160 |  if (!empty($spotter_array)) { | 
| 161 | 161 |  	if (isset($_GET['archive'])) { | 
| 162 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); | |
| 162 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); | |
| 163 | 163 |  	} elseif ($tracker) { | 
| 164 | 164 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); | 
| 165 | 165 |  	} elseif ($marine) { | 
| @@ -170,15 +170,15 @@ discard block | ||
| 170 | 170 | if ($flightcnt == '') $flightcnt = 0; | 
| 171 | 171 | } else $flightcnt = 0; | 
| 172 | 172 | |
| 173 | -$sqltime = round(microtime(true)-$begintime,2); | |
| 173 | +$sqltime = round(microtime(true) - $begintime, 2); | |
| 174 | 174 | $minitime = time(); | 
| 175 | 175 | $maxitime = 0; | 
| 176 | 176 | |
| 177 | 177 | $modelsdb = array(); | 
| 178 | 178 |  if (file_exists(dirname(__FILE__).'/models/modelsdb')) { | 
| 179 | -	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { | |
| 180 | -		while (($row = fgetcsv($handle,1000)) !== FALSE) { | |
| 181 | -			if (isset($row[1]) ){ | |
| 179 | +	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { | |
| 180 | +		while (($row = fgetcsv($handle, 1000)) !== FALSE) { | |
| 181 | +			if (isset($row[1])) { | |
| 182 | 182 | $model = $row[0]; | 
| 183 | 183 | $modelsdb[$model] = $row[1]; | 
| 184 | 184 | } | 
| @@ -214,7 +214,7 @@ discard block | ||
| 214 | 214 | $output .= '},'; | 
| 215 | 215 | if (!empty($spotter_array) && is_array($spotter_array)) | 
| 216 | 216 |  { | 
| 217 | - foreach($spotter_array as $spotter_item) | |
| 217 | + foreach ($spotter_array as $spotter_item) | |
| 218 | 218 |  	{ | 
| 219 | 219 | $j++; | 
| 220 | 220 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; | 
| @@ -585,8 +585,8 @@ discard block | ||
| 585 | 585 | $output .= '},'; | 
| 586 | 586 | } | 
| 587 | 587 | } | 
| 588 | -			if ($onground) $output = str_replace('%onground%','true',$output); | |
| 589 | -			else $output = str_replace('%onground%','false',$output); | |
| 588 | +			if ($onground) $output = str_replace('%onground%', 'true', $output); | |
| 589 | +			else $output = str_replace('%onground%', 'false', $output); | |
| 590 | 590 | |
| 591 | 591 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; | 
| 592 | 592 | //$output .= '"heightReference": "'.$heightrelative.'",'; | 
| @@ -601,7 +601,7 @@ discard block | ||
| 601 | 601 | $output .= '"cartographicDegrees": ['; | 
| 602 | 602 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); | 
| 603 | 603 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); | 
| 604 | -			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; | |
| 604 | +			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; | |
| 605 | 605 | $output .= $spotter_item['longitude'].', '; | 
| 606 | 606 | $output .= $spotter_item['latitude']; | 
| 607 | 607 | $prevlong = $spotter_item['longitude']; | 
| @@ -629,7 +629,7 @@ discard block | ||
| 629 | 629 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); | 
| 630 | 630 |  			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; | 
| 631 | 631 |  		} else { | 
| 632 | -			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; | |
| 632 | +			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; | |
| 633 | 633 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); | 
| 634 | 634 |  			if ($spotter_item['ground_speed'] == 0) { | 
| 635 | 635 | $output .= $prevlong.', '; | 
| @@ -669,15 +669,15 @@ discard block | ||
| 669 | 669 | } | 
| 670 | 670 | $output .= ']'; | 
| 671 | 671 |  if (isset($globalArchive) && $globalArchive === TRUE) { | 
| 672 | -	if ((time()-$globalLiveInterval) > $minitime) { | |
| 673 | -		if (time()-$globalLiveInterval > $maxitime) { | |
| 674 | -			$output = str_replace('%minitime%',date("c",$maxitime),$output); | |
| 672 | +	if ((time() - $globalLiveInterval) > $minitime) { | |
| 673 | +		if (time() - $globalLiveInterval > $maxitime) { | |
| 674 | +			$output = str_replace('%minitime%', date("c", $maxitime), $output); | |
| 675 | 675 |  		} else { | 
| 676 | -			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); | |
| 676 | +			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); | |
| 677 | 677 | } | 
| 678 | 678 | } | 
| 679 | -	else $output = str_replace('%minitime%',date("c",$minitime),$output); | |
| 680 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); | |
| 681 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); | |
| 679 | +	else $output = str_replace('%minitime%', date("c", $minitime), $output); | |
| 680 | +} else $output = str_replace('%minitime%', date("c", $minitime), $output); | |
| 681 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); | |
| 682 | 682 | print $output; | 
| 683 | 683 | ?> | 
| @@ -8,8 +8,12 @@ discard block | ||
| 8 | 8 | } | 
| 9 | 9 | $tracker = false; | 
| 10 | 10 | $marine = false; | 
| 11 | -if (isset($_GET['tracker'])) $tracker = true; | |
| 12 | -if (isset($_GET['marine'])) $marine = true; | |
| 11 | +if (isset($_GET['tracker'])) { | |
| 12 | + $tracker = true; | |
| 13 | +} | |
| 14 | +if (isset($_GET['marine'])) { | |
| 15 | + $marine = true; | |
| 16 | +} | |
| 13 | 17 |  if ($tracker) { | 
| 14 | 18 |  	require_once('require/class.Tracker.php'); | 
| 15 | 19 |  	require_once('require/class.TrackerLive.php'); | 
| @@ -66,23 +70,46 @@ discard block | ||
| 66 | 70 | } | 
| 67 | 71 |  header('Content-Type: text/javascript'); | 
| 68 | 72 | |
| 69 | -if (!isset($globalJsonCompress)) $compress = true; | |
| 70 | -else $compress = $globalJsonCompress; | |
| 73 | +if (!isset($globalJsonCompress)) { | |
| 74 | + $compress = true; | |
| 75 | +} else { | |
| 76 | + $compress = $globalJsonCompress; | |
| 77 | +} | |
| 71 | 78 | |
| 72 | 79 | $from_archive = false; | 
| 73 | 80 | $min = false; | 
| 74 | 81 | $allhistory = false; | 
| 75 | 82 | $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); | |
| 83 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { | |
| 84 | +	$filter['source'] = array_merge($filter['source'],array('vatsimtxt')); | |
| 85 | +} | |
| 86 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { | |
| 87 | +	$filter['source'] = array_merge($filter['source'],array('whazzup')); | |
| 88 | +} | |
| 89 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { | |
| 90 | +	$filter['source'] = array_merge($filter['source'],array('phpvmacars')); | |
| 91 | +} | |
| 92 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { | |
| 93 | +	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); | |
| 94 | +} | |
| 95 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { | |
| 96 | +	$filter['source'] = array_merge($filter['source'],array('aprs')); | |
| 97 | +} | |
| 98 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { | |
| 99 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); | |
| 100 | +} | |
| 101 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { | |
| 102 | +	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); | |
| 103 | +} | |
| 104 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { | |
| 105 | +	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); | |
| 106 | +} | |
| 107 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { | |
| 108 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); | |
| 109 | +} | |
| 110 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { | |
| 111 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); | |
| 112 | +} | |
| 86 | 113 | /* | 
| 87 | 114 |  if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { | 
| 88 | 115 | $min = true; | 
| @@ -167,8 +194,12 @@ discard block | ||
| 167 | 194 |  	} else { | 
| 168 | 195 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); | 
| 169 | 196 | } | 
| 170 | - if ($flightcnt == '') $flightcnt = 0; | |
| 171 | -} else $flightcnt = 0; | |
| 197 | +	if ($flightcnt == '') { | |
| 198 | + $flightcnt = 0; | |
| 199 | + } | |
| 200 | +	} else { | |
| 201 | + $flightcnt = 0; | |
| 202 | +} | |
| 172 | 203 | |
| 173 | 204 | $sqltime = round(microtime(true)-$begintime,2); | 
| 174 | 205 | $minitime = time(); | 
| @@ -191,7 +222,9 @@ discard block | ||
| 191 | 222 | $j = 0; | 
| 192 | 223 | $prev_flightaware_id = ''; | 
| 193 | 224 | $speed = 1; | 
| 194 | -if (isset($archivespeed)) $speed = $archivespeed; | |
| 225 | +if (isset($archivespeed)) { | |
| 226 | + $speed = $archivespeed; | |
| 227 | +} | |
| 195 | 228 | $output = '['; | 
| 196 | 229 |  if ($tracker) { | 
| 197 | 230 |  	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; | 
| @@ -226,9 +259,13 @@ discard block | ||
| 226 | 259 | $image = "images/placeholder_thumb.png"; | 
| 227 | 260 | } | 
| 228 | 261 | |
| 229 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; | |
| 230 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; | |
| 231 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; | |
| 262 | +                if (isset($spotter_item['flightaware_id'])) { | |
| 263 | + $id = $spotter_item['flightaware_id']; | |
| 264 | +                } elseif (isset($spotter_item['famtrackid'])) { | |
| 265 | + $id = $spotter_item['famtrackid']; | |
| 266 | +                } elseif (isset($spotter_item['fammarine_id'])) { | |
| 267 | + $id = $spotter_item['fammarine_id']; | |
| 268 | + } | |
| 232 | 269 |                  if ($prev_flightaware_id != $id) { | 
| 233 | 270 |  			if ($prev_flightaware_id != '') { | 
| 234 | 271 | $output .= ']'; | 
| @@ -270,7 +307,9 @@ discard block | ||
| 270 | 307 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; | 
| 271 | 308 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; | 
| 272 | 309 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; | 
| 273 | - } else $aircraft_shadow = ''; | |
| 310 | +						} else { | |
| 311 | + $aircraft_shadow = ''; | |
| 312 | + } | |
| 274 | 313 |  	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; | 
| 275 | 314 |  						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] && isset($_COOKIE['IconColor'])) { | 
| 276 | 315 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); | 
| @@ -278,7 +317,9 @@ discard block | ||
| 278 | 317 | } | 
| 279 | 318 | $output .= '},'; | 
| 280 | 319 | } | 
| 281 | -				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; | |
| 320 | +				} else { | |
| 321 | +					$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; | |
| 322 | + } | |
| 282 | 323 |  			} elseif ($one3dmodel) { | 
| 283 | 324 |  				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') { | 
| 284 | 325 |  					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20'; | 
| @@ -309,7 +350,9 @@ discard block | ||
| 309 | 350 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; | 
| 310 | 351 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; | 
| 311 | 352 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; | 
| 312 | - } else $aircraft_shadow = ''; | |
| 353 | +						} else { | |
| 354 | + $aircraft_shadow = ''; | |
| 355 | + } | |
| 313 | 356 |  						if ($aircraft_shadow != '') { | 
| 314 | 357 |  							if (isset($modelsdb[$aircraft_shadow])) { | 
| 315 | 358 |  								$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20'; | 
| @@ -446,7 +489,9 @@ discard block | ||
| 446 | 489 | } | 
| 447 | 490 | $output .= '},'; | 
| 448 | 491 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; | 
| 449 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; | |
| 492 | +								if ($spotter_item['aircraft_icao'] != '') { | |
| 493 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; | |
| 494 | + } | |
| 450 | 495 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; | 
| 451 | 496 | } | 
| 452 | 497 |  						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { | 
| @@ -468,7 +513,9 @@ discard block | ||
| 468 | 513 | } | 
| 469 | 514 | $output .= '},'; | 
| 470 | 515 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; | 
| 471 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; | |
| 516 | +							if ($spotter_item['aircraft_icao'] != '') { | |
| 517 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; | |
| 518 | + } | |
| 472 | 519 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; | 
| 473 | 520 | } | 
| 474 | 521 |  					} else { | 
| @@ -481,7 +528,9 @@ discard block | ||
| 481 | 528 | } | 
| 482 | 529 | $output .= '},'; | 
| 483 | 530 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; | 
| 484 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; | |
| 531 | +						if ($spotter_item['aircraft_icao'] != '') { | |
| 532 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; | |
| 533 | + } | |
| 485 | 534 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; | 
| 486 | 535 | } | 
| 487 | 536 |  				} elseif ($tracker && isset($spotter_item['type'])) { | 
| @@ -585,8 +634,11 @@ discard block | ||
| 585 | 634 | $output .= '},'; | 
| 586 | 635 | } | 
| 587 | 636 | } | 
| 588 | -			if ($onground) $output = str_replace('%onground%','true',$output); | |
| 589 | -			else $output = str_replace('%onground%','false',$output); | |
| 637 | +			if ($onground) { | |
| 638 | +				$output = str_replace('%onground%','true',$output); | |
| 639 | +			} else { | |
| 640 | +				$output = str_replace('%onground%','false',$output); | |
| 641 | + } | |
| 590 | 642 | |
| 591 | 643 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; | 
| 592 | 644 | //$output .= '"heightReference": "'.$heightrelative.'",'; | 
| @@ -599,8 +651,12 @@ discard block | ||
| 599 | 651 | // $output .= '"interpolationDegree" : 5,'; | 
| 600 | 652 |  	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; | 
| 601 | 653 | $output .= '"cartographicDegrees": ['; | 
| 602 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); | |
| 603 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); | |
| 654 | +			if ($minitime > strtotime($spotter_item['date'])) { | |
| 655 | + $minitime = strtotime($spotter_item['date']); | |
| 656 | + } | |
| 657 | +			if ($maxitime < strtotime($spotter_item['date'])) { | |
| 658 | + $maxitime = strtotime($spotter_item['date']); | |
| 659 | + } | |
| 604 | 660 |  			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; | 
| 605 | 661 | $output .= $spotter_item['longitude'].', '; | 
| 606 | 662 | $output .= $spotter_item['latitude']; | 
| @@ -623,20 +679,27 @@ discard block | ||
| 623 | 679 | $output .= ', '.round($spotter_item['altitude']*30.48); | 
| 624 | 680 | $prevalt = round($spotter_item['altitude']*30.48); | 
| 625 | 681 | } | 
| 626 | - } else $output .= ', 0'; | |
| 682 | +			} else { | |
| 683 | + $output .= ', 0'; | |
| 684 | + } | |
| 627 | 685 |  			//$orientation = '"orientation" : { '; | 
| 628 | 686 | //$orientation .= '"unitQuaternion": ['; | 
| 629 | 687 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); | 
| 630 | 688 |  			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; | 
| 631 | 689 |  		} else { | 
| 632 | 690 |  			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; | 
| 633 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); | |
| 691 | +			if ($maxitime < strtotime($spotter_item['date'])) { | |
| 692 | + $maxitime = strtotime($spotter_item['date']); | |
| 693 | + } | |
| 634 | 694 |  			if ($spotter_item['ground_speed'] == 0) { | 
| 635 | 695 | $output .= $prevlong.', '; | 
| 636 | 696 | $output .= $prevlat; | 
| 637 | 697 | //if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt; | 
| 638 | - if (!$marine) $output .= ', '.$prevalt; | |
| 639 | - else $output .= ', 0'; | |
| 698 | +				if (!$marine) { | |
| 699 | + $output .= ', '.$prevalt; | |
| 700 | +				} else { | |
| 701 | + $output .= ', 0'; | |
| 702 | + } | |
| 640 | 703 |  			} else { | 
| 641 | 704 | $output .= $spotter_item['longitude'].', '; | 
| 642 | 705 | $output .= $spotter_item['latitude']; | 
| @@ -649,14 +712,17 @@ discard block | ||
| 649 | 712 | $output .= ', 0'; | 
| 650 | 713 | } | 
| 651 | 714 |  					} else { | 
| 652 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048); | |
| 653 | -						elseif ($tracker) { | |
| 715 | +						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { | |
| 716 | + $output .= ', '.round($spotter_item['real_altitude']*0.3048); | |
| 717 | +						} elseif ($tracker) { | |
| 654 | 718 | $output .= ', '.round($spotter_item['altitude']*0.3048); | 
| 655 | 719 |  						} else { | 
| 656 | 720 | $output .= ', '.round($spotter_item['altitude']*30.48); | 
| 657 | 721 | } | 
| 658 | 722 | } | 
| 659 | - } else $output .= ', 0'; | |
| 723 | +				} else { | |
| 724 | + $output .= ', 0'; | |
| 725 | + } | |
| 660 | 726 | } | 
| 661 | 727 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); | 
| 662 | 728 |  			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; | 
| @@ -675,9 +741,12 @@ discard block | ||
| 675 | 741 |  		} else { | 
| 676 | 742 |  			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); | 
| 677 | 743 | } | 
| 744 | +	} else { | |
| 745 | +		$output = str_replace('%minitime%',date("c",$minitime),$output); | |
| 678 | 746 | } | 
| 679 | -	else $output = str_replace('%minitime%',date("c",$minitime),$output); | |
| 680 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); | |
| 747 | +	} else { | |
| 748 | +	$output = str_replace('%minitime%',date("c",$minitime),$output); | |
| 749 | +} | |
| 681 | 750 |  $output = str_replace('%maxitime%',date("c",$maxitime),$output); | 
| 682 | 751 | print $output; | 
| 683 | 752 | ?> | 
| @@ -16,33 +16,33 @@ discard block | ||
| 16 | 16 | * @param Array $filter the filter | 
| 17 | 17 | * @return Array the SQL part | 
| 18 | 18 | */ | 
| 19 | -	public function getFilter($filter = array(),$where = false,$and = false) { | |
| 19 | +	public function getFilter($filter = array(), $where = false, $and = false) { | |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; | 
| 21 | 21 | $filters = array(); | 
| 22 | 22 |  		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { | 
| 23 | 23 |  			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { | 
| 24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; | 
| 25 | 25 |  			} else { | 
| 26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); | |
| 26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); | |
| 27 | 27 | } | 
| 28 | 28 | } | 
| 29 | 29 |  		if (isset($filter[0]['source'])) { | 
| 30 | - $filters = array_merge($filters,$filter); | |
| 30 | + $filters = array_merge($filters, $filter); | |
| 31 | 31 | } | 
| 32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); | |
| 32 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); | |
| 33 | 33 | $filter_query_join = ''; | 
| 34 | 34 | $filter_query_where = ''; | 
| 35 | -		foreach($filters as $flt) { | |
| 35 | +		foreach ($filters as $flt) { | |
| 36 | 36 |  			if (isset($flt['idents']) && !empty($flt['idents'])) { | 
| 37 | 37 |  				if (isset($flt['source'])) { | 
| 38 | -					$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"; | |
| 38 | +					$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 | 39 |  				} else { | 
| 40 | -					$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"; | |
| 40 | +					$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 | 41 | } | 
| 42 | 42 | } | 
| 43 | 43 | } | 
| 44 | 44 |  		if (isset($filter['source']) && !empty($filter['source'])) { | 
| 45 | -			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; | |
| 45 | +			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; | |
| 46 | 46 | } | 
| 47 | 47 |  		if (isset($filter['ident']) && !empty($filter['ident'])) { | 
| 48 | 48 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; | 
| @@ -71,15 +71,15 @@ discard block | ||
| 71 | 71 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; | 
| 72 | 72 | } | 
| 73 | 73 | } | 
| 74 | -			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; | |
| 74 | +			$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 | 75 | } | 
| 76 | 76 |  		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { | 
| 77 | -			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; | |
| 77 | +			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; | |
| 78 | 78 | } | 
| 79 | 79 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; | 
| 80 | 80 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; | 
| 81 | 81 |  		if ($filter_query_where != '') { | 
| 82 | -			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); | |
| 82 | +			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); | |
| 83 | 83 | } | 
| 84 | 84 | $filter_query = $filter_query_join.$filter_query_where; | 
| 85 | 85 | return $filter_query; | 
| @@ -102,8 +102,8 @@ discard block | ||
| 102 | 102 | if ($limit != '') | 
| 103 | 103 |  		{ | 
| 104 | 104 |  			$limit_array = explode(',', $limit); | 
| 105 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); | |
| 106 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); | |
| 105 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); | |
| 106 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); | |
| 107 | 107 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) | 
| 108 | 108 |  			{ | 
| 109 | 109 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; | 
| @@ -126,7 +126,7 @@ discard block | ||
| 126 | 126 |  		} else { | 
| 127 | 127 | $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; | 
| 128 | 128 | } | 
| 129 | - $spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true); | |
| 129 | + $spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true); | |
| 130 | 130 | |
| 131 | 131 | return $spotter_array; | 
| 132 | 132 | } | 
| @@ -142,7 +142,7 @@ discard block | ||
| 142 | 142 | global $globalDBdriver, $globalLiveInterval; | 
| 143 | 143 |  		date_default_timezone_set('UTC'); | 
| 144 | 144 | |
| 145 | - $filter_query = $this->getFilter($filter,true,true); | |
| 145 | + $filter_query = $this->getFilter($filter, true, true); | |
| 146 | 146 | |
| 147 | 147 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; | 
| 148 | 148 |  		if ($globalDBdriver == 'mysql') { | 
| @@ -160,7 +160,7 @@ discard block | ||
| 160 | 160 |  		try { | 
| 161 | 161 | $sth = $this->db->prepare($query); | 
| 162 | 162 | $sth->execute(); | 
| 163 | -		} catch(PDOException $e) { | |
| 163 | +		} catch (PDOException $e) { | |
| 164 | 164 | echo $e->getMessage(); | 
| 165 | 165 | die; | 
| 166 | 166 | } | 
| @@ -180,12 +180,12 @@ discard block | ||
| 180 | 180 | global $globalDBdriver, $globalLiveInterval, $globalArchive; | 
| 181 | 181 |  		date_default_timezone_set('UTC'); | 
| 182 | 182 | |
| 183 | - $filter_query = $this->getFilter($filter,true,true); | |
| 183 | + $filter_query = $this->getFilter($filter, true, true); | |
| 184 | 184 | |
| 185 | 185 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; | 
| 186 | 186 |  		if ($globalDBdriver == 'mysql') { | 
| 187 | 187 |  			if (isset($globalArchive) && $globalArchive) { | 
| 188 | - $query = "SELECT * FROM ( | |
| 188 | + $query = "SELECT * FROM ( | |
| 189 | 189 | 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 | 
| 190 | 190 | 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 | 
| 191 | 191 | UNION | 
| @@ -195,14 +195,14 @@ discard block | ||
| 195 | 195 | WHERE latitude <> '0' AND longitude <> '0' | 
| 196 | 196 | ORDER BY famtrackid, date"; | 
| 197 | 197 |  			} else { | 
| 198 | - $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 | |
| 198 | + $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 | |
| 199 | 199 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date | 
| 200 | 200 | AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' | 
| 201 | 201 | ORDER BY tracker_live.famtrackid, tracker_live.date"; | 
| 202 | 202 | } | 
| 203 | 203 |  		} else { | 
| 204 | 204 |  			if (isset($globalArchive) && $globalArchive) { | 
| 205 | - $query = "SELECT * FROM ( | |
| 205 | + $query = "SELECT * FROM ( | |
| 206 | 206 | 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 | 
| 207 | 207 | 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 | 
| 208 | 208 | UNION | 
| @@ -212,7 +212,7 @@ discard block | ||
| 212 | 212 | WHERE latitude <> '0' AND longitude <> '0' | 
| 213 | 213 | ORDER BY famtrackid, date"; | 
| 214 | 214 |  			} else { | 
| 215 | - $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 | |
| 215 | + $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 | |
| 216 | 216 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' | 
| 217 | 217 | ORDER BY tracker_live.famtrackid, tracker_live.date"; | 
| 218 | 218 | } | 
| @@ -221,7 +221,7 @@ discard block | ||
| 221 | 221 |  		try { | 
| 222 | 222 | $sth = $this->db->prepare($query); | 
| 223 | 223 | $sth->execute(); | 
| 224 | -		} catch(PDOException $e) { | |
| 224 | +		} catch (PDOException $e) { | |
| 225 | 225 | echo $e->getMessage(); | 
| 226 | 226 | die; | 
| 227 | 227 | } | 
| @@ -238,7 +238,7 @@ discard block | ||
| 238 | 238 | public function getLiveTrackerCount($filter = array()) | 
| 239 | 239 |  	{ | 
| 240 | 240 | global $globalDBdriver, $globalLiveInterval; | 
| 241 | - $filter_query = $this->getFilter($filter,true,true); | |
| 241 | + $filter_query = $this->getFilter($filter, true, true); | |
| 242 | 242 | |
| 243 | 243 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; | 
| 244 | 244 |  		if ($globalDBdriver == 'mysql') { | 
| @@ -249,7 +249,7 @@ discard block | ||
| 249 | 249 |  		try { | 
| 250 | 250 | $sth = $this->db->prepare($query); | 
| 251 | 251 | $sth->execute(); | 
| 252 | -		} catch(PDOException $e) { | |
| 252 | +		} catch (PDOException $e) { | |
| 253 | 253 | echo $e->getMessage(); | 
| 254 | 254 | die; | 
| 255 | 255 | } | 
| @@ -272,10 +272,10 @@ discard block | ||
| 272 | 272 | $filter_query = $this->getFilter($filter); | 
| 273 | 273 | |
| 274 | 274 |  		if (is_array($coord)) { | 
| 275 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 276 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 277 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 278 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 275 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 276 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 277 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 278 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 279 | 279 | } else return array(); | 
| 280 | 280 |  		if ($globalDBdriver == 'mysql') { | 
| 281 | 281 | $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; | 
| @@ -300,17 +300,17 @@ discard block | ||
| 300 | 300 | $filter_query = $this->getFilter($filter); | 
| 301 | 301 | |
| 302 | 302 |  		if (is_array($coord)) { | 
| 303 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 304 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 305 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 306 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 303 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 304 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 305 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 306 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 307 | 307 | } else return array(); | 
| 308 | 308 |  		if ($globalDBdriver == 'mysql') { | 
| 309 | 309 | $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 | 
| 310 | 310 | 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." | 
| 311 | 311 | ORDER BY tracker_live.famtrackid, tracker_live.date"; | 
| 312 | 312 |  		} else { | 
| 313 | - $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 | |
| 313 | + $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 | |
| 314 | 314 | 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'"; | 
| 315 | 315 | } | 
| 316 | 316 | $spotter_array = $Spotter->getDataFromDB($query); | 
| @@ -358,7 +358,7 @@ discard block | ||
| 358 | 358 | if ($interval == '1m') | 
| 359 | 359 |                  { | 
| 360 | 360 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; | 
| 361 | -                } else if ($interval == '15m'){ | |
| 361 | +                } else if ($interval == '15m') { | |
| 362 | 362 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; | 
| 363 | 363 | } | 
| 364 | 364 | } | 
| @@ -366,14 +366,14 @@ discard block | ||
| 366 | 366 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; | 
| 367 | 367 | } | 
| 368 | 368 | |
| 369 | - $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 | |
| 369 | + $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 | |
| 370 | 370 | WHERE tracker_live.latitude <> '' | 
| 371 | 371 | AND tracker_live.longitude <> '' | 
| 372 | 372 | ".$additional_query." | 
| 373 | 373 | HAVING distance < :radius | 
| 374 | 374 | ORDER BY distance"; | 
| 375 | 375 | |
| 376 | -                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); | |
| 376 | +                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); | |
| 377 | 377 | |
| 378 | 378 | return $spotter_array; | 
| 379 | 379 | } | 
| @@ -391,9 +391,9 @@ discard block | ||
| 391 | 391 |  		date_default_timezone_set('UTC'); | 
| 392 | 392 | |
| 393 | 393 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); | 
| 394 | - $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'; | |
| 394 | + $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'; | |
| 395 | 395 | |
| 396 | -		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); | |
| 396 | +		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true); | |
| 397 | 397 | |
| 398 | 398 | return $spotter_array; | 
| 399 | 399 | } | 
| @@ -404,16 +404,16 @@ discard block | ||
| 404 | 404 | * @return Array the spotter information | 
| 405 | 405 | * | 
| 406 | 406 | */ | 
| 407 | - public function getDateLiveTrackerDataByIdent($ident,$date) | |
| 407 | + public function getDateLiveTrackerDataByIdent($ident, $date) | |
| 408 | 408 |  	{ | 
| 409 | 409 | $Tracker = new Tracker($this->db); | 
| 410 | 410 |  		date_default_timezone_set('UTC'); | 
| 411 | 411 | |
| 412 | 412 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); | 
| 413 | - $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'; | |
| 413 | + $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'; | |
| 414 | 414 | |
| 415 | -                $date = date('c',$date); | |
| 416 | -		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); | |
| 415 | +                $date = date('c', $date); | |
| 416 | +		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); | |
| 417 | 417 | |
| 418 | 418 | return $spotter_array; | 
| 419 | 419 | } | 
| @@ -430,9 +430,9 @@ discard block | ||
| 430 | 430 |  		date_default_timezone_set('UTC'); | 
| 431 | 431 | |
| 432 | 432 | $id = filter_var($id, FILTER_SANITIZE_STRING); | 
| 433 | - $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'; | |
| 433 | + $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'; | |
| 434 | 434 | |
| 435 | -		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); | |
| 435 | +		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true); | |
| 436 | 436 | |
| 437 | 437 | return $spotter_array; | 
| 438 | 438 | } | 
| @@ -443,15 +443,15 @@ discard block | ||
| 443 | 443 | * @return Array the spotter information | 
| 444 | 444 | * | 
| 445 | 445 | */ | 
| 446 | - public function getDateLiveTrackerDataById($id,$date) | |
| 446 | + public function getDateLiveTrackerDataById($id, $date) | |
| 447 | 447 |  	{ | 
| 448 | 448 | $Tracker = new Tracker($this->db); | 
| 449 | 449 |  		date_default_timezone_set('UTC'); | 
| 450 | 450 | |
| 451 | 451 | $id = filter_var($id, FILTER_SANITIZE_STRING); | 
| 452 | - $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'; | |
| 453 | -                $date = date('c',$date); | |
| 454 | -		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); | |
| 452 | + $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'; | |
| 453 | +                $date = date('c', $date); | |
| 454 | +		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); | |
| 455 | 455 | |
| 456 | 456 | return $spotter_array; | 
| 457 | 457 | } | 
| @@ -468,13 +468,13 @@ discard block | ||
| 468 | 468 |  		date_default_timezone_set('UTC'); | 
| 469 | 469 | |
| 470 | 470 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); | 
| 471 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; | |
| 471 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; | |
| 472 | 472 | |
| 473 | 473 |      		try { | 
| 474 | 474 | |
| 475 | 475 | $sth = $this->db->prepare($query); | 
| 476 | 476 |  			$sth->execute(array(':ident' => $ident)); | 
| 477 | -		} catch(PDOException $e) { | |
| 477 | +		} catch (PDOException $e) { | |
| 478 | 478 | echo $e->getMessage(); | 
| 479 | 479 | die; | 
| 480 | 480 | } | 
| @@ -489,7 +489,7 @@ discard block | ||
| 489 | 489 | * @return Array the spotter information | 
| 490 | 490 | * | 
| 491 | 491 | */ | 
| 492 | - public function getAllLiveTrackerDataById($id,$liveinterval = false) | |
| 492 | + public function getAllLiveTrackerDataById($id, $liveinterval = false) | |
| 493 | 493 |  	{ | 
| 494 | 494 | global $globalDBdriver, $globalLiveInterval; | 
| 495 | 495 |  		date_default_timezone_set('UTC'); | 
| @@ -508,7 +508,7 @@ discard block | ||
| 508 | 508 |  		try { | 
| 509 | 509 | $sth = $this->db->prepare($query); | 
| 510 | 510 |  			$sth->execute(array(':id' => $id)); | 
| 511 | -		} catch(PDOException $e) { | |
| 511 | +		} catch (PDOException $e) { | |
| 512 | 512 | echo $e->getMessage(); | 
| 513 | 513 | die; | 
| 514 | 514 | } | 
| @@ -526,12 +526,12 @@ discard block | ||
| 526 | 526 |  	{ | 
| 527 | 527 |  		date_default_timezone_set('UTC'); | 
| 528 | 528 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); | 
| 529 | - $query = self::$global_query.' WHERE tracker_live.ident = :ident'; | |
| 529 | + $query = self::$global_query.' WHERE tracker_live.ident = :ident'; | |
| 530 | 530 |      		try { | 
| 531 | 531 | |
| 532 | 532 | $sth = $this->db->prepare($query); | 
| 533 | 533 |  			$sth->execute(array(':ident' => $ident)); | 
| 534 | -		} catch(PDOException $e) { | |
| 534 | +		} catch (PDOException $e) { | |
| 535 | 535 | echo $e->getMessage(); | 
| 536 | 536 | die; | 
| 537 | 537 | } | 
| @@ -561,7 +561,7 @@ discard block | ||
| 561 | 561 | |
| 562 | 562 | $sth = $this->db->prepare($query); | 
| 563 | 563 | $sth->execute(); | 
| 564 | -		} catch(PDOException $e) { | |
| 564 | +		} catch (PDOException $e) { | |
| 565 | 565 | return "error"; | 
| 566 | 566 | } | 
| 567 | 567 | |
| @@ -584,14 +584,14 @@ discard block | ||
| 584 | 584 | |
| 585 | 585 | $sth = $this->db->prepare($query); | 
| 586 | 586 | $sth->execute(); | 
| 587 | -			} catch(PDOException $e) { | |
| 587 | +			} catch (PDOException $e) { | |
| 588 | 588 | return "error"; | 
| 589 | 589 | } | 
| 590 | 590 |  			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; | 
| 591 | 591 | $i = 0; | 
| 592 | - $j =0; | |
| 592 | + $j = 0; | |
| 593 | 593 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); | 
| 594 | - foreach($all as $row) | |
| 594 | + foreach ($all as $row) | |
| 595 | 595 |  			{ | 
| 596 | 596 | $i++; | 
| 597 | 597 | $j++; | 
| @@ -599,9 +599,9 @@ discard block | ||
| 599 | 599 | if ($globalDebug) echo "."; | 
| 600 | 600 |  				    	try { | 
| 601 | 601 | |
| 602 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); | |
| 602 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); | |
| 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 ('; | 
| @@ -612,9 +612,9 @@ discard block | ||
| 612 | 612 |  			if ($i > 0) { | 
| 613 | 613 |      				try { | 
| 614 | 614 | |
| 615 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); | |
| 615 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); | |
| 616 | 616 | $sth->execute(); | 
| 617 | -				} catch(PDOException $e) { | |
| 617 | +				} catch (PDOException $e) { | |
| 618 | 618 | return "error"; | 
| 619 | 619 | } | 
| 620 | 620 | } | 
| @@ -627,7 +627,7 @@ discard block | ||
| 627 | 627 | |
| 628 | 628 | $sth = $this->db->prepare($query); | 
| 629 | 629 | $sth->execute(); | 
| 630 | -			} catch(PDOException $e) { | |
| 630 | +			} catch (PDOException $e) { | |
| 631 | 631 | return "error"; | 
| 632 | 632 | } | 
| 633 | 633 |  /*			$query_delete = "DELETE FROM tracker_live WHERE famtrackid IN ("; | 
| @@ -675,13 +675,13 @@ discard block | ||
| 675 | 675 | public function deleteLiveTrackerDataByIdent($ident) | 
| 676 | 676 |  	{ | 
| 677 | 677 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); | 
| 678 | - $query = 'DELETE FROM tracker_live WHERE ident = :ident'; | |
| 678 | + $query = 'DELETE FROM tracker_live WHERE ident = :ident'; | |
| 679 | 679 | |
| 680 | 680 |      		try { | 
| 681 | 681 | |
| 682 | 682 | $sth = $this->db->prepare($query); | 
| 683 | 683 |  			$sth->execute(array(':ident' => $ident)); | 
| 684 | -		} catch(PDOException $e) { | |
| 684 | +		} catch (PDOException $e) { | |
| 685 | 685 | return "error"; | 
| 686 | 686 | } | 
| 687 | 687 | |
| @@ -697,13 +697,13 @@ discard block | ||
| 697 | 697 | public function deleteLiveTrackerDataById($id) | 
| 698 | 698 |  	{ | 
| 699 | 699 | $id = filter_var($id, FILTER_SANITIZE_STRING); | 
| 700 | - $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; | |
| 700 | + $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; | |
| 701 | 701 | |
| 702 | 702 |      		try { | 
| 703 | 703 | |
| 704 | 704 | $sth = $this->db->prepare($query); | 
| 705 | 705 |  			$sth->execute(array(':id' => $id)); | 
| 706 | -		} catch(PDOException $e) { | |
| 706 | +		} catch (PDOException $e) { | |
| 707 | 707 | return "error"; | 
| 708 | 708 | } | 
| 709 | 709 | |
| @@ -721,13 +721,13 @@ discard block | ||
| 721 | 721 |  	{ | 
| 722 | 722 | global $globalDBdriver, $globalTimezone; | 
| 723 | 723 |  		if ($globalDBdriver == 'mysql') { | 
| 724 | - $query = 'SELECT tracker_live.ident FROM tracker_live | |
| 724 | + $query = 'SELECT tracker_live.ident FROM tracker_live | |
| 725 | 725 | WHERE tracker_live.ident = :ident | 
| 726 | 726 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) | 
| 727 | 727 | AND tracker_live.date < UTC_TIMESTAMP()'; | 
| 728 | 728 |  			$query_data = array(':ident' => $ident); | 
| 729 | 729 |  		} else { | 
| 730 | - $query = "SELECT tracker_live.ident FROM tracker_live | |
| 730 | + $query = "SELECT tracker_live.ident FROM tracker_live | |
| 731 | 731 | WHERE tracker_live.ident = :ident | 
| 732 | 732 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' | 
| 733 | 733 | AND tracker_live.date < now() AT TIME ZONE 'UTC'"; | 
| @@ -736,8 +736,8 @@ discard block | ||
| 736 | 736 | |
| 737 | 737 | $sth = $this->db->prepare($query); | 
| 738 | 738 | $sth->execute($query_data); | 
| 739 | - $ident_result=''; | |
| 740 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) | |
| 739 | + $ident_result = ''; | |
| 740 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) | |
| 741 | 741 |  		{ | 
| 742 | 742 | $ident_result = $row['ident']; | 
| 743 | 743 | } | 
| @@ -754,13 +754,13 @@ discard block | ||
| 754 | 754 |  	{ | 
| 755 | 755 | global $globalDBdriver, $globalTimezone; | 
| 756 | 756 |  		if ($globalDBdriver == 'mysql') { | 
| 757 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live | |
| 757 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live | |
| 758 | 758 | WHERE tracker_live.ident = :ident | 
| 759 | 759 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; | 
| 760 | 760 | // AND tracker_live.date < UTC_TIMESTAMP()"; | 
| 761 | 761 |  			$query_data = array(':ident' => $ident); | 
| 762 | 762 |  		} else { | 
| 763 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live | |
| 763 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live | |
| 764 | 764 | WHERE tracker_live.ident = :ident | 
| 765 | 765 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; | 
| 766 | 766 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; | 
| @@ -769,8 +769,8 @@ discard block | ||
| 769 | 769 | |
| 770 | 770 | $sth = $this->db->prepare($query); | 
| 771 | 771 | $sth->execute($query_data); | 
| 772 | - $ident_result=''; | |
| 773 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) | |
| 772 | + $ident_result = ''; | |
| 773 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) | |
| 774 | 774 |  		{ | 
| 775 | 775 | $ident_result = $row['famtrackid']; | 
| 776 | 776 | } | 
| @@ -787,13 +787,13 @@ discard block | ||
| 787 | 787 |  	{ | 
| 788 | 788 | global $globalDBdriver, $globalTimezone; | 
| 789 | 789 |  		if ($globalDBdriver == 'mysql') { | 
| 790 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live | |
| 790 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live | |
| 791 | 791 | WHERE tracker_live.famtrackid = :id | 
| 792 | 792 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; | 
| 793 | 793 | // AND tracker_live.date < UTC_TIMESTAMP()"; | 
| 794 | 794 |  			$query_data = array(':id' => $id); | 
| 795 | 795 |  		} else { | 
| 796 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live | |
| 796 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live | |
| 797 | 797 | WHERE tracker_live.famtrackid = :id | 
| 798 | 798 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; | 
| 799 | 799 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; | 
| @@ -802,8 +802,8 @@ discard block | ||
| 802 | 802 | |
| 803 | 803 | $sth = $this->db->prepare($query); | 
| 804 | 804 | $sth->execute($query_data); | 
| 805 | - $ident_result=''; | |
| 806 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) | |
| 805 | + $ident_result = ''; | |
| 806 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) | |
| 807 | 807 |  		{ | 
| 808 | 808 | $ident_result = $row['famtrackid']; | 
| 809 | 809 | } | 
| @@ -821,7 +821,7 @@ discard block | ||
| 821 | 821 | * @return String success or false | 
| 822 | 822 | * | 
| 823 | 823 | */ | 
| 824 | - public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') | |
| 824 | + public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') | |
| 825 | 825 |  	{ | 
| 826 | 826 | global $globalURL, $globalArchive, $globalDebug; | 
| 827 | 827 | $Common = new Common(); | 
| @@ -880,21 +880,21 @@ discard block | ||
| 880 | 880 |  		if ($date == '') $date = date("Y-m-d H:i:s", time()); | 
| 881 | 881 | |
| 882 | 882 | |
| 883 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); | |
| 884 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); | |
| 885 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 886 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 887 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 888 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); | |
| 889 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | |
| 890 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); | |
| 891 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); | |
| 892 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); | |
| 893 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); | |
| 894 | - $type = filter_var($type,FILTER_SANITIZE_STRING); | |
| 895 | - | |
| 896 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; | |
| 897 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; | |
| 883 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); | |
| 884 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); | |
| 885 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 886 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 887 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 888 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); | |
| 889 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); | |
| 890 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); | |
| 891 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); | |
| 892 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); | |
| 893 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); | |
| 894 | + $type = filter_var($type, FILTER_SANITIZE_STRING); | |
| 895 | + | |
| 896 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; | |
| 897 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; | |
| 898 | 898 | |
| 899 | 899 | $query = ''; | 
| 900 | 900 |  		if ($globalArchive) { | 
| @@ -904,12 +904,12 @@ discard block | ||
| 904 | 904 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) | 
| 905 | 905 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; | 
| 906 | 906 | |
| 907 | -		$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); | |
| 907 | +		$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); | |
| 908 | 908 |  		try { | 
| 909 | 909 | |
| 910 | 910 | $sth = $this->db->prepare($query); | 
| 911 | 911 | $sth->execute($query_values); | 
| 912 | -                } catch(PDOException $e) { | |
| 912 | +                } catch (PDOException $e) { | |
| 913 | 913 | return "error : ".$e->getMessage(); | 
| 914 | 914 | } | 
| 915 | 915 | /* | 
| @@ -919,7 +919,7 @@ discard block | ||
| 919 | 919 |  		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { | 
| 920 | 920 | if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; | 
| 921 | 921 | $TrackerArchive = new TrackerArchive($this->db); | 
| 922 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); | |
| 922 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country); | |
| 923 | 923 | if ($globalDebug) echo $result.')'; | 
| 924 | 924 | } | 
| 925 | 925 | |
| @@ -929,7 +929,7 @@ discard block | ||
| 929 | 929 | |
| 930 | 930 | public function getOrderBy() | 
| 931 | 931 |  	{ | 
| 932 | -		$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")); | |
| 932 | +		$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")); | |
| 933 | 933 | return $orderby; | 
| 934 | 934 | } | 
| 935 | 935 | |
| @@ -29,7 +29,9 @@ discard block | ||
| 29 | 29 |  		if (isset($filter[0]['source'])) { | 
| 30 | 30 | $filters = array_merge($filters,$filter); | 
| 31 | 31 | } | 
| 32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); | |
| 32 | +		if (is_array($globalFilter)) { | |
| 33 | + $filter = array_merge($filter,$globalFilter); | |
| 34 | + } | |
| 33 | 35 | $filter_query_join = ''; | 
| 34 | 36 | $filter_query_where = ''; | 
| 35 | 37 |  		foreach($filters as $flt) { | 
| @@ -76,8 +78,11 @@ discard block | ||
| 76 | 78 |  		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { | 
| 77 | 79 |  			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; | 
| 78 | 80 | } | 
| 79 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; | |
| 80 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; | |
| 81 | +		if ($filter_query_where == '' && $where) { | |
| 82 | + $filter_query_where = ' WHERE'; | |
| 83 | +		} elseif ($filter_query_where != '' && $and) { | |
| 84 | + $filter_query_where .= ' AND'; | |
| 85 | + } | |
| 81 | 86 |  		if ($filter_query_where != '') { | 
| 82 | 87 |  			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); | 
| 83 | 88 | } | 
| @@ -119,7 +124,9 @@ discard block | ||
| 119 | 124 | } | 
| 120 | 125 | } | 
| 121 | 126 | |
| 122 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; | |
| 127 | +		if (!isset($globalLiveInterval)) { | |
| 128 | + $globalLiveInterval = '200'; | |
| 129 | + } | |
| 123 | 130 |  		if ($globalDBdriver == 'mysql') { | 
| 124 | 131 | //$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 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate"; | 
| 125 | 132 | $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'.$filter_query.$orderby_query; | 
| @@ -144,7 +151,9 @@ discard block | ||
| 144 | 151 | |
| 145 | 152 | $filter_query = $this->getFilter($filter,true,true); | 
| 146 | 153 | |
| 147 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; | |
| 154 | +		if (!isset($globalLiveInterval)) { | |
| 155 | + $globalLiveInterval = '200'; | |
| 156 | + } | |
| 148 | 157 |  		if ($globalDBdriver == 'mysql') { | 
| 149 | 158 | $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 | 
| 150 | 159 | 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'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0"; | 
| @@ -182,7 +191,9 @@ discard block | ||
| 182 | 191 | |
| 183 | 192 | $filter_query = $this->getFilter($filter,true,true); | 
| 184 | 193 | |
| 185 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; | |
| 194 | +		if (!isset($globalLiveInterval)) { | |
| 195 | + $globalLiveInterval = '200'; | |
| 196 | + } | |
| 186 | 197 |  		if ($globalDBdriver == 'mysql') { | 
| 187 | 198 |  			if (isset($globalArchive) && $globalArchive) { | 
| 188 | 199 | $query = "SELECT * FROM ( | 
| @@ -240,7 +251,9 @@ discard block | ||
| 240 | 251 | global $globalDBdriver, $globalLiveInterval; | 
| 241 | 252 | $filter_query = $this->getFilter($filter,true,true); | 
| 242 | 253 | |
| 243 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; | |
| 254 | +		if (!isset($globalLiveInterval)) { | |
| 255 | + $globalLiveInterval = '200'; | |
| 256 | + } | |
| 244 | 257 |  		if ($globalDBdriver == 'mysql') { | 
| 245 | 258 | $query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; | 
| 246 | 259 |  		} else { | 
| @@ -268,7 +281,9 @@ discard block | ||
| 268 | 281 |  	{ | 
| 269 | 282 | global $globalDBdriver, $globalLiveInterval; | 
| 270 | 283 | $Spotter = new Spotter($this->db); | 
| 271 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; | |
| 284 | +		if (!isset($globalLiveInterval)) { | |
| 285 | + $globalLiveInterval = '200'; | |
| 286 | + } | |
| 272 | 287 | $filter_query = $this->getFilter($filter); | 
| 273 | 288 | |
| 274 | 289 |  		if (is_array($coord)) { | 
| @@ -276,7 +291,9 @@ discard block | ||
| 276 | 291 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | 
| 277 | 292 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | 
| 278 | 293 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | 
| 279 | - } else return array(); | |
| 294 | +		} else { | |
| 295 | + return array(); | |
| 296 | + } | |
| 280 | 297 |  		if ($globalDBdriver == 'mysql') { | 
| 281 | 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; | 
| 282 | 299 |  		} else { | 
| @@ -296,7 +313,9 @@ discard block | ||
| 296 | 313 |  	{ | 
| 297 | 314 | global $globalDBdriver, $globalLiveInterval; | 
| 298 | 315 | $Spotter = new Spotter($this->db); | 
| 299 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; | |
| 316 | +		if (!isset($globalLiveInterval)) { | |
| 317 | + $globalLiveInterval = '200'; | |
| 318 | + } | |
| 300 | 319 | $filter_query = $this->getFilter($filter); | 
| 301 | 320 | |
| 302 | 321 |  		if (is_array($coord)) { | 
| @@ -304,7 +323,9 @@ discard block | ||
| 304 | 323 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | 
| 305 | 324 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | 
| 306 | 325 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); | 
| 307 | - } else return array(); | |
| 326 | +		} else { | |
| 327 | + return array(); | |
| 328 | + } | |
| 308 | 329 |  		if ($globalDBdriver == 'mysql') { | 
| 309 | 330 | $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 | 
| 310 | 331 | 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." | 
| @@ -497,11 +518,15 @@ discard block | ||
| 497 | 518 | //$query = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date'; | 
| 498 | 519 |  		if ($globalDBdriver == 'mysql') { | 
| 499 | 520 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; | 
| 500 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; | |
| 521 | +			if ($liveinterval) { | |
| 522 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; | |
| 523 | + } | |
| 501 | 524 | $query .= ' ORDER BY date'; | 
| 502 | 525 |  		} else { | 
| 503 | 526 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; | 
| 504 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; | |
| 527 | +			if ($liveinterval) { | |
| 528 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; | |
| 529 | + } | |
| 505 | 530 | $query .= ' ORDER BY date'; | 
| 506 | 531 | } | 
| 507 | 532 | |
| @@ -596,7 +621,9 @@ discard block | ||
| 596 | 621 | $i++; | 
| 597 | 622 | $j++; | 
| 598 | 623 |  				if ($j == 30) { | 
| 599 | - if ($globalDebug) echo "."; | |
| 624 | +					if ($globalDebug) { | |
| 625 | + echo "."; | |
| 626 | + } | |
| 600 | 627 |  				    	try { | 
| 601 | 628 | |
| 602 | 629 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); | 
| @@ -843,7 +870,9 @@ discard block | ||
| 843 | 870 |  			{ | 
| 844 | 871 | return false; | 
| 845 | 872 | } | 
| 846 | - } else return ''; | |
| 873 | +		} else { | |
| 874 | + return ''; | |
| 875 | + } | |
| 847 | 876 | |
| 848 | 877 | if ($longitude != '') | 
| 849 | 878 |  		{ | 
| @@ -851,7 +880,9 @@ discard block | ||
| 851 | 880 |  			{ | 
| 852 | 881 | return false; | 
| 853 | 882 | } | 
| 854 | - } else return ''; | |
| 883 | +		} else { | |
| 884 | + return ''; | |
| 885 | + } | |
| 855 | 886 | |
| 856 | 887 | if ($altitude != '') | 
| 857 | 888 |  		{ | 
| @@ -859,7 +890,9 @@ discard block | ||
| 859 | 890 |  			{ | 
| 860 | 891 | return false; | 
| 861 | 892 | } | 
| 862 | - } else $altitude = 0; | |
| 893 | +		} else { | |
| 894 | + $altitude = 0; | |
| 895 | + } | |
| 863 | 896 | |
| 864 | 897 | if ($heading != '') | 
| 865 | 898 |  		{ | 
| @@ -867,7 +900,9 @@ discard block | ||
| 867 | 900 |  			{ | 
| 868 | 901 | return false; | 
| 869 | 902 | } | 
| 870 | - } else $heading = 0; | |
| 903 | +		} else { | |
| 904 | + $heading = 0; | |
| 905 | + } | |
| 871 | 906 | |
| 872 | 907 | if ($groundspeed != '') | 
| 873 | 908 |  		{ | 
| @@ -875,9 +910,13 @@ discard block | ||
| 875 | 910 |  			{ | 
| 876 | 911 | return false; | 
| 877 | 912 | } | 
| 878 | - } else $groundspeed = 0; | |
| 913 | +		} else { | |
| 914 | + $groundspeed = 0; | |
| 915 | + } | |
| 879 | 916 |  		date_default_timezone_set('UTC'); | 
| 880 | -		if ($date == '') $date = date("Y-m-d H:i:s", time()); | |
| 917 | +		if ($date == '') { | |
| 918 | +			$date = date("Y-m-d H:i:s", time()); | |
| 919 | + } | |
| 881 | 920 | |
| 882 | 921 | |
| 883 | 922 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); | 
| @@ -893,12 +932,18 @@ discard block | ||
| 893 | 932 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); | 
| 894 | 933 | $type = filter_var($type,FILTER_SANITIZE_STRING); | 
| 895 | 934 | |
| 896 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; | |
| 897 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; | |
| 935 | +            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { | |
| 936 | + $groundspeed = 0; | |
| 937 | + } | |
| 938 | +            	if ($heading == '' || $Common->isInteger($heading) === false ) { | |
| 939 | + $heading = 0; | |
| 940 | + } | |
| 898 | 941 | |
| 899 | 942 | $query = ''; | 
| 900 | 943 |  		if ($globalArchive) { | 
| 901 | - if ($globalDebug) echo '-- Delete previous data -- '; | |
| 944 | +			if ($globalDebug) { | |
| 945 | + echo '-- Delete previous data -- '; | |
| 946 | + } | |
| 902 | 947 | $query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;'; | 
| 903 | 948 | } | 
| 904 | 949 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) | 
| @@ -917,10 +962,14 @@ discard block | ||
| 917 | 962 | echo 'noarchive : '.$noarchive."\n"; | 
| 918 | 963 | */ | 
| 919 | 964 |  		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { | 
| 920 | - if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; | |
| 965 | +		    if ($globalDebug) { | |
| 966 | + echo '(Add to Tracker archive '.$famtrackid.' : '; | |
| 967 | + } | |
| 921 | 968 | $TrackerArchive = new TrackerArchive($this->db); | 
| 922 | 969 | $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); | 
| 923 | - if ($globalDebug) echo $result.')'; | |
| 970 | +		    if ($globalDebug) { | |
| 971 | + echo $result.')'; | |
| 972 | + } | |
| 924 | 973 | } | 
| 925 | 974 | |
| 926 | 975 | return "success"; | 
| @@ -47,7 +47,7 @@ discard block | ||
| 47 | 47 |  	    if (isset($this->all_tracked[$key]['id'])) { | 
| 48 | 48 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; | 
| 49 | 49 | $Tracker = new Tracker($this->db); | 
| 50 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); | |
| 50 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); | |
| 51 | 51 | } | 
| 52 | 52 | } | 
| 53 | 53 | } | 
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; | 
| 59 | 59 |  	foreach ($this->all_tracked as $key => $flight) { | 
| 60 | 60 |      	    if (isset($flight['lastupdate'])) { | 
| 61 | -        	if ($flight['lastupdate'] < (time()-3000)) { | |
| 61 | +        	if ($flight['lastupdate'] < (time() - 3000)) { | |
| 62 | 62 |              	    if (isset($this->all_tracked[$key]['id'])) { | 
| 63 | 63 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; | 
| 64 | 64 | /* | 
| @@ -69,7 +69,7 @@ discard block | ||
| 69 | 69 | //$real_arrival = $this->arrival($key); | 
| 70 | 70 | $Tracker = new Tracker($this->db); | 
| 71 | 71 |              		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { | 
| 72 | - $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); | |
| 72 | + $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']); | |
| 73 | 73 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; | 
| 74 | 74 | } | 
| 75 | 75 | // Put in archive | 
| @@ -89,7 +89,7 @@ discard block | ||
| 89 | 89 | $send = false; | 
| 90 | 90 | |
| 91 | 91 | // SBS format is CSV format | 
| 92 | -	if(is_array($line) && isset($line['ident'])) { | |
| 92 | +	if (is_array($line) && isset($line['ident'])) { | |
| 93 | 93 | //print_r($line); | 
| 94 | 94 |    	    if (isset($line['ident'])) { | 
| 95 | 95 | |
| @@ -113,33 +113,33 @@ discard block | ||
| 113 | 113 | |
| 114 | 114 |  		if (!isset($this->all_tracked[$id])) { | 
| 115 | 115 | $this->all_tracked[$id] = array(); | 
| 116 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); | |
| 117 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); | |
| 118 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); | |
| 116 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0)); | |
| 117 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '')); | |
| 118 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); | |
| 119 | 119 |  		    if (!isset($line['id'])) { | 
| 120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; | 
| 121 | -			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); | |
| 122 | -		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); | |
| 121 | +			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); | |
| 122 | +		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); | |
| 123 | 123 | if ($globalAllTracked !== FALSE) $dataFound = true; | 
| 124 | 124 | } | 
| 125 | 125 | |
| 126 | -		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { | |
| 126 | +		if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { | |
| 127 | 127 |  		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { | 
| 128 | -			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); | |
| 128 | +			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); | |
| 129 | 129 |  		    } else { | 
| 130 | 130 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; | 
| 131 | 131 |  				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; | 
| 132 | 132 | return ''; | 
| 133 | 133 | } | 
| 134 | -		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { | |
| 134 | +		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { | |
| 135 | 135 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; | 
| 136 | 136 | return ''; | 
| 137 | -		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { | |
| 137 | +		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { | |
| 138 | 138 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; | 
| 139 | 139 | return ''; | 
| 140 | 140 |  		} elseif (!isset($line['datetime'])) { | 
| 141 | 141 |  			date_default_timezone_set('UTC'); | 
| 142 | -			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); | |
| 142 | +			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); | |
| 143 | 143 |  		} else { | 
| 144 | 144 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; | 
| 145 | 145 | return ''; | 
| @@ -147,38 +147,38 @@ discard block | ||
| 147 | 147 | |
| 148 | 148 |  		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { | 
| 149 | 149 |  		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { | 
| 150 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); | |
| 150 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); | |
| 151 | 151 |  		    if ($this->all_tracked[$id]['addedTracker'] == 1) { | 
| 152 | 152 | $timeelapsed = microtime(true); | 
| 153 | 153 | $Tracker = new Tracker($this->db); | 
| 154 | 154 | $fromsource = NULL; | 
| 155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); | |
| 155 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); | |
| 156 | 156 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; | 
| 157 | 157 | $Tracker->db = null; | 
| 158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 158 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; | |
| 159 | 159 | } | 
| 160 | -		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); | |
| 160 | +		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); | |
| 161 | 161 | } | 
| 162 | 162 | |
| 163 | 163 |  		if (isset($line['speed']) && $line['speed'] != '') { | 
| 164 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); | |
| 165 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); | |
| 164 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); | |
| 165 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); | |
| 166 | 166 |  		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { | 
| 167 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); | |
| 167 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); | |
| 168 | 168 |  		    if ($distance > 100 && $distance < 10000) { | 
| 169 | 169 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); | 
| 170 | 170 | $speed = $speed*3.6; | 
| 171 | -			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); | |
| 171 | +			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); | |
| 172 | 172 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; | 
| 173 | 173 | } | 
| 174 | 174 | } | 
| 175 | 175 | |
| 176 | 176 |  	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { | 
| 177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); | |
| 177 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); | |
| 178 | 178 | else unset($timediff); | 
| 179 | -	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { | |
| 179 | +	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) { | |
| 180 | 180 |  			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { | 
| 181 | -			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.1)) { | |
| 181 | +			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'], 0.1)) { | |
| 182 | 182 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; | 
| 183 | 183 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; | 
| 184 | 184 | $this->all_tracked[$id]['putinarchive'] = true; | 
| @@ -186,10 +186,10 @@ discard block | ||
| 186 | 186 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; | 
| 187 | 187 | $timeelapsed = microtime(true); | 
| 188 | 188 | $Tracker = new Tracker($this->db); | 
| 189 | - $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); | |
| 189 | + $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); | |
| 190 | 190 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; | 
| 191 | 191 | $Tracker->db = null; | 
| 192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 192 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; | |
| 193 | 193 | $this->tmd = 0; | 
| 194 | 194 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; | 
| 195 | 195 | } | 
| @@ -197,75 +197,75 @@ discard block | ||
| 197 | 197 | |
| 198 | 198 |  			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { | 
| 199 | 199 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; | 
| 200 | -				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { | |
| 200 | +				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { | |
| 201 | 201 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; | 
| 202 | 202 | $dataFound = true; | 
| 203 | 203 | $this->all_tracked[$id]['time_last_coord'] = time(); | 
| 204 | 204 | } | 
| 205 | -				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); | |
| 205 | +				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); | |
| 206 | 206 | } | 
| 207 | 207 |  			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { | 
| 208 | 208 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; | 
| 209 | 209 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; | 
| 210 | -				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { | |
| 210 | +				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { | |
| 211 | 211 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; | 
| 212 | 212 | $dataFound = true; | 
| 213 | 213 | $this->all_tracked[$id]['time_last_coord'] = time(); | 
| 214 | 214 | } | 
| 215 | -				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); | |
| 215 | +				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); | |
| 216 | 216 | } | 
| 217 | 217 | |
| 218 | 218 |  		    } else if ($globalDebug && $timediff > 20) { | 
| 219 | 219 | $this->tmd = $this->tmd + 1; | 
| 220 | 220 |  			if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) { | 
| 221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; | 
| 222 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; | |
| 223 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; | |
| 222 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; | |
| 223 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; | |
| 224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; | 
| 225 | 225 | } | 
| 226 | 226 | } | 
| 227 | 227 | } | 
| 228 | 228 |  		if (isset($line['last_update']) && $line['last_update'] != '') { | 
| 229 | 229 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; | 
| 230 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); | |
| 230 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); | |
| 231 | 231 | } | 
| 232 | 232 |  		if (isset($line['format_source']) && $line['format_source'] != '') { | 
| 233 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); | |
| 233 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); | |
| 234 | 234 | } | 
| 235 | 235 |  		if (isset($line['source_name']) && $line['source_name'] != '') { | 
| 236 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); | |
| 236 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); | |
| 237 | 237 | } | 
| 238 | 238 |  		if (isset($line['comment']) && $line['comment'] != '') { | 
| 239 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); | |
| 239 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment'])); | |
| 240 | 240 | //$dataFound = true; | 
| 241 | 241 | } | 
| 242 | 242 |  		if (isset($line['type']) && $line['type'] != '') { | 
| 243 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); | |
| 243 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); | |
| 244 | 244 | //$dataFound = true; | 
| 245 | 245 | } | 
| 246 | 246 | |
| 247 | 247 |  		if (isset($line['altitude']) && $line['altitude'] != '') { | 
| 248 | 248 |  		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { | 
| 249 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; | |
| 250 | -			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); | |
| 251 | -			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); | |
| 249 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; | |
| 250 | +			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => $line['altitude'])); | |
| 251 | +			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude'])); | |
| 252 | 252 | //$dataFound = true; | 
| 253 | 253 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; | 
| 254 | 254 | } | 
| 255 | 255 | |
| 256 | 256 |  		if (isset($line['noarchive']) && $line['noarchive'] === true) { | 
| 257 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); | |
| 257 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); | |
| 258 | 258 | } | 
| 259 | 259 | |
| 260 | 260 |  		if (isset($line['heading']) && $line['heading'] != '') { | 
| 261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; | |
| 262 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); | |
| 263 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); | |
| 261 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; | |
| 262 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); | |
| 263 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); | |
| 264 | 264 | //$dataFound = true; | 
| 265 | 265 |    		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { | 
| 266 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); | |
| 267 | -		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); | |
| 268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; | |
| 266 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); | |
| 267 | +		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); | |
| 268 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; | |
| 269 | 269 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; | 
| 270 | 270 | } | 
| 271 | 271 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; | 
| @@ -273,54 +273,54 @@ discard block | ||
| 273 | 273 |  		if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { | 
| 274 | 274 | $this->all_tracked[$id]['lastupdate'] = time(); | 
| 275 | 275 |  		    if ($this->all_tracked[$id]['addedTracker'] == 0) { | 
| 276 | -		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { | |
| 276 | +		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { | |
| 277 | 277 |  			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { | 
| 278 | 278 | if ($globalDebug) echo "Check if aircraft is already in DB..."; | 
| 279 | 279 | $timeelapsed = microtime(true); | 
| 280 | 280 | $TrackerLive = new TrackerLive($this->db); | 
| 281 | 281 |  				if (isset($line['id'])) { | 
| 282 | 282 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); | 
| 283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 283 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; | |
| 284 | 284 |  				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { | 
| 285 | 285 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); | 
| 286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 286 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; | |
| 287 | 287 | } else $recent_ident = ''; | 
| 288 | - $TrackerLive->db=null; | |
| 288 | + $TrackerLive->db = null; | |
| 289 | 289 | |
| 290 | 290 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; | 
| 291 | 291 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; | 
| 292 | 292 |  			    } else { | 
| 293 | 293 | $recent_ident = ''; | 
| 294 | -				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); | |
| 294 | +				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); | |
| 295 | 295 | } | 
| 296 | 296 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive | 
| 297 | - if($recent_ident == "") | |
| 297 | + if ($recent_ident == "") | |
| 298 | 298 |  			    { | 
| 299 | 299 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; | 
| 300 | 300 | //adds the spotter data for the archive | 
| 301 | 301 | $highlight = ''; | 
| 302 | -				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); | |
| 302 | +				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); | |
| 303 | 303 | $timeelapsed = microtime(true); | 
| 304 | 304 | $Tracker = new Tracker($this->db); | 
| 305 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); | |
| 305 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']); | |
| 306 | 306 | $Tracker->db = null; | 
| 307 | 307 | if ($globalDebug && isset($result)) echo $result."\n"; | 
| 308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 308 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; | |
| 309 | 309 | |
| 310 | 310 | |
| 311 | 311 | // Add source stat in DB | 
| 312 | 312 | $Stats = new Stats($this->db); | 
| 313 | 313 |  				    if (!empty($this->stats)) { | 
| 314 | 314 | if ($globalDebug) echo 'Add source stats : '; | 
| 315 | -				        foreach($this->stats as $date => $data) { | |
| 316 | -					    foreach($data as $source => $sourced) { | |
| 315 | +				        foreach ($this->stats as $date => $data) { | |
| 316 | +					    foreach ($data as $source => $sourced) { | |
| 317 | 317 | //print_r($sourced); | 
| 318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); | |
| 319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); | |
| 318 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_tracker', $date); | |
| 319 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_tracker', $date); | |
| 320 | 320 |  				    		if (isset($sourced['msg'])) { | 
| 321 | 321 |  				    		    if (time() - $sourced['msg']['date'] > 10) { | 
| 322 | 322 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); | 
| 323 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); | |
| 323 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_tracker', $date); | |
| 324 | 324 | unset($this->stats[$date][$source]['msg']); | 
| 325 | 325 | } | 
| 326 | 326 | } | 
| @@ -343,7 +343,7 @@ discard block | ||
| 343 | 343 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); | 
| 344 | 344 | $TrackerLive = new TrackerLive($this->db); | 
| 345 | 345 | $TrackerLive->deleteLiveTrackerData(); | 
| 346 | - $TrackerLive->db=null; | |
| 346 | + $TrackerLive->db = null; | |
| 347 | 347 | if ($globalDebug) echo " Done\n"; | 
| 348 | 348 | $this->last_delete = time(); | 
| 349 | 349 | } | 
| @@ -352,7 +352,7 @@ discard block | ||
| 352 | 352 | $this->all_tracked[$id]['addedTracker'] = 1; | 
| 353 | 353 |  				if (isset($globalDaemon) && !$globalDaemon) { | 
| 354 | 354 | $Tracker = new Tracker($this->db); | 
| 355 | - $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); | |
| 355 | + $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']); | |
| 356 | 356 | $Tracker->db = null; | 
| 357 | 357 | } | 
| 358 | 358 | |
| @@ -366,14 +366,14 @@ discard block | ||
| 366 | 366 | $ignoreImport = false; | 
| 367 | 367 | |
| 368 | 368 |  		    if (!$ignoreImport) { | 
| 369 | -			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { | |
| 369 | +			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { | |
| 370 | 370 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; | 
| 371 | 371 | $timeelapsed = microtime(true); | 
| 372 | 372 | $TrackerLive = new TrackerLive($this->db); | 
| 373 | - $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); | |
| 373 | + $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); | |
| 374 | 374 | $TrackerLive->db = null; | 
| 375 | 375 | $this->all_tracked[$id]['putinarchive'] = false; | 
| 376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 376 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; | |
| 377 | 377 | |
| 378 | 378 | // Put statistics in $this->stats variable | 
| 379 | 379 | |
| @@ -390,19 +390,19 @@ discard block | ||
| 390 | 390 | $latitude = $globalCenterLatitude; | 
| 391 | 391 | $longitude = $globalCenterLongitude; | 
| 392 | 392 | } | 
| 393 | -						$this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); | |
| 393 | +						$this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); | |
| 394 | 394 |  					} else { | 
| 395 | 395 | $latitude = $this->source_location[$source]['latitude']; | 
| 396 | 396 | $longitude = $this->source_location[$source]['longitude']; | 
| 397 | 397 | } | 
| 398 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); | |
| 398 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); | |
| 399 | 399 | //$stats_heading = $stats_heading%22.5; | 
| 400 | 400 | $stats_heading = round($stats_heading/22.5); | 
| 401 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); | |
| 401 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); | |
| 402 | 402 |  					$current_date = date('Y-m-d'); | 
| 403 | 403 | if ($stats_heading == 16) $stats_heading = 0; | 
| 404 | 404 |  					if (!isset($this->stats[$current_date][$source]['polar'][1])) { | 
| 405 | -						for ($i=0;$i<=15;$i++) { | |
| 405 | +						for ($i = 0; $i <= 15; $i++) { | |
| 406 | 406 | $this->stats[$current_date][$source]['polar'][$i] = 0; | 
| 407 | 407 | } | 
| 408 | 408 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; | 
| @@ -417,9 +417,9 @@ discard block | ||
| 417 | 417 |  					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { | 
| 418 | 418 |  						if (isset($this->stats[$current_date][$source]['hist'][0])) { | 
| 419 | 419 | end($this->stats[$current_date][$source]['hist']); | 
| 420 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; | |
| 420 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; | |
| 421 | 421 | } else $mini = 0; | 
| 422 | -						for ($i=$mini;$i<=$distance;$i+=10) { | |
| 422 | +						for ($i = $mini; $i <= $distance; $i += 10) { | |
| 423 | 423 | $this->stats[$current_date][$source]['hist'][$i] = 0; | 
| 424 | 424 | } | 
| 425 | 425 | $this->stats[$current_date][$source]['hist'][$distance] = 1; | 
| @@ -431,7 +431,7 @@ discard block | ||
| 431 | 431 | $this->all_tracked[$id]['lastupdate'] = time(); | 
| 432 | 432 | if ($this->all_tracked[$id]['putinarchive']) $send = true; | 
| 433 | 433 | if ($globalDebug) echo $result."\n"; | 
| 434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; | |
| 434 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; | |
| 435 | 435 | //$this->del(); | 
| 436 | 436 | |
| 437 | 437 | |
| @@ -42,7 +42,9 @@ discard block | ||
| 42 | 42 | |
| 43 | 43 |      public function checkAll() { | 
| 44 | 44 | global $globalDebug; | 
| 45 | - if ($globalDebug) echo "Update last seen tracked data...\n"; | |
| 45 | +	if ($globalDebug) { | |
| 46 | + echo "Update last seen tracked data...\n"; | |
| 47 | + } | |
| 46 | 48 |  	foreach ($this->all_tracked as $key => $flight) { | 
| 47 | 49 |  	    if (isset($this->all_tracked[$key]['id'])) { | 
| 48 | 50 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; | 
| @@ -55,12 +57,16 @@ discard block | ||
| 55 | 57 |      public function del() { | 
| 56 | 58 | global $globalDebug; | 
| 57 | 59 | // Delete old infos | 
| 58 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; | |
| 60 | +	if ($globalDebug) { | |
| 61 | + echo 'Delete old values and update latest data...'."\n"; | |
| 62 | + } | |
| 59 | 63 |  	foreach ($this->all_tracked as $key => $flight) { | 
| 60 | 64 |      	    if (isset($flight['lastupdate'])) { | 
| 61 | 65 |          	if ($flight['lastupdate'] < (time()-3000)) { | 
| 62 | 66 |              	    if (isset($this->all_tracked[$key]['id'])) { | 
| 63 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; | |
| 67 | +            		if ($globalDebug) { | |
| 68 | + echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; | |
| 69 | + } | |
| 64 | 70 | /* | 
| 65 | 71 | $TrackerLive = new TrackerLive(); | 
| 66 | 72 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); | 
| @@ -70,7 +76,9 @@ discard block | ||
| 70 | 76 | $Tracker = new Tracker($this->db); | 
| 71 | 77 |              		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { | 
| 72 | 78 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); | 
| 73 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; | |
| 79 | +				if ($globalDebug && $result != 'success') { | |
| 80 | + echo '!!! ERROR : '.$result."\n"; | |
| 81 | + } | |
| 74 | 82 | } | 
| 75 | 83 | // Put in archive | 
| 76 | 84 | // $Tracker->db = null; | 
| @@ -83,7 +91,9 @@ discard block | ||
| 83 | 91 | |
| 84 | 92 |      public function add($line) { | 
| 85 | 93 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; | 
| 86 | - if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChange = '0.015'; | |
| 94 | +	if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') { | |
| 95 | + $globalCoordMinChange = '0.015'; | |
| 96 | + } | |
| 87 | 97 |  	date_default_timezone_set('UTC'); | 
| 88 | 98 | $dataFound = false; | 
| 89 | 99 | $send = false; | 
| @@ -97,19 +107,29 @@ discard block | ||
| 97 | 107 | // Increment message number | 
| 98 | 108 |  		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { | 
| 99 | 109 |  		    $current_date = date('Y-m-d'); | 
| 100 | - if (isset($line['source_name'])) $source = $line['source_name']; | |
| 101 | - else $source = ''; | |
| 102 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; | |
| 110 | +		    if (isset($line['source_name'])) { | |
| 111 | + $source = $line['source_name']; | |
| 112 | +		    } else { | |
| 113 | + $source = ''; | |
| 114 | + } | |
| 115 | +		    if ($source == '' || $line['format_source'] == 'aprs') { | |
| 116 | + $source = $line['format_source']; | |
| 117 | + } | |
| 103 | 118 |  		    if (!isset($this->stats[$current_date][$source]['msg'])) { | 
| 104 | 119 | $this->stats[$current_date][$source]['msg']['date'] = time(); | 
| 105 | 120 | $this->stats[$current_date][$source]['msg']['nb'] = 1; | 
| 106 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; | |
| 121 | +		    } else { | |
| 122 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; | |
| 123 | + } | |
| 107 | 124 | } | 
| 108 | 125 | |
| 109 | 126 | |
| 110 | 127 | $Common = new Common(); | 
| 111 | - if (!isset($line['id'])) $id = trim($line['ident']); | |
| 112 | - else $id = trim($line['id']); | |
| 128 | +	        if (!isset($line['id'])) { | |
| 129 | + $id = trim($line['ident']); | |
| 130 | +	        } else { | |
| 131 | + $id = trim($line['id']); | |
| 132 | + } | |
| 113 | 133 | |
| 114 | 134 |  		if (!isset($this->all_tracked[$id])) { | 
| 115 | 135 | $this->all_tracked[$id] = array(); | 
| @@ -117,31 +137,46 @@ discard block | ||
| 117 | 137 |  		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); | 
| 118 | 138 |  		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); | 
| 119 | 139 |  		    if (!isset($line['id'])) { | 
| 120 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; | |
| 140 | +			if (!isset($globalDaemon)) { | |
| 141 | + $globalDaemon = TRUE; | |
| 142 | + } | |
| 121 | 143 |  			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); | 
| 122 | -		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); | |
| 123 | - if ($globalAllTracked !== FALSE) $dataFound = true; | |
| 144 | +		     } else { | |
| 145 | +		     	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); | |
| 146 | + } | |
| 147 | +		    if ($globalAllTracked !== FALSE) { | |
| 148 | + $dataFound = true; | |
| 149 | + } | |
| 124 | 150 | } | 
| 125 | 151 | |
| 126 | 152 |  		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { | 
| 127 | 153 |  		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { | 
| 128 | 154 |  			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); | 
| 129 | 155 |  		    } else { | 
| 130 | - if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; | |
| 131 | -				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; | |
| 156 | +				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { | |
| 157 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; | |
| 158 | +				} elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { | |
| 159 | +					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; | |
| 160 | + } | |
| 132 | 161 | return ''; | 
| 133 | 162 | } | 
| 134 | 163 |  		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { | 
| 135 | - if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; | |
| 164 | +			if ($globalDebug) { | |
| 165 | + echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; | |
| 166 | + } | |
| 136 | 167 | return ''; | 
| 137 | 168 |  		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { | 
| 138 | - if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; | |
| 169 | +			if ($globalDebug) { | |
| 170 | + echo "!!! Date is in the future ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; | |
| 171 | + } | |
| 139 | 172 | return ''; | 
| 140 | 173 |  		} elseif (!isset($line['datetime'])) { | 
| 141 | 174 |  			date_default_timezone_set('UTC'); | 
| 142 | 175 |  			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); | 
| 143 | 176 |  		} else { | 
| 144 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; | |
| 177 | +			if ($globalDebug) { | |
| 178 | + echo "!!! Unknow date error ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; | |
| 179 | + } | |
| 145 | 180 | return ''; | 
| 146 | 181 | } | 
| 147 | 182 | |
| @@ -153,11 +188,17 @@ discard block | ||
| 153 | 188 | $Tracker = new Tracker($this->db); | 
| 154 | 189 | $fromsource = NULL; | 
| 155 | 190 | $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); | 
| 156 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; | |
| 191 | +			if ($globalDebug && $result != 'success') { | |
| 192 | + echo '!!! ERROR : '.$result."\n"; | |
| 193 | + } | |
| 157 | 194 | $Tracker->db = null; | 
| 158 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 195 | +			if ($globalDebugTimeElapsed) { | |
| 196 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 197 | + } | |
| 198 | + } | |
| 199 | +		    if (!isset($this->all_tracked[$id]['id'])) { | |
| 200 | +		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); | |
| 159 | 201 | } | 
| 160 | -		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); | |
| 161 | 202 | } | 
| 162 | 203 | |
| 163 | 204 |  		if (isset($line['speed']) && $line['speed'] != '') { | 
| @@ -168,14 +209,21 @@ discard block | ||
| 168 | 209 |  		    if ($distance > 100 && $distance < 10000) { | 
| 169 | 210 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); | 
| 170 | 211 | $speed = $speed*3.6; | 
| 171 | -			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); | |
| 172 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; | |
| 212 | +			if ($speed < 1000) { | |
| 213 | +				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); | |
| 214 | + } | |
| 215 | +  			if ($globalDebug) { | |
| 216 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; | |
| 217 | + } | |
| 173 | 218 | } | 
| 174 | 219 | } | 
| 175 | 220 | |
| 176 | 221 |  	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { | 
| 177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); | |
| 178 | - else unset($timediff); | |
| 222 | +	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) { | |
| 223 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); | |
| 224 | +	    	    } else { | |
| 225 | + unset($timediff); | |
| 226 | + } | |
| 179 | 227 |  	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 100 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { | 
| 180 | 228 |  			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { | 
| 181 | 229 |  			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.1)) { | 
| @@ -183,20 +231,30 @@ discard block | ||
| 183 | 231 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; | 
| 184 | 232 | $this->all_tracked[$id]['putinarchive'] = true; | 
| 185 | 233 | |
| 186 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; | |
| 234 | +				if ($globalDebug) { | |
| 235 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; | |
| 236 | + } | |
| 187 | 237 | $timeelapsed = microtime(true); | 
| 188 | 238 | $Tracker = new Tracker($this->db); | 
| 189 | 239 | $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); | 
| 190 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; | |
| 240 | +				if (!empty($all_country)) { | |
| 241 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; | |
| 242 | + } | |
| 191 | 243 | $Tracker->db = null; | 
| 192 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 244 | +				if ($globalDebugTimeElapsed) { | |
| 245 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 246 | + } | |
| 193 | 247 | $this->tmd = 0; | 
| 194 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; | |
| 248 | +				if ($globalDebug) { | |
| 249 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; | |
| 250 | + } | |
| 195 | 251 | } | 
| 196 | 252 | } | 
| 197 | 253 | |
| 198 | 254 |  			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { | 
| 199 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; | |
| 255 | +				if (!isset($this->all_tracked[$id]['archive_latitude'])) { | |
| 256 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; | |
| 257 | + } | |
| 200 | 258 |  				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { | 
| 201 | 259 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; | 
| 202 | 260 | $dataFound = true; | 
| @@ -205,8 +263,12 @@ discard block | ||
| 205 | 263 |  				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); | 
| 206 | 264 | } | 
| 207 | 265 |  			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { | 
| 208 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; | |
| 209 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; | |
| 266 | +			    if ($line['longitude'] > 180) { | |
| 267 | + $line['longitude'] = $line['longitude'] - 360; | |
| 268 | + } | |
| 269 | +				if (!isset($this->all_tracked[$id]['archive_longitude'])) { | |
| 270 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; | |
| 271 | + } | |
| 210 | 272 |  				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { | 
| 211 | 273 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; | 
| 212 | 274 | $dataFound = true; | 
| @@ -226,7 +288,9 @@ discard block | ||
| 226 | 288 | } | 
| 227 | 289 | } | 
| 228 | 290 |  		if (isset($line['last_update']) && $line['last_update'] != '') { | 
| 229 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; | |
| 291 | +		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { | |
| 292 | + $dataFound = true; | |
| 293 | + } | |
| 230 | 294 |  		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); | 
| 231 | 295 | } | 
| 232 | 296 |  		if (isset($line['format_source']) && $line['format_source'] != '') { | 
| @@ -246,7 +310,9 @@ discard block | ||
| 246 | 310 | |
| 247 | 311 |  		if (isset($line['altitude']) && $line['altitude'] != '') { | 
| 248 | 312 |  		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { | 
| 249 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; | |
| 313 | +			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) { | |
| 314 | + $this->all_tracked[$id]['putinarchive'] = true; | |
| 315 | + } | |
| 250 | 316 |  			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); | 
| 251 | 317 |  			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); | 
| 252 | 318 | //$dataFound = true; | 
| @@ -258,15 +324,21 @@ discard block | ||
| 258 | 324 | } | 
| 259 | 325 | |
| 260 | 326 |  		if (isset($line['heading']) && $line['heading'] != '') { | 
| 261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; | |
| 327 | +		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { | |
| 328 | + $this->all_tracked[$id]['putinarchive'] = true; | |
| 329 | + } | |
| 262 | 330 |  		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); | 
| 263 | 331 |  		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); | 
| 264 | 332 | //$dataFound = true; | 
| 265 | 333 |    		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { | 
| 266 | 334 | $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); | 
| 267 | 335 |  		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); | 
| 268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; | |
| 269 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; | |
| 336 | +		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { | |
| 337 | + $this->all_tracked[$id]['putinarchive'] = true; | |
| 338 | + } | |
| 339 | +  		    if ($globalDebug) { | |
| 340 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; | |
| 341 | + } | |
| 270 | 342 | } | 
| 271 | 343 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; | 
| 272 | 344 | |
| @@ -275,20 +347,31 @@ discard block | ||
| 275 | 347 |  		    if ($this->all_tracked[$id]['addedTracker'] == 0) { | 
| 276 | 348 |  		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { | 
| 277 | 349 |  			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { | 
| 278 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; | |
| 350 | +				if ($globalDebug) { | |
| 351 | + echo "Check if aircraft is already in DB..."; | |
| 352 | + } | |
| 279 | 353 | $timeelapsed = microtime(true); | 
| 280 | 354 | $TrackerLive = new TrackerLive($this->db); | 
| 281 | 355 |  				if (isset($line['id'])) { | 
| 282 | 356 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); | 
| 283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 357 | +				    if ($globalDebugTimeElapsed) { | |
| 358 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 359 | + } | |
| 284 | 360 |  				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { | 
| 285 | 361 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); | 
| 286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 287 | - } else $recent_ident = ''; | |
| 362 | +				    if ($globalDebugTimeElapsed) { | |
| 363 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 364 | + } | |
| 365 | +				} else { | |
| 366 | + $recent_ident = ''; | |
| 367 | + } | |
| 288 | 368 | $TrackerLive->db=null; | 
| 289 | 369 | |
| 290 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; | |
| 291 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; | |
| 370 | +				if ($globalDebug && $recent_ident == '') { | |
| 371 | + echo " Not in DB.\n"; | |
| 372 | +				} elseif ($globalDebug && $recent_ident != '') { | |
| 373 | + echo " Already in DB.\n"; | |
| 374 | + } | |
| 292 | 375 |  			    } else { | 
| 293 | 376 | $recent_ident = ''; | 
| 294 | 377 |  				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); | 
| @@ -296,27 +379,41 @@ discard block | ||
| 296 | 379 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive | 
| 297 | 380 | if($recent_ident == "") | 
| 298 | 381 |  			    { | 
| 299 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; | |
| 382 | +				if ($globalDebug) { | |
| 383 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; | |
| 384 | + } | |
| 300 | 385 | //adds the spotter data for the archive | 
| 301 | 386 | $highlight = ''; | 
| 302 | -				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); | |
| 387 | +				    if (!isset($this->all_tracked[$id]['id'])) { | |
| 388 | +				    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); | |
| 389 | + } | |
| 303 | 390 | $timeelapsed = microtime(true); | 
| 304 | 391 | $Tracker = new Tracker($this->db); | 
| 305 | 392 | $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); | 
| 306 | 393 | $Tracker->db = null; | 
| 307 | - if ($globalDebug && isset($result)) echo $result."\n"; | |
| 308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 394 | +				    if ($globalDebug && isset($result)) { | |
| 395 | + echo $result."\n"; | |
| 396 | + } | |
| 397 | +				    if ($globalDebugTimeElapsed) { | |
| 398 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 399 | + } | |
| 309 | 400 | |
| 310 | 401 | |
| 311 | 402 | // Add source stat in DB | 
| 312 | 403 | $Stats = new Stats($this->db); | 
| 313 | 404 |  				    if (!empty($this->stats)) { | 
| 314 | - if ($globalDebug) echo 'Add source stats : '; | |
| 405 | +					if ($globalDebug) { | |
| 406 | + echo 'Add source stats : '; | |
| 407 | + } | |
| 315 | 408 |  				        foreach($this->stats as $date => $data) { | 
| 316 | 409 |  					    foreach($data as $source => $sourced) { | 
| 317 | 410 | //print_r($sourced); | 
| 318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); | |
| 319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); | |
| 411 | +				    	        if (isset($sourced['polar'])) { | |
| 412 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); | |
| 413 | + } | |
| 414 | +				    	        if (isset($sourced['hist'])) { | |
| 415 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); | |
| 416 | + } | |
| 320 | 417 |  				    		if (isset($sourced['msg'])) { | 
| 321 | 418 |  				    		    if (time() - $sourced['msg']['date'] > 10) { | 
| 322 | 419 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); | 
| @@ -329,7 +426,9 @@ discard block | ||
| 329 | 426 | unset($this->stats[$date]); | 
| 330 | 427 | } | 
| 331 | 428 | } | 
| 332 | - if ($globalDebug) echo 'Done'."\n"; | |
| 429 | +				    	if ($globalDebug) { | |
| 430 | + echo 'Done'."\n"; | |
| 431 | + } | |
| 333 | 432 | |
| 334 | 433 | } | 
| 335 | 434 | $Stats->db = null; | 
| @@ -339,12 +438,16 @@ discard block | ||
| 339 | 438 | $this->all_tracked[$id]['addedTracker'] = 1; | 
| 340 | 439 | //print_r($this->all_tracked[$id]); | 
| 341 | 440 |  				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { | 
| 342 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; | |
| 441 | +				    if ($globalDebug) { | |
| 442 | + echo "---- Deleting Live Tracker data older than 9 hours..."; | |
| 443 | + } | |
| 343 | 444 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); | 
| 344 | 445 | $TrackerLive = new TrackerLive($this->db); | 
| 345 | 446 | $TrackerLive->deleteLiveTrackerData(); | 
| 346 | 447 | $TrackerLive->db=null; | 
| 347 | - if ($globalDebug) echo " Done\n"; | |
| 448 | +				    if ($globalDebug) { | |
| 449 | + echo " Done\n"; | |
| 450 | + } | |
| 348 | 451 | $this->last_delete = time(); | 
| 349 | 452 | } | 
| 350 | 453 |  			    } else { | 
| @@ -367,19 +470,25 @@ discard block | ||
| 367 | 470 | |
| 368 | 471 |  		    if (!$ignoreImport) { | 
| 369 | 472 |  			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { | 
| 370 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; | |
| 473 | +				if ($globalDebug) { | |
| 474 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; | |
| 475 | + } | |
| 371 | 476 | $timeelapsed = microtime(true); | 
| 372 | 477 | $TrackerLive = new TrackerLive($this->db); | 
| 373 | 478 | $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); | 
| 374 | 479 | $TrackerLive->db = null; | 
| 375 | 480 | $this->all_tracked[$id]['putinarchive'] = false; | 
| 376 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 481 | +				if ($globalDebugTimeElapsed) { | |
| 482 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; | |
| 483 | + } | |
| 377 | 484 | |
| 378 | 485 | // Put statistics in $this->stats variable | 
| 379 | 486 | |
| 380 | 487 |  				if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { | 
| 381 | 488 | $source = $this->all_tracked[$id]['source_name']; | 
| 382 | - if ($source == '') $source = $this->all_tracked[$id]['format_source']; | |
| 489 | +					if ($source == '') { | |
| 490 | + $source = $this->all_tracked[$id]['format_source']; | |
| 491 | + } | |
| 383 | 492 |  					if (!isset($this->source_location[$source])) { | 
| 384 | 493 | $Location = new Source(); | 
| 385 | 494 | $coord = $Location->getLocationInfobySourceName($source); | 
| @@ -400,7 +509,9 @@ discard block | ||
| 400 | 509 | $stats_heading = round($stats_heading/22.5); | 
| 401 | 510 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); | 
| 402 | 511 |  					$current_date = date('Y-m-d'); | 
| 403 | - if ($stats_heading == 16) $stats_heading = 0; | |
| 512 | +					if ($stats_heading == 16) { | |
| 513 | + $stats_heading = 0; | |
| 514 | + } | |
| 404 | 515 |  					if (!isset($this->stats[$current_date][$source]['polar'][1])) { | 
| 405 | 516 |  						for ($i=0;$i<=15;$i++) { | 
| 406 | 517 | $this->stats[$current_date][$source]['polar'][$i] = 0; | 
| @@ -418,7 +529,9 @@ discard block | ||
| 418 | 529 |  						if (isset($this->stats[$current_date][$source]['hist'][0])) { | 
| 419 | 530 | end($this->stats[$current_date][$source]['hist']); | 
| 420 | 531 | $mini = key($this->stats[$current_date][$source]['hist'])+10; | 
| 421 | - } else $mini = 0; | |
| 532 | +						} else { | |
| 533 | + $mini = 0; | |
| 534 | + } | |
| 422 | 535 |  						for ($i=$mini;$i<=$distance;$i+=10) { | 
| 423 | 536 | $this->stats[$current_date][$source]['hist'][$i] = 0; | 
| 424 | 537 | } | 
| @@ -429,19 +542,29 @@ discard block | ||
| 429 | 542 | } | 
| 430 | 543 | |
| 431 | 544 | $this->all_tracked[$id]['lastupdate'] = time(); | 
| 432 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; | |
| 433 | - if ($globalDebug) echo $result."\n"; | |
| 434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; | |
| 545 | +				if ($this->all_tracked[$id]['putinarchive']) { | |
| 546 | + $send = true; | |
| 547 | + } | |
| 548 | +				if ($globalDebug) { | |
| 549 | + echo $result."\n"; | |
| 550 | + } | |
| 551 | +			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { | |
| 552 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; | |
| 553 | + } | |
| 435 | 554 | //$this->del(); | 
| 436 | 555 | |
| 437 | 556 | |
| 438 | 557 |  			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { | 
| 439 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; | |
| 558 | +			    if ($globalDebug) { | |
| 559 | + echo "---- Deleting Live Tracker data Not updated since 2 hour..."; | |
| 560 | + } | |
| 440 | 561 | $TrackerLive = new TrackerLive($this->db); | 
| 441 | 562 | $TrackerLive->deleteLiveTrackerDataNotUpdated(); | 
| 442 | 563 | $TrackerLive->db = null; | 
| 443 | 564 | //TrackerLive->deleteLiveTrackerData(); | 
| 444 | - if ($globalDebug) echo " Done\n"; | |
| 565 | +			    if ($globalDebug) { | |
| 566 | + echo " Done\n"; | |
| 567 | + } | |
| 445 | 568 | $this->last_delete_hourly = time(); | 
| 446 | 569 | } | 
| 447 | 570 | |
| @@ -449,7 +572,9 @@ discard block | ||
| 449 | 572 | //$ignoreImport = false; | 
| 450 | 573 | } | 
| 451 | 574 |  		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); | 
| 452 | - if ($send) return $this->all_tracked[$id]; | |
| 575 | +		if ($send) { | |
| 576 | + return $this->all_tracked[$id]; | |
| 577 | + } | |
| 453 | 578 | } | 
| 454 | 579 | } | 
| 455 | 580 | } | 
| @@ -46,20 +46,20 @@ discard block | ||
| 46 | 46 | die; | 
| 47 | 47 | } | 
| 48 | 48 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); | 
| 49 | -	$globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); | |
| 49 | +	$globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); | |
| 50 | 50 | } | 
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver')); | |
| 53 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver')); | |
| 54 | 54 | //if (isset($options['s'])) $hosts = array($options['s']); | 
| 55 | 55 | //elseif (isset($options['source'])) $hosts = array($options['source']); | 
| 56 | 56 |  if (isset($options['s'])) { | 
| 57 | 57 | $globalSources = array(); | 
| 58 | -    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); | |
| 58 | +    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']); | |
| 59 | 59 |      else $globalSources[] = array('host' => $options['s']); | 
| 60 | 60 |  } elseif (isset($options['source'])) { | 
| 61 | 61 | $globalSources = array(); | 
| 62 | -    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); | |
| 62 | +    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']); | |
| 63 | 63 |      else $globalSources[] = array('host' => $options['source']); | 
| 64 | 64 | } | 
| 65 | 65 |  if (isset($options['aprsserverhost'])) { | 
| @@ -76,28 +76,28 @@ discard block | ||
| 76 | 76 | else $id_source = 1; | 
| 77 | 77 |  if (isset($globalServer) && $globalServer) { | 
| 78 | 78 | if ($globalDebug) echo "Using Server Mode\n"; | 
| 79 | - $SI=new SpotterServer(); | |
| 79 | + $SI = new SpotterServer(); | |
| 80 | 80 | /* | 
| 81 | 81 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); | 
| 82 | 82 | $SI = new adsb2aprs(); | 
| 83 | 83 | $SI->connect(); | 
| 84 | 84 | */ | 
| 85 | -} else $SI=new SpotterImport($Connection->db); | |
| 85 | +} else $SI = new SpotterImport($Connection->db); | |
| 86 | 86 | if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); | 
| 87 | 87 |  if (isset($globalMarine) && $globalMarine) { | 
| 88 | 88 | $AIS = new AIS(); | 
| 89 | 89 | $MI = new MarineImport($Connection->db); | 
| 90 | 90 | } | 
| 91 | 91 | //$APRS=new APRS($Connection->db); | 
| 92 | -$SBS=new SBS(); | |
| 93 | -$ACARS=new ACARS($Connection->db); | |
| 94 | -$Source=new Source($Connection->db); | |
| 95 | -$Common=new Common(); | |
| 92 | +$SBS = new SBS(); | |
| 93 | +$ACARS = new ACARS($Connection->db); | |
| 94 | +$Source = new Source($Connection->db); | |
| 95 | +$Common = new Common(); | |
| 96 | 96 |  date_default_timezone_set('UTC'); | 
| 97 | 97 |  //$servertz = system('date +%Z'); | 
| 98 | 98 | // signal handler - playing nice with sockets and dump1090 | 
| 99 | 99 |  if (function_exists('pcntl_fork')) { | 
| 100 | -    pcntl_signal(SIGINT,  function() { | |
| 100 | +    pcntl_signal(SIGINT, function() { | |
| 101 | 101 | global $sockets; | 
| 102 | 102 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; | 
| 103 | 103 |          die("Bye!\n"); | 
| @@ -113,30 +113,30 @@ discard block | ||
| 113 | 113 | |
| 114 | 114 |  function connect_all($hosts) { | 
| 115 | 115 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; | 
| 116 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; | |
| 116 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; | |
| 117 | 117 | $reset++; | 
| 118 | 118 | if ($globalDebug) echo 'Connect to all...'."\n"; | 
| 119 | 119 |      foreach ($hosts as $id => $value) { | 
| 120 | 120 | $host = $value['host']; | 
| 121 | 121 | $globalSources[$id]['last_exec'] = 0; | 
| 122 | 122 | // Here we check type of source(s) | 
| 123 | -	if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { | |
| 124 | -            if (preg_match('/deltadb.txt$/i',$host)) { | |
| 123 | +	if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { | |
| 124 | +            if (preg_match('/deltadb.txt$/i', $host)) { | |
| 125 | 125 | //$formats[$id] = 'deltadbtxt'; | 
| 126 | 126 | $globalSources[$id]['format'] = 'deltadbtxt'; | 
| 127 | 127 | //$last_exec['deltadbtxt'] = 0; | 
| 128 | 128 |          	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; | 
| 129 | -            } else if (preg_match('/vatsim-data.txt$/i',$host)) { | |
| 129 | +            } else if (preg_match('/vatsim-data.txt$/i', $host)) { | |
| 130 | 130 | //$formats[$id] = 'vatsimtxt'; | 
| 131 | 131 | $globalSources[$id]['format'] = 'vatsimtxt'; | 
| 132 | 132 | //$last_exec['vatsimtxt'] = 0; | 
| 133 | 133 |          	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; | 
| 134 | -    	    } else if (preg_match('/aircraftlist.json$/i',$host)) { | |
| 134 | +    	    } else if (preg_match('/aircraftlist.json$/i', $host)) { | |
| 135 | 135 | //$formats[$id] = 'aircraftlistjson'; | 
| 136 | 136 | $globalSources[$id]['format'] = 'aircraftlistjson'; | 
| 137 | 137 | //$last_exec['aircraftlistjson'] = 0; | 
| 138 | 138 |          	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; | 
| 139 | -    	    } else if (preg_match('/opensky/i',$host)) { | |
| 139 | +    	    } else if (preg_match('/opensky/i', $host)) { | |
| 140 | 140 | //$formats[$id] = 'aircraftlistjson'; | 
| 141 | 141 | $globalSources[$id]['format'] = 'opensky'; | 
| 142 | 142 | //$last_exec['aircraftlistjson'] = 0; | 
| @@ -153,7 +153,7 @@ discard block | ||
| 153 | 153 | exit(0); | 
| 154 | 154 | } | 
| 155 | 155 | */ | 
| 156 | -    	    } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { | |
| 156 | +    	    } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { | |
| 157 | 157 | //$formats[$id] = 'planeupdatefaa'; | 
| 158 | 158 | $globalSources[$id]['format'] = 'planeupdatefaa'; | 
| 159 | 159 | //$last_exec['planeupdatefaa'] = 0; | 
| @@ -162,29 +162,29 @@ discard block | ||
| 162 | 162 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; | 
| 163 | 163 | exit(0); | 
| 164 | 164 | } | 
| 165 | -            } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { | |
| 165 | +            } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { | |
| 166 | 166 | //$formats[$id] = 'phpvmacars'; | 
| 167 | 167 | $globalSources[$id]['format'] = 'phpvmacars'; | 
| 168 | 168 | //$last_exec['phpvmacars'] = 0; | 
| 169 | 169 |          	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; | 
| 170 | -            } else if (preg_match('/VAM-json.php$/i',$host)) { | |
| 170 | +            } else if (preg_match('/VAM-json.php$/i', $host)) { | |
| 171 | 171 | //$formats[$id] = 'phpvmacars'; | 
| 172 | 172 | $globalSources[$id]['format'] = 'vam'; | 
| 173 | 173 |          	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; | 
| 174 | -            } else if (preg_match('/whazzup/i',$host)) { | |
| 174 | +            } else if (preg_match('/whazzup/i', $host)) { | |
| 175 | 175 | //$formats[$id] = 'whazzup'; | 
| 176 | 176 | $globalSources[$id]['format'] = 'whazzup'; | 
| 177 | 177 | //$last_exec['whazzup'] = 0; | 
| 178 | 178 |          	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; | 
| 179 | -            } else if (preg_match('/airwhere/i',$host)) { | |
| 179 | +            } else if (preg_match('/airwhere/i', $host)) { | |
| 180 | 180 | $globalSources[$id]['format'] = 'airwhere'; | 
| 181 | 181 |          	if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; | 
| 182 | -            } else if (preg_match('/recentpireps/i',$host)) { | |
| 182 | +            } else if (preg_match('/recentpireps/i', $host)) { | |
| 183 | 183 | //$formats[$id] = 'pirepsjson'; | 
| 184 | 184 | $globalSources[$id]['format'] = 'pirepsjson'; | 
| 185 | 185 | //$last_exec['pirepsjson'] = 0; | 
| 186 | 186 |          	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; | 
| 187 | -            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { | |
| 187 | +            } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { | |
| 188 | 188 | //$formats[$id] = 'fr24json'; | 
| 189 | 189 | $globalSources[$id]['format'] = 'fr24json'; | 
| 190 | 190 | //$last_exec['fr24json'] = 0; | 
| @@ -193,7 +193,7 @@ discard block | ||
| 193 | 193 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; | 
| 194 | 194 | exit(0); | 
| 195 | 195 | } | 
| 196 | -            } else if (preg_match(':myshiptracking.com/:i',$host)) { | |
| 196 | +            } else if (preg_match(':myshiptracking.com/:i', $host)) { | |
| 197 | 197 | //$formats[$id] = 'fr24json'; | 
| 198 | 198 | $globalSources[$id]['format'] = 'myshiptracking'; | 
| 199 | 199 | //$last_exec['fr24json'] = 0; | 
| @@ -203,22 +203,22 @@ discard block | ||
| 203 | 203 | exit(0); | 
| 204 | 204 | } | 
| 205 | 205 |              //} else if (preg_match('/10001/',$host)) { | 
| 206 | -            } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { | |
| 206 | +            } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { | |
| 207 | 207 | //$formats[$id] = 'tsv'; | 
| 208 | 208 | $globalSources[$id]['format'] = 'tsv'; | 
| 209 | 209 |          	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; | 
| 210 | 210 | } | 
| 211 | -        } elseif (filter_var($host,FILTER_VALIDATE_URL)) { | |
| 211 | +        } elseif (filter_var($host, FILTER_VALIDATE_URL)) { | |
| 212 | 212 |      		if ($globalSources[$id]['format'] == 'aisnmeahttp') { | 
| 213 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); | |
| 213 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); | |
| 214 | 214 |      		    if ($idf !== false) { | 
| 215 | 215 | $httpfeeds[$id] = $idf; | 
| 216 | 216 |          		if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; | 
| 217 | 217 | } | 
| 218 | 218 | elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; | 
| 219 | 219 |      		} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; | 
| 220 | -        } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { | |
| 221 | -	    $hostport = explode(':',$host); | |
| 220 | +        } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { | |
| 221 | +	    $hostport = explode(':', $host); | |
| 222 | 222 |  	    if (isset($hostport[1])) { | 
| 223 | 223 | $port = $hostport[1]; | 
| 224 | 224 | $hostn = $hostport[0]; | 
| @@ -228,19 +228,19 @@ discard block | ||
| 228 | 228 | } | 
| 229 | 229 | $Common = new Common(); | 
| 230 | 230 |  	    if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { | 
| 231 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); | |
| 231 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); | |
| 232 | 232 |      	    } else { | 
| 233 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); | |
| 233 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); | |
| 234 | 234 | } | 
| 235 | 235 |  	    if ($s) { | 
| 236 | 236 | $sockets[$id] = $s; | 
| 237 | 237 |      	        if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { | 
| 238 | -		    if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { | |
| 238 | +		    if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { | |
| 239 | 239 | //$formats[$id] = 'aprs'; | 
| 240 | 240 | $globalSources[$id]['format'] = 'aprs'; | 
| 241 | 241 | //$aprs_connect = 0; | 
| 242 | 242 | //$use_aprs = true; | 
| 243 | -		    } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { | |
| 243 | +		    } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { | |
| 244 | 244 | $globalSources[$id]['format'] = 'vrstcp'; | 
| 245 | 245 |      		    } elseif ($port == '10001') { | 
| 246 | 246 | //$formats[$id] = 'tsv'; | 
| @@ -279,7 +279,7 @@ discard block | ||
| 279 | 279 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; | 
| 280 | 280 | else $timeout = 20; | 
| 281 | 281 | $errno = ''; | 
| 282 | -$errstr=''; | |
| 282 | +$errstr = ''; | |
| 283 | 283 | |
| 284 | 284 | if (!isset($globalDaemon)) $globalDaemon = TRUE; | 
| 285 | 285 | /* Initiate connections to all the hosts simultaneously */ | 
| @@ -287,7 +287,7 @@ discard block | ||
| 287 | 287 | //connect_all($globalSources); | 
| 288 | 288 | |
| 289 | 289 |  if (isset($globalProxy) && $globalProxy) { | 
| 290 | -    $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); | |
| 290 | +    $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); | |
| 291 | 291 |  } else { | 
| 292 | 292 |      $context = stream_context_create(array('http' => array('timeout' => $timeout))); | 
| 293 | 293 | } | 
| @@ -317,16 +317,16 @@ discard block | ||
| 317 | 317 | |
| 318 | 318 |  if ($use_aprs) { | 
| 319 | 319 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); | 
| 320 | - $APRS=new APRS(); | |
| 320 | + $APRS = new APRS(); | |
| 321 | 321 | $aprs_connect = 0; | 
| 322 | 322 | $aprs_keep = 120; | 
| 323 | 323 | $aprs_last_tx = time(); | 
| 324 | 324 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; | 
| 325 | -	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); | |
| 325 | +	else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); | |
| 326 | 326 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; | 
| 327 | -	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); | |
| 327 | +	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); | |
| 328 | 328 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; | 
| 329 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; | |
| 329 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; | |
| 330 | 330 | if ($aprs_full) $aprs_filter = ''; | 
| 331 | 331 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; | 
| 332 | 332 | else $aprs_pass = '-1'; | 
| @@ -340,12 +340,12 @@ discard block | ||
| 340 | 340 | sleep(1); | 
| 341 | 341 | if ($globalDebug) echo "SCAN MODE \n\n"; | 
| 342 | 342 | if (!isset($globalCronEnd)) $globalCronEnd = 60; | 
| 343 | -$endtime = time()+$globalCronEnd; | |
| 343 | +$endtime = time() + $globalCronEnd; | |
| 344 | 344 | $i = 1; | 
| 345 | 345 | $tt = array(); | 
| 346 | 346 | // Delete all ATC | 
| 347 | 347 |  if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { | 
| 348 | - $ATC=new ATC($Connection->db); | |
| 348 | + $ATC = new ATC($Connection->db); | |
| 349 | 349 | } | 
| 350 | 350 |  if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { | 
| 351 | 351 | $ATC->deleteAll(); | 
| @@ -353,7 +353,7 @@ discard block | ||
| 353 | 353 | |
| 354 | 354 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. | 
| 355 | 355 |  while ($i > 0) { | 
| 356 | - if (!$globalDaemon) $i = $endtime-time(); | |
| 356 | + if (!$globalDaemon) $i = $endtime - time(); | |
| 357 | 357 | // Delete old ATC | 
| 358 | 358 |      if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { | 
| 359 | 359 | if ($globalDebug) echo 'Delete old ATC...'."\n"; | 
| @@ -367,7 +367,7 @@ discard block | ||
| 367 | 367 | } | 
| 368 | 368 |  	if ($max != $globalMinFetch) { | 
| 369 | 369 | if ($globalDebug) echo 'Sleeping...'."\n"; | 
| 370 | - sleep($globalMinFetch-$max+2); | |
| 370 | + sleep($globalMinFetch - $max + 2); | |
| 371 | 371 | } | 
| 372 | 372 | } | 
| 373 | 373 | |
| @@ -380,8 +380,8 @@ discard block | ||
| 380 | 380 | //$buffer = $Common->getData($hosts[$id]); | 
| 381 | 381 | $buffer = $Common->getData($value['host']); | 
| 382 | 382 | if ($buffer != '') $reset = 0; | 
| 383 | -    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); | |
| 384 | -	    $buffer = explode('\n',$buffer); | |
| 383 | +    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); | |
| 384 | +	    $buffer = explode('\n', $buffer); | |
| 385 | 385 |  	    foreach ($buffer as $line) { | 
| 386 | 386 |      		if ($line != '' && count($line) > 7) { | 
| 387 | 387 |      		    $line = explode(',', $line); | 
| @@ -409,11 +409,11 @@ discard block | ||
| 409 | 409 | $last_exec[$id]['last'] = time(); | 
| 410 | 410 |  	} elseif ($value['format'] == 'aisnmeatxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { | 
| 411 | 411 |  	    date_default_timezone_set('CET'); | 
| 412 | -	    $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); | |
| 412 | +	    $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); | |
| 413 | 413 |  	    date_default_timezone_set('UTC'); | 
| 414 | 414 | if ($buffer != '') $reset = 0; | 
| 415 | -    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); | |
| 416 | -	    $buffer = explode('\n',$buffer); | |
| 415 | +    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); | |
| 416 | +	    $buffer = explode('\n', $buffer); | |
| 417 | 417 |  	    foreach ($buffer as $line) { | 
| 418 | 418 |  		if ($line != '') { | 
| 419 | 419 | //echo "'".$line."'\n"; | 
| @@ -431,7 +431,7 @@ discard block | ||
| 431 | 431 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; | 
| 432 | 432 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; | 
| 433 | 433 |  		    if (isset($ais_data['timestamp'])) { | 
| 434 | -			$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); | |
| 434 | +			$data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); | |
| 435 | 435 |  			if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { | 
| 436 | 436 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; | 
| 437 | 437 | $add = true; | 
| @@ -454,12 +454,12 @@ discard block | ||
| 454 | 454 | $w = $e = null; | 
| 455 | 455 | |
| 456 | 456 |  	    if (isset($arr[$id])) { | 
| 457 | - $nn = stream_select($arr,$w,$e,$timeout); | |
| 457 | + $nn = stream_select($arr, $w, $e, $timeout); | |
| 458 | 458 |  		if ($nn > 0) { | 
| 459 | 459 |  		    foreach ($httpfeeds as $feed) { | 
| 460 | - $buffer = stream_get_line($feed,2000,"\n"); | |
| 461 | -			$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); | |
| 462 | -			$buffer = explode('\n',$buffer); | |
| 460 | + $buffer = stream_get_line($feed, 2000, "\n"); | |
| 461 | +			$buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); | |
| 462 | +			$buffer = explode('\n', $buffer); | |
| 463 | 463 |  			foreach ($buffer as $line) { | 
| 464 | 464 |  			    if ($line != '') { | 
| 465 | 465 | $ais_data = $AIS->parse_line(trim($line)); | 
| @@ -477,9 +477,9 @@ discard block | ||
| 477 | 477 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; | 
| 478 | 478 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; | 
| 479 | 479 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; | 
| 480 | -				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); | |
| 480 | +				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); | |
| 481 | 481 |  				if (isset($ais_data['timestamp'])) { | 
| 482 | -				    $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); | |
| 482 | +				    $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); | |
| 483 | 483 |  				} else { | 
| 484 | 484 |  				    $data['datetime'] = date('Y-m-d H:i:s'); | 
| 485 | 485 | } | 
| @@ -505,10 +505,10 @@ discard block | ||
| 505 | 505 | } | 
| 506 | 506 | } | 
| 507 | 507 |  	} elseif ($value['format'] == 'myshiptracking' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { | 
| 508 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); | |
| 508 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); | |
| 509 | 509 |  	    if ($buffer != '') { | 
| 510 | 510 | //echo $buffer; | 
| 511 | - $all_data = json_decode($buffer,true); | |
| 511 | + $all_data = json_decode($buffer, true); | |
| 512 | 512 | //print_r($all_data); | 
| 513 | 513 |  		if (isset($all_data[0]['DATA'])) { | 
| 514 | 514 |  		    foreach ($all_data[0]['DATA'] as $line) { | 
| @@ -523,7 +523,7 @@ discard block | ||
| 523 | 523 | // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; | 
| 524 | 524 | $data['imo'] = $line['IMO']; | 
| 525 | 525 | //$data['arrival_code'] = $ais_data['destination']; | 
| 526 | -			    $data['datetime'] = date('Y-m-d H:i:s',$line['T']); | |
| 526 | +			    $data['datetime'] = date('Y-m-d H:i:s', $line['T']); | |
| 527 | 527 | $data['format_source'] = 'myshiptracking'; | 
| 528 | 528 | $data['id_source'] = $id_source; | 
| 529 | 529 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | 
| @@ -535,9 +535,9 @@ discard block | ||
| 535 | 535 | } | 
| 536 | 536 | $last_exec[$id]['last'] = time(); | 
| 537 | 537 |  	} elseif ($value['format'] == 'boatbeaconapp' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { | 
| 538 | -	    $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); | |
| 538 | +	    $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); | |
| 539 | 539 |  	    if ($buffer != '') { | 
| 540 | - $all_data = json_decode($buffer,true); | |
| 540 | + $all_data = json_decode($buffer, true); | |
| 541 | 541 |  		if (isset($all_data[0]['mmsi'])) { | 
| 542 | 542 |  		    foreach ($all_data as $line) { | 
| 543 | 543 |  			if ($line != '') { | 
| @@ -566,7 +566,7 @@ discard block | ||
| 566 | 566 |  	} elseif ($value['format'] == 'boatnerd' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { | 
| 567 | 567 | $buffer = $Common->getData($value['host']); | 
| 568 | 568 |  	    if ($buffer != '') { | 
| 569 | - $all_data = json_decode($buffer,true); | |
| 569 | + $all_data = json_decode($buffer, true); | |
| 570 | 570 |  		if (isset($all_data['features'][0]['id'])) { | 
| 571 | 571 |  		    foreach ($all_data['features'] as $line) { | 
| 572 | 572 | $data = array(); | 
| @@ -594,27 +594,27 @@ discard block | ||
| 594 | 594 | $last_exec[$id]['last'] = time(); | 
| 595 | 595 |  	} elseif ($value['format'] == 'shipplotter' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { | 
| 596 | 596 | echo 'download...'; | 
| 597 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); | |
| 597 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); | |
| 598 | 598 | echo 'done !'."\n"; | 
| 599 | 599 | if ($buffer != '') $reset = 0; | 
| 600 | -    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); | |
| 601 | -	    $buffer = explode('\n',$buffer); | |
| 600 | +    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); | |
| 601 | +	    $buffer = explode('\n', $buffer); | |
| 602 | 602 |  	    foreach ($buffer as $line) { | 
| 603 | 603 |  		if ($line != '') { | 
| 604 | 604 | $data = array(); | 
| 605 | - $data['mmsi'] = (int)substr($line,0,9); | |
| 606 | -		    $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); | |
| 605 | + $data['mmsi'] = (int) substr($line, 0, 9); | |
| 606 | +		    $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); | |
| 607 | 607 | //$data['status'] = substr($line,21,2); | 
| 608 | 608 | //$data['type'] = substr($line,24,3); | 
| 609 | - $data['latitude'] = substr($line,29,9); | |
| 610 | - $data['longitude'] = substr($line,41,9); | |
| 611 | - $data['speed'] = round(substr($line,51,5)); | |
| 609 | + $data['latitude'] = substr($line, 29, 9); | |
| 610 | + $data['longitude'] = substr($line, 41, 9); | |
| 611 | + $data['speed'] = round(substr($line, 51, 5)); | |
| 612 | 612 | //$data['course'] = substr($line,57,5); | 
| 613 | - $data['heading'] = round(substr($line,63,3)); | |
| 613 | + $data['heading'] = round(substr($line, 63, 3)); | |
| 614 | 614 | //$data['draft'] = substr($line,67,4); | 
| 615 | 615 | //$data['length'] = substr($line,72,3); | 
| 616 | 616 | //$data['beam'] = substr($line,76,2); | 
| 617 | - $data['ident'] = trim(utf8_encode(substr($line,79,20))); | |
| 617 | + $data['ident'] = trim(utf8_encode(substr($line, 79, 20))); | |
| 618 | 618 | //$data['callsign'] = trim(substr($line,100,7); | 
| 619 | 619 | //$data['dest'] = substr($line,108,20); | 
| 620 | 620 | //$data['etaDate'] = substr($line,129,5); | 
| @@ -633,8 +633,8 @@ discard block | ||
| 633 | 633 |  	} elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) { | 
| 634 | 634 | //$buffer = $Common->getData($hosts[$id]); | 
| 635 | 635 | $buffer = $Common->getData($value['host']); | 
| 636 | -    	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); | |
| 637 | -	    $buffer = explode('\n',$buffer); | |
| 636 | +    	    $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); | |
| 637 | +	    $buffer = explode('\n', $buffer); | |
| 638 | 638 | $reset = 0; | 
| 639 | 639 |  	    foreach ($buffer as $line) { | 
| 640 | 640 |      		if ($line != '') { | 
| @@ -645,7 +645,7 @@ discard block | ||
| 645 | 645 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; | 
| 646 | 646 | $data['pilot_id'] = $line[1]; | 
| 647 | 647 | $data['pilot_name'] = $line[2]; | 
| 648 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); | |
| 648 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); | |
| 649 | 649 | $data['ident'] = $line[0]; // ident | 
| 650 | 650 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude | 
| 651 | 651 | $data['speed'] = $line[8]; // speed | 
| @@ -661,7 +661,7 @@ discard block | ||
| 661 | 661 |  			//$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); | 
| 662 | 662 | //if (isset($line[37])) $data['last_update'] = $line[37]; | 
| 663 | 663 | $data['departure_airport_icao'] = $line[11]; | 
| 664 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); | |
| 664 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); | |
| 665 | 665 | $data['arrival_airport_icao'] = $line[13]; | 
| 666 | 666 | $data['frequency'] = $line[4]; | 
| 667 | 667 | $data['type'] = $line[18]; | 
| @@ -670,7 +670,7 @@ discard block | ||
| 670 | 670 | $data['id_source'] = $id_source; | 
| 671 | 671 | //$data['arrival_airport_time'] = ; | 
| 672 | 672 |  	    		if ($line[9] != '') { | 
| 673 | -	    		    $aircraft_data = explode('/',$line[9]); | |
| 673 | +	    		    $aircraft_data = explode('/', $line[9]); | |
| 674 | 674 |  	    		    if (isset($aircraft_data[1])) { | 
| 675 | 675 | $data['aircraft_icao'] = $aircraft_data[1]; | 
| 676 | 676 | } | 
| @@ -685,9 +685,9 @@ discard block | ||
| 685 | 685 | if ($line[3] == 'PILOT') $SI->add($data); | 
| 686 | 686 |  			elseif ($line[3] == 'ATC') { | 
| 687 | 687 | //print_r($data); | 
| 688 | -				$data['info'] = str_replace('^§','<br />',$data['info']); | |
| 689 | -				$data['info'] = str_replace('&sect;','',$data['info']); | |
| 690 | - $typec = substr($data['ident'],-3); | |
| 688 | +				$data['info'] = str_replace('^§', '<br />', $data['info']); | |
| 689 | +				$data['info'] = str_replace('&sect;', '', $data['info']); | |
| 690 | + $typec = substr($data['ident'], -3); | |
| 691 | 691 | if ($typec == 'APP') $data['type'] = 'Approach'; | 
| 692 | 692 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; | 
| 693 | 693 | elseif ($typec == 'OBS') $data['type'] = 'Observer'; | 
| @@ -699,8 +699,8 @@ discard block | ||
| 699 | 699 | elseif ($data['type'] == '') $data['type'] = 'Observer'; | 
| 700 | 700 | if (!isset($data['source_name'])) $data['source_name'] = ''; | 
| 701 | 701 |  				if (isset($ATC)) { | 
| 702 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); | |
| 703 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); | |
| 702 | + if (count($ATC->getByIdent($data['ident'], $data['format_source'])) > 0) echo $ATC->update($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); | |
| 703 | + else echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); | |
| 704 | 704 | } | 
| 705 | 705 | } | 
| 706 | 706 | unset($data); | 
| @@ -711,24 +711,24 @@ discard block | ||
| 711 | 711 | //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); | 
| 712 | 712 | $last_exec[$id]['last'] = time(); | 
| 713 | 713 |      	} elseif ($value['format'] == 'airwhere' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { | 
| 714 | -	    $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); | |
| 714 | +	    $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20'); | |
| 715 | 715 |  	    if ($buffer != '') { | 
| 716 | 716 | $all_data = simplexml_load_string($buffer); | 
| 717 | -		foreach($all_data->children() as $childdata) { | |
| 717 | +		foreach ($all_data->children() as $childdata) { | |
| 718 | 718 | $data = array(); | 
| 719 | 719 | $line = $childdata; | 
| 720 | 720 | //$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT); | 
| 721 | -			$data['id'] = date('Ymd').(int)$line['pktPilotID']; | |
| 722 | -			$data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); | |
| 723 | - $data['latitude'] = (float)$line['pktLatitude']; | |
| 724 | - $data['longitude'] = (float)$line['pktLongitude']; | |
| 725 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; | |
| 726 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; | |
| 727 | - $data['altitude'] = round((int)$line['pktAltitude']*3.28084); | |
| 721 | +			$data['id'] = date('Ymd').(int) $line['pktPilotID']; | |
| 722 | +			$data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST')); | |
| 723 | + $data['latitude'] = (float) $line['pktLatitude']; | |
| 724 | + $data['longitude'] = (float) $line['pktLongitude']; | |
| 725 | + if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack']; | |
| 726 | + if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed']; | |
| 727 | + $data['altitude'] = round((int) $line['pktAltitude']*3.28084); | |
| 728 | 728 | $data['altitude_relative'] = 'AMSL'; | 
| 729 | - $data['pilot_id'] = (int)$line['pktPilotID']; | |
| 729 | + $data['pilot_id'] = (int) $line['pktPilotID']; | |
| 730 | 730 | $data['aircraft_icao'] = 'PARAGLIDER'; | 
| 731 | -			$pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); | |
| 731 | +			$pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); | |
| 732 | 732 | if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; | 
| 733 | 733 | $data['format_source'] = $value['format']; | 
| 734 | 734 | $SI->add($data); | 
| @@ -736,31 +736,31 @@ discard block | ||
| 736 | 736 | } | 
| 737 | 737 | } | 
| 738 | 738 |  	    $Source->deleteOldLocationByType('gs'); | 
| 739 | -	    $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); | |
| 739 | +	    $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20'); | |
| 740 | 740 |  	    if ($buffer != '') { | 
| 741 | 741 | $all_data = simplexml_load_string($buffer); | 
| 742 | -		foreach($all_data->children() as $childdata) { | |
| 742 | +		foreach ($all_data->children() as $childdata) { | |
| 743 | 743 | $data = array(); | 
| 744 | 744 | $line = $childdata; | 
| 745 | - $data['id'] = (int)$line['gsID']; | |
| 746 | - $data['latitude'] = (float)$line['gsLatitude']; | |
| 747 | - $data['longitude'] = (float)$line['gsLongitude']; | |
| 748 | - $data['altitude'] = round((int)$line['gsHeight']*3.28084); | |
| 745 | + $data['id'] = (int) $line['gsID']; | |
| 746 | + $data['latitude'] = (float) $line['gsLatitude']; | |
| 747 | + $data['longitude'] = (float) $line['gsLongitude']; | |
| 748 | + $data['altitude'] = round((int) $line['gsHeight']*3.28084); | |
| 749 | 749 | $data['altitude_relative'] = 'AMSL'; | 
| 750 | -			$data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST')); | |
| 750 | +			$data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST')); | |
| 751 | 751 |  			if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) { | 
| 752 | -				$Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); | |
| 752 | +				$Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); | |
| 753 | 753 |  			} else { | 
| 754 | -				$Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); | |
| 754 | +				$Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); | |
| 755 | 755 | } | 
| 756 | 756 | unset($data); | 
| 757 | 757 | } | 
| 758 | 758 | } | 
| 759 | 759 | $last_exec[$id]['last'] = time(); | 
| 760 | 760 |  	} elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { | 
| 761 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); | |
| 761 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); | |
| 762 | 762 |  	    if ($buffer != '') { | 
| 763 | - $all_data = json_decode($buffer,true); | |
| 763 | + $all_data = json_decode($buffer, true); | |
| 764 | 764 |  	    if (isset($all_data['acList'])) { | 
| 765 | 765 | $reset = 0; | 
| 766 | 766 |  		foreach ($all_data['acList'] as $line) { | 
| @@ -777,7 +777,7 @@ discard block | ||
| 777 | 777 | $data['emergency'] = ''; // emergency | 
| 778 | 778 | if (isset($line['Reg'])) $data['registration'] = $line['Reg']; | 
| 779 | 779 | |
| 780 | -		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); | |
| 780 | +		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); | |
| 781 | 781 |  		    else $data['datetime'] = date('Y-m-d H:i:s'); | 
| 782 | 782 | |
| 783 | 783 |  		    //$data['datetime'] = date('Y-m-d H:i:s'); | 
| @@ -803,7 +803,7 @@ discard block | ||
| 803 | 803 | $data['verticalrate'] = $line['vrt']; // verticale rate | 
| 804 | 804 | $data['squawk'] = $line['squawk']; // squawk | 
| 805 | 805 | $data['emergency'] = ''; // emergency | 
| 806 | -		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); | |
| 806 | +		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); | |
| 807 | 807 |  		    else $data['datetime'] = date('Y-m-d H:i:s'); | 
| 808 | 808 | $data['format_source'] = 'aircraftlistjson'; | 
| 809 | 809 | $data['id_source'] = $id_source; | 
| @@ -819,7 +819,7 @@ discard block | ||
| 819 | 819 |      	//} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { | 
| 820 | 820 |      	} elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { | 
| 821 | 821 | $buffer = $Common->getData($value['host']); | 
| 822 | - $all_data = json_decode($buffer,true); | |
| 822 | + $all_data = json_decode($buffer, true); | |
| 823 | 823 |  	    if (isset($all_data['planes'])) { | 
| 824 | 824 | $reset = 0; | 
| 825 | 825 |  		foreach ($all_data['planes'] as $key => $line) { | 
| @@ -836,12 +836,12 @@ discard block | ||
| 836 | 836 | $data['emergency'] = ''; // emergency | 
| 837 | 837 | $data['registration'] = $line[2]; | 
| 838 | 838 | $data['aircraft_icao'] = $line[0]; | 
| 839 | -		    $deparr = explode('-',$line[1]); | |
| 839 | +		    $deparr = explode('-', $line[1]); | |
| 840 | 840 |  		    if (count($deparr) == 2) { | 
| 841 | 841 | $data['departure_airport_icao'] = $deparr[0]; | 
| 842 | 842 | $data['arrival_airport_icao'] = $deparr[1]; | 
| 843 | 843 | } | 
| 844 | -		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]); | |
| 844 | +		    $data['datetime'] = date('Y-m-d H:i:s', $line[9]); | |
| 845 | 845 | $data['format_source'] = 'planeupdatefaa'; | 
| 846 | 846 | $data['id_source'] = $id_source; | 
| 847 | 847 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | 
| @@ -854,7 +854,7 @@ discard block | ||
| 854 | 854 | $last_exec[$id]['last'] = time(); | 
| 855 | 855 |      	} elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { | 
| 856 | 856 | $buffer = $Common->getData($value['host']); | 
| 857 | - $all_data = json_decode($buffer,true); | |
| 857 | + $all_data = json_decode($buffer, true); | |
| 858 | 858 |  	    if (isset($all_data['states'])) { | 
| 859 | 859 | $reset = 0; | 
| 860 | 860 |  		foreach ($all_data['states'] as $key => $line) { | 
| @@ -871,7 +871,7 @@ discard block | ||
| 871 | 871 | //$data['emergency'] = ''; // emergency | 
| 872 | 872 | //$data['registration'] = $line[2]; | 
| 873 | 873 | //$data['aircraft_icao'] = $line[0]; | 
| 874 | -		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]); | |
| 874 | +		    $data['datetime'] = date('Y-m-d H:i:s', $line[3]); | |
| 875 | 875 | $data['format_source'] = 'opensky'; | 
| 876 | 876 | $data['id_source'] = $id_source; | 
| 877 | 877 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | 
| @@ -885,7 +885,7 @@ discard block | ||
| 885 | 885 |      	} elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { | 
| 886 | 886 | //$buffer = $Common->getData($hosts[$id]); | 
| 887 | 887 | $buffer = $Common->getData($value['host']); | 
| 888 | - $all_data = json_decode($buffer,true); | |
| 888 | + $all_data = json_decode($buffer, true); | |
| 889 | 889 | if (!empty($all_data)) $reset = 0; | 
| 890 | 890 |  	    foreach ($all_data as $key => $line) { | 
| 891 | 891 |  		if ($key != 'full_count' && $key != 'version' && $key != 'stats') { | 
| @@ -918,11 +918,11 @@ discard block | ||
| 918 | 918 |      	//} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { | 
| 919 | 919 |      	} elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { | 
| 920 | 920 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); | 
| 921 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); | |
| 921 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); | |
| 922 | 922 | //echo $buffer; | 
| 923 | -	    $buffer = str_replace(array("\n","\r"),"",$buffer); | |
| 924 | -	    $buffer = preg_replace('/,"num":(.+)/','}',$buffer); | |
| 925 | - $all_data = json_decode($buffer,true); | |
| 923 | +	    $buffer = str_replace(array("\n", "\r"), "", $buffer); | |
| 924 | +	    $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); | |
| 925 | + $all_data = json_decode($buffer, true); | |
| 926 | 926 |  	    if (json_last_error() != JSON_ERROR_NONE) { | 
| 927 | 927 | die(json_last_error_msg()); | 
| 928 | 928 | } | 
| @@ -945,7 +945,7 @@ discard block | ||
| 945 | 945 | //$data['departure_airport_iata'] = $line[11]; | 
| 946 | 946 | //$data['arrival_airport_iata'] = $line[12]; | 
| 947 | 947 | //$data['emergency'] = ''; // emergency | 
| 948 | -			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] | |
| 948 | +			$data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] | |
| 949 | 949 | $data['format_source'] = 'radarvirtueljson'; | 
| 950 | 950 | $data['id_source'] = $id_source; | 
| 951 | 951 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | 
| @@ -961,14 +961,14 @@ discard block | ||
| 961 | 961 |      	} elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { | 
| 962 | 962 | //$buffer = $Common->getData($hosts[$id]); | 
| 963 | 963 | $buffer = $Common->getData($value['host'].'?'.time()); | 
| 964 | - $all_data = json_decode(utf8_encode($buffer),true); | |
| 964 | + $all_data = json_decode(utf8_encode($buffer), true); | |
| 965 | 965 | |
| 966 | 966 |  	    if (isset($all_data['pireps'])) { | 
| 967 | 967 | $reset = 0; | 
| 968 | 968 |  	        foreach ($all_data['pireps'] as $line) { | 
| 969 | 969 | $data = array(); | 
| 970 | 970 | $data['id'] = $line['id']; | 
| 971 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); | |
| 971 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); | |
| 972 | 972 | $data['ident'] = $line['callsign']; // ident | 
| 973 | 973 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id | 
| 974 | 974 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name | 
| @@ -998,9 +998,9 @@ discard block | ||
| 998 | 998 | $SI->add($data); | 
| 999 | 999 | // print_r($data); | 
| 1000 | 1000 |      		    } elseif ($line['icon'] == 'ct') { | 
| 1001 | -			$data['info'] = str_replace('^§','<br />',$data['info']); | |
| 1002 | -			$data['info'] = str_replace('&sect;','',$data['info']); | |
| 1003 | - $typec = substr($data['ident'],-3); | |
| 1001 | +			$data['info'] = str_replace('^§', '<br />', $data['info']); | |
| 1002 | +			$data['info'] = str_replace('&sect;', '', $data['info']); | |
| 1003 | + $typec = substr($data['ident'], -3); | |
| 1004 | 1004 | $data['type'] = ''; | 
| 1005 | 1005 | if ($typec == 'APP') $data['type'] = 'Approach'; | 
| 1006 | 1006 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; | 
| @@ -1011,7 +1011,7 @@ discard block | ||
| 1011 | 1011 | elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; | 
| 1012 | 1012 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; | 
| 1013 | 1013 | else $data['type'] = 'Observer'; | 
| 1014 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); | |
| 1014 | + if (isset($ATC)) echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']); | |
| 1015 | 1015 | } | 
| 1016 | 1016 | unset($data); | 
| 1017 | 1017 | } | 
| @@ -1023,14 +1023,14 @@ discard block | ||
| 1023 | 1023 | //$buffer = $Common->getData($hosts[$id]); | 
| 1024 | 1024 | if ($globalDebug) echo 'Get Data...'."\n"; | 
| 1025 | 1025 | $buffer = $Common->getData($value['host']); | 
| 1026 | - $all_data = json_decode($buffer,true); | |
| 1026 | + $all_data = json_decode($buffer, true); | |
| 1027 | 1027 |  	    if ($buffer != '' && is_array($all_data)) { | 
| 1028 | 1028 | $reset = 0; | 
| 1029 | 1029 |  		foreach ($all_data as $line) { | 
| 1030 | 1030 | $data = array(); | 
| 1031 | 1031 | //$data['id'] = $line['id']; // id not usable | 
| 1032 | 1032 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; | 
| 1033 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex | |
| 1033 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex | |
| 1034 | 1034 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; | 
| 1035 | 1035 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; | 
| 1036 | 1036 | $data['ident'] = $line['flightnum']; // ident | 
| @@ -1045,7 +1045,7 @@ discard block | ||
| 1045 | 1045 | //$data['datetime'] = $line['lastupdate']; | 
| 1046 | 1046 | //$data['last_update'] = $line['lastupdate']; | 
| 1047 | 1047 |  	    	    if (isset($value['timezone'])) { | 
| 1048 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); | |
| 1048 | + $datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone'])); | |
| 1049 | 1049 |  	    		$datetime->setTimeZone(new DateTimeZone('UTC')); | 
| 1050 | 1050 |  	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s'); | 
| 1051 | 1051 |  	    	    } else $data['datetime'] = date('Y-m-d H:i:s'); | 
| @@ -1058,14 +1058,14 @@ discard block | ||
| 1058 | 1058 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route | 
| 1059 | 1059 |  		    if (isset($line['aircraftname'])) { | 
| 1060 | 1060 | $line['aircraftname'] = strtoupper($line['aircraftname']); | 
| 1061 | -			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); | |
| 1062 | -	    		$aircraft_data = explode('-',$line['aircraftname']); | |
| 1061 | +			$line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); | |
| 1062 | +	    		$aircraft_data = explode('-', $line['aircraftname']); | |
| 1063 | 1063 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; | 
| 1064 | 1064 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; | 
| 1065 | 1065 |  	    		else { | 
| 1066 | -	    		    $aircraft_data = explode(' ',$line['aircraftname']); | |
| 1067 | -	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); | |
| 1068 | -	    		    else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); | |
| 1066 | +	    		    $aircraft_data = explode(' ', $line['aircraftname']); | |
| 1067 | +	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); | |
| 1068 | +	    		    else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); | |
| 1069 | 1069 | } | 
| 1070 | 1070 | } | 
| 1071 | 1071 | if (isset($line['route'])) $data['waypoints'] = $line['route']; | 
| @@ -1085,14 +1085,14 @@ discard block | ||
| 1085 | 1085 | //$buffer = $Common->getData($hosts[$id]); | 
| 1086 | 1086 | if ($globalDebug) echo 'Get Data...'."\n"; | 
| 1087 | 1087 | $buffer = $Common->getData($value['host']); | 
| 1088 | - $all_data = json_decode($buffer,true); | |
| 1088 | + $all_data = json_decode($buffer, true); | |
| 1089 | 1089 |  	    if ($buffer != '' && is_array($all_data)) { | 
| 1090 | 1090 | $reset = 0; | 
| 1091 | 1091 |  		foreach ($all_data as $line) { | 
| 1092 | 1092 | $data = array(); | 
| 1093 | 1093 | //$data['id'] = $line['id']; // id not usable | 
| 1094 | 1094 | $data['id'] = trim($line['flight_id']); | 
| 1095 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex | |
| 1095 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex | |
| 1096 | 1096 | $data['pilot_name'] = $line['pilot_name']; | 
| 1097 | 1097 | $data['pilot_id'] = $line['pilot_id']; | 
| 1098 | 1098 | $data['ident'] = trim($line['callsign']); // ident | 
| @@ -1144,11 +1144,11 @@ discard block | ||
| 1144 | 1144 | //$value = $formats[$nb]; | 
| 1145 | 1145 | $format = $globalSources[$nb]['format']; | 
| 1146 | 1146 |  		    if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { | 
| 1147 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); | |
| 1147 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); | |
| 1148 | 1148 |  		    } elseif ($format == 'vrstcp') { | 
| 1149 | 1149 | $buffer = @socket_read($r, 6000); | 
| 1150 | 1150 |  		    } else { | 
| 1151 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); | |
| 1151 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); | |
| 1152 | 1152 | } | 
| 1153 | 1153 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); | 
| 1154 | 1154 | //echo $buffer."\n"; | 
| @@ -1157,8 +1157,8 @@ discard block | ||
| 1157 | 1157 | $error = false; | 
| 1158 | 1158 | //$SI::del(); | 
| 1159 | 1159 |  		    if ($format == 'vrstcp') { | 
| 1160 | -			$buffer = explode('},{',$buffer); | |
| 1161 | -		    } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); | |
| 1160 | +			$buffer = explode('},{', $buffer); | |
| 1161 | +		    } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); | |
| 1162 | 1162 | // SBS format is CSV format | 
| 1163 | 1163 |  		    if ($buffer !== FALSE && $buffer != '') { | 
| 1164 | 1164 | $tt[$format] = 0; | 
| @@ -1192,13 +1192,13 @@ discard block | ||
| 1192 | 1192 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; | 
| 1193 | 1193 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; | 
| 1194 | 1194 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; | 
| 1195 | -			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); | |
| 1195 | +			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); | |
| 1196 | 1196 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; | 
| 1197 | 1197 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; | 
| 1198 | 1198 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | 
| 1199 | 1199 | |
| 1200 | 1200 |  			    if (isset($ais_data['timestamp'])) { | 
| 1201 | -				$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); | |
| 1201 | +				$data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); | |
| 1202 | 1202 |  			    } else { | 
| 1203 | 1203 |  				$data['datetime'] = date('Y-m-d H:i:s'); | 
| 1204 | 1204 | } | 
| @@ -1209,10 +1209,10 @@ discard block | ||
| 1209 | 1209 |                          } elseif ($format == 'flightgearsp') { | 
| 1210 | 1210 | //echo $buffer."\n"; | 
| 1211 | 1211 |                      	    if (strlen($buffer) > 5) { | 
| 1212 | -				$line = explode(',',$buffer); | |
| 1212 | +				$line = explode(',', $buffer); | |
| 1213 | 1213 | $data = array(); | 
| 1214 | 1214 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p | 
| 1215 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); | |
| 1215 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); | |
| 1216 | 1216 | $data['ident'] = $line[6]; | 
| 1217 | 1217 | $data['aircraft_name'] = $line[7]; | 
| 1218 | 1218 | $data['longitude'] = $line[1]; | 
| @@ -1229,16 +1229,16 @@ discard block | ||
| 1229 | 1229 |                          } elseif ($format == 'acars') { | 
| 1230 | 1230 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; | 
| 1231 | 1231 | $ACARS->add(trim($buffer)); | 
| 1232 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); | |
| 1232 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); | |
| 1233 | 1233 | $ACARS->deleteLiveAcarsData(); | 
| 1234 | 1234 |  			} elseif ($format == 'flightgearmp') { | 
| 1235 | -			    if (substr($buffer,0,1) != '#') { | |
| 1235 | +			    if (substr($buffer, 0, 1) != '#') { | |
| 1236 | 1236 | $data = array(); | 
| 1237 | 1237 | //echo $buffer."\n"; | 
| 1238 | -				$line = explode(' ',$buffer); | |
| 1238 | +				$line = explode(' ', $buffer); | |
| 1239 | 1239 |  				if (count($line) == 11) { | 
| 1240 | -				    $userserver = explode('@',$line[0]); | |
| 1241 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex | |
| 1240 | +				    $userserver = explode('@', $line[0]); | |
| 1241 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex | |
| 1242 | 1242 | $data['ident'] = $userserver[0]; | 
| 1243 | 1243 | $data['registration'] = $userserver[0]; | 
| 1244 | 1244 | $data['latitude'] = $line[4]; | 
| @@ -1246,8 +1246,8 @@ discard block | ||
| 1246 | 1246 | $data['altitude'] = $line[6]; | 
| 1247 | 1247 |  				    $data['datetime'] = date('Y-m-d H:i:s'); | 
| 1248 | 1248 | $aircraft_type = $line[10]; | 
| 1249 | -				    $aircraft_type = preg_split(':/:',$aircraft_type); | |
| 1250 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); | |
| 1249 | +				    $aircraft_type = preg_split(':/:', $aircraft_type); | |
| 1250 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); | |
| 1251 | 1251 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; | 
| 1252 | 1252 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); | 
| 1253 | 1253 | } | 
| @@ -1256,8 +1256,8 @@ discard block | ||
| 1256 | 1256 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; | 
| 1257 | 1257 | die; | 
| 1258 | 1258 |  			} elseif ($format == 'vrstcp') { | 
| 1259 | -			    foreach($buffer as $all_data) { | |
| 1260 | -				$line = json_decode('{'.$all_data.'}',true); | |
| 1259 | +			    foreach ($buffer as $all_data) { | |
| 1260 | +				$line = json_decode('{'.$all_data.'}', true); | |
| 1261 | 1261 | $data = array(); | 
| 1262 | 1262 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex | 
| 1263 | 1263 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident | 
| @@ -1283,16 +1283,16 @@ discard block | ||
| 1283 | 1283 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); | 
| 1284 | 1284 | unset($data); | 
| 1285 | 1285 | } | 
| 1286 | -			} elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { | |
| 1286 | +			} elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') { | |
| 1287 | 1287 |  			    $line = explode("\t", $buffer); | 
| 1288 | -			    for($k = 0; $k < count($line); $k=$k+2) { | |
| 1288 | +			    for ($k = 0; $k < count($line); $k = $k + 2) { | |
| 1289 | 1289 | $key = $line[$k]; | 
| 1290 | - $lined[$key] = $line[$k+1]; | |
| 1290 | + $lined[$key] = $line[$k + 1]; | |
| 1291 | 1291 | } | 
| 1292 | 1292 |      			    if (count($lined) > 3) { | 
| 1293 | 1293 | $data['hex'] = $lined['hexid']; | 
| 1294 | 1294 |      				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; | 
| 1295 | -    				$data['datetime'] = date('Y-m-d H:i:s');; | |
| 1295 | +    				$data['datetime'] = date('Y-m-d H:i:s'); ; | |
| 1296 | 1296 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; | 
| 1297 | 1297 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; | 
| 1298 | 1298 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; | 
| @@ -1311,22 +1311,22 @@ discard block | ||
| 1311 | 1311 | } else $error = true; | 
| 1312 | 1312 |  			} elseif ($format == 'aprs' && $use_aprs) { | 
| 1313 | 1313 |  			    if ($aprs_connect == 0) { | 
| 1314 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); | |
| 1314 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); | |
| 1315 | 1315 | $aprs_connect = 1; | 
| 1316 | 1316 | } | 
| 1317 | 1317 | |
| 1318 | -			    if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { | |
| 1318 | +			    if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { | |
| 1319 | 1319 | $aprs_last_tx = time(); | 
| 1320 | 1320 | $data_aprs = "# Keep alive"; | 
| 1321 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); | |
| 1321 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); | |
| 1322 | 1322 | } | 
| 1323 | 1323 | |
| 1324 | 1324 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; | 
| 1325 | 1325 | //echo 'APRS data : '.$buffer."\n"; | 
| 1326 | -			    $buffer = str_replace('APRS <- ','',$buffer); | |
| 1327 | -			    $buffer = str_replace('APRS -> ','',$buffer); | |
| 1326 | +			    $buffer = str_replace('APRS <- ', '', $buffer); | |
| 1327 | +			    $buffer = str_replace('APRS -> ', '', $buffer); | |
| 1328 | 1328 | //echo $buffer."\n"; | 
| 1329 | -			    if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { | |
| 1329 | +			    if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { | |
| 1330 | 1330 | $line = $APRS->parse($buffer); | 
| 1331 | 1331 |  				//if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { | 
| 1332 | 1332 |  				if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { | 
| @@ -1341,7 +1341,7 @@ discard block | ||
| 1341 | 1341 | if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; | 
| 1342 | 1342 | if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; | 
| 1343 | 1343 | if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; | 
| 1344 | -				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); | |
| 1344 | +				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); | |
| 1345 | 1345 |  				    else $data['datetime'] = date('Y-m-d H:i:s'); | 
| 1346 | 1346 |  				    //$data['datetime'] = date('Y-m-d H:i:s'); | 
| 1347 | 1347 | if (isset($line['ident'])) $data['ident'] = $line['ident']; | 
| @@ -1420,29 +1420,29 @@ discard block | ||
| 1420 | 1420 |  				    } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { | 
| 1421 | 1421 | if (!isset($data['altitude'])) $data['altitude'] = 0; | 
| 1422 | 1422 |  					$Source->deleteOldLocationByType('gs'); | 
| 1423 | -					if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { | |
| 1424 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); | |
| 1423 | +					if (count($Source->getLocationInfoByNameType($data['ident'], 'gs')) > 0) { | |
| 1424 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); | |
| 1425 | 1425 |  					} else { | 
| 1426 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); | |
| 1426 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); | |
| 1427 | 1427 | } | 
| 1428 | 1428 |  				    } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') { | 
| 1429 | 1429 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; | 
| 1430 | 1430 | if ($globalDebug) echo '# Weather Station added'."\n"; | 
| 1431 | 1431 |  					$Source->deleteOldLocationByType('wx'); | 
| 1432 | 1432 | $weather_data = json_encode($line); | 
| 1433 | -					if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { | |
| 1434 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); | |
| 1433 | +					if (count($Source->getLocationInfoByNameType($data['ident'], 'wx')) > 0) { | |
| 1434 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); | |
| 1435 | 1435 |  					} else { | 
| 1436 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); | |
| 1436 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); | |
| 1437 | 1437 | } | 
| 1438 | 1438 |  				    } elseif (isset($line['symbol']) && $line['symbol'] == 'Lightning') { | 
| 1439 | 1439 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; | 
| 1440 | 1440 | if ($globalDebug) echo '☈ Lightning added'."\n"; | 
| 1441 | 1441 |  					$Source->deleteOldLocationByType('lightning'); | 
| 1442 | -					if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { | |
| 1443 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); | |
| 1442 | +					if (count($Source->getLocationInfoByNameType($data['ident'], 'lightning')) > 0) { | |
| 1443 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); | |
| 1444 | 1444 |  					} else { | 
| 1445 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); | |
| 1445 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); | |
| 1446 | 1446 | } | 
| 1447 | 1447 |  				    } elseif ($globalDebug) { | 
| 1448 | 1448 | echo '/!\ Not added: '.$buffer."\n"; | 
| @@ -1451,7 +1451,7 @@ discard block | ||
| 1451 | 1451 | unset($data); | 
| 1452 | 1452 | } | 
| 1453 | 1453 |  				elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { | 
| 1454 | - $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); | |
| 1454 | + $Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']); | |
| 1455 | 1455 | } | 
| 1456 | 1456 | /* | 
| 1457 | 1457 |  				elseif (is_array($line) && $globalDebug && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] == 'Car' || $line['symbol'] == 'Ambulance' || $line['symbol'] == 'Van' || $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || $line['symbol'] == 'Motorcycle')) { | 
| @@ -1460,7 +1460,7 @@ discard block | ||
| 1460 | 1460 | */ | 
| 1461 | 1461 |  				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; | 
| 1462 | 1462 | elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; | 
| 1463 | -				if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { | |
| 1463 | +				if (isset($globalSources[$nb]['last_weather_clean']) && time() - $globalSources[$nb]['last_weather_clean'] > 60*5) { | |
| 1464 | 1464 |  					$Source->deleteOldLocationByType('lightning'); | 
| 1465 | 1465 |  					$Source->deleteOldLocationByType('wx'); | 
| 1466 | 1466 | $globalSources[$nb]['last_weather_clean'] = time(); | 
| @@ -1545,7 +1545,7 @@ discard block | ||
| 1545 | 1545 | connect_all($sourceee); | 
| 1546 | 1546 | $sourceee = array(); | 
| 1547 | 1547 | //connect_all($globalSources); | 
| 1548 | - $tt[$format]=0; | |
| 1548 | + $tt[$format] = 0; | |
| 1549 | 1549 | break; | 
| 1550 | 1550 | } | 
| 1551 | 1551 | } | 
| @@ -1554,14 +1554,14 @@ discard block | ||
| 1554 | 1554 |  	    } else { | 
| 1555 | 1555 | $error = socket_strerror(socket_last_error()); | 
| 1556 | 1556 |  		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { | 
| 1557 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; | |
| 1557 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; | |
| 1558 | 1558 | if (isset($globalDebug)) echo "Restarting...\n"; | 
| 1559 | 1559 | // Restart the script if possible | 
| 1560 | 1560 |  			if (is_array($sockets)) { | 
| 1561 | 1561 | if ($globalDebug) echo "Shutdown all sockets..."; | 
| 1562 | 1562 | |
| 1563 | 1563 |  			    foreach ($sockets as $sock) { | 
| 1564 | - @socket_shutdown($sock,2); | |
| 1564 | + @socket_shutdown($sock, 2); | |
| 1565 | 1565 | @socket_close($sock); | 
| 1566 | 1566 | } | 
| 1567 | 1567 | |
| @@ -14,13 +14,17 @@ discard block | ||
| 14 | 14 | require_once(dirname(__FILE__).'/../require/class.Source.php'); | 
| 15 | 15 | require_once(dirname(__FILE__).'/../require/class.Connection.php'); | 
| 16 | 16 | require_once(dirname(__FILE__).'/../require/class.Common.php'); | 
| 17 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); | |
| 17 | +if (isset($globalTracker) && $globalTracker) { | |
| 18 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); | |
| 19 | +} | |
| 18 | 20 |  if (isset($globalMarine) && $globalMarine) { | 
| 19 | 21 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); | 
| 20 | 22 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); | 
| 21 | 23 | } | 
| 22 | 24 | |
| 23 | -if (!isset($globalDebug)) $globalDebug = FALSE; | |
| 25 | +if (!isset($globalDebug)) { | |
| 26 | + $globalDebug = FALSE; | |
| 27 | +} | |
| 24 | 28 | |
| 25 | 29 | // Check if schema is at latest version | 
| 26 | 30 | $Connection = new Connection(); | 
| @@ -55,35 +59,62 @@ discard block | ||
| 55 | 59 | //elseif (isset($options['source'])) $hosts = array($options['source']); | 
| 56 | 60 |  if (isset($options['s'])) { | 
| 57 | 61 | $globalSources = array(); | 
| 58 | -    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); | |
| 59 | -    else $globalSources[] = array('host' => $options['s']); | |
| 60 | -} elseif (isset($options['source'])) { | |
| 62 | +    if (isset($options['format'])) { | |
| 63 | +    	$globalSources[] = array('host' => $options['s'],'format' => $options['format']); | |
| 64 | +    } else { | |
| 65 | +    	$globalSources[] = array('host' => $options['s']); | |
| 66 | + } | |
| 67 | +    } elseif (isset($options['source'])) { | |
| 61 | 68 | $globalSources = array(); | 
| 62 | -    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); | |
| 63 | -    else $globalSources[] = array('host' => $options['source']); | |
| 64 | -} | |
| 69 | +    if (isset($options['format'])) { | |
| 70 | +    	$globalSources[] = array('host' => $options['source'],'format' => $options['format']); | |
| 71 | +    } else { | |
| 72 | +    	$globalSources[] = array('host' => $options['source']); | |
| 73 | + } | |
| 74 | + } | |
| 65 | 75 |  if (isset($options['aprsserverhost'])) { | 
| 66 | 76 | $globalServerAPRS = TRUE; | 
| 67 | 77 | $globalServerAPRShost = $options['aprsserverhost']; | 
| 68 | 78 | } | 
| 69 | -if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport']; | |
| 70 | -if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid']; | |
| 71 | -if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass']; | |
| 72 | -if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; | |
| 73 | -if (isset($options['nodaemon'])) $globalDaemon = FALSE; | |
| 74 | -if (isset($options['server'])) $globalServer = TRUE; | |
| 75 | -if (isset($options['idsource'])) $id_source = $options['idsource']; | |
| 76 | -else $id_source = 1; | |
| 79 | +if (isset($options['aprsserverport'])) { | |
| 80 | + $globalServerAPRSport = $options['aprsserverport']; | |
| 81 | +} | |
| 82 | +if (isset($options['aprsserverssid'])) { | |
| 83 | + $globalServerAPRSssid = $options['aprsserverssid']; | |
| 84 | +} | |
| 85 | +if (isset($options['aprsserverpass'])) { | |
| 86 | + $globalServerAPRSpass = $options['aprsserverpass']; | |
| 87 | +} | |
| 88 | +if (isset($options['noaprsserver'])) { | |
| 89 | + $globalServerAPRS = FALSE; | |
| 90 | +} | |
| 91 | +if (isset($options['nodaemon'])) { | |
| 92 | + $globalDaemon = FALSE; | |
| 93 | +} | |
| 94 | +if (isset($options['server'])) { | |
| 95 | + $globalServer = TRUE; | |
| 96 | +} | |
| 97 | +if (isset($options['idsource'])) { | |
| 98 | + $id_source = $options['idsource']; | |
| 99 | +} else { | |
| 100 | + $id_source = 1; | |
| 101 | +} | |
| 77 | 102 |  if (isset($globalServer) && $globalServer) { | 
| 78 | - if ($globalDebug) echo "Using Server Mode\n"; | |
| 103 | +    if ($globalDebug) { | |
| 104 | + echo "Using Server Mode\n"; | |
| 105 | + } | |
| 79 | 106 | $SI=new SpotterServer(); | 
| 80 | 107 | /* | 
| 81 | 108 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); | 
| 82 | 109 | $SI = new adsb2aprs(); | 
| 83 | 110 | $SI->connect(); | 
| 84 | 111 | */ | 
| 85 | -} else $SI=new SpotterImport($Connection->db); | |
| 86 | -if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); | |
| 112 | +} else { | |
| 113 | + $SI=new SpotterImport($Connection->db); | |
| 114 | +} | |
| 115 | +if (isset($globalTracker) && $globalTracker) { | |
| 116 | + $TI = new TrackerImport($Connection->db); | |
| 117 | +} | |
| 87 | 118 |  if (isset($globalMarine) && $globalMarine) { | 
| 88 | 119 | $AIS = new AIS(); | 
| 89 | 120 | $MI = new MarineImport($Connection->db); | 
| @@ -106,7 +137,9 @@ discard block | ||
| 106 | 137 | } | 
| 107 | 138 | |
| 108 | 139 | // let's try and connect | 
| 109 | -if ($globalDebug) echo "Connecting...\n"; | |
| 140 | +if ($globalDebug) { | |
| 141 | + echo "Connecting...\n"; | |
| 142 | +} | |
| 110 | 143 | $use_aprs = false; | 
| 111 | 144 | $aprs_full = false; | 
| 112 | 145 | $reset = 0; | 
| @@ -115,7 +148,9 @@ discard block | ||
| 115 | 148 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; | 
| 116 | 149 | global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; | 
| 117 | 150 | $reset++; | 
| 118 | - if ($globalDebug) echo 'Connect to all...'."\n"; | |
| 151 | +    if ($globalDebug) { | |
| 152 | + echo 'Connect to all...'."\n"; | |
| 153 | + } | |
| 119 | 154 |      foreach ($hosts as $id => $value) { | 
| 120 | 155 | $host = $value['host']; | 
| 121 | 156 | $globalSources[$id]['last_exec'] = 0; | 
| @@ -125,22 +160,30 @@ discard block | ||
| 125 | 160 | //$formats[$id] = 'deltadbtxt'; | 
| 126 | 161 | $globalSources[$id]['format'] = 'deltadbtxt'; | 
| 127 | 162 | //$last_exec['deltadbtxt'] = 0; | 
| 128 | -        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; | |
| 163 | +        	if ($globalDebug) { | |
| 164 | +        		echo "Connect to deltadb source (".$host.")...\n"; | |
| 165 | + } | |
| 129 | 166 |              } else if (preg_match('/vatsim-data.txt$/i',$host)) { | 
| 130 | 167 | //$formats[$id] = 'vatsimtxt'; | 
| 131 | 168 | $globalSources[$id]['format'] = 'vatsimtxt'; | 
| 132 | 169 | //$last_exec['vatsimtxt'] = 0; | 
| 133 | -        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; | |
| 170 | +        	if ($globalDebug) { | |
| 171 | +        		echo "Connect to vatsim source (".$host.")...\n"; | |
| 172 | + } | |
| 134 | 173 |      	    } else if (preg_match('/aircraftlist.json$/i',$host)) { | 
| 135 | 174 | //$formats[$id] = 'aircraftlistjson'; | 
| 136 | 175 | $globalSources[$id]['format'] = 'aircraftlistjson'; | 
| 137 | 176 | //$last_exec['aircraftlistjson'] = 0; | 
| 138 | -        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; | |
| 177 | +        	if ($globalDebug) { | |
| 178 | +        		echo "Connect to aircraftlist.json source (".$host.")...\n"; | |
| 179 | + } | |
| 139 | 180 |      	    } else if (preg_match('/opensky/i',$host)) { | 
| 140 | 181 | //$formats[$id] = 'aircraftlistjson'; | 
| 141 | 182 | $globalSources[$id]['format'] = 'opensky'; | 
| 142 | 183 | //$last_exec['aircraftlistjson'] = 0; | 
| 143 | -        	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; | |
| 184 | +        	if ($globalDebug) { | |
| 185 | +        		echo "Connect to opensky source (".$host.")...\n"; | |
| 186 | + } | |
| 144 | 187 | /* | 
| 145 | 188 | // Disabled for now, site change source format | 
| 146 | 189 |      	    } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { | 
| @@ -157,7 +200,9 @@ discard block | ||
| 157 | 200 | //$formats[$id] = 'planeupdatefaa'; | 
| 158 | 201 | $globalSources[$id]['format'] = 'planeupdatefaa'; | 
| 159 | 202 | //$last_exec['planeupdatefaa'] = 0; | 
| 160 | -        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; | |
| 203 | +        	if ($globalDebug) { | |
| 204 | +        		echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; | |
| 205 | + } | |
| 161 | 206 |          	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { | 
| 162 | 207 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; | 
| 163 | 208 | exit(0); | 
| @@ -166,29 +211,41 @@ discard block | ||
| 166 | 211 | //$formats[$id] = 'phpvmacars'; | 
| 167 | 212 | $globalSources[$id]['format'] = 'phpvmacars'; | 
| 168 | 213 | //$last_exec['phpvmacars'] = 0; | 
| 169 | -        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; | |
| 214 | +        	if ($globalDebug) { | |
| 215 | +        		echo "Connect to phpvmacars source (".$host.")...\n"; | |
| 216 | + } | |
| 170 | 217 |              } else if (preg_match('/VAM-json.php$/i',$host)) { | 
| 171 | 218 | //$formats[$id] = 'phpvmacars'; | 
| 172 | 219 | $globalSources[$id]['format'] = 'vam'; | 
| 173 | -        	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; | |
| 220 | +        	if ($globalDebug) { | |
| 221 | +        		echo "Connect to Vam source (".$host.")...\n"; | |
| 222 | + } | |
| 174 | 223 |              } else if (preg_match('/whazzup/i',$host)) { | 
| 175 | 224 | //$formats[$id] = 'whazzup'; | 
| 176 | 225 | $globalSources[$id]['format'] = 'whazzup'; | 
| 177 | 226 | //$last_exec['whazzup'] = 0; | 
| 178 | -        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; | |
| 227 | +        	if ($globalDebug) { | |
| 228 | +        		echo "Connect to whazzup source (".$host.")...\n"; | |
| 229 | + } | |
| 179 | 230 |              } else if (preg_match('/airwhere/i',$host)) { | 
| 180 | 231 | $globalSources[$id]['format'] = 'airwhere'; | 
| 181 | -        	if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; | |
| 232 | +        	if ($globalDebug) { | |
| 233 | +        		echo "Connect to airwhere source (".$host.")...\n"; | |
| 234 | + } | |
| 182 | 235 |              } else if (preg_match('/recentpireps/i',$host)) { | 
| 183 | 236 | //$formats[$id] = 'pirepsjson'; | 
| 184 | 237 | $globalSources[$id]['format'] = 'pirepsjson'; | 
| 185 | 238 | //$last_exec['pirepsjson'] = 0; | 
| 186 | -        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; | |
| 239 | +        	if ($globalDebug) { | |
| 240 | +        		echo "Connect to pirepsjson source (".$host.")...\n"; | |
| 241 | + } | |
| 187 | 242 |              } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { | 
| 188 | 243 | //$formats[$id] = 'fr24json'; | 
| 189 | 244 | $globalSources[$id]['format'] = 'fr24json'; | 
| 190 | 245 | //$last_exec['fr24json'] = 0; | 
| 191 | -        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; | |
| 246 | +        	if ($globalDebug) { | |
| 247 | +        		echo "Connect to fr24 source (".$host.")...\n"; | |
| 248 | + } | |
| 192 | 249 |          	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { | 
| 193 | 250 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; | 
| 194 | 251 | exit(0); | 
| @@ -197,7 +254,9 @@ discard block | ||
| 197 | 254 | //$formats[$id] = 'fr24json'; | 
| 198 | 255 | $globalSources[$id]['format'] = 'myshiptracking'; | 
| 199 | 256 | //$last_exec['fr24json'] = 0; | 
| 200 | -        	if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; | |
| 257 | +        	if ($globalDebug) { | |
| 258 | +        		echo "Connect to myshiptracking source (".$host.")...\n"; | |
| 259 | + } | |
| 201 | 260 |          	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { | 
| 202 | 261 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; | 
| 203 | 262 | exit(0); | 
| @@ -206,17 +265,24 @@ discard block | ||
| 206 | 265 |              } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { | 
| 207 | 266 | //$formats[$id] = 'tsv'; | 
| 208 | 267 | $globalSources[$id]['format'] = 'tsv'; | 
| 209 | -        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; | |
| 268 | +        	if ($globalDebug) { | |
| 269 | +        		echo "Connect to tsv source (".$host.")...\n"; | |
| 270 | + } | |
| 210 | 271 | } | 
| 211 | 272 |          } elseif (filter_var($host,FILTER_VALIDATE_URL)) { | 
| 212 | 273 |      		if ($globalSources[$id]['format'] == 'aisnmeahttp') { | 
| 213 | 274 | $idf = fopen($globalSources[$id]['host'],'r',false,$context); | 
| 214 | 275 |      		    if ($idf !== false) { | 
| 215 | 276 | $httpfeeds[$id] = $idf; | 
| 216 | -        		if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; | |
| 277 | +        		if ($globalDebug) { | |
| 278 | +        			echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; | |
| 279 | + } | |
| 280 | +    		    } elseif ($globalDebug) { | |
| 281 | + echo "Can't connect to ".$globalSources[$id]['host']."\n"; | |
| 217 | 282 | } | 
| 218 | - elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; | |
| 219 | -    		} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; | |
| 283 | +    		} elseif ($globalDebug) { | |
| 284 | +    			echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; | |
| 285 | + } | |
| 220 | 286 |          } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { | 
| 221 | 287 |  	    $hostport = explode(':',$host); | 
| 222 | 288 |  	    if (isset($hostport[1])) { | 
| @@ -256,17 +322,25 @@ discard block | ||
| 256 | 322 | //$formats[$id] = 'beast'; | 
| 257 | 323 | $globalSources[$id]['format'] = 'beast'; | 
| 258 | 324 | //} else $formats[$id] = 'sbs'; | 
| 259 | - } else $globalSources[$id]['format'] = 'sbs'; | |
| 325 | +		    } else { | |
| 326 | + $globalSources[$id]['format'] = 'sbs'; | |
| 327 | + } | |
| 260 | 328 |  		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; | 
| 261 | 329 | } | 
| 262 | -		if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; | |
| 330 | +		if ($globalDebug) { | |
| 331 | +			echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; | |
| 332 | + } | |
| 263 | 333 |              } else { | 
| 264 | - if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; | |
| 334 | +		if ($globalDebug) { | |
| 335 | + echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; | |
| 336 | + } | |
| 265 | 337 | } | 
| 266 | 338 | } | 
| 267 | 339 | } | 
| 268 | 340 | } | 
| 269 | -if (!isset($globalMinFetch)) $globalMinFetch = 15; | |
| 341 | +if (!isset($globalMinFetch)) { | |
| 342 | + $globalMinFetch = 15; | |
| 343 | +} | |
| 270 | 344 | |
| 271 | 345 | // Initialize all | 
| 272 | 346 | $status = array(); | 
| @@ -275,13 +349,19 @@ discard block | ||
| 275 | 349 | $formats = array(); | 
| 276 | 350 | $last_exec = array(); | 
| 277 | 351 | $time = time(); | 
| 278 | -if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut; | |
| 279 | -else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; | |
| 280 | -else $timeout = 20; | |
| 352 | +if (isset($globalSourcesTimeout)) { | |
| 353 | + $timeout = $globalSourcesTimeOut; | |
| 354 | +} else if (isset($globalSBS1TimeOut)) { | |
| 355 | + $timeout = $globalSBS1TimeOut; | |
| 356 | +} else { | |
| 357 | + $timeout = 20; | |
| 358 | +} | |
| 281 | 359 | $errno = ''; | 
| 282 | 360 | $errstr=''; | 
| 283 | 361 | |
| 284 | -if (!isset($globalDaemon)) $globalDaemon = TRUE; | |
| 362 | +if (!isset($globalDaemon)) { | |
| 363 | + $globalDaemon = TRUE; | |
| 364 | +} | |
| 285 | 365 | /* Initiate connections to all the hosts simultaneously */ | 
| 286 | 366 | //connect_all($hosts); | 
| 287 | 367 | //connect_all($globalSources); | 
| @@ -310,7 +390,9 @@ discard block | ||
| 310 | 390 |      if (isset($source['format']) && $source['format'] == 'aprs') { | 
| 311 | 391 | $aprs_connect = 0; | 
| 312 | 392 | $use_aprs = true; | 
| 313 | - if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; | |
| 393 | +	if (isset($source['port']) && $source['port'] == '10152') { | |
| 394 | + $aprs_full = true; | |
| 395 | + } | |
| 314 | 396 | break; | 
| 315 | 397 | } | 
| 316 | 398 | } | 
| @@ -321,25 +403,48 @@ discard block | ||
| 321 | 403 | $aprs_connect = 0; | 
| 322 | 404 | $aprs_keep = 120; | 
| 323 | 405 | $aprs_last_tx = time(); | 
| 324 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; | |
| 325 | -	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); | |
| 326 | - if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; | |
| 327 | -	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); | |
| 328 | - if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; | |
| 329 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; | |
| 330 | - if ($aprs_full) $aprs_filter = ''; | |
| 331 | - if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; | |
| 332 | - else $aprs_pass = '-1'; | |
| 406 | +	if (isset($globalAPRSversion)) { | |
| 407 | + $aprs_version = $globalAPRSversion; | |
| 408 | +	} else { | |
| 409 | +		$aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); | |
| 410 | + } | |
| 411 | +	if (isset($globalAPRSssid)) { | |
| 412 | + $aprs_ssid = $globalAPRSssid; | |
| 413 | +	} else { | |
| 414 | +		$aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); | |
| 415 | + } | |
| 416 | +	if (isset($globalAPRSfilter)) { | |
| 417 | + $aprs_filter = $globalAPRSfilter; | |
| 418 | +	} else { | |
| 419 | + $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; | |
| 420 | + } | |
| 421 | +	if ($aprs_full) { | |
| 422 | + $aprs_filter = ''; | |
| 423 | + } | |
| 424 | +	if (isset($globalAPRSpass)) { | |
| 425 | + $aprs_pass = $globalAPRSpass; | |
| 426 | +	} else { | |
| 427 | + $aprs_pass = '-1'; | |
| 428 | + } | |
| 333 | 429 | |
| 334 | -	if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; | |
| 335 | -	else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; | |
| 336 | -} | |
| 430 | +	if ($aprs_filter != '') { | |
| 431 | +		$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; | |
| 432 | +	} else { | |
| 433 | +		$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; | |
| 434 | + } | |
| 435 | + } | |
| 337 | 436 | |
| 338 | 437 | // connected - lets do some work | 
| 339 | -if ($globalDebug) echo "Connected!\n"; | |
| 438 | +if ($globalDebug) { | |
| 439 | + echo "Connected!\n"; | |
| 440 | +} | |
| 340 | 441 | sleep(1); | 
| 341 | -if ($globalDebug) echo "SCAN MODE \n\n"; | |
| 342 | -if (!isset($globalCronEnd)) $globalCronEnd = 60; | |
| 442 | +if ($globalDebug) { | |
| 443 | + echo "SCAN MODE \n\n"; | |
| 444 | +} | |
| 445 | +if (!isset($globalCronEnd)) { | |
| 446 | + $globalCronEnd = 60; | |
| 447 | +} | |
| 343 | 448 | $endtime = time()+$globalCronEnd; | 
| 344 | 449 | $i = 1; | 
| 345 | 450 | $tt = array(); | 
| @@ -353,20 +458,28 @@ discard block | ||
| 353 | 458 | |
| 354 | 459 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. | 
| 355 | 460 |  while ($i > 0) { | 
| 356 | - if (!$globalDaemon) $i = $endtime-time(); | |
| 461 | +    if (!$globalDaemon) { | |
| 462 | + $i = $endtime-time(); | |
| 463 | + } | |
| 357 | 464 | // Delete old ATC | 
| 358 | 465 |      if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { | 
| 359 | - if ($globalDebug) echo 'Delete old ATC...'."\n"; | |
| 466 | +	if ($globalDebug) { | |
| 467 | + echo 'Delete old ATC...'."\n"; | |
| 468 | + } | |
| 360 | 469 | $ATC->deleteOldATC(); | 
| 361 | 470 | } | 
| 362 | 471 | |
| 363 | 472 |      if (count($last_exec) == count($globalSources)) { | 
| 364 | 473 | $max = $globalMinFetch; | 
| 365 | 474 |  	foreach ($last_exec as $last) { | 
| 366 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; | |
| 475 | +	    if ((time() - $last['last']) < $max) { | |
| 476 | + $max = time() - $last['last']; | |
| 477 | + } | |
| 367 | 478 | } | 
| 368 | 479 |  	if ($max != $globalMinFetch) { | 
| 369 | - if ($globalDebug) echo 'Sleeping...'."\n"; | |
| 480 | +	    if ($globalDebug) { | |
| 481 | + echo 'Sleeping...'."\n"; | |
| 482 | + } | |
| 370 | 483 | sleep($globalMinFetch-$max+2); | 
| 371 | 484 | } | 
| 372 | 485 | } | 
| @@ -375,11 +488,15 @@ discard block | ||
| 375 | 488 |      //foreach ($formats as $id => $value) { | 
| 376 | 489 |      foreach ($globalSources as $id => $value) { | 
| 377 | 490 |  	date_default_timezone_set('UTC'); | 
| 378 | - if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; | |
| 491 | +	if (!isset($last_exec[$id]['last'])) { | |
| 492 | + $last_exec[$id]['last'] = 0; | |
| 493 | + } | |
| 379 | 494 |  	if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { | 
| 380 | 495 | //$buffer = $Common->getData($hosts[$id]); | 
| 381 | 496 | $buffer = $Common->getData($value['host']); | 
| 382 | - if ($buffer != '') $reset = 0; | |
| 497 | +	    if ($buffer != '') { | |
| 498 | + $reset = 0; | |
| 499 | + } | |
| 383 | 500 |      	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); | 
| 384 | 501 |  	    $buffer = explode('\n',$buffer); | 
| 385 | 502 |  	    foreach ($buffer as $line) { | 
| @@ -388,20 +505,41 @@ discard block | ||
| 388 | 505 | $data = array(); | 
| 389 | 506 | $data['hex'] = $line[1]; // hex | 
| 390 | 507 | $data['ident'] = $line[2]; // ident | 
| 391 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude | |
| 392 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed | |
| 393 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading | |
| 394 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat | |
| 395 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long | |
| 508 | +	            if (isset($line[3])) { | |
| 509 | + $data['altitude'] = $line[3]; | |
| 510 | + } | |
| 511 | + // altitude | |
| 512 | +	            if (isset($line[4])) { | |
| 513 | + $data['speed'] = $line[4]; | |
| 514 | + } | |
| 515 | + // speed | |
| 516 | +	            if (isset($line[5])) { | |
| 517 | + $data['heading'] = $line[5]; | |
| 518 | + } | |
| 519 | + // heading | |
| 520 | +	            if (isset($line[6])) { | |
| 521 | + $data['latitude'] = $line[6]; | |
| 522 | + } | |
| 523 | + // lat | |
| 524 | +	            if (isset($line[7])) { | |
| 525 | + $data['longitude'] = $line[7]; | |
| 526 | + } | |
| 527 | + // long | |
| 396 | 528 | $data['verticalrate'] = ''; // vertical rate | 
| 397 | 529 | //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk | 
| 398 | 530 | $data['emergency'] = ''; // emergency | 
| 399 | 531 |  		    $data['datetime'] = date('Y-m-d H:i:s'); | 
| 400 | 532 | $data['format_source'] = 'deltadbtxt'; | 
| 401 | 533 | $data['id_source'] = $id_source; | 
| 402 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 403 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 404 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; | |
| 534 | +		    if (isset($value['name']) && $value['name'] != '') { | |
| 535 | + $data['source_name'] = $value['name']; | |
| 536 | + } | |
| 537 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 538 | + $data['noarchive'] = true; | |
| 539 | + } | |
| 540 | +		    if (isset($value['sourcestats'])) { | |
| 541 | + $data['sourcestats'] = $value['sourcestats']; | |
| 542 | + } | |
| 405 | 543 | $SI->add($data); | 
| 406 | 544 | unset($data); | 
| 407 | 545 | } | 
| @@ -411,7 +549,9 @@ discard block | ||
| 411 | 549 |  	    date_default_timezone_set('CET'); | 
| 412 | 550 |  	    $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); | 
| 413 | 551 |  	    date_default_timezone_set('UTC'); | 
| 414 | - if ($buffer != '') $reset = 0; | |
| 552 | +	    if ($buffer != '') { | |
| 553 | + $reset = 0; | |
| 554 | + } | |
| 415 | 555 |      	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); | 
| 416 | 556 |  	    $buffer = explode('\n',$buffer); | 
| 417 | 557 |  	    foreach ($buffer as $line) { | 
| @@ -420,16 +560,36 @@ discard block | ||
| 420 | 560 | $add = false; | 
| 421 | 561 | $ais_data = $AIS->parse_line(trim($line)); | 
| 422 | 562 | $data = array(); | 
| 423 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; | |
| 424 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; | |
| 425 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; | |
| 426 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; | |
| 427 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; | |
| 428 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; | |
| 429 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; | |
| 430 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; | |
| 431 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; | |
| 432 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; | |
| 563 | +		    if (isset($ais_data['ident'])) { | |
| 564 | + $data['ident'] = $ais_data['ident']; | |
| 565 | + } | |
| 566 | +		    if (isset($ais_data['mmsi'])) { | |
| 567 | + $data['mmsi'] = $ais_data['mmsi']; | |
| 568 | + } | |
| 569 | +		    if (isset($ais_data['speed'])) { | |
| 570 | + $data['speed'] = $ais_data['speed']; | |
| 571 | + } | |
| 572 | +		    if (isset($ais_data['heading'])) { | |
| 573 | + $data['heading'] = $ais_data['heading']; | |
| 574 | + } | |
| 575 | +		    if (isset($ais_data['latitude'])) { | |
| 576 | + $data['latitude'] = $ais_data['latitude']; | |
| 577 | + } | |
| 578 | +		    if (isset($ais_data['longitude'])) { | |
| 579 | + $data['longitude'] = $ais_data['longitude']; | |
| 580 | + } | |
| 581 | +		    if (isset($ais_data['status'])) { | |
| 582 | + $data['status'] = $ais_data['status']; | |
| 583 | + } | |
| 584 | +		    if (isset($ais_data['type'])) { | |
| 585 | + $data['type'] = $ais_data['type']; | |
| 586 | + } | |
| 587 | +		    if (isset($ais_data['imo'])) { | |
| 588 | + $data['imo'] = $ais_data['imo']; | |
| 589 | + } | |
| 590 | +		    if (isset($ais_data['callsign'])) { | |
| 591 | + $data['callsign'] = $ais_data['callsign']; | |
| 592 | + } | |
| 433 | 593 |  		    if (isset($ais_data['timestamp'])) { | 
| 434 | 594 |  			$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); | 
| 435 | 595 |  			if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { | 
| @@ -443,8 +603,12 @@ discard block | ||
| 443 | 603 | $data['format_source'] = 'aisnmeatxt'; | 
| 444 | 604 | $data['id_source'] = $id_source; | 
| 445 | 605 | //print_r($data); | 
| 446 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 447 | - if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); | |
| 606 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 607 | + $data['noarchive'] = true; | |
| 608 | + } | |
| 609 | +		    if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { | |
| 610 | + $MI->add($data); | |
| 611 | + } | |
| 448 | 612 | unset($data); | 
| 449 | 613 | } | 
| 450 | 614 | } | 
| @@ -464,20 +628,48 @@ discard block | ||
| 464 | 628 |  			    if ($line != '') { | 
| 465 | 629 | $ais_data = $AIS->parse_line(trim($line)); | 
| 466 | 630 | $data = array(); | 
| 467 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; | |
| 468 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; | |
| 469 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; | |
| 470 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; | |
| 471 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; | |
| 472 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; | |
| 473 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; | |
| 474 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; | |
| 475 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; | |
| 476 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; | |
| 477 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; | |
| 478 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; | |
| 479 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; | |
| 480 | -				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); | |
| 631 | +				if (isset($ais_data['ident'])) { | |
| 632 | + $data['ident'] = $ais_data['ident']; | |
| 633 | + } | |
| 634 | +				if (isset($ais_data['mmsi'])) { | |
| 635 | + $data['mmsi'] = $ais_data['mmsi']; | |
| 636 | + } | |
| 637 | +				if (isset($ais_data['speed'])) { | |
| 638 | + $data['speed'] = $ais_data['speed']; | |
| 639 | + } | |
| 640 | +				if (isset($ais_data['heading'])) { | |
| 641 | + $data['heading'] = $ais_data['heading']; | |
| 642 | + } | |
| 643 | +				if (isset($ais_data['latitude'])) { | |
| 644 | + $data['latitude'] = $ais_data['latitude']; | |
| 645 | + } | |
| 646 | +				if (isset($ais_data['longitude'])) { | |
| 647 | + $data['longitude'] = $ais_data['longitude']; | |
| 648 | + } | |
| 649 | +				if (isset($ais_data['status'])) { | |
| 650 | + $data['status'] = $ais_data['status']; | |
| 651 | + } | |
| 652 | +				if (isset($ais_data['statusid'])) { | |
| 653 | + $data['status_id'] = $ais_data['statusid']; | |
| 654 | + } | |
| 655 | +				if (isset($ais_data['type'])) { | |
| 656 | + $data['type'] = $ais_data['type']; | |
| 657 | + } | |
| 658 | +				if (isset($ais_data['typeid'])) { | |
| 659 | + $data['type_id'] = $ais_data['typeid']; | |
| 660 | + } | |
| 661 | +				if (isset($ais_data['imo'])) { | |
| 662 | + $data['imo'] = $ais_data['imo']; | |
| 663 | + } | |
| 664 | +				if (isset($ais_data['callsign'])) { | |
| 665 | + $data['callsign'] = $ais_data['callsign']; | |
| 666 | + } | |
| 667 | +				if (isset($ais_data['destination'])) { | |
| 668 | + $data['arrival_code'] = $ais_data['destination']; | |
| 669 | + } | |
| 670 | +				if (isset($ais_data['eta_ts'])) { | |
| 671 | +					$data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); | |
| 672 | + } | |
| 481 | 673 |  				if (isset($ais_data['timestamp'])) { | 
| 482 | 674 |  				    $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); | 
| 483 | 675 |  				} else { | 
| @@ -485,18 +677,27 @@ discard block | ||
| 485 | 677 | } | 
| 486 | 678 | $data['format_source'] = 'aisnmeahttp'; | 
| 487 | 679 | $data['id_source'] = $id_source; | 
| 488 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 489 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); | |
| 680 | +				if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 681 | + $data['noarchive'] = true; | |
| 682 | + } | |
| 683 | +				if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { | |
| 684 | + $MI->add($data); | |
| 685 | + } | |
| 490 | 686 | unset($data); | 
| 491 | 687 | } | 
| 492 | 688 | } | 
| 493 | 689 | } | 
| 494 | 690 |  		} else { | 
| 495 | 691 | $format = $value['format']; | 
| 496 | - if (isset($tt[$format])) $tt[$format]++; | |
| 497 | - else $tt[$format] = 0; | |
| 692 | +		    if (isset($tt[$format])) { | |
| 693 | + $tt[$format]++; | |
| 694 | +		    } else { | |
| 695 | + $tt[$format] = 0; | |
| 696 | + } | |
| 498 | 697 |  		    if ($tt[$format] > 30) { | 
| 499 | - if ($globalDebug) echo 'Reconnect...'."\n"; | |
| 698 | +			if ($globalDebug) { | |
| 699 | + echo 'Reconnect...'."\n"; | |
| 700 | + } | |
| 500 | 701 | sleep(2); | 
| 501 | 702 | $sourceeen[] = $value; | 
| 502 | 703 | connect_all($sourceeen); | 
| @@ -526,7 +727,9 @@ discard block | ||
| 526 | 727 |  			    $data['datetime'] = date('Y-m-d H:i:s',$line['T']); | 
| 527 | 728 | $data['format_source'] = 'myshiptracking'; | 
| 528 | 729 | $data['id_source'] = $id_source; | 
| 529 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 730 | +			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 731 | + $data['noarchive'] = true; | |
| 732 | + } | |
| 530 | 733 | $MI->add($data); | 
| 531 | 734 | unset($data); | 
| 532 | 735 | } | 
| @@ -546,7 +749,9 @@ discard block | ||
| 546 | 749 | $data['callsign'] = $line['callsign']; | 
| 547 | 750 | $data['mmsi'] = $line['mmsi']; | 
| 548 | 751 | $data['speed'] = $line['sog']; | 
| 549 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; | |
| 752 | +			    if ($line['heading'] != '511') { | |
| 753 | + $data['heading'] = $line['heading']; | |
| 754 | + } | |
| 550 | 755 | $data['latitude'] = $line['latitude']; | 
| 551 | 756 | $data['longitude'] = $line['longitude']; | 
| 552 | 757 | $data['type_id'] = $line['shiptype']; | 
| @@ -554,7 +759,9 @@ discard block | ||
| 554 | 759 | $data['datetime'] = $line['time']; | 
| 555 | 760 | $data['format_source'] = 'boatbeaconapp'; | 
| 556 | 761 | $data['id_source'] = $id_source; | 
| 557 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 762 | +			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 763 | + $data['noarchive'] = true; | |
| 764 | + } | |
| 558 | 765 | $MI->add($data); | 
| 559 | 766 | unset($data); | 
| 560 | 767 | } | 
| @@ -570,22 +777,44 @@ discard block | ||
| 570 | 777 |  		if (isset($all_data['features'][0]['id'])) { | 
| 571 | 778 |  		    foreach ($all_data['features'] as $line) { | 
| 572 | 779 | $data = array(); | 
| 573 | - if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; | |
| 574 | - if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; | |
| 575 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = $line['properties']['mmsi']; | |
| 576 | - if (isset($line['properties']['imo'])) $data['mmsi'] = $line['properties']['imo']; | |
| 577 | - if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; | |
| 578 | - if (isset($line['properties']['heading'])) $data['heading'] = $line['properties']['heading']; | |
| 780 | +			if (isset($line['properties']['name'])) { | |
| 781 | + $data['ident'] = $line['properties']['name']; | |
| 782 | + } | |
| 783 | +			if (isset($line['properties']['callsign'])) { | |
| 784 | + $data['callsign'] = $line['properties']['callsign']; | |
| 785 | + } | |
| 786 | +			if (isset($line['properties']['mmsi'])) { | |
| 787 | + $data['mmsi'] = $line['properties']['mmsi']; | |
| 788 | + } | |
| 789 | +			if (isset($line['properties']['imo'])) { | |
| 790 | + $data['mmsi'] = $line['properties']['imo']; | |
| 791 | + } | |
| 792 | +			if (isset($line['properties']['speed'])) { | |
| 793 | + $data['speed'] = $line['properties']['speed']; | |
| 794 | + } | |
| 795 | +			if (isset($line['properties']['heading'])) { | |
| 796 | + $data['heading'] = $line['properties']['heading']; | |
| 797 | + } | |
| 579 | 798 | $data['latitude'] = $line['geometry']['coordinates'][1]; | 
| 580 | 799 | $data['longitude'] = $line['geometry']['coordinates'][0]; | 
| 581 | - if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType']; | |
| 582 | - if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination']; | |
| 583 | - if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta']; | |
| 800 | +			if (isset($line['properties']['vesselType'])) { | |
| 801 | + $data['type'] = $line['properties']['vesselType']; | |
| 802 | + } | |
| 803 | +			if (isset($line['properties']['destination'])) { | |
| 804 | + $data['arrival_code'] = $line['properties']['destination']; | |
| 805 | + } | |
| 806 | +			if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') { | |
| 807 | + $data['arrival_date'] = $line['properties']['eta']; | |
| 808 | + } | |
| 584 | 809 | $data['format_source'] = 'boatnerd'; | 
| 585 | 810 | $data['id_source'] = $id_source; | 
| 586 | 811 |  			$data['datetime'] = date('Y-m-d H:i:s'); | 
| 587 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 588 | - if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); | |
| 812 | +			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 813 | + $data['noarchive'] = true; | |
| 814 | + } | |
| 815 | +			if ($line['properties']['vesselType'] != 'Navigation Aid') { | |
| 816 | + $MI->add($data); | |
| 817 | + } | |
| 589 | 818 | unset($data); | 
| 590 | 819 | } | 
| 591 | 820 | } | 
| @@ -596,7 +825,9 @@ discard block | ||
| 596 | 825 | echo 'download...'; | 
| 597 | 826 | $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); | 
| 598 | 827 | echo 'done !'."\n"; | 
| 599 | - if ($buffer != '') $reset = 0; | |
| 828 | +	    if ($buffer != '') { | |
| 829 | + $reset = 0; | |
| 830 | + } | |
| 600 | 831 |      	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); | 
| 601 | 832 |  	    $buffer = explode('\n',$buffer); | 
| 602 | 833 |  	    foreach ($buffer as $line) { | 
| @@ -621,7 +852,9 @@ discard block | ||
| 621 | 852 | //$data['etaTime'] = substr($line,135,5); | 
| 622 | 853 | $data['format_source'] = 'shipplotter'; | 
| 623 | 854 | $data['id_source'] = $id_source; | 
| 624 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 855 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 856 | + $data['noarchive'] = true; | |
| 857 | + } | |
| 625 | 858 | //print_r($data); | 
| 626 | 859 | echo 'Add...'."\n"; | 
| 627 | 860 | $MI->add($data); | 
| @@ -641,16 +874,28 @@ discard block | ||
| 641 | 874 |      		    $line = explode(':', $line); | 
| 642 | 875 |      		    if (count($line) > 30 && $line[0] != 'callsign') { | 
| 643 | 876 | $data = array(); | 
| 644 | - if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; | |
| 645 | - else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; | |
| 877 | +			if (isset($line[37]) && $line[37] != '') { | |
| 878 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; | |
| 879 | +			} else { | |
| 880 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; | |
| 881 | + } | |
| 646 | 882 | $data['pilot_id'] = $line[1]; | 
| 647 | 883 | $data['pilot_name'] = $line[2]; | 
| 648 | 884 | $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); | 
| 649 | 885 | $data['ident'] = $line[0]; // ident | 
| 650 | - if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude | |
| 886 | +			if ($line[7] != '' && $line[7] != 0) { | |
| 887 | + $data['altitude'] = $line[7]; | |
| 888 | + } | |
| 889 | + // altitude | |
| 651 | 890 | $data['speed'] = $line[8]; // speed | 
| 652 | - if (isset($line[45])) $data['heading'] = $line[45]; // heading | |
| 653 | - elseif (isset($line[38])) $data['heading'] = $line[38]; // heading | |
| 891 | +			if (isset($line[45])) { | |
| 892 | + $data['heading'] = $line[45]; | |
| 893 | + } | |
| 894 | + // heading | |
| 895 | +			elseif (isset($line[38])) { | |
| 896 | + $data['heading'] = $line[38]; | |
| 897 | + } | |
| 898 | + // heading | |
| 654 | 899 | $data['latitude'] = $line[5]; // lat | 
| 655 | 900 | $data['longitude'] = $line[6]; // long | 
| 656 | 901 | $data['verticalrate'] = ''; // vertical rate | 
| @@ -666,7 +911,9 @@ discard block | ||
| 666 | 911 | $data['frequency'] = $line[4]; | 
| 667 | 912 | $data['type'] = $line[18]; | 
| 668 | 913 | $data['range'] = $line[19]; | 
| 669 | - if (isset($line[35])) $data['info'] = $line[35]; | |
| 914 | +			if (isset($line[35])) { | |
| 915 | + $data['info'] = $line[35]; | |
| 916 | + } | |
| 670 | 917 | $data['id_source'] = $id_source; | 
| 671 | 918 | //$data['arrival_airport_time'] = ; | 
| 672 | 919 |  	    		if ($line[9] != '') { | 
| @@ -680,27 +927,47 @@ discard block | ||
| 680 | 927 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; | 
| 681 | 928 | */ | 
| 682 | 929 | $data['format_source'] = $value['format']; | 
| 683 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 684 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 685 | - if ($line[3] == 'PILOT') $SI->add($data); | |
| 686 | -			elseif ($line[3] == 'ATC') { | |
| 930 | +			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 931 | + $data['noarchive'] = true; | |
| 932 | + } | |
| 933 | +			if (isset($value['name']) && $value['name'] != '') { | |
| 934 | + $data['source_name'] = $value['name']; | |
| 935 | + } | |
| 936 | +    			if ($line[3] == 'PILOT') { | |
| 937 | + $SI->add($data); | |
| 938 | +    			} elseif ($line[3] == 'ATC') { | |
| 687 | 939 | //print_r($data); | 
| 688 | 940 |  				$data['info'] = str_replace('^§','<br />',$data['info']); | 
| 689 | 941 |  				$data['info'] = str_replace('&sect;','',$data['info']); | 
| 690 | 942 | $typec = substr($data['ident'],-3); | 
| 691 | - if ($typec == 'APP') $data['type'] = 'Approach'; | |
| 692 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; | |
| 693 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; | |
| 694 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; | |
| 695 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; | |
| 696 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; | |
| 697 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; | |
| 698 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; | |
| 699 | - elseif ($data['type'] == '') $data['type'] = 'Observer'; | |
| 700 | - if (!isset($data['source_name'])) $data['source_name'] = ''; | |
| 943 | +				if ($typec == 'APP') { | |
| 944 | + $data['type'] = 'Approach'; | |
| 945 | +				} elseif ($typec == 'TWR') { | |
| 946 | + $data['type'] = 'Tower'; | |
| 947 | +				} elseif ($typec == 'OBS') { | |
| 948 | + $data['type'] = 'Observer'; | |
| 949 | +				} elseif ($typec == 'GND') { | |
| 950 | + $data['type'] = 'Ground'; | |
| 951 | +				} elseif ($typec == 'DEL') { | |
| 952 | + $data['type'] = 'Delivery'; | |
| 953 | +				} elseif ($typec == 'DEP') { | |
| 954 | + $data['type'] = 'Departure'; | |
| 955 | +				} elseif ($typec == 'FSS') { | |
| 956 | + $data['type'] = 'Flight Service Station'; | |
| 957 | +				} elseif ($typec == 'CTR') { | |
| 958 | + $data['type'] = 'Control Radar or Centre'; | |
| 959 | +				} elseif ($data['type'] == '') { | |
| 960 | + $data['type'] = 'Observer'; | |
| 961 | + } | |
| 962 | +				if (!isset($data['source_name'])) { | |
| 963 | + $data['source_name'] = ''; | |
| 964 | + } | |
| 701 | 965 |  				if (isset($ATC)) { | 
| 702 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); | |
| 703 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); | |
| 966 | +					if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) { | |
| 967 | + echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); | |
| 968 | +					} else { | |
| 969 | + echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); | |
| 970 | + } | |
| 704 | 971 | } | 
| 705 | 972 | } | 
| 706 | 973 | unset($data); | 
| @@ -722,14 +989,20 @@ discard block | ||
| 722 | 989 |  			$data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); | 
| 723 | 990 | $data['latitude'] = (float)$line['pktLatitude']; | 
| 724 | 991 | $data['longitude'] = (float)$line['pktLongitude']; | 
| 725 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; | |
| 726 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; | |
| 992 | +			if ((float)$line['pktTrack'] != 0) { | |
| 993 | + $data['heading'] = (float)$line['pktTrack']; | |
| 994 | + } | |
| 995 | +			if ((int)$line['pktSpeed'] != 0) { | |
| 996 | + $data['speed'] = (int)$line['pktSpeed']; | |
| 997 | + } | |
| 727 | 998 | $data['altitude'] = round((int)$line['pktAltitude']*3.28084); | 
| 728 | 999 | $data['altitude_relative'] = 'AMSL'; | 
| 729 | 1000 | $data['pilot_id'] = (int)$line['pktPilotID']; | 
| 730 | 1001 | $data['aircraft_icao'] = 'PARAGLIDER'; | 
| 731 | 1002 |  			$pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); | 
| 732 | - if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; | |
| 1003 | +			if (isset($pilot_data[4])) { | |
| 1004 | + $data['pilot_name'] = $pilot_data[4]; | |
| 1005 | + } | |
| 733 | 1006 | $data['format_source'] = $value['format']; | 
| 734 | 1007 | $SI->add($data); | 
| 735 | 1008 | unset($data); | 
| @@ -766,27 +1039,61 @@ discard block | ||
| 766 | 1039 |  		foreach ($all_data['acList'] as $line) { | 
| 767 | 1040 | $data = array(); | 
| 768 | 1041 | $data['hex'] = $line['Icao']; // hex | 
| 769 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident | |
| 770 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude | |
| 771 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed | |
| 772 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading | |
| 773 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat | |
| 774 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long | |
| 1042 | +		    if (isset($line['Call'])) { | |
| 1043 | + $data['ident'] = $line['Call']; | |
| 1044 | + } | |
| 1045 | + // ident | |
| 1046 | +		    if (isset($line['Alt'])) { | |
| 1047 | + $data['altitude'] = $line['Alt']; | |
| 1048 | + } | |
| 1049 | + // altitude | |
| 1050 | +		    if (isset($line['Spd'])) { | |
| 1051 | + $data['speed'] = $line['Spd']; | |
| 1052 | + } | |
| 1053 | + // speed | |
| 1054 | +		    if (isset($line['Trak'])) { | |
| 1055 | + $data['heading'] = $line['Trak']; | |
| 1056 | + } | |
| 1057 | + // heading | |
| 1058 | +		    if (isset($line['Lat'])) { | |
| 1059 | + $data['latitude'] = $line['Lat']; | |
| 1060 | + } | |
| 1061 | + // lat | |
| 1062 | +		    if (isset($line['Long'])) { | |
| 1063 | + $data['longitude'] = $line['Long']; | |
| 1064 | + } | |
| 1065 | + // long | |
| 775 | 1066 | //$data['verticalrate'] = $line['']; // verticale rate | 
| 776 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk | |
| 1067 | +		    if (isset($line['Sqk'])) { | |
| 1068 | + $data['squawk'] = $line['Sqk']; | |
| 1069 | + } | |
| 1070 | + // squawk | |
| 777 | 1071 | $data['emergency'] = ''; // emergency | 
| 778 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; | |
| 1072 | +		    if (isset($line['Reg'])) { | |
| 1073 | + $data['registration'] = $line['Reg']; | |
| 1074 | + } | |
| 779 | 1075 | |
| 780 | -		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); | |
| 781 | -		    else $data['datetime'] = date('Y-m-d H:i:s'); | |
| 1076 | +		    if (isset($line['PosTime'])) { | |
| 1077 | +		    	$data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); | |
| 1078 | +		    } else { | |
| 1079 | +		    	$data['datetime'] = date('Y-m-d H:i:s'); | |
| 1080 | + } | |
| 782 | 1081 | |
| 783 | 1082 |  		    //$data['datetime'] = date('Y-m-d H:i:s'); | 
| 784 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; | |
| 1083 | +		    if (isset($line['Type'])) { | |
| 1084 | + $data['aircraft_icao'] = $line['Type']; | |
| 1085 | + } | |
| 785 | 1086 | $data['format_source'] = 'aircraftlistjson'; | 
| 786 | 1087 | $data['id_source'] = $id_source; | 
| 787 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 788 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 789 | - if (isset($data['latitude'])) $SI->add($data); | |
| 1088 | +		    if (isset($value['name']) && $value['name'] != '') { | |
| 1089 | + $data['source_name'] = $value['name']; | |
| 1090 | + } | |
| 1091 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 1092 | + $data['noarchive'] = true; | |
| 1093 | + } | |
| 1094 | +		    if (isset($data['latitude'])) { | |
| 1095 | + $SI->add($data); | |
| 1096 | + } | |
| 790 | 1097 | unset($data); | 
| 791 | 1098 | } | 
| 792 | 1099 |  	    } elseif (is_array($all_data)) { | 
| @@ -803,12 +1110,19 @@ discard block | ||
| 803 | 1110 | $data['verticalrate'] = $line['vrt']; // verticale rate | 
| 804 | 1111 | $data['squawk'] = $line['squawk']; // squawk | 
| 805 | 1112 | $data['emergency'] = ''; // emergency | 
| 806 | -		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); | |
| 807 | -		    else $data['datetime'] = date('Y-m-d H:i:s'); | |
| 1113 | +		    if (isset($line['PosTime'])) { | |
| 1114 | +		    	$data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); | |
| 1115 | +		    } else { | |
| 1116 | +		    	$data['datetime'] = date('Y-m-d H:i:s'); | |
| 1117 | + } | |
| 808 | 1118 | $data['format_source'] = 'aircraftlistjson'; | 
| 809 | 1119 | $data['id_source'] = $id_source; | 
| 810 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 811 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 1120 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 1121 | + $data['noarchive'] = true; | |
| 1122 | + } | |
| 1123 | +		    if (isset($value['name']) && $value['name'] != '') { | |
| 1124 | + $data['source_name'] = $value['name']; | |
| 1125 | + } | |
| 812 | 1126 | $SI->add($data); | 
| 813 | 1127 | unset($data); | 
| 814 | 1128 | } | 
| @@ -844,8 +1158,12 @@ discard block | ||
| 844 | 1158 |  		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]); | 
| 845 | 1159 | $data['format_source'] = 'planeupdatefaa'; | 
| 846 | 1160 | $data['id_source'] = $id_source; | 
| 847 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 848 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 1161 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 1162 | + $data['noarchive'] = true; | |
| 1163 | + } | |
| 1164 | +		    if (isset($value['name']) && $value['name'] != '') { | |
| 1165 | + $data['source_name'] = $value['name']; | |
| 1166 | + } | |
| 849 | 1167 | $SI->add($data); | 
| 850 | 1168 | unset($data); | 
| 851 | 1169 | } | 
| @@ -874,7 +1192,9 @@ discard block | ||
| 874 | 1192 |  		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]); | 
| 875 | 1193 | $data['format_source'] = 'opensky'; | 
| 876 | 1194 | $data['id_source'] = $id_source; | 
| 877 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 1195 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 1196 | + $data['noarchive'] = true; | |
| 1197 | + } | |
| 878 | 1198 | $SI->add($data); | 
| 879 | 1199 | unset($data); | 
| 880 | 1200 | } | 
| @@ -886,7 +1206,9 @@ discard block | ||
| 886 | 1206 | //$buffer = $Common->getData($hosts[$id]); | 
| 887 | 1207 | $buffer = $Common->getData($value['host']); | 
| 888 | 1208 | $all_data = json_decode($buffer,true); | 
| 889 | - if (!empty($all_data)) $reset = 0; | |
| 1209 | +	    if (!empty($all_data)) { | |
| 1210 | + $reset = 0; | |
| 1211 | + } | |
| 890 | 1212 |  	    foreach ($all_data as $key => $line) { | 
| 891 | 1213 |  		if ($key != 'full_count' && $key != 'version' && $key != 'stats') { | 
| 892 | 1214 | $data = array(); | 
| @@ -907,8 +1229,12 @@ discard block | ||
| 907 | 1229 |  		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] | 
| 908 | 1230 | $data['format_source'] = 'fr24json'; | 
| 909 | 1231 | $data['id_source'] = $id_source; | 
| 910 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 911 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 1232 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 1233 | + $data['noarchive'] = true; | |
| 1234 | + } | |
| 1235 | +		    if (isset($value['name']) && $value['name'] != '') { | |
| 1236 | + $data['source_name'] = $value['name']; | |
| 1237 | + } | |
| 912 | 1238 | $SI->add($data); | 
| 913 | 1239 | unset($data); | 
| 914 | 1240 | } | 
| @@ -932,24 +1258,42 @@ discard block | ||
| 932 | 1258 |  		    if (isset($line['inf'])) { | 
| 933 | 1259 | $data = array(); | 
| 934 | 1260 | $data['hex'] = $line['inf']['ia']; | 
| 935 | - if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] | |
| 1261 | +			if (isset($line['inf']['cs'])) { | |
| 1262 | + $data['ident'] = $line['inf']['cs']; | |
| 1263 | + } | |
| 1264 | + //$line[13] | |
| 936 | 1265 | $data['altitude'] = round($line['inf']['al']*3.28084); // altitude | 
| 937 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed | |
| 938 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading | |
| 1266 | +	    		if (isset($line['inf']['gs'])) { | |
| 1267 | + $data['speed'] = round($line['inf']['gs']*0.539957); | |
| 1268 | + } | |
| 1269 | + // speed | |
| 1270 | +	    		if (isset($line['inf']['tr'])) { | |
| 1271 | + $data['heading'] = $line['inf']['tr']; | |
| 1272 | + } | |
| 1273 | + // heading | |
| 939 | 1274 | $data['latitude'] = $line['pt'][0]; // lat | 
| 940 | 1275 | $data['longitude'] = $line['pt'][1]; // long | 
| 941 | 1276 | //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate | 
| 942 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk | |
| 1277 | +	    		if (isset($line['inf']['sq'])) { | |
| 1278 | + $data['squawk'] = $line['inf']['sq']; | |
| 1279 | + } | |
| 1280 | + // squawk | |
| 943 | 1281 | //$data['aircraft_icao'] = $line[8]; | 
| 944 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; | |
| 1282 | +	    		if (isset($line['inf']['rc'])) { | |
| 1283 | + $data['registration'] = $line['inf']['rc']; | |
| 1284 | + } | |
| 945 | 1285 | //$data['departure_airport_iata'] = $line[11]; | 
| 946 | 1286 | //$data['arrival_airport_iata'] = $line[12]; | 
| 947 | 1287 | //$data['emergency'] = ''; // emergency | 
| 948 | 1288 |  			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] | 
| 949 | 1289 | $data['format_source'] = 'radarvirtueljson'; | 
| 950 | 1290 | $data['id_source'] = $id_source; | 
| 951 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 952 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 1291 | +			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 1292 | + $data['noarchive'] = true; | |
| 1293 | + } | |
| 1294 | +			if (isset($value['name']) && $value['name'] != '') { | |
| 1295 | + $data['source_name'] = $value['name']; | |
| 1296 | + } | |
| 953 | 1297 | $SI->add($data); | 
| 954 | 1298 | unset($data); | 
| 955 | 1299 | } | 
| @@ -970,30 +1314,65 @@ discard block | ||
| 970 | 1314 | $data['id'] = $line['id']; | 
| 971 | 1315 | $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); | 
| 972 | 1316 | $data['ident'] = $line['callsign']; // ident | 
| 973 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id | |
| 974 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name | |
| 975 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude | |
| 976 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed | |
| 977 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading | |
| 978 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route | |
| 1317 | +		    if (isset($line['pilotid'])) { | |
| 1318 | + $data['pilot_id'] = $line['pilotid']; | |
| 1319 | + } | |
| 1320 | + // pilot id | |
| 1321 | +		    if (isset($line['name'])) { | |
| 1322 | + $data['pilot_name'] = $line['name']; | |
| 1323 | + } | |
| 1324 | + // pilot name | |
| 1325 | +		    if (isset($line['alt'])) { | |
| 1326 | + $data['altitude'] = $line['alt']; | |
| 1327 | + } | |
| 1328 | + // altitude | |
| 1329 | +		    if (isset($line['gs'])) { | |
| 1330 | + $data['speed'] = $line['gs']; | |
| 1331 | + } | |
| 1332 | + // speed | |
| 1333 | +		    if (isset($line['heading'])) { | |
| 1334 | + $data['heading'] = $line['heading']; | |
| 1335 | + } | |
| 1336 | + // heading | |
| 1337 | +		    if (isset($line['route'])) { | |
| 1338 | + $data['waypoints'] = $line['route']; | |
| 1339 | + } | |
| 1340 | + // route | |
| 979 | 1341 | $data['latitude'] = $line['lat']; // lat | 
| 980 | 1342 | $data['longitude'] = $line['lon']; // long | 
| 981 | 1343 | //$data['verticalrate'] = $line['vrt']; // verticale rate | 
| 982 | 1344 | //$data['squawk'] = $line['squawk']; // squawk | 
| 983 | 1345 | //$data['emergency'] = ''; // emergency | 
| 984 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; | |
| 985 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; | |
| 986 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; | |
| 1346 | +		    if (isset($line['depicao'])) { | |
| 1347 | + $data['departure_airport_icao'] = $line['depicao']; | |
| 1348 | + } | |
| 1349 | +		    if (isset($line['deptime'])) { | |
| 1350 | + $data['departure_airport_time'] = $line['deptime']; | |
| 1351 | + } | |
| 1352 | +		    if (isset($line['arricao'])) { | |
| 1353 | + $data['arrival_airport_icao'] = $line['arricao']; | |
| 1354 | + } | |
| 987 | 1355 | //$data['arrival_airport_time'] = $line['arrtime']; | 
| 988 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; | |
| 989 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; | |
| 990 | - if (isset($line['atis'])) $data['info'] = $line['atis']; | |
| 991 | - else $data['info'] = ''; | |
| 1356 | +		    if (isset($line['aircraft'])) { | |
| 1357 | + $data['aircraft_icao'] = $line['aircraft']; | |
| 1358 | + } | |
| 1359 | +		    if (isset($line['transponder'])) { | |
| 1360 | + $data['squawk'] = $line['transponder']; | |
| 1361 | + } | |
| 1362 | +		    if (isset($line['atis'])) { | |
| 1363 | + $data['info'] = $line['atis']; | |
| 1364 | +		    } else { | |
| 1365 | + $data['info'] = ''; | |
| 1366 | + } | |
| 992 | 1367 | $data['format_source'] = 'pireps'; | 
| 993 | 1368 | $data['id_source'] = $id_source; | 
| 994 | 1369 |  		    $data['datetime'] = date('Y-m-d H:i:s'); | 
| 995 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 996 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 1370 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 1371 | + $data['noarchive'] = true; | |
| 1372 | + } | |
| 1373 | +		    if (isset($value['name']) && $value['name'] != '') { | |
| 1374 | + $data['source_name'] = $value['name']; | |
| 1375 | + } | |
| 997 | 1376 |  		    if ($line['icon'] == 'plane') { | 
| 998 | 1377 | $SI->add($data); | 
| 999 | 1378 | // print_r($data); | 
| @@ -1002,16 +1381,28 @@ discard block | ||
| 1002 | 1381 |  			$data['info'] = str_replace('&sect;','',$data['info']); | 
| 1003 | 1382 | $typec = substr($data['ident'],-3); | 
| 1004 | 1383 | $data['type'] = ''; | 
| 1005 | - if ($typec == 'APP') $data['type'] = 'Approach'; | |
| 1006 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; | |
| 1007 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; | |
| 1008 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; | |
| 1009 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; | |
| 1010 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; | |
| 1011 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; | |
| 1012 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; | |
| 1013 | - else $data['type'] = 'Observer'; | |
| 1014 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); | |
| 1384 | +			if ($typec == 'APP') { | |
| 1385 | + $data['type'] = 'Approach'; | |
| 1386 | +			} elseif ($typec == 'TWR') { | |
| 1387 | + $data['type'] = 'Tower'; | |
| 1388 | +			} elseif ($typec == 'OBS') { | |
| 1389 | + $data['type'] = 'Observer'; | |
| 1390 | +			} elseif ($typec == 'GND') { | |
| 1391 | + $data['type'] = 'Ground'; | |
| 1392 | +			} elseif ($typec == 'DEL') { | |
| 1393 | + $data['type'] = 'Delivery'; | |
| 1394 | +			} elseif ($typec == 'DEP') { | |
| 1395 | + $data['type'] = 'Departure'; | |
| 1396 | +			} elseif ($typec == 'FSS') { | |
| 1397 | + $data['type'] = 'Flight Service Station'; | |
| 1398 | +			} elseif ($typec == 'CTR') { | |
| 1399 | + $data['type'] = 'Control Radar or Centre'; | |
| 1400 | +			} else { | |
| 1401 | + $data['type'] = 'Observer'; | |
| 1402 | + } | |
| 1403 | +			if (isset($ATC)) { | |
| 1404 | + echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); | |
| 1405 | + } | |
| 1015 | 1406 | } | 
| 1016 | 1407 | unset($data); | 
| 1017 | 1408 | } | 
| @@ -1021,7 +1412,9 @@ discard block | ||
| 1021 | 1412 |      	//} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { | 
| 1022 | 1413 |      	} elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { | 
| 1023 | 1414 | //$buffer = $Common->getData($hosts[$id]); | 
| 1024 | - if ($globalDebug) echo 'Get Data...'."\n"; | |
| 1415 | +	    if ($globalDebug) { | |
| 1416 | + echo 'Get Data...'."\n"; | |
| 1417 | + } | |
| 1025 | 1418 | $buffer = $Common->getData($value['host']); | 
| 1026 | 1419 | $all_data = json_decode($buffer,true); | 
| 1027 | 1420 |  	    if ($buffer != '' && is_array($all_data)) { | 
| @@ -1029,10 +1422,16 @@ discard block | ||
| 1029 | 1422 |  		foreach ($all_data as $line) { | 
| 1030 | 1423 | $data = array(); | 
| 1031 | 1424 | //$data['id'] = $line['id']; // id not usable | 
| 1032 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; | |
| 1425 | +	    	    if (isset($line['pilotid'])) { | |
| 1426 | + $data['id'] = $line['pilotid'].$line['flightnum']; | |
| 1427 | + } | |
| 1033 | 1428 | $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex | 
| 1034 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; | |
| 1035 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; | |
| 1429 | +	    	    if (isset($line['pilotname'])) { | |
| 1430 | + $data['pilot_name'] = $line['pilotname']; | |
| 1431 | + } | |
| 1432 | +	    	    if (isset($line['pilotid'])) { | |
| 1433 | + $data['pilot_id'] = $line['pilotid']; | |
| 1434 | + } | |
| 1036 | 1435 | $data['ident'] = $line['flightnum']; // ident | 
| 1037 | 1436 | $data['altitude'] = $line['alt']; // altitude | 
| 1038 | 1437 | $data['speed'] = $line['gs']; // speed | 
| @@ -1048,34 +1447,52 @@ discard block | ||
| 1048 | 1447 | $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); | 
| 1049 | 1448 |  	    		$datetime->setTimeZone(new DateTimeZone('UTC')); | 
| 1050 | 1449 |  	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s'); | 
| 1051 | -	    	    } else $data['datetime'] = date('Y-m-d H:i:s'); | |
| 1450 | +	    	    } else { | |
| 1451 | +	    	    	$data['datetime'] = date('Y-m-d H:i:s'); | |
| 1452 | + } | |
| 1052 | 1453 | $data['departure_airport_icao'] = $line['depicao']; | 
| 1053 | 1454 | $data['departure_airport_time'] = $line['deptime']; | 
| 1054 | 1455 | $data['arrival_airport_icao'] = $line['arricao']; | 
| 1055 | 1456 | $data['arrival_airport_time'] = $line['arrtime']; | 
| 1056 | 1457 | $data['registration'] = $line['aircraft']; | 
| 1057 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 1058 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route | |
| 1458 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 1459 | + $data['noarchive'] = true; | |
| 1460 | + } | |
| 1461 | +		    if (isset($line['route'])) { | |
| 1462 | + $data['waypoints'] = $line['route']; | |
| 1463 | + } | |
| 1464 | + // route | |
| 1059 | 1465 |  		    if (isset($line['aircraftname'])) { | 
| 1060 | 1466 | $line['aircraftname'] = strtoupper($line['aircraftname']); | 
| 1061 | 1467 |  			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); | 
| 1062 | 1468 |  	    		$aircraft_data = explode('-',$line['aircraftname']); | 
| 1063 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; | |
| 1064 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; | |
| 1065 | -	    		else { | |
| 1469 | +	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) { | |
| 1470 | + $data['aircraft_icao'] = $aircraft_data[0]; | |
| 1471 | +	    		} elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) { | |
| 1472 | + $data['aircraft_icao'] = $aircraft_data[1]; | |
| 1473 | +	    		} else { | |
| 1066 | 1474 |  	    		    $aircraft_data = explode(' ',$line['aircraftname']); | 
| 1067 | -	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); | |
| 1068 | -	    		    else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); | |
| 1475 | +	    		    if (isset($aircraft_data[1])) { | |
| 1476 | +	    		    	$data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); | |
| 1477 | +	    		    } else { | |
| 1478 | +	    		    	$data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); | |
| 1479 | + } | |
| 1069 | 1480 | } | 
| 1070 | 1481 | } | 
| 1071 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; | |
| 1482 | +    		    if (isset($line['route'])) { | |
| 1483 | + $data['waypoints'] = $line['route']; | |
| 1484 | + } | |
| 1072 | 1485 | $data['id_source'] = $id_source; | 
| 1073 | 1486 | $data['format_source'] = 'phpvmacars'; | 
| 1074 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 1487 | +		    if (isset($value['name']) && $value['name'] != '') { | |
| 1488 | + $data['source_name'] = $value['name']; | |
| 1489 | + } | |
| 1075 | 1490 | $SI->add($data); | 
| 1076 | 1491 | unset($data); | 
| 1077 | 1492 | } | 
| 1078 | - if ($globalDebug) echo 'No more data...'."\n"; | |
| 1493 | +		if ($globalDebug) { | |
| 1494 | + echo 'No more data...'."\n"; | |
| 1495 | + } | |
| 1079 | 1496 | unset($buffer); | 
| 1080 | 1497 | unset($all_data); | 
| 1081 | 1498 | } | 
| @@ -1083,7 +1500,9 @@ discard block | ||
| 1083 | 1500 | $last_exec[$id]['last'] = time(); | 
| 1084 | 1501 |      	} elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { | 
| 1085 | 1502 | //$buffer = $Common->getData($hosts[$id]); | 
| 1086 | - if ($globalDebug) echo 'Get Data...'."\n"; | |
| 1503 | +	    if ($globalDebug) { | |
| 1504 | + echo 'Get Data...'."\n"; | |
| 1505 | + } | |
| 1087 | 1506 | $buffer = $Common->getData($value['host']); | 
| 1088 | 1507 | $all_data = json_decode($buffer,true); | 
| 1089 | 1508 |  	    if ($buffer != '' && is_array($all_data)) { | 
| @@ -1112,16 +1531,25 @@ discard block | ||
| 1112 | 1531 | $data['arrival_airport_icao'] = $line['arrival']; | 
| 1113 | 1532 | //$data['arrival_airport_time'] = $line['arrival_time']; | 
| 1114 | 1533 | //$data['registration'] = $line['aircraft']; | 
| 1115 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route | |
| 1534 | +		    if (isset($line['route'])) { | |
| 1535 | + $data['waypoints'] = $line['route']; | |
| 1536 | + } | |
| 1537 | + // route | |
| 1116 | 1538 | $data['aircraft_icao'] = $line['plane_type']; | 
| 1117 | 1539 | $data['id_source'] = $id_source; | 
| 1118 | 1540 | $data['format_source'] = 'vam'; | 
| 1119 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 1120 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 1541 | +		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { | |
| 1542 | + $data['noarchive'] = true; | |
| 1543 | + } | |
| 1544 | +		    if (isset($value['name']) && $value['name'] != '') { | |
| 1545 | + $data['source_name'] = $value['name']; | |
| 1546 | + } | |
| 1121 | 1547 | $SI->add($data); | 
| 1122 | 1548 | unset($data); | 
| 1123 | 1549 | } | 
| 1124 | - if ($globalDebug) echo 'No more data...'."\n"; | |
| 1550 | +		if ($globalDebug) { | |
| 1551 | + echo 'No more data...'."\n"; | |
| 1552 | + } | |
| 1125 | 1553 | unset($buffer); | 
| 1126 | 1554 | unset($all_data); | 
| 1127 | 1555 | } | 
| @@ -1129,7 +1557,9 @@ discard block | ||
| 1129 | 1557 | $last_exec[$id]['last'] = time(); | 
| 1130 | 1558 |  	//} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { | 
| 1131 | 1559 |  	} elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'famaprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3' || $value['format'] == 'ais' || $value['format'] == 'vrstcp') { | 
| 1132 | -	    if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); | |
| 1560 | +	    if (function_exists('pcntl_fork')) { | |
| 1561 | + pcntl_signal_dispatch(); | |
| 1562 | + } | |
| 1133 | 1563 | //$last_exec[$id]['last'] = time(); | 
| 1134 | 1564 | |
| 1135 | 1565 | //$read = array( $sockets[$id] ); | 
| @@ -1137,7 +1567,9 @@ discard block | ||
| 1137 | 1567 | $write = NULL; | 
| 1138 | 1568 | $e = NULL; | 
| 1139 | 1569 | $n = socket_select($read, $write, $e, $timeout); | 
| 1140 | - if ($e != NULL) var_dump($e); | |
| 1570 | +	    if ($e != NULL) { | |
| 1571 | + var_dump($e); | |
| 1572 | + } | |
| 1141 | 1573 |  	    if ($n > 0) { | 
| 1142 | 1574 | $reset = 0; | 
| 1143 | 1575 |  		foreach ($read as $nb => $r) { | 
| @@ -1158,12 +1590,16 @@ discard block | ||
| 1158 | 1590 | //$SI::del(); | 
| 1159 | 1591 |  		    if ($format == 'vrstcp') { | 
| 1160 | 1592 |  			$buffer = explode('},{',$buffer); | 
| 1161 | -		    } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); | |
| 1593 | +		    } else { | |
| 1594 | +		    	$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); | |
| 1595 | + } | |
| 1162 | 1596 | // SBS format is CSV format | 
| 1163 | 1597 |  		    if ($buffer !== FALSE && $buffer != '') { | 
| 1164 | 1598 | $tt[$format] = 0; | 
| 1165 | 1599 |  			if ($format == 'acarssbs3') { | 
| 1166 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; | |
| 1600 | +			    if ($globalDebug) { | |
| 1601 | + echo 'ACARS : '.$buffer."\n"; | |
| 1602 | + } | |
| 1167 | 1603 | $ACARS->add(trim($buffer)); | 
| 1168 | 1604 | $ACARS->deleteLiveAcarsData(); | 
| 1169 | 1605 |  			} elseif ($format == 'raw') { | 
| @@ -1172,30 +1608,70 @@ discard block | ||
| 1172 | 1608 |  			    if (is_array($data)) { | 
| 1173 | 1609 |  				$data['datetime'] = date('Y-m-d H:i:s'); | 
| 1174 | 1610 | $data['format_source'] = 'raw'; | 
| 1175 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; | |
| 1176 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | |
| 1177 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 1178 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); | |
| 1611 | +				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { | |
| 1612 | + $data['source_name'] = $globalSources[$nb]['name']; | |
| 1613 | + } | |
| 1614 | +				if (isset($globalSources[$nb]['sourcestats'])) { | |
| 1615 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | |
| 1616 | + } | |
| 1617 | +				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { | |
| 1618 | + $data['noarchive'] = true; | |
| 1619 | + } | |
| 1620 | +				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { | |
| 1621 | + $SI->add($data); | |
| 1622 | + } | |
| 1179 | 1623 | } | 
| 1180 | 1624 |  			} elseif ($format == 'ais') { | 
| 1181 | 1625 | $ais_data = $AIS->parse_line(trim($buffer)); | 
| 1182 | 1626 | $data = array(); | 
| 1183 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; | |
| 1184 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; | |
| 1185 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; | |
| 1186 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; | |
| 1187 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; | |
| 1188 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; | |
| 1189 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; | |
| 1190 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; | |
| 1191 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; | |
| 1192 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; | |
| 1193 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; | |
| 1194 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; | |
| 1195 | -			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); | |
| 1196 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 1197 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; | |
| 1198 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | |
| 1627 | +			    if (isset($ais_data['ident'])) { | |
| 1628 | + $data['ident'] = $ais_data['ident']; | |
| 1629 | + } | |
| 1630 | +			    if (isset($ais_data['mmsi'])) { | |
| 1631 | + $data['mmsi'] = $ais_data['mmsi']; | |
| 1632 | + } | |
| 1633 | +			    if (isset($ais_data['speed'])) { | |
| 1634 | + $data['speed'] = $ais_data['speed']; | |
| 1635 | + } | |
| 1636 | +			    if (isset($ais_data['heading'])) { | |
| 1637 | + $data['heading'] = $ais_data['heading']; | |
| 1638 | + } | |
| 1639 | +			    if (isset($ais_data['latitude'])) { | |
| 1640 | + $data['latitude'] = $ais_data['latitude']; | |
| 1641 | + } | |
| 1642 | +			    if (isset($ais_data['longitude'])) { | |
| 1643 | + $data['longitude'] = $ais_data['longitude']; | |
| 1644 | + } | |
| 1645 | +			    if (isset($ais_data['status'])) { | |
| 1646 | + $data['status'] = $ais_data['status']; | |
| 1647 | + } | |
| 1648 | +			    if (isset($ais_data['statusid'])) { | |
| 1649 | + $data['status_id'] = $ais_data['statusid']; | |
| 1650 | + } | |
| 1651 | +			    if (isset($ais_data['type'])) { | |
| 1652 | + $data['type'] = $ais_data['type']; | |
| 1653 | + } | |
| 1654 | +			    if (isset($ais_data['imo'])) { | |
| 1655 | + $data['imo'] = $ais_data['imo']; | |
| 1656 | + } | |
| 1657 | +			    if (isset($ais_data['callsign'])) { | |
| 1658 | + $data['callsign'] = $ais_data['callsign']; | |
| 1659 | + } | |
| 1660 | +			    if (isset($ais_data['destination'])) { | |
| 1661 | + $data['arrival_code'] = $ais_data['destination']; | |
| 1662 | + } | |
| 1663 | +			    if (isset($ais_data['eta_ts'])) { | |
| 1664 | +			    	$data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); | |
| 1665 | + } | |
| 1666 | +			    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { | |
| 1667 | + $data['noarchive'] = true; | |
| 1668 | + } | |
| 1669 | +			    if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { | |
| 1670 | + $data['source_name'] = $globalSources[$nb]['name']; | |
| 1671 | + } | |
| 1672 | +			    if (isset($globalSources[$nb]['sourcestats'])) { | |
| 1673 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | |
| 1674 | + } | |
| 1199 | 1675 | |
| 1200 | 1676 |  			    if (isset($ais_data['timestamp'])) { | 
| 1201 | 1677 |  				$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); | 
| @@ -1204,7 +1680,9 @@ discard block | ||
| 1204 | 1680 | } | 
| 1205 | 1681 | $data['format_source'] = 'aisnmea'; | 
| 1206 | 1682 | $data['id_source'] = $id_source; | 
| 1207 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); | |
| 1683 | +			    if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { | |
| 1684 | + $MI->add($data); | |
| 1685 | + } | |
| 1208 | 1686 | unset($data); | 
| 1209 | 1687 |                          } elseif ($format == 'flightgearsp') { | 
| 1210 | 1688 | //echo $buffer."\n"; | 
| @@ -1222,12 +1700,18 @@ discard block | ||
| 1222 | 1700 | $data['speed'] = round($line[5]*1.94384); | 
| 1223 | 1701 |  				$data['datetime'] = date('Y-m-d H:i:s'); | 
| 1224 | 1702 | $data['format_source'] = 'flightgearsp'; | 
| 1225 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 1226 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); | |
| 1703 | +				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { | |
| 1704 | + $data['noarchive'] = true; | |
| 1705 | + } | |
| 1706 | +				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { | |
| 1707 | + $SI->add($data); | |
| 1708 | + } | |
| 1227 | 1709 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); | 
| 1228 | 1710 | } | 
| 1229 | 1711 |                          } elseif ($format == 'acars') { | 
| 1230 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; | |
| 1712 | +                    	    if ($globalDebug) { | |
| 1713 | + echo 'ACARS : '.$buffer."\n"; | |
| 1714 | + } | |
| 1231 | 1715 | $ACARS->add(trim($buffer)); | 
| 1232 | 1716 | socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); | 
| 1233 | 1717 | $ACARS->deleteLiveAcarsData(); | 
| @@ -1248,8 +1732,12 @@ discard block | ||
| 1248 | 1732 | $aircraft_type = $line[10]; | 
| 1249 | 1733 |  				    $aircraft_type = preg_split(':/:',$aircraft_type); | 
| 1250 | 1734 | $data['aircraft_name'] = substr(end($aircraft_type),0,-4); | 
| 1251 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 1252 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); | |
| 1735 | +				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { | |
| 1736 | + $data['noarchive'] = true; | |
| 1737 | + } | |
| 1738 | +				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { | |
| 1739 | + $SI->add($data); | |
| 1740 | + } | |
| 1253 | 1741 | } | 
| 1254 | 1742 | } | 
| 1255 | 1743 |  			} elseif ($format == 'beast') { | 
| @@ -1259,28 +1747,62 @@ discard block | ||
| 1259 | 1747 |  			    foreach($buffer as $all_data) { | 
| 1260 | 1748 |  				$line = json_decode('{'.$all_data.'}',true); | 
| 1261 | 1749 | $data = array(); | 
| 1262 | - if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex | |
| 1263 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident | |
| 1264 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude | |
| 1265 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed | |
| 1266 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading | |
| 1267 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat | |
| 1268 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long | |
| 1750 | +				if (isset($line['Icao'])) { | |
| 1751 | + $data['hex'] = $line['Icao']; | |
| 1752 | + } | |
| 1753 | + // hex | |
| 1754 | +				if (isset($line['Call'])) { | |
| 1755 | + $data['ident'] = $line['Call']; | |
| 1756 | + } | |
| 1757 | + // ident | |
| 1758 | +				if (isset($line['Alt'])) { | |
| 1759 | + $data['altitude'] = $line['Alt']; | |
| 1760 | + } | |
| 1761 | + // altitude | |
| 1762 | +				if (isset($line['Spd'])) { | |
| 1763 | + $data['speed'] = $line['Spd']; | |
| 1764 | + } | |
| 1765 | + // speed | |
| 1766 | +				if (isset($line['Trak'])) { | |
| 1767 | + $data['heading'] = $line['Trak']; | |
| 1768 | + } | |
| 1769 | + // heading | |
| 1770 | +				if (isset($line['Lat'])) { | |
| 1771 | + $data['latitude'] = $line['Lat']; | |
| 1772 | + } | |
| 1773 | + // lat | |
| 1774 | +				if (isset($line['Long'])) { | |
| 1775 | + $data['longitude'] = $line['Long']; | |
| 1776 | + } | |
| 1777 | + // long | |
| 1269 | 1778 | //$data['verticalrate'] = $line['']; // verticale rate | 
| 1270 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk | |
| 1779 | +				if (isset($line['Sqk'])) { | |
| 1780 | + $data['squawk'] = $line['Sqk']; | |
| 1781 | + } | |
| 1782 | + // squawk | |
| 1271 | 1783 | $data['emergency'] = ''; // emergency | 
| 1272 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; | |
| 1784 | +				if (isset($line['Reg'])) { | |
| 1785 | + $data['registration'] = $line['Reg']; | |
| 1786 | + } | |
| 1273 | 1787 | /* | 
| 1274 | 1788 |  				if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); | 
| 1275 | 1789 |  				else $data['datetime'] = date('Y-m-d H:i:s'); | 
| 1276 | 1790 | */ | 
| 1277 | 1791 |  				$data['datetime'] = date('Y-m-d H:i:s'); | 
| 1278 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; | |
| 1792 | +				if (isset($line['Type'])) { | |
| 1793 | + $data['aircraft_icao'] = $line['Type']; | |
| 1794 | + } | |
| 1279 | 1795 | $data['format_source'] = 'vrstcp'; | 
| 1280 | 1796 | $data['id_source'] = $id_source; | 
| 1281 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 1282 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; | |
| 1283 | - if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); | |
| 1797 | +				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { | |
| 1798 | + $data['noarchive'] = true; | |
| 1799 | + } | |
| 1800 | +				if (isset($value['name']) && $value['name'] != '') { | |
| 1801 | + $data['source_name'] = $value['name']; | |
| 1802 | + } | |
| 1803 | +				if (isset($data['latitude']) && isset($data['hex'])) { | |
| 1804 | + $SI->add($data); | |
| 1805 | + } | |
| 1284 | 1806 | unset($data); | 
| 1285 | 1807 | } | 
| 1286 | 1808 |  			} elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { | 
| @@ -1293,22 +1815,46 @@ discard block | ||
| 1293 | 1815 | $data['hex'] = $lined['hexid']; | 
| 1294 | 1816 |      				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; | 
| 1295 | 1817 |      				$data['datetime'] = date('Y-m-d H:i:s');; | 
| 1296 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; | |
| 1297 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; | |
| 1298 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; | |
| 1299 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; | |
| 1300 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; | |
| 1301 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; | |
| 1302 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; | |
| 1818 | +    				if (isset($lined['ident'])) { | |
| 1819 | + $data['ident'] = $lined['ident']; | |
| 1820 | + } | |
| 1821 | +    				if (isset($lined['lat'])) { | |
| 1822 | + $data['latitude'] = $lined['lat']; | |
| 1823 | + } | |
| 1824 | +    				if (isset($lined['lon'])) { | |
| 1825 | + $data['longitude'] = $lined['lon']; | |
| 1826 | + } | |
| 1827 | +    				if (isset($lined['speed'])) { | |
| 1828 | + $data['speed'] = $lined['speed']; | |
| 1829 | + } | |
| 1830 | +    				if (isset($lined['squawk'])) { | |
| 1831 | + $data['squawk'] = $lined['squawk']; | |
| 1832 | + } | |
| 1833 | +    				if (isset($lined['alt'])) { | |
| 1834 | + $data['altitude'] = $lined['alt']; | |
| 1835 | + } | |
| 1836 | +    				if (isset($lined['heading'])) { | |
| 1837 | + $data['heading'] = $lined['heading']; | |
| 1838 | + } | |
| 1303 | 1839 | $data['id_source'] = $id_source; | 
| 1304 | 1840 | $data['format_source'] = 'tsv'; | 
| 1305 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; | |
| 1306 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | |
| 1307 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 1308 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); | |
| 1841 | +    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { | |
| 1842 | + $data['source_name'] = $globalSources[$nb]['name']; | |
| 1843 | + } | |
| 1844 | +    				if (isset($globalSources[$nb]['sourcestats'])) { | |
| 1845 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | |
| 1846 | + } | |
| 1847 | +				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { | |
| 1848 | + $data['noarchive'] = true; | |
| 1849 | + } | |
| 1850 | +    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { | |
| 1851 | + $SI->add($data); | |
| 1852 | + } | |
| 1309 | 1853 | unset($lined); | 
| 1310 | 1854 | unset($data); | 
| 1311 | - } else $error = true; | |
| 1855 | +    			    } else { | |
| 1856 | + $error = true; | |
| 1857 | + } | |
| 1312 | 1858 |  			} elseif ($format == 'aprs' && $use_aprs) { | 
| 1313 | 1859 |  			    if ($aprs_connect == 0) { | 
| 1314 | 1860 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); | 
| @@ -1333,59 +1879,117 @@ discard block | ||
| 1333 | 1879 | $aprs_last_tx = time(); | 
| 1334 | 1880 | $data = array(); | 
| 1335 | 1881 | //print_r($line); | 
| 1336 | - if (isset($line['address'])) $data['hex'] = $line['address']; | |
| 1337 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; | |
| 1338 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; | |
| 1339 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; | |
| 1340 | - if (isset($line['arrival_code'])) $data['arrical_code'] = $line['arrival_code']; | |
| 1341 | - if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; | |
| 1342 | - if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; | |
| 1343 | - if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; | |
| 1344 | -				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); | |
| 1345 | -				    else $data['datetime'] = date('Y-m-d H:i:s'); | |
| 1882 | +				    if (isset($line['address'])) { | |
| 1883 | + $data['hex'] = $line['address']; | |
| 1884 | + } | |
| 1885 | +				    if (isset($line['mmsi'])) { | |
| 1886 | + $data['mmsi'] = $line['mmsi']; | |
| 1887 | + } | |
| 1888 | +				    if (isset($line['imo'])) { | |
| 1889 | + $data['imo'] = $line['imo']; | |
| 1890 | + } | |
| 1891 | +				    if (isset($line['squawk'])) { | |
| 1892 | + $data['squawk'] = $line['squawk']; | |
| 1893 | + } | |
| 1894 | +				    if (isset($line['arrival_code'])) { | |
| 1895 | + $data['arrical_code'] = $line['arrival_code']; | |
| 1896 | + } | |
| 1897 | +				    if (isset($line['arrival_date'])) { | |
| 1898 | + $data['arrical_date'] = $line['arrival_date']; | |
| 1899 | + } | |
| 1900 | +				    if (isset($line['type_id'])) { | |
| 1901 | + $data['type_id'] = $line['typeid']; | |
| 1902 | + } | |
| 1903 | +				    if (isset($line['status_id'])) { | |
| 1904 | + $data['status_id'] = $line['statusid']; | |
| 1905 | + } | |
| 1906 | +				    if (isset($line['timestamp'])) { | |
| 1907 | +				    	$data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); | |
| 1908 | +				    } else { | |
| 1909 | +				    	$data['datetime'] = date('Y-m-d H:i:s'); | |
| 1910 | + } | |
| 1346 | 1911 |  				    //$data['datetime'] = date('Y-m-d H:i:s'); | 
| 1347 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; | |
| 1912 | +				    if (isset($line['ident'])) { | |
| 1913 | + $data['ident'] = $line['ident']; | |
| 1914 | + } | |
| 1348 | 1915 | $data['latitude'] = $line['latitude']; | 
| 1349 | 1916 | $data['longitude'] = $line['longitude']; | 
| 1350 | 1917 | //$data['verticalrate'] = $line[16]; | 
| 1351 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; | |
| 1918 | +				    if (isset($line['speed'])) { | |
| 1919 | + $data['speed'] = $line['speed']; | |
| 1920 | + } | |
| 1352 | 1921 | //else $data['speed'] = 0; | 
| 1353 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; | |
| 1354 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; | |
| 1355 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; | |
| 1356 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; | |
| 1922 | +				    if (isset($line['altitude'])) { | |
| 1923 | + $data['altitude'] = $line['altitude']; | |
| 1924 | + } | |
| 1925 | +				    if (isset($line['comment'])) { | |
| 1926 | + $data['comment'] = $line['comment']; | |
| 1927 | + } | |
| 1928 | +				    if (isset($line['symbol'])) { | |
| 1929 | + $data['type'] = $line['symbol']; | |
| 1930 | + } | |
| 1931 | +				    if (isset($line['heading'])) { | |
| 1932 | + $data['heading'] = $line['heading']; | |
| 1933 | + } | |
| 1357 | 1934 | //else $data['heading'] = 0; | 
| 1358 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; | |
| 1935 | +				    if (isset($line['stealth'])) { | |
| 1936 | + $data['aircraft_type'] = $line['stealth']; | |
| 1937 | + } | |
| 1359 | 1938 | //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; | 
| 1360 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; | |
| 1361 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; | |
| 1362 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 1363 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; | |
| 1939 | +				    if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) { | |
| 1940 | + $data['noarchive'] = true; | |
| 1941 | +				    } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) { | |
| 1942 | + $data['noarchive'] = false; | |
| 1943 | + } | |
| 1944 | +				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { | |
| 1945 | + $data['noarchive'] = true; | |
| 1946 | +				    } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) { | |
| 1947 | + $data['noarchive'] = false; | |
| 1948 | + } | |
| 1364 | 1949 | $data['id_source'] = $id_source; | 
| 1365 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; | |
| 1366 | - else $data['format_source'] = 'aprs'; | |
| 1950 | +    				    if (isset($line['format_source'])) { | |
| 1951 | + $data['format_source'] = $line['format_source']; | |
| 1952 | +    				    } else { | |
| 1953 | + $data['format_source'] = 'aprs'; | |
| 1954 | + } | |
| 1367 | 1955 | $data['source_name'] = $line['source']; | 
| 1368 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; | |
| 1369 | - else $data['source_type'] = 'flarm'; | |
| 1370 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | |
| 1956 | +				    if (isset($line['source_type'])) { | |
| 1957 | + $data['source_type'] = $line['source_type']; | |
| 1958 | +				    } else { | |
| 1959 | + $data['source_type'] = 'flarm'; | |
| 1960 | + } | |
| 1961 | +    				    if (isset($globalSources[$nb]['sourcestats'])) { | |
| 1962 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | |
| 1963 | + } | |
| 1371 | 1964 |  				    $currentdate = date('Y-m-d H:i:s'); | 
| 1372 | 1965 | $aprsdate = strtotime($data['datetime']); | 
| 1373 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; | |
| 1966 | +				    if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') { | |
| 1967 | + $data['altitude_relative'] = 'AMSL'; | |
| 1968 | + } | |
| 1374 | 1969 | // Accept data if time <= system time + 20s | 
| 1375 | 1970 |  				    //if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { | 
| 1376 | 1971 |  				    if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { | 
| 1377 | 1972 | $send = $SI->add($data); | 
| 1378 | 1973 |  				    } elseif ($data['source_type'] == 'ais') { | 
| 1379 | - if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); | |
| 1974 | +					if (isset($globalMarine) && $globalMarine) { | |
| 1975 | + $send = $MI->add($data); | |
| 1976 | + } | |
| 1380 | 1977 |  				    } elseif (isset($line['stealth'])) { | 
| 1381 | - if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; | |
| 1382 | - else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; | |
| 1978 | +					if ($line['stealth'] != 0) { | |
| 1979 | + echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; | |
| 1980 | +					} else { | |
| 1981 | + echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; | |
| 1982 | + } | |
| 1383 | 1983 | } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( | 
| 1384 | 1984 | //$line['symbol'] == 'Balloon' || | 
| 1385 | 1985 | $line['symbol'] == 'Glider' || | 
| 1386 | 1986 |  					    $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) { | 
| 1387 | - if ($line['symbol'] == 'Ballon') $data['aircraft_icao'] = 'BALL'; | |
| 1388 | - if ($line['symbol'] == 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; | |
| 1987 | +					    if ($line['symbol'] == 'Ballon') { | |
| 1988 | + $data['aircraft_icao'] = 'BALL'; | |
| 1989 | + } | |
| 1990 | +					    if ($line['symbol'] == 'Glider') { | |
| 1991 | + $data['aircraft_icao'] = 'PARAGLIDER'; | |
| 1992 | + } | |
| 1389 | 1993 | $send = $SI->add($data); | 
| 1390 | 1994 | } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( | 
| 1391 | 1995 | $line['symbol'] == 'Yacht (Sail)' || | 
| @@ -1416,9 +2020,13 @@ discard block | ||
| 1416 | 2020 |  				    //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { | 
| 1417 | 2021 |  				//    } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { | 
| 1418 | 2022 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; | 
| 1419 | - if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); | |
| 2023 | +					if (isset($globalTracker) && $globalTracker) { | |
| 2024 | + $send = $TI->add($data); | |
| 2025 | + } | |
| 1420 | 2026 |  				    } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { | 
| 1421 | - if (!isset($data['altitude'])) $data['altitude'] = 0; | |
| 2027 | +					if (!isset($data['altitude'])) { | |
| 2028 | + $data['altitude'] = 0; | |
| 2029 | + } | |
| 1422 | 2030 |  					$Source->deleteOldLocationByType('gs'); | 
| 1423 | 2031 |  					if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { | 
| 1424 | 2032 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); | 
| @@ -1427,7 +2035,9 @@ discard block | ||
| 1427 | 2035 | } | 
| 1428 | 2036 |  				    } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') { | 
| 1429 | 2037 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; | 
| 1430 | - if ($globalDebug) echo '# Weather Station added'."\n"; | |
| 2038 | +					if ($globalDebug) { | |
| 2039 | + echo '# Weather Station added'."\n"; | |
| 2040 | + } | |
| 1431 | 2041 |  					$Source->deleteOldLocationByType('wx'); | 
| 1432 | 2042 | $weather_data = json_encode($line); | 
| 1433 | 2043 |  					if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { | 
| @@ -1437,7 +2047,9 @@ discard block | ||
| 1437 | 2047 | } | 
| 1438 | 2048 |  				    } elseif (isset($line['symbol']) && $line['symbol'] == 'Lightning') { | 
| 1439 | 2049 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; | 
| 1440 | - if ($globalDebug) echo '☈ Lightning added'."\n"; | |
| 2050 | +					if ($globalDebug) { | |
| 2051 | + echo '☈ Lightning added'."\n"; | |
| 2052 | + } | |
| 1441 | 2053 |  					$Source->deleteOldLocationByType('lightning'); | 
| 1442 | 2054 |  					if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { | 
| 1443 | 2055 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); | 
| @@ -1449,8 +2061,7 @@ discard block | ||
| 1449 | 2061 | print_r($line); | 
| 1450 | 2062 | } | 
| 1451 | 2063 | unset($data); | 
| 1452 | - } | |
| 1453 | -				elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { | |
| 2064 | +				} elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { | |
| 1454 | 2065 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); | 
| 1455 | 2066 | } | 
| 1456 | 2067 | /* | 
| @@ -1459,7 +2070,9 @@ discard block | ||
| 1459 | 2070 | } | 
| 1460 | 2071 | */ | 
| 1461 | 2072 |  				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; | 
| 1462 | - elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; | |
| 2073 | +				elseif ($line == true && $globalDebug) { | |
| 2074 | + echo '!! Failed : '.$buffer."!!\n"; | |
| 2075 | + } | |
| 1463 | 2076 |  				if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { | 
| 1464 | 2077 |  					$Source->deleteOldLocationByType('lightning'); | 
| 1465 | 2078 |  					$Source->deleteOldLocationByType('wx'); | 
| @@ -1495,26 +2108,45 @@ discard block | ||
| 1495 | 2108 | $data['ground'] = $line[21]; | 
| 1496 | 2109 | $data['emergency'] = $line[19]; | 
| 1497 | 2110 | $data['format_source'] = 'sbs'; | 
| 1498 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; | |
| 1499 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | |
| 1500 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; | |
| 2111 | +				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { | |
| 2112 | + $data['source_name'] = $globalSources[$nb]['name']; | |
| 2113 | + } | |
| 2114 | +    				if (isset($globalSources[$nb]['sourcestats'])) { | |
| 2115 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; | |
| 2116 | + } | |
| 2117 | +				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { | |
| 2118 | + $data['noarchive'] = true; | |
| 2119 | + } | |
| 1501 | 2120 | $data['id_source'] = $id_source; | 
| 1502 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); | |
| 1503 | - else $error = true; | |
| 2121 | +    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { | |
| 2122 | + $send = $SI->add($data); | |
| 2123 | +    				} else { | |
| 2124 | + $error = true; | |
| 2125 | + } | |
| 1504 | 2126 | unset($data); | 
| 1505 | - } else $error = true; | |
| 2127 | +    			    } else { | |
| 2128 | + $error = true; | |
| 2129 | + } | |
| 1506 | 2130 |  			    if ($error) { | 
| 1507 | 2131 |  				if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) {  | 
| 1508 | - if ($globalDebug) echo "Not a message. Ignoring... \n"; | |
| 2132 | +					if ($globalDebug) { | |
| 2133 | + echo "Not a message. Ignoring... \n"; | |
| 2134 | + } | |
| 1509 | 2135 |  				} else { | 
| 1510 | - if ($globalDebug) echo "Wrong line format. Ignoring... \n"; | |
| 2136 | +					if ($globalDebug) { | |
| 2137 | + echo "Wrong line format. Ignoring... \n"; | |
| 2138 | + } | |
| 1511 | 2139 |  					if ($globalDebug) { | 
| 1512 | 2140 | echo $buffer; | 
| 1513 | 2141 | //print_r($line); | 
| 1514 | 2142 | } | 
| 1515 | 2143 | //socket_close($r); | 
| 1516 | - if ($globalDebug) echo "Reconnect after an error...\n"; | |
| 1517 | - if ($format == 'aprs') $aprs_connect = 0; | |
| 2144 | +					if ($globalDebug) { | |
| 2145 | + echo "Reconnect after an error...\n"; | |
| 2146 | + } | |
| 2147 | +					if ($format == 'aprs') { | |
| 2148 | + $aprs_connect = 0; | |
| 2149 | + } | |
| 1518 | 2150 | $sourceer[$nb] = $globalSources[$nb]; | 
| 1519 | 2151 | connect_all($sourceer); | 
| 1520 | 2152 | $sourceer = array(); | 
| @@ -1522,10 +2154,14 @@ discard block | ||
| 1522 | 2154 | } | 
| 1523 | 2155 | } | 
| 1524 | 2156 | // Sleep for xxx microseconds | 
| 1525 | - if (isset($globalSBSSleep)) usleep($globalSBSSleep); | |
| 2157 | +			if (isset($globalSBSSleep)) { | |
| 2158 | + usleep($globalSBSSleep); | |
| 2159 | + } | |
| 1526 | 2160 |  		    } else { | 
| 1527 | 2161 |  			if ($format == 'flightgearmp') { | 
| 1528 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; | |
| 2162 | +			    	if ($globalDebug) { | |
| 2163 | + echo "Reconnect FlightGear MP..."; | |
| 2164 | + } | |
| 1529 | 2165 | //@socket_close($r); | 
| 1530 | 2166 | sleep($globalMinFetch); | 
| 1531 | 2167 | $sourcefg[$nb] = $globalSources[$nb]; | 
| @@ -1534,10 +2170,15 @@ discard block | ||
| 1534 | 2170 | break; | 
| 1535 | 2171 | |
| 1536 | 2172 |  			} elseif ($format != 'acars' && $format != 'flightgearsp') { | 
| 1537 | - if (isset($tt[$format])) $tt[$format]++; | |
| 1538 | - else $tt[$format] = 0; | |
| 2173 | +			    if (isset($tt[$format])) { | |
| 2174 | + $tt[$format]++; | |
| 2175 | +			    } else { | |
| 2176 | + $tt[$format] = 0; | |
| 2177 | + } | |
| 1539 | 2178 |  			    if ($tt[$format] > 30) { | 
| 1540 | - if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; | |
| 2179 | +				if ($globalDebug) { | |
| 2180 | + echo "ERROR : Reconnect ".$format."..."; | |
| 2181 | + } | |
| 1541 | 2182 | //@socket_close($r); | 
| 1542 | 2183 | sleep(2); | 
| 1543 | 2184 | $aprs_connect = 0; | 
| @@ -1554,11 +2195,17 @@ discard block | ||
| 1554 | 2195 |  	    } else { | 
| 1555 | 2196 | $error = socket_strerror(socket_last_error()); | 
| 1556 | 2197 |  		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { | 
| 1557 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; | |
| 1558 | - if (isset($globalDebug)) echo "Restarting...\n"; | |
| 2198 | +			if ($globalDebug) { | |
| 2199 | + echo "ERROR : socket_select give this error ".$error . "\n"; | |
| 2200 | + } | |
| 2201 | +			if (isset($globalDebug)) { | |
| 2202 | + echo "Restarting...\n"; | |
| 2203 | + } | |
| 1559 | 2204 | // Restart the script if possible | 
| 1560 | 2205 |  			if (is_array($sockets)) { | 
| 1561 | - if ($globalDebug) echo "Shutdown all sockets..."; | |
| 2206 | +			    if ($globalDebug) { | |
| 2207 | + echo "Shutdown all sockets..."; | |
| 2208 | + } | |
| 1562 | 2209 | |
| 1563 | 2210 |  			    foreach ($sockets as $sock) { | 
| 1564 | 2211 | @socket_shutdown($sock,2); | 
| @@ -1566,25 +2213,45 @@ discard block | ||
| 1566 | 2213 | } | 
| 1567 | 2214 | |
| 1568 | 2215 | } | 
| 1569 | - if ($globalDebug) echo "Waiting..."; | |
| 2216 | +			if ($globalDebug) { | |
| 2217 | + echo "Waiting..."; | |
| 2218 | + } | |
| 1570 | 2219 | sleep(2); | 
| 1571 | 2220 | $time = time(); | 
| 1572 | 2221 | //connect_all($hosts); | 
| 1573 | 2222 | $aprs_connect = 0; | 
| 1574 | - if ($reset%5 == 0) sleep(20); | |
| 1575 | - if ($reset%10 == 0) sleep(100); | |
| 1576 | - if ($reset%20 == 0) sleep(200); | |
| 1577 | -			if ($reset > 100) exit('Too many attempts...'); | |
| 1578 | - if ($globalDebug) echo "Restart all connections..."; | |
| 2223 | +			if ($reset%5 == 0) { | |
| 2224 | + sleep(20); | |
| 2225 | + } | |
| 2226 | +			if ($reset%10 == 0) { | |
| 2227 | + sleep(100); | |
| 2228 | + } | |
| 2229 | +			if ($reset%20 == 0) { | |
| 2230 | + sleep(200); | |
| 2231 | + } | |
| 2232 | +			if ($reset > 100) { | |
| 2233 | +				exit('Too many attempts...'); | |
| 2234 | + } | |
| 2235 | +			if ($globalDebug) { | |
| 2236 | + echo "Restart all connections..."; | |
| 2237 | + } | |
| 1579 | 2238 | connect_all($globalSources); | 
| 1580 | 2239 | } | 
| 1581 | 2240 | } | 
| 1582 | 2241 | } | 
| 1583 | 2242 |  	if ($globalDaemon === false) { | 
| 1584 | - if ($globalDebug) echo 'Check all...'."\n"; | |
| 1585 | - if (isset($SI)) $SI->checkAll(); | |
| 1586 | - if (isset($TI)) $TI->checkAll(); | |
| 1587 | - if (isset($MI)) $MI->checkAll(); | |
| 2243 | +	    if ($globalDebug) { | |
| 2244 | + echo 'Check all...'."\n"; | |
| 2245 | + } | |
| 2246 | +	    if (isset($SI)) { | |
| 2247 | + $SI->checkAll(); | |
| 2248 | + } | |
| 2249 | +	    if (isset($TI)) { | |
| 2250 | + $TI->checkAll(); | |
| 2251 | + } | |
| 2252 | +	    if (isset($MI)) { | |
| 2253 | + $MI->checkAll(); | |
| 2254 | + } | |
| 1588 | 2255 | } | 
| 1589 | 2256 | } | 
| 1590 | 2257 | } | 
| @@ -177,7 +177,7 @@ | ||
| 177 | 177 |  } else { | 
| 178 | 178 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); | 
| 179 | 179 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); | 
| 180 | -	$(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); | |
| 180 | +	$(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); | |
| 181 | 181 | } | 
| 182 | 182 |  function TrackericonColor(color) { | 
| 183 | 183 | document.cookie = 'TrackerIconColor='+color.substring(1)+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' | 
| @@ -131,7 +131,7 @@ | ||
| 131 | 131 |  } else { | 
| 132 | 132 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); | 
| 133 | 133 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); | 
| 134 | -	$(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); | |
| 134 | +	$(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); | |
| 135 | 135 | } | 
| 136 | 136 |  function MarineiconColor(color) { | 
| 137 | 137 | document.cookie = 'MarineIconColor='+color.substring(1)+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' | 
| @@ -5,8 +5,11 @@ discard block | ||
| 5 | 5 |  setcookie("MapFormat",'2d'); | 
| 6 | 6 | |
| 7 | 7 | // Compressed GeoJson is used if true | 
| 8 | -if (!isset($globalJsonCompress)) $compress = true; | |
| 9 | -else $compress = $globalJsonCompress; | |
| 8 | +if (!isset($globalJsonCompress)) { | |
| 9 | + $compress = true; | |
| 10 | +} else { | |
| 11 | + $compress = $globalJsonCompress; | |
| 12 | +} | |
| 10 | 13 | ?> | 
| 11 | 14 | |
| 12 | 15 | |
| @@ -155,9 +158,13 @@ discard block | ||
| 155 | 158 |  		    if (callsign != ""){ markerTrackerLabel += callsign; } | 
| 156 | 159 |  		    if (type != ""){ markerTrackerLabel += ' - '+type; } | 
| 157 | 160 | <?php | 
| 158 | - if (isset($_COOKIE['TrackerIconColor'])) $IconColor = $_COOKIE['TrackerIconColor']; | |
| 159 | - elseif (isset($globalTrackerIconColor)) $IconColor = $globalTrackerIconColor; | |
| 160 | - else $IconColor = '1a3151'; | |
| 161 | +	if (isset($_COOKIE['TrackerIconColor'])) { | |
| 162 | + $IconColor = $_COOKIE['TrackerIconColor']; | |
| 163 | +	} elseif (isset($globalTrackerIconColor)) { | |
| 164 | + $IconColor = $globalTrackerIconColor; | |
| 165 | +	} else { | |
| 166 | + $IconColor = '1a3151'; | |
| 167 | + } | |
| 161 | 168 |  	if (!isset($ident) && !isset($famtrackid)) { | 
| 162 | 169 | ?> | 
| 163 | 170 | info_tracker_update(feature.properties.fc); | 
| @@ -191,7 +198,12 @@ discard block | ||
| 191 | 198 | <?php | 
| 192 | 199 |  		} else { | 
| 193 | 200 | ?> | 
| 194 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); | |
| 201 | +		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { | |
| 202 | + print $archiveupdatetime*1000; | |
| 203 | +} else { | |
| 204 | + print $globalMapRefresh*1000+20000; | |
| 205 | +} | |
| 206 | +?>+feature.properties.sqt*1000); | |
| 195 | 207 |  		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ | 
| 196 | 208 | <?php | 
| 197 | 209 | } | 
| @@ -247,7 +259,12 @@ discard block | ||
| 247 | 259 | <?php | 
| 248 | 260 |  		} else { | 
| 249 | 261 | ?> | 
| 250 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); | |
| 262 | +			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { | |
| 263 | + print $archiveupdatetime*1000; | |
| 264 | +} else { | |
| 265 | + print $globalMapRefresh*1000+20000; | |
| 266 | +} | |
| 267 | +?>+feature.properties.sqt*1000); | |
| 251 | 268 |  			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ | 
| 252 | 269 | <?php | 
| 253 | 270 | } | 
| @@ -302,7 +319,12 @@ discard block | ||
| 302 | 319 | <?php | 
| 303 | 320 |  		} else { | 
| 304 | 321 | ?> | 
| 305 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); | |
| 322 | +			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { | |
| 323 | + print $archiveupdatetime*1000; | |
| 324 | +} else { | |
| 325 | + print $globalMapRefresh*1000+20000; | |
| 326 | +} | |
| 327 | +?>+feature.properties.sqt*1000); | |
| 306 | 328 |  			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ | 
| 307 | 329 | <?php | 
| 308 | 330 | } | 
| @@ -592,14 +614,24 @@ discard block | ||
| 592 | 614 |  	if (isset($archive) && $archive) { | 
| 593 | 615 | ?> | 
| 594 | 616 | //then load it again every 30 seconds | 
| 595 | -//  var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); | |
| 617 | +//  var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) { | |
| 618 | + print ($globalMapRefresh*1000)/2; | |
| 619 | +} else { | |
| 620 | + print '15000'; | |
| 621 | +} | |
| 622 | +?>); | |
| 596 | 623 |  reloadTrackerPage = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php print $archiveupdatetime*1000; ?>); | 
| 597 | 624 | <?php | 
| 598 | 625 |  	} else { | 
| 599 | 626 | ?> | 
| 600 | 627 | //then load it again every 30 seconds | 
| 601 | 628 | reloadTrackerPage = setInterval( | 
| 602 | -    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); | |
| 629 | +    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) { | |
| 630 | + print $globalMapRefresh*1000; | |
| 631 | +} else { | |
| 632 | + print '30000'; | |
| 633 | +} | |
| 634 | +?>); | |
| 603 | 635 | <?php | 
| 604 | 636 | } | 
| 605 | 637 | ?> | 
| @@ -157,11 +157,26 @@ discard block | ||
| 157 | 157 |  				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li> | 
| 158 | 158 |  				<li><?php echo _("NOTAM scope:"); ?> | 
| 159 | 159 | <select class="selectpicker" onchange="notamscope(this);"> | 
| 160 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> | |
| 161 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> | |
| 162 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> | |
| 163 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> | |
| 164 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> | |
| 160 | +						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { | |
| 161 | + print ' selected'; | |
| 162 | +} | |
| 163 | +?>>All</option> | |
| 164 | +						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { | |
| 165 | + print ' selected'; | |
| 166 | +} | |
| 167 | +?>>Airport/Enroute warning</option> | |
| 168 | +						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { | |
| 169 | + print ' selected'; | |
| 170 | +} | |
| 171 | +?>>Airport warning</option> | |
| 172 | +						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { | |
| 173 | + print ' selected'; | |
| 174 | +} | |
| 175 | +?>>Navigation warning</option> | |
| 176 | +						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { | |
| 177 | + print ' selected'; | |
| 178 | +} | |
| 179 | +?>>Enroute warning</option> | |
| 165 | 180 | </select | 
| 166 | 181 | </li> | 
| 167 | 182 | </ul> | 
| @@ -189,7 +204,12 @@ discard block | ||
| 189 | 204 | <div class="form-group"> | 
| 190 | 205 | <label>From (UTC):</label> | 
| 191 | 206 | <div class='input-group date' id='datetimepicker1'> | 
| 192 | -            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> | |
| 207 | +            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) { | |
| 208 | + print $_POST['start_date']; | |
| 209 | +} elseif (isset($_COOKIE['archive_begin'])) { | |
| 210 | +	print date("m/d/Y h:i a",$_COOKIE['archive_begin']); | |
| 211 | +} | |
| 212 | +?>" required /> | |
| 193 | 213 | <span class="input-group-addon"> | 
| 194 | 214 | <span class="glyphicon glyphicon-calendar"></span> | 
| 195 | 215 | </span> | 
| @@ -198,7 +218,12 @@ discard block | ||
| 198 | 218 | <div class="form-group"> | 
| 199 | 219 | <label>To (UTC):</label> | 
| 200 | 220 | <div class='input-group date' id='datetimepicker2'> | 
| 201 | -		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> | |
| 221 | +		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) { | |
| 222 | + print $_POST['end_date']; | |
| 223 | +} elseif (isset($_COOKIE['archive_end'])) { | |
| 224 | +	print date("m/d/Y h:i a",$_COOKIE['archive_end']); | |
| 225 | +} | |
| 226 | +?>" /> | |
| 202 | 227 | <span class="input-group-addon"> | 
| 203 | 228 | <span class="glyphicon glyphicon-calendar"></span> | 
| 204 | 229 | </span> | 
| @@ -224,8 +249,20 @@ discard block | ||
| 224 | 249 | |
| 225 | 250 |  		    <li><?php echo _("Playback speed:"); ?> | 
| 226 | 251 | <div class="range"> | 
| 227 | - <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> | |
| 228 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> | |
| 252 | +			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) { | |
| 253 | + print $_POST['archivespeed']; | |
| 254 | +} elseif (isset($_COOKIE['archive_speed'])) { | |
| 255 | + print $_COOKIE['archive_speed']; | |
| 256 | +} else { | |
| 257 | + print '1'; | |
| 258 | +} | |
| 259 | +?>"> | |
| 260 | +			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) { | |
| 261 | + print $_COOKIE['archive_speed']; | |
| 262 | +} else { | |
| 263 | + print '1'; | |
| 264 | +} | |
| 265 | +?></output> | |
| 229 | 266 | </div> | 
| 230 | 267 | </li> | 
| 231 | 268 | <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li> | 
| @@ -247,15 +284,27 @@ discard block | ||
| 247 | 284 |  		    <li><?php echo _("Type of Map:"); ?> | 
| 248 | 285 | <select class="selectpicker" onchange="mapType(this);"> | 
| 249 | 286 | <?php | 
| 250 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; | |
| 251 | - else $MapType = $_COOKIE['MapType']; | |
| 287 | +				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { | |
| 288 | + $MapType = $globalMapProvider; | |
| 289 | +				} else { | |
| 290 | + $MapType = $_COOKIE['MapType']; | |
| 291 | + } | |
| 252 | 292 | ?> | 
| 253 | 293 | <?php | 
| 254 | 294 |  				if (isset($globalBingMapKey) && $globalBingMapKey != '') { | 
| 255 | 295 | ?> | 
| 256 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> | |
| 257 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> | |
| 258 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> | |
| 296 | +			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { | |
| 297 | + print ' selected'; | |
| 298 | +} | |
| 299 | +?>>Bing-Aerial</option> | |
| 300 | +			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { | |
| 301 | + print ' selected'; | |
| 302 | +} | |
| 303 | +?>>Bing-Hybrid</option> | |
| 304 | +			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { | |
| 305 | + print ' selected'; | |
| 306 | +} | |
| 307 | +?>>Bing-Road</option> | |
| 259 | 308 | <?php | 
| 260 | 309 | } | 
| 261 | 310 | ?> | 
| @@ -265,56 +314,131 @@ discard block | ||
| 265 | 314 | <?php | 
| 266 | 315 |  				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { | 
| 267 | 316 | ?> | 
| 268 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> | |
| 269 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> | |
| 270 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> | |
| 317 | +			    <option value="Here-Aerial"<?php if ($MapType == 'Here') { | |
| 318 | + print ' selected'; | |
| 319 | +} | |
| 320 | +?>>Here-Aerial</option> | |
| 321 | +			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') { | |
| 322 | + print ' selected'; | |
| 323 | +} | |
| 324 | +?>>Here-Hybrid</option> | |
| 325 | +			    <option value="Here-Road"<?php if ($MapType == 'Here') { | |
| 326 | + print ' selected'; | |
| 327 | +} | |
| 328 | +?>>Here-Road</option> | |
| 271 | 329 | <?php | 
| 272 | 330 | } | 
| 273 | 331 | ?> | 
| 274 | 332 | <?php | 
| 275 | 333 |  				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { | 
| 276 | 334 | ?> | 
| 277 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> | |
| 278 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> | |
| 279 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> | |
| 280 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> | |
| 335 | +			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { | |
| 336 | + print ' selected'; | |
| 337 | +} | |
| 338 | +?>>Google Roadmap</option> | |
| 339 | +			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { | |
| 340 | + print ' selected'; | |
| 341 | +} | |
| 342 | +?>>Google Satellite</option> | |
| 343 | +			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { | |
| 344 | + print ' selected'; | |
| 345 | +} | |
| 346 | +?>>Google Hybrid</option> | |
| 347 | +			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { | |
| 348 | + print ' selected'; | |
| 349 | +} | |
| 350 | +?>>Google Terrain</option> | |
| 281 | 351 | <?php | 
| 282 | 352 | } | 
| 283 | 353 | ?> | 
| 284 | 354 | <?php | 
| 285 | 355 |  				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { | 
| 286 | 356 | ?> | 
| 287 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> | |
| 288 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> | |
| 289 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> | |
| 357 | +			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { | |
| 358 | + print ' selected'; | |
| 359 | +} | |
| 360 | +?>>MapQuest-OSM</option> | |
| 361 | +			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { | |
| 362 | + print ' selected'; | |
| 363 | +} | |
| 364 | +?>>MapQuest-Aerial</option> | |
| 365 | +			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { | |
| 366 | + print ' selected'; | |
| 367 | +} | |
| 368 | +?>>MapQuest-Hybrid</option> | |
| 290 | 369 | <?php | 
| 291 | 370 | } | 
| 292 | 371 | ?> | 
| 293 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> | |
| 372 | +			    <option value="Yandex"<?php if ($MapType == 'Yandex') { | |
| 373 | + print ' selected'; | |
| 374 | +} | |
| 375 | +?>>Yandex</option> | |
| 294 | 376 | <?php | 
| 295 | 377 | } | 
| 296 | 378 | ?> | 
| 297 | 379 | <?php | 
| 298 | 380 |  				    if (isset($globalMapboxToken) && $globalMapboxToken != '') { | 
| 299 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; | |
| 300 | - else $MapBoxId = $_COOKIE['MapTypeId']; | |
| 381 | +					if (!isset($_COOKIE['MapTypeId'])) { | |
| 382 | + $MapBoxId = 'default'; | |
| 383 | +					} else { | |
| 384 | + $MapBoxId = $_COOKIE['MapTypeId']; | |
| 385 | + } | |
| 301 | 386 | ?> | 
| 302 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> | |
| 303 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> | |
| 304 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> | |
| 305 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> | |
| 306 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> | |
| 307 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> | |
| 308 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> | |
| 309 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> | |
| 310 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> | |
| 311 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> | |
| 312 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> | |
| 313 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> | |
| 387 | +			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { | |
| 388 | + print ' selected'; | |
| 389 | +} | |
| 390 | +?>>Mapbox default</option> | |
| 391 | +			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { | |
| 392 | + print ' selected'; | |
| 393 | +} | |
| 394 | +?>>Mapbox streets</option> | |
| 395 | +			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { | |
| 396 | + print ' selected'; | |
| 397 | +} | |
| 398 | +?>>Mapbox light</option> | |
| 399 | +			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { | |
| 400 | + print ' selected'; | |
| 401 | +} | |
| 402 | +?>>Mapbox dark</option> | |
| 403 | +			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { | |
| 404 | + print ' selected'; | |
| 405 | +} | |
| 406 | +?>>Mapbox satellite</option> | |
| 407 | +			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { | |
| 408 | + print ' selected'; | |
| 409 | +} | |
| 410 | +?>>Mapbox streets-satellite</option> | |
| 411 | +			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { | |
| 412 | + print ' selected'; | |
| 413 | +} | |
| 414 | +?>>Mapbox streets-basic</option> | |
| 415 | +			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { | |
| 416 | + print ' selected'; | |
| 417 | +} | |
| 418 | +?>>Mapbox comic</option> | |
| 419 | +			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { | |
| 420 | + print ' selected'; | |
| 421 | +} | |
| 422 | +?>>Mapbox outdoors</option> | |
| 423 | +			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { | |
| 424 | + print ' selected'; | |
| 425 | +} | |
| 426 | +?>>Mapbox pencil</option> | |
| 427 | +			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { | |
| 428 | + print ' selected'; | |
| 429 | +} | |
| 430 | +?>>Mapbox pirates</option> | |
| 431 | +			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { | |
| 432 | + print ' selected'; | |
| 433 | +} | |
| 434 | +?>>Mapbox emerald</option> | |
| 314 | 435 | <?php | 
| 315 | 436 | } | 
| 316 | 437 | ?> | 
| 317 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> | |
| 438 | +			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { | |
| 439 | + print ' selected'; | |
| 440 | +} | |
| 441 | +?>>OpenStreetMap</option> | |
| 318 | 442 | </select> | 
| 319 | 443 | </li> | 
| 320 | 444 | <?php | 
| @@ -322,10 +446,22 @@ discard block | ||
| 322 | 446 | ?> | 
| 323 | 447 |  		    <li><?php echo _("Type of Terrain:"); ?> | 
| 324 | 448 | <select class="selectpicker" onchange="terrainType(this);"> | 
| 325 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> | |
| 326 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> | |
| 327 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> | |
| 328 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> | |
| 449 | +			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { | |
| 450 | + print ' selected'; | |
| 451 | +} | |
| 452 | +?>>stk terrain</option> | |
| 453 | +			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { | |
| 454 | + print ' selected'; | |
| 455 | +} | |
| 456 | +?>>ellipsoid</option> | |
| 457 | +			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { | |
| 458 | + print ' selected'; | |
| 459 | +} | |
| 460 | +?>>vr terrain</option> | |
| 461 | +			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { | |
| 462 | + print ' selected'; | |
| 463 | +} | |
| 464 | +?>>ArticDEM</option> | |
| 329 | 465 | </select> | 
| 330 | 466 | </li> | 
| 331 | 467 | <?php | 
| @@ -335,20 +471,44 @@ discard block | ||
| 335 | 471 |      if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { | 
| 336 | 472 | ?> | 
| 337 | 473 | |
| 338 | -		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li> | |
| 339 | -		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> | |
| 340 | -		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> | |
| 341 | -		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> | |
| 342 | -		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> | |
| 474 | +		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { | |
| 475 | + print 'checked'; | |
| 476 | +} | |
| 477 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li> | |
| 478 | +		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { | |
| 479 | + print 'checked'; | |
| 480 | +} | |
| 481 | +?> ><?php echo _("Display flight path"); ?></label></div></li> | |
| 482 | +		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (isset($globalMapRoute) && $globalMapRoute)) { | |
| 483 | + print 'checked'; | |
| 484 | +} | |
| 485 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> | |
| 486 | +		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || !isset($_COOKIE['MapRemainingRoute']) || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) { | |
| 487 | + print 'checked'; | |
| 488 | +} | |
| 489 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> | |
| 490 | +		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { | |
| 491 | + print 'checked'; | |
| 492 | +} | |
| 493 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> | |
| 343 | 494 | <?php | 
| 344 | 495 | } | 
| 345 | 496 | ?> | 
| 346 | -		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> | |
| 347 | -		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> | |
| 497 | +		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) { | |
| 498 | + print 'checked'; | |
| 499 | +} | |
| 500 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> | |
| 501 | +		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) { | |
| 502 | + print 'checked'; | |
| 503 | +} | |
| 504 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> | |
| 348 | 505 | <?php | 
| 349 | 506 |      if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { | 
| 350 | 507 | ?> | 
| 351 | -		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> | |
| 508 | +		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { | |
| 509 | + print 'checked'; | |
| 510 | +} | |
| 511 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> | |
| 352 | 512 | <?php | 
| 353 | 513 | } | 
| 354 | 514 |      if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { | 
| @@ -362,17 +522,25 @@ discard block | ||
| 362 | 522 |  			if (function_exists('array_column')) { | 
| 363 | 523 |  			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { | 
| 364 | 524 | ?> | 
| 365 | -		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> | |
| 525 | +		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { | |
| 526 | + print 'checked'; | |
| 527 | +} | |
| 528 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> | |
| 366 | 529 | <?php | 
| 367 | 530 | } | 
| 368 | 531 |  			} elseif (isset($globalSources)) { | 
| 369 | 532 | $dispolar = false; | 
| 370 | 533 |  			    foreach ($globalSources as $testsource) { | 
| 371 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; | |
| 534 | +			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { | |
| 535 | + $dispolar = true; | |
| 536 | + } | |
| 372 | 537 | } | 
| 373 | 538 |  			    if ($dispolar) { | 
| 374 | 539 | ?> | 
| 375 | -		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> | |
| 540 | +		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { | |
| 541 | + print 'checked'; | |
| 542 | +} | |
| 543 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> | |
| 376 | 544 | <?php | 
| 377 | 545 | } | 
| 378 | 546 | } | 
| @@ -385,12 +553,22 @@ discard block | ||
| 385 | 553 |  			if (!isset($globalAircraft) || $globalAircraft === TRUE) { | 
| 386 | 554 |  		    	    if (extension_loaded('gd') && function_exists('gd_info')) { | 
| 387 | 555 | ?> | 
| 388 | -		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> | |
| 556 | +		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { | |
| 557 | + print 'checked'; | |
| 558 | +} | |
| 559 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> | |
| 389 | 560 | <?php | 
| 390 | 561 |  				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { | 
| 391 | 562 | ?> | 
| 392 | 563 |  		    <li><?php echo _("Aircraft icon color:"); ?> | 
| 393 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"> | |
| 564 | +			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { | |
| 565 | + print $_COOKIE['IconColor']; | |
| 566 | +} elseif (isset($globalAircraftIconColor)) { | |
| 567 | + print $globalAircraftIconColor; | |
| 568 | +} else { | |
| 569 | + print '1a3151'; | |
| 570 | +} | |
| 571 | +?>"> | |
| 394 | 572 | </li> | 
| 395 | 573 | <?php | 
| 396 | 574 | } | 
| @@ -402,7 +580,14 @@ discard block | ||
| 402 | 580 |  			    if (extension_loaded('gd') && function_exists('gd_info')) { | 
| 403 | 581 | ?> | 
| 404 | 582 |  		    <li><?php echo _("Marine icon color:"); ?> | 
| 405 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> | |
| 583 | +			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { | |
| 584 | + print $_COOKIE['MarineIconColor']; | |
| 585 | +} elseif (isset($globalMarineIconColor)) { | |
| 586 | + print $globalMarineIconColor; | |
| 587 | +} else { | |
| 588 | + print '1a3151'; | |
| 589 | +} | |
| 590 | +?>"> | |
| 406 | 591 | </li> | 
| 407 | 592 | <?php | 
| 408 | 593 | } | 
| @@ -413,7 +598,14 @@ discard block | ||
| 413 | 598 |  			    if (extension_loaded('gd') && function_exists('gd_info')) { | 
| 414 | 599 | ?> | 
| 415 | 600 |  		    <li><?php echo _("Tracker icon color:"); ?> | 
| 416 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> | |
| 601 | +			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { | |
| 602 | + print $_COOKIE['TrackerIconColor']; | |
| 603 | +} elseif (isset($globalTrackerIconColor)) { | |
| 604 | + print $globalTrackerIconColor; | |
| 605 | +} else { | |
| 606 | + print '1a3151'; | |
| 607 | +} | |
| 608 | +?>"> | |
| 417 | 609 | </li> | 
| 418 | 610 | <?php | 
| 419 | 611 | } | 
| @@ -424,8 +616,22 @@ discard block | ||
| 424 | 616 | ?> | 
| 425 | 617 |  		    <li><?php echo _("Show airport icon at zoom level:"); ?> | 
| 426 | 618 | <div class="range"> | 
| 427 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> | |
| 428 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> | |
| 619 | +			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { | |
| 620 | + print $_COOKIE['AirportZoom']; | |
| 621 | +} elseif (isset($globalAirportZoom)) { | |
| 622 | + print $globalAirportZoom; | |
| 623 | +} else { | |
| 624 | + print '7'; | |
| 625 | +} | |
| 626 | +?>"> | |
| 627 | +			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { | |
| 628 | + print $_COOKIE['AirportZoom']; | |
| 629 | +} elseif (isset($globalAirportZoom)) { | |
| 630 | + print $globalAirportZoom; | |
| 631 | +} else { | |
| 632 | + print '7'; | |
| 633 | +} | |
| 634 | +?></output> | |
| 429 | 635 | </div> | 
| 430 | 636 | </li> | 
| 431 | 637 | <?php | 
| @@ -437,9 +643,19 @@ discard block | ||
| 437 | 643 | <?php | 
| 438 | 644 |  	if (!isset($globalAircraft) || $globalAircraft === TRUE) { | 
| 439 | 645 | ?> | 
| 440 | -		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?></li> | |
| 646 | +		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { | |
| 647 | + print 'checked'; | |
| 648 | +} | |
| 649 | +?> ><?php echo _("Force Aircraft color"); ?></li> | |
| 441 | 650 |  		    <li><?php echo _("Aircraft icon color:"); ?> | 
| 442 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>"> | |
| 651 | +			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { | |
| 652 | + print $_COOKIE['IconColor']; | |
| 653 | +} elseif (isset($globalAircraftIconColor)) { | |
| 654 | + print $globalAircraftIconColor; | |
| 655 | +} else { | |
| 656 | + print 'ff0000'; | |
| 657 | +} | |
| 658 | +?>"> | |
| 443 | 659 | </li> | 
| 444 | 660 | <?php | 
| 445 | 661 | } | 
| @@ -447,9 +663,19 @@ discard block | ||
| 447 | 663 | <?php | 
| 448 | 664 |  	if (isset($globalMarine) && $globalMarine === TRUE) { | 
| 449 | 665 | ?> | 
| 450 | -		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?></li> | |
| 666 | +		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { | |
| 667 | + print 'checked'; | |
| 668 | +} | |
| 669 | +?> ><?php echo _("Force Marine color"); ?></li> | |
| 451 | 670 |  		    <li><?php echo _("Marine icon color:"); ?> | 
| 452 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>"> | |
| 671 | +			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { | |
| 672 | + print $_COOKIE['MarineIconColor']; | |
| 673 | +} elseif (isset($globalMarineIconColor)) { | |
| 674 | + print $globalMarineIconColor; | |
| 675 | +} else { | |
| 676 | + print 'ff0000'; | |
| 677 | +} | |
| 678 | +?>"> | |
| 453 | 679 | </li> | 
| 454 | 680 | <?php | 
| 455 | 681 | } | 
| @@ -457,9 +683,19 @@ discard block | ||
| 457 | 683 | <?php | 
| 458 | 684 |  	if (isset($globalTracker) && $globalTracker === TRUE) { | 
| 459 | 685 | ?> | 
| 460 | -		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?></li> | |
| 686 | +		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { | |
| 687 | + print 'checked'; | |
| 688 | +} | |
| 689 | +?> ><?php echo _("Force Tracker color"); ?></li> | |
| 461 | 690 |  		    <li><?php echo _("Tracker icon color:"); ?> | 
| 462 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>"> | |
| 691 | +			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { | |
| 692 | + print $_COOKIE['TrackerIconColor']; | |
| 693 | +} elseif (isset($globalTrackerIconColor)) { | |
| 694 | + print $globalTrackerIconColor; | |
| 695 | +} else { | |
| 696 | + print 'ff0000'; | |
| 697 | +} | |
| 698 | +?>"> | |
| 463 | 699 | </li> | 
| 464 | 700 | <?php | 
| 465 | 701 | } | 
| @@ -467,22 +703,46 @@ discard block | ||
| 467 | 703 | ?> | 
| 468 | 704 |  		    <li><?php echo _("Distance unit:"); ?> | 
| 469 | 705 | <select class="selectpicker" onchange="unitdistance(this);"> | 
| 470 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> | |
| 471 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> | |
| 472 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> | |
| 706 | +			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { | |
| 707 | + echo ' selected'; | |
| 708 | +} | |
| 709 | +?>>km</option> | |
| 710 | +			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { | |
| 711 | + echo ' selected'; | |
| 712 | +} | |
| 713 | +?>>nm</option> | |
| 714 | +			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { | |
| 715 | + echo ' selected'; | |
| 716 | +} | |
| 717 | +?>>mi</option> | |
| 473 | 718 | </select> | 
| 474 | 719 | </li> | 
| 475 | 720 |  		    <li><?php echo _("Altitude unit:"); ?> | 
| 476 | 721 | <select class="selectpicker" onchange="unitaltitude(this);"> | 
| 477 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> | |
| 478 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> | |
| 722 | +			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { | |
| 723 | + echo ' selected'; | |
| 724 | +} | |
| 725 | +?>>m</option> | |
| 726 | +			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { | |
| 727 | + echo ' selected'; | |
| 728 | +} | |
| 729 | +?>>feet</option> | |
| 479 | 730 | </select> | 
| 480 | 731 | </li> | 
| 481 | 732 |  		    <li><?php echo _("Speed unit:"); ?> | 
| 482 | 733 | <select class="selectpicker" onchange="unitspeed(this);"> | 
| 483 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> | |
| 484 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> | |
| 485 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> | |
| 734 | +			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { | |
| 735 | + echo ' selected'; | |
| 736 | +} | |
| 737 | +?>>km/h</option> | |
| 738 | +			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { | |
| 739 | + echo ' selected'; | |
| 740 | +} | |
| 741 | +?>>mph</option> | |
| 742 | +			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { | |
| 743 | + echo ' selected'; | |
| 744 | +} | |
| 745 | +?>>knots</option> | |
| 486 | 746 | </select> | 
| 487 | 747 | </li> | 
| 488 | 748 | |
| @@ -500,9 +760,18 @@ discard block | ||
| 500 | 760 | <?php | 
| 501 | 761 |  			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { | 
| 502 | 762 | ?> | 
| 503 | -			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> | |
| 504 | -			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> | |
| 505 | -			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> | |
| 763 | +			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) { | |
| 764 | + print 'checked'; | |
| 765 | +} | |
| 766 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> | |
| 767 | +			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) { | |
| 768 | + print 'checked'; | |
| 769 | +} | |
| 770 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> | |
| 771 | +			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) { | |
| 772 | + print 'checked'; | |
| 773 | +} | |
| 774 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> | |
| 506 | 775 | <?php | 
| 507 | 776 | } | 
| 508 | 777 | ?> | 
| @@ -510,10 +779,16 @@ discard block | ||
| 510 | 779 |  			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { | 
| 511 | 780 | ?> | 
| 512 | 781 |  			<?php if (isset($globalSBS1) && $globalSBS1) { ?> | 
| 513 | -			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> | |
| 782 | +			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) { | |
| 783 | + print 'checked'; | |
| 784 | +} | |
| 785 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> | |
| 514 | 786 | <?php } ?> | 
| 515 | 787 |  			<?php if (isset($globalAPRS) && $globalAPRS) { ?> | 
| 516 | -			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> | |
| 788 | +			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { | |
| 789 | + print 'checked'; | |
| 790 | +} | |
| 791 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> | |
| 517 | 792 | <?php } ?> | 
| 518 | 793 | <?php | 
| 519 | 794 | } | 
| @@ -530,7 +805,9 @@ discard block | ||
| 530 | 805 | } | 
| 531 | 806 |  				foreach($allairlinenames as $airline) { | 
| 532 | 807 | $airline_name = $airline['airline_name']; | 
| 533 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; | |
| 808 | +					if (strlen($airline_name) > 30) { | |
| 809 | + $airline_name = substr($airline_name,0,30).'...'; | |
| 810 | + } | |
| 534 | 811 |  					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { | 
| 535 | 812 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; | 
| 536 | 813 |  					} else { | 
| @@ -548,7 +825,10 @@ discard block | ||
| 548 | 825 |  		    <li><?php echo _("Display alliance:"); ?> | 
| 549 | 826 | <br/> | 
| 550 | 827 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> | 
| 551 | -			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> | |
| 828 | +			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { | |
| 829 | + echo ' selected'; | |
| 830 | +} | |
| 831 | +?>><?php echo _("All"); ?></option> | |
| 552 | 832 | <?php | 
| 553 | 833 |  				foreach($allalliancenames as $alliance) { | 
| 554 | 834 | $alliance_name = $alliance['alliance']; | 
| @@ -595,10 +875,22 @@ discard block | ||
| 595 | 875 | ?> | 
| 596 | 876 |  		    <li><?php echo _("Display airlines of type:"); ?><br/> | 
| 597 | 877 | <select class="selectpicker" onchange="airlinestype(this);"> | 
| 598 | -			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> | |
| 599 | -			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> | |
| 600 | -			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> | |
| 601 | -			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> | |
| 878 | +			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { | |
| 879 | + echo ' selected'; | |
| 880 | +} | |
| 881 | +?>><?php echo _("All"); ?></option> | |
| 882 | +			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { | |
| 883 | + echo ' selected'; | |
| 884 | +} | |
| 885 | +?>><?php echo _("Passenger"); ?></option> | |
| 886 | +			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { | |
| 887 | + echo ' selected'; | |
| 888 | +} | |
| 889 | +?>><?php echo _("Cargo"); ?></option> | |
| 890 | +			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { | |
| 891 | + echo ' selected'; | |
| 892 | +} | |
| 893 | +?>><?php echo _("Military"); ?></option> | |
| 602 | 894 | </select> | 
| 603 | 895 | </li> | 
| 604 | 896 | <?php | 
| @@ -606,7 +898,10 @@ discard block | ||
| 606 | 898 | ?> | 
| 607 | 899 | <li> | 
| 608 | 900 |  			<?php echo _("Display flight with ident:"); ?> | 
| 609 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> | |
| 901 | +			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { | |
| 902 | + print $_COOKIE['filter_ident']; | |
| 903 | +} | |
| 904 | +?>" /> | |
| 610 | 905 | </li> | 
| 611 | 906 | <?php | 
| 612 | 907 | } | 
| @@ -625,7 +920,10 @@ discard block | ||
| 625 | 920 |  	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> | 
| 626 | 921 | <form> | 
| 627 | 922 | <ul> | 
| 628 | -		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> | |
| 923 | +		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') { | |
| 924 | + print 'checked'; | |
| 925 | +} | |
| 926 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> | |
| 629 | 927 |  		    <li><?php echo _("Type:"); ?> | 
| 630 | 928 | <select class="selectpicker" multiple onchange="sattypes(this);"> | 
| 631 | 929 | <?php | 
| @@ -633,25 +931,45 @@ discard block | ||
| 633 | 931 | $types = $Satellite->get_tle_types(); | 
| 634 | 932 |  				foreach ($types as $type) { | 
| 635 | 933 | $type_name = $type['tle_type']; | 
| 636 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; | |
| 637 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; | |
| 638 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; | |
| 639 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; | |
| 640 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; | |
| 641 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; | |
| 642 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; | |
| 643 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; | |
| 644 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; | |
| 645 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; | |
| 646 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; | |
| 647 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; | |
| 648 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; | |
| 649 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; | |
| 650 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; | |
| 651 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; | |
| 652 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; | |
| 653 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; | |
| 654 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; | |
| 934 | +					if ($type_name == 'musson') { | |
| 935 | + $type_name = 'Russian LEO Navigation'; | |
| 936 | +					} else if ($type_name == 'nnss') { | |
| 937 | + $type_name = 'Navi Navigation Satellite System'; | |
| 938 | +					} else if ($type_name == 'sbas') { | |
| 939 | + $type_name = 'Satellite-Based Augmentation System'; | |
| 940 | +					} else if ($type_name == 'glo-ops') { | |
| 941 | + $type_name = 'Glonass Operational'; | |
| 942 | +					} else if ($type_name == 'gps-ops') { | |
| 943 | + $type_name = 'GPS Operational'; | |
| 944 | +					} else if ($type_name == 'argos') { | |
| 945 | + $type_name = 'ARGOS Data Collection System'; | |
| 946 | +					} else if ($type_name == 'tdrss') { | |
| 947 | + $type_name = 'Tracking and Data Relay Satellite System'; | |
| 948 | +					} else if ($type_name == 'sarsat') { | |
| 949 | + $type_name = 'Search & Rescue'; | |
| 950 | +					} else if ($type_name == 'dmc') { | |
| 951 | + $type_name = 'Disaster Monitoring'; | |
| 952 | +					} else if ($type_name == 'resource') { | |
| 953 | + $type_name = 'Earth Resources'; | |
| 954 | +					} else if ($type_name == 'stations') { | |
| 955 | + $type_name = 'Space Stations'; | |
| 956 | +					} else if ($type_name == 'geo') { | |
| 957 | + $type_name = 'Geostationary'; | |
| 958 | +					} else if ($type_name == 'amateur') { | |
| 959 | + $type_name = 'Amateur Radio'; | |
| 960 | +					} else if ($type_name == 'x-comm') { | |
| 961 | + $type_name = 'Experimental'; | |
| 962 | +					} else if ($type_name == 'other-comm') { | |
| 963 | + $type_name = 'Other Comm'; | |
| 964 | +					} else if ($type_name == 'science') { | |
| 965 | + $type_name = 'Space & Earth Science'; | |
| 966 | +					} else if ($type_name == 'military') { | |
| 967 | + $type_name = 'Miscellaneous Military'; | |
| 968 | +					} else if ($type_name == 'radar') { | |
| 969 | + $type_name = 'Radar Calibration'; | |
| 970 | +					} else if ($type_name == 'tle-new') { | |
| 971 | + $type_name = 'Last 30 days launches'; | |
| 972 | + } | |
| 655 | 973 | |
| 656 | 974 |  					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { | 
| 657 | 975 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; | 
| @@ -5,7 +5,7 @@ discard block | ||
| 5 | 5 | $Source = new Source(); | 
| 6 | 6 | |
| 7 | 7 |  if (isset($_GET['sourceid'])) { | 
| 8 | - $sourceid = filter_input(INPUT_GET,'sourceid',FILTER_SANITIZE_NUMBER_INT); | |
| 8 | + $sourceid = filter_input(INPUT_GET, 'sourceid', FILTER_SANITIZE_NUMBER_INT); | |
| 9 | 9 | $source_data = $Source->getLocationInfoById($sourceid); | 
| 10 | 10 |  	if (isset($source_data[0])) { | 
| 11 | 11 | ?> | 
| @@ -34,8 +34,8 @@ discard block | ||
| 34 | 34 | print '</div>'; | 
| 35 | 35 | |
| 36 | 36 |  if ($spotter_item['city'] != '') print '<div><span>'._("City").'</span>'.$spotter_item['city'].'</div>'; | 
| 37 | -if ($spotter_item['country'] !='') print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>'; | |
| 38 | -print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>'; | |
| 37 | +if ($spotter_item['country'] != '') print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>'; | |
| 38 | +print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'], 3).', '.round($spotter_item['longitude'], 3).'</div>'; | |
| 39 | 39 | /* | 
| 40 | 40 |  if ($spotter_item['atc_range'] > 0) { | 
| 41 | 41 |      print '<div><span>'._("Range").'</span>'; | 
| @@ -44,7 +44,7 @@ discard block | ||
| 44 | 44 | } | 
| 45 | 45 | */ | 
| 46 | 46 |  if ($spotter_item['type'] == 'wx') { | 
| 47 | - $weather = json_decode($spotter_item['description'],true); | |
| 47 | + $weather = json_decode($spotter_item['description'], true); | |
| 48 | 48 | //print_r($weather); | 
| 49 | 49 |  	if (isset($weather['temp'])) print '<div><span>'._("Temperature").'</span>'.$weather['temp'].'°C</div>'; | 
| 50 | 50 |  	if (isset($weather['pressure'])) print '<div><span>'._("Pressure").'</span>'.$weather['pressure'].'hPa</div>'; | 
| @@ -17,8 +17,11 @@ discard block | ||
| 17 | 17 |  date_default_timezone_set('UTC'); | 
| 18 | 18 | |
| 19 | 19 | print '<div class="top">'; | 
| 20 | -if ($spotter_item['name'] != '') print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['name'].'</div>'; | |
| 21 | -else print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['location_id'].'</div>'; | |
| 20 | +if ($spotter_item['name'] != '') { | |
| 21 | + print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['name'].'</div>'; | |
| 22 | +} else { | |
| 23 | + print '<div class="right"><div class="callsign-details"><div class="callsign">'.$spotter_item['location_id'].'</div>'; | |
| 24 | +} | |
| 22 | 25 | print '</div>'; | 
| 23 | 26 | |
| 24 | 27 | print '</div></div>'; | 
| @@ -33,8 +36,12 @@ discard block | ||
| 33 | 36 | print $spotter_item['last_seen'].' UTC'; | 
| 34 | 37 | print '</div>'; | 
| 35 | 38 | |
| 36 | -if ($spotter_item['city'] != '') print '<div><span>'._("City").'</span>'.$spotter_item['city'].'</div>'; | |
| 37 | -if ($spotter_item['country'] !='') print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>'; | |
| 39 | +if ($spotter_item['city'] != '') { | |
| 40 | +	print '<div><span>'._("City").'</span>'.$spotter_item['city'].'</div>'; | |
| 41 | +} | |
| 42 | +if ($spotter_item['country'] !='') { | |
| 43 | +	print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>'; | |
| 44 | +} | |
| 38 | 45 |  print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>'; | 
| 39 | 46 | /* | 
| 40 | 47 |  if ($spotter_item['atc_range'] > 0) { | 
| @@ -46,13 +53,27 @@ discard block | ||
| 46 | 53 |  if ($spotter_item['type'] == 'wx') { | 
| 47 | 54 | $weather = json_decode($spotter_item['description'],true); | 
| 48 | 55 | //print_r($weather); | 
| 49 | -	if (isset($weather['temp'])) print '<div><span>'._("Temperature").'</span>'.$weather['temp'].'°C</div>'; | |
| 50 | -	if (isset($weather['pressure'])) print '<div><span>'._("Pressure").'</span>'.$weather['pressure'].'hPa</div>'; | |
| 51 | -	if (isset($weather['wind_gust'])) print '<div><span>'._("Wind Gust").'</span>'.$weather['wind_gust'].' km/h</div>'; | |
| 52 | -	if (isset($weather['humidity'])) print '<div><span>'._("Humidity").'</span>'.$weather['humidity'].'%</div>'; | |
| 53 | -	if (isset($weather['rain'])) print '<div><span>'._("Rain").'</span>'.$weather['rain'].' mm</div>'; | |
| 54 | -	if (isset($weather['precipitation'])) print '<div><span>'._("Precipitation 24H").'</span>'.$weather['precipitation'].' mm</div>'; | |
| 55 | -	if (isset($weather['precipitation24h'])) print '<div><span>'._("Precipitation Today").'</span>'.$weather['precipitation24h'].' mm</div>'; | |
| 56 | +	if (isset($weather['temp'])) { | |
| 57 | +		print '<div><span>'._("Temperature").'</span>'.$weather['temp'].'°C</div>'; | |
| 58 | + } | |
| 59 | +	if (isset($weather['pressure'])) { | |
| 60 | +		print '<div><span>'._("Pressure").'</span>'.$weather['pressure'].'hPa</div>'; | |
| 61 | + } | |
| 62 | +	if (isset($weather['wind_gust'])) { | |
| 63 | +		print '<div><span>'._("Wind Gust").'</span>'.$weather['wind_gust'].' km/h</div>'; | |
| 64 | + } | |
| 65 | +	if (isset($weather['humidity'])) { | |
| 66 | +		print '<div><span>'._("Humidity").'</span>'.$weather['humidity'].'%</div>'; | |
| 67 | + } | |
| 68 | +	if (isset($weather['rain'])) { | |
| 69 | +		print '<div><span>'._("Rain").'</span>'.$weather['rain'].' mm</div>'; | |
| 70 | + } | |
| 71 | +	if (isset($weather['precipitation'])) { | |
| 72 | +		print '<div><span>'._("Precipitation 24H").'</span>'.$weather['precipitation'].' mm</div>'; | |
| 73 | + } | |
| 74 | +	if (isset($weather['precipitation24h'])) { | |
| 75 | +		print '<div><span>'._("Precipitation Today").'</span>'.$weather['precipitation24h'].' mm</div>'; | |
| 76 | + } | |
| 56 | 77 | $spotter_item['description'] = $weather['comment']; | 
| 57 | 78 | } | 
| 58 | 79 | print '</div>'; |