@@ -86,7 +86,9 @@ discard block |
||
86 | 86 | return $result; |
87 | 87 | } |
88 | 88 | $handle = @opendir(dirname(__FILE__).'/../locale'); |
89 | - if ($handle === false) return $result; |
|
89 | + if ($handle === false) { |
|
90 | + return $result; |
|
91 | + } |
|
90 | 92 | while (false !== ($file = readdir($handle))) { |
91 | 93 | $path = dirname(__FILE__).'/../locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
92 | 94 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -113,7 +115,9 @@ discard block |
||
113 | 115 | $allAvailableLanguages = array(); |
114 | 116 | $currentLocal = setlocale(LC_ALL, 0); |
115 | 117 | foreach ($available as $lang) { |
116 | - if (isset($this->all_languages[$lang]) && (setlocale(LC_ALL,$this->getLocale($lang)) || $lang = 'en_GB')) $allAvailableLanguages[$lang] = $this->all_languages[$lang]; |
|
118 | + if (isset($this->all_languages[$lang]) && (setlocale(LC_ALL,$this->getLocale($lang)) || $lang = 'en_GB')) { |
|
119 | + $allAvailableLanguages[$lang] = $this->all_languages[$lang]; |
|
120 | + } |
|
117 | 121 | } |
118 | 122 | setlocale(LC_ALL,$currentLocal); |
119 | 123 | return $allAvailableLanguages; |
@@ -25,12 +25,10 @@ discard block |
||
25 | 25 | if ($tracker) { |
26 | 26 | require_once('require/class.Tracker.php'); |
27 | 27 | require_once('require/class.TrackerArchive.php'); |
28 | -} |
|
29 | -elseif ($marine) { |
|
28 | +} elseif ($marine) { |
|
30 | 29 | require_once('require/class.Marine.php'); |
31 | 30 | require_once('require/class.MarineArchive.php'); |
32 | -} |
|
33 | -else { |
|
31 | +} else { |
|
34 | 32 | require_once('require/class.Spotter.php'); |
35 | 33 | require_once('require/class.SpotterArchive.php'); |
36 | 34 | } |
@@ -38,12 +36,10 @@ discard block |
||
38 | 36 | if ($tracker) { |
39 | 37 | $Tracker = new Tracker(); |
40 | 38 | $TrackerArchive = new TrackerArchive(); |
41 | -} |
|
42 | -elseif ($marine) { |
|
39 | +} elseif ($marine) { |
|
43 | 40 | $Marine = new Marine(); |
44 | 41 | $MarineArchive = new MarineArchive(); |
45 | -} |
|
46 | -else { |
|
42 | +} else { |
|
47 | 43 | $Spotter = new Spotter(); |
48 | 44 | $SpotterArchive = new SpotterArchive(); |
49 | 45 | } |
@@ -56,66 +52,92 @@ discard block |
||
56 | 52 | } |
57 | 53 | header('Content-Type: text/javascript'); |
58 | 54 | |
59 | -if (!isset($globalJsonCompress)) $compress = true; |
|
60 | -else $compress = $globalJsonCompress; |
|
55 | +if (!isset($globalJsonCompress)) { |
|
56 | + $compress = true; |
|
57 | +} else { |
|
58 | + $compress = $globalJsonCompress; |
|
59 | +} |
|
61 | 60 | |
62 | 61 | $from_archive = false; |
63 | 62 | $min = false; |
64 | 63 | $allhistory = false; |
65 | 64 | $filter['source'] = array(); |
66 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
71 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
66 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
67 | +} |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
69 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
70 | +} |
|
71 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
72 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
73 | +} |
|
74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
75 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
76 | +} |
|
77 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
78 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
79 | +} |
|
80 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
81 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | +} |
|
83 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
84 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
85 | +} |
|
86 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
87 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
88 | +} |
|
89 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
90 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
91 | +} |
|
92 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
93 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
94 | +} |
|
95 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
96 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
97 | +} |
|
77 | 98 | |
78 | 99 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
79 | 100 | $min = true; |
80 | -} else $min = false; |
|
101 | +} else { |
|
102 | + $min = false; |
|
103 | +} |
|
81 | 104 | |
82 | 105 | if (isset($_GET['ident'])) { |
83 | 106 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
84 | 107 | $from_archive = true; |
85 | 108 | if ($tracker) { |
86 | 109 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
87 | - } |
|
88 | - elseif ($marine) { |
|
110 | + } elseif ($marine) { |
|
89 | 111 | $spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident); |
90 | - } |
|
91 | - else { |
|
112 | + } else { |
|
92 | 113 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
93 | 114 | } |
94 | 115 | $allhistory = true; |
95 | -} |
|
96 | -elseif (isset($_GET['flightaware_id'])) { |
|
116 | +} elseif (isset($_GET['flightaware_id'])) { |
|
97 | 117 | $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
98 | 118 | $from_archive = true; |
99 | 119 | if ($tracker) { |
100 | 120 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
101 | - } |
|
102 | - elseif ($marine) { |
|
121 | + } elseif ($marine) { |
|
103 | 122 | $spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id); |
104 | - } |
|
105 | - else { |
|
123 | + } else { |
|
106 | 124 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
107 | 125 | } |
108 | 126 | $allhistory = true; |
109 | -} |
|
110 | -elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
127 | +} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
111 | 128 | $from_archive = true; |
112 | 129 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
113 | - if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
|
114 | - else $begindate = $begindate - 3000; |
|
130 | + if (isset($globalAircraftMaxUpdate)) { |
|
131 | + $begindate = $begindate - $globalAircraftMaxUpdate; |
|
132 | + } else { |
|
133 | + $begindate = $begindate - 3000; |
|
134 | + } |
|
115 | 135 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
116 | 136 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
117 | 137 | $part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT); |
118 | - if ($part == '') $part = 0; |
|
138 | + if ($part == '') { |
|
139 | + $part = 0; |
|
140 | + } |
|
119 | 141 | |
120 | 142 | if ($begindate != '' && $enddate != '') { |
121 | 143 | $begindate = date('Y-m-d H:i:s',$begindate); |
@@ -123,11 +145,9 @@ discard block |
||
123 | 145 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
124 | 146 | if ($tracker) { |
125 | 147 | $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
126 | - } |
|
127 | - elseif ($marine) { |
|
148 | + } elseif ($marine) { |
|
128 | 149 | $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
129 | - } |
|
130 | - else { |
|
150 | + } else { |
|
131 | 151 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part); |
132 | 152 | } |
133 | 153 | } |
@@ -136,8 +156,12 @@ discard block |
||
136 | 156 | if (!empty($spotter_array)) { |
137 | 157 | //$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
138 | 158 | $flightcnt = 0; |
139 | - if ($flightcnt == '') $flightcnt = 0; |
|
140 | -} else $flightcnt = 0; |
|
159 | + if ($flightcnt == '') { |
|
160 | + $flightcnt = 0; |
|
161 | + } |
|
162 | + } else { |
|
163 | + $flightcnt = 0; |
|
164 | +} |
|
141 | 165 | |
142 | 166 | $sqltime = round(microtime(true)-$begintime,2); |
143 | 167 | |
@@ -147,8 +171,11 @@ discard block |
||
147 | 171 | $aircrafts_shadow = array(); |
148 | 172 | $output = '{'; |
149 | 173 | $output .= '"type": "FeatureCollection",'; |
150 | -if ($min) $output .= '"minimal": "true",'; |
|
151 | -else $output .= '"minimal": "false",'; |
|
174 | +if ($min) { |
|
175 | + $output .= '"minimal": "true",'; |
|
176 | +} else { |
|
177 | + $output .= '"minimal": "false",'; |
|
178 | +} |
|
152 | 179 | $output .= '"fc": "'.$flightcnt.'",'; |
153 | 180 | $output .= '"sqt": "'.$sqltime.'",'; |
154 | 181 | $begin = true; |
@@ -161,15 +188,17 @@ discard block |
||
161 | 188 | if ($pfi != $spotter_item['famtrackid']) { |
162 | 189 | $pfi = $spotter_item['famtrackid']; |
163 | 190 | $begin = true; |
164 | - } else $spotter_history_array = 0; |
|
165 | - } |
|
166 | - elseif ($marine) { |
|
191 | + } else { |
|
192 | + $spotter_history_array = 0; |
|
193 | + } |
|
194 | + } elseif ($marine) { |
|
167 | 195 | if ($pfi != $spotter_item['fammarine_d']) { |
168 | 196 | $pfi = $spotter_item['fammarine_id']; |
169 | 197 | $begin = true; |
170 | - } else $spotter_history_array = 0; |
|
171 | - } |
|
172 | - else { |
|
198 | + } else { |
|
199 | + $spotter_history_array = 0; |
|
200 | + } |
|
201 | + } else { |
|
173 | 202 | if ($pfi != $spotter_item['flightaware_id']) { |
174 | 203 | $pfi = $spotter_item['flightaware_id']; |
175 | 204 | $begin = true; |
@@ -206,7 +235,9 @@ discard block |
||
206 | 235 | $output_history .= '['.$spotter_item['longitude'].', '.$spotter_item['latitude'].'],'; |
207 | 236 | $output_time .= (strtotime($spotter_item['date'])*1000).','; |
208 | 237 | $previousts = strtotime($spotter_item['date']); |
209 | - if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) $end = true; |
|
238 | + if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) { |
|
239 | + $end = true; |
|
240 | + } |
|
210 | 241 | } |
211 | 242 | |
212 | 243 | if ($begin) { |
@@ -216,7 +247,9 @@ discard block |
||
216 | 247 | $output .= '"type": "Feature",'; |
217 | 248 | $output .= '"properties": {'; |
218 | 249 | $output .= '"fi": "'.$pfi.'",'; |
219 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
250 | + if (isset($begindate)) { |
|
251 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
252 | + } |
|
220 | 253 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
221 | 254 | $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
222 | 255 | //" |
@@ -224,14 +257,20 @@ discard block |
||
224 | 257 | $output .= '"c": "NA",'; |
225 | 258 | } |
226 | 259 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
227 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
228 | - else { |
|
260 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
261 | + $spotter_item['aircraft_shadow'] = ''; |
|
262 | + } else { |
|
229 | 263 | $aircraft_icao = $spotter_item['aircraft_icao']; |
230 | 264 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
231 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
232 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
233 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
234 | - else $spotter_item['aircraft_shadow'] = ''; |
|
265 | + if (count($aircraft_info) > 0) { |
|
266 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
267 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
268 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
269 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
270 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
271 | + } else { |
|
272 | + $spotter_item['aircraft_shadow'] = ''; |
|
273 | + } |
|
235 | 274 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
236 | 275 | } |
237 | 276 | } |
@@ -239,93 +278,139 @@ discard block |
||
239 | 278 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
240 | 279 | if ($tracker) { |
241 | 280 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
242 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
243 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
244 | - } |
|
245 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
246 | - if ($compress) $output .= '"as": "police.png",'; |
|
247 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
248 | - } |
|
249 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
250 | - if ($compress) $output .= '"as": "ship.png",'; |
|
251 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
252 | - } |
|
253 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
254 | - if ($compress) $output .= '"as": "ship.png",'; |
|
255 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
256 | - } |
|
257 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
258 | - if ($compress) $output .= '"as": "ship.png",'; |
|
259 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
281 | + if ($compress) { |
|
282 | + $output .= '"as": "ambulance.png",'; |
|
283 | + } else { |
|
284 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
285 | + } |
|
286 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
287 | + if ($compress) { |
|
288 | + $output .= '"as": "police.png",'; |
|
289 | + } else { |
|
290 | + $output .= '"aircraft_shadow": "police.png",'; |
|
291 | + } |
|
292 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
293 | + if ($compress) { |
|
294 | + $output .= '"as": "ship.png",'; |
|
295 | + } else { |
|
296 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
297 | + } |
|
298 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
299 | + if ($compress) { |
|
300 | + $output .= '"as": "ship.png",'; |
|
301 | + } else { |
|
302 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
303 | + } |
|
304 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
305 | + if ($compress) { |
|
306 | + $output .= '"as": "ship.png",'; |
|
307 | + } else { |
|
308 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
309 | + } |
|
310 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
311 | + if ($compress) { |
|
312 | + $output .= '"as": "truck.png",'; |
|
313 | + } else { |
|
314 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
315 | + } |
|
316 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
317 | + if ($compress) { |
|
318 | + $output .= '"as": "truck.png",'; |
|
319 | + } else { |
|
320 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
321 | + } |
|
322 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
323 | + if ($compress) { |
|
324 | + $output .= '"as": "aircraft.png",'; |
|
325 | + } else { |
|
326 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
327 | + } |
|
328 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
329 | + if ($compress) { |
|
330 | + $output .= '"as": "aircraft.png",'; |
|
331 | + } else { |
|
332 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
333 | + } |
|
334 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
335 | + if ($compress) { |
|
336 | + $output .= '"as": "helico.png",'; |
|
337 | + } else { |
|
338 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
339 | + } |
|
340 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
341 | + if ($compress) { |
|
342 | + $output .= '"as": "rail.png",'; |
|
343 | + } else { |
|
344 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
345 | + } |
|
346 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
347 | + if ($compress) { |
|
348 | + $output .= '"as": "firetruck.png",'; |
|
349 | + } else { |
|
350 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
351 | + } |
|
352 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
353 | + if ($compress) { |
|
354 | + $output .= '"as": "bus.png",'; |
|
355 | + } else { |
|
356 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
357 | + } |
|
358 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
359 | + if ($compress) { |
|
360 | + $output .= '"as": "phone.png",'; |
|
361 | + } else { |
|
362 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
363 | + } |
|
364 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
365 | + if ($compress) { |
|
366 | + $output .= '"as": "jogger.png",'; |
|
367 | + } else { |
|
368 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
369 | + } |
|
370 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
371 | + if ($compress) { |
|
372 | + $output .= '"as": "bike.png",'; |
|
373 | + } else { |
|
374 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
375 | + } |
|
376 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
377 | + if ($compress) { |
|
378 | + $output .= '"as": "motorcycle.png",'; |
|
379 | + } else { |
|
380 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
381 | + } |
|
382 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
383 | + if ($compress) { |
|
384 | + $output .= '"as": "balloon.png",'; |
|
385 | + } else { |
|
386 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
387 | + } |
|
388 | + } else { |
|
389 | + if ($compress) { |
|
390 | + $output .= '"as": "car.png",'; |
|
391 | + } else { |
|
392 | + $output .= '"aircraft_shadow": "car.png",'; |
|
393 | + } |
|
260 | 394 | } |
261 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
262 | - if ($compress) $output .= '"as": "truck.png",'; |
|
263 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
395 | + } elseif ($marine) { |
|
396 | + if ($compress) { |
|
397 | + $output .= '"as": "ship.png",'; |
|
398 | + } else { |
|
399 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
264 | 400 | } |
265 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
266 | - if ($compress) $output .= '"as": "truck.png",'; |
|
267 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
268 | - } |
|
269 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
270 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
271 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
272 | - } |
|
273 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
274 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
275 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
276 | - } |
|
277 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
278 | - if ($compress) $output .= '"as": "helico.png",'; |
|
279 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
280 | - } |
|
281 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
282 | - if ($compress) $output .= '"as": "rail.png",'; |
|
283 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
284 | - } |
|
285 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
286 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
287 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
288 | - } |
|
289 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
290 | - if ($compress) $output .= '"as": "bus.png",'; |
|
291 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
292 | - } |
|
293 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
294 | - if ($compress) $output .= '"as": "phone.png",'; |
|
295 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
296 | - } |
|
297 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
298 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
299 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
300 | - } |
|
301 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
302 | - if ($compress) $output .= '"as": "bike.png",'; |
|
303 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
304 | - } |
|
305 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
306 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
307 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
308 | - } |
|
309 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
310 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
311 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
312 | - } |
|
313 | - else { |
|
314 | - if ($compress) $output .= '"as": "car.png",'; |
|
315 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
401 | + } else { |
|
402 | + if ($compress) { |
|
403 | + $output .= '"as": "default.png",'; |
|
404 | + } else { |
|
405 | + $output .= '"aircraft_shadow": "default.png",'; |
|
316 | 406 | } |
317 | 407 | } |
318 | - elseif ($marine) { |
|
319 | - if ($compress) $output .= '"as": "ship.png",'; |
|
320 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
321 | - } |
|
322 | - else { |
|
323 | - if ($compress) $output .= '"as": "default.png",'; |
|
324 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
325 | - } |
|
326 | 408 | } else { |
327 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
328 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
409 | + if ($compress) { |
|
410 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
411 | + } else { |
|
412 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
413 | + } |
|
329 | 414 | } |
330 | 415 | |
331 | 416 | if (isset($spotter_item['date_iso_8601'])) { |
@@ -373,7 +458,9 @@ discard block |
||
373 | 458 | $output .= ']'; |
374 | 459 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
375 | 460 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
376 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
461 | + if (isset($begindate)) { |
|
462 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
463 | + } |
|
377 | 464 | $output .= '"fc": "'.$flightcnt.'"'; |
378 | 465 | } else { |
379 | 466 | $output .= '"features": '; |
@@ -123,15 +123,21 @@ discard block |
||
123 | 123 | { |
124 | 124 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']); |
125 | 125 | $ident = $spotter_array[0]['ident']; |
126 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
127 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
126 | + if (isset($spotter_array[0]['latitude'])) { |
|
127 | + $latitude = $spotter_array[0]['latitude']; |
|
128 | + } |
|
129 | + if (isset($spotter_array[0]['longitude'])) { |
|
130 | + $longitude = $spotter_array[0]['longitude']; |
|
131 | + } |
|
128 | 132 | require_once('header.php'); |
129 | 133 | if (isset($globalArchive) && $globalArchive && $type == 'aircraft') { |
130 | 134 | // Requirement for altitude graph |
131 | 135 | $all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']); |
132 | 136 | if (isset($globalTimezone)) { |
133 | 137 | date_default_timezone_set($globalTimezone); |
134 | - } else date_default_timezone_set('UTC'); |
|
138 | + } else { |
|
139 | + date_default_timezone_set('UTC'); |
|
140 | + } |
|
135 | 141 | if (is_array($all_data) && count($all_data) > 1) { |
136 | 142 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
137 | 143 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -205,18 +211,28 @@ discard block |
||
205 | 211 | print '<br/><br/><br/>'; |
206 | 212 | print '<h1>'.$spotter_array[0]['ident'].'</h1>'; |
207 | 213 | print '<div><span class="label">'._("Ident").'</span>'.$spotter_array[0]['ident'].'</div>'; |
208 | - if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) print '<div>'._("Callsign is in blocked FAA list").'</div>'; |
|
214 | + if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) { |
|
215 | + print '<div>'._("Callsign is in blocked FAA list").'</div>'; |
|
216 | + } |
|
209 | 217 | if (isset($spotter_array[0]['airline_icao'])) { |
210 | 218 | print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>'; |
211 | 219 | } |
212 | - if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>'; |
|
220 | + if ($type == 'aircraft') { |
|
221 | + print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>'; |
|
222 | + } |
|
213 | 223 | print '</div>'; |
214 | 224 | |
215 | - if ($type == 'aircraft') include('ident-sub-menu.php'); |
|
225 | + if ($type == 'aircraft') { |
|
226 | + include('ident-sub-menu.php'); |
|
227 | + } |
|
216 | 228 | print '<div class="table column">'; |
217 | - if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
218 | - elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
219 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
229 | + if ($type == 'aircraft') { |
|
230 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
231 | + } elseif ($type == 'marine') { |
|
232 | + print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
233 | + } elseif ($type == 'tracker') { |
|
234 | + print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
235 | + } |
|
220 | 236 | |
221 | 237 | include('table-output.php'); |
222 | 238 | print '<div class="pagination">'; |
@@ -58,7 +58,9 @@ discard block |
||
58 | 58 | { |
59 | 59 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
60 | 60 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
61 | - } else $image = $spotter_item['image_thumbnail']; |
|
61 | + } else { |
|
62 | + $image = $spotter_item['image_thumbnail']; |
|
63 | + } |
|
62 | 64 | } |
63 | 65 | /* else { |
64 | 66 | $image = "images/placeholder_thumb.png"; |
@@ -75,10 +77,14 @@ discard block |
||
75 | 77 | print '<div class="callsign-details">'; |
76 | 78 | if ($spotter_item['ident'] != 'Not Available') { |
77 | 79 | print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a>'; |
78 | - if (isset($spotter_item['blocked']) && $spotter_item['blocked'] === true) print '<img src="'.$globalURL.'/images/forbidden.png" title="'._("Callsign is in blocked FAA list").'" class="blocked" />'; |
|
80 | + if (isset($spotter_item['blocked']) && $spotter_item['blocked'] === true) { |
|
81 | + print '<img src="'.$globalURL.'/images/forbidden.png" title="'._("Callsign is in blocked FAA list").'" class="blocked" />'; |
|
82 | + } |
|
79 | 83 | print '</div>'; |
80 | 84 | } |
81 | - if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
85 | + if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') { |
|
86 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
87 | + } |
|
82 | 88 | print '</div>'; |
83 | 89 | if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') { |
84 | 90 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
@@ -110,15 +116,25 @@ discard block |
||
110 | 116 | print '</div>'; |
111 | 117 | print '<div id="aircraft">'; |
112 | 118 | print '<span>'._("Aircraft").'</span>'; |
113 | - if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
119 | + if (isset($spotter_item['aircraft_wiki'])) { |
|
120 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
121 | + } |
|
114 | 122 | if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
115 | 123 | $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
116 | - if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
117 | - else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
118 | - } elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
119 | - else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
124 | + if (count($aircraft_names) == 1) { |
|
125 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
126 | + } else { |
|
127 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
128 | + } |
|
129 | + } elseif (isset($spotter_item['aircraft_type'])) { |
|
130 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
131 | + } else { |
|
132 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
133 | + } |
|
120 | 134 | print '</div>'; |
121 | - if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
135 | + if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
136 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
137 | + } |
|
122 | 138 | |
123 | 139 | print '<div id="altitude"><span>'._("Altitude").'</span>'; |
124 | 140 | if (isset($globalGroundAltitude) && $globalGroundAltitude) { |
@@ -131,11 +147,17 @@ discard block |
||
131 | 147 | |
132 | 148 | print '<span class="altitude">'; |
133 | 149 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
134 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
135 | - else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
150 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
151 | + print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
152 | + } else { |
|
153 | + print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
154 | + } |
|
136 | 155 | } else { |
137 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
138 | - else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
156 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
157 | + print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
158 | + } else { |
|
159 | + print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
160 | + } |
|
139 | 161 | } |
140 | 162 | print '</span>'; |
141 | 163 | |
@@ -200,8 +222,11 @@ discard block |
||
200 | 222 | } |
201 | 223 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
202 | 224 | print '<div id="pilot"><span>'._("Pilot").'</span>'; |
203 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
204 | - else print $spotter_item['pilot_name']; |
|
225 | + if (isset($spotter_item['pilot_id'])) { |
|
226 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
227 | + } else { |
|
228 | + print $spotter_item['pilot_name']; |
|
229 | + } |
|
205 | 230 | print '</div>'; |
206 | 231 | } |
207 | 232 | if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') { |
@@ -227,10 +252,18 @@ discard block |
||
227 | 252 | } |
228 | 253 | print '</div>'; |
229 | 254 | print '</div>'; |
230 | - if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
231 | - if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
232 | - if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
233 | - if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
255 | + if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') { |
|
256 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
257 | + } |
|
258 | + if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
259 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
260 | + } |
|
261 | + if (isset($spotter_item['acars']['message'])) { |
|
262 | + print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
263 | + } |
|
264 | + if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
265 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
266 | + } |
|
234 | 267 | print '</div>'; |
235 | 268 | } |
236 | 269 | ?> |
@@ -73,8 +73,11 @@ discard block |
||
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
75 | 75 | $sth->closeCursor(); |
76 | - if ($row['nb'] > 0) return false; |
|
77 | - else return true; |
|
76 | + if ($row['nb'] > 0) { |
|
77 | + return false; |
|
78 | + } else { |
|
79 | + return true; |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | /* |
@@ -104,29 +107,48 @@ discard block |
||
104 | 107 | //$pieces = explode(' ',$data); |
105 | 108 | $pieces = preg_split('/\s/',$data); |
106 | 109 | $pos = 0; |
107 | - if ($pieces[0] == 'METAR') $pos++; |
|
108 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
109 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
110 | + if ($pieces[0] == 'METAR') { |
|
111 | + $pos++; |
|
112 | + } elseif ($pieces[0] == 'SPECI') { |
|
113 | + $pos++; |
|
114 | + } |
|
115 | + if (strlen($pieces[$pos]) != 4) { |
|
116 | + $pos++; |
|
117 | + } |
|
110 | 118 | $result = array(); |
111 | - if (!isset($pieces[$pos])) return $result; |
|
119 | + if (!isset($pieces[$pos])) { |
|
120 | + return $result; |
|
121 | + } |
|
112 | 122 | $result['location'] = $pieces[$pos]; |
113 | 123 | $pos++; |
114 | - if (!isset($pieces[$pos])) return $result; |
|
124 | + if (!isset($pieces[$pos])) { |
|
125 | + return $result; |
|
126 | + } |
|
115 | 127 | $result['dayofmonth'] = substr($pieces[$pos],0,2); |
116 | 128 | $result['time'] = substr($pieces[$pos],2,4); |
117 | 129 | $c = count($pieces); |
118 | 130 | for($pos++; $pos < $c; $pos++) { |
119 | 131 | $piece = $pieces[$pos]; |
120 | - if ($piece == 'RMK') break; |
|
121 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
122 | - if ($piece == 'COR') $result['correction'] = true; |
|
132 | + if ($piece == 'RMK') { |
|
133 | + break; |
|
134 | + } |
|
135 | + if ($piece == 'AUTO') { |
|
136 | + $result['auto'] = true; |
|
137 | + } |
|
138 | + if ($piece == 'COR') { |
|
139 | + $result['correction'] = true; |
|
140 | + } |
|
123 | 141 | // Wind Speed |
124 | 142 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
125 | 143 | $result['wind']['direction'] = (float)$matches[1]; |
126 | 144 | $result['wind']['unit'] = $matches[4]; |
127 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
128 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
129 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
145 | + if ($result['wind']['unit'] == 'KT') { |
|
146 | + $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
147 | + } elseif ($result['wind']['unit'] == 'KPH') { |
|
148 | + $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
149 | + } elseif ($result['wind']['unit'] == 'MPS') { |
|
150 | + $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
151 | + } |
|
130 | 152 | $result['wind']['gust'] = (float)$matches[3]; |
131 | 153 | $result['wind']['unit'] = $matches[4]; |
132 | 154 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
@@ -210,27 +232,49 @@ discard block |
||
210 | 232 | //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
211 | 233 | $type = $matches[1]; |
212 | 234 | $cloud = array(); |
213 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
214 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
215 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
216 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
217 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
218 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
219 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
220 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
235 | + if ($type == 'SKC') { |
|
236 | + $cloud['type'] = 'No cloud/Sky clear'; |
|
237 | + } elseif ($type == 'CLR') { |
|
238 | + $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
239 | + } elseif ($type == 'NSC') { |
|
240 | + $cloud['type'] = 'No significant cloud'; |
|
241 | + } elseif ($type == 'FEW') { |
|
242 | + $cloud['type'] = 'Few'; |
|
243 | + } elseif ($type == 'SCT') { |
|
244 | + $cloud['type'] = 'Scattered'; |
|
245 | + } elseif ($type == 'BKN') { |
|
246 | + $cloud['type'] = 'Broken'; |
|
247 | + } elseif ($type == 'OVC') { |
|
248 | + $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
249 | + } elseif ($type == 'VV') { |
|
250 | + $cloud['type'] = 'Vertical visibility'; |
|
251 | + } |
|
221 | 252 | $cloud['type_code'] = $type; |
222 | 253 | $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
223 | - if (isset($matches[3])) $significant = $matches[3]; |
|
224 | - else $significant = ''; |
|
225 | - if ($significant == 'CB') $cloud['significant'] = 'Cumulonimbus'; |
|
226 | - elseif ($significant == 'AC') $cloud['significant'] = 'Altocumulus'; |
|
227 | - elseif ($significant == 'CBS') $cloud['significant'] = 'Cumulonimbus'; |
|
228 | - elseif ($significant == 'CC') $cloud['significant'] = 'Cirrocumulus'; |
|
229 | - elseif ($significant == 'CU') $cloud['significant'] = 'Cumulus'; |
|
230 | - elseif ($significant == 'CI') $cloud['significant'] = 'Cirrus'; |
|
231 | - elseif ($significant == 'CS') $cloud['significant'] = 'Cirrostratus'; |
|
232 | - elseif ($significant == 'TCU') $cloud['significant'] = 'Towering Cumulus'; |
|
233 | - else $cloud['significant'] = $significant; |
|
254 | + if (isset($matches[3])) { |
|
255 | + $significant = $matches[3]; |
|
256 | + } else { |
|
257 | + $significant = ''; |
|
258 | + } |
|
259 | + if ($significant == 'CB') { |
|
260 | + $cloud['significant'] = 'Cumulonimbus'; |
|
261 | + } elseif ($significant == 'AC') { |
|
262 | + $cloud['significant'] = 'Altocumulus'; |
|
263 | + } elseif ($significant == 'CBS') { |
|
264 | + $cloud['significant'] = 'Cumulonimbus'; |
|
265 | + } elseif ($significant == 'CC') { |
|
266 | + $cloud['significant'] = 'Cirrocumulus'; |
|
267 | + } elseif ($significant == 'CU') { |
|
268 | + $cloud['significant'] = 'Cumulus'; |
|
269 | + } elseif ($significant == 'CI') { |
|
270 | + $cloud['significant'] = 'Cirrus'; |
|
271 | + } elseif ($significant == 'CS') { |
|
272 | + $cloud['significant'] = 'Cirrostratus'; |
|
273 | + } elseif ($significant == 'TCU') { |
|
274 | + $cloud['significant'] = 'Towering Cumulus'; |
|
275 | + } else { |
|
276 | + $cloud['significant'] = $significant; |
|
277 | + } |
|
234 | 278 | //$cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
235 | 279 | $result['cloud'][] = $cloud; |
236 | 280 | } |
@@ -254,8 +298,11 @@ discard block |
||
254 | 298 | $result['RVR']['friction'] = $matches[5]; |
255 | 299 | } |
256 | 300 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
257 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
258 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
301 | + if (isset($matches[5])) { |
|
302 | + $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
303 | + } else { |
|
304 | + $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
305 | + } |
|
259 | 306 | if (isset($matches[3])) { |
260 | 307 | $range = Array( |
261 | 308 | 'from' => (float)$matches[2], |
@@ -288,8 +335,11 @@ discard block |
||
288 | 335 | if (isset($matches[3])) { |
289 | 336 | $text[] = $this->texts[$matches[3]]; |
290 | 337 | } |
291 | - if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
|
292 | - else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
338 | + if (!isset($result['weather'])) { |
|
339 | + $result['weather'] = implode(' ', $text); |
|
340 | + } else { |
|
341 | + $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
342 | + } |
|
293 | 343 | } |
294 | 344 | } |
295 | 345 | return $result; |
@@ -305,8 +355,11 @@ discard block |
||
305 | 355 | if (isset($globalMETARcycle) && $globalMETARcycle) { |
306 | 356 | $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
307 | 357 | } else { |
308 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
309 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
358 | + if ($globalDBdriver == 'mysql') { |
|
359 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
360 | + } else { |
|
361 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
362 | + } |
|
310 | 363 | } |
311 | 364 | $query_values = array(':icao' => $icao); |
312 | 365 | try { |
@@ -378,7 +431,9 @@ discard block |
||
378 | 431 | */ |
379 | 432 | public function addMETARCycle() { |
380 | 433 | global $globalDebug, $globalIVAO, $globalTransaction; |
381 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
434 | + if (isset($globalDebug) && $globalDebug) { |
|
435 | + echo "Downloading METAR cycle..."; |
|
436 | + } |
|
382 | 437 | date_default_timezone_set("UTC"); |
383 | 438 | $Common = new Common(); |
384 | 439 | if (isset($globalIVAO) && $globalIVAO) { |
@@ -389,28 +444,42 @@ discard block |
||
389 | 444 | $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
390 | 445 | } |
391 | 446 | if ($handle) { |
392 | - if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
447 | + if (isset($globalDebug) && $globalDebug) { |
|
448 | + echo "Done - Updating DB..."; |
|
449 | + } |
|
393 | 450 | $date = ''; |
394 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
451 | + if ($globalTransaction) { |
|
452 | + $this->db->beginTransaction(); |
|
453 | + } |
|
395 | 454 | while(($line = fgets($handle,4096)) !== false) { |
396 | 455 | $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
397 | 456 | if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
398 | 457 | $date = $line; |
399 | 458 | } elseif (trim($line) != '') { |
400 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
459 | + if ($date == '') { |
|
460 | + $date = date('Y/m/d H:m'); |
|
461 | + } |
|
401 | 462 | $pos = 0; |
402 | 463 | $pieces = preg_split('/\s/',$line); |
403 | - if ($pieces[0] == 'METAR') $pos++; |
|
404 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
464 | + if ($pieces[0] == 'METAR') { |
|
465 | + $pos++; |
|
466 | + } |
|
467 | + if (strlen($pieces[$pos]) != 4) { |
|
468 | + $pos++; |
|
469 | + } |
|
405 | 470 | $location = $pieces[$pos]; |
406 | 471 | //if ($location == 'LFLL') echo 'location: '.$location.' - date: '.$date.' - data: '.$line."\n"; |
407 | 472 | echo $this->addMETAR($location,$line,$date); |
408 | 473 | } |
409 | 474 | } |
410 | 475 | fclose($handle); |
411 | - if ($globalTransaction) $this->db->commit(); |
|
476 | + if ($globalTransaction) { |
|
477 | + $this->db->commit(); |
|
478 | + } |
|
479 | + } |
|
480 | + if (isset($globalDebug) && $globalDebug) { |
|
481 | + echo "Done\n"; |
|
412 | 482 | } |
413 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
414 | 483 | } |
415 | 484 | |
416 | 485 | /* |
@@ -420,7 +489,9 @@ discard block |
||
420 | 489 | */ |
421 | 490 | public function downloadMETAR($icao) { |
422 | 491 | global $globalMETARurl; |
423 | - if ($globalMETARurl == '') return array(); |
|
492 | + if ($globalMETARurl == '') { |
|
493 | + return array(); |
|
494 | + } |
|
424 | 495 | date_default_timezone_set("UTC"); |
425 | 496 | $Common = new Common(); |
426 | 497 | $url = str_replace('{icao}',$icao,$globalMETARurl); |
@@ -432,16 +503,24 @@ discard block |
||
432 | 503 | $date = $line; |
433 | 504 | } |
434 | 505 | if (trim($line) != '') { |
435 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
506 | + if ($date == '') { |
|
507 | + $date = date('Y/m/d H:m'); |
|
508 | + } |
|
436 | 509 | $pos = 0; |
437 | 510 | $pieces = preg_split('/\s/',$line); |
438 | - if ($pieces[0] == 'METAR') $pos++; |
|
439 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
511 | + if ($pieces[0] == 'METAR') { |
|
512 | + $pos++; |
|
513 | + } |
|
514 | + if (strlen($pieces[$pos]) != 4) { |
|
515 | + $pos++; |
|
516 | + } |
|
440 | 517 | $location = $pieces[$pos]; |
441 | 518 | if (strlen($location == 4)) { |
442 | 519 | $this->addMETAR($location,$line,$date); |
443 | 520 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
444 | - } else return array(); |
|
521 | + } else { |
|
522 | + return array(); |
|
523 | + } |
|
445 | 524 | } |
446 | 525 | } |
447 | 526 | return array(); |
@@ -33,7 +33,9 @@ discard block |
||
33 | 33 | } |
34 | 34 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
35 | 35 | } |
36 | - if ($firstLetter != "'") $previous = $firstLetter; |
|
36 | + if ($firstLetter != "'") { |
|
37 | + $previous = $firstLetter; |
|
38 | + } |
|
37 | 39 | } |
38 | 40 | print '</div>'; |
39 | 41 | $previous = null; |
@@ -48,10 +50,15 @@ discard block |
||
48 | 50 | } |
49 | 51 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
50 | 52 | } |
51 | - if ($firstLetter != "'") $previous = $firstLetter; |
|
53 | + if ($firstLetter != "'") { |
|
54 | + $previous = $firstLetter; |
|
55 | + } |
|
52 | 56 | print '<div class="alphabet-item">'; |
53 | - if (isset($value['race_id']) && $value['race_id'] != '') print '<a href="'.$globalURL.'/marine/race/'.$value['race_id'].'">'.$value['race_name'].' ('.$value['race_id'].')'; |
|
54 | - else print '<a href="'.$globalURL.'/race/'.$value['race_name'].'">'.$value['race_name']; |
|
57 | + if (isset($value['race_id']) && $value['race_id'] != '') { |
|
58 | + print '<a href="'.$globalURL.'/marine/race/'.$value['race_id'].'">'.$value['race_name'].' ('.$value['race_id'].')'; |
|
59 | + } else { |
|
60 | + print '<a href="'.$globalURL.'/race/'.$value['race_name'].'">'.$value['race_name']; |
|
61 | + } |
|
55 | 62 | print '</a>'; |
56 | 63 | print '</div>'; |
57 | 64 | } |
@@ -38,8 +38,12 @@ discard block |
||
38 | 38 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
39 | 39 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
40 | 40 | $filter = array(); |
41 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
42 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
41 | + if ($year != '') { |
|
42 | + $filter = array_merge($filter,array('year' => $year)); |
|
43 | + } |
|
44 | + if ($month != '') { |
|
45 | + $filter = array_merge($filter,array('month' => $month)); |
|
46 | + } |
|
43 | 47 | if ($sort != '') |
44 | 48 | { |
45 | 49 | $spotter_array = $Marine->getMarineDataByCaptain($captain,$limit_start.",".$absolute_difference, $sort,$filter); |
@@ -57,8 +61,12 @@ discard block |
||
57 | 61 | { |
58 | 62 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['captain_name']); |
59 | 63 | $ident = $spotter_array[0]['ident']; |
60 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
61 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
64 | + if (isset($spotter_array[0]['latitude'])) { |
|
65 | + $latitude = $spotter_array[0]['latitude']; |
|
66 | + } |
|
67 | + if (isset($spotter_array[0]['longitude'])) { |
|
68 | + $longitude = $spotter_array[0]['longitude']; |
|
69 | + } |
|
62 | 70 | require_once('header.php'); |
63 | 71 | /* |
64 | 72 | if (isset($globalArchive) && $globalArchive) { |
@@ -111,7 +119,9 @@ discard block |
||
111 | 119 | */ |
112 | 120 | print '<div class="info column">'; |
113 | 121 | print '<h1>'.$spotter_array[0]['captain_name'].'</h1>'; |
114 | - if (isset($spotter_array[0]['captain_id']) && $spotter_array[0]['captain_id'] != '') print '<div><span class="label">'._("Captain ID").'</span>'.$spotter_array[0]['captain_id'].'</div>'; |
|
122 | + if (isset($spotter_array[0]['captain_id']) && $spotter_array[0]['captain_id'] != '') { |
|
123 | + print '<div><span class="label">'._("Captain ID").'</span>'.$spotter_array[0]['captain_id'].'</div>'; |
|
124 | + } |
|
115 | 125 | /* |
116 | 126 | if ($year == '' && $month == '') { |
117 | 127 | $Stats = new Stats(); |
@@ -130,7 +140,9 @@ discard block |
||
130 | 140 | //$airlines = count($Marine->countAllAirlinesByCaptain($captain,$filter)); |
131 | 141 | //print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
132 | 142 | $duration = $Marine->getRaceDurationByCaptain($captain,$filter); |
133 | - if ($duration != '0') print '<div><span class="label">'._("Total races spotted duration").'</span>'.$duration.'</div>'; |
|
143 | + if ($duration != '0') { |
|
144 | + print '<div><span class="label">'._("Total races spotted duration").'</span>'.$duration.'</div>'; |
|
145 | + } |
|
134 | 146 | print '</div>'; |
135 | 147 | |
136 | 148 | //include('captain-sub-menu.php'); |
@@ -33,7 +33,9 @@ discard block |
||
33 | 33 | } |
34 | 34 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
35 | 35 | } |
36 | - if ($firstLetter != "'") $previous = $firstLetter; |
|
36 | + if ($firstLetter != "'") { |
|
37 | + $previous = $firstLetter; |
|
38 | + } |
|
37 | 39 | } |
38 | 40 | print '</div>'; |
39 | 41 | $previous = null; |
@@ -48,10 +50,15 @@ discard block |
||
48 | 50 | } |
49 | 51 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
50 | 52 | } |
51 | - if ($firstLetter != "'") $previous = $firstLetter; |
|
53 | + if ($firstLetter != "'") { |
|
54 | + $previous = $firstLetter; |
|
55 | + } |
|
52 | 56 | print '<div class="alphabet-item">'; |
53 | - if (isset($value['captain_id']) && $value['captain_id'] != '') print '<a href="'.$globalURL.'/marine/captain/'.$value['captain_id'].'">'.$value['captain_name'].' ('.$value['captain_id'].')'; |
|
54 | - else print '<a href="'.$globalURL.'/captain/'.$value['captain_name'].'">'.$value['captain_name']; |
|
57 | + if (isset($value['captain_id']) && $value['captain_id'] != '') { |
|
58 | + print '<a href="'.$globalURL.'/marine/captain/'.$value['captain_id'].'">'.$value['captain_name'].' ('.$value['captain_id'].')'; |
|
59 | + } else { |
|
60 | + print '<a href="'.$globalURL.'/captain/'.$value['captain_name'].'">'.$value['captain_name']; |
|
61 | + } |
|
55 | 62 | print '</a>'; |
56 | 63 | print '</div>'; |
57 | 64 | } |
@@ -28,7 +28,9 @@ discard block |
||
28 | 28 | private $openedFiles = []; |
29 | 29 | |
30 | 30 | public function __construct($htgFilesDestination = '', $resolution = 3) { |
31 | - if ($htgFilesDestination == '') $htgFilesDestination = dirname(__FILE__).'/../data/'; |
|
31 | + if ($htgFilesDestination == '') { |
|
32 | + $htgFilesDestination = dirname(__FILE__).'/../data/'; |
|
33 | + } |
|
32 | 34 | $this->htgFilesDestination = $htgFilesDestination; |
33 | 35 | $this->resolution = $resolution; |
34 | 36 | switch ($resolution) { |
@@ -149,8 +151,11 @@ discard block |
||
149 | 151 | |
150 | 152 | $d = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3; |
151 | 153 | $zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3; |
152 | - if ($zN > 10000) return 0; |
|
153 | - else return $zN; |
|
154 | + if ($zN > 10000) { |
|
155 | + return 0; |
|
156 | + } else { |
|
157 | + return $zN; |
|
158 | + } |
|
154 | 159 | } |
155 | 160 | |
156 | 161 | private function getDeg($deg, $numPrefix) { |
@@ -189,16 +194,26 @@ discard block |
||
189 | 194 | $fileName = $latd.$lond.".hgt"; |
190 | 195 | if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
191 | 196 | $Common = new Common(); |
192 | - if ($debug) echo 'Downloading '.$fileName.'.gz ...'; |
|
197 | + if ($debug) { |
|
198 | + echo 'Downloading '.$fileName.'.gz ...'; |
|
199 | + } |
|
193 | 200 | $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/'.$latd.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
194 | 201 | if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) { |
195 | - if ($debug) echo "File '{$fileName}.gz' not exists."; |
|
202 | + if ($debug) { |
|
203 | + echo "File '{$fileName}.gz' not exists."; |
|
204 | + } |
|
196 | 205 | return false; |
197 | 206 | } |
198 | - if ($debug) echo 'Done'."\n"; |
|
199 | - if ($debug) echo 'Decompress '.$fileName.' ....'; |
|
207 | + if ($debug) { |
|
208 | + echo 'Done'."\n"; |
|
209 | + } |
|
210 | + if ($debug) { |
|
211 | + echo 'Decompress '.$fileName.' ....'; |
|
212 | + } |
|
200 | 213 | $Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName); |
201 | - if ($debug) echo 'Done'."\n"; |
|
214 | + if ($debug) { |
|
215 | + echo 'Done'."\n"; |
|
216 | + } |
|
202 | 217 | unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
203 | 218 | } |
204 | 219 | return true; |