Completed
Push — master ( ae4662...65be4b )
by Yannick
11:45 queued 04:47
created

getLatestData-tv.php (1 issue)

Severity

Upgrade to new PHP Analysis Engine

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
6
header('Content-Type: text/javascript');
7
$Spotter = new Spotter();
8
$spotter_array = $Spotter->getRealTimeData($_GET['q']);
9
10
$output = '{';
11
$output .= '"flights": [';
12
if (!empty($spotter_array)) {
13
	foreach($spotter_array as $spotter_item)
14
	{
15
		$output .= '{';
16
		$output .= '"flight_id": "'.$spotter_item['spotter_id'].'",';
17
		$output .= '"html": "';
18
		$output .= '<tr id=\"table-tr-'.$spotter_item['spotter_id'].'\" style=\"display:none;\">';
19
		if ($_GET['image'] == "true")
20
		{
21
			if ($spotter_item['image'] != "")
22
			{
23
				$output .= '<td class=\"aircraft_image\">';
24
				$output .= '<img src=\"'.$spotter_item['image'].'\" alt=\"Click to see more information about this flight\" title=\"Click to see more information about this flight\" />';
25
				$output .= '</td>';
26
			} else {
27
				$output .= '<td class=\"aircraft_image\">';
28
				$output .= '<img src=\"'.$globalURL.'/images/placeholder.png\" alt=\"Click to see more information about this flight\" title=\"Click to see more information about this flight\" />';
29
				$output .= '</td>';
30
			}
31
		}
32
		if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.gif'))
33
		{
34
			$output .= '<td class=\"logo\">';
35
			$output .= '<img src=\"'.$globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.gif\" />';
36
			$output .= '</td>';
37
		} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.png'))
38
		{
39
			$output .= '<td class=\"logo\">';
40
			$output .= '<img src=\"'.$globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.png\" />';
41
			$output .= '</td>';
42
		} else {
43
			$output .= '<td class=\"logo-no-image\">';
44
			if ($spotter_item['airline_name'] != "")
45
			{
46
				$output .= $spotter_item['airline_name'];
47
			}
48
			$output .= '</td>';
49
		}
50
		$output .= '<td class=\"info\">';
51
		$output .= '<div class=\"flight\">';
52
		$output .= $spotter_item['departure_airport_city'].' ('.$spotter_item['departure_airport'].') <i class=\"fa fa-arrow-right\"></i> '.$spotter_item['arrival_airport_city'].' ('.$spotter_item['arrival_airport'].')';
53
		$output .= '</div>';
54
		if ($_GET['other_i'] == "1")
55
		{
56
			$output .= '<div class=\"other1\">';
57
		} else {
58
			$output .= '<div class=\"other1\" style=\"display:none;\">';
59
		}
60
		if ($spotter_item['registration'] != "")
61
		{
62
			$output .= '<span><i class=\"fa fa-align-justify\"></i> '.$spotter_item['registration'].'</span>';
63
		}
64
		if ($spotter_item['aircraft_name'] != "")
65
		{
66
			$output .= '<span><i class=\"fa fa-plane\"></i> '.$spotter_item['aircraft_name'].'</span>';
67
		} else {
68
			if ($spotter_item['aircraft_type'] != "")
69
			{
70
				$output .= '<span><i class=\"fa fa-plane\"></i> '.$spotter_item['aircraft_type'].'</span>';
71
			}
72
		}
73
		$output .= '<span><i class=\"fa fa-calendar\"></i> '.date('M j, Y g:i a', strtotime($spotter_item['date_iso_8601'])).'</span>';
74
		$output .= '</div>';
75
		if ($_GET['other_i'] == "2")
76
		{
77
			$output .= '<div class=\"other2\">';
78
		} else {
79
			$output .= '<div class=\"other2\" style=\"display:none;\">';
80
		}
81
		$output .= '<span><i class=\"fa fa-arrow-up\"></i> '.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_name'].', '.$spotter_item['departure_airport_country'].'</span>';
82
		$output .= '<span><i class=\"fa fa-arrow-down\"></i> '.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_name'].', '.$spotter_item['arrival_airport_country'].'</span>';
83
		$output .= '</div>';
84
		if ($_GET['other_i'] == "3")
85
		{
86
			$output .= '<div class=\"other3\">';
87
		} else {
88
			$output .= '<div class=\"other3\" style=\"display:none;\">';
89
		}
90
		if ($spotter_item['ident'] != "")
91
		{
92
			$output .= '<span><i class=\"fa fa-th-list\"></i> '.$spotter_item['ident'].'</span>';
93
		}
94
		if ($spotter_item['airline_name'] != "")
95
		{
96
			$output .= '<span><i class=\"fa fa-align-justify\"></i> '.$spotter_item['airline_name'].'</span>';
97
		}
98
		if ($spotter_item['airline_country'] != "")
99
		{
100
			$output .= '<span><i class=\"fa fa-globe\"></i> '.$spotter_item['airline_country'].'</span>';
101
		}
102
		$output .= '</div>';
103
		$output .= '</td>';
104
		$output .= '</tr>';
105
106
		$output .= '"';
107
		$output .= '},';
108
	}
109
	$output = substr($output, 0, -1);
110
}
111
$output .= ']';
112
$output .= '}';
113
print $output;
114
115
?>
1 ignored issue
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...