@@ -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'].'],'; |
@@ -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 .= ']'; |
@@ -13,30 +13,30 @@ |
||
13 | 13 | |
14 | 14 | |
15 | 15 | function quaternionrotate($heading, $attitude = 0, $bank = 0) { |
16 | - // Assuming the angles are in radians. |
|
17 | - $c1 = cos($heading/2); |
|
18 | - $s1 = sin($heading/2); |
|
19 | - $c2 = cos($attitude/2); |
|
20 | - $s2 = sin($attitude/2); |
|
21 | - $c3 = cos($bank/2); |
|
22 | - $s3 = sin($bank/2); |
|
23 | - $c1c2 = $c1*$c2; |
|
24 | - $s1s2 = $s1*$s2; |
|
25 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
26 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
27 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
28 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
29 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
16 | + // Assuming the angles are in radians. |
|
17 | + $c1 = cos($heading/2); |
|
18 | + $s1 = sin($heading/2); |
|
19 | + $c2 = cos($attitude/2); |
|
20 | + $s2 = sin($attitude/2); |
|
21 | + $c3 = cos($bank/2); |
|
22 | + $s3 = sin($bank/2); |
|
23 | + $c1c2 = $c1*$c2; |
|
24 | + $s1s2 = $s1*$s2; |
|
25 | + $w =$c1c2*$c3 - $s1s2*$s3; |
|
26 | + $x =$c1c2*$s3 + $s1s2*$c3; |
|
27 | + $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
28 | + $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
29 | + return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
30 | 30 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | 34 | |
35 | 35 | if (isset($_GET['download'])) { |
36 | - if ($_GET['download'] == "true") |
|
37 | - { |
|
36 | + if ($_GET['download'] == "true") |
|
37 | + { |
|
38 | 38 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
39 | - } |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | header('Content-Type: text/javascript'); |
42 | 42 |
@@ -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 |