@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | |
6 | 6 | if (!isset($_GET['aircraft_type'])) { |
7 | - header('Location: '.$globalURL.'/aircraft'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/aircraft'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING); |
11 | 11 | $Spotter = new Spotter(); |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['ident'])) { |
6 | - header('Location: '.$globalURL.'/ident'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/ident'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['ident'])) { |
6 | - header('Location: '.$globalURL.'/ident'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/ident'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['aircraft_manufacturer'])) { |
6 | - header('Location: '.$globalURL.'/manufacturer'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/manufacturer'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))); |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['country'])) { |
6 | - header('Location: '.$globalURL.'/country'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/country'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $country = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))); |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['airport'])) { |
6 | - header('Location: '.$globalURL.'/airport'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/airport'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
10 | 10 | $Spotter = new Spotter(); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | function drawChart() { |
66 | 66 | var data = google.visualization.arrayToDataTable([ |
67 | 67 | ["'._("Country").'", "'._("# of times").'"], '; |
68 | - $country_data = ''; |
|
68 | + $country_data = ''; |
|
69 | 69 | foreach($airport_country_array as $airport_item) |
70 | 70 | { |
71 | 71 | $country_data .= '[ "'.$airport_item['departure_airport_country'].'",'.$airport_item['airport_departure_country_count'].'],'; |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | $Common = new Common(); |
12 | 12 | |
13 | 13 | if (isset($_GET['download'])) { |
14 | - if ($_GET['download'] == "true") |
|
15 | - { |
|
14 | + if ($_GET['download'] == "true") |
|
15 | + { |
|
16 | 16 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
17 | - } |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | header('Content-Type: text/javascript'); |
20 | 20 | |
@@ -325,29 +325,29 @@ discard block |
||
325 | 325 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
326 | 326 | || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
327 | 327 | || (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) { |
328 | - if ($from_archive) { |
|
329 | - $spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
|
330 | - } else { |
|
331 | - $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
|
332 | - } |
|
333 | - $d = false; |
|
328 | + if ($from_archive) { |
|
329 | + $spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
|
330 | + } else { |
|
331 | + $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
|
332 | + } |
|
333 | + $d = false; |
|
334 | 334 | foreach ($spotter_history_array as $key => $spotter_history) |
335 | 335 | { |
336 | - /* |
|
336 | + /* |
|
337 | 337 | if (abs($spotter_history['longitude']-$spotter_item['longitude']) > 200 || $d==true) { |
338 | 338 | if ($d == false) $d = true; |
339 | 339 | } else { |
340 | 340 | */ |
341 | 341 | $alt = round($spotter_history['altitude']/10)*10; |
342 | 342 | if (!isset($prev_alt) || $prev_alt != $alt) { |
343 | - if (isset($prev_alt)) { |
|
343 | + if (isset($prev_alt)) { |
|
344 | 344 | //$output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].','.$spotter_history['altitude'].']'; |
345 | 345 | $output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].', '.$spotter_history['altitude'].']'; |
346 | 346 | $output_history .= ']}},'; |
347 | 347 | $output .= $output_history; |
348 | - } |
|
349 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
350 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
348 | + } |
|
349 | + if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
350 | + else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
351 | 351 | } |
352 | 352 | $output_history .= '['; |
353 | 353 | $output_history .= $spotter_history['longitude'].', '; |
@@ -355,41 +355,41 @@ discard block |
||
355 | 355 | $output_history .= $spotter_history['altitude']*30.48; |
356 | 356 | $output_history .= '],'; |
357 | 357 | $prev_alt = $alt; |
358 | - //} |
|
358 | + //} |
|
359 | 359 | } |
360 | 360 | if (isset($output_history)) { |
361 | - $output_history = substr($output_history, 0, -1); |
|
362 | - $output_history .= ']}},'; |
|
363 | - $output .= $output_history; |
|
364 | - unset($prev_alt); |
|
365 | - unset($output_history); |
|
361 | + $output_history = substr($output_history, 0, -1); |
|
362 | + $output_history .= ']}},'; |
|
363 | + $output .= $output_history; |
|
364 | + unset($prev_alt); |
|
365 | + unset($output_history); |
|
366 | 366 | } |
367 | 367 | } |
368 | 368 | |
369 | 369 | if (isset($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))))) { |
370 | - $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
371 | - if (isset($spotter_item['departure_airport_latitude'])) { |
|
370 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
371 | + if (isset($spotter_item['departure_airport_latitude'])) { |
|
372 | 372 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
373 | - } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
373 | + } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
374 | 374 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
375 | 375 | //print_r($dairport); |
376 | 376 | //echo $spotter_item['departure_airport']; |
377 | 377 | if (isset($dairport[0]['latitude'])) { |
378 | - $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
378 | + $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
379 | 379 | } |
380 | - } |
|
381 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
380 | + } |
|
381 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
382 | 382 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
383 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
383 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
384 | 384 | //print_r($aairport); |
385 | 385 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
386 | 386 | if (isset($aairport[0]['latitude'])) { |
387 | - $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
387 | + $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
388 | 388 | } |
389 | - } |
|
390 | - $output_air .= ']}},'; |
|
391 | - $output .= $output_air; |
|
392 | - unset($output_air); |
|
389 | + } |
|
390 | + $output_air .= ']}},'; |
|
391 | + $output .= $output_air; |
|
392 | + unset($output_air); |
|
393 | 393 | } |
394 | 394 | } |
395 | 395 | $output = substr($output, 0, -1); |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | $Common = new Common(); |
10 | 10 | |
11 | 11 | if (isset($_GET['download'])) { |
12 | - if ($_GET['download'] == "true") |
|
13 | - { |
|
12 | + if ($_GET['download'] == "true") |
|
13 | + { |
|
14 | 14 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
15 | - } |
|
15 | + } |
|
16 | 16 | } |
17 | 17 | header('Content-Type: text/javascript'); |
18 | 18 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | //waypoint plotting |
94 | - /* |
|
94 | + /* |
|
95 | 95 | $output .= '{'; |
96 | 96 | $output .= '"type": "Feature",'; |
97 | 97 | $output .= '"properties": {'; |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | $output_time .= (strtotime($spotter_history['date'])*1000).','; |
271 | 271 | } |
272 | 272 | if (isset($output_time)) { |
273 | - $output_time = substr($output_time, 0, -1); |
|
274 | - $output .= '"time": ['.$output_time.'],'; |
|
273 | + $output_time = substr($output_time, 0, -1); |
|
274 | + $output .= '"time": ['.$output_time.'],'; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | $output .= '"coordinates": ['; |
286 | 286 | |
287 | 287 | if (isset($output_history)) { |
288 | - $output_history = substr($output_history, 0, -1); |
|
289 | - $output .= $output_history; |
|
288 | + $output_history = substr($output_history, 0, -1); |
|
289 | + $output .= $output_history; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | $output .= ']'; |
@@ -4,88 +4,88 @@ |
||
4 | 4 | $hex = str_replace("#", "", $hex); |
5 | 5 | $color = array(); |
6 | 6 | if (strlen($hex) == 3) { |
7 | - $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1)); |
|
8 | - $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1)); |
|
9 | - $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1)); |
|
7 | + $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1)); |
|
8 | + $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1)); |
|
9 | + $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1)); |
|
10 | 10 | } else if (strlen($hex) == 6) { |
11 | - $color['r'] = hexdec(substr($hex, 0, 2)); |
|
12 | - $color['g'] = hexdec(substr($hex, 2, 2)); |
|
13 | - $color['b'] = hexdec(substr($hex, 4, 2)); |
|
11 | + $color['r'] = hexdec(substr($hex, 0, 2)); |
|
12 | + $color['g'] = hexdec(substr($hex, 2, 2)); |
|
13 | + $color['b'] = hexdec(substr($hex, 4, 2)); |
|
14 | 14 | } |
15 | 15 | return $color; |
16 | 16 | } |
17 | 17 | |
18 | 18 | |
19 | 19 | if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { |
20 | - exit(0); |
|
20 | + exit(0); |
|
21 | 21 | } |
22 | 22 | $color = $_GET['color']; |
23 | 23 | if (!isset($_GET['filename']) || !preg_match('/^[a-z0-9-_]+\.png$/', strtolower($_GET['filename']))) { |
24 | - echo "Incorrect filename"; |
|
25 | - exit(0); |
|
24 | + echo "Incorrect filename"; |
|
25 | + exit(0); |
|
26 | 26 | } |
27 | 27 | $filename = $_GET['filename']; |
28 | 28 | if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename)) { |
29 | - header('Content-type: image/png'); |
|
30 | - readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename); |
|
31 | - exit(0); |
|
29 | + header('Content-type: image/png'); |
|
30 | + readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename); |
|
31 | + exit(0); |
|
32 | 32 | } |
33 | 33 | $original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'aircrafts'.DIRECTORY_SEPARATOR.'new'.DIRECTORY_SEPARATOR.$filename; |
34 | 34 | if (!file_exists($original)) { |
35 | - echo "File not found"; |
|
35 | + echo "File not found"; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | if (extension_loaded('gd') && function_exists('gd_info')) { |
39 | - $image = imagecreatefrompng($original); |
|
40 | - $index = imagecolorexact($image,26,49,81); |
|
41 | - if ($index < 0) { |
|
39 | + $image = imagecreatefrompng($original); |
|
40 | + $index = imagecolorexact($image,26,49,81); |
|
41 | + if ($index < 0) { |
|
42 | 42 | $index = imagecolorexact($image,25,49,79); |
43 | - } |
|
44 | - if ($index < 0) { |
|
43 | + } |
|
44 | + if ($index < 0) { |
|
45 | 45 | $index = imagecolorexact($image,0,0,0); |
46 | - } |
|
47 | - $c = hexToRGB($color); |
|
48 | - imagecolorset($image,$index,$c['r'],$c['g'],$c['b']); |
|
46 | + } |
|
47 | + $c = hexToRGB($color); |
|
48 | + imagecolorset($image,$index,$c['r'],$c['g'],$c['b']); |
|
49 | 49 | /* |
50 | 50 | $ig = imagecolorat($image, 0, 0); |
51 | 51 | imagecolortransparent($image, $ig); |
52 | 52 | */ |
53 | 53 | |
54 | - header('Content-type: image/png'); |
|
55 | - if (isset($_GET['resize']) && function_exists('imagecopyresampled')) { |
|
54 | + header('Content-type: image/png'); |
|
55 | + if (isset($_GET['resize']) && function_exists('imagecopyresampled')) { |
|
56 | 56 | $resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT); |
57 | 57 | $newimg = imagecreatetruecolor($resize,$resize); |
58 | - imagealphablending($newimg, false); |
|
58 | + imagealphablending($newimg, false); |
|
59 | 59 | imagesavealpha($newimg, true); |
60 | 60 | imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image)); |
61 | 61 | if (isset($_GET['heading'])) { |
62 | - $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT); |
|
63 | - $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127)); |
|
64 | - imagealphablending($rotation, false); |
|
65 | - imagesavealpha($rotation, true); |
|
66 | - imagepng($rotation); |
|
67 | - imagedestroy($newimg); |
|
68 | - imagedestroy($image); |
|
69 | - imagedestroy($rotation); |
|
62 | + $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT); |
|
63 | + $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127)); |
|
64 | + imagealphablending($rotation, false); |
|
65 | + imagesavealpha($rotation, true); |
|
66 | + imagepng($rotation); |
|
67 | + imagedestroy($newimg); |
|
68 | + imagedestroy($image); |
|
69 | + imagedestroy($rotation); |
|
70 | 70 | |
71 | 71 | } else { |
72 | - imagepng($newimg); |
|
73 | - imagedestroy($newimg); |
|
74 | - imagedestroy($image); |
|
75 | - } |
|
76 | - } else { |
|
72 | + imagepng($newimg); |
|
73 | + imagedestroy($newimg); |
|
74 | + imagedestroy($image); |
|
75 | + } |
|
76 | + } else { |
|
77 | 77 | imagealphablending($image, false); |
78 | - imagesavealpha($image, true); |
|
78 | + imagesavealpha($image, true); |
|
79 | 79 | imagepng($image); |
80 | 80 | imagepng($image); |
81 | 81 | if (is_writable('cache')) { |
82 | - imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename); |
|
82 | + imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename); |
|
83 | + } |
|
84 | + imagedestroy($image); |
|
83 | 85 | } |
84 | - imagedestroy($image); |
|
85 | - } |
|
86 | 86 | } else { |
87 | - header('Content-type: image/png'); |
|
88 | - if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename); |
|
89 | - else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename); |
|
87 | + header('Content-type: image/png'); |
|
88 | + if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename); |
|
89 | + else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename); |
|
90 | 90 | } |
91 | 91 | ?> |
92 | 92 | \ No newline at end of file |