@@ -3,8 +3,8 @@ discard block  | 
                                                    ||
| 3 | 3 |  require_once('require/class.Spotter.php'); | 
                                                        
| 4 | 4 |  require_once('require/class.Language.php'); | 
                                                        
| 5 | 5 |  if (!isset($_GET['country'])) { | 
                                                        
| 6 | -        header('Location: '.$globalURL.'/country'); | 
                                                        |
| 7 | - die();  | 
                                                        |
| 6 | +		header('Location: '.$globalURL.'/country'); | 
                                                        |
| 7 | + die();  | 
                                                        |
| 8 | 8 | }  | 
                                                        
| 9 | 9 | $Spotter = new Spotter();  | 
                                                        
| 10 | 10 |  $country = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))); | 
                                                        
@@ -61,7 +61,7 @@ discard block  | 
                                                    ||
| 61 | 61 |            function drawChart() { | 
                                                        
| 62 | 62 | var data = google.visualization.arrayToDataTable([  | 
                                                        
| 63 | 63 |              	["'._("Hour").'", "'._("# of Flights").'"], '; | 
                                                        
| 64 | - $hour_data = '';  | 
                                                        |
| 64 | + $hour_data = '';  | 
                                                        |
| 65 | 65 | foreach($hour_array as $hour_item)  | 
                                                        
| 66 | 66 |  	{ | 
                                                        
| 67 | 67 |  		$hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],'; | 
                                                        
@@ -3,8 +3,8 @@  | 
                                                    ||
| 3 | 3 |  require_once('require/class.Spotter.php'); | 
                                                        
| 4 | 4 |  require_once('require/class.Language.php'); | 
                                                        
| 5 | 5 |  if (!isset($_GET['country'])) { | 
                                                        
| 6 | -        header('Location: '.$globalURL.'/country'); | 
                                                        |
| 7 | - die();  | 
                                                        |
| 6 | +		header('Location: '.$globalURL.'/country'); | 
                                                        |
| 7 | + die();  | 
                                                        |
| 8 | 8 | }  | 
                                                        
| 9 | 9 | $Spotter = new Spotter();  | 
                                                        
| 10 | 10 |  $country = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))); | 
                                                        
@@ -41,7 +41,9 @@ discard block  | 
                                                    ||
| 41 | 41 |  { | 
                                                        
| 42 | 42 |  	if (isset($globalTimezone)) { | 
                                                        
| 43 | 43 | date_default_timezone_set($globalTimezone);  | 
                                                        
| 44 | -	} else date_default_timezone_set('UTC'); | 
                                                        |
| 44 | +	} else { | 
                                                        |
| 45 | +		date_default_timezone_set('UTC'); | 
                                                        |
| 46 | + }  | 
                                                        |
| 45 | 47 | print '<tr>';  | 
                                                        
| 46 | 48 | if (isset($_GET['image']) && $_GET['image'] == "true")  | 
                                                        
| 47 | 49 |  	{ | 
                                                        
@@ -98,10 +100,14 @@ discard block  | 
                                                    ||
| 98 | 100 | print '</div>';  | 
                                                        
| 99 | 101 | print '<div class="other2">';  | 
                                                        
| 100 | 102 | print '<span><i class="fa fa-arrow-up"></i> '.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_name'].', '.$spotter_item['departure_airport_country'];  | 
                                                        
| 101 | -	if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != '') print ' ('.$spotter_item['departure_airport_time'].')'; | 
                                                        |
| 103 | +	if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != '') { | 
                                                        |
| 104 | +		print ' ('.$spotter_item['departure_airport_time'].')'; | 
                                                        |
| 105 | + }  | 
                                                        |
| 102 | 106 | print '</span>';  | 
                                                        
| 103 | 107 | print '<span><i class="fa fa-arrow-down"></i> '.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_name'].', '.$spotter_item['arrival_airport_country'];  | 
                                                        
| 104 | -	if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != '') print ' ('.$spotter_item['arrival_airport_time'].')'; | 
                                                        |
| 108 | +	if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != '') { | 
                                                        |
| 109 | +		print ' ('.$spotter_item['arrival_airport_time'].')'; | 
                                                        |
| 110 | + }  | 
                                                        |
| 105 | 111 | print '</span>';  | 
                                                        
| 106 | 112 | print '</div>';  | 
                                                        
| 107 | 113 | print '<div class="other3">';  | 
                                                        
@@ -62,7 +62,7 @@  | 
                                                    ||
| 62 | 62 |                        function drawChart6() { | 
                                                        
| 63 | 63 | var data = google.visualization.arrayToDataTable([  | 
                                                        
| 64 | 64 | ["Hour","Altitude","Speed"], ';  | 
                                                        
| 65 | - $altitude_data = '';  | 
                                                        |
| 65 | + $altitude_data = '';  | 
                                                        |
| 66 | 66 | foreach($all_data as $data)  | 
                                                        
| 67 | 67 |  			{ | 
                                                        
| 68 | 68 |  				$altitude_data .= '[ "'.date("G:i",strtotime($data['date']." UTC")).'",'.$data['altitude'].','.$data['ground_speed'].'],'; | 
                                                        
@@ -51,7 +51,9 @@ discard block  | 
                                                    ||
| 51 | 51 | |
| 52 | 52 |  		if (isset($globalTimezone)) { | 
                                                        
| 53 | 53 | date_default_timezone_set($globalTimezone);  | 
                                                        
| 54 | -		} else date_default_timezone_set('UTC'); | 
                                                        |
| 54 | +		} else { | 
                                                        |
| 55 | +			date_default_timezone_set('UTC'); | 
                                                        |
| 56 | + }  | 
                                                        |
| 55 | 57 | |
| 56 | 58 |  		//date_default_timezone_set('UTC'); | 
                                                        
| 57 | 59 |  		if (is_array($all_data) && count($all_data) > 0) { | 
                                                        
@@ -300,9 +302,13 @@ discard block  | 
                                                    ||
| 300 | 302 | print '<div>';  | 
                                                        
| 301 | 303 | if (isset($spotter_item['pilot_id']) && $spotter_item['pilot_id'] != "")  | 
                                                        
| 302 | 304 |  			{ | 
                                                        
| 303 | -				if ($spotter_item['format_source'] == 'whazzup') print '<a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>'; | 
                                                        |
| 304 | -				elseif ($spotter_item['format_source'] == 'vatsimtxt') print '<a href="http://www.vataware.com/pilot/'.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>'; | 
                                                        |
| 305 | -				else print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; | 
                                                        |
| 305 | +				if ($spotter_item['format_source'] == 'whazzup') { | 
                                                        |
| 306 | +					print '<a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>'; | 
                                                        |
| 307 | +				} elseif ($spotter_item['format_source'] == 'vatsimtxt') { | 
                                                        |
| 308 | +					print '<a href="http://www.vataware.com/pilot/'.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a>'; | 
                                                        |
| 309 | +				} else { | 
                                                        |
| 310 | +					print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; | 
                                                        |
| 311 | + }  | 
                                                        |
| 306 | 312 |  			} else { | 
                                                        
| 307 | 313 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != "")  | 
                                                        
| 308 | 314 |  				{ | 
                                                        
@@ -8,7 +8,9 @@  | 
                                                    ||
| 8 | 8 |  if ($registration != '') { | 
                                                        
| 9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort);  | 
                                                        
| 10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration);  | 
                                                        
| 11 | -} else $spotter_array=array();  | 
                                                        |
| 11 | +} else { | 
                                                        |
| 12 | + $spotter_array=array();  | 
                                                        |
| 13 | +}  | 
                                                        |
| 12 | 14 | |
| 13 | 15 | |
| 14 | 16 | if (!empty($spotter_array))  | 
                                                        
@@ -89,7 +89,7 @@  | 
                                                    ||
| 89 | 89 |                        function drawChart6() { | 
                                                        
| 90 | 90 | var data = google.visualization.arrayToDataTable([  | 
                                                        
| 91 | 91 |                              ["Hour","'._("Altitude").'","'._("Speed").'"], '; | 
                                                        
| 92 | - $altitude_data = '';  | 
                                                        |
| 92 | + $altitude_data = '';  | 
                                                        |
| 93 | 93 | foreach($all_data as $data)  | 
                                                        
| 94 | 94 |  				{ | 
                                                        
| 95 | 95 |  					$altitude_data .= '[ "'.date("G:i",strtotime($data['date']." UTC")).'",'.$data['altitude'].','.$data['ground_speed'].'],'; | 
                                                        
@@ -118,8 +118,12 @@ discard block  | 
                                                    ||
| 118 | 118 |  	{ | 
                                                        
| 119 | 119 |  		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']); | 
                                                        
| 120 | 120 | $ident = $spotter_array[0]['ident'];  | 
                                                        
| 121 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];  | 
                                                        |
| 122 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];  | 
                                                        |
| 121 | +		if (isset($spotter_array[0]['latitude'])) { | 
                                                        |
| 122 | + $latitude = $spotter_array[0]['latitude'];  | 
                                                        |
| 123 | + }  | 
                                                        |
| 124 | +		if (isset($spotter_array[0]['longitude'])) { | 
                                                        |
| 125 | + $longitude = $spotter_array[0]['longitude'];  | 
                                                        |
| 126 | + }  | 
                                                        |
| 123 | 127 |  		require_once('header.php'); | 
                                                        
| 124 | 128 |  		if (isset($globalArchive) && $globalArchive && $type == 'aircraft') { | 
                                                        
| 125 | 129 | // Requirement for altitude graph  | 
                                                        
@@ -127,7 +131,9 @@ discard block  | 
                                                    ||
| 127 | 131 | $all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']);  | 
                                                        
| 128 | 132 |  			if (isset($globalTimezone)) { | 
                                                        
| 129 | 133 | date_default_timezone_set($globalTimezone);  | 
                                                        
| 130 | -			} else date_default_timezone_set('UTC'); | 
                                                        |
| 134 | +			} else { | 
                                                        |
| 135 | +				date_default_timezone_set('UTC'); | 
                                                        |
| 136 | + }  | 
                                                        |
| 131 | 137 |  			if (count($all_data) > 0) { | 
                                                        
| 132 | 138 | print '<div id="chart6" class="chart" width="100%"></div>  | 
                                                        
| 133 | 139 | <script>  | 
                                                        
@@ -174,14 +180,22 @@ discard block  | 
                                                    ||
| 174 | 180 |  		if (isset($spotter_array[0]['airline_icao'])) { | 
                                                        
| 175 | 181 |  			print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>';  | 
                                                        
| 176 | 182 | }  | 
                                                        
| 177 | -		if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>'; | 
                                                        |
| 183 | +		if ($type == 'aircraft') { | 
                                                        |
| 184 | +			print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>'; | 
                                                        |
| 185 | + }  | 
                                                        |
| 178 | 186 | print '</div>';  | 
                                                        
| 179 | 187 | |
| 180 | -		if ($type == 'aircraft') include('ident-sub-menu.php'); | 
                                                        |
| 188 | +		if ($type == 'aircraft') { | 
                                                        |
| 189 | +			include('ident-sub-menu.php'); | 
                                                        |
| 190 | + }  | 
                                                        |
| 181 | 191 | print '<div class="table column">';  | 
                                                        
| 182 | -		if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; | 
                                                        |
| 183 | -		elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; | 
                                                        |
| 184 | -		elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; | 
                                                        |
| 192 | +		if ($type == 'aircraft') { | 
                                                        |
| 193 | +			print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; | 
                                                        |
| 194 | +		} elseif ($type == 'marine') { | 
                                                        |
| 195 | +			print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; | 
                                                        |
| 196 | +		} elseif ($type == 'tracker') { | 
                                                        |
| 197 | +			print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; | 
                                                        |
| 198 | + }  | 
                                                        |
| 185 | 199 | |
| 186 | 200 |  		include('table-output.php');  | 
                                                        
| 187 | 201 | print '<div class="pagination">';  | 
                                                        
@@ -11,7 +11,7 @@ discard block  | 
                                                    ||
| 11 | 11 | <div class="info column">  | 
                                                        
| 12 | 12 | <h1>About <?php print $globalName; ?></h1>  | 
                                                        
| 13 | 13 | <?php  | 
                                                        
| 14 | -    if ($globalName == 'FlightAirMap') { | 
                                                        |
| 14 | +	if ($globalName == 'FlightAirMap') { | 
                                                        |
| 15 | 15 | ?>  | 
                                                        
| 16 | 16 | <p>This is an open source project displaying <u>most</u> (mostly <a href="http://en.wikipedia.org/wiki/Instrument_flight_rules" target="_blank">IFR</a>) flights that have flown near this site area.  | 
                                                        
| 17 | 17 |      <?php if ($globalADSBHUB) { ?> Some ADS-B sources come from <a href="http://www.adsbhub.net">ADSBHUB.net</a>.<?php } ?> | 
                                                        
@@ -27,18 +27,18 @@ discard block  | 
                                                    ||
| 27 | 27 | |
| 28 | 28 | <br /><br />  | 
                                                        
| 29 | 29 | <?php  | 
                                                        
| 30 | -    } else { | 
                                                        |
| 30 | +	} else { | 
                                                        |
| 31 | 31 | ?>  | 
                                                        
| 32 | 32 | <p>This project use <a href="http://www.flightairmap.fr/">FlightAirMap</a> (<a href="https://github.com/Ysurac/FlightAirMap/">source</a>) by Ycarus from <a href="http://www.zugaina.com/">Zugaina</a>.</p>  | 
                                                        
| 33 | 33 | <?php  | 
                                                        
| 34 | - }  | 
                                                        |
| 34 | + }  | 
                                                        |
| 35 | 35 | ?>  | 
                                                        
| 36 | 36 | <a name="source"></a>  | 
                                                        
| 37 | 37 | <h3>Source & Credits</h3>  | 
                                                        
| 38 | 38 | |
| 39 | 39 | <?php  | 
                                                        
| 40 | 40 |  	if ($globalFlightAware) {  | 
                                                        
| 41 | - ?>  | 
                                                        |
| 41 | + ?>  | 
                                                        |
| 42 | 42 | <p>The data from FlightAware is coming from multiple sources. Not every aircraft is tracked on FlightAware, especially not older aircrafts as well as government aircrafts, however most modern airliners will work. You can learn more about how it works on <a href="http://flightaware.com/adsb/" target="_blank">FlightAware's ADS-B</a> page. Also, not every aircraft is shown to have flown exactly at that minute as seen on this site (aka real-time). There is a 5 minute delay on some of the sources.</p>  | 
                                                        
| 43 | 43 | <?php } ?>  | 
                                                        
| 44 | 44 | <p>None of this project would have been possible without the help and contributions of these organizations and people:</p>  | 
                                                        
@@ -5,55 +5,55 @@ discard block  | 
                                                    ||
| 5 | 5 | $Spotter = new Spotter();  | 
                                                        
| 6 | 6 | |
| 7 | 7 |  if (isset($_GET['start_date'])) { | 
                                                        
| 8 | - //for the date manipulation into the query  | 
                                                        |
| 9 | -        if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ | 
                                                        |
| 10 | - $start_date = $_GET['start_date'].":00";  | 
                                                        |
| 11 | - $end_date = $_GET['end_date'].":00";  | 
                                                        |
| 12 | - $sql_date = $start_date.",".$end_date;  | 
                                                        |
| 13 | -        } else if($_GET['start_date'] != ""){ | 
                                                        |
| 14 | - $start_date = $_GET['start_date'].":00";  | 
                                                        |
| 15 | - $sql_date = $start_date;  | 
                                                        |
| 16 | -        } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ | 
                                                        |
| 17 | -                $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; | 
                                                        |
| 18 | - $sql_date = $end_date;  | 
                                                        |
| 19 | - } else $sql_date = '';  | 
                                                        |
| 8 | + //for the date manipulation into the query  | 
                                                        |
| 9 | +		if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ | 
                                                        |
| 10 | + $start_date = $_GET['start_date'].":00";  | 
                                                        |
| 11 | + $end_date = $_GET['end_date'].":00";  | 
                                                        |
| 12 | + $sql_date = $start_date.",".$end_date;  | 
                                                        |
| 13 | +		} else if($_GET['start_date'] != ""){ | 
                                                        |
| 14 | + $start_date = $_GET['start_date'].":00";  | 
                                                        |
| 15 | + $sql_date = $start_date;  | 
                                                        |
| 16 | +		} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ | 
                                                        |
| 17 | +				$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; | 
                                                        |
| 18 | + $sql_date = $end_date;  | 
                                                        |
| 19 | + } else $sql_date = '';  | 
                                                        |
| 20 | 20 | } else $sql_date = '';  | 
                                                        
| 21 | 21 | |
| 22 | 22 |  if (isset($_GET['highest_altitude'])) { | 
                                                        
| 23 | - //for altitude manipulation  | 
                                                        |
| 24 | -        if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ | 
                                                        |
| 25 | - $end_altitude = $_GET['highest_altitude'];  | 
                                                        |
| 26 | - $start_altitude = $_GET['lowest_altitude'];  | 
                                                        |
| 27 | - $sql_altitude = $start_altitude.",".$end_altitude;  | 
                                                        |
| 28 | -        } else if($_GET['highest_altitude'] != ""){ | 
                                                        |
| 29 | - $end_altitude = $_GET['highest_altitude'];  | 
                                                        |
| 30 | - $sql_altitude = $end_altitude;  | 
                                                        |
| 31 | -        } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ | 
                                                        |
| 32 | - $start_altitude = $_GET['lowest_altitude'].",60000";  | 
                                                        |
| 33 | - $sql_altitude = $start_altitude;  | 
                                                        |
| 34 | - } else $sql_altitude = '';  | 
                                                        |
| 23 | + //for altitude manipulation  | 
                                                        |
| 24 | +		if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ | 
                                                        |
| 25 | + $end_altitude = $_GET['highest_altitude'];  | 
                                                        |
| 26 | + $start_altitude = $_GET['lowest_altitude'];  | 
                                                        |
| 27 | + $sql_altitude = $start_altitude.",".$end_altitude;  | 
                                                        |
| 28 | +		} else if($_GET['highest_altitude'] != ""){ | 
                                                        |
| 29 | + $end_altitude = $_GET['highest_altitude'];  | 
                                                        |
| 30 | + $sql_altitude = $end_altitude;  | 
                                                        |
| 31 | +		} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ | 
                                                        |
| 32 | + $start_altitude = $_GET['lowest_altitude'].",60000";  | 
                                                        |
| 33 | + $sql_altitude = $start_altitude;  | 
                                                        |
| 34 | + } else $sql_altitude = '';  | 
                                                        |
| 35 | 35 | } else $sql_altitude = '';  | 
                                                        
| 36 | 36 | |
| 37 | 37 | //calculuation for the pagination  | 
                                                        
| 38 | 38 | if(!isset($_GET['limit']))  | 
                                                        
| 39 | 39 |  { | 
                                                        
| 40 | - if (!isset($_GET['number_results']))  | 
                                                        |
| 41 | -        { | 
                                                        |
| 42 | - $limit_start = 0;  | 
                                                        |
| 43 | - $limit_end = 25;  | 
                                                        |
| 44 | - $absolute_difference = 25;  | 
                                                        |
| 45 | -        } else { | 
                                                        |
| 46 | -                if ($_GET['number_results'] > 1000){ | 
                                                        |
| 47 | - $_GET['number_results'] = 1000;  | 
                                                        |
| 48 | - }  | 
                                                        |
| 49 | - $limit_start = 0;  | 
                                                        |
| 50 | - $limit_end = $_GET['number_results'];  | 
                                                        |
| 51 | - $absolute_difference = $_GET['number_results'];  | 
                                                        |
| 52 | - }  | 
                                                        |
| 40 | + if (!isset($_GET['number_results']))  | 
                                                        |
| 41 | +		{ | 
                                                        |
| 42 | + $limit_start = 0;  | 
                                                        |
| 43 | + $limit_end = 25;  | 
                                                        |
| 44 | + $absolute_difference = 25;  | 
                                                        |
| 45 | +		} else { | 
                                                        |
| 46 | +				if ($_GET['number_results'] > 1000){ | 
                                                        |
| 47 | + $_GET['number_results'] = 1000;  | 
                                                        |
| 48 | + }  | 
                                                        |
| 49 | + $limit_start = 0;  | 
                                                        |
| 50 | + $limit_end = $_GET['number_results'];  | 
                                                        |
| 51 | + $absolute_difference = $_GET['number_results'];  | 
                                                        |
| 52 | + }  | 
                                                        |
| 53 | 53 |  }  else { | 
                                                        
| 54 | -        $limit_explode = explode(",", $_GET['limit']); | 
                                                        |
| 55 | - $limit_start = $limit_explode[0];  | 
                                                        |
| 56 | - $limit_end = $limit_explode[1];  | 
                                                        |
| 54 | +		$limit_explode = explode(",", $_GET['limit']); | 
                                                        |
| 55 | + $limit_start = $limit_explode[0];  | 
                                                        |
| 56 | + $limit_end = $limit_explode[1];  | 
                                                        |
| 57 | 57 | }  | 
                                                        
| 58 | 58 | $absolute_difference = abs($limit_start - $limit_end);  | 
                                                        
| 59 | 59 | $limit_next = $limit_end + $absolute_difference;  | 
                                                        
@@ -96,41 +96,41 @@ discard block  | 
                                                    ||
| 96 | 96 | foreach($spotter_array as $spotter_item)  | 
                                                        
| 97 | 97 |    { | 
                                                        
| 98 | 98 | |
| 99 | - $output .= $spotter_item['spotter_id'].',';  | 
                                                        |
| 100 | - $output .= $spotter_item['ident'].',';  | 
                                                        |
| 101 | - $output .= $spotter_item['registration'].',';  | 
                                                        |
| 102 | - $output .= $spotter_item['aircraft_type'].',';  | 
                                                        |
| 103 | - $output .= $spotter_item['aircraft_name'].',';  | 
                                                        |
| 104 | - $output .= $spotter_item['aircraft_manufacturer'].',';  | 
                                                        |
| 105 | - $output .= $spotter_item['airline_name'].',';  | 
                                                        |
| 106 | - $output .= $spotter_item['airline_icao'].',';  | 
                                                        |
| 107 | - $output .= $spotter_item['airline_iata'].',';  | 
                                                        |
| 108 | - $output .= $spotter_item['airline_country'].',';  | 
                                                        |
| 109 | - $output .= $spotter_item['airline_callsign'].',';  | 
                                                        |
| 110 | - $output .= $spotter_item['airline_type'].',';  | 
                                                        |
| 111 | - $output .= $spotter_item['departure_airport_city'].',';  | 
                                                        |
| 112 | - $output .= $spotter_item['departure_airport_country'].',';  | 
                                                        |
| 113 | - $output .= $spotter_item['departure_airport_iata'].',';  | 
                                                        |
| 114 | - $output .= $spotter_item['departure_airport_icao'].',';  | 
                                                        |
| 115 | - $output .= $spotter_item['departure_airport_latitude'].',';  | 
                                                        |
| 116 | - $output .= $spotter_item['departure_airport_longitude'].',';  | 
                                                        |
| 117 | - $output .= $spotter_item['departure_airport_altitude'].',';  | 
                                                        |
| 118 | - $output .= $spotter_item['arrival_airport_city'].',';  | 
                                                        |
| 119 | - $output .= $spotter_item['arrival_airport_country'].',';  | 
                                                        |
| 120 | - $output .= $spotter_item['arrival_airport_iata'].',';  | 
                                                        |
| 121 | - $output .= $spotter_item['arrival_airport_icao'].',';  | 
                                                        |
| 122 | - $output .= $spotter_item['arrival_airport_latitude'].',';  | 
                                                        |
| 123 | - $output .= $spotter_item['arrival_airport_longitude'].',';  | 
                                                        |
| 124 | - $output .= $spotter_item['arrival_airport_altitude'].',';  | 
                                                        |
| 125 | - $output .= $spotter_item['latitude'].',';  | 
                                                        |
| 126 | - $output .= $spotter_item['longitude'].',';  | 
                                                        |
| 127 | - $output .= $spotter_item['altitude'].',';  | 
                                                        |
| 128 | - $output .= $spotter_item['ground_speed'].',';  | 
                                                        |
| 129 | - $output .= $spotter_item['heading'].',';  | 
                                                        |
| 130 | - $output .= $spotter_item['heading_name'].',';  | 
                                                        |
| 131 | - $output .= $spotter_item['waypoints'].',';  | 
                                                        |
| 132 | -    $output .= date("c", strtotime($spotter_item['date_iso_8601'])); | 
                                                        |
| 133 | - $output .= "\n";  | 
                                                        |
| 99 | + $output .= $spotter_item['spotter_id'].',';  | 
                                                        |
| 100 | + $output .= $spotter_item['ident'].',';  | 
                                                        |
| 101 | + $output .= $spotter_item['registration'].',';  | 
                                                        |
| 102 | + $output .= $spotter_item['aircraft_type'].',';  | 
                                                        |
| 103 | + $output .= $spotter_item['aircraft_name'].',';  | 
                                                        |
| 104 | + $output .= $spotter_item['aircraft_manufacturer'].',';  | 
                                                        |
| 105 | + $output .= $spotter_item['airline_name'].',';  | 
                                                        |
| 106 | + $output .= $spotter_item['airline_icao'].',';  | 
                                                        |
| 107 | + $output .= $spotter_item['airline_iata'].',';  | 
                                                        |
| 108 | + $output .= $spotter_item['airline_country'].',';  | 
                                                        |
| 109 | + $output .= $spotter_item['airline_callsign'].',';  | 
                                                        |
| 110 | + $output .= $spotter_item['airline_type'].',';  | 
                                                        |
| 111 | + $output .= $spotter_item['departure_airport_city'].',';  | 
                                                        |
| 112 | + $output .= $spotter_item['departure_airport_country'].',';  | 
                                                        |
| 113 | + $output .= $spotter_item['departure_airport_iata'].',';  | 
                                                        |
| 114 | + $output .= $spotter_item['departure_airport_icao'].',';  | 
                                                        |
| 115 | + $output .= $spotter_item['departure_airport_latitude'].',';  | 
                                                        |
| 116 | + $output .= $spotter_item['departure_airport_longitude'].',';  | 
                                                        |
| 117 | + $output .= $spotter_item['departure_airport_altitude'].',';  | 
                                                        |
| 118 | + $output .= $spotter_item['arrival_airport_city'].',';  | 
                                                        |
| 119 | + $output .= $spotter_item['arrival_airport_country'].',';  | 
                                                        |
| 120 | + $output .= $spotter_item['arrival_airport_iata'].',';  | 
                                                        |
| 121 | + $output .= $spotter_item['arrival_airport_icao'].',';  | 
                                                        |
| 122 | + $output .= $spotter_item['arrival_airport_latitude'].',';  | 
                                                        |
| 123 | + $output .= $spotter_item['arrival_airport_longitude'].',';  | 
                                                        |
| 124 | + $output .= $spotter_item['arrival_airport_altitude'].',';  | 
                                                        |
| 125 | + $output .= $spotter_item['latitude'].',';  | 
                                                        |
| 126 | + $output .= $spotter_item['longitude'].',';  | 
                                                        |
| 127 | + $output .= $spotter_item['altitude'].',';  | 
                                                        |
| 128 | + $output .= $spotter_item['ground_speed'].',';  | 
                                                        |
| 129 | + $output .= $spotter_item['heading'].',';  | 
                                                        |
| 130 | + $output .= $spotter_item['heading_name'].',';  | 
                                                        |
| 131 | + $output .= $spotter_item['waypoints'].',';  | 
                                                        |
| 132 | +	$output .= date("c", strtotime($spotter_item['date_iso_8601'])); | 
                                                        |
| 133 | + $output .= "\n";  | 
                                                        |
| 134 | 134 | }  | 
                                                        
| 135 | 135 | }  | 
                                                        
| 136 | 136 | |
@@ -16,8 +16,12 @@ discard block  | 
                                                    ||
| 16 | 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 | - } else $sql_date = '';  | 
                                                        |
| 20 | -} else $sql_date = '';  | 
                                                        |
| 19 | +        } else { | 
                                                        |
| 20 | + $sql_date = '';  | 
                                                        |
| 21 | + }  | 
                                                        |
| 22 | +        } else { | 
                                                        |
| 23 | + $sql_date = '';  | 
                                                        |
| 24 | +}  | 
                                                        |
| 21 | 25 | |
| 22 | 26 |  if (isset($_GET['highest_altitude'])) { | 
                                                        
| 23 | 27 | //for altitude manipulation  | 
                                                        
@@ -31,8 +35,12 @@ discard block  | 
                                                    ||
| 31 | 35 |          } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ | 
                                                        
| 32 | 36 | $start_altitude = $_GET['lowest_altitude'].",60000";  | 
                                                        
| 33 | 37 | $sql_altitude = $start_altitude;  | 
                                                        
| 34 | - } else $sql_altitude = '';  | 
                                                        |
| 35 | -} else $sql_altitude = '';  | 
                                                        |
| 38 | +        } else { | 
                                                        |
| 39 | + $sql_altitude = '';  | 
                                                        |
| 40 | + }  | 
                                                        |
| 41 | +        } else { | 
                                                        |
| 42 | + $sql_altitude = '';  | 
                                                        |
| 43 | +}  | 
                                                        |
| 36 | 44 | |
| 37 | 45 | //calculuation for the pagination  | 
                                                        
| 38 | 46 | if(!isset($_GET['limit']))  | 
                                                        
@@ -50,7 +58,7 @@ discard block  | 
                                                    ||
| 50 | 58 | $limit_end = $_GET['number_results'];  | 
                                                        
| 51 | 59 | $absolute_difference = $_GET['number_results'];  | 
                                                        
| 52 | 60 | }  | 
                                                        
| 53 | -}  else { | 
                                                        |
| 61 | +} else { | 
                                                        |
| 54 | 62 |          $limit_explode = explode(",", $_GET['limit']); | 
                                                        
| 55 | 63 | $limit_start = $limit_explode[0];  | 
                                                        
| 56 | 64 | $limit_end = $limit_explode[1];  | 
                                                        
@@ -67,8 +75,11 @@ discard block  | 
                                                    ||
| 67 | 75 | |
| 68 | 76 |  header("Content-type: text/csv"); | 
                                                        
| 69 | 77 | |
| 70 | -if (isset($_GET['sort'])) $sort = $_GET['sort'];  | 
                                                        |
| 71 | -else $sort = '';  | 
                                                        |
| 78 | +if (isset($_GET['sort'])) { | 
                                                        |
| 79 | + $sort = $_GET['sort'];  | 
                                                        |
| 80 | +} else { | 
                                                        |
| 81 | + $sort = '';  | 
                                                        |
| 82 | +}  | 
                                                        |
| 72 | 83 | |
| 73 | 84 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);  | 
                                                        
| 74 | 85 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);  | 
                                                        
@@ -12,7 +12,7 @@  | 
                                                    ||
| 12 | 12 | $limit_start = 0;  | 
                                                        
| 13 | 13 | $limit_end = 28;  | 
                                                        
| 14 | 14 | $absolute_difference = 28;  | 
                                                        
| 15 | -}  else { | 
                                                        |
| 15 | +} else { | 
                                                        |
| 16 | 16 |  	$limit_explode = explode(",", $_GET['limit']); | 
                                                        
| 17 | 17 | $limit_start = $limit_explode[0];  | 
                                                        
| 18 | 18 | $limit_end = $limit_explode[1];  |