@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $s3 = sin($bank/2); |
49 | 49 | $c1c2 = $c1*$c2; |
50 | 50 | $s1s2 = $s1*$s2; |
51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
51 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
52 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
53 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
57 | 57 | |
58 | 58 | } |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | $min = false; |
74 | 74 | $allhistory = false; |
75 | 75 | $filter['source'] = array(); |
76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
83 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
85 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
77 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
79 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
80 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
81 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
82 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
83 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
84 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
85 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
86 | 86 | /* |
87 | 87 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
88 | 88 | $min = true; |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | $from_archive = true; |
130 | 130 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
131 | 131 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
132 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
133 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
134 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
135 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
136 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
137 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
132 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
133 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
134 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
135 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
136 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
137 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
138 | 138 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
139 | 139 | $from_archive = true; |
140 | 140 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -144,34 +144,34 @@ discard block |
||
144 | 144 | $begindate = $_COOKIE['archive_begin']; |
145 | 145 | $enddate = $_COOKIE['archive_end']; |
146 | 146 | |
147 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
148 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
149 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
147 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
148 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
149 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
150 | 150 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
151 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
151 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
152 | 152 | } elseif ($tracker) { |
153 | 153 | $coord = array(); |
154 | 154 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
155 | - $coord = explode(',',$_GET['coord']); |
|
155 | + $coord = explode(',', $_GET['coord']); |
|
156 | 156 | } |
157 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
157 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
158 | 158 | } elseif ($marine) { |
159 | 159 | $coord = array(); |
160 | 160 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
161 | - $coord = explode(',',$_GET['coord']); |
|
161 | + $coord = explode(',', $_GET['coord']); |
|
162 | 162 | } |
163 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
163 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
164 | 164 | } else { |
165 | 165 | $coord = array(); |
166 | 166 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
167 | - $coord = explode(',',$_GET['coord']); |
|
167 | + $coord = explode(',', $_GET['coord']); |
|
168 | 168 | } |
169 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
169 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
170 | 170 | } |
171 | 171 | //print_r($spotter_array); |
172 | 172 | if (!empty($spotter_array) && isset($coord)) { |
173 | 173 | if (isset($_GET['archive'])) { |
174 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
174 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
175 | 175 | } elseif ($tracker) { |
176 | 176 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
177 | 177 | } elseif ($marine) { |
@@ -182,15 +182,15 @@ discard block |
||
182 | 182 | if ($flightcnt == '') $flightcnt = 0; |
183 | 183 | } else $flightcnt = 0; |
184 | 184 | |
185 | -$sqltime = round(microtime(true)-$begintime,2); |
|
185 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
186 | 186 | $minitime = time(); |
187 | 187 | $maxitime = 0; |
188 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
188 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
189 | 189 | $modelsdb = array(); |
190 | 190 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
191 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
192 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
193 | - if (isset($row[1]) ){ |
|
191 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
192 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
193 | + if (isset($row[1])) { |
|
194 | 194 | $model = $row[0]; |
195 | 195 | $modelsdb[$model] = $row[1]; |
196 | 196 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $output .= '},'; |
227 | 227 | if (!empty($spotter_array) && is_array($spotter_array)) |
228 | 228 | { |
229 | - foreach($spotter_array as $spotter_item) |
|
229 | + foreach ($spotter_array as $spotter_item) |
|
230 | 230 | { |
231 | 231 | $j++; |
232 | 232 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -258,11 +258,11 @@ discard block |
||
258 | 258 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
259 | 259 | $output .= '"format": "'.$spotter_item['format_source'].'",'; |
260 | 260 | if ($tracker) { |
261 | - $output.= '"type": "tracker"'; |
|
261 | + $output .= '"type": "tracker"'; |
|
262 | 262 | } elseif ($marine) { |
263 | - $output.= '"type": "marine"'; |
|
263 | + $output .= '"type": "marine"'; |
|
264 | 264 | } else { |
265 | - $output.= '"type": "flight"'; |
|
265 | + $output .= '"type": "flight"'; |
|
266 | 266 | } |
267 | 267 | $output .= '},'; |
268 | 268 | |
@@ -606,8 +606,8 @@ discard block |
||
606 | 606 | $output .= '},'; |
607 | 607 | } |
608 | 608 | } |
609 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
610 | - else $output = str_replace('%onground%','false',$output); |
|
609 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
610 | + else $output = str_replace('%onground%', 'false', $output); |
|
611 | 611 | |
612 | 612 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
613 | 613 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | $output .= '"cartographicDegrees": ['; |
623 | 623 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
624 | 624 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
625 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
625 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
626 | 626 | $output .= $spotter_item['longitude'].', '; |
627 | 627 | $output .= $spotter_item['latitude']; |
628 | 628 | $prevlong = $spotter_item['longitude']; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
651 | 651 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
652 | 652 | } else { |
653 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
653 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
654 | 654 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
655 | 655 | if ($spotter_item['ground_speed'] == 0) { |
656 | 656 | $output .= $prevlong.', '; |
@@ -690,15 +690,15 @@ discard block |
||
690 | 690 | } |
691 | 691 | $output .= ']'; |
692 | 692 | if (isset($globalArchive) && $globalArchive === TRUE) { |
693 | - if ((time()-$globalLiveInterval) > $minitime) { |
|
694 | - if (time()-$globalLiveInterval > $maxitime) { |
|
695 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
693 | + if ((time() - $globalLiveInterval) > $minitime) { |
|
694 | + if (time() - $globalLiveInterval > $maxitime) { |
|
695 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
696 | 696 | } else { |
697 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
697 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
698 | 698 | } |
699 | 699 | } |
700 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
701 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
702 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
700 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
701 | +} else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
702 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
703 | 703 | print $output; |
704 | 704 | ?> |
@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | $min = true; |
56 | 56 | $allhistory = false; |
57 | 57 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
58 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
60 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
61 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
63 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
64 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
65 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
66 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
67 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
68 | 68 | |
69 | 69 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
70 | 70 | $min = true; |
71 | 71 | } else $min = false; |
72 | 72 | |
73 | 73 | if (isset($_GET['ident'])) { |
74 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
74 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
75 | 75 | if ($tracker) { |
76 | 76 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
77 | 77 | } elseif ($marine) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | $allhistory = true; |
87 | 87 | } elseif (isset($_GET['flightaware_id'])) { |
88 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
88 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
89 | 89 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
90 | 90 | if (empty($spotter_array)) { |
91 | 91 | $from_archive = true; |
@@ -93,44 +93,44 @@ discard block |
||
93 | 93 | } |
94 | 94 | $allhistory = true; |
95 | 95 | } elseif (isset($_GET['famtrack_id'])) { |
96 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
96 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
97 | 97 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
98 | 98 | $allhistory = true; |
99 | 99 | } elseif (isset($_GET['fammarine_id'])) { |
100 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
100 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
101 | 101 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
102 | 102 | $allhistory = true; |
103 | 103 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
104 | 104 | //} elseif (isset($_GET['coord'])) { |
105 | 105 | $usecoord = true; |
106 | - $coord = explode(',',$_GET['coord']); |
|
106 | + $coord = explode(',', $_GET['coord']); |
|
107 | 107 | if ($tracker) { |
108 | - $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
|
108 | + $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter); |
|
109 | 109 | } elseif ($marine) { |
110 | - $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
|
110 | + $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter); |
|
111 | 111 | } else { |
112 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
112 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
113 | 113 | } |
114 | 114 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
115 | 115 | $usecoord = true; |
116 | - $coord = explode(',',$_GET['coord']); |
|
116 | + $coord = explode(',', $_GET['coord']); |
|
117 | 117 | if ($tracker) { |
118 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
118 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
119 | 119 | } elseif ($marine) { |
120 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
120 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
121 | 121 | } else { |
122 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
122 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
123 | 123 | } |
124 | 124 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
125 | 125 | $from_archive = true; |
126 | 126 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
127 | 127 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
128 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
129 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
130 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
131 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
132 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
133 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
128 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
129 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
130 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
131 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
132 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
133 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
134 | 134 | } elseif ($min) { |
135 | 135 | if ($tracker) { |
136 | 136 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -142,17 +142,17 @@ discard block |
||
142 | 142 | # $min = true; |
143 | 143 | } else { |
144 | 144 | if ($tracker) { |
145 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
145 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
146 | 146 | } elseif ($marine) { |
147 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
147 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
148 | 148 | } else { |
149 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
149 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | if ($usecoord) { |
154 | 154 | if (isset($_GET['archive'])) { |
155 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
155 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
156 | 156 | } else { |
157 | 157 | if ($tracker) { |
158 | 158 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | if ($flightcnt == '') $flightcnt = 0; |
166 | 166 | } else $flightcnt = 0; |
167 | 167 | |
168 | -$sqltime = round(microtime(true)-$begintime,2); |
|
168 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
169 | 169 | |
170 | 170 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
171 | 171 | else $usenextlatlon = true; |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | if (!empty($spotter_array) && is_array($spotter_array)) |
183 | 183 | { |
184 | 184 | $output .= '"features": ['; |
185 | - foreach($spotter_array as $spotter_item) |
|
185 | + foreach ($spotter_array as $spotter_item) |
|
186 | 186 | { |
187 | 187 | $j++; |
188 | 188 | date_default_timezone_set('UTC'); |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | */ |
239 | 239 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
240 | 240 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
241 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
242 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
241 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
242 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
243 | 243 | //" |
244 | 244 | } else { |
245 | 245 | if ($compress) $output .= '"c": "NA",'; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
249 | 249 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
250 | 250 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
251 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
251 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
252 | 252 | } elseif (isset($spotter_item['aircraft_type'])) { |
253 | 253 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
254 | 254 | } elseif (!$min) { |
@@ -389,16 +389,16 @@ discard block |
||
389 | 389 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
390 | 390 | |
391 | 391 | if (isset($archivespeed)) { |
392 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
392 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
393 | 393 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
394 | 394 | } elseif ($usenextlatlon) { |
395 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
395 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
396 | 396 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
397 | 397 | } |
398 | 398 | |
399 | 399 | if (!$min) $output .= '"image": "'.$image.'",'; |
400 | 400 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
401 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
401 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
402 | 402 | } |
403 | 403 | if (isset($spotter_item['image_source_website'])) { |
404 | 404 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -420,7 +420,7 @@ discard block |
||
420 | 420 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
421 | 421 | } |
422 | 422 | if (isset($spotter_item['acars'])) { |
423 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
423 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
424 | 424 | } |
425 | 425 | // type when not aircraft ? |
426 | 426 | if (isset($spotter_item['type'])) { |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | |
499 | 499 | } |
500 | 500 | */ |
501 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
501 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
502 | 502 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
503 | 503 | |
504 | 504 | if ( |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
507 | 507 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
508 | 508 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
509 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
509 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
510 | 510 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
511 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
511 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
512 | 512 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
513 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
513 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
514 | 514 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
515 | 515 | ) { |
516 | 516 | if ($tracker) { |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
548 | 548 | } |
549 | 549 | $output_history .= '['; |
550 | - $output_history .= $spotter_history['longitude'].', '; |
|
551 | - $output_history .= $spotter_history['latitude'].', '; |
|
552 | - $output_history .= $spotter_history['altitude']*30.48; |
|
550 | + $output_history .= $spotter_history['longitude'].', '; |
|
551 | + $output_history .= $spotter_history['latitude'].', '; |
|
552 | + $output_history .= $spotter_history['altitude']*30.48; |
|
553 | 553 | $output_history .= '],'; |
554 | 554 | /* |
555 | 555 | if ($from_archive === false) { |
@@ -567,8 +567,8 @@ discard block |
||
567 | 567 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
568 | 568 | } else $d = true; |
569 | 569 | $output_history .= '['; |
570 | - $output_history .= $spotter_history['longitude'].', '; |
|
571 | - $output_history .= $spotter_history['latitude']; |
|
570 | + $output_history .= $spotter_history['longitude'].', '; |
|
571 | + $output_history .= $spotter_history['latitude']; |
|
572 | 572 | $output_history .= '],'; |
573 | 573 | /* |
574 | 574 | if ($from_archive === false) { |
@@ -584,9 +584,9 @@ discard block |
||
584 | 584 | |
585 | 585 | if ($from_archive === false) { |
586 | 586 | $output_historyd = '['; |
587 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
588 | - $output_historyd .= $spotter_item['latitude']; |
|
589 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
587 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
588 | + $output_historyd .= $spotter_item['latitude']; |
|
589 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
590 | 590 | $output_historyd .= '],'; |
591 | 591 | //$output_history = $output_historyd.$output_history; |
592 | 592 | $output_history = $output_history.$output_historyd; |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | } |
601 | 601 | } |
602 | 602 | |
603 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
603 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
604 | 604 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
605 | 605 | && (isset($spotter_item['departure_airport']) |
606 | 606 | && $spotter_item['departure_airport'] != 'NA' |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | |
635 | 635 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
636 | 636 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
637 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
637 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
638 | 638 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
639 | 639 | && (isset($spotter_item['arrival_airport']) |
640 | 640 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | $output = substr($output, 0, -1); |
666 | 666 | $output .= ']'; |
667 | 667 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
668 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
668 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
669 | 669 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
670 | 670 | $output .= '"fc": "'.$j.'"'; |
671 | 671 | } else { |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
73 | 73 | } |
74 | 74 | } |
75 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
75 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
76 | 76 | } |
77 | 77 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
78 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
78 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
79 | 79 | } |
80 | 80 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
81 | 81 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
82 | 82 | if ($filter_query_where != '') { |
83 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
83 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
84 | 84 | } |
85 | 85 | $filter_query = $filter_query_join.$filter_query_where; |
86 | 86 | return $filter_query; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | if ($limit != '') |
104 | 104 | { |
105 | 105 | $limit_array = explode(',', $limit); |
106 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
107 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
106 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
107 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
108 | 108 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
109 | 109 | { |
110 | 110 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } else { |
128 | 128 | $query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query; |
129 | 129 | } |
130 | - $spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true); |
|
130 | + $spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true); |
|
131 | 131 | |
132 | 132 | return $spotter_array; |
133 | 133 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | global $globalDBdriver, $globalLiveInterval; |
144 | 144 | date_default_timezone_set('UTC'); |
145 | 145 | |
146 | - $filter_query = $this->getFilter($filter,true,true); |
|
146 | + $filter_query = $this->getFilter($filter, true, true); |
|
147 | 147 | |
148 | 148 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
149 | 149 | if ($globalDBdriver == 'mysql') { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | try { |
162 | 162 | $sth = $this->db->prepare($query); |
163 | 163 | $sth->execute(); |
164 | - } catch(PDOException $e) { |
|
164 | + } catch (PDOException $e) { |
|
165 | 165 | echo $e->getMessage(); |
166 | 166 | die; |
167 | 167 | } |
@@ -176,25 +176,25 @@ discard block |
||
176 | 176 | * @return Array the spotter information |
177 | 177 | * |
178 | 178 | */ |
179 | - public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false) |
|
179 | + public function getMinLastLiveTrackerData($coord, $filter = array(), $limit = false) |
|
180 | 180 | { |
181 | 181 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit; |
182 | 182 | date_default_timezone_set('UTC'); |
183 | 183 | $usecoord = false; |
184 | 184 | if (is_array($coord) && !empty($coord)) { |
185 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
186 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
187 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
188 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
185 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
186 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
187 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
188 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
189 | 189 | $usecoord = true; |
190 | 190 | } |
191 | - $filter_query = $this->getFilter($filter,true,true); |
|
191 | + $filter_query = $this->getFilter($filter, true, true); |
|
192 | 192 | |
193 | 193 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
194 | 194 | if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300'; |
195 | 195 | if ($globalDBdriver == 'mysql') { |
196 | 196 | if (isset($globalArchive) && $globalArchive) { |
197 | - $query = "SELECT * FROM ( |
|
197 | + $query = "SELECT * FROM ( |
|
198 | 198 | 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 |
199 | 199 | 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 "; |
200 | 200 | if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | } else { |
218 | 218 | if (isset($globalArchive) && $globalArchive) { |
219 | - $query = "SELECT * FROM ( |
|
219 | + $query = "SELECT * FROM ( |
|
220 | 220 | 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 |
221 | 221 | 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 "; |
222 | 222 | if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | try { |
241 | 241 | $sth = $this->db->prepare($query); |
242 | 242 | $sth->execute(); |
243 | - } catch(PDOException $e) { |
|
243 | + } catch (PDOException $e) { |
|
244 | 244 | echo $e->getMessage(); |
245 | 245 | die; |
246 | 246 | } |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | public function getLiveTrackerCount($filter = array()) |
258 | 258 | { |
259 | 259 | global $globalDBdriver, $globalLiveInterval; |
260 | - $filter_query = $this->getFilter($filter,true,true); |
|
260 | + $filter_query = $this->getFilter($filter, true, true); |
|
261 | 261 | |
262 | 262 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
263 | 263 | if ($globalDBdriver == 'mysql') { |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | try { |
269 | 269 | $sth = $this->db->prepare($query); |
270 | 270 | $sth->execute(); |
271 | - } catch(PDOException $e) { |
|
271 | + } catch (PDOException $e) { |
|
272 | 272 | echo $e->getMessage(); |
273 | 273 | die; |
274 | 274 | } |
@@ -291,10 +291,10 @@ discard block |
||
291 | 291 | $filter_query = $this->getFilter($filter); |
292 | 292 | |
293 | 293 | if (is_array($coord)) { |
294 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
295 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
296 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
297 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
294 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
295 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
296 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
297 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
298 | 298 | } else return array(); |
299 | 299 | if ($globalDBdriver == 'mysql') { |
300 | 300 | $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; |
@@ -319,17 +319,17 @@ discard block |
||
319 | 319 | $filter_query = $this->getFilter($filter); |
320 | 320 | |
321 | 321 | if (is_array($coord)) { |
322 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
323 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
324 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
325 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
322 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
323 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
324 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
325 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
326 | 326 | } else return array(); |
327 | 327 | if ($globalDBdriver == 'mysql') { |
328 | 328 | $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 |
329 | 329 | 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." |
330 | 330 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
331 | 331 | } else { |
332 | - $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 |
|
332 | + $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 |
|
333 | 333 | 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'"; |
334 | 334 | } |
335 | 335 | $spotter_array = $Spotter->getDataFromDB($query); |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | if ($interval == '1m') |
378 | 378 | { |
379 | 379 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
380 | - } else if ($interval == '15m'){ |
|
380 | + } else if ($interval == '15m') { |
|
381 | 381 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
382 | 382 | } |
383 | 383 | } |
@@ -385,14 +385,14 @@ discard block |
||
385 | 385 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
386 | 386 | } |
387 | 387 | |
388 | - $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 |
|
388 | + $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 |
|
389 | 389 | WHERE tracker_live.latitude <> '' |
390 | 390 | AND tracker_live.longitude <> '' |
391 | 391 | ".$additional_query." |
392 | 392 | HAVING distance < :radius |
393 | 393 | ORDER BY distance"; |
394 | 394 | |
395 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
395 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
396 | 396 | |
397 | 397 | return $spotter_array; |
398 | 398 | } |
@@ -410,9 +410,9 @@ discard block |
||
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 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 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 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
415 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
416 | 416 | |
417 | 417 | return $spotter_array; |
418 | 418 | } |
@@ -423,16 +423,16 @@ discard block |
||
423 | 423 | * @return Array the spotter information |
424 | 424 | * |
425 | 425 | */ |
426 | - public function getDateLiveTrackerDataByIdent($ident,$date) |
|
426 | + public function getDateLiveTrackerDataByIdent($ident, $date) |
|
427 | 427 | { |
428 | 428 | $Tracker = new Tracker($this->db); |
429 | 429 | date_default_timezone_set('UTC'); |
430 | 430 | |
431 | 431 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
432 | - $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'; |
|
432 | + $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'; |
|
433 | 433 | |
434 | - $date = date('c',$date); |
|
435 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
434 | + $date = date('c', $date); |
|
435 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
436 | 436 | |
437 | 437 | return $spotter_array; |
438 | 438 | } |
@@ -449,9 +449,9 @@ discard block |
||
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 GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
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 GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
453 | 453 | |
454 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
|
454 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true); |
|
455 | 455 | |
456 | 456 | return $spotter_array; |
457 | 457 | } |
@@ -462,15 +462,15 @@ discard block |
||
462 | 462 | * @return Array the spotter information |
463 | 463 | * |
464 | 464 | */ |
465 | - public function getDateLiveTrackerDataById($id,$date) |
|
465 | + public function getDateLiveTrackerDataById($id, $date) |
|
466 | 466 | { |
467 | 467 | $Tracker = new Tracker($this->db); |
468 | 468 | date_default_timezone_set('UTC'); |
469 | 469 | |
470 | 470 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
471 | - $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'; |
|
472 | - $date = date('c',$date); |
|
473 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
471 | + $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'; |
|
472 | + $date = date('c', $date); |
|
473 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
474 | 474 | |
475 | 475 | return $spotter_array; |
476 | 476 | } |
@@ -487,13 +487,13 @@ discard block |
||
487 | 487 | date_default_timezone_set('UTC'); |
488 | 488 | |
489 | 489 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
490 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
490 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
491 | 491 | |
492 | 492 | try { |
493 | 493 | |
494 | 494 | $sth = $this->db->prepare($query); |
495 | 495 | $sth->execute(array(':ident' => $ident)); |
496 | - } catch(PDOException $e) { |
|
496 | + } catch (PDOException $e) { |
|
497 | 497 | echo $e->getMessage(); |
498 | 498 | die; |
499 | 499 | } |
@@ -508,7 +508,7 @@ discard block |
||
508 | 508 | * @return Array the spotter information |
509 | 509 | * |
510 | 510 | */ |
511 | - public function getAllLiveTrackerDataById($id,$liveinterval = false) |
|
511 | + public function getAllLiveTrackerDataById($id, $liveinterval = false) |
|
512 | 512 | { |
513 | 513 | global $globalDBdriver, $globalLiveInterval; |
514 | 514 | date_default_timezone_set('UTC'); |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | try { |
528 | 528 | $sth = $this->db->prepare($query); |
529 | 529 | $sth->execute(array(':id' => $id)); |
530 | - } catch(PDOException $e) { |
|
530 | + } catch (PDOException $e) { |
|
531 | 531 | echo $e->getMessage(); |
532 | 532 | die; |
533 | 533 | } |
@@ -545,12 +545,12 @@ discard block |
||
545 | 545 | { |
546 | 546 | date_default_timezone_set('UTC'); |
547 | 547 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
548 | - $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
548 | + $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
549 | 549 | try { |
550 | 550 | |
551 | 551 | $sth = $this->db->prepare($query); |
552 | 552 | $sth->execute(array(':ident' => $ident)); |
553 | - } catch(PDOException $e) { |
|
553 | + } catch (PDOException $e) { |
|
554 | 554 | echo $e->getMessage(); |
555 | 555 | die; |
556 | 556 | } |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | |
581 | 581 | $sth = $this->db->prepare($query); |
582 | 582 | $sth->execute(); |
583 | - } catch(PDOException $e) { |
|
583 | + } catch (PDOException $e) { |
|
584 | 584 | return "error"; |
585 | 585 | } |
586 | 586 | |
@@ -603,14 +603,14 @@ discard block |
||
603 | 603 | |
604 | 604 | $sth = $this->db->prepare($query); |
605 | 605 | $sth->execute(); |
606 | - } catch(PDOException $e) { |
|
606 | + } catch (PDOException $e) { |
|
607 | 607 | return "error"; |
608 | 608 | } |
609 | 609 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
610 | 610 | $i = 0; |
611 | - $j =0; |
|
611 | + $j = 0; |
|
612 | 612 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
613 | - foreach($all as $row) |
|
613 | + foreach ($all as $row) |
|
614 | 614 | { |
615 | 615 | $i++; |
616 | 616 | $j++; |
@@ -618,9 +618,9 @@ discard block |
||
618 | 618 | if ($globalDebug) echo "."; |
619 | 619 | try { |
620 | 620 | |
621 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
621 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
622 | 622 | $sth->execute(); |
623 | - } catch(PDOException $e) { |
|
623 | + } catch (PDOException $e) { |
|
624 | 624 | return "error"; |
625 | 625 | } |
626 | 626 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
@@ -631,9 +631,9 @@ discard block |
||
631 | 631 | if ($i > 0) { |
632 | 632 | try { |
633 | 633 | |
634 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
634 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
635 | 635 | $sth->execute(); |
636 | - } catch(PDOException $e) { |
|
636 | + } catch (PDOException $e) { |
|
637 | 637 | return "error"; |
638 | 638 | } |
639 | 639 | } |
@@ -646,7 +646,7 @@ discard block |
||
646 | 646 | |
647 | 647 | $sth = $this->db->prepare($query); |
648 | 648 | $sth->execute(); |
649 | - } catch(PDOException $e) { |
|
649 | + } catch (PDOException $e) { |
|
650 | 650 | return "error"; |
651 | 651 | } |
652 | 652 | /* $query_delete = "DELETE FROM tracker_live WHERE famtrackid IN ("; |
@@ -694,13 +694,13 @@ discard block |
||
694 | 694 | public function deleteLiveTrackerDataByIdent($ident) |
695 | 695 | { |
696 | 696 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
697 | - $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
697 | + $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
698 | 698 | |
699 | 699 | try { |
700 | 700 | |
701 | 701 | $sth = $this->db->prepare($query); |
702 | 702 | $sth->execute(array(':ident' => $ident)); |
703 | - } catch(PDOException $e) { |
|
703 | + } catch (PDOException $e) { |
|
704 | 704 | return "error"; |
705 | 705 | } |
706 | 706 | |
@@ -716,13 +716,13 @@ discard block |
||
716 | 716 | public function deleteLiveTrackerDataById($id) |
717 | 717 | { |
718 | 718 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
719 | - $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
719 | + $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
720 | 720 | |
721 | 721 | try { |
722 | 722 | |
723 | 723 | $sth = $this->db->prepare($query); |
724 | 724 | $sth->execute(array(':id' => $id)); |
725 | - } catch(PDOException $e) { |
|
725 | + } catch (PDOException $e) { |
|
726 | 726 | return "error"; |
727 | 727 | } |
728 | 728 | |
@@ -740,13 +740,13 @@ discard block |
||
740 | 740 | { |
741 | 741 | global $globalDBdriver, $globalTimezone; |
742 | 742 | if ($globalDBdriver == 'mysql') { |
743 | - $query = 'SELECT tracker_live.ident FROM tracker_live |
|
743 | + $query = 'SELECT tracker_live.ident FROM tracker_live |
|
744 | 744 | WHERE tracker_live.ident = :ident |
745 | 745 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
746 | 746 | AND tracker_live.date < UTC_TIMESTAMP()'; |
747 | 747 | $query_data = array(':ident' => $ident); |
748 | 748 | } else { |
749 | - $query = "SELECT tracker_live.ident FROM tracker_live |
|
749 | + $query = "SELECT tracker_live.ident FROM tracker_live |
|
750 | 750 | WHERE tracker_live.ident = :ident |
751 | 751 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
752 | 752 | AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -755,8 +755,8 @@ discard block |
||
755 | 755 | |
756 | 756 | $sth = $this->db->prepare($query); |
757 | 757 | $sth->execute($query_data); |
758 | - $ident_result=''; |
|
759 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
758 | + $ident_result = ''; |
|
759 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
760 | 760 | { |
761 | 761 | $ident_result = $row['ident']; |
762 | 762 | } |
@@ -773,13 +773,13 @@ discard block |
||
773 | 773 | { |
774 | 774 | global $globalDBdriver, $globalTimezone; |
775 | 775 | if ($globalDBdriver == 'mysql') { |
776 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
776 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
777 | 777 | WHERE tracker_live.ident = :ident |
778 | 778 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
779 | 779 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
780 | 780 | $query_data = array(':ident' => $ident); |
781 | 781 | } else { |
782 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
782 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
783 | 783 | WHERE tracker_live.ident = :ident |
784 | 784 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
785 | 785 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -788,8 +788,8 @@ discard block |
||
788 | 788 | |
789 | 789 | $sth = $this->db->prepare($query); |
790 | 790 | $sth->execute($query_data); |
791 | - $ident_result=''; |
|
792 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
791 | + $ident_result = ''; |
|
792 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
793 | 793 | { |
794 | 794 | $ident_result = $row['famtrackid']; |
795 | 795 | } |
@@ -806,13 +806,13 @@ discard block |
||
806 | 806 | { |
807 | 807 | global $globalDBdriver, $globalTimezone; |
808 | 808 | if ($globalDBdriver == 'mysql') { |
809 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
809 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
810 | 810 | WHERE tracker_live.famtrackid = :id |
811 | 811 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
812 | 812 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
813 | 813 | $query_data = array(':id' => $id); |
814 | 814 | } else { |
815 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
815 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
816 | 816 | WHERE tracker_live.famtrackid = :id |
817 | 817 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
818 | 818 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -821,8 +821,8 @@ discard block |
||
821 | 821 | |
822 | 822 | $sth = $this->db->prepare($query); |
823 | 823 | $sth->execute($query_data); |
824 | - $ident_result=''; |
|
825 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
824 | + $ident_result = ''; |
|
825 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
826 | 826 | { |
827 | 827 | $ident_result = $row['famtrackid']; |
828 | 828 | } |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | * @return String success or false |
841 | 841 | * |
842 | 842 | */ |
843 | - public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
843 | + public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
844 | 844 | { |
845 | 845 | global $globalURL, $globalArchive, $globalDebug; |
846 | 846 | $Common = new Common(); |
@@ -899,21 +899,21 @@ discard block |
||
899 | 899 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
900 | 900 | |
901 | 901 | |
902 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
903 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
904 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
905 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
906 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
907 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
908 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
909 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
910 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
911 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
912 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
913 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
914 | - |
|
915 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
916 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
902 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
903 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
904 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
905 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
906 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
907 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
908 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
909 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
910 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
911 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
912 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
913 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
914 | + |
|
915 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
916 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
917 | 917 | |
918 | 918 | $query = ''; |
919 | 919 | if ($globalArchive) { |
@@ -923,12 +923,12 @@ discard block |
||
923 | 923 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
924 | 924 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
925 | 925 | |
926 | - $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); |
|
926 | + $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); |
|
927 | 927 | try { |
928 | 928 | |
929 | 929 | $sth = $this->db->prepare($query); |
930 | 930 | $sth->execute($query_values); |
931 | - } catch(PDOException $e) { |
|
931 | + } catch (PDOException $e) { |
|
932 | 932 | return "error : ".$e->getMessage(); |
933 | 933 | } |
934 | 934 | /* |
@@ -938,7 +938,7 @@ discard block |
||
938 | 938 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
939 | 939 | if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
940 | 940 | $TrackerArchive = new TrackerArchive($this->db); |
941 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
941 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country); |
|
942 | 942 | if ($globalDebug) echo $result.')'; |
943 | 943 | } |
944 | 944 | |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | |
949 | 949 | public function getOrderBy() |
950 | 950 | { |
951 | - $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")); |
|
951 | + $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")); |
|
952 | 952 | return $orderby; |
953 | 953 | } |
954 | 954 |
@@ -17,62 +17,62 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
38 | 38 | if ($flt['airlines'][0] != '') { |
39 | 39 | if (isset($flt['source'])) { |
40 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
40 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
41 | 41 | } else { |
42 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
42 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | 46 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
47 | 47 | if (isset($flt['source'])) { |
48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
49 | 49 | } else { |
50 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
50 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
54 | 54 | if (isset($flt['source'])) { |
55 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
55 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
56 | 56 | } else { |
57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
61 | 61 | if (isset($flt['source'])) { |
62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
63 | 63 | } else { |
64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
68 | 68 | if (isset($flt['source'])) { |
69 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
69 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
73 | 73 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
74 | 74 | if ($filter['airlines'][0] != '') { |
75 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
75 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -82,10 +82,10 @@ discard block |
||
82 | 82 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
83 | 83 | } |
84 | 84 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
85 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
85 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
86 | 86 | } |
87 | 87 | if (isset($filter['source']) && !empty($filter['source'])) { |
88 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
88 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
89 | 89 | } |
90 | 90 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
91 | 91 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
115 | 115 | } |
116 | 116 | } |
117 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
117 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
118 | 118 | } |
119 | 119 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
120 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
120 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
121 | 121 | } |
122 | 122 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
123 | 123 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
124 | 124 | if ($filter_query_where != '') { |
125 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
125 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
126 | 126 | } |
127 | 127 | $filter_query = $filter_query_join.$filter_query_where; |
128 | 128 | return $filter_query; |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | if ($limit != '') |
146 | 146 | { |
147 | 147 | $limit_array = explode(',', $limit); |
148 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
149 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
148 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
149 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
150 | 150 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
151 | 151 | { |
152 | 152 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | } else { |
171 | 171 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
172 | 172 | } |
173 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
173 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
174 | 174 | |
175 | 175 | return $spotter_array; |
176 | 176 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | { |
186 | 186 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
187 | 187 | date_default_timezone_set('UTC'); |
188 | - $filter_query = $this->getFilter($filter,true,true); |
|
188 | + $filter_query = $this->getFilter($filter, true, true); |
|
189 | 189 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
190 | 190 | if ($globalDBdriver == 'mysql') { |
191 | 191 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | try { |
209 | 209 | $sth = $this->db->prepare($query); |
210 | 210 | $sth->execute(); |
211 | - } catch(PDOException $e) { |
|
211 | + } catch (PDOException $e) { |
|
212 | 212 | echo $e->getMessage(); |
213 | 213 | die; |
214 | 214 | } |
@@ -222,19 +222,19 @@ discard block |
||
222 | 222 | * @return Array the spotter information |
223 | 223 | * |
224 | 224 | */ |
225 | - public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false) |
|
225 | + public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false) |
|
226 | 226 | { |
227 | 227 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
228 | 228 | date_default_timezone_set('UTC'); |
229 | 229 | $usecoord = false; |
230 | 230 | if (is_array($coord) && !empty($coord)) { |
231 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
232 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
233 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
234 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
231 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
232 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
233 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
234 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
235 | 235 | $usecoord = true; |
236 | 236 | } |
237 | - $filter_query = $this->getFilter($filter,true,true); |
|
237 | + $filter_query = $this->getFilter($filter, true, true); |
|
238 | 238 | |
239 | 239 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
240 | 240 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | try { |
296 | 296 | $sth = $this->db->prepare($query); |
297 | 297 | $sth->execute(); |
298 | - } catch(PDOException $e) { |
|
298 | + } catch (PDOException $e) { |
|
299 | 299 | echo $e->getMessage(); |
300 | 300 | die; |
301 | 301 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | public function getLiveSpotterCount($filter = array()) |
313 | 313 | { |
314 | 314 | global $globalDBdriver, $globalLiveInterval; |
315 | - $filter_query = $this->getFilter($filter,true,true); |
|
315 | + $filter_query = $this->getFilter($filter, true, true); |
|
316 | 316 | |
317 | 317 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
318 | 318 | if ($globalDBdriver == 'mysql') { |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | try { |
326 | 326 | $sth = $this->db->prepare($query); |
327 | 327 | $sth->execute(); |
328 | - } catch(PDOException $e) { |
|
328 | + } catch (PDOException $e) { |
|
329 | 329 | echo $e->getMessage(); |
330 | 330 | die; |
331 | 331 | } |
@@ -348,10 +348,10 @@ discard block |
||
348 | 348 | $filter_query = $this->getFilter($filter); |
349 | 349 | |
350 | 350 | if (is_array($coord)) { |
351 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
352 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
353 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
354 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
351 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
352 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
353 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
354 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
355 | 355 | } else return array(); |
356 | 356 | if ($globalDBdriver == 'mysql') { |
357 | 357 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -374,23 +374,23 @@ discard block |
||
374 | 374 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
375 | 375 | $Spotter = new Spotter($this->db); |
376 | 376 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
377 | - $filter_query = $this->getFilter($filter,true,true); |
|
377 | + $filter_query = $this->getFilter($filter, true, true); |
|
378 | 378 | |
379 | 379 | if (is_array($coord)) { |
380 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
381 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
382 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
383 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
380 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
381 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
382 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
383 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
384 | 384 | } else return array(); |
385 | 385 | if ($globalDBdriver == 'mysql') { |
386 | 386 | if (isset($globalArchive) && $globalArchive === TRUE) { |
387 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
387 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
388 | 388 | FROM spotter_live |
389 | 389 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
390 | 390 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
391 | 391 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0'; |
392 | 392 | } else { |
393 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
393 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
394 | 394 | FROM spotter_live |
395 | 395 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
396 | 396 | FROM spotter_live l |
@@ -402,14 +402,14 @@ discard block |
||
402 | 402 | } |
403 | 403 | } else { |
404 | 404 | if (isset($globalArchive) && $globalArchive === TRUE) { |
405 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
405 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
406 | 406 | FROM spotter_live |
407 | 407 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
408 | 408 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
409 | 409 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
410 | 410 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
411 | 411 | } else { |
412 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
412 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
413 | 413 | FROM spotter_live |
414 | 414 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
415 | 415 | FROM spotter_live l |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | try { |
425 | 425 | $sth = $this->db->prepare($query); |
426 | 426 | $sth->execute(); |
427 | - } catch(PDOException $e) { |
|
427 | + } catch (PDOException $e) { |
|
428 | 428 | echo $e->getMessage(); |
429 | 429 | die; |
430 | 430 | } |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | if ($interval == '1m') |
474 | 474 | { |
475 | 475 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
476 | - } else if ($interval == '15m'){ |
|
476 | + } else if ($interval == '15m') { |
|
477 | 477 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
478 | 478 | } |
479 | 479 | } |
@@ -481,14 +481,14 @@ discard block |
||
481 | 481 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
482 | 482 | } |
483 | 483 | |
484 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
484 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
485 | 485 | WHERE spotter_live.latitude <> '' |
486 | 486 | AND spotter_live.longitude <> '' |
487 | 487 | ".$additional_query." |
488 | 488 | HAVING distance < :radius |
489 | 489 | ORDER BY distance"; |
490 | 490 | |
491 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
491 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
492 | 492 | |
493 | 493 | return $spotter_array; |
494 | 494 | } |
@@ -506,9 +506,9 @@ discard block |
||
506 | 506 | date_default_timezone_set('UTC'); |
507 | 507 | |
508 | 508 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
509 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
509 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
510 | 510 | |
511 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
511 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
512 | 512 | |
513 | 513 | return $spotter_array; |
514 | 514 | } |
@@ -519,16 +519,16 @@ discard block |
||
519 | 519 | * @return Array the spotter information |
520 | 520 | * |
521 | 521 | */ |
522 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
522 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
523 | 523 | { |
524 | 524 | $Spotter = new Spotter($this->db); |
525 | 525 | date_default_timezone_set('UTC'); |
526 | 526 | |
527 | 527 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
528 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
528 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
529 | 529 | |
530 | - $date = date('c',$date); |
|
531 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
530 | + $date = date('c', $date); |
|
531 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
532 | 532 | |
533 | 533 | return $spotter_array; |
534 | 534 | } |
@@ -544,8 +544,8 @@ discard block |
||
544 | 544 | $Spotter = new Spotter($this->db); |
545 | 545 | date_default_timezone_set('UTC'); |
546 | 546 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
547 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
548 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
547 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
548 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
549 | 549 | return $spotter_array; |
550 | 550 | } |
551 | 551 | |
@@ -555,15 +555,15 @@ discard block |
||
555 | 555 | * @return Array the spotter information |
556 | 556 | * |
557 | 557 | */ |
558 | - public function getDateLiveSpotterDataById($id,$date) |
|
558 | + public function getDateLiveSpotterDataById($id, $date) |
|
559 | 559 | { |
560 | 560 | $Spotter = new Spotter($this->db); |
561 | 561 | date_default_timezone_set('UTC'); |
562 | 562 | |
563 | 563 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
564 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
565 | - $date = date('c',$date); |
|
566 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
564 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
565 | + $date = date('c', $date); |
|
566 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
567 | 567 | return $spotter_array; |
568 | 568 | } |
569 | 569 | |
@@ -579,13 +579,13 @@ discard block |
||
579 | 579 | date_default_timezone_set('UTC'); |
580 | 580 | |
581 | 581 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
582 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
582 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
583 | 583 | |
584 | 584 | try { |
585 | 585 | |
586 | 586 | $sth = $this->db->prepare($query); |
587 | 587 | $sth->execute(array(':ident' => $ident)); |
588 | - } catch(PDOException $e) { |
|
588 | + } catch (PDOException $e) { |
|
589 | 589 | echo $e->getMessage(); |
590 | 590 | die; |
591 | 591 | } |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | * @return Array the spotter information |
601 | 601 | * |
602 | 602 | */ |
603 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
603 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
604 | 604 | { |
605 | 605 | global $globalDBdriver, $globalLiveInterval; |
606 | 606 | date_default_timezone_set('UTC'); |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | try { |
620 | 620 | $sth = $this->db->prepare($query); |
621 | 621 | $sth->execute(array(':id' => $id)); |
622 | - } catch(PDOException $e) { |
|
622 | + } catch (PDOException $e) { |
|
623 | 623 | echo $e->getMessage(); |
624 | 624 | die; |
625 | 625 | } |
@@ -637,12 +637,12 @@ discard block |
||
637 | 637 | { |
638 | 638 | date_default_timezone_set('UTC'); |
639 | 639 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
640 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
640 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
641 | 641 | try { |
642 | 642 | |
643 | 643 | $sth = $this->db->prepare($query); |
644 | 644 | $sth->execute(array(':ident' => $ident)); |
645 | - } catch(PDOException $e) { |
|
645 | + } catch (PDOException $e) { |
|
646 | 646 | echo $e->getMessage(); |
647 | 647 | die; |
648 | 648 | } |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | |
673 | 673 | $sth = $this->db->prepare($query); |
674 | 674 | $sth->execute(); |
675 | - } catch(PDOException $e) { |
|
675 | + } catch (PDOException $e) { |
|
676 | 676 | return "error"; |
677 | 677 | } |
678 | 678 | |
@@ -695,14 +695,14 @@ discard block |
||
695 | 695 | |
696 | 696 | $sth = $this->db->prepare($query); |
697 | 697 | $sth->execute(); |
698 | - } catch(PDOException $e) { |
|
698 | + } catch (PDOException $e) { |
|
699 | 699 | return "error"; |
700 | 700 | } |
701 | 701 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
702 | 702 | $i = 0; |
703 | - $j =0; |
|
703 | + $j = 0; |
|
704 | 704 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
705 | - foreach($all as $row) |
|
705 | + foreach ($all as $row) |
|
706 | 706 | { |
707 | 707 | $i++; |
708 | 708 | $j++; |
@@ -710,9 +710,9 @@ discard block |
||
710 | 710 | if ($globalDebug) echo "."; |
711 | 711 | try { |
712 | 712 | |
713 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
713 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
714 | 714 | $sth->execute(); |
715 | - } catch(PDOException $e) { |
|
715 | + } catch (PDOException $e) { |
|
716 | 716 | return "error"; |
717 | 717 | } |
718 | 718 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -723,9 +723,9 @@ discard block |
||
723 | 723 | if ($i > 0) { |
724 | 724 | try { |
725 | 725 | |
726 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
726 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
727 | 727 | $sth->execute(); |
728 | - } catch(PDOException $e) { |
|
728 | + } catch (PDOException $e) { |
|
729 | 729 | return "error"; |
730 | 730 | } |
731 | 731 | } |
@@ -738,7 +738,7 @@ discard block |
||
738 | 738 | |
739 | 739 | $sth = $this->db->prepare($query); |
740 | 740 | $sth->execute(); |
741 | - } catch(PDOException $e) { |
|
741 | + } catch (PDOException $e) { |
|
742 | 742 | return "error"; |
743 | 743 | } |
744 | 744 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -786,13 +786,13 @@ discard block |
||
786 | 786 | public function deleteLiveSpotterDataByIdent($ident) |
787 | 787 | { |
788 | 788 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
789 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
789 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
790 | 790 | |
791 | 791 | try { |
792 | 792 | |
793 | 793 | $sth = $this->db->prepare($query); |
794 | 794 | $sth->execute(array(':ident' => $ident)); |
795 | - } catch(PDOException $e) { |
|
795 | + } catch (PDOException $e) { |
|
796 | 796 | return "error"; |
797 | 797 | } |
798 | 798 | |
@@ -808,13 +808,13 @@ discard block |
||
808 | 808 | public function deleteLiveSpotterDataById($id) |
809 | 809 | { |
810 | 810 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
811 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
811 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
812 | 812 | |
813 | 813 | try { |
814 | 814 | |
815 | 815 | $sth = $this->db->prepare($query); |
816 | 816 | $sth->execute(array(':id' => $id)); |
817 | - } catch(PDOException $e) { |
|
817 | + } catch (PDOException $e) { |
|
818 | 818 | return "error"; |
819 | 819 | } |
820 | 820 | |
@@ -832,13 +832,13 @@ discard block |
||
832 | 832 | { |
833 | 833 | global $globalDBdriver, $globalTimezone; |
834 | 834 | if ($globalDBdriver == 'mysql') { |
835 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
835 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
836 | 836 | WHERE spotter_live.ident = :ident |
837 | 837 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
838 | 838 | AND spotter_live.date < UTC_TIMESTAMP()'; |
839 | 839 | $query_data = array(':ident' => $ident); |
840 | 840 | } else { |
841 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
841 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
842 | 842 | WHERE spotter_live.ident = :ident |
843 | 843 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
844 | 844 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -847,8 +847,8 @@ discard block |
||
847 | 847 | |
848 | 848 | $sth = $this->db->prepare($query); |
849 | 849 | $sth->execute($query_data); |
850 | - $ident_result=''; |
|
851 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
850 | + $ident_result = ''; |
|
851 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
852 | 852 | { |
853 | 853 | $ident_result = $row['ident']; |
854 | 854 | } |
@@ -865,13 +865,13 @@ discard block |
||
865 | 865 | { |
866 | 866 | global $globalDBdriver, $globalTimezone; |
867 | 867 | if ($globalDBdriver == 'mysql') { |
868 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
868 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
869 | 869 | WHERE spotter_live.ident = :ident |
870 | 870 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
871 | 871 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
872 | 872 | $query_data = array(':ident' => $ident); |
873 | 873 | } else { |
874 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
874 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
875 | 875 | WHERE spotter_live.ident = :ident |
876 | 876 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
877 | 877 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -880,8 +880,8 @@ discard block |
||
880 | 880 | |
881 | 881 | $sth = $this->db->prepare($query); |
882 | 882 | $sth->execute($query_data); |
883 | - $ident_result=''; |
|
884 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
883 | + $ident_result = ''; |
|
884 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
885 | 885 | { |
886 | 886 | $ident_result = $row['flightaware_id']; |
887 | 887 | } |
@@ -898,13 +898,13 @@ discard block |
||
898 | 898 | { |
899 | 899 | global $globalDBdriver, $globalTimezone; |
900 | 900 | if ($globalDBdriver == 'mysql') { |
901 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
901 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
902 | 902 | WHERE spotter_live.flightaware_id = :id |
903 | 903 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
904 | 904 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
905 | 905 | $query_data = array(':id' => $id); |
906 | 906 | } else { |
907 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
907 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
908 | 908 | WHERE spotter_live.flightaware_id = :id |
909 | 909 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
910 | 910 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -913,8 +913,8 @@ discard block |
||
913 | 913 | |
914 | 914 | $sth = $this->db->prepare($query); |
915 | 915 | $sth->execute($query_data); |
916 | - $ident_result=''; |
|
917 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
916 | + $ident_result = ''; |
|
917 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
918 | 918 | { |
919 | 919 | $ident_result = $row['flightaware_id']; |
920 | 920 | } |
@@ -931,13 +931,13 @@ discard block |
||
931 | 931 | { |
932 | 932 | global $globalDBdriver, $globalTimezone; |
933 | 933 | if ($globalDBdriver == 'mysql') { |
934 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
934 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
935 | 935 | WHERE spotter_live.ModeS = :modes |
936 | 936 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
937 | 937 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
938 | 938 | $query_data = array(':modes' => $modes); |
939 | 939 | } else { |
940 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
940 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
941 | 941 | WHERE spotter_live.ModeS = :modes |
942 | 942 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
943 | 943 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -946,8 +946,8 @@ discard block |
||
946 | 946 | |
947 | 947 | $sth = $this->db->prepare($query); |
948 | 948 | $sth->execute($query_data); |
949 | - $ident_result=''; |
|
950 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
949 | + $ident_result = ''; |
|
950 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
951 | 951 | { |
952 | 952 | //$ident_result = $row['spotter_live_id']; |
953 | 953 | $ident_result = $row['flightaware_id']; |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | * @return String success or false |
967 | 967 | * |
968 | 968 | */ |
969 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
969 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
970 | 970 | { |
971 | 971 | global $globalURL, $globalArchive, $globalDebug; |
972 | 972 | $Common = new Common(); |
@@ -1066,27 +1066,27 @@ discard block |
||
1066 | 1066 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1067 | 1067 | |
1068 | 1068 | |
1069 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
1070 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1071 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
1072 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1073 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1074 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1075 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1076 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
1077 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1078 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1079 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1080 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1081 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
1082 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
1083 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
1084 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
1085 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
1086 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1087 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1088 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1089 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
1069 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
1070 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1071 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
1072 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1073 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1074 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1075 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1076 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
1077 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1078 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1079 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1080 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1081 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
1082 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
1083 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
1084 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
1085 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
1086 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1087 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1088 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1089 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
1090 | 1090 | |
1091 | 1091 | $airline_name = ''; |
1092 | 1092 | $airline_icao = ''; |
@@ -1108,10 +1108,10 @@ discard block |
||
1108 | 1108 | $arrival_airport_country = ''; |
1109 | 1109 | |
1110 | 1110 | |
1111 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1112 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1113 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1114 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1111 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
1112 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
1113 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
1114 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1115 | 1115 | |
1116 | 1116 | $query = ''; |
1117 | 1117 | if ($globalArchive) { |
@@ -1122,19 +1122,19 @@ discard block |
||
1122 | 1122 | $query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) |
1123 | 1123 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)'; |
1124 | 1124 | |
1125 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real); |
|
1125 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real); |
|
1126 | 1126 | try { |
1127 | 1127 | |
1128 | 1128 | $sth = $this->db->prepare($query); |
1129 | 1129 | $sth->execute($query_values); |
1130 | 1130 | $sth->closeCursor(); |
1131 | - } catch(PDOException $e) { |
|
1131 | + } catch (PDOException $e) { |
|
1132 | 1132 | return "error : ".$e->getMessage(); |
1133 | 1133 | } |
1134 | 1134 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1135 | 1135 | if ($globalDebug) echo '(Add to SBS archive : '; |
1136 | 1136 | $SpotterArchive = new SpotterArchive($this->db); |
1137 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1137 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
1138 | 1138 | if ($globalDebug) echo $result.')'; |
1139 | 1139 | } elseif ($globalDebug && $putinarchive !== true) { |
1140 | 1140 | echo '(Not adding to archive)'; |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | |
1148 | 1148 | public function getOrderBy() |
1149 | 1149 | { |
1150 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1150 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1151 | 1151 | return $orderby; |
1152 | 1152 | } |
1153 | 1153 |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -72,15 +72,15 @@ discard block |
||
72 | 72 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
73 | 73 | } |
74 | 74 | } |
75 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
75 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
76 | 76 | } |
77 | 77 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
78 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
78 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
79 | 79 | } |
80 | 80 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
81 | 81 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
82 | 82 | if ($filter_query_where != '') { |
83 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
83 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
84 | 84 | } |
85 | 85 | $filter_query = $filter_query_join.$filter_query_where; |
86 | 86 | return $filter_query; |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | if ($limit != '') |
104 | 104 | { |
105 | 105 | $limit_array = explode(',', $limit); |
106 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
107 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
106 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
107 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
108 | 108 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
109 | 109 | { |
110 | 110 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
120 | 120 | } |
121 | 121 | } |
122 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
122 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
123 | 123 | |
124 | 124 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
125 | 125 | if ($globalDBdriver == 'mysql') { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } else { |
129 | 129 | $query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query; |
130 | 130 | } |
131 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
131 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
132 | 132 | |
133 | 133 | return $spotter_array; |
134 | 134 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | global $globalDBdriver, $globalLiveInterval; |
145 | 145 | date_default_timezone_set('UTC'); |
146 | 146 | |
147 | - $filter_query = $this->getFilter($filter,true,true); |
|
147 | + $filter_query = $this->getFilter($filter, true, true); |
|
148 | 148 | |
149 | 149 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
150 | 150 | if ($globalDBdriver == 'mysql') { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | try { |
159 | 159 | $sth = $this->db->prepare($query); |
160 | 160 | $sth->execute(); |
161 | - } catch(PDOException $e) { |
|
161 | + } catch (PDOException $e) { |
|
162 | 162 | echo $e->getMessage(); |
163 | 163 | die; |
164 | 164 | } |
@@ -173,19 +173,19 @@ discard block |
||
173 | 173 | * @return Array the spotter information |
174 | 174 | * |
175 | 175 | */ |
176 | - public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false) |
|
176 | + public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false) |
|
177 | 177 | { |
178 | 178 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
179 | 179 | date_default_timezone_set('UTC'); |
180 | 180 | $usecoord = false; |
181 | 181 | if (is_array($coord) && !empty($coord)) { |
182 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
183 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
184 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
185 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
182 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
183 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
184 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
185 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
186 | 186 | $usecoord = true; |
187 | 187 | } |
188 | - $filter_query = $this->getFilter($filter,true,true); |
|
188 | + $filter_query = $this->getFilter($filter, true, true); |
|
189 | 189 | |
190 | 190 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
191 | 191 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | try { |
235 | 235 | $sth = $this->db->prepare($query); |
236 | 236 | $sth->execute(); |
237 | - } catch(PDOException $e) { |
|
237 | + } catch (PDOException $e) { |
|
238 | 238 | echo $e->getMessage(); |
239 | 239 | die; |
240 | 240 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | public function getLiveMarineCount($filter = array()) |
252 | 252 | { |
253 | 253 | global $globalDBdriver, $globalLiveInterval; |
254 | - $filter_query = $this->getFilter($filter,true,true); |
|
254 | + $filter_query = $this->getFilter($filter, true, true); |
|
255 | 255 | |
256 | 256 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
257 | 257 | if ($globalDBdriver == 'mysql') { |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | try { |
263 | 263 | $sth = $this->db->prepare($query); |
264 | 264 | $sth->execute(); |
265 | - } catch(PDOException $e) { |
|
265 | + } catch (PDOException $e) { |
|
266 | 266 | echo $e->getMessage(); |
267 | 267 | die; |
268 | 268 | } |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | $filter_query = $this->getFilter($filter); |
286 | 286 | |
287 | 287 | if (is_array($coord)) { |
288 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
289 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
290 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
291 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
288 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
289 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
290 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
291 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
292 | 292 | } else return array(); |
293 | 293 | if ($globalDBdriver == 'mysql') { |
294 | 294 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query; |
@@ -313,17 +313,17 @@ discard block |
||
313 | 313 | $filter_query = $this->getFilter($filter); |
314 | 314 | |
315 | 315 | if (is_array($coord)) { |
316 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
317 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
318 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
319 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
316 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
317 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
318 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
319 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
320 | 320 | } else return array(); |
321 | 321 | if ($globalDBdriver == 'mysql') { |
322 | 322 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
323 | 323 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
324 | 324 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
325 | 325 | } else { |
326 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
326 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
|
327 | 327 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
328 | 328 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
329 | 329 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | if ($interval == '1m') |
373 | 373 | { |
374 | 374 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
375 | - } else if ($interval == '15m'){ |
|
375 | + } else if ($interval == '15m') { |
|
376 | 376 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
377 | 377 | } |
378 | 378 | } |
@@ -380,14 +380,14 @@ discard block |
||
380 | 380 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
381 | 381 | } |
382 | 382 | |
383 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
383 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
384 | 384 | WHERE marine_live.latitude <> '' |
385 | 385 | AND marine_live.longitude <> '' |
386 | 386 | ".$additional_query." |
387 | 387 | HAVING distance < :radius |
388 | 388 | ORDER BY distance"; |
389 | 389 | |
390 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
390 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
391 | 391 | |
392 | 392 | return $spotter_array; |
393 | 393 | } |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | date_default_timezone_set('UTC'); |
406 | 406 | |
407 | 407 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
408 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
408 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
409 | 409 | |
410 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
410 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
411 | 411 | |
412 | 412 | return $spotter_array; |
413 | 413 | } |
@@ -418,16 +418,16 @@ discard block |
||
418 | 418 | * @return Array the spotter information |
419 | 419 | * |
420 | 420 | */ |
421 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
421 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
422 | 422 | { |
423 | 423 | $Marine = new Marine($this->db); |
424 | 424 | date_default_timezone_set('UTC'); |
425 | 425 | |
426 | 426 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
427 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
427 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
428 | 428 | |
429 | - $date = date('c',$date); |
|
430 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
429 | + $date = date('c', $date); |
|
430 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
431 | 431 | |
432 | 432 | return $spotter_array; |
433 | 433 | } |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | date_default_timezone_set('UTC'); |
445 | 445 | |
446 | 446 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
447 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
447 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
448 | 448 | |
449 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
449 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
450 | 450 | |
451 | 451 | return $spotter_array; |
452 | 452 | } |
@@ -457,15 +457,15 @@ discard block |
||
457 | 457 | * @return Array the spotter information |
458 | 458 | * |
459 | 459 | */ |
460 | - public function getDateLiveMarineDataById($id,$date) |
|
460 | + public function getDateLiveMarineDataById($id, $date) |
|
461 | 461 | { |
462 | 462 | $Marine = new Marine($this->db); |
463 | 463 | date_default_timezone_set('UTC'); |
464 | 464 | |
465 | 465 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
466 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
467 | - $date = date('c',$date); |
|
468 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
466 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
467 | + $date = date('c', $date); |
|
468 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
469 | 469 | |
470 | 470 | return $spotter_array; |
471 | 471 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | * @return Array the spotter information |
478 | 478 | * |
479 | 479 | */ |
480 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
480 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
481 | 481 | { |
482 | 482 | global $globalDBdriver, $globalLiveInterval; |
483 | 483 | date_default_timezone_set('UTC'); |
@@ -496,7 +496,7 @@ discard block |
||
496 | 496 | try { |
497 | 497 | $sth = $this->db->prepare($query); |
498 | 498 | $sth->execute(array(':id' => $id)); |
499 | - } catch(PDOException $e) { |
|
499 | + } catch (PDOException $e) { |
|
500 | 500 | echo $e->getMessage(); |
501 | 501 | die; |
502 | 502 | } |
@@ -514,12 +514,12 @@ discard block |
||
514 | 514 | { |
515 | 515 | date_default_timezone_set('UTC'); |
516 | 516 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
517 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
517 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
518 | 518 | try { |
519 | 519 | |
520 | 520 | $sth = $this->db->prepare($query); |
521 | 521 | $sth->execute(array(':ident' => $ident)); |
522 | - } catch(PDOException $e) { |
|
522 | + } catch (PDOException $e) { |
|
523 | 523 | echo $e->getMessage(); |
524 | 524 | die; |
525 | 525 | } |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | |
550 | 550 | $sth = $this->db->prepare($query); |
551 | 551 | $sth->execute(); |
552 | - } catch(PDOException $e) { |
|
552 | + } catch (PDOException $e) { |
|
553 | 553 | return "error"; |
554 | 554 | } |
555 | 555 | |
@@ -572,14 +572,14 @@ discard block |
||
572 | 572 | |
573 | 573 | $sth = $this->db->prepare($query); |
574 | 574 | $sth->execute(); |
575 | - } catch(PDOException $e) { |
|
575 | + } catch (PDOException $e) { |
|
576 | 576 | return "error"; |
577 | 577 | } |
578 | 578 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
579 | 579 | $i = 0; |
580 | - $j =0; |
|
580 | + $j = 0; |
|
581 | 581 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
582 | - foreach($all as $row) |
|
582 | + foreach ($all as $row) |
|
583 | 583 | { |
584 | 584 | $i++; |
585 | 585 | $j++; |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | if ($globalDebug) echo "."; |
588 | 588 | try { |
589 | 589 | |
590 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
590 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
591 | 591 | $sth->execute(); |
592 | - } catch(PDOException $e) { |
|
592 | + } catch (PDOException $e) { |
|
593 | 593 | return "error"; |
594 | 594 | } |
595 | 595 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -600,9 +600,9 @@ discard block |
||
600 | 600 | if ($i > 0) { |
601 | 601 | try { |
602 | 602 | |
603 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
603 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
604 | 604 | $sth->execute(); |
605 | - } catch(PDOException $e) { |
|
605 | + } catch (PDOException $e) { |
|
606 | 606 | return "error"; |
607 | 607 | } |
608 | 608 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | |
616 | 616 | $sth = $this->db->prepare($query); |
617 | 617 | $sth->execute(); |
618 | - } catch(PDOException $e) { |
|
618 | + } catch (PDOException $e) { |
|
619 | 619 | return "error"; |
620 | 620 | } |
621 | 621 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -663,13 +663,13 @@ discard block |
||
663 | 663 | public function deleteLiveMarineDataByIdent($ident) |
664 | 664 | { |
665 | 665 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
666 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
666 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
667 | 667 | |
668 | 668 | try { |
669 | 669 | |
670 | 670 | $sth = $this->db->prepare($query); |
671 | 671 | $sth->execute(array(':ident' => $ident)); |
672 | - } catch(PDOException $e) { |
|
672 | + } catch (PDOException $e) { |
|
673 | 673 | return "error"; |
674 | 674 | } |
675 | 675 | |
@@ -685,13 +685,13 @@ discard block |
||
685 | 685 | public function deleteLiveMarineDataById($id) |
686 | 686 | { |
687 | 687 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
688 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
688 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
689 | 689 | |
690 | 690 | try { |
691 | 691 | |
692 | 692 | $sth = $this->db->prepare($query); |
693 | 693 | $sth->execute(array(':id' => $id)); |
694 | - } catch(PDOException $e) { |
|
694 | + } catch (PDOException $e) { |
|
695 | 695 | return "error"; |
696 | 696 | } |
697 | 697 | |
@@ -709,13 +709,13 @@ discard block |
||
709 | 709 | { |
710 | 710 | global $globalDBdriver, $globalTimezone; |
711 | 711 | if ($globalDBdriver == 'mysql') { |
712 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
712 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
713 | 713 | WHERE marine_live.ident = :ident |
714 | 714 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
715 | 715 | AND marine_live.date < UTC_TIMESTAMP()'; |
716 | 716 | $query_data = array(':ident' => $ident); |
717 | 717 | } else { |
718 | - $query = "SELECT marine_live.ident FROM marine_live |
|
718 | + $query = "SELECT marine_live.ident FROM marine_live |
|
719 | 719 | WHERE marine_live.ident = :ident |
720 | 720 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
721 | 721 | AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -724,8 +724,8 @@ discard block |
||
724 | 724 | |
725 | 725 | $sth = $this->db->prepare($query); |
726 | 726 | $sth->execute($query_data); |
727 | - $ident_result=''; |
|
728 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
727 | + $ident_result = ''; |
|
728 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
729 | 729 | { |
730 | 730 | $ident_result = $row['ident']; |
731 | 731 | } |
@@ -742,13 +742,13 @@ discard block |
||
742 | 742 | { |
743 | 743 | global $globalDBdriver, $globalTimezone; |
744 | 744 | if ($globalDBdriver == 'mysql') { |
745 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
745 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
746 | 746 | WHERE marine_live.ident = :ident |
747 | 747 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
748 | 748 | // AND marine_live.date < UTC_TIMESTAMP()"; |
749 | 749 | $query_data = array(':ident' => $ident); |
750 | 750 | } else { |
751 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
751 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
752 | 752 | WHERE marine_live.ident = :ident |
753 | 753 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
754 | 754 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -757,8 +757,8 @@ discard block |
||
757 | 757 | |
758 | 758 | $sth = $this->db->prepare($query); |
759 | 759 | $sth->execute($query_data); |
760 | - $ident_result=''; |
|
761 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
760 | + $ident_result = ''; |
|
761 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
762 | 762 | { |
763 | 763 | $ident_result = $row['fammarine_id']; |
764 | 764 | } |
@@ -775,13 +775,13 @@ discard block |
||
775 | 775 | { |
776 | 776 | global $globalDBdriver, $globalTimezone; |
777 | 777 | if ($globalDBdriver == 'mysql') { |
778 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
778 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
779 | 779 | WHERE marine_live.fammarine_id = :id |
780 | 780 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
781 | 781 | // AND marine_live.date < UTC_TIMESTAMP()"; |
782 | 782 | $query_data = array(':id' => $id); |
783 | 783 | } else { |
784 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
784 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
785 | 785 | WHERE marine_live.fammarine_id = :id |
786 | 786 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
787 | 787 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -790,8 +790,8 @@ discard block |
||
790 | 790 | |
791 | 791 | $sth = $this->db->prepare($query); |
792 | 792 | $sth->execute($query_data); |
793 | - $ident_result=''; |
|
794 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
793 | + $ident_result = ''; |
|
794 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
795 | 795 | { |
796 | 796 | $ident_result = $row['fammarine_id']; |
797 | 797 | } |
@@ -808,13 +808,13 @@ discard block |
||
808 | 808 | { |
809 | 809 | global $globalDBdriver, $globalTimezone; |
810 | 810 | if ($globalDBdriver == 'mysql') { |
811 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
811 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
812 | 812 | WHERE marine_live.mmsi = :mmsi |
813 | 813 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
814 | 814 | // AND marine_live.date < UTC_TIMESTAMP()"; |
815 | 815 | $query_data = array(':mmsi' => $mmsi); |
816 | 816 | } else { |
817 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
817 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
818 | 818 | WHERE marine_live.mmsi = :mmsi |
819 | 819 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
820 | 820 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -823,8 +823,8 @@ discard block |
||
823 | 823 | |
824 | 824 | $sth = $this->db->prepare($query); |
825 | 825 | $sth->execute($query_data); |
826 | - $ident_result=''; |
|
827 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
826 | + $ident_result = ''; |
|
827 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
828 | 828 | { |
829 | 829 | $ident_result = $row['fammarine_id']; |
830 | 830 | } |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | * @return String success or false |
843 | 843 | * |
844 | 844 | */ |
845 | - public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
845 | + public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
846 | 846 | { |
847 | 847 | global $globalURL, $globalArchive, $globalDebug; |
848 | 848 | $Common = new Common(); |
@@ -894,26 +894,26 @@ discard block |
||
894 | 894 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
895 | 895 | |
896 | 896 | |
897 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
898 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
899 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
900 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
901 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
902 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
903 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
904 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
905 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
906 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
907 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
908 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
909 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
910 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
911 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
912 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
897 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
898 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
899 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
900 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
901 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
902 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
903 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
904 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
905 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
906 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
907 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
908 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
909 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
910 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
911 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
912 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
913 | 913 | |
914 | 914 | |
915 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
916 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
915 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
916 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
917 | 917 | if ($arrival_date == '') $arrival_date = NULL; |
918 | 918 | $query = ''; |
919 | 919 | if ($globalArchive) { |
@@ -923,18 +923,18 @@ discard block |
||
923 | 923 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) |
924 | 924 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)'; |
925 | 925 | |
926 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
926 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
927 | 927 | try { |
928 | 928 | $sth = $this->db->prepare($query); |
929 | 929 | $sth->execute($query_values); |
930 | - } catch(PDOException $e) { |
|
930 | + } catch (PDOException $e) { |
|
931 | 931 | return "error : ".$e->getMessage(); |
932 | 932 | } |
933 | 933 | |
934 | 934 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
935 | 935 | if ($globalDebug) echo '(Add to Marine archive : '; |
936 | 936 | $MarineArchive = new MarineArchive($this->db); |
937 | - $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country); |
|
937 | + $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $noarchive, $format_source, $source_name, $over_country); |
|
938 | 938 | if ($globalDebug) echo $result.')'; |
939 | 939 | } |
940 | 940 | return "success"; |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | |
943 | 943 | public function getOrderBy() |
944 | 944 | { |
945 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
945 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
946 | 946 | return $orderby; |
947 | 947 | } |
948 | 948 |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | default: |
42 | 42 | throw new \Exception("bad resolution can be only one of 1,3"); |
43 | 43 | } |
44 | - register_shutdown_function(function () { |
|
44 | + register_shutdown_function(function() { |
|
45 | 45 | $this->closeAllFiles(); |
46 | 46 | }); |
47 | 47 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | |
56 | 56 | private function getElevationAtPosition($fileName, $row, $column) { |
57 | 57 | if (!array_key_exists($fileName, $this->openedFiles)) { |
58 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
|
58 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) { |
|
59 | 59 | throw new \Exception("File '{$fileName}' not exists."); |
60 | 60 | } |
61 | - $file = fopen($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName, "r"); |
|
61 | + $file = fopen($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName, "r"); |
|
62 | 62 | if ($file === false) { |
63 | 63 | throw new \Exception("Cant open file '{$fileName}' for reading."); |
64 | 64 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | throw new \Exception("Not implemented yet"); |
73 | 73 | } |
74 | 74 | $aRow = $this->measPerDeg - $row; |
75 | - $position = ($this->measPerDeg * ($aRow - 1)) + $column; |
|
75 | + $position = ($this->measPerDeg*($aRow - 1)) + $column; |
|
76 | 76 | $position *= 2; |
77 | 77 | fseek($file, $position); |
78 | 78 | $short = fread($file, 2); |
@@ -100,8 +100,8 @@ discard block |
||
100 | 100 | $latSec = $this->getSec($lat); |
101 | 101 | $lonSec = $this->getSec($lon); |
102 | 102 | |
103 | - $Xn = round($latSec / $this->resolution, 3); |
|
104 | - $Yn = round($lonSec / $this->resolution, 3); |
|
103 | + $Xn = round($latSec/$this->resolution, 3); |
|
104 | + $Yn = round($lonSec/$this->resolution, 3); |
|
105 | 105 | |
106 | 106 | $a1 = round($Xn); |
107 | 107 | $a2 = round($Yn); |
@@ -133,55 +133,55 @@ discard block |
||
133 | 133 | $b3 = $this->getElevationAtPosition($fName, $b1, $b2); |
134 | 134 | $c3 = $this->getElevationAtPosition($fName, $c1, $c2); |
135 | 135 | |
136 | - $n1 = ($c2 - $a2) * ($b3 - $a3) - ($c3 - $a3) * ($b2 - $a2); |
|
137 | - $n2 = ($c3 - $a3) * ($b1 - $a1) - ($c1 - $a1) * ($b3 - $a3); |
|
138 | - $n3 = ($c1 - $a1) * ($b2 - $a2) - ($c2 - $a2) * ($b1 - $a1); |
|
136 | + $n1 = ($c2 - $a2)*($b3 - $a3) - ($c3 - $a3)*($b2 - $a2); |
|
137 | + $n2 = ($c3 - $a3)*($b1 - $a1) - ($c1 - $a1)*($b3 - $a3); |
|
138 | + $n3 = ($c1 - $a1)*($b2 - $a2) - ($c2 - $a2)*($b1 - $a1); |
|
139 | 139 | |
140 | - $d = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3; |
|
141 | - $zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3; |
|
140 | + $d = -$n1*$a1 - $n2*$a2 - $n3*$a3; |
|
141 | + $zN = (-$n1*$Xn - $n2*$Yn - $d)/$n3; |
|
142 | 142 | |
143 | 143 | return $zN; |
144 | 144 | } |
145 | 145 | |
146 | 146 | private function getDeg($deg, $numPrefix) { |
147 | 147 | $deg = abs($deg); |
148 | - $d = floor($deg); // round degrees |
|
148 | + $d = floor($deg); // round degrees |
|
149 | 149 | if ($numPrefix >= 3) { |
150 | 150 | if ($d < 100) { |
151 | - $d = '0' . $d; |
|
151 | + $d = '0'.$d; |
|
152 | 152 | } |
153 | 153 | } // pad with leading zeros |
154 | 154 | if ($d < 10) { |
155 | - $d = '0' . $d; |
|
155 | + $d = '0'.$d; |
|
156 | 156 | } |
157 | 157 | return $d; |
158 | 158 | } |
159 | 159 | |
160 | 160 | private function getSec($deg) { |
161 | 161 | $deg = abs($deg); |
162 | - $sec = round($deg * 3600, 4); |
|
163 | - $m = fmod(floor($sec / 60), 60); |
|
162 | + $sec = round($deg*3600, 4); |
|
163 | + $m = fmod(floor($sec/60), 60); |
|
164 | 164 | $s = round(fmod($sec, 60), 4); |
165 | - return ($m * 60) + $s; |
|
165 | + return ($m*60) + $s; |
|
166 | 166 | } |
167 | 167 | |
168 | - public function download($lat,$lon, $debug = false) { |
|
168 | + public function download($lat, $lon, $debug = false) { |
|
169 | 169 | $N = $this->getDeg($lat, 2); |
170 | 170 | $E = $this->getDeg($lon, 3); |
171 | - $fileName = "N{$N}E{$E}.hgt"; |
|
172 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
|
171 | + $fileName = "N{$N}E{$E}.hgt"; |
|
172 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) { |
|
173 | 173 | $Common = new Common(); |
174 | 174 | if ($debug) echo 'Downloading '.$fileName.'.gz ...'; |
175 | - $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
|
176 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) { |
|
175 | + $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz'); |
|
176 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz')) { |
|
177 | 177 | if ($debug) echo "File '{$fileName}.gz' not exists."; |
178 | 178 | return false; |
179 | 179 | } |
180 | 180 | if ($debug) echo 'Done'."\n"; |
181 | 181 | if ($debug) echo 'Decompress '.$fileName.' ....'; |
182 | - $Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName); |
|
182 | + $Common->gunzip($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName); |
|
183 | 183 | if ($debug) echo 'Done'."\n"; |
184 | - unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
|
184 | + unlink($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz'); |
|
185 | 185 | } |
186 | 186 | return true; |
187 | 187 | } |
@@ -194,22 +194,22 @@ discard block |
||
194 | 194 | try { |
195 | 195 | $sth = $db->prepare($query); |
196 | 196 | $sth->execute($query_values); |
197 | - } catch(PDOException $e) { |
|
197 | + } catch (PDOException $e) { |
|
198 | 198 | return "error : ".$e->getMessage(); |
199 | 199 | } |
200 | 200 | while ($data = $sth->fetch(PDO::FETCH_ASSOC)) { |
201 | - $this->download($data['latitude'],$data['longitude'],true); |
|
201 | + $this->download($data['latitude'], $data['longitude'], true); |
|
202 | 202 | } |
203 | 203 | $query = 'SELECT latitude, longitude FROM tracker_output WHERE latitude <> 0 AND longitude <> 0 ORDER BY date DESC LIMIT 50'; |
204 | 204 | $query_values = array(); |
205 | 205 | try { |
206 | 206 | $sth = $db->prepare($query); |
207 | 207 | $sth->execute($query_values); |
208 | - } catch(PDOException $e) { |
|
208 | + } catch (PDOException $e) { |
|
209 | 209 | return "error : ".$e->getMessage(); |
210 | 210 | } |
211 | 211 | while ($data = $sth->fetch(PDO::FETCH_ASSOC)) { |
212 | - $this->download($data['latitude'],$data['longitude'],true); |
|
212 | + $this->download($data['latitude'], $data['longitude'], true); |
|
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | $ch = curl_init(); |
17 | 17 | curl_setopt($ch, CURLOPT_URL, $url); |
18 | 18 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
19 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
19 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
20 | 20 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
21 | 21 | } |
22 | 22 | } |
@@ -34,20 +34,20 @@ discard block |
||
34 | 34 | fclose($fp); |
35 | 35 | } |
36 | 36 | |
37 | - public static function gunzip($in_file,$out_file_name = '') { |
|
37 | + public static function gunzip($in_file, $out_file_name = '') { |
|
38 | 38 | //echo $in_file.' -> '.$out_file_name."\n"; |
39 | 39 | $buffer_size = 4096; // read 4kb at a time |
40 | 40 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
41 | 41 | if ($in_file != '' && file_exists($in_file)) { |
42 | 42 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
43 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
44 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
43 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
44 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
45 | 45 | else { |
46 | 46 | echo 'gzopen not available'; |
47 | 47 | die; |
48 | 48 | } |
49 | 49 | $out_file = fopen($out_file_name, 'wb'); |
50 | - while(!gzeof($file)) { |
|
50 | + while (!gzeof($file)) { |
|
51 | 51 | fwrite($out_file, gzread($file, $buffer_size)); |
52 | 52 | } |
53 | 53 | fclose($out_file); |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | try { |
72 | 72 | self::$db_sqlite = new PDO('sqlite:'.$database); |
73 | 73 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
74 | - } catch(PDOException $e) { |
|
74 | + } catch (PDOException $e) { |
|
75 | 75 | return "error : ".$e->getMessage(); |
76 | 76 | } |
77 | 77 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | //$Connection = new Connection(); |
87 | 87 | $sth = $Connection->db->prepare($query); |
88 | 88 | $sth->execute(array(':source' => $database_file)); |
89 | - } catch(PDOException $e) { |
|
89 | + } catch (PDOException $e) { |
|
90 | 90 | return "error : ".$e->getMessage(); |
91 | 91 | } |
92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | try { |
98 | 98 | $sth = update_db::$db_sqlite->prepare($query); |
99 | 99 | $sth->execute(); |
100 | - } catch(PDOException $e) { |
|
100 | + } catch (PDOException $e) { |
|
101 | 101 | return "error : ".$e->getMessage(); |
102 | 102 | } |
103 | 103 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -108,11 +108,11 @@ discard block |
||
108 | 108 | if ($globalTransaction) $Connection->db->beginTransaction(); |
109 | 109 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
110 | 110 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
111 | - $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
111 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
112 | 112 | $sth_dest->execute($query_dest_values); |
113 | 113 | } |
114 | 114 | if ($globalTransaction) $Connection->db->commit(); |
115 | - } catch(PDOException $e) { |
|
115 | + } catch (PDOException $e) { |
|
116 | 116 | if ($globalTransaction) $Connection->db->rollBack(); |
117 | 117 | return "error : ".$e->getMessage(); |
118 | 118 | } |
@@ -128,26 +128,26 @@ discard block |
||
128 | 128 | //$Connection = new Connection(); |
129 | 129 | $sth = $Connection->db->prepare($query); |
130 | 130 | $sth->execute(array(':source' => 'oneworld')); |
131 | - } catch(PDOException $e) { |
|
131 | + } catch (PDOException $e) { |
|
132 | 132 | return "error : ".$e->getMessage(); |
133 | 133 | } |
134 | 134 | |
135 | 135 | if ($globalDebug) echo " - Add routes to DB -"; |
136 | 136 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
137 | 137 | $Spotter = new Spotter(); |
138 | - if ($fh = fopen($database_file,"r")) { |
|
138 | + if ($fh = fopen($database_file, "r")) { |
|
139 | 139 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
140 | 140 | $Connection = new Connection(); |
141 | 141 | $sth_dest = $Connection->db->prepare($query_dest); |
142 | 142 | if ($globalTransaction) $Connection->db->beginTransaction(); |
143 | 143 | while (!feof($fh)) { |
144 | - $line = fgetcsv($fh,9999,','); |
|
144 | + $line = fgetcsv($fh, 9999, ','); |
|
145 | 145 | if ($line[0] != '') { |
146 | 146 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
147 | 147 | try { |
148 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
148 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
149 | 149 | $sth_dest->execute($query_dest_values); |
150 | - } catch(PDOException $e) { |
|
150 | + } catch (PDOException $e) { |
|
151 | 151 | if ($globalTransaction) $Connection->db->rollBack(); |
152 | 152 | return "error : ".$e->getMessage(); |
153 | 153 | } |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | //$Connection = new Connection(); |
170 | 170 | $sth = $Connection->db->prepare($query); |
171 | 171 | $sth->execute(array(':source' => 'skyteam')); |
172 | - } catch(PDOException $e) { |
|
172 | + } catch (PDOException $e) { |
|
173 | 173 | return "error : ".$e->getMessage(); |
174 | 174 | } |
175 | 175 | |
@@ -177,24 +177,24 @@ discard block |
||
177 | 177 | |
178 | 178 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
179 | 179 | $Spotter = new Spotter(); |
180 | - if ($fh = fopen($database_file,"r")) { |
|
180 | + if ($fh = fopen($database_file, "r")) { |
|
181 | 181 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
182 | 182 | $Connection = new Connection(); |
183 | 183 | $sth_dest = $Connection->db->prepare($query_dest); |
184 | 184 | try { |
185 | 185 | if ($globalTransaction) $Connection->db->beginTransaction(); |
186 | 186 | while (!feof($fh)) { |
187 | - $line = fgetcsv($fh,9999,','); |
|
187 | + $line = fgetcsv($fh, 9999, ','); |
|
188 | 188 | if ($line[0] != '') { |
189 | - $datebe = explode(' - ',$line[2]); |
|
189 | + $datebe = explode(' - ', $line[2]); |
|
190 | 190 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
191 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
191 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
192 | 192 | $sth_dest->execute($query_dest_values); |
193 | 193 | } |
194 | 194 | } |
195 | 195 | } |
196 | 196 | if ($globalTransaction) $Connection->db->commit(); |
197 | - } catch(PDOException $e) { |
|
197 | + } catch (PDOException $e) { |
|
198 | 198 | if ($globalTransaction) $Connection->db->rollBack(); |
199 | 199 | return "error : ".$e->getMessage(); |
200 | 200 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $Connection = new Connection(); |
210 | 210 | $sth = $Connection->db->prepare($query); |
211 | 211 | $sth->execute(array(':source' => $database_file)); |
212 | - } catch(PDOException $e) { |
|
212 | + } catch (PDOException $e) { |
|
213 | 213 | return "error : ".$e->getMessage(); |
214 | 214 | } |
215 | 215 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | $Connection = new Connection(); |
218 | 218 | $sth = $Connection->db->prepare($query); |
219 | 219 | $sth->execute(array(':source' => $database_file)); |
220 | - } catch(PDOException $e) { |
|
220 | + } catch (PDOException $e) { |
|
221 | 221 | return "error : ".$e->getMessage(); |
222 | 222 | } |
223 | 223 | |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | try { |
227 | 227 | $sth = update_db::$db_sqlite->prepare($query); |
228 | 228 | $sth->execute(); |
229 | - } catch(PDOException $e) { |
|
229 | + } catch (PDOException $e) { |
|
230 | 230 | return "error : ".$e->getMessage(); |
231 | 231 | } |
232 | 232 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -243,15 +243,15 @@ discard block |
||
243 | 243 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
244 | 244 | if ($values['UserString4'] == 'M') $type = 'military'; |
245 | 245 | else $type = null; |
246 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
246 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
247 | 247 | $sth_dest->execute($query_dest_values); |
248 | 248 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
249 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
249 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
250 | 250 | $sth_dest_owner->execute($query_dest_owner_values); |
251 | 251 | } |
252 | 252 | } |
253 | 253 | if ($globalTransaction) $Connection->db->commit(); |
254 | - } catch(PDOException $e) { |
|
254 | + } catch (PDOException $e) { |
|
255 | 255 | return "error : ".$e->getMessage(); |
256 | 256 | } |
257 | 257 | |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | $Connection = new Connection(); |
262 | 262 | $sth = $Connection->db->prepare($query); |
263 | 263 | $sth->execute(array(':source' => $database_file)); |
264 | - } catch(PDOException $e) { |
|
264 | + } catch (PDOException $e) { |
|
265 | 265 | return "error : ".$e->getMessage(); |
266 | 266 | } |
267 | 267 | return ''; |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | $Connection = new Connection(); |
277 | 277 | $sth = $Connection->db->prepare($query); |
278 | 278 | $sth->execute(array(':source' => $database_file)); |
279 | - } catch(PDOException $e) { |
|
279 | + } catch (PDOException $e) { |
|
280 | 280 | return "error : ".$e->getMessage(); |
281 | 281 | } |
282 | 282 | |
283 | - if ($fh = fopen($database_file,"r")) { |
|
283 | + if ($fh = fopen($database_file, "r")) { |
|
284 | 284 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
285 | 285 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
286 | 286 | |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | if ($globalTransaction) $Connection->db->beginTransaction(); |
291 | 291 | while (!feof($fh)) { |
292 | 292 | $values = array(); |
293 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
293 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
294 | 294 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
295 | - $values['ModeS'] = substr($line,0,6); |
|
296 | - $values['Registration'] = trim(substr($line,69,6)); |
|
297 | - $aircraft_name = trim(substr($line,48,6)); |
|
295 | + $values['ModeS'] = substr($line, 0, 6); |
|
296 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
297 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
298 | 298 | // Check if we can find ICAO, else set it to GLID |
299 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
299 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
300 | 300 | $search_more = ''; |
301 | 301 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
302 | 302 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -308,20 +308,20 @@ discard block |
||
308 | 308 | if (isset($result['icao']) && $result['icao'] != '') { |
309 | 309 | $values['ICAOTypeCode'] = $result['icao']; |
310 | 310 | } |
311 | - } catch(PDOException $e) { |
|
311 | + } catch (PDOException $e) { |
|
312 | 312 | return "error : ".$e->getMessage(); |
313 | 313 | } |
314 | 314 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
315 | 315 | // Add data to db |
316 | 316 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
317 | 317 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
318 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
318 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
319 | 319 | //print_r($query_dest_values); |
320 | 320 | $sth_dest->execute($query_dest_values); |
321 | 321 | } |
322 | 322 | } |
323 | 323 | if ($globalTransaction) $Connection->db->commit(); |
324 | - } catch(PDOException $e) { |
|
324 | + } catch (PDOException $e) { |
|
325 | 325 | return "error : ".$e->getMessage(); |
326 | 326 | } |
327 | 327 | } |
@@ -331,7 +331,7 @@ discard block |
||
331 | 331 | $Connection = new Connection(); |
332 | 332 | $sth = $Connection->db->prepare($query); |
333 | 333 | $sth->execute(array(':source' => $database_file)); |
334 | - } catch(PDOException $e) { |
|
334 | + } catch (PDOException $e) { |
|
335 | 335 | return "error : ".$e->getMessage(); |
336 | 336 | } |
337 | 337 | return ''; |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | $Connection = new Connection(); |
346 | 346 | $sth = $Connection->db->prepare($query); |
347 | 347 | $sth->execute(array(':source' => $database_file)); |
348 | - } catch(PDOException $e) { |
|
348 | + } catch (PDOException $e) { |
|
349 | 349 | return "error : ".$e->getMessage(); |
350 | 350 | } |
351 | 351 | |
352 | - if ($fh = fopen($database_file,"r")) { |
|
352 | + if ($fh = fopen($database_file, "r")) { |
|
353 | 353 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
354 | 354 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
355 | 355 | |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | $sth_dest = $Connection->db->prepare($query_dest); |
358 | 358 | try { |
359 | 359 | if ($globalTransaction) $Connection->db->beginTransaction(); |
360 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
360 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
361 | 361 | while (!feof($fh)) { |
362 | - $line = fgetcsv($fh,9999,',',"'"); |
|
362 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
363 | 363 | |
364 | 364 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
365 | 365 | //print_r($line); |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | $values['ICAOTypeCode'] = ''; |
369 | 369 | $aircraft_name = $line[2]; |
370 | 370 | // Check if we can find ICAO, else set it to GLID |
371 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
371 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
372 | 372 | $search_more = ''; |
373 | 373 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
374 | 374 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -377,20 +377,20 @@ discard block |
||
377 | 377 | $sth_search->execute(); |
378 | 378 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
379 | 379 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
380 | - } catch(PDOException $e) { |
|
380 | + } catch (PDOException $e) { |
|
381 | 381 | return "error : ".$e->getMessage(); |
382 | 382 | } |
383 | 383 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
384 | 384 | // Add data to db |
385 | 385 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
386 | 386 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
387 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
387 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
388 | 388 | //print_r($query_dest_values); |
389 | 389 | $sth_dest->execute($query_dest_values); |
390 | 390 | } |
391 | 391 | } |
392 | 392 | if ($globalTransaction) $Connection->db->commit(); |
393 | - } catch(PDOException $e) { |
|
393 | + } catch (PDOException $e) { |
|
394 | 394 | return "error : ".$e->getMessage(); |
395 | 395 | } |
396 | 396 | } |
@@ -400,13 +400,13 @@ discard block |
||
400 | 400 | $Connection = new Connection(); |
401 | 401 | $sth = $Connection->db->prepare($query); |
402 | 402 | $sth->execute(array(':source' => $database_file)); |
403 | - } catch(PDOException $e) { |
|
403 | + } catch (PDOException $e) { |
|
404 | 404 | return "error : ".$e->getMessage(); |
405 | 405 | } |
406 | 406 | return ''; |
407 | 407 | } |
408 | 408 | |
409 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
409 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
410 | 410 | global $globalTransaction, $globalMasterSource; |
411 | 411 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
412 | 412 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -414,12 +414,12 @@ discard block |
||
414 | 414 | $Connection = new Connection(); |
415 | 415 | $sth = $Connection->db->prepare($query); |
416 | 416 | $sth->execute(array(':source' => $database_file)); |
417 | - } catch(PDOException $e) { |
|
417 | + } catch (PDOException $e) { |
|
418 | 418 | return "error : ".$e->getMessage(); |
419 | 419 | } |
420 | 420 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
421 | 421 | $Spotter = new Spotter(); |
422 | - if ($fh = fopen($database_file,"r")) { |
|
422 | + if ($fh = fopen($database_file, "r")) { |
|
423 | 423 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
424 | 424 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
425 | 425 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -429,9 +429,9 @@ discard block |
||
429 | 429 | $sth_modes = $Connection->db->prepare($query_modes); |
430 | 430 | try { |
431 | 431 | if ($globalTransaction) $Connection->db->beginTransaction(); |
432 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
432 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
433 | 433 | while (!feof($fh)) { |
434 | - $line = fgetcsv($fh,9999,',','"'); |
|
434 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
435 | 435 | $values = array(); |
436 | 436 | //print_r($line); |
437 | 437 | if ($country == 'F') { |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | $values['base'] = $line[4]; |
440 | 440 | $values['owner'] = $line[5]; |
441 | 441 | if ($line[6] == '') $values['date_first_reg'] = null; |
442 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
442 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
443 | 443 | $values['cancel'] = $line[7]; |
444 | 444 | } elseif ($country == 'EI') { |
445 | 445 | // TODO : add modeS & reg to aircraft_modes |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | $values['base'] = $line[3]; |
448 | 448 | $values['owner'] = $line[2]; |
449 | 449 | if ($line[1] == '') $values['date_first_reg'] = null; |
450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
450 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
451 | 451 | $values['cancel'] = ''; |
452 | 452 | $values['modes'] = $line[7]; |
453 | 453 | $values['icao'] = $line[8]; |
@@ -467,7 +467,7 @@ discard block |
||
467 | 467 | $values['base'] = null; |
468 | 468 | $values['owner'] = $line[5]; |
469 | 469 | if ($line[18] == '') $values['date_first_reg'] = null; |
470 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
470 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
471 | 471 | $values['cancel'] = ''; |
472 | 472 | } elseif ($country == 'VH') { |
473 | 473 | // TODO : add modeS & reg to aircraft_modes |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | $values['base'] = null; |
476 | 476 | $values['owner'] = $line[12]; |
477 | 477 | if ($line[28] == '') $values['date_first_reg'] = null; |
478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
478 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
479 | 479 | |
480 | 480 | $values['cancel'] = $line[39]; |
481 | 481 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -495,28 +495,28 @@ discard block |
||
495 | 495 | $values['base'] = null; |
496 | 496 | $values['owner'] = $line[8]; |
497 | 497 | if ($line[7] == '') $values['date_first_reg'] = null; |
498 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
498 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
499 | 499 | $values['cancel'] = ''; |
500 | 500 | } elseif ($country == 'PP') { |
501 | 501 | $values['registration'] = $line[0]; |
502 | 502 | $values['base'] = null; |
503 | 503 | $values['owner'] = $line[4]; |
504 | 504 | if ($line[6] == '') $values['date_first_reg'] = null; |
505 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
505 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
506 | 506 | $values['cancel'] = $line[7]; |
507 | 507 | } elseif ($country == 'E7') { |
508 | 508 | $values['registration'] = $line[0]; |
509 | 509 | $values['base'] = null; |
510 | 510 | $values['owner'] = $line[4]; |
511 | 511 | if ($line[5] == '') $values['date_first_reg'] = null; |
512 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
512 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
513 | 513 | $values['cancel'] = ''; |
514 | 514 | } elseif ($country == '8Q') { |
515 | 515 | $values['registration'] = $line[0]; |
516 | 516 | $values['base'] = null; |
517 | 517 | $values['owner'] = $line[3]; |
518 | 518 | if ($line[7] == '') $values['date_first_reg'] = null; |
519 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
519 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
520 | 520 | $values['cancel'] = ''; |
521 | 521 | } elseif ($country == 'ZK') { |
522 | 522 | $values['registration'] = $line[0]; |
@@ -530,18 +530,18 @@ discard block |
||
530 | 530 | $values['registration'] = $line[0]; |
531 | 531 | $values['base'] = null; |
532 | 532 | $values['owner'] = $line[6]; |
533 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
534 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
533 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
534 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
535 | 535 | $values['modes'] = $line[4]; |
536 | 536 | $values['icao'] = $line[10]; |
537 | 537 | } elseif ($country == 'OY') { |
538 | 538 | $values['registration'] = $line[0]; |
539 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
539 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
540 | 540 | $values['modes'] = $line[5]; |
541 | 541 | $values['icao'] = $line[6]; |
542 | 542 | } elseif ($country == 'PH') { |
543 | 543 | $values['registration'] = $line[0]; |
544 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
544 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
545 | 545 | $values['modes'] = $line[4]; |
546 | 546 | $values['icao'] = $line[5]; |
547 | 547 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -552,17 +552,17 @@ discard block |
||
552 | 552 | $values['cancel'] = ''; |
553 | 553 | } |
554 | 554 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
555 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
555 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
556 | 556 | $sth_dest->execute($query_dest_values); |
557 | 557 | } |
558 | 558 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
559 | 559 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
560 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
560 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
561 | 561 | $sth_modes->execute($query_modes_values); |
562 | 562 | } |
563 | 563 | } |
564 | 564 | if ($globalTransaction) $Connection->db->commit(); |
565 | - } catch(PDOException $e) { |
|
565 | + } catch (PDOException $e) { |
|
566 | 566 | return "error : ".$e->getMessage(); |
567 | 567 | } |
568 | 568 | } |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | if ($globalTransaction) $Connection->db->beginTransaction(); |
701 | 701 | |
702 | 702 | $i = 0; |
703 | - while($row = sparql_fetch_array($result)) |
|
703 | + while ($row = sparql_fetch_array($result)) |
|
704 | 704 | { |
705 | 705 | if ($i >= 1) { |
706 | 706 | //print_r($row); |
@@ -720,33 +720,33 @@ discard block |
||
720 | 720 | $row['image'] = ''; |
721 | 721 | $row['image_thumb'] = ''; |
722 | 722 | } else { |
723 | - $image = str_replace(' ','_',$row['image']); |
|
723 | + $image = str_replace(' ', '_', $row['image']); |
|
724 | 724 | $digest = md5($image); |
725 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
726 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
727 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
728 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
725 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
726 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
727 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
728 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
729 | 729 | } |
730 | 730 | |
731 | - $country = explode('-',$row['country']); |
|
731 | + $country = explode('-', $row['country']); |
|
732 | 732 | $row['country'] = $country[0]; |
733 | 733 | |
734 | 734 | $row['type'] = trim($row['type']); |
735 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
735 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
736 | 736 | $row['type'] = 'military'; |
737 | 737 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
738 | 738 | $row['type'] = 'small_airport'; |
739 | 739 | } |
740 | 740 | |
741 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
742 | - $query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($row['altitude']),':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
741 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
742 | + $query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($row['altitude']), ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
743 | 743 | //print_r($query_dest_values); |
744 | 744 | |
745 | 745 | if ($row['icao'] != '') { |
746 | 746 | try { |
747 | 747 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
748 | 748 | $sth->execute(array(':icao' => $row['icao'])); |
749 | - } catch(PDOException $e) { |
|
749 | + } catch (PDOException $e) { |
|
750 | 750 | return "error : ".$e->getMessage(); |
751 | 751 | } |
752 | 752 | if ($sth->fetchColumn() > 0) { |
@@ -754,15 +754,15 @@ discard block |
||
754 | 754 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
755 | 755 | try { |
756 | 756 | $sth = $Connection->db->prepare($query); |
757 | - $sth->execute(array(':icao' => $row['icao'],':type' => $row['type'])); |
|
758 | - } catch(PDOException $e) { |
|
757 | + $sth->execute(array(':icao' => $row['icao'], ':type' => $row['type'])); |
|
758 | + } catch (PDOException $e) { |
|
759 | 759 | return "error : ".$e->getMessage(); |
760 | 760 | } |
761 | 761 | echo $row['icao'].' : '.$row['type']."\n"; |
762 | 762 | } else { |
763 | 763 | try { |
764 | 764 | $sth_dest->execute($query_dest_values); |
765 | - } catch(PDOException $e) { |
|
765 | + } catch (PDOException $e) { |
|
766 | 766 | return "error : ".$e->getMessage(); |
767 | 767 | } |
768 | 768 | } |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | echo "Download data from ourairports.com...\n"; |
814 | 814 | $delimiter = ','; |
815 | 815 | $out_file = $tmp_dir.'airports.csv'; |
816 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
816 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
817 | 817 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
818 | 818 | echo "Add data from ourairports.com...\n"; |
819 | 819 | |
@@ -824,33 +824,33 @@ discard block |
||
824 | 824 | //$Connection->db->beginTransaction(); |
825 | 825 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
826 | 826 | { |
827 | - if(!$header) $header = $row; |
|
827 | + if (!$header) $header = $row; |
|
828 | 828 | else { |
829 | 829 | $data = array(); |
830 | 830 | $data = array_combine($header, $row); |
831 | 831 | try { |
832 | 832 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
833 | 833 | $sth->execute(array(':icao' => $data['ident'])); |
834 | - } catch(PDOException $e) { |
|
834 | + } catch (PDOException $e) { |
|
835 | 835 | return "error : ".$e->getMessage(); |
836 | 836 | } |
837 | 837 | if ($sth->fetchColumn() > 0) { |
838 | 838 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
839 | 839 | try { |
840 | 840 | $sth = $Connection->db->prepare($query); |
841 | - $sth->execute(array(':icao' => $data['ident'],':type' => $data['type'])); |
|
842 | - } catch(PDOException $e) { |
|
841 | + $sth->execute(array(':icao' => $data['ident'], ':type' => $data['type'])); |
|
842 | + } catch (PDOException $e) { |
|
843 | 843 | return "error : ".$e->getMessage(); |
844 | 844 | } |
845 | 845 | } else { |
846 | 846 | if ($data['gps_code'] == $data['ident']) { |
847 | 847 | $query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link) |
848 | 848 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
849 | - $query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
849 | + $query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
850 | 850 | try { |
851 | 851 | $sth = $Connection->db->prepare($query); |
852 | 852 | $sth->execute($query_values); |
853 | - } catch(PDOException $e) { |
|
853 | + } catch (PDOException $e) { |
|
854 | 854 | return "error : ".$e->getMessage(); |
855 | 855 | } |
856 | 856 | $i++; |
@@ -865,7 +865,7 @@ discard block |
||
865 | 865 | |
866 | 866 | echo "Download data from another free database...\n"; |
867 | 867 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
868 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
868 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
869 | 869 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
870 | 870 | update_db::unzip($out_file); |
871 | 871 | $header = NULL; |
@@ -877,15 +877,15 @@ discard block |
||
877 | 877 | //$Connection->db->beginTransaction(); |
878 | 878 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
879 | 879 | { |
880 | - if(!$header) $header = $row; |
|
880 | + if (!$header) $header = $row; |
|
881 | 881 | else { |
882 | 882 | $data = $row; |
883 | 883 | |
884 | 884 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
885 | 885 | try { |
886 | 886 | $sth = $Connection->db->prepare($query); |
887 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
888 | - } catch(PDOException $e) { |
|
887 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
888 | + } catch (PDOException $e) { |
|
889 | 889 | return "error : ".$e->getMessage(); |
890 | 890 | } |
891 | 891 | } |
@@ -899,15 +899,15 @@ discard block |
||
899 | 899 | try { |
900 | 900 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'"); |
901 | 901 | $sth->execute(); |
902 | - } catch(PDOException $e) { |
|
902 | + } catch (PDOException $e) { |
|
903 | 903 | return "error : ".$e->getMessage(); |
904 | 904 | } |
905 | 905 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
906 | 906 | $query2 = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
907 | 907 | try { |
908 | 908 | $sth2 = $Connection->db->prepare($query2); |
909 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
910 | - } catch(PDOException $e) { |
|
909 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
910 | + } catch (PDOException $e) { |
|
911 | 911 | return "error : ".$e->getMessage(); |
912 | 912 | } |
913 | 913 | } |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | $Connection = new Connection(); |
929 | 929 | $sth = $Connection->db->prepare($query); |
930 | 930 | $sth->execute(array(':source' => 'translation.csv')); |
931 | - } catch(PDOException $e) { |
|
931 | + } catch (PDOException $e) { |
|
932 | 932 | return "error : ".$e->getMessage(); |
933 | 933 | } |
934 | 934 | |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
946 | 946 | { |
947 | 947 | $i++; |
948 | - if($i > 12) { |
|
948 | + if ($i > 12) { |
|
949 | 949 | $data = $row; |
950 | 950 | $operator = $data[2]; |
951 | 951 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | //echo substr($operator, 0, 2)."\n";; |
954 | 954 | if (count($airline_array) > 0) { |
955 | 955 | //print_r($airline_array); |
956 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
956 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
957 | 957 | } |
958 | 958 | } |
959 | 959 | |
@@ -961,14 +961,14 @@ discard block |
||
961 | 961 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
962 | 962 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
963 | 963 | if (count($airline_array) > 0) { |
964 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
964 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
965 | 965 | } |
966 | 966 | } |
967 | 967 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
968 | 968 | try { |
969 | 969 | $sth = $Connection->db->prepare($query); |
970 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
971 | - } catch(PDOException $e) { |
|
970 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
971 | + } catch (PDOException $e) { |
|
972 | 972 | return "error : ".$e->getMessage(); |
973 | 973 | } |
974 | 974 | } |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | $Connection = new Connection(); |
987 | 987 | $sth = $Connection->db->prepare($query); |
988 | 988 | $sth->execute(array(':source' => 'website_fam')); |
989 | - } catch(PDOException $e) { |
|
989 | + } catch (PDOException $e) { |
|
990 | 990 | return "error : ".$e->getMessage(); |
991 | 991 | } |
992 | 992 | //update_db::unzip($out_file); |
@@ -1004,8 +1004,8 @@ discard block |
||
1004 | 1004 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
1005 | 1005 | try { |
1006 | 1006 | $sth = $Connection->db->prepare($query); |
1007 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
1008 | - } catch(PDOException $e) { |
|
1007 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
1008 | + } catch (PDOException $e) { |
|
1009 | 1009 | return "error : ".$e->getMessage(); |
1010 | 1010 | } |
1011 | 1011 | } |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | $Connection = new Connection(); |
1029 | 1029 | $sth = $Connection->db->prepare($query); |
1030 | 1030 | $sth->execute(array(':source' => 'website_faa')); |
1031 | - } catch(PDOException $e) { |
|
1031 | + } catch (PDOException $e) { |
|
1032 | 1032 | return "error : ".$e->getMessage(); |
1033 | 1033 | } |
1034 | 1034 | |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $Connection = new Connection(); |
1038 | 1038 | $sth = $Connection->db->prepare($query); |
1039 | 1039 | $sth->execute(array(':source' => 'website_faa')); |
1040 | - } catch(PDOException $e) { |
|
1040 | + } catch (PDOException $e) { |
|
1041 | 1041 | return "error : ".$e->getMessage(); |
1042 | 1042 | } |
1043 | 1043 | |
@@ -1054,8 +1054,8 @@ discard block |
||
1054 | 1054 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
1055 | 1055 | try { |
1056 | 1056 | $sths = $Connection->db->prepare($query_search); |
1057 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
1058 | - } catch(PDOException $e) { |
|
1057 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
1058 | + } catch (PDOException $e) { |
|
1059 | 1059 | return "error s : ".$e->getMessage(); |
1060 | 1060 | } |
1061 | 1061 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1068,8 +1068,8 @@ discard block |
||
1068 | 1068 | //} |
1069 | 1069 | try { |
1070 | 1070 | $sthi = $Connection->db->prepare($queryi); |
1071 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1072 | - } catch(PDOException $e) { |
|
1071 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1072 | + } catch (PDOException $e) { |
|
1073 | 1073 | return "error u : ".$e->getMessage(); |
1074 | 1074 | } |
1075 | 1075 | } else { |
@@ -1077,7 +1077,7 @@ discard block |
||
1077 | 1077 | try { |
1078 | 1078 | $sthsm = $Connection->db->prepare($query_search_mfr); |
1079 | 1079 | $sthsm->execute(array(':mfr' => $data[2])); |
1080 | - } catch(PDOException $e) { |
|
1080 | + } catch (PDOException $e) { |
|
1081 | 1081 | return "error mfr : ".$e->getMessage(); |
1082 | 1082 | } |
1083 | 1083 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1087,8 +1087,8 @@ discard block |
||
1087 | 1087 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1088 | 1088 | try { |
1089 | 1089 | $sthf = $Connection->db->prepare($queryf); |
1090 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
1091 | - } catch(PDOException $e) { |
|
1090 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
1091 | + } catch (PDOException $e) { |
|
1092 | 1092 | return "error f : ".$e->getMessage(); |
1093 | 1093 | } |
1094 | 1094 | } |
@@ -1098,13 +1098,13 @@ discard block |
||
1098 | 1098 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1099 | 1099 | try { |
1100 | 1100 | $sth = $Connection->db->prepare($query); |
1101 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
1102 | - } catch(PDOException $e) { |
|
1101 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
1102 | + } catch (PDOException $e) { |
|
1103 | 1103 | return "error i : ".$e->getMessage(); |
1104 | 1104 | } |
1105 | 1105 | } |
1106 | 1106 | } |
1107 | - if ($i % 90 == 0) { |
|
1107 | + if ($i%90 == 0) { |
|
1108 | 1108 | if ($globalTransaction) $Connection->db->commit(); |
1109 | 1109 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1110 | 1110 | } |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | $Connection = new Connection(); |
1124 | 1124 | $sth = $Connection->db->prepare($query); |
1125 | 1125 | $sth->execute(array(':source' => 'website_fam')); |
1126 | - } catch(PDOException $e) { |
|
1126 | + } catch (PDOException $e) { |
|
1127 | 1127 | return "error : ".$e->getMessage(); |
1128 | 1128 | } |
1129 | 1129 | $delimiter = "\t"; |
@@ -1139,8 +1139,8 @@ discard block |
||
1139 | 1139 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1140 | 1140 | try { |
1141 | 1141 | $sth = $Connection->db->prepare($query); |
1142 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
1143 | - } catch(PDOException $e) { |
|
1142 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
1143 | + } catch (PDOException $e) { |
|
1144 | 1144 | return "error : ".$e->getMessage(); |
1145 | 1145 | } |
1146 | 1146 | } |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | try { |
1173 | 1173 | $sth = $Connection->db->prepare($query); |
1174 | 1174 | $sth->execute(); |
1175 | - } catch(PDOException $e) { |
|
1175 | + } catch (PDOException $e) { |
|
1176 | 1176 | return "error : ".$e->getMessage(); |
1177 | 1177 | } |
1178 | 1178 | $delimiter = "\t"; |
@@ -1187,8 +1187,8 @@ discard block |
||
1187 | 1187 | $query = 'INSERT INTO airlines (airline_id,name,alias,iata,icao,callsign,country,active,type,home_link,wikipedia_link,alliance,ban_eu) VALUES (0,:name,:alias,:iata,:icao,:callsign,:country,:active,:type,:home,:wikipedia_link,:alliance,:ban_eu)'; |
1188 | 1188 | try { |
1189 | 1189 | $sth = $Connection->db->prepare($query); |
1190 | - $sth->execute(array(':name' => $data[0],':alias' => $data[1],':iata' => $data[2],':icao' => $data[3], ':callsign' => $data[4],':country' => $data[5],':active' => $data[6],':type' => $data[7],':home' => $data[8],':wikipedia_link' => $data[9],':alliance' => $data[10],':ban_eu' => $data[11])); |
|
1191 | - } catch(PDOException $e) { |
|
1190 | + $sth->execute(array(':name' => $data[0], ':alias' => $data[1], ':iata' => $data[2], ':icao' => $data[3], ':callsign' => $data[4], ':country' => $data[5], ':active' => $data[6], ':type' => $data[7], ':home' => $data[8], ':wikipedia_link' => $data[9], ':alliance' => $data[10], ':ban_eu' => $data[11])); |
|
1191 | + } catch (PDOException $e) { |
|
1192 | 1192 | return "error : ".$e->getMessage(); |
1193 | 1193 | } |
1194 | 1194 | } |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | $Connection = new Connection(); |
1217 | 1217 | $sth = $Connection->db->prepare($query); |
1218 | 1218 | $sth->execute(array(':source' => 'website_fam')); |
1219 | - } catch(PDOException $e) { |
|
1219 | + } catch (PDOException $e) { |
|
1220 | 1220 | return "error : ".$e->getMessage(); |
1221 | 1221 | } |
1222 | 1222 | |
@@ -1232,8 +1232,8 @@ discard block |
||
1232 | 1232 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1233 | 1233 | try { |
1234 | 1234 | $sth = $Connection->db->prepare($query); |
1235 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1236 | - } catch(PDOException $e) { |
|
1235 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1236 | + } catch (PDOException $e) { |
|
1237 | 1237 | //print_r($data); |
1238 | 1238 | return "error : ".$e->getMessage(); |
1239 | 1239 | } |
@@ -1253,7 +1253,7 @@ discard block |
||
1253 | 1253 | $Connection = new Connection(); |
1254 | 1254 | $sth = $Connection->db->prepare($query); |
1255 | 1255 | $sth->execute(array(':source' => 'website_fam')); |
1256 | - } catch(PDOException $e) { |
|
1256 | + } catch (PDOException $e) { |
|
1257 | 1257 | return "error : ".$e->getMessage(); |
1258 | 1258 | } |
1259 | 1259 | $delimiter = "\t"; |
@@ -1268,9 +1268,9 @@ discard block |
||
1268 | 1268 | $query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
1269 | 1269 | try { |
1270 | 1270 | $sth = $Connection->db->prepare($query); |
1271 | - $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
1272 | - } catch(PDOException $e) { |
|
1273 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
1271 | + $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
1272 | + } catch (PDOException $e) { |
|
1273 | + if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data); |
|
1274 | 1274 | } |
1275 | 1275 | } |
1276 | 1276 | $i++; |
@@ -1288,7 +1288,7 @@ discard block |
||
1288 | 1288 | $Connection = new Connection(); |
1289 | 1289 | $sth = $Connection->db->prepare($query); |
1290 | 1290 | $sth->execute(); |
1291 | - } catch(PDOException $e) { |
|
1291 | + } catch (PDOException $e) { |
|
1292 | 1292 | return "error : ".$e->getMessage(); |
1293 | 1293 | } |
1294 | 1294 | |
@@ -1309,8 +1309,8 @@ discard block |
||
1309 | 1309 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
1310 | 1310 | try { |
1311 | 1311 | $sth = $Connection->db->prepare($query); |
1312 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
1313 | - } catch(PDOException $e) { |
|
1312 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
1313 | + } catch (PDOException $e) { |
|
1314 | 1314 | return "error : ".$e->getMessage(); |
1315 | 1315 | } |
1316 | 1316 | } |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | $Connection = new Connection(); |
1330 | 1330 | $sth = $Connection->db->prepare($query); |
1331 | 1331 | $sth->execute(); |
1332 | - } catch(PDOException $e) { |
|
1332 | + } catch (PDOException $e) { |
|
1333 | 1333 | return "error : ".$e->getMessage(); |
1334 | 1334 | } |
1335 | 1335 | $delimiter = "\t"; |
@@ -1346,8 +1346,8 @@ discard block |
||
1346 | 1346 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1347 | 1347 | try { |
1348 | 1348 | $sth = $Connection->db->prepare($query); |
1349 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1350 | - } catch(PDOException $e) { |
|
1349 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
1350 | + } catch (PDOException $e) { |
|
1351 | 1351 | return "error : ".$e->getMessage(); |
1352 | 1352 | } |
1353 | 1353 | } |
@@ -1366,7 +1366,7 @@ discard block |
||
1366 | 1366 | $Connection = new Connection(); |
1367 | 1367 | $sth = $Connection->db->prepare($query); |
1368 | 1368 | $sth->execute(); |
1369 | - } catch(PDOException $e) { |
|
1369 | + } catch (PDOException $e) { |
|
1370 | 1370 | return "error : ".$e->getMessage(); |
1371 | 1371 | } |
1372 | 1372 | |
@@ -1382,7 +1382,7 @@ discard block |
||
1382 | 1382 | try { |
1383 | 1383 | $sth = $Connection->db->prepare($query); |
1384 | 1384 | $sth->execute(array(':icao' => $icao)); |
1385 | - } catch(PDOException $e) { |
|
1385 | + } catch (PDOException $e) { |
|
1386 | 1386 | return "error : ".$e->getMessage(); |
1387 | 1387 | } |
1388 | 1388 | } |
@@ -1393,7 +1393,7 @@ discard block |
||
1393 | 1393 | return ''; |
1394 | 1394 | } |
1395 | 1395 | |
1396 | - public static function tle($filename,$tletype) { |
|
1396 | + public static function tle($filename, $tletype) { |
|
1397 | 1397 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1398 | 1398 | global $tmp_dir, $globalTransaction; |
1399 | 1399 | //$Spotter = new Spotter(); |
@@ -1403,7 +1403,7 @@ discard block |
||
1403 | 1403 | $Connection = new Connection(); |
1404 | 1404 | $sth = $Connection->db->prepare($query); |
1405 | 1405 | $sth->execute(array(':source' => $filename)); |
1406 | - } catch(PDOException $e) { |
|
1406 | + } catch (PDOException $e) { |
|
1407 | 1407 | return "error : ".$e->getMessage(); |
1408 | 1408 | } |
1409 | 1409 | |
@@ -1428,8 +1428,8 @@ discard block |
||
1428 | 1428 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1429 | 1429 | try { |
1430 | 1430 | $sth = $Connection->db->prepare($query); |
1431 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1432 | - } catch(PDOException $e) { |
|
1431 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1432 | + } catch (PDOException $e) { |
|
1433 | 1433 | return "error : ".$e->getMessage(); |
1434 | 1434 | } |
1435 | 1435 | |
@@ -1449,7 +1449,7 @@ discard block |
||
1449 | 1449 | $Connection = new Connection(); |
1450 | 1450 | $sth = $Connection->db->prepare($query); |
1451 | 1451 | $sth->execute(array(':source' => $filename)); |
1452 | - } catch(PDOException $e) { |
|
1452 | + } catch (PDOException $e) { |
|
1453 | 1453 | return "error : ".$e->getMessage(); |
1454 | 1454 | } |
1455 | 1455 | |
@@ -1459,13 +1459,13 @@ discard block |
||
1459 | 1459 | $i = 0; |
1460 | 1460 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1461 | 1461 | //$Connection->db->beginTransaction(); |
1462 | - while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE) |
|
1462 | + while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) |
|
1463 | 1463 | { |
1464 | 1464 | if ($i > 0 && $data[0] != '') { |
1465 | 1465 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1466 | - $period = str_replace(',','',$data[14]); |
|
1467 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1468 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1466 | + $period = str_replace(',', '', $data[14]); |
|
1467 | + if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60; |
|
1468 | + if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18])); |
|
1469 | 1469 | else $launch_date = NULL; |
1470 | 1470 | $data = array_map(function($value) { |
1471 | 1471 | return trim($value) === '' ? null : $value; |
@@ -1475,8 +1475,8 @@ discard block |
||
1475 | 1475 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
1476 | 1476 | try { |
1477 | 1477 | $sth = $Connection->db->prepare($query); |
1478 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1479 | - } catch(PDOException $e) { |
|
1478 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
1479 | + } catch (PDOException $e) { |
|
1480 | 1480 | return "error : ".$e->getMessage(); |
1481 | 1481 | } |
1482 | 1482 | } |
@@ -1516,7 +1516,7 @@ discard block |
||
1516 | 1516 | 'EGYP' => array('country' => 'Egypt', 'owner' => ''), |
1517 | 1517 | 'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'), |
1518 | 1518 | 'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'), |
1519 | - 'EST' => array('country' => 'Estonia','owner' => ''), |
|
1519 | + 'EST' => array('country' => 'Estonia', 'owner' => ''), |
|
1520 | 1520 | 'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'), |
1521 | 1521 | 'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'), |
1522 | 1522 | 'FGER' => array('country' => 'France/Germany', 'owner' => ''), |
@@ -1639,10 +1639,10 @@ discard block |
||
1639 | 1639 | while (($data = fgets($handle, 1000)) !== FALSE) |
1640 | 1640 | { |
1641 | 1641 | $result = array(); |
1642 | - $result['cospar'] = trim(substr($data,0,11)); |
|
1643 | - $result['norad'] = trim(substr($data,13,6)); |
|
1644 | - $result['operational'] = trim(substr($data,21,1)); |
|
1645 | - $result['name'] = trim(substr($data,23,24)); |
|
1642 | + $result['cospar'] = trim(substr($data, 0, 11)); |
|
1643 | + $result['norad'] = trim(substr($data, 13, 6)); |
|
1644 | + $result['operational'] = trim(substr($data, 21, 1)); |
|
1645 | + $result['name'] = trim(substr($data, 23, 24)); |
|
1646 | 1646 | /* |
1647 | 1647 | * R/B(1) = Rocket body, first stage |
1648 | 1648 | * R/B(2) = Rocket body, second stage |
@@ -1654,20 +1654,20 @@ discard block |
||
1654 | 1654 | * An ampersand (&) indicates two or more objects are attached |
1655 | 1655 | */ |
1656 | 1656 | |
1657 | - $owner_code = trim(substr($data,49,5)); |
|
1657 | + $owner_code = trim(substr($data, 49, 5)); |
|
1658 | 1658 | if ($owner_code != 'TBD') { |
1659 | 1659 | $result['country_owner'] = $satcat_sources[$owner_code]['country']; |
1660 | 1660 | $result['owner'] = $satcat_sources[$owner_code]['owner']; |
1661 | - $result['launch_date'] = trim(substr($data,56,10)); |
|
1662 | - $launch_site_code = trim(substr($data,68,5)); |
|
1661 | + $result['launch_date'] = trim(substr($data, 56, 10)); |
|
1662 | + $launch_site_code = trim(substr($data, 68, 5)); |
|
1663 | 1663 | $result['launch_site'] = $satcat_launch_site[$launch_site_code]; |
1664 | - $result['lifetime'] = trim(substr($data,75,10)); |
|
1665 | - $result['period'] = trim(substr($data,87,7)); |
|
1666 | - $result['inclination'] = trim(substr($data,96,5)); |
|
1667 | - $result['apogee'] = trim(substr($data,103,6)); |
|
1668 | - $result['perigee'] = trim(substr($data,111,6)); |
|
1664 | + $result['lifetime'] = trim(substr($data, 75, 10)); |
|
1665 | + $result['period'] = trim(substr($data, 87, 7)); |
|
1666 | + $result['inclination'] = trim(substr($data, 96, 5)); |
|
1667 | + $result['apogee'] = trim(substr($data, 103, 6)); |
|
1668 | + $result['perigee'] = trim(substr($data, 111, 6)); |
|
1669 | 1669 | //$result['radarcross'] = trim(substr($data,119,8)); |
1670 | - $result['status'] = trim(substr($data,129,3)); |
|
1670 | + $result['status'] = trim(substr($data, 129, 3)); |
|
1671 | 1671 | //print_r($result); |
1672 | 1672 | $result = array_map(function($value) { |
1673 | 1673 | return trim($value) === '' ? null : $value; |
@@ -1680,7 +1680,7 @@ discard block |
||
1680 | 1680 | $sth = $Connection->db->prepare($query); |
1681 | 1681 | $sth->execute(array(':cospar' => $result['cospar'])); |
1682 | 1682 | $exist = $sth->fetchAll(PDO::FETCH_ASSOC); |
1683 | - } catch(PDOException $e) { |
|
1683 | + } catch (PDOException $e) { |
|
1684 | 1684 | return "error : ".$e->getMessage(); |
1685 | 1685 | } |
1686 | 1686 | if (empty($exist)) { |
@@ -1692,10 +1692,10 @@ discard block |
||
1692 | 1692 | ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
1693 | 1693 | ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
1694 | 1694 | ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
1695 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1695 | + ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1696 | 1696 | ) |
1697 | 1697 | ); |
1698 | - } catch(PDOException $e) { |
|
1698 | + } catch (PDOException $e) { |
|
1699 | 1699 | return "error : ".$e->getMessage(); |
1700 | 1700 | } |
1701 | 1701 | } elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) { |
@@ -1703,8 +1703,8 @@ discard block |
||
1703 | 1703 | try { |
1704 | 1704 | $Connection = new Connection(); |
1705 | 1705 | $sth = $Connection->db->prepare($query); |
1706 | - $sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar'])); |
|
1707 | - } catch(PDOException $e) { |
|
1706 | + $sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar'])); |
|
1707 | + } catch (PDOException $e) { |
|
1708 | 1708 | return "error : ".$e->getMessage(); |
1709 | 1709 | } |
1710 | 1710 | } |
@@ -1823,13 +1823,13 @@ discard block |
||
1823 | 1823 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1824 | 1824 | { |
1825 | 1825 | $i++; |
1826 | - if($i > 3 && count($row) > 2) { |
|
1826 | + if ($i > 3 && count($row) > 2) { |
|
1827 | 1827 | $data = array_values(array_filter($row)); |
1828 | 1828 | $cntdata = count($data); |
1829 | 1829 | if ($cntdata > 10) { |
1830 | 1830 | $value = $data[9]; |
1831 | 1831 | |
1832 | - for ($i =10;$i < $cntdata;$i++) { |
|
1832 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1833 | 1833 | $value .= ' '.$data[$i]; |
1834 | 1834 | } |
1835 | 1835 | $data[9] = $value; |
@@ -1839,8 +1839,8 @@ discard block |
||
1839 | 1839 | $query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
1840 | 1840 | try { |
1841 | 1841 | $sth = $Connection->db->prepare($query); |
1842 | - $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1843 | - } catch(PDOException $e) { |
|
1842 | + $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1843 | + } catch (PDOException $e) { |
|
1844 | 1844 | return "error : ".$e->getMessage(); |
1845 | 1845 | } |
1846 | 1846 | } |
@@ -1861,7 +1861,7 @@ discard block |
||
1861 | 1861 | $Connection = new Connection(); |
1862 | 1862 | $sth = $Connection->db->prepare($query); |
1863 | 1863 | $sth->execute(); |
1864 | - } catch(PDOException $e) { |
|
1864 | + } catch (PDOException $e) { |
|
1865 | 1865 | return "error : ".$e->getMessage(); |
1866 | 1866 | } |
1867 | 1867 | |
@@ -1873,12 +1873,12 @@ discard block |
||
1873 | 1873 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1874 | 1874 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1875 | 1875 | { |
1876 | - if(count($row) > 1) { |
|
1876 | + if (count($row) > 1) { |
|
1877 | 1877 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1878 | 1878 | try { |
1879 | 1879 | $sth = $Connection->db->prepare($query); |
1880 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1881 | - } catch(PDOException $e) { |
|
1880 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1881 | + } catch (PDOException $e) { |
|
1882 | 1882 | return "error : ".$e->getMessage(); |
1883 | 1883 | } |
1884 | 1884 | } |
@@ -1898,21 +1898,21 @@ discard block |
||
1898 | 1898 | try { |
1899 | 1899 | $sth = $Connection->db->prepare($query); |
1900 | 1900 | $sth->execute(); |
1901 | - } catch(PDOException $e) { |
|
1901 | + } catch (PDOException $e) { |
|
1902 | 1902 | return "error : ".$e->getMessage(); |
1903 | 1903 | } |
1904 | 1904 | } |
1905 | 1905 | |
1906 | 1906 | |
1907 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1907 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1908 | 1908 | else { |
1909 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1909 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1910 | 1910 | $query = "CREATE EXTENSION postgis"; |
1911 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1911 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1912 | 1912 | try { |
1913 | 1913 | $sth = $Connection->db->prepare($query); |
1914 | 1914 | $sth->execute(); |
1915 | - } catch(PDOException $e) { |
|
1915 | + } catch (PDOException $e) { |
|
1916 | 1916 | return "error : ".$e->getMessage(); |
1917 | 1917 | } |
1918 | 1918 | } |
@@ -1925,13 +1925,13 @@ discard block |
||
1925 | 1925 | include_once('class.create_db.php'); |
1926 | 1926 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1927 | 1927 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
1928 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
|
1928 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5', $tmp_dir.'notam.txt.gz.md5'); |
|
1929 | 1929 | $error = ''; |
1930 | 1930 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
1931 | - $notam_md5_file = explode(' ',file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
1931 | + $notam_md5_file = explode(' ', file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
1932 | 1932 | $notam_md5 = $notam_md5_file[0]; |
1933 | 1933 | if (!update_db::check_notam_version($notam_md5)) { |
1934 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
1934 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1935 | 1935 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1936 | 1936 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
1937 | 1937 | if ($globalDebug) echo "Gunzip..."; |
@@ -1967,14 +1967,14 @@ discard block |
||
1967 | 1967 | try { |
1968 | 1968 | $sth = $Connection->db->prepare($query); |
1969 | 1969 | $sth->execute(); |
1970 | - } catch(PDOException $e) { |
|
1970 | + } catch (PDOException $e) { |
|
1971 | 1971 | echo "error : ".$e->getMessage(); |
1972 | 1972 | } |
1973 | 1973 | } |
1974 | 1974 | if ($globalDBdriver == 'mysql') { |
1975 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1975 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1976 | 1976 | } else { |
1977 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1977 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1978 | 1978 | } |
1979 | 1979 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
1980 | 1980 | return $error; |
@@ -1987,7 +1987,7 @@ discard block |
||
1987 | 1987 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
1988 | 1988 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
1989 | 1989 | // update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
1990 | - update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
1990 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
1991 | 1991 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
1992 | 1992 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
1993 | 1993 | return $error; |
@@ -2008,7 +2008,7 @@ discard block |
||
2008 | 2008 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
2009 | 2009 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
2010 | 2010 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
2011 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
2011 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
2012 | 2012 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
2013 | 2013 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
2014 | 2014 | } else $error = "ZIP module not loaded but required for IVAO."; |
@@ -2022,7 +2022,7 @@ discard block |
||
2022 | 2022 | global $tmp_dir, $globalDebug; |
2023 | 2023 | $error = ''; |
2024 | 2024 | if ($globalDebug) echo "Routes : Download..."; |
2025 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
2025 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
2026 | 2026 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
2027 | 2027 | if ($globalDebug) echo "Gunzip..."; |
2028 | 2028 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -2038,7 +2038,7 @@ discard block |
||
2038 | 2038 | global $tmp_dir, $globalDebug; |
2039 | 2039 | $error = ''; |
2040 | 2040 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
2041 | - update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
2041 | + update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
2042 | 2042 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
2043 | 2043 | if ($globalDebug) echo "Gunzip..."; |
2044 | 2044 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -2054,7 +2054,7 @@ discard block |
||
2054 | 2054 | global $tmp_dir, $globalDebug; |
2055 | 2055 | $error = ''; |
2056 | 2056 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
2057 | - update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
2057 | + update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
2058 | 2058 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
2059 | 2059 | if ($globalDebug) echo "Gunzip..."; |
2060 | 2060 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -2082,7 +2082,7 @@ discard block |
||
2082 | 2082 | */ |
2083 | 2083 | if ($globalDebug) echo "Modes : Download..."; |
2084 | 2084 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
2085 | - update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
2085 | + update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
2086 | 2086 | |
2087 | 2087 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2088 | 2088 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -2102,7 +2102,7 @@ discard block |
||
2102 | 2102 | public static function update_ModeS_faa() { |
2103 | 2103 | global $tmp_dir, $globalDebug; |
2104 | 2104 | if ($globalDebug) echo "Modes FAA: Download..."; |
2105 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
2105 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
2106 | 2106 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2107 | 2107 | if ($globalDebug) echo "Unzip..."; |
2108 | 2108 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -2118,7 +2118,7 @@ discard block |
||
2118 | 2118 | public static function update_ModeS_flarm() { |
2119 | 2119 | global $tmp_dir, $globalDebug; |
2120 | 2120 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
2121 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
2121 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
2122 | 2122 | if (file_exists($tmp_dir.'data.fln')) { |
2123 | 2123 | if ($globalDebug) echo "Add to DB..."; |
2124 | 2124 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -2132,7 +2132,7 @@ discard block |
||
2132 | 2132 | public static function update_ModeS_ogn() { |
2133 | 2133 | global $tmp_dir, $globalDebug; |
2134 | 2134 | if ($globalDebug) echo "Modes OGN: Download..."; |
2135 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
2135 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
2136 | 2136 | if (file_exists($tmp_dir.'ogn.csv')) { |
2137 | 2137 | if ($globalDebug) echo "Add to DB..."; |
2138 | 2138 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -2147,201 +2147,201 @@ discard block |
||
2147 | 2147 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2148 | 2148 | |
2149 | 2149 | if ($globalDebug) echo "Owner France: Download..."; |
2150 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
2150 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
2151 | 2151 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2152 | 2152 | if ($globalDebug) echo "Add to DB..."; |
2153 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
2153 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
2154 | 2154 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
2155 | 2155 | if ($error != '') { |
2156 | 2156 | return $error; |
2157 | 2157 | } elseif ($globalDebug) echo "Done\n"; |
2158 | 2158 | |
2159 | 2159 | if ($globalDebug) echo "Owner Ireland: Download..."; |
2160 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
2160 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
2161 | 2161 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2162 | 2162 | if ($globalDebug) echo "Add to DB..."; |
2163 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
2163 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
2164 | 2164 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
2165 | 2165 | if ($error != '') { |
2166 | 2166 | return $error; |
2167 | 2167 | } elseif ($globalDebug) echo "Done\n"; |
2168 | 2168 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
2169 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
2169 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
2170 | 2170 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2171 | 2171 | if ($globalDebug) echo "Add to DB..."; |
2172 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
2172 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
2173 | 2173 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
2174 | 2174 | if ($error != '') { |
2175 | 2175 | return $error; |
2176 | 2176 | } elseif ($globalDebug) echo "Done\n"; |
2177 | 2177 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
2178 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
2178 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
2179 | 2179 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2180 | 2180 | if ($globalDebug) echo "Add to DB..."; |
2181 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
2181 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
2182 | 2182 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
2183 | 2183 | if ($error != '') { |
2184 | 2184 | return $error; |
2185 | 2185 | } elseif ($globalDebug) echo "Done\n"; |
2186 | 2186 | if ($globalDebug) echo "Owner Australia: Download..."; |
2187 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
2187 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
2188 | 2188 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2189 | 2189 | if ($globalDebug) echo "Add to DB..."; |
2190 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
2190 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
2191 | 2191 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
2192 | 2192 | if ($error != '') { |
2193 | 2193 | return $error; |
2194 | 2194 | } elseif ($globalDebug) echo "Done\n"; |
2195 | 2195 | if ($globalDebug) echo "Owner Austria: Download..."; |
2196 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
2196 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
2197 | 2197 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2198 | 2198 | if ($globalDebug) echo "Add to DB..."; |
2199 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
2199 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
2200 | 2200 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
2201 | 2201 | if ($error != '') { |
2202 | 2202 | return $error; |
2203 | 2203 | } elseif ($globalDebug) echo "Done\n"; |
2204 | 2204 | if ($globalDebug) echo "Owner Chile: Download..."; |
2205 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
2205 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
2206 | 2206 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2207 | 2207 | if ($globalDebug) echo "Add to DB..."; |
2208 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
2208 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
2209 | 2209 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
2210 | 2210 | if ($error != '') { |
2211 | 2211 | return $error; |
2212 | 2212 | } elseif ($globalDebug) echo "Done\n"; |
2213 | 2213 | if ($globalDebug) echo "Owner Colombia: Download..."; |
2214 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
2214 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
2215 | 2215 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2216 | 2216 | if ($globalDebug) echo "Add to DB..."; |
2217 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
2217 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
2218 | 2218 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
2219 | 2219 | if ($error != '') { |
2220 | 2220 | return $error; |
2221 | 2221 | } elseif ($globalDebug) echo "Done\n"; |
2222 | 2222 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
2223 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
2223 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
2224 | 2224 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2225 | 2225 | if ($globalDebug) echo "Add to DB..."; |
2226 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
2226 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
2227 | 2227 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
2228 | 2228 | if ($error != '') { |
2229 | 2229 | return $error; |
2230 | 2230 | } elseif ($globalDebug) echo "Done\n"; |
2231 | 2231 | if ($globalDebug) echo "Owner Brazil: Download..."; |
2232 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
2232 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
2233 | 2233 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2234 | 2234 | if ($globalDebug) echo "Add to DB..."; |
2235 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
2235 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
2236 | 2236 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
2237 | 2237 | if ($error != '') { |
2238 | 2238 | return $error; |
2239 | 2239 | } elseif ($globalDebug) echo "Done\n"; |
2240 | 2240 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
2241 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
2241 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
2242 | 2242 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2243 | 2243 | if ($globalDebug) echo "Add to DB..."; |
2244 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
2244 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
2245 | 2245 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
2246 | 2246 | if ($error != '') { |
2247 | 2247 | return $error; |
2248 | 2248 | } elseif ($globalDebug) echo "Done\n"; |
2249 | 2249 | if ($globalDebug) echo "Owner Croatia: Download..."; |
2250 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
2250 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
2251 | 2251 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2252 | 2252 | if ($globalDebug) echo "Add to DB..."; |
2253 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
2253 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
2254 | 2254 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
2255 | 2255 | if ($error != '') { |
2256 | 2256 | return $error; |
2257 | 2257 | } elseif ($globalDebug) echo "Done\n"; |
2258 | 2258 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
2259 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
2259 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
2260 | 2260 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2261 | 2261 | if ($globalDebug) echo "Add to DB..."; |
2262 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
2262 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
2263 | 2263 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
2264 | 2264 | if ($error != '') { |
2265 | 2265 | return $error; |
2266 | 2266 | } elseif ($globalDebug) echo "Done\n"; |
2267 | 2267 | if ($globalDebug) echo "Owner Maldives: Download..."; |
2268 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
2268 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
2269 | 2269 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2270 | 2270 | if ($globalDebug) echo "Add to DB..."; |
2271 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
2271 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
2272 | 2272 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
2273 | 2273 | if ($error != '') { |
2274 | 2274 | return $error; |
2275 | 2275 | } elseif ($globalDebug) echo "Done\n"; |
2276 | 2276 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
2277 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
2277 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
2278 | 2278 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2279 | 2279 | if ($globalDebug) echo "Add to DB..."; |
2280 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
2280 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
2281 | 2281 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
2282 | 2282 | if ($error != '') { |
2283 | 2283 | return $error; |
2284 | 2284 | } elseif ($globalDebug) echo "Done\n"; |
2285 | 2285 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
2286 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
2286 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
2287 | 2287 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2288 | 2288 | if ($globalDebug) echo "Add to DB..."; |
2289 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
2289 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
2290 | 2290 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
2291 | 2291 | if ($error != '') { |
2292 | 2292 | return $error; |
2293 | 2293 | } elseif ($globalDebug) echo "Done\n"; |
2294 | 2294 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
2295 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
2295 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
2296 | 2296 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2297 | 2297 | if ($globalDebug) echo "Add to DB..."; |
2298 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
2298 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
2299 | 2299 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
2300 | 2300 | if ($error != '') { |
2301 | 2301 | return $error; |
2302 | 2302 | } elseif ($globalDebug) echo "Done\n"; |
2303 | 2303 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
2304 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
2304 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
2305 | 2305 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2306 | 2306 | if ($globalDebug) echo "Add to DB..."; |
2307 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
2307 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
2308 | 2308 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
2309 | 2309 | if ($error != '') { |
2310 | 2310 | return $error; |
2311 | 2311 | } elseif ($globalDebug) echo "Done\n"; |
2312 | 2312 | if ($globalDebug) echo "Owner Iceland: Download..."; |
2313 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
2313 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
2314 | 2314 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2315 | 2315 | if ($globalDebug) echo "Add to DB..."; |
2316 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
2316 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
2317 | 2317 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
2318 | 2318 | if ($error != '') { |
2319 | 2319 | return $error; |
2320 | 2320 | } elseif ($globalDebug) echo "Done\n"; |
2321 | 2321 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
2322 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
2322 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
2323 | 2323 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2324 | 2324 | if ($globalDebug) echo "Add to DB..."; |
2325 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
2325 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
2326 | 2326 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
2327 | 2327 | if ($error != '') { |
2328 | 2328 | return $error; |
2329 | 2329 | } elseif ($globalDebug) echo "Done\n"; |
2330 | 2330 | if ($globalMasterSource) { |
2331 | 2331 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
2332 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
2332 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
2333 | 2333 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2334 | 2334 | if ($globalDebug) echo "Add to DB..."; |
2335 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
2335 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
2336 | 2336 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
2337 | 2337 | if ($error != '') { |
2338 | 2338 | return $error; |
2339 | 2339 | } elseif ($globalDebug) echo "Done\n"; |
2340 | 2340 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
2341 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
2341 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
2342 | 2342 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2343 | 2343 | if ($globalDebug) echo "Add to DB..."; |
2344 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
2344 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
2345 | 2345 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
2346 | 2346 | if ($error != '') { |
2347 | 2347 | return $error; |
@@ -2354,7 +2354,7 @@ discard block |
||
2354 | 2354 | global $tmp_dir, $globalDebug; |
2355 | 2355 | $error = ''; |
2356 | 2356 | if ($globalDebug) echo "Translation : Download..."; |
2357 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
2357 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
2358 | 2358 | if (file_exists($tmp_dir.'translation.zip')) { |
2359 | 2359 | if ($globalDebug) echo "Unzip..."; |
2360 | 2360 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -2370,10 +2370,10 @@ discard block |
||
2370 | 2370 | public static function update_translation_fam() { |
2371 | 2371 | global $tmp_dir, $globalDebug; |
2372 | 2372 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
2373 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
2374 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
|
2373 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
2374 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5', $tmp_dir.'translation.tsv.gz.md5'); |
|
2375 | 2375 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
2376 | - $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
2376 | + $translation_md5_file = explode(' ', file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
2377 | 2377 | $translation_md5 = $translation_md5_file[0]; |
2378 | 2378 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
2379 | 2379 | if ($globalDebug) echo "Gunzip..."; |
@@ -2390,10 +2390,10 @@ discard block |
||
2390 | 2390 | public static function update_ModeS_fam() { |
2391 | 2391 | global $tmp_dir, $globalDebug; |
2392 | 2392 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
2393 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
2394 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
|
2393 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
2394 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5', $tmp_dir.'modes.tsv.gz.md5'); |
|
2395 | 2395 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
2396 | - $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
2396 | + $modes_md5_file = explode(' ', file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
2397 | 2397 | $modes_md5 = $modes_md5_file[0]; |
2398 | 2398 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
2399 | 2399 | if ($globalDebug) echo "Gunzip..."; |
@@ -2412,12 +2412,12 @@ discard block |
||
2412 | 2412 | global $tmp_dir, $globalDebug; |
2413 | 2413 | $error = ''; |
2414 | 2414 | if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
2415 | - update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
|
2415 | + update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5', $tmp_dir.'airlines.tsv.gz.md5'); |
|
2416 | 2416 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
2417 | - $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
2417 | + $airlines_md5_file = explode(' ', file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
2418 | 2418 | $airlines_md5 = $airlines_md5_file[0]; |
2419 | 2419 | if (!update_db::check_airlines_version($airlines_md5)) { |
2420 | - update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
|
2420 | + update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz', $tmp_dir.'airlines.tsv.gz'); |
|
2421 | 2421 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
2422 | 2422 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
2423 | 2423 | if ($globalDebug) echo "Gunzip..."; |
@@ -2442,14 +2442,14 @@ discard block |
||
2442 | 2442 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
2443 | 2443 | $error = ''; |
2444 | 2444 | if ($globalOwner === TRUE) { |
2445 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2446 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
2445 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2446 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
2447 | 2447 | } else { |
2448 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2449 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
2448 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2449 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
2450 | 2450 | } |
2451 | 2451 | if (file_exists($tmp_dir.'owners.tsv.gz') && file_exists($tmp_dir.'owners.tsv.gz.md5')) { |
2452 | - $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
2452 | + $owners_md5_file = explode(' ', file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
2453 | 2453 | $owners_md5 = $owners_md5_file[0]; |
2454 | 2454 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
2455 | 2455 | if ($globalDebug) echo "Gunzip..."; |
@@ -2466,10 +2466,10 @@ discard block |
||
2466 | 2466 | public static function update_routes_fam() { |
2467 | 2467 | global $tmp_dir, $globalDebug; |
2468 | 2468 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2469 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
2470 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
|
2469 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2470 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5', $tmp_dir.'routes.tsv.gz.md5'); |
|
2471 | 2471 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
2472 | - $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
2472 | + $routes_md5_file = explode(' ', file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
2473 | 2473 | $routes_md5 = $routes_md5_file[0]; |
2474 | 2474 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
2475 | 2475 | if ($globalDebug) echo "Gunzip..."; |
@@ -2485,13 +2485,13 @@ discard block |
||
2485 | 2485 | } |
2486 | 2486 | public static function update_marine_identity_fam() { |
2487 | 2487 | global $tmp_dir, $globalDebug; |
2488 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2488 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2489 | 2489 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2490 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2490 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2491 | 2491 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2492 | 2492 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2493 | 2493 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2494 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2494 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2495 | 2495 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2496 | 2496 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
2497 | 2497 | if ($globalDebug) echo "Gunzip..."; |
@@ -2513,13 +2513,13 @@ discard block |
||
2513 | 2513 | |
2514 | 2514 | public static function update_satellite_fam() { |
2515 | 2515 | global $tmp_dir, $globalDebug; |
2516 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5'); |
|
2516 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5'); |
|
2517 | 2517 | if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) { |
2518 | - $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2518 | + $satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2519 | 2519 | $satellite_md5 = $satellite_md5_file[0]; |
2520 | 2520 | if (!update_db::check_satellite_version($satellite_md5)) { |
2521 | 2521 | if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
2522 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
|
2522 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz'); |
|
2523 | 2523 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2524 | 2524 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
2525 | 2525 | if ($globalDebug) echo "Gunzip..."; |
@@ -2541,7 +2541,7 @@ discard block |
||
2541 | 2541 | public static function update_banned_fam() { |
2542 | 2542 | global $tmp_dir, $globalDebug; |
2543 | 2543 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2544 | - update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2544 | + update_db::download('http://data.flightairmap.com/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2545 | 2545 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2546 | 2546 | //if ($globalDebug) echo "Gunzip..."; |
2547 | 2547 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2560,18 +2560,18 @@ discard block |
||
2560 | 2560 | $error = ''; |
2561 | 2561 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2562 | 2562 | if ($globalDBdriver == 'mysql') { |
2563 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2563 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2564 | 2564 | } else { |
2565 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2565 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2566 | 2566 | } |
2567 | 2567 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2568 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2568 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2569 | 2569 | $airspace_md5 = $airspace_md5_file[0]; |
2570 | 2570 | if (!update_db::check_airspace_version($airspace_md5)) { |
2571 | 2571 | if ($globalDBdriver == 'mysql') { |
2572 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2572 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2573 | 2573 | } else { |
2574 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2574 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2575 | 2575 | } |
2576 | 2576 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2577 | 2577 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
@@ -2584,7 +2584,7 @@ discard block |
||
2584 | 2584 | try { |
2585 | 2585 | $sth = $Connection->db->prepare($query); |
2586 | 2586 | $sth->execute(); |
2587 | - } catch(PDOException $e) { |
|
2587 | + } catch (PDOException $e) { |
|
2588 | 2588 | return "error : ".$e->getMessage(); |
2589 | 2589 | } |
2590 | 2590 | } |
@@ -2604,16 +2604,16 @@ discard block |
||
2604 | 2604 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2605 | 2605 | $error = ''; |
2606 | 2606 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
2607 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2607 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2608 | 2608 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2609 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2609 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2610 | 2610 | $geoid_md5 = $geoid_md5_file[0]; |
2611 | 2611 | if (!update_db::check_geoid_version($geoid_md5)) { |
2612 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2612 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2613 | 2613 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2614 | 2614 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
2615 | 2615 | if ($globalDebug) echo "Gunzip..."; |
2616 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2616 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2617 | 2617 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2618 | 2618 | update_db::insert_geoid_version($geoid_md5); |
2619 | 2619 | } |
@@ -2630,15 +2630,15 @@ discard block |
||
2630 | 2630 | public static function update_tle() { |
2631 | 2631 | global $tmp_dir, $globalDebug; |
2632 | 2632 | if ($globalDebug) echo "Download TLE : Download..."; |
2633 | - $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
|
2634 | - 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
|
2635 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
|
2633 | + $alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt', |
|
2634 | + 'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt', |
|
2635 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt', 'visual.txt', 'sarsat.txt', 'argos.txt', 'ses.txt', 'iridium-NEXT.txt', 'beidou.txt'); |
|
2636 | 2636 | foreach ($alltle as $filename) { |
2637 | 2637 | if ($globalDebug) echo "downloading ".$filename.'...'; |
2638 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2638 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2639 | 2639 | if (file_exists($tmp_dir.$filename)) { |
2640 | 2640 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
2641 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2641 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2642 | 2642 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2643 | 2643 | if ($error != '') { |
2644 | 2644 | echo $error."\n"; |
@@ -2650,7 +2650,7 @@ discard block |
||
2650 | 2650 | public static function update_ucsdb() { |
2651 | 2651 | global $tmp_dir, $globalDebug; |
2652 | 2652 | if ($globalDebug) echo "Download UCS DB : Download..."; |
2653 | - update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
2653 | + update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt', $tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
2654 | 2654 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2655 | 2655 | if ($globalDebug) echo "Add to DB..."; |
2656 | 2656 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
@@ -2664,7 +2664,7 @@ discard block |
||
2664 | 2664 | public static function update_celestrak() { |
2665 | 2665 | global $tmp_dir, $globalDebug; |
2666 | 2666 | if ($globalDebug) echo "Download Celestrak DB : Download..."; |
2667 | - update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
|
2667 | + update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt'); |
|
2668 | 2668 | if (file_exists($tmp_dir.'satcat.txt')) { |
2669 | 2669 | if ($globalDebug) echo "Add to DB..."; |
2670 | 2670 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
@@ -2679,32 +2679,32 @@ discard block |
||
2679 | 2679 | global $tmp_dir, $globalDebug; |
2680 | 2680 | $error = ''; |
2681 | 2681 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
2682 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2682 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2683 | 2683 | if (file_exists($tmp_dir.'models.md5sum')) { |
2684 | 2684 | if ($globalDebug) echo "Check files...\n"; |
2685 | 2685 | $newmodelsdb = array(); |
2686 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2687 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2686 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2687 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2688 | 2688 | $model = trim($row[2]); |
2689 | 2689 | $newmodelsdb[$model] = trim($row[0]); |
2690 | 2690 | } |
2691 | 2691 | } |
2692 | 2692 | $modelsdb = array(); |
2693 | 2693 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2694 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2695 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2694 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2695 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2696 | 2696 | $model = trim($row[2]); |
2697 | 2697 | $modelsdb[$model] = trim($row[0]); |
2698 | 2698 | } |
2699 | 2699 | } |
2700 | 2700 | } |
2701 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2701 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2702 | 2702 | foreach ($diff as $key => $value) { |
2703 | 2703 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2704 | - update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2704 | + update_db::download('http://data.flightairmap.com/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2705 | 2705 | |
2706 | 2706 | } |
2707 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2707 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2708 | 2708 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2709 | 2709 | if ($error != '') { |
2710 | 2710 | return $error; |
@@ -2716,32 +2716,32 @@ discard block |
||
2716 | 2716 | global $tmp_dir, $globalDebug; |
2717 | 2717 | $error = ''; |
2718 | 2718 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
2719 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
2719 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2720 | 2720 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2721 | 2721 | if ($globalDebug) echo "Check files...\n"; |
2722 | 2722 | $newmodelsdb = array(); |
2723 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2724 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2723 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
2724 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2725 | 2725 | $model = trim($row[2]); |
2726 | 2726 | $newmodelsdb[$model] = trim($row[0]); |
2727 | 2727 | } |
2728 | 2728 | } |
2729 | 2729 | $modelsdb = array(); |
2730 | 2730 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
2731 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2732 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2731 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2732 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2733 | 2733 | $model = trim($row[2]); |
2734 | 2734 | $modelsdb[$model] = trim($row[0]); |
2735 | 2735 | } |
2736 | 2736 | } |
2737 | 2737 | } |
2738 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2738 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2739 | 2739 | foreach ($diff as $key => $value) { |
2740 | 2740 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2741 | - update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2741 | + update_db::download('http://data.flightairmap.com/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2742 | 2742 | |
2743 | 2743 | } |
2744 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2744 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2745 | 2745 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2746 | 2746 | if ($error != '') { |
2747 | 2747 | return $error; |
@@ -2753,32 +2753,32 @@ discard block |
||
2753 | 2753 | global $tmp_dir, $globalDebug; |
2754 | 2754 | $error = ''; |
2755 | 2755 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
2756 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
2756 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2757 | 2757 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2758 | 2758 | if ($globalDebug) echo "Check files...\n"; |
2759 | 2759 | $newmodelsdb = array(); |
2760 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2761 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2760 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2761 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2762 | 2762 | $model = trim($row[2]); |
2763 | 2763 | $newmodelsdb[$model] = trim($row[0]); |
2764 | 2764 | } |
2765 | 2765 | } |
2766 | 2766 | $modelsdb = array(); |
2767 | 2767 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
2768 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2769 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2768 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2769 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2770 | 2770 | $model = trim($row[2]); |
2771 | 2771 | $modelsdb[$model] = trim($row[0]); |
2772 | 2772 | } |
2773 | 2773 | } |
2774 | 2774 | } |
2775 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2775 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2776 | 2776 | foreach ($diff as $key => $value) { |
2777 | 2777 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
2778 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2778 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2779 | 2779 | |
2780 | 2780 | } |
2781 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2781 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2782 | 2782 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2783 | 2783 | if ($error != '') { |
2784 | 2784 | return $error; |
@@ -2801,8 +2801,8 @@ discard block |
||
2801 | 2801 | */ |
2802 | 2802 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2803 | 2803 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
2804 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2805 | - $result = fread($fh,100000000); |
|
2804 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
2805 | + $result = fread($fh, 100000000); |
|
2806 | 2806 | //echo $result; |
2807 | 2807 | //var_dump(str_get_html($result)); |
2808 | 2808 | //print_r(self::table2array($result)); |
@@ -2820,23 +2820,23 @@ discard block |
||
2820 | 2820 | $Connection = new Connection(); |
2821 | 2821 | $sth = $Connection->db->prepare($query); |
2822 | 2822 | $sth->execute(); |
2823 | - } catch(PDOException $e) { |
|
2823 | + } catch (PDOException $e) { |
|
2824 | 2824 | return "error : ".$e->getMessage(); |
2825 | 2825 | } |
2826 | 2826 | |
2827 | 2827 | $error = ''; |
2828 | 2828 | if ($globalDebug) echo "Notam : Download..."; |
2829 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
2829 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2830 | 2830 | if (file_exists($tmp_dir.'notam.rss')) { |
2831 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
2831 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2832 | 2832 | foreach ($notams['channel']['item'] as $notam) { |
2833 | - $title = explode(':',$notam['title']); |
|
2833 | + $title = explode(':', $notam['title']); |
|
2834 | 2834 | $data['ref'] = trim($title[0]); |
2835 | 2835 | unset($title[0]); |
2836 | - $data['title'] = trim(implode(':',$title)); |
|
2837 | - $description = strip_tags($notam['description'],'<pre>'); |
|
2838 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
2839 | - $q = explode('/',$match[1]); |
|
2836 | + $data['title'] = trim(implode(':', $title)); |
|
2837 | + $description = strip_tags($notam['description'], '<pre>'); |
|
2838 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
2839 | + $q = explode('/', $match[1]); |
|
2840 | 2840 | $data['fir'] = $q[0]; |
2841 | 2841 | $data['code'] = $q[1]; |
2842 | 2842 | $ifrvfr = $q[2]; |
@@ -2852,30 +2852,30 @@ discard block |
||
2852 | 2852 | $data['lower_limit'] = $q[5]; |
2853 | 2853 | $data['upper_limit'] = $q[6]; |
2854 | 2854 | $latlonrad = $q[7]; |
2855 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2856 | - $latitude = $Common->convertDec($las,'latitude'); |
|
2857 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
2855 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
2856 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
2857 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
2858 | 2858 | if ($lac == 'S') $latitude = '-'.$latitude; |
2859 | 2859 | if ($lnc == 'W') $longitude = '-'.$longitude; |
2860 | 2860 | $data['center_latitude'] = $latitude; |
2861 | 2861 | $data['center_longitude'] = $longitude; |
2862 | 2862 | $data['radius'] = intval($radius); |
2863 | 2863 | |
2864 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
2864 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2865 | 2865 | $data['text'] = $match[1]; |
2866 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
2866 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
2867 | 2867 | $fromto = $match[1]; |
2868 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
2868 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2869 | 2869 | $fromall = trim($match[1]); |
2870 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
2870 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2871 | 2871 | $from = trim($match[1]); |
2872 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2873 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
2872 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
2873 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2874 | 2874 | $toall = trim($match[1]); |
2875 | - if (!preg_match(':Permanent:',$toall)) { |
|
2876 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
2875 | + if (!preg_match(':Permanent:', $toall)) { |
|
2876 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2877 | 2877 | $to = trim($match[1]); |
2878 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
2878 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2879 | 2879 | $data['permanent'] = 0; |
2880 | 2880 | } else { |
2881 | 2881 | $data['date_end'] = NULL; |
@@ -2883,7 +2883,7 @@ discard block |
||
2883 | 2883 | } |
2884 | 2884 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2885 | 2885 | $NOTAM = new NOTAM(); |
2886 | - $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
2886 | + $NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
2887 | 2887 | unset($data); |
2888 | 2888 | } |
2889 | 2889 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2906,16 +2906,16 @@ discard block |
||
2906 | 2906 | $Connection = new Connection(); |
2907 | 2907 | $sth = $Connection->db->prepare($query); |
2908 | 2908 | $sth->execute(); |
2909 | - } catch(PDOException $e) { |
|
2909 | + } catch (PDOException $e) { |
|
2910 | 2910 | return "error : ".$e->getMessage(); |
2911 | 2911 | } |
2912 | 2912 | } |
2913 | 2913 | $Common = new Common(); |
2914 | 2914 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2915 | - $airspace_json = json_decode($airspace_lst,true); |
|
2915 | + $airspace_json = json_decode($airspace_lst, true); |
|
2916 | 2916 | foreach ($airspace_json['records'] as $airspace) { |
2917 | 2917 | if ($globalDebug) echo $airspace['name']."...\n"; |
2918 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
2918 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2919 | 2919 | if (file_exists($tmp_dir.$airspace['name'])) { |
2920 | 2920 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
2921 | 2921 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2937,7 +2937,7 @@ discard block |
||
2937 | 2937 | $Connection = new Connection(); |
2938 | 2938 | $sth = $Connection->db->prepare($query); |
2939 | 2939 | $sth->execute(array(':new' => $new, ':old' => $old)); |
2940 | - } catch(PDOException $e) { |
|
2940 | + } catch (PDOException $e) { |
|
2941 | 2941 | return "error : ".$e->getMessage(); |
2942 | 2942 | } |
2943 | 2943 | } |
@@ -2954,7 +2954,7 @@ discard block |
||
2954 | 2954 | $Connection = new Connection(); |
2955 | 2955 | $sth = $Connection->db->prepare($query); |
2956 | 2956 | $sth->execute(); |
2957 | - } catch(PDOException $e) { |
|
2957 | + } catch (PDOException $e) { |
|
2958 | 2958 | return "error : ".$e->getMessage(); |
2959 | 2959 | } |
2960 | 2960 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2969,7 +2969,7 @@ discard block |
||
2969 | 2969 | $Connection = new Connection(); |
2970 | 2970 | $sth = $Connection->db->prepare($query); |
2971 | 2971 | $sth->execute(); |
2972 | - } catch(PDOException $e) { |
|
2972 | + } catch (PDOException $e) { |
|
2973 | 2973 | return "error : ".$e->getMessage(); |
2974 | 2974 | } |
2975 | 2975 | } |
@@ -2980,7 +2980,7 @@ discard block |
||
2980 | 2980 | $Connection = new Connection(); |
2981 | 2981 | $sth = $Connection->db->prepare($query); |
2982 | 2982 | $sth->execute(array(':version' => $version)); |
2983 | - } catch(PDOException $e) { |
|
2983 | + } catch (PDOException $e) { |
|
2984 | 2984 | return "error : ".$e->getMessage(); |
2985 | 2985 | } |
2986 | 2986 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2994,7 +2994,7 @@ discard block |
||
2994 | 2994 | $Connection = new Connection(); |
2995 | 2995 | $sth = $Connection->db->prepare($query); |
2996 | 2996 | $sth->execute(array(':version' => $version)); |
2997 | - } catch(PDOException $e) { |
|
2997 | + } catch (PDOException $e) { |
|
2998 | 2998 | return "error : ".$e->getMessage(); |
2999 | 2999 | } |
3000 | 3000 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3008,7 +3008,7 @@ discard block |
||
3008 | 3008 | $Connection = new Connection(); |
3009 | 3009 | $sth = $Connection->db->prepare($query); |
3010 | 3010 | $sth->execute(array(':version' => $version)); |
3011 | - } catch(PDOException $e) { |
|
3011 | + } catch (PDOException $e) { |
|
3012 | 3012 | return "error : ".$e->getMessage(); |
3013 | 3013 | } |
3014 | 3014 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3022,7 +3022,7 @@ discard block |
||
3022 | 3022 | $Connection = new Connection(); |
3023 | 3023 | $sth = $Connection->db->prepare($query); |
3024 | 3024 | $sth->execute(array(':version' => $version)); |
3025 | - } catch(PDOException $e) { |
|
3025 | + } catch (PDOException $e) { |
|
3026 | 3026 | return "error : ".$e->getMessage(); |
3027 | 3027 | } |
3028 | 3028 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3036,7 +3036,7 @@ discard block |
||
3036 | 3036 | $Connection = new Connection(); |
3037 | 3037 | $sth = $Connection->db->prepare($query); |
3038 | 3038 | $sth->execute(array(':version' => $version)); |
3039 | - } catch(PDOException $e) { |
|
3039 | + } catch (PDOException $e) { |
|
3040 | 3040 | return "error : ".$e->getMessage(); |
3041 | 3041 | } |
3042 | 3042 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3050,7 +3050,7 @@ discard block |
||
3050 | 3050 | $Connection = new Connection(); |
3051 | 3051 | $sth = $Connection->db->prepare($query); |
3052 | 3052 | $sth->execute(array(':version' => $version)); |
3053 | - } catch(PDOException $e) { |
|
3053 | + } catch (PDOException $e) { |
|
3054 | 3054 | return "error : ".$e->getMessage(); |
3055 | 3055 | } |
3056 | 3056 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3065,7 +3065,7 @@ discard block |
||
3065 | 3065 | $Connection = new Connection(); |
3066 | 3066 | $sth = $Connection->db->prepare($query); |
3067 | 3067 | $sth->execute(array(':version' => $version)); |
3068 | - } catch(PDOException $e) { |
|
3068 | + } catch (PDOException $e) { |
|
3069 | 3069 | return "error : ".$e->getMessage(); |
3070 | 3070 | } |
3071 | 3071 | } |
@@ -3077,7 +3077,7 @@ discard block |
||
3077 | 3077 | $Connection = new Connection(); |
3078 | 3078 | $sth = $Connection->db->prepare($query); |
3079 | 3079 | $sth->execute(array(':version' => $version)); |
3080 | - } catch(PDOException $e) { |
|
3080 | + } catch (PDOException $e) { |
|
3081 | 3081 | return "error : ".$e->getMessage(); |
3082 | 3082 | } |
3083 | 3083 | } |
@@ -3089,7 +3089,7 @@ discard block |
||
3089 | 3089 | $Connection = new Connection(); |
3090 | 3090 | $sth = $Connection->db->prepare($query); |
3091 | 3091 | $sth->execute(array(':version' => $version)); |
3092 | - } catch(PDOException $e) { |
|
3092 | + } catch (PDOException $e) { |
|
3093 | 3093 | return "error : ".$e->getMessage(); |
3094 | 3094 | } |
3095 | 3095 | } |
@@ -3101,7 +3101,7 @@ discard block |
||
3101 | 3101 | $Connection = new Connection(); |
3102 | 3102 | $sth = $Connection->db->prepare($query); |
3103 | 3103 | $sth->execute(array(':version' => $version)); |
3104 | - } catch(PDOException $e) { |
|
3104 | + } catch (PDOException $e) { |
|
3105 | 3105 | return "error : ".$e->getMessage(); |
3106 | 3106 | } |
3107 | 3107 | } |
@@ -3113,7 +3113,7 @@ discard block |
||
3113 | 3113 | $Connection = new Connection(); |
3114 | 3114 | $sth = $Connection->db->prepare($query); |
3115 | 3115 | $sth->execute(array(':version' => $version)); |
3116 | - } catch(PDOException $e) { |
|
3116 | + } catch (PDOException $e) { |
|
3117 | 3117 | return "error : ".$e->getMessage(); |
3118 | 3118 | } |
3119 | 3119 | } |
@@ -3125,7 +3125,7 @@ discard block |
||
3125 | 3125 | $Connection = new Connection(); |
3126 | 3126 | $sth = $Connection->db->prepare($query); |
3127 | 3127 | $sth->execute(array(':version' => $version)); |
3128 | - } catch(PDOException $e) { |
|
3128 | + } catch (PDOException $e) { |
|
3129 | 3129 | return "error : ".$e->getMessage(); |
3130 | 3130 | } |
3131 | 3131 | } |
@@ -3141,7 +3141,7 @@ discard block |
||
3141 | 3141 | $Connection = new Connection(); |
3142 | 3142 | $sth = $Connection->db->prepare($query); |
3143 | 3143 | $sth->execute(); |
3144 | - } catch(PDOException $e) { |
|
3144 | + } catch (PDOException $e) { |
|
3145 | 3145 | return "error : ".$e->getMessage(); |
3146 | 3146 | } |
3147 | 3147 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3156,7 +3156,7 @@ discard block |
||
3156 | 3156 | $Connection = new Connection(); |
3157 | 3157 | $sth = $Connection->db->prepare($query); |
3158 | 3158 | $sth->execute(); |
3159 | - } catch(PDOException $e) { |
|
3159 | + } catch (PDOException $e) { |
|
3160 | 3160 | return "error : ".$e->getMessage(); |
3161 | 3161 | } |
3162 | 3162 | } |
@@ -3172,7 +3172,7 @@ discard block |
||
3172 | 3172 | $Connection = new Connection(); |
3173 | 3173 | $sth = $Connection->db->prepare($query); |
3174 | 3174 | $sth->execute(); |
3175 | - } catch(PDOException $e) { |
|
3175 | + } catch (PDOException $e) { |
|
3176 | 3176 | return "error : ".$e->getMessage(); |
3177 | 3177 | } |
3178 | 3178 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3187,7 +3187,7 @@ discard block |
||
3187 | 3187 | $Connection = new Connection(); |
3188 | 3188 | $sth = $Connection->db->prepare($query); |
3189 | 3189 | $sth->execute(); |
3190 | - } catch(PDOException $e) { |
|
3190 | + } catch (PDOException $e) { |
|
3191 | 3191 | return "error : ".$e->getMessage(); |
3192 | 3192 | } |
3193 | 3193 | } |
@@ -3203,7 +3203,7 @@ discard block |
||
3203 | 3203 | $Connection = new Connection(); |
3204 | 3204 | $sth = $Connection->db->prepare($query); |
3205 | 3205 | $sth->execute(); |
3206 | - } catch(PDOException $e) { |
|
3206 | + } catch (PDOException $e) { |
|
3207 | 3207 | return "error : ".$e->getMessage(); |
3208 | 3208 | } |
3209 | 3209 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3218,7 +3218,7 @@ discard block |
||
3218 | 3218 | $Connection = new Connection(); |
3219 | 3219 | $sth = $Connection->db->prepare($query); |
3220 | 3220 | $sth->execute(); |
3221 | - } catch(PDOException $e) { |
|
3221 | + } catch (PDOException $e) { |
|
3222 | 3222 | return "error : ".$e->getMessage(); |
3223 | 3223 | } |
3224 | 3224 | } |
@@ -3234,7 +3234,7 @@ discard block |
||
3234 | 3234 | $Connection = new Connection(); |
3235 | 3235 | $sth = $Connection->db->prepare($query); |
3236 | 3236 | $sth->execute(); |
3237 | - } catch(PDOException $e) { |
|
3237 | + } catch (PDOException $e) { |
|
3238 | 3238 | return "error : ".$e->getMessage(); |
3239 | 3239 | } |
3240 | 3240 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3249,7 +3249,7 @@ discard block |
||
3249 | 3249 | $Connection = new Connection(); |
3250 | 3250 | $sth = $Connection->db->prepare($query); |
3251 | 3251 | $sth->execute(); |
3252 | - } catch(PDOException $e) { |
|
3252 | + } catch (PDOException $e) { |
|
3253 | 3253 | return "error : ".$e->getMessage(); |
3254 | 3254 | } |
3255 | 3255 | } |
@@ -3265,7 +3265,7 @@ discard block |
||
3265 | 3265 | $Connection = new Connection(); |
3266 | 3266 | $sth = $Connection->db->prepare($query); |
3267 | 3267 | $sth->execute(); |
3268 | - } catch(PDOException $e) { |
|
3268 | + } catch (PDOException $e) { |
|
3269 | 3269 | return "error : ".$e->getMessage(); |
3270 | 3270 | } |
3271 | 3271 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3280,7 +3280,7 @@ discard block |
||
3280 | 3280 | $Connection = new Connection(); |
3281 | 3281 | $sth = $Connection->db->prepare($query); |
3282 | 3282 | $sth->execute(); |
3283 | - } catch(PDOException $e) { |
|
3283 | + } catch (PDOException $e) { |
|
3284 | 3284 | return "error : ".$e->getMessage(); |
3285 | 3285 | } |
3286 | 3286 | } |
@@ -3296,7 +3296,7 @@ discard block |
||
3296 | 3296 | $Connection = new Connection(); |
3297 | 3297 | $sth = $Connection->db->prepare($query); |
3298 | 3298 | $sth->execute(); |
3299 | - } catch(PDOException $e) { |
|
3299 | + } catch (PDOException $e) { |
|
3300 | 3300 | return "error : ".$e->getMessage(); |
3301 | 3301 | } |
3302 | 3302 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3311,7 +3311,7 @@ discard block |
||
3311 | 3311 | $Connection = new Connection(); |
3312 | 3312 | $sth = $Connection->db->prepare($query); |
3313 | 3313 | $sth->execute(); |
3314 | - } catch(PDOException $e) { |
|
3314 | + } catch (PDOException $e) { |
|
3315 | 3315 | return "error : ".$e->getMessage(); |
3316 | 3316 | } |
3317 | 3317 | } |
@@ -3327,7 +3327,7 @@ discard block |
||
3327 | 3327 | $Connection = new Connection(); |
3328 | 3328 | $sth = $Connection->db->prepare($query); |
3329 | 3329 | $sth->execute(); |
3330 | - } catch(PDOException $e) { |
|
3330 | + } catch (PDOException $e) { |
|
3331 | 3331 | return "error : ".$e->getMessage(); |
3332 | 3332 | } |
3333 | 3333 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3342,7 +3342,7 @@ discard block |
||
3342 | 3342 | $Connection = new Connection(); |
3343 | 3343 | $sth = $Connection->db->prepare($query); |
3344 | 3344 | $sth->execute(); |
3345 | - } catch(PDOException $e) { |
|
3345 | + } catch (PDOException $e) { |
|
3346 | 3346 | return "error : ".$e->getMessage(); |
3347 | 3347 | } |
3348 | 3348 | } |
@@ -3358,7 +3358,7 @@ discard block |
||
3358 | 3358 | $Connection = new Connection(); |
3359 | 3359 | $sth = $Connection->db->prepare($query); |
3360 | 3360 | $sth->execute(); |
3361 | - } catch(PDOException $e) { |
|
3361 | + } catch (PDOException $e) { |
|
3362 | 3362 | return "error : ".$e->getMessage(); |
3363 | 3363 | } |
3364 | 3364 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3373,7 +3373,7 @@ discard block |
||
3373 | 3373 | $Connection = new Connection(); |
3374 | 3374 | $sth = $Connection->db->prepare($query); |
3375 | 3375 | $sth->execute(); |
3376 | - } catch(PDOException $e) { |
|
3376 | + } catch (PDOException $e) { |
|
3377 | 3377 | return "error : ".$e->getMessage(); |
3378 | 3378 | } |
3379 | 3379 | } |
@@ -3389,7 +3389,7 @@ discard block |
||
3389 | 3389 | $Connection = new Connection(); |
3390 | 3390 | $sth = $Connection->db->prepare($query); |
3391 | 3391 | $sth->execute(); |
3392 | - } catch(PDOException $e) { |
|
3392 | + } catch (PDOException $e) { |
|
3393 | 3393 | return "error : ".$e->getMessage(); |
3394 | 3394 | } |
3395 | 3395 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3404,7 +3404,7 @@ discard block |
||
3404 | 3404 | $Connection = new Connection(); |
3405 | 3405 | $sth = $Connection->db->prepare($query); |
3406 | 3406 | $sth->execute(); |
3407 | - } catch(PDOException $e) { |
|
3407 | + } catch (PDOException $e) { |
|
3408 | 3408 | return "error : ".$e->getMessage(); |
3409 | 3409 | } |
3410 | 3410 | } |
@@ -3420,7 +3420,7 @@ discard block |
||
3420 | 3420 | $Connection = new Connection(); |
3421 | 3421 | $sth = $Connection->db->prepare($query); |
3422 | 3422 | $sth->execute(); |
3423 | - } catch(PDOException $e) { |
|
3423 | + } catch (PDOException $e) { |
|
3424 | 3424 | return "error : ".$e->getMessage(); |
3425 | 3425 | } |
3426 | 3426 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3439,7 +3439,7 @@ discard block |
||
3439 | 3439 | $Connection = new Connection(); |
3440 | 3440 | $sth = $Connection->db->prepare($query); |
3441 | 3441 | $sth->execute(); |
3442 | - } catch(PDOException $e) { |
|
3442 | + } catch (PDOException $e) { |
|
3443 | 3443 | return "error : ".$e->getMessage(); |
3444 | 3444 | } |
3445 | 3445 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3454,7 +3454,7 @@ discard block |
||
3454 | 3454 | $Connection = new Connection(); |
3455 | 3455 | $sth = $Connection->db->prepare($query); |
3456 | 3456 | $sth->execute(); |
3457 | - } catch(PDOException $e) { |
|
3457 | + } catch (PDOException $e) { |
|
3458 | 3458 | return "error : ".$e->getMessage(); |
3459 | 3459 | } |
3460 | 3460 | } |
@@ -3466,7 +3466,7 @@ discard block |
||
3466 | 3466 | $Connection = new Connection(); |
3467 | 3467 | $sth = $Connection->db->prepare($query); |
3468 | 3468 | $sth->execute(); |
3469 | - } catch(PDOException $e) { |
|
3469 | + } catch (PDOException $e) { |
|
3470 | 3470 | return "error : ".$e->getMessage(); |
3471 | 3471 | } |
3472 | 3472 | } |
@@ -3482,7 +3482,7 @@ discard block |
||
3482 | 3482 | $Connection = new Connection(); |
3483 | 3483 | $sth = $Connection->db->prepare($query); |
3484 | 3484 | $sth->execute(); |
3485 | - } catch(PDOException $e) { |
|
3485 | + } catch (PDOException $e) { |
|
3486 | 3486 | return "error : ".$e->getMessage(); |
3487 | 3487 | } |
3488 | 3488 | } |
@@ -3497,7 +3497,7 @@ discard block |
||
3497 | 3497 | $Connection = new Connection(); |
3498 | 3498 | $sth = $Connection->db->prepare($query); |
3499 | 3499 | $sth->execute(); |
3500 | - } catch(PDOException $e) { |
|
3500 | + } catch (PDOException $e) { |
|
3501 | 3501 | return "error : ".$e->getMessage(); |
3502 | 3502 | } |
3503 | 3503 | } |
@@ -16,24 +16,24 @@ discard block |
||
16 | 16 | $sql_date = ''; |
17 | 17 | if (isset($_GET['start_date'])) { |
18 | 18 | //for the date manipulation into the query |
19 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
19 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
20 | 20 | if (strtotime($_GET['start_date']) !== false && strtotime($_GET['end_date']) !== false) { |
21 | 21 | //$start_date = $_GET['start_date']." 00:00:00"; |
22 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
22 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
23 | 23 | //$end_date = $_GET['end_date']." 00:00:00"; |
24 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
24 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
25 | 25 | $sql_date = $start_date.",".$end_date; |
26 | 26 | } |
27 | - } else if($_GET['start_date'] != ""){ |
|
27 | + } else if ($_GET['start_date'] != "") { |
|
28 | 28 | if (strtotime($_GET['start_date']) !== false) { |
29 | 29 | //$start_date = $_GET['start_date']." 00:00:00"; |
30 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
30 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
31 | 31 | $sql_date = $start_date; |
32 | 32 | } |
33 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
33 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
34 | 34 | if (strtotime($_GET['end_date']) !== false) { |
35 | 35 | //$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00"; |
36 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
36 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
37 | 37 | $sql_date = $end_date; |
38 | 38 | } |
39 | 39 | } else $sql_date = ''; |
@@ -41,21 +41,21 @@ discard block |
||
41 | 41 | |
42 | 42 | if (isset($_GET['highest_altitude'])) { |
43 | 43 | //for altitude manipulation |
44 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
45 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
46 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
44 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
45 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
46 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | $sql_altitude = $start_altitude.",".$end_altitude; |
48 | - } else if($_GET['highest_altitude'] != ""){ |
|
49 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
48 | + } else if ($_GET['highest_altitude'] != "") { |
|
49 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
50 | 50 | $sql_altitude = $end_altitude; |
51 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
52 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
51 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
52 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
53 | 53 | $sql_altitude = $start_altitude; |
54 | 54 | } else $sql_altitude = ''; |
55 | 55 | } else $sql_altitude = ''; |
56 | 56 | |
57 | 57 | //calculuation for the pagination |
58 | -if(!isset($_GET['limit'])) |
|
58 | +if (!isset($_GET['limit'])) |
|
59 | 59 | { |
60 | 60 | if (!isset($_GET['number_results'])) |
61 | 61 | { |
@@ -63,45 +63,45 @@ discard block |
||
63 | 63 | $limit_end = 25; |
64 | 64 | $absolute_difference = 25; |
65 | 65 | } else { |
66 | - if ($_GET['number_results'] > 1000){ |
|
66 | + if ($_GET['number_results'] > 1000) { |
|
67 | 67 | $_GET['number_results'] = 1000; |
68 | 68 | } |
69 | 69 | $limit_start = 0; |
70 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
71 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
70 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
71 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
72 | 72 | } |
73 | -} else { |
|
73 | +} else { |
|
74 | 74 | $limit_explode = explode(",", $_GET['limit']); |
75 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
76 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
75 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
76 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
77 | 77 | } |
78 | 78 | $absolute_difference = abs($limit_start - $limit_end); |
79 | 79 | $limit_next = $limit_end + $absolute_difference; |
80 | 80 | $limit_previous_1 = $limit_start - $absolute_difference; |
81 | 81 | $limit_previous_2 = $limit_end - $absolute_difference; |
82 | 82 | |
83 | -if (!empty($_GET)){ |
|
84 | - $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
|
85 | - $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
|
86 | - $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
|
87 | - $manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING); |
|
88 | - $highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING); |
|
89 | - $airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING); |
|
90 | - $airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING); |
|
91 | - $airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING); |
|
92 | - $airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING); |
|
93 | - $airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING); |
|
94 | - $callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING); |
|
95 | - $owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING); |
|
96 | - $pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING); |
|
97 | - $pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING); |
|
98 | - $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING); |
|
99 | - $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
100 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
101 | - $archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT); |
|
102 | - $origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_NUMBER_FLOAT); |
|
103 | - $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_NUMBER_FLOAT); |
|
104 | - $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
|
83 | +if (!empty($_GET)) { |
|
84 | + $q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
85 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
86 | + $aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
87 | + $manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
88 | + $highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
89 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
90 | + $airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
91 | + $airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
92 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
93 | + $airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
94 | + $callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
95 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
96 | + $pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
97 | + $pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
98 | + $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
99 | + $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
100 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
101 | + $archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT); |
|
102 | + $origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_NUMBER_FLOAT); |
|
103 | + $origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_NUMBER_FLOAT); |
|
104 | + $dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT); |
|
105 | 105 | if ($dist != '') { |
106 | 106 | if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
107 | 107 | elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
@@ -109,9 +109,9 @@ discard block |
||
109 | 109 | if (!isset($sql_date)) $sql_date = ''; |
110 | 110 | if ($archive == 1) { |
111 | 111 | $SpotterArchive = new SpotterArchive(); |
112 | - $spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
112 | + $spotter_array = $SpotterArchive->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
113 | 113 | } else { |
114 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
114 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | print '<span class="sub-menu-statistic column mobile">'; |
@@ -144,12 +144,12 @@ discard block |
||
144 | 144 | //remove 3D=true parameter |
145 | 145 | $no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']); |
146 | 146 | $kmlURL = str_replace("http://", "kml://", $globalURL); |
147 | - if (!isset($_GET['3D'])){ |
|
147 | + if (!isset($_GET['3D'])) { |
|
148 | 148 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>'; |
149 | 149 | } else { |
150 | 150 | print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>'; |
151 | 151 | } |
152 | - if (isset($_GET['3D'])){ |
|
152 | + if (isset($_GET['3D'])) { |
|
153 | 153 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>'; |
154 | 154 | } else { |
155 | 155 | print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>'; |
@@ -170,30 +170,30 @@ discard block |
||
170 | 170 | print '<div class="column">'; |
171 | 171 | print '<div class="info">'; |
172 | 172 | print '<h1>'._("Search Results for").' '; |
173 | - if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$q.'</span> '; } |
|
174 | - if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
175 | - if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
176 | - if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
|
177 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
178 | - if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
|
179 | - if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
180 | - if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
181 | - if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$airport.'</span> '; } |
|
182 | - if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
183 | - if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
184 | - if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$owner.'</span> '; } |
|
185 | - if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
186 | - if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
187 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
188 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
189 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
190 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
191 | - if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
192 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
193 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
194 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
195 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
196 | - if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
173 | + if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$q.'</span> '; } |
|
174 | + if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
175 | + if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
176 | + if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$registration.'</span> '; } |
|
177 | + if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
178 | + if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$airline.'</span> '; } |
|
179 | + if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
180 | + if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
181 | + if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$airport.'</span> '; } |
|
182 | + if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
183 | + if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
184 | + if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$owner.'</span> '; } |
|
185 | + if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
186 | + if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
187 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
188 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
189 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
190 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
191 | + if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
192 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
193 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
194 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
195 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
196 | + if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
197 | 197 | print '</h1>'; |
198 | 198 | print '</div>'; |
199 | 199 | |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | </select> |
301 | 301 | </div> |
302 | 302 | </div> |
303 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
303 | + <script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
304 | 304 | <div class="form-group"> |
305 | 305 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
306 | 306 | <div class="col-sm-10"> |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | </select> |
310 | 310 | </div> |
311 | 311 | </div> |
312 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
312 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
313 | 313 | <div class="form-group"> |
314 | 314 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
315 | 315 | <div class="col-sm-10"> |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | </div> |
333 | 333 | </div> |
334 | 334 | <?php |
335 | -}else { |
|
335 | +} else { |
|
336 | 336 | ?> |
337 | 337 | <div class="form-group"> |
338 | 338 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
@@ -345,8 +345,8 @@ discard block |
||
345 | 345 | ?> |
346 | 346 | <div class="form-group"> |
347 | 347 | <div class="col-sm-offset-2 col-sm-10"> |
348 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
349 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
348 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
349 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
350 | 350 | </div> |
351 | 351 | </div> |
352 | 352 | </fieldset> |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | </select> |
361 | 361 | </div> |
362 | 362 | </div> |
363 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
363 | + <script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $airline; ?>');</script> |
|
364 | 364 | <div class="form-group"> |
365 | 365 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
366 | 366 | <div class="col-sm-10"> |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | </select> |
370 | 370 | </div> |
371 | 371 | </div> |
372 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
372 | + <script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
373 | 373 | <div class="form-group"> |
374 | 374 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
375 | 375 | <div class="col-sm-10"> |
@@ -378,10 +378,10 @@ discard block |
||
378 | 378 | </div> |
379 | 379 | <div class="form-group"> |
380 | 380 | <div class="col-sm-offset-2 col-sm-10"> |
381 | - <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
382 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
383 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
384 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
381 | + <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
382 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
383 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
384 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
385 | 385 | </div> |
386 | 386 | </div> |
387 | 387 | </fieldset> |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | </select> |
396 | 396 | </div> |
397 | 397 | </div> |
398 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
398 | + <script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
399 | 399 | <div class="form-group"> |
400 | 400 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
401 | 401 | <div class="col-sm-10"> |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | </select> |
405 | 405 | </div> |
406 | 406 | </div> |
407 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
407 | + <script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
408 | 408 | </fieldset> |
409 | 409 | <fieldset> |
410 | 410 | <legend><?php echo _("Route"); ?></legend> |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | </select> |
417 | 417 | </div> |
418 | 418 | </div> |
419 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
419 | + <script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
420 | 420 | <div class="form-group"> |
421 | 421 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
422 | 422 | <div class="col-sm-10"> |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | </select> |
426 | 426 | </div> |
427 | 427 | </div> |
428 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
428 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
429 | 429 | </fieldset> |
430 | 430 | <fieldset> |
431 | 431 | <legend><?php echo _("Date"); ?></legend> |
@@ -479,9 +479,9 @@ discard block |
||
479 | 479 | <option></option> |
480 | 480 | <?php |
481 | 481 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
482 | -foreach($altitude_array as $altitude) |
|
482 | +foreach ($altitude_array as $altitude) |
|
483 | 483 | { |
484 | - if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
484 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
485 | 485 | { |
486 | 486 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
487 | 487 | } else { |
@@ -499,9 +499,9 @@ discard block |
||
499 | 499 | <option></option> |
500 | 500 | <?php |
501 | 501 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
502 | -foreach($altitude_array as $altitude) |
|
502 | +foreach ($altitude_array as $altitude) |
|
503 | 503 | { |
504 | - if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
504 | + if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
505 | 505 | { |
506 | 506 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
507 | 507 | } else { |
@@ -540,10 +540,10 @@ discard block |
||
540 | 540 | <div class="col-sm-10"> |
541 | 541 | <select class="form-control" name="number_results"> |
542 | 542 | <?php |
543 | -$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
544 | -foreach($number_results_array as $number) |
|
543 | +$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
544 | +foreach ($number_results_array as $number) |
|
545 | 545 | { |
546 | - if(isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
546 | + if (isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
547 | 547 | { |
548 | 548 | print '<option value="'.$number.'" selected="selected">'.$number.'</option>'; |
549 | 549 | } else { |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | <fieldset> |
563 | 563 | <div class="form-group"> |
564 | 564 | <div class="col-sm-offset-2 col-sm-10"> |
565 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
565 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
566 | 566 | <p class="help-block">Disabled in demo</p> |
567 | 567 | </div> |
568 | 568 | </div> |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | <fieldset> |
574 | 574 | <div class="form-group"> |
575 | 575 | <div class="col-sm-offset-2 col-sm-10"> |
576 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
576 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
577 | 577 | </div> |
578 | 578 | </div> |
579 | 579 | </fieldset> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | require_once('require/class.Satellite.php'); |
6 | 6 | |
7 | -$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING); |
|
7 | +$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($trackident != '') { |
9 | 9 | require_once('require/class.SpotterLive.php'); |
10 | 10 | $SpotterLive = new SpotterLive(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident); |
15 | 15 | header('Location: '.$globalURL.'/flightid/'.$spotterid); |
16 | 16 | } else { |
17 | - setcookie('MapTrack',$resulttrackident[0]['flightaware_id']); |
|
17 | + setcookie('MapTrack', $resulttrackident[0]['flightaware_id']); |
|
18 | 18 | } |
19 | 19 | } else { |
20 | 20 | unset($_COOKIE['MapTrack']); |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | <div class="form-group"> |
195 | 195 | <label>From (UTC):</label> |
196 | 196 | <div class='input-group date' id='datetimepicker1'> |
197 | - <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 /> |
|
197 | + <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 /> |
|
198 | 198 | <span class="input-group-addon"> |
199 | 199 | <span class="glyphicon glyphicon-calendar"></span> |
200 | 200 | </span> |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | <div class="form-group"> |
204 | 204 | <label>To (UTC):</label> |
205 | 205 | <div class='input-group date' id='datetimepicker2'> |
206 | - <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']); ?>" /> |
|
206 | + <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']); ?>" /> |
|
207 | 207 | <span class="input-group-addon"> |
208 | 208 | <span class="glyphicon glyphicon-calendar"></span> |
209 | 209 | </span> |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | <li><?php echo _("Type of Terrain:"); ?> |
328 | 328 | <select class="selectpicker" onchange="terrainType(this);"> |
329 | 329 | <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
330 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
331 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
332 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
330 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option> |
|
331 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option> |
|
332 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option> |
|
333 | 333 | </select> |
334 | 334 | </li> |
335 | 335 | <?php |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | <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> |
366 | 366 | <?php |
367 | 367 | } |
368 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
368 | + if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) { |
|
369 | 369 | ?> |
370 | 370 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
371 | 371 | <?php |
@@ -541,10 +541,10 @@ discard block |
||
541 | 541 | $Spotter = new Spotter(); |
542 | 542 | $allairlinenames = $Spotter->getAllAirlineNames(); |
543 | 543 | } |
544 | - foreach($allairlinenames as $airline) { |
|
544 | + foreach ($allairlinenames as $airline) { |
|
545 | 545 | $airline_name = $airline['airline_name']; |
546 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
547 | - if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
|
546 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
547 | + if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) { |
|
548 | 548 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
549 | 549 | } else { |
550 | 550 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
564 | 564 | <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
565 | 565 | <?php |
566 | - foreach($allalliancenames as $alliance) { |
|
566 | + foreach ($allalliancenames as $alliance) { |
|
567 | 567 | $alliance_name = $alliance['alliance']; |
568 | 568 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) { |
569 | 569 | echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>'; |
@@ -599,8 +599,8 @@ discard block |
||
599 | 599 | */ |
600 | 600 | $Source = new Source(); |
601 | 601 | $datasource = $Source->getLocationInfoByType('gs'); |
602 | - foreach($datasource as $src) { |
|
603 | - if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) { |
|
602 | + foreach ($datasource as $src) { |
|
603 | + if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) { |
|
604 | 604 | echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>'; |
605 | 605 | } else { |
606 | 606 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
680 | 680 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
681 | 681 | |
682 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
682 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
683 | 683 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
684 | 684 | } else { |
685 | 685 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |