@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
17 | 17 | $sql_date = $end_date; |
18 | 18 | } else $sql_date = ''; |
@@ -20,38 +20,38 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) |
|
37 | +if (!isset($_GET['limit'])) |
|
38 | 38 | { |
39 | 39 | if (!isset($_GET['number_results'])) { |
40 | 40 | $limit_start = 0; |
41 | 41 | $limit_end = 25; |
42 | 42 | $absolute_difference = 25; |
43 | 43 | } else { |
44 | - if ($_GET['number_results'] > 1000){ |
|
44 | + if ($_GET['number_results'] > 1000) { |
|
45 | 45 | $_GET['number_results'] = 1000; |
46 | 46 | } |
47 | 47 | $limit_start = 0; |
48 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
49 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
48 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
49 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
50 | 50 | } |
51 | -} else { |
|
51 | +} else { |
|
52 | 52 | $limit_explode = explode(",", $_GET['limit']); |
53 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
54 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
53 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
54 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -68,29 +68,29 @@ discard block |
||
68 | 68 | |
69 | 69 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
70 | 70 | else $sort = ''; |
71 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
72 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
73 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
74 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
75 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
76 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
77 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
78 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
79 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
80 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
81 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
82 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
83 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
84 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
85 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
86 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
87 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
71 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
72 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
73 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
74 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
75 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
76 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
77 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
78 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
79 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
80 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
81 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
82 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
83 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
84 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
85 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
86 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
87 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
88 | 88 | $output = '<?xml version="1.0" encoding="UTF-8"?>'; |
89 | 89 | $output .= '<gpx version="1.0">'; |
90 | 90 | $output .= '<name>FlightAirMap GPX Feed</name>'; |
91 | 91 | if (!empty($spotter_array)) |
92 | 92 | { |
93 | - foreach($spotter_array as $spotter_item) |
|
93 | + foreach ($spotter_array as $spotter_item) |
|
94 | 94 | { |
95 | 95 | $altitude = $spotter_item['altitude'].'00'; |
96 | 96 | //waypoint plotting |
@@ -2,17 +2,17 @@ discard block |
||
2 | 2 | require_once('require/class.Connection.php'); |
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | -$Spotter=new Spotter(); |
|
5 | +$Spotter = new Spotter(); |
|
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
17 | 17 | $sql_date = $end_date; |
18 | 18 | } else $sql_date = ''; |
@@ -20,21 +20,21 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) |
|
37 | +if (!isset($_GET['limit'])) |
|
38 | 38 | { |
39 | 39 | if (!isset($_GET['number_results'])) |
40 | 40 | { |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | $limit_end = 25; |
43 | 43 | $absolute_difference = 25; |
44 | 44 | } else { |
45 | - if ($_GET['number_results'] > 1000){ |
|
45 | + if ($_GET['number_results'] > 1000) { |
|
46 | 46 | $_GET['number_results'] = 1000; |
47 | 47 | } |
48 | 48 | $limit_start = 0; |
49 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
50 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
49 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
50 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
51 | 51 | } |
52 | -} else { |
|
52 | +} else { |
|
53 | 53 | $limit_explode = explode(",", $_GET['limit']); |
54 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
55 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
54 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
55 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -69,29 +69,29 @@ discard block |
||
69 | 69 | |
70 | 70 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
71 | 71 | else $sort = ''; |
72 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
73 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
74 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
75 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
76 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
77 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
78 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
79 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
80 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
81 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
82 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
83 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
84 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
85 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
86 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
87 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
88 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
72 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
73 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
74 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
75 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
76 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
77 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
78 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
79 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
80 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
81 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
82 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
83 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
84 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
85 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
86 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
87 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
88 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
89 | 89 | |
90 | 90 | $output = '{'; |
91 | 91 | $output .= '"type": "FeatureCollection",'; |
92 | 92 | $output .= '"features": ['; |
93 | 93 | if (!empty($spotter_array)) { |
94 | - foreach($spotter_array as $spotter_item) { |
|
94 | + foreach ($spotter_array as $spotter_item) { |
|
95 | 95 | //waypoint plotting |
96 | 96 | $output .= '{'; |
97 | 97 | $output .= '"type": "Feature",'; |
@@ -138,8 +138,8 @@ discard block |
||
138 | 138 | $waypoint_pieces = array_chunk($waypoint_pieces, 2); |
139 | 139 | foreach ($waypoint_pieces as $waypoint_coordinate) { |
140 | 140 | $output .= '['; |
141 | - $output .= $waypoint_coordinate[1].', '; |
|
142 | - $output .= $waypoint_coordinate[0]; |
|
141 | + $output .= $waypoint_coordinate[1].', '; |
|
142 | + $output .= $waypoint_coordinate[0]; |
|
143 | 143 | $output .= '],'; |
144 | 144 | } |
145 | 145 | $output = substr($output, 0, -1); |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | $output .= '"geometry": {'; |
189 | 189 | $output .= '"type": "Point",'; |
190 | 190 | $output .= '"coordinates": ['; |
191 | - $output .= $spotter_item['longitude'].', '; |
|
192 | - $output .= $spotter_item['latitude']; |
|
191 | + $output .= $spotter_item['longitude'].', '; |
|
192 | + $output .= $spotter_item['latitude']; |
|
193 | 193 | $output .= ']'; |
194 | 194 | $output .= '}'; |
195 | 195 | $output .= '},'; |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
17 | 17 | $sql_date = $end_date; |
18 | 18 | } else $sql_date = ''; |
@@ -20,38 +20,38 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) |
|
37 | +if (!isset($_GET['limit'])) |
|
38 | 38 | { |
39 | 39 | if (!isset($_GET['number_results'])) { |
40 | 40 | $limit_start = 0; |
41 | 41 | $limit_end = 25; |
42 | 42 | $absolute_difference = 25; |
43 | 43 | } else { |
44 | - if ($_GET['number_results'] > 1000){ |
|
44 | + if ($_GET['number_results'] > 1000) { |
|
45 | 45 | $_GET['number_results'] = 1000; |
46 | 46 | } |
47 | 47 | $limit_start = 0; |
48 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
49 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
48 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
49 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
50 | 50 | } |
51 | -} else { |
|
51 | +} else { |
|
52 | 52 | $limit_explode = explode(",", $_GET['limit']); |
53 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
54 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
53 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
54 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -68,23 +68,23 @@ discard block |
||
68 | 68 | |
69 | 69 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
70 | 70 | else $sort = ''; |
71 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
72 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
73 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
74 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
75 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
76 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
77 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
78 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
79 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
80 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
81 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
82 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
83 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
84 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
85 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
86 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
87 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
71 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
72 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
73 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
74 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
75 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
76 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
77 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
78 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
79 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
80 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
81 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
82 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
83 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
84 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
85 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
86 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
87 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
88 | 88 | |
89 | 89 | $output = '<?xml version="1.0" encoding="UTF-8"?>'; |
90 | 90 | $output .= '<kml xmlns="http://www.opengis.net/kml/2.2">'; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | $output .= '</Style>'; |
113 | 113 | |
114 | 114 | if (!empty($spotter_array)) { |
115 | - foreach($spotter_array as $spotter_item) { |
|
115 | + foreach ($spotter_array as $spotter_item) { |
|
116 | 116 | $altitude = $spotter_item['altitude'].'00'; |
117 | 117 | if ($spotter_item['waypoints'] != '') { |
118 | 118 | //waypoint plotting |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $waypoint_pieces = explode(' ', $spotter_item['waypoints']); |
124 | 124 | $waypoint_pieces = array_chunk($waypoint_pieces, 2); |
125 | 125 | foreach ($waypoint_pieces as $waypoint_coordinate) { |
126 | - $output .= $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' '; |
|
126 | + $output .= $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' '; |
|
127 | 127 | } |
128 | 128 | $output .= '</coordinates>'; |
129 | 129 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | $output .= ' ]]></description>'; |
168 | 168 | $output .= '<styleUrl>#departureAirport</styleUrl>'; |
169 | 169 | $output .= '<Point>'; |
170 | - $output .= '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>'; |
|
170 | + $output .= '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>'; |
|
171 | 171 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
172 | 172 | $output .= '</Point>'; |
173 | 173 | $output .= '</Placemark>'; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $output .= ' ]]></description>'; |
209 | 209 | $output .= '<styleUrl>#arrivalAirport</styleUrl>'; |
210 | 210 | $output .= '<Point>'; |
211 | - $output .= '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>'; |
|
211 | + $output .= '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>'; |
|
212 | 212 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
213 | 213 | $output .= '</Point>'; |
214 | 214 | $output .= '</Placemark>'; |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | $output .= ' ]]></description>'; |
253 | 253 | $output .= '<styleUrl>#aircraft_'.$spotter_item['spotter_id'].'</styleUrl>'; |
254 | 254 | $output .= '<Point>'; |
255 | - $output .= '<coordinates>'.$spotter_item['longitude'].', '.$spotter_item['latitude'].', '.$altitude.'</coordinates>'; |
|
255 | + $output .= '<coordinates>'.$spotter_item['longitude'].', '.$spotter_item['latitude'].', '.$altitude.'</coordinates>'; |
|
256 | 256 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
257 | 257 | $output .= '</Point>'; |
258 | 258 | $output .= '</Placemark>'; |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
17 | 17 | $sql_date = $end_date; |
18 | 18 | } else $sql_date = ''; |
@@ -20,37 +20,37 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) { |
|
37 | +if (!isset($_GET['limit'])) { |
|
38 | 38 | if (!isset($_GET['number_results'])) { |
39 | 39 | $limit_start = 0; |
40 | 40 | $limit_end = 25; |
41 | 41 | $absolute_difference = 25; |
42 | 42 | } else { |
43 | - if ($_GET['number_results'] > 1000){ |
|
43 | + if ($_GET['number_results'] > 1000) { |
|
44 | 44 | $_GET['number_results'] = 1000; |
45 | 45 | } |
46 | 46 | $limit_start = 0; |
47 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
48 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
47 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
48 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
49 | 49 | } |
50 | -} else { |
|
50 | +} else { |
|
51 | 51 | $limit_explode = explode(",", $_GET['limit']); |
52 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
53 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
52 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
53 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -67,23 +67,23 @@ discard block |
||
67 | 67 | |
68 | 68 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
69 | 69 | else $sort = ''; |
70 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
71 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
72 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
73 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
74 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
75 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
76 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
77 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
78 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
79 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
80 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
81 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
82 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
83 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
84 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
85 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
86 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
70 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
71 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
72 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
73 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
74 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
75 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
76 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
77 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
78 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
79 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
80 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
81 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
82 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
83 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
84 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
85 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
86 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
87 | 87 | |
88 | 88 | $output = '<?xml version="1.0" encoding="UTF-8" ?>'; |
89 | 89 | $output .= '<flightairmap>'; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $output .= '<link>http://'.$_SERVER['HTTP_HOST'].$globalURL.'</link>'; |
92 | 92 | $output .= '<aircrafts>'; |
93 | 93 | if (!empty($spotter_array)) { |
94 | - foreach($spotter_array as $spotter_item) { |
|
94 | + foreach ($spotter_array as $spotter_item) { |
|
95 | 95 | $output .= '<aircraft>'; |
96 | 96 | $output .= '<id>'.$spotter_item['spotter_id'].'</id>'; |
97 | 97 | $output .= '<ident>'.$spotter_item['ident'].'</ident>'; |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
17 | 17 | $sql_date = $end_date; |
18 | 18 | } else $sql_date = ''; |
@@ -20,37 +20,37 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) { |
|
37 | +if (!isset($_GET['limit'])) { |
|
38 | 38 | if (!isset($_GET['number_results'])) { |
39 | 39 | $limit_start = 0; |
40 | 40 | $limit_end = 25; |
41 | 41 | $absolute_difference = 25; |
42 | 42 | } else { |
43 | - if ($_GET['number_results'] > 1000){ |
|
43 | + if ($_GET['number_results'] > 1000) { |
|
44 | 44 | $_GET['number_results'] = 1000; |
45 | 45 | } |
46 | 46 | $limit_start = 0; |
47 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
48 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
47 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
48 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
49 | 49 | } |
50 | -} else { |
|
50 | +} else { |
|
51 | 51 | $limit_explode = explode(",", $_GET['limit']); |
52 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
53 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
52 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
53 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -67,27 +67,27 @@ discard block |
||
67 | 67 | |
68 | 68 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
69 | 69 | else $sort = ''; |
70 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
71 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
72 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
73 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
74 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
75 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
76 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
77 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
78 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
79 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
80 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
81 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
82 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
83 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
84 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
85 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
86 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
70 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
71 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
72 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
73 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
74 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
75 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
76 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
77 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
78 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
79 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
80 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
81 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
82 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
83 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
84 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
85 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
86 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
87 | 87 | |
88 | 88 | $output = "-flights:\n"; |
89 | 89 | if (!empty($spotter_array)) { |
90 | - foreach($spotter_array as $spotter_item) { |
|
90 | + foreach ($spotter_array as $spotter_item) { |
|
91 | 91 | $output .= ' - id: '.$spotter_item['spotter_id']; |
92 | 92 | $output .= "\n"; |
93 | 93 | $output .= ' - ident: '.$spotter_item['ident']; |
@@ -6,14 +6,14 @@ discard block |
||
6 | 6 | |
7 | 7 | if (isset($_GET['start_date'])) { |
8 | 8 | //for the date manipulation into the query |
9 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
9 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
10 | 10 | $start_date = $_GET['start_date'].":00"; |
11 | 11 | $end_date = $_GET['end_date'].":00"; |
12 | 12 | $sql_date = $start_date.",".$end_date; |
13 | - } else if($_GET['start_date'] != ""){ |
|
13 | + } else if ($_GET['start_date'] != "") { |
|
14 | 14 | $start_date = $_GET['start_date'].":00"; |
15 | 15 | $sql_date = $start_date; |
16 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
16 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
17 | 17 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
18 | 18 | $sql_date = $end_date; |
19 | 19 | } else $sql_date = ''; |
@@ -21,38 +21,38 @@ discard block |
||
21 | 21 | |
22 | 22 | if (isset($_GET['highest_altitude'])) { |
23 | 23 | //for altitude manipulation |
24 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
24 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
25 | 25 | $end_altitude = $_GET['highest_altitude']; |
26 | 26 | $start_altitude = $_GET['lowest_altitude']; |
27 | 27 | $sql_altitude = $start_altitude.",".$end_altitude; |
28 | - } else if($_GET['highest_altitude'] != ""){ |
|
28 | + } else if ($_GET['highest_altitude'] != "") { |
|
29 | 29 | $end_altitude = $_GET['highest_altitude']; |
30 | 30 | $sql_altitude = $end_altitude; |
31 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
31 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
32 | 32 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
33 | 33 | $sql_altitude = $start_altitude; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | } else $sql_altitude = ''; |
36 | 36 | |
37 | 37 | //calculuation for the pagination |
38 | -if(!isset($_GET['limit'])) |
|
38 | +if (!isset($_GET['limit'])) |
|
39 | 39 | { |
40 | 40 | if (!isset($_GET['number_results'])) { |
41 | 41 | $limit_start = 0; |
42 | 42 | $limit_end = 25; |
43 | 43 | $absolute_difference = 25; |
44 | 44 | } else { |
45 | - if ($_GET['number_results'] > 1000){ |
|
45 | + if ($_GET['number_results'] > 1000) { |
|
46 | 46 | $_GET['number_results'] = 1000; |
47 | 47 | } |
48 | 48 | $limit_start = 0; |
49 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
50 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
49 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
50 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
51 | 51 | } |
52 | -} else { |
|
52 | +} else { |
|
53 | 53 | $limit_explode = explode(",", $_GET['limit']); |
54 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
55 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
54 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
55 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
56 | 56 | } |
57 | 57 | $absolute_difference = abs($limit_start - $limit_end); |
58 | 58 | $limit_next = $limit_end + $absolute_difference; |
@@ -69,29 +69,29 @@ discard block |
||
69 | 69 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
70 | 70 | else $sort = ''; |
71 | 71 | |
72 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
73 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
74 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
75 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
76 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
77 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
78 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
79 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
80 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
81 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
82 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
83 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
84 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
85 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
86 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
87 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
88 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
72 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
73 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
74 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
75 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
76 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
77 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
78 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
79 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
80 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
81 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
82 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
83 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
84 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
85 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
86 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
87 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
88 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
89 | 89 | |
90 | 90 | |
91 | 91 | $output = "id,ident,registration,aircraft_icao,aircraft_name,aircraft_manufacturer,airline,airline_icao,airline_iata,airline_country,airline_callsign,airline_type,departure_airport_city,departure_airport_country,departure_airport_iata,departure_airport_icao,departure_airport_latitude,departure_airport_longitude,departure_airport_altitude,arrival_airport_city,arrival_airport_country,arrival_airport_iata,arrival_airport_icao,arrival_airport_latitude,arrival_airport_longitude,arrival_airport_altitude,latitude,longitude,altitude,ground_speed,heading,heading_name,waypoints,date\n"; |
92 | 92 | |
93 | 93 | if (!empty($spotter_array)) { |
94 | - foreach($spotter_array as $spotter_item) { |
|
94 | + foreach ($spotter_array as $spotter_item) { |
|
95 | 95 | $output .= $spotter_item['spotter_id'].','; |
96 | 96 | $output .= $spotter_item['ident'].','; |
97 | 97 | $output .= $spotter_item['registration'].','; |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
12 | -$spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", $sort); |
|
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Airlines of %s"),$spotter_array[0]['ident']); |
|
16 | + $title = sprintf(_("Most Common Airlines of %s"), $spotter_array[0]['ident']); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
19 | 19 | print '<h1>'.$spotter_array[0]['ident'].'</h1>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('ident-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Airlines").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights using the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights using the ident/callsign <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
28 | 28 | |
29 | 29 | $airline_array = $Spotter->countAllAirlinesByIdent($ident); |
30 | 30 | if (!empty($airline_array)) |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | print '</thead>'; |
42 | 42 | print '<tbody>'; |
43 | 43 | $i = 1; |
44 | - foreach($airline_array as $airline_item) |
|
44 | + foreach ($airline_array as $airline_item) |
|
45 | 45 | { |
46 | 46 | print '<tr>'; |
47 | 47 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | require_once('header.php'); |
8 | 8 | |
9 | 9 | //calculuation for the pagination |
10 | -if(!isset($_GET['limit'])) |
|
10 | +if (!isset($_GET['limit'])) |
|
11 | 11 | { |
12 | 12 | $limit_start = 0; |
13 | 13 | $limit_end = 28; |
14 | 14 | $absolute_difference = 28; |
15 | 15 | } else { |
16 | 16 | $limit_explode = explode(",", $_GET['limit']); |
17 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
18 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
17 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
18 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
19 | 19 | if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) { |
20 | 20 | $limit_start = 0; |
21 | 21 | $limit_end = 25; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | print '<div class="column">'; |
40 | 40 | print '<p>'._("The view below shows all aircrafts that have been selected to have some sort of special characteristic about them, such as unique liveries, destinations etc.").'</p>'; |
41 | 41 | |
42 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
42 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
43 | 43 | if ($sort != '') { |
44 | 44 | $spotter_array = $Spotter->getSpotterDataByHighlight($limit_start.",".$absolute_difference, $sort); |
45 | 45 | } else { |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | if (!empty($spotter_array)) |
49 | 49 | { |
50 | 50 | print '<div class="dispay-view">'; |
51 | - foreach($spotter_array as $spotter_item) |
|
51 | + foreach ($spotter_array as $spotter_item) |
|
52 | 52 | { |
53 | 53 | if (isset($spotter_item['image']) && $spotter_item['image'] != "") |
54 | 54 | { |
@@ -17,22 +17,22 @@ discard block |
||
17 | 17 | * @return Array the images list |
18 | 18 | * |
19 | 19 | */ |
20 | - public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
20 | + public function getSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
21 | 21 | { |
22 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
23 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
24 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
22 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
23 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
24 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
25 | 25 | $reg = $registration; |
26 | 26 | if ($reg == '' && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao; |
27 | 27 | $reg = trim($reg); |
28 | - $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
28 | + $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
|
29 | 29 | FROM spotter_image |
30 | 30 | WHERE spotter_image.registration = :registration LIMIT 1"; |
31 | 31 | $sth = $this->db->prepare($query); |
32 | 32 | $sth->execute(array(':registration' => $reg)); |
33 | 33 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
34 | 34 | if (!empty($result)) return $result; |
35 | - elseif ($registration != '') return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
35 | + elseif ($registration != '') return $this->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
36 | 36 | else return array(); |
37 | 37 | } |
38 | 38 | |
@@ -42,23 +42,23 @@ discard block |
||
42 | 42 | * @return Array the images list |
43 | 43 | * |
44 | 44 | */ |
45 | - public function getMarineImage($mmsi,$imo = '',$name = '') |
|
45 | + public function getMarineImage($mmsi, $imo = '', $name = '') |
|
46 | 46 | { |
47 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
48 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
49 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
47 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
48 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
49 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
50 | 50 | $name = trim($name); |
51 | - $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
|
51 | + $query = "SELECT marine_image.image, marine_image.image_thumbnail, marine_image.image_source, marine_image.image_source_website,marine_image.image_copyright, marine_image.mmsi, marine_image.imo, marine_image.name |
|
52 | 52 | FROM marine_image |
53 | 53 | WHERE marine_image.mmsi = :mmsi"; |
54 | 54 | $query_data = array(':mmsi' => $mmsi); |
55 | 55 | if ($imo != '') { |
56 | 56 | $query .= " AND marine_image.imo = :imo"; |
57 | - $query_data = array_merge($query_data,array(':imo' => $imo)); |
|
57 | + $query_data = array_merge($query_data, array(':imo' => $imo)); |
|
58 | 58 | } |
59 | 59 | if ($name != '') { |
60 | 60 | $query .= " AND marine_image.name = :name"; |
61 | - $query_data = array_merge($query_data,array(':name' => $name)); |
|
61 | + $query_data = array_merge($query_data, array(':name' => $name)); |
|
62 | 62 | } |
63 | 63 | $query .= " LIMIT 1"; |
64 | 64 | $sth = $this->db->prepare($query); |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
80 | 80 | elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
81 | 81 | if ($copyright != '') { |
82 | - $copyright = str_replace('Copyright ','',$copyright); |
|
83 | - $copyright = str_replace('© ','',$copyright); |
|
84 | - $copyright = str_replace('(c) ','',$copyright); |
|
82 | + $copyright = str_replace('Copyright ', '', $copyright); |
|
83 | + $copyright = str_replace('© ', '', $copyright); |
|
84 | + $copyright = str_replace('(c) ', '', $copyright); |
|
85 | 85 | } |
86 | 86 | return $copyright; |
87 | 87 | } |
@@ -92,25 +92,25 @@ discard block |
||
92 | 92 | * @return String either success or error |
93 | 93 | * |
94 | 94 | */ |
95 | - public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
|
95 | + public function addSpotterImage($registration, $aircraft_icao = '', $airline_icao = '') |
|
96 | 96 | { |
97 | - global $globalDebug,$globalAircraftImageFetch; |
|
97 | + global $globalDebug, $globalAircraftImageFetch; |
|
98 | 98 | if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return ''; |
99 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
99 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
100 | 100 | $registration = trim($registration); |
101 | 101 | //getting the aircraft image |
102 | 102 | if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
103 | 103 | elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
104 | 104 | elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
105 | - $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
|
105 | + $image_url = $this->findAircraftImage($registration, $aircraft_icao, $airline_icao); |
|
106 | 106 | if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
107 | 107 | if ($image_url['original'] != '') { |
108 | 108 | if ($globalDebug) echo 'Found !'."\n"; |
109 | - $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
109 | + $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
110 | 110 | try { |
111 | 111 | $sth = $this->db->prepare($query); |
112 | - $sth->execute(array(':registration' => $registration,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website'])); |
|
113 | - } catch(PDOException $e) { |
|
112 | + $sth->execute(array(':registration' => $registration, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website'])); |
|
113 | + } catch (PDOException $e) { |
|
114 | 114 | echo $e->getMessage()."\n"; |
115 | 115 | return "error"; |
116 | 116 | } |
@@ -124,13 +124,13 @@ discard block |
||
124 | 124 | * @return String either success or error |
125 | 125 | * |
126 | 126 | */ |
127 | - public function addMarineImage($mmsi,$imo = '',$name = '') |
|
127 | + public function addMarineImage($mmsi, $imo = '', $name = '') |
|
128 | 128 | { |
129 | - global $globalDebug,$globalMarineImageFetch; |
|
129 | + global $globalDebug, $globalMarineImageFetch; |
|
130 | 130 | if (isset($globalMarineImageFetch) && !$globalMarineImageFetch) return ''; |
131 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
132 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
133 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
131 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
132 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
133 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
134 | 134 | $name = trim($name); |
135 | 135 | $Marine = new Marine($this->db); |
136 | 136 | if ($imo == '' || $name == '') { |
@@ -144,14 +144,14 @@ discard block |
||
144 | 144 | |
145 | 145 | //getting the aircraft image |
146 | 146 | if ($globalDebug && $name != '') echo 'Try to find an vessel image for '.$name.'...'; |
147 | - $image_url = $this->findMarineImage($mmsi,$imo,$name); |
|
147 | + $image_url = $this->findMarineImage($mmsi, $imo, $name); |
|
148 | 148 | if ($image_url['original'] != '') { |
149 | 149 | if ($globalDebug) echo 'Found !'."\n"; |
150 | - $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
150 | + $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
|
151 | 151 | try { |
152 | 152 | $sth = $this->db->prepare($query); |
153 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':name' => $name,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website'])); |
|
154 | - } catch(PDOException $e) { |
|
153 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':name' => $name, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website'])); |
|
154 | + } catch (PDOException $e) { |
|
155 | 155 | echo $e->getMessage()."\n"; |
156 | 156 | return "error"; |
157 | 157 | } |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
172 | 172 | $Spotter = new Spotter($this->db); |
173 | 173 | if (!isset($globalIVAO)) $globalIVAO = FALSE; |
174 | - $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
|
174 | + $aircraft_registration = filter_var($aircraft_registration, FILTER_SANITIZE_STRING); |
|
175 | 175 | if ($aircraft_registration != '' && (!isset($globalVA) || $globalVA !== TRUE)) { |
176 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
176 | + if (strpos($aircraft_registration, '/') !== false) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
177 | 177 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
178 | 178 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
179 | 179 | if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
@@ -187,25 +187,25 @@ discard block |
||
187 | 187 | if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type']; |
188 | 188 | else $aircraft_name = ''; |
189 | 189 | $aircraft_registration = $aircraft_icao; |
190 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
190 | + } else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
191 | 191 | unset($Spotter); |
192 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
192 | + if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
193 | 193 | foreach ($globalAircraftImageSources as $source) { |
194 | 194 | $source = strtolower($source); |
195 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
196 | - if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
197 | - if ($source == 'flickr') $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
198 | - if ($source == 'bing') $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
199 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
200 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
201 | - if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
202 | - if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
203 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name); |
|
204 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
195 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft', $aircraft_icao, $airline_icao); |
|
196 | + if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters('aircraft', $aircraft_registration, $aircraft_name); |
|
197 | + if ($source == 'flickr') $images_array = $this->fromFlickr('aircraft', $aircraft_registration, $aircraft_name); |
|
198 | + if ($source == 'bing') $images_array = $this->fromBing('aircraft', $aircraft_registration, $aircraft_name); |
|
199 | + if ($source == 'deviantart') $images_array = $this->fromDeviantart('aircraft', $aircraft_registration, $aircraft_name); |
|
200 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft', $aircraft_registration, $aircraft_name); |
|
201 | + if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos('aircraft', $aircraft_registration, $aircraft_name); |
|
202 | + if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures('aircraft', $aircraft_registration, $aircraft_name); |
|
203 | + if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft', $aircraft_registration, $aircraft_name); |
|
204 | + if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft', $aircraft_registration, $aircraft_name); |
|
205 | 205 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
206 | 206 | } |
207 | 207 | if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao); |
208 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
208 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | * @return Array the aircraft thumbnail, orignal url and copyright |
218 | 218 | * |
219 | 219 | */ |
220 | - public function findMarineImage($mmsi,$imo = '',$name = '') |
|
220 | + public function findMarineImage($mmsi, $imo = '', $name = '') |
|
221 | 221 | { |
222 | 222 | global $globalMarineImageSources; |
223 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
223 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
224 | 224 | //$imo = filter_var($imo,FILTER_SANITIZE_STRING); |
225 | - $name = filter_var($name,FILTER_SANITIZE_STRING); |
|
225 | + $name = filter_var($name, FILTER_SANITIZE_STRING); |
|
226 | 226 | $name = trim($name); |
227 | - if (strlen($name) < 4) return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
227 | + if (strlen($name) < 4) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
228 | 228 | /* |
229 | 229 | $Marine = new Marine($this->db); |
230 | 230 | if ($imo == '' || $name == '') { |
@@ -236,17 +236,17 @@ discard block |
||
236 | 236 | } |
237 | 237 | unset($Marine); |
238 | 238 | */ |
239 | - if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
239 | + if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia', 'deviantart', 'flickr', 'bing'); |
|
240 | 240 | foreach ($globalMarineImageSources as $source) { |
241 | 241 | $source = strtolower($source); |
242 | - if ($source == 'flickr') $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
243 | - if ($source == 'bing') $images_array = $this->fromBing('marine',$mmsi,$name); |
|
244 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
245 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
246 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
242 | + if ($source == 'flickr') $images_array = $this->fromFlickr('marine', $mmsi, $name); |
|
243 | + if ($source == 'bing') $images_array = $this->fromBing('marine', $mmsi, $name); |
|
244 | + if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine', $mmsi, $name); |
|
245 | + if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine', $mmsi, $name); |
|
246 | + if ($source == 'customsources') $images_array = $this->fromCustomSource('marine', $mmsi, $name); |
|
247 | 247 | if (isset($images_array) && $images_array['original'] != '') return $images_array; |
248 | 248 | } |
249 | - return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
249 | + return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => ''); |
|
250 | 250 | } |
251 | 251 | |
252 | 252 | /** |
@@ -257,24 +257,24 @@ discard block |
||
257 | 257 | * @return Array the aircraft thumbnail, orignal url and copyright |
258 | 258 | * |
259 | 259 | */ |
260 | - public function fromPlanespotters($type,$aircraft_registration, $aircraft_name='') { |
|
260 | + public function fromPlanespotters($type, $aircraft_registration, $aircraft_name = '') { |
|
261 | 261 | $Common = new Common(); |
262 | 262 | // If aircraft registration is only number, also check with aircraft model |
263 | - if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') { |
|
264 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
263 | + if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') { |
|
264 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss'; |
|
265 | 265 | } else { |
266 | 266 | //$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss'; |
267 | - $url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
267 | + $url = 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss'; |
|
268 | 268 | } |
269 | 269 | $data = $Common->getData($url); |
270 | 270 | if ($xml = simplexml_load_string($data)) { |
271 | 271 | if (isset($xml->channel->item)) { |
272 | 272 | $image_url = array(); |
273 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
273 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
274 | 274 | $image_url['thumbnail'] = $thumbnail_url; |
275 | - $image_url['original'] = str_replace('thumbnail','original',$thumbnail_url); |
|
276 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
277 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
275 | + $image_url['original'] = str_replace('thumbnail', 'original', $thumbnail_url); |
|
276 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright); |
|
277 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
278 | 278 | $image_url['source'] = 'planespotters'; |
279 | 279 | return $image_url; |
280 | 280 | } |
@@ -290,30 +290,30 @@ discard block |
||
290 | 290 | * @return Array the aircraft thumbnail, orignal url and copyright |
291 | 291 | * |
292 | 292 | */ |
293 | - public function fromDeviantart($type,$registration, $name='') { |
|
293 | + public function fromDeviantart($type, $registration, $name = '') { |
|
294 | 294 | $Common = new Common(); |
295 | 295 | if ($type == 'aircraft') { |
296 | 296 | // If aircraft registration is only number, also check with aircraft model |
297 | - if (preg_match('/^[[:digit]]+$/',$registration) && $name != '') { |
|
298 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$registration.'%20'.urlencode($name); |
|
297 | + if (preg_match('/^[[:digit]]+$/', $registration) && $name != '') { |
|
298 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$registration.'%20'.urlencode($name); |
|
299 | 299 | } else { |
300 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$registration; |
|
300 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$registration; |
|
301 | 301 | } |
302 | 302 | } elseif ($type == 'marine') { |
303 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=ship%20"'.urlencode($name).'"'; |
|
303 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=ship%20"'.urlencode($name).'"'; |
|
304 | 304 | } else { |
305 | - $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
|
305 | + $url = 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"'; |
|
306 | 306 | } |
307 | 307 | $data = $Common->getData($url); |
308 | 308 | if ($xml = simplexml_load_string($data)) { |
309 | 309 | if (isset($xml->channel->item->link)) { |
310 | 310 | $image_url = array(); |
311 | - $thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
311 | + $thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url); |
|
312 | 312 | $image_url['thumbnail'] = $thumbnail_url; |
313 | - $original_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
313 | + $original_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url); |
|
314 | 314 | $image_url['original'] = $original_url; |
315 | - $image_url['copyright'] = str_replace('Copyright ','',trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
316 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
315 | + $image_url['copyright'] = str_replace('Copyright ', '', trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright)); |
|
316 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
317 | 317 | $image_url['source'] = 'deviantart'; |
318 | 318 | return $image_url; |
319 | 319 | } |
@@ -329,32 +329,32 @@ discard block |
||
329 | 329 | * @return Array the aircraft thumbnail, orignal url and copyright |
330 | 330 | * |
331 | 331 | */ |
332 | - public function fromJetPhotos($type,$aircraft_registration, $aircraft_name='') { |
|
332 | + public function fromJetPhotos($type, $aircraft_registration, $aircraft_name = '') { |
|
333 | 333 | $Common = new Common(); |
334 | - $url= 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
334 | + $url = 'http://jetphotos.net/showphotos.php?displaymode=2®search='.$aircraft_registration; |
|
335 | 335 | $data = $Common->getData($url); |
336 | 336 | $dom = new DOMDocument(); |
337 | 337 | @$dom->loadHTML($data); |
338 | 338 | $all_pics = array(); |
339 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
339 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
340 | 340 | if ($image->getAttribute('itemprop') == "http://schema.org/image") { |
341 | 341 | $all_pics[] = $image->getAttribute('src'); |
342 | 342 | } |
343 | 343 | } |
344 | 344 | $all_authors = array(); |
345 | - foreach($dom->getElementsByTagName('meta') as $author) { |
|
345 | + foreach ($dom->getElementsByTagName('meta') as $author) { |
|
346 | 346 | if ($author->getAttribute('itemprop') == "http://schema.org/author") { |
347 | 347 | $all_authors[] = $author->getAttribute('content'); |
348 | 348 | } |
349 | 349 | } |
350 | 350 | $all_ref = array(); |
351 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
351 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
352 | 352 | $all_ref[] = $link->getAttribute('href'); |
353 | 353 | } |
354 | 354 | if (isset($all_pics[0])) { |
355 | 355 | $image_url = array(); |
356 | 356 | $image_url['thumbnail'] = $all_pics[0]; |
357 | - $image_url['original'] = str_replace('_tb','',$all_pics[0]); |
|
357 | + $image_url['original'] = str_replace('_tb', '', $all_pics[0]); |
|
358 | 358 | $image_url['copyright'] = $all_authors[0]; |
359 | 359 | $image_url['source_website'] = 'http://jetphotos.net'.$all_ref[8]; |
360 | 360 | $image_url['source'] = 'JetPhotos'; |
@@ -371,24 +371,24 @@ discard block |
||
371 | 371 | * @return Array the aircraft thumbnail, orignal url and copyright |
372 | 372 | * |
373 | 373 | */ |
374 | - public function fromPlanePictures($type,$aircraft_registration, $aircraft_name='') { |
|
374 | + public function fromPlanePictures($type, $aircraft_registration, $aircraft_name = '') { |
|
375 | 375 | $Common = new Common(); |
376 | - $url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
376 | + $url = 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2'; |
|
377 | 377 | $data = $Common->getData($url); |
378 | 378 | $dom = new DOMDocument(); |
379 | 379 | @$dom->loadHTML($data); |
380 | 380 | $all_pics = array(); |
381 | - foreach($dom->getElementsByTagName('img') as $image) { |
|
381 | + foreach ($dom->getElementsByTagName('img') as $image) { |
|
382 | 382 | $all_pics[] = $image->getAttribute('src'); |
383 | 383 | } |
384 | 384 | $all_links = array(); |
385 | - foreach($dom->getElementsByTagName('a') as $link) { |
|
386 | - $all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href')); |
|
385 | + foreach ($dom->getElementsByTagName('a') as $link) { |
|
386 | + $all_links[] = array('text' => $link->textContent, 'href' => $link->getAttribute('href')); |
|
387 | 387 | } |
388 | - if (isset($all_pics[1]) && !preg_match('/bit.ly/',$all_pics[1]) && !preg_match('/flagge/',$all_pics[1])) { |
|
388 | + if (isset($all_pics[1]) && !preg_match('/bit.ly/', $all_pics[1]) && !preg_match('/flagge/', $all_pics[1])) { |
|
389 | 389 | $image_url = array(); |
390 | 390 | $image_url['thumbnail'] = 'http://www.planepictures.net/'.$all_pics[1]; |
391 | - $image_url['original'] = 'http://www.planepictures.net/'.str_replace('_TN','',$all_pics[1]); |
|
391 | + $image_url['original'] = 'http://www.planepictures.net/'.str_replace('_TN', '', $all_pics[1]); |
|
392 | 392 | $image_url['copyright'] = $all_links[6]['text']; |
393 | 393 | $image_url['source_website'] = 'http://www.planepictures.net/'.$all_links[2]['href']; |
394 | 394 | $image_url['source'] = 'PlanePictures'; |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | * @return Array the aircraft thumbnail, orignal url and copyright |
406 | 406 | * |
407 | 407 | */ |
408 | - public function fromFlickr($type,$registration,$name='') { |
|
408 | + public function fromFlickr($type, $registration, $name = '') { |
|
409 | 409 | $Common = new Common(); |
410 | 410 | if ($type == 'aircraft') { |
411 | 411 | if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
@@ -417,12 +417,12 @@ discard block |
||
417 | 417 | $data = $Common->getData($url); |
418 | 418 | if ($xml = simplexml_load_string($data)) { |
419 | 419 | if (isset($xml->channel->item)) { |
420 | - $original_url = trim((string)$xml->channel->item->enclosure->attributes()->url); |
|
420 | + $original_url = trim((string) $xml->channel->item->enclosure->attributes()->url); |
|
421 | 421 | $image_url = array(); |
422 | 422 | $image_url['thumbnail'] = $original_url; |
423 | 423 | $image_url['original'] = $original_url; |
424 | - $image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
425 | - $image_url['source_website'] = trim((string)$xml->channel->item->link); |
|
424 | + $image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->credit); |
|
425 | + $image_url['source_website'] = trim((string) $xml->channel->item->link); |
|
426 | 426 | $image_url['source'] = 'flickr'; |
427 | 427 | return $image_url; |
428 | 428 | } |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | return false; |
431 | 431 | } |
432 | 432 | |
433 | - public function fromIvaoMtl($type,$aircraft_icao,$airline_icao) { |
|
433 | + public function fromIvaoMtl($type, $aircraft_icao, $airline_icao) { |
|
434 | 434 | $Common = new Common(); |
435 | 435 | //echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg'; |
436 | 436 | if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) { |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | * @return Array the aircraft thumbnail, orignal url and copyright |
455 | 455 | * |
456 | 456 | */ |
457 | - public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
|
457 | + public function fromBing($type, $aircraft_registration, $aircraft_name = '') { |
|
458 | 458 | global $globalImageBingKey; |
459 | 459 | $Common = new Common(); |
460 | 460 | if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false; |
@@ -465,8 +465,8 @@ discard block |
||
465 | 465 | if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
466 | 466 | else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
467 | 467 | } |
468 | - $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
|
469 | - $data = $Common->getData($url,'get','',$headers); |
|
468 | + $headers = array("Authorization: Basic ".base64_encode("ignored:".$globalImageBingKey)); |
|
469 | + $data = $Common->getData($url, 'get', '', $headers); |
|
470 | 470 | $result = json_decode($data); |
471 | 471 | if (isset($result->d->results[0]->MediaUrl)) { |
472 | 472 | $image_url = array(); |
@@ -491,14 +491,14 @@ discard block |
||
491 | 491 | * @return Array the aircraft thumbnail, orignal url and copyright |
492 | 492 | * |
493 | 493 | */ |
494 | - public function fromAirportData($type,$aircraft_registration,$aircraft_name='') { |
|
494 | + public function fromAirportData($type, $aircraft_registration, $aircraft_name = '') { |
|
495 | 495 | $Common = new Common(); |
496 | 496 | $url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration; |
497 | 497 | $data = $Common->getData($url); |
498 | 498 | $result = json_decode($data); |
499 | 499 | if (isset($result->count) && $result->count > 0) { |
500 | 500 | $image_url = array(); |
501 | - $image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image); |
|
501 | + $image_url['original'] = str_replace('thumbnails', 'large', $result->data[0]->image); |
|
502 | 502 | $image_url['source_website'] = $result->data[0]->link; |
503 | 503 | $image_url['thumbnail'] = $result->data[0]->image; |
504 | 504 | $image_url['copyright'] = $result->data[0]->photographer; |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | * @return Array the aircraft thumbnail, orignal url and copyright |
517 | 517 | * |
518 | 518 | */ |
519 | - public function fromWikimedia($type,$registration,$name='') { |
|
519 | + public function fromWikimedia($type, $registration, $name = '') { |
|
520 | 520 | $Common = new Common(); |
521 | 521 | if ($type == 'aircraft') { |
522 | 522 | if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | $result = json_decode($data); |
530 | 530 | if (isset($result->query->search[0]->title)) { |
531 | 531 | $fileo = $result->query->search[0]->title; |
532 | - if (substr($fileo,-3) == 'pdf') return false; |
|
532 | + if (substr($fileo, -3) == 'pdf') return false; |
|
533 | 533 | $file = urlencode($fileo); |
534 | 534 | $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file; |
535 | 535 | $data2 = $Common->getData($url2); |
@@ -554,11 +554,11 @@ discard block |
||
554 | 554 | if (isset($result2->query->pages)) { |
555 | 555 | foreach ($result2->query->pages as $page) { |
556 | 556 | if (isset($page->imageinfo[0]->extmetadata->Artist)) { |
557 | - $image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
557 | + $image_url['copyright'] = preg_replace('/ from(.*)/', '', strip_tags($page->imageinfo[0]->extmetadata->Artist->value)); |
|
558 | 558 | if (isset($page->imageinfo[0]->extmetadata->License->value)) { |
559 | 559 | $image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')'; |
560 | 560 | } |
561 | - $image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright'])); |
|
561 | + $image_url['copyright'] = trim(str_replace('\n', '', $image_url['copyright'])); |
|
562 | 562 | return $image_url; |
563 | 563 | } |
564 | 564 | } |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * @return Array the aircraft thumbnail, orignal url and copyright |
578 | 578 | * |
579 | 579 | */ |
580 | - public function fromCustomSource($type,$registration,$name='') { |
|
580 | + public function fromCustomSource($type, $registration, $name = '') { |
|
581 | 581 | global $globalAircraftImageCustomSources, $globalMarineImageCustomSources, $globalDebug; |
582 | 582 | //$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true); |
583 | 583 | if (!empty($globalAircraftImageCustomSources) && $type == 'aircraft') { |
@@ -594,15 +594,15 @@ discard block |
||
594 | 594 | print_r($source); |
595 | 595 | print_r($customsources); |
596 | 596 | } |
597 | - $url = str_replace('{registration}',$registration,$source['original']); |
|
598 | - $url_thumbnail = str_replace('{registration}',$registration,$source['thumbnail']); |
|
597 | + $url = str_replace('{registration}', $registration, $source['original']); |
|
598 | + $url_thumbnail = str_replace('{registration}', $registration, $source['thumbnail']); |
|
599 | 599 | if ($Common->urlexist($url)) { |
600 | 600 | $image_url = array(); |
601 | 601 | $image_url['thumbnail'] = $url_thumbnail; |
602 | 602 | $image_url['original'] = $url; |
603 | 603 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
604 | 604 | else $exifCopyright = ''; |
605 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
605 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
606 | 606 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
607 | 607 | else $image_url['copyright'] = $source['source_website']; |
608 | 608 | $image_url['source_website'] = $source['source_website']; |
@@ -626,19 +626,19 @@ discard block |
||
626 | 626 | print_r($source); |
627 | 627 | print_r($customsources); |
628 | 628 | } |
629 | - $url = str_replace('{registration}',$registration,$source['original']); |
|
630 | - $url = str_replace('{mmsi}',$registration,$url); |
|
631 | - $url = str_replace('{name}',$name,$url); |
|
632 | - $url_thumbnail = str_replace('{registration}',$registration,$source['thumbnail']); |
|
633 | - $url_thumbnail = str_replace('{mmsi}',$registration,$url_thumbnail); |
|
634 | - $url_thumbnail = str_replace('{name}',$name,$url_thumbnail); |
|
629 | + $url = str_replace('{registration}', $registration, $source['original']); |
|
630 | + $url = str_replace('{mmsi}', $registration, $url); |
|
631 | + $url = str_replace('{name}', $name, $url); |
|
632 | + $url_thumbnail = str_replace('{registration}', $registration, $source['thumbnail']); |
|
633 | + $url_thumbnail = str_replace('{mmsi}', $registration, $url_thumbnail); |
|
634 | + $url_thumbnail = str_replace('{name}', $name, $url_thumbnail); |
|
635 | 635 | if ($Common->urlexist($url)) { |
636 | 636 | $image_url = array(); |
637 | 637 | $image_url['thumbnail'] = $url_thumbnail; |
638 | 638 | $image_url['original'] = $url; |
639 | 639 | if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
640 | 640 | else $exifCopyright = ''; |
641 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
641 | + if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
642 | 642 | elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
643 | 643 | else $image_url['copyright'] = $source['source_website']; |
644 | 644 | $image_url['source_website'] = $source['source_website']; |