These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | require_once('require/class.Connection.php'); |
||
3 | require_once('require/class.Spotter.php'); |
||
4 | require_once('require/class.Language.php'); |
||
5 | $Spotter = new Spotter(); |
||
6 | if (isset($_GET['start_date'])) { |
||
7 | //for the date manipulation into the query |
||
8 | if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
||
9 | $start_date = $_GET['start_date'].":00"; |
||
10 | $end_date = $_GET['end_date'].":00"; |
||
11 | $sql_date = $start_date.",".$end_date; |
||
12 | } else if($_GET['start_date'] != ""){ |
||
13 | $start_date = $_GET['start_date'].":00"; |
||
14 | $sql_date = $start_date; |
||
15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
||
16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
||
17 | $sql_date = $end_date; |
||
18 | } else $sql_date = ''; |
||
19 | } else $sql_date = ''; |
||
20 | |||
21 | if (isset($_GET['highest_altitude'])) { |
||
22 | //for altitude manipulation |
||
23 | if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
||
24 | $end_altitude = $_GET['highest_altitude']; |
||
25 | $start_altitude = $_GET['lowest_altitude']; |
||
26 | $sql_altitude = $start_altitude.",".$end_altitude; |
||
27 | } else if($_GET['highest_altitude'] != ""){ |
||
28 | $end_altitude = $_GET['highest_altitude']; |
||
29 | $sql_altitude = $end_altitude; |
||
30 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
||
31 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
||
32 | $sql_altitude = $start_altitude; |
||
33 | } else $sql_altitude = ''; |
||
34 | } else $sql_altitude = ''; |
||
35 | |||
36 | //calculuation for the pagination |
||
37 | if(!isset($_GET['limit'])) |
||
38 | { |
||
39 | if (!isset($_GET['number_results'])) |
||
40 | { |
||
41 | $limit_start = 0; |
||
42 | $limit_end = 25; |
||
43 | $absolute_difference = 25; |
||
44 | } else { |
||
45 | if ($_GET['number_results'] > 1000){ |
||
46 | $_GET['number_results'] = 1000; |
||
47 | } |
||
48 | $limit_start = 0; |
||
49 | $limit_end = $_GET['number_results']; |
||
50 | $absolute_difference = $_GET['number_results']; |
||
51 | } |
||
52 | } else { |
||
53 | $limit_explode = explode(",", $_GET['limit']); |
||
54 | $limit_start = $limit_explode[0]; |
||
55 | $limit_end = $limit_explode[1]; |
||
56 | } |
||
57 | |||
58 | $absolute_difference = abs($limit_start - $limit_end); |
||
59 | $limit_next = $limit_end + $absolute_difference; |
||
60 | $limit_previous_1 = $limit_start - $absolute_difference; |
||
61 | $limit_previous_2 = $limit_end - $absolute_difference; |
||
62 | |||
63 | if ($_GET['download'] == "true") |
||
64 | { |
||
65 | header('Content-disposition: attachment; filename="flightairmap.txt"'); |
||
66 | } |
||
67 | |||
68 | header("Content-type: text/plain"); |
||
69 | |||
70 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
||
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,''); |
||
89 | |||
90 | $flights = array(); |
||
91 | |||
92 | if (!empty($spotter_array)) |
||
93 | { |
||
94 | foreach($spotter_array as $spotter_item) |
||
95 | { |
||
96 | |||
97 | array_push($flights, array( |
||
98 | "id" => $spotter_item['spotter_id'], |
||
99 | "ident" => $spotter_item['ident'], |
||
100 | "registration" => $spotter_item['registration'], |
||
101 | "aircraft_icao" => $spotter_item['aircraft_type'], |
||
102 | "aircraft_name" => $spotter_item['aircraft_name'], |
||
103 | "aircraft_manufacturer" => $spotter_item['aircraft_manufacturer'], |
||
104 | "airline_name" => $spotter_item['airline_name'], |
||
105 | "airline_icao" => $spotter_item['airline_icao'], |
||
106 | "airline_iata" => $spotter_item['airline_iata'], |
||
107 | "airline_country" => $spotter_item['airline_country'], |
||
108 | "airline_callsign" => $spotter_item['airline_callsign'], |
||
109 | "airline_type" => $spotter_item['airline_type'], |
||
110 | "departure_airport_city" => $spotter_item['departure_airport_city'], |
||
111 | "departure_airport_country" => $spotter_item['departure_airport_country'], |
||
112 | "departure_airport_iata" => $spotter_item['departure_airport_iata'], |
||
113 | "departure_airport_icao" => $spotter_item['departure_airport_icao'], |
||
114 | "departure_airport_latitude" => $spotter_item['departure_airport_latitude'], |
||
115 | "departure_airport_longitude" => $spotter_item['departure_airport_longitude'], |
||
116 | "departure_airport_altitude" => $spotter_item['departure_airport_altitude'], |
||
117 | "arrival_airport_city" => $spotter_item['arrival_airport_city'], |
||
118 | "arrival_airport_country" => $spotter_item['arrival_airport_country'], |
||
119 | "arrival_airport_iata" => $spotter_item['arrival_airport_iata'], |
||
120 | "arrival_airport_icao" => $spotter_item['arrival_airport_icao'], |
||
121 | "arrival_airport_latitude" => $spotter_item['arrival_airport_latitude'], |
||
122 | "arrival_airport_longitude" => $spotter_item['arrival_airport_longitude'], |
||
123 | "arrival_airport_altitude" => $spotter_item['arrival_airport_altitude'], |
||
124 | "latitude" => $spotter_item['latitude'], |
||
125 | "longitude" => $spotter_item['longitude'], |
||
126 | "altitude" => $spotter_item['altitude'], |
||
127 | "ground_speed" => $spotter_item['ground_speed'], |
||
128 | "heading" => $spotter_item['heading'], |
||
129 | "heading_name" => $spotter_item['heading_name'], |
||
130 | "waypoints" => $spotter_item['waypoints'], |
||
131 | "date" => date("c", strtotime($spotter_item['date_iso_8601'])) |
||
132 | ) |
||
133 | ); |
||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||
134 | } |
||
135 | } |
||
136 | |||
137 | $flights = serialize($flights); |
||
138 | |||
139 | print $flights; |
||
140 | ?> |