Completed
Push — master ( 3f174d...72d96f )
by Yannick
12:45
created

table-output.php (8 issues)

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
print '<div class="table-responsive">';
3
print '<table class="table-striped">';
4
5
// FIXME : Dirty Hacks
6
if (!isset($_GET['sort'])) 
7
{
8
	$_GET['sort'] = '';
9
}
10
if (!isset($showSpecial)) 
11
{
12
	$showSpecial = false;
13
}
14
if (!isset($hide_th_links)) 
15
{
16
	$hide_th_links = false;
17
}
18
19
if (strtolower($current_page) == "search")
20
{
21
	print '<thead>';
22
	print '<th class="aircraft_thumbnail"></th>';
23 View Code Duplication
	if ($_GET['sort'] == "airline_name_asc")
24
	{
25
		print '<th class="logo"><a href="'.$page_url.'&sort=airline_name_desc" class="active">'._("Airline").'</a> <i class="fa fa-caret-up"></i></th>';
26
	} else if ($_GET['sort'] == "airline_name_desc")
27
	{
28
		 print '<th class="logo"><a href="'.$page_url.'&sort=airline_name_asc" class="active">'._("Airline").'</a> <i class="fa fa-caret-down"></i></th>';
29
	} else {
30
		print '<th class="logo"><a href="'.$page_url.'&sort=airline_name_asc">'._("Airline").'</a> <i class="fa fa-sort small"></i></th>';
31
	}
32 View Code Duplication
	if ($_GET['sort'] == "ident_asc")
33
	{
34
		print '<th class="ident"><a href="'.$page_url.'&sort=ident_desc" class="active">'._("Ident").'</a> <i class="fa fa-caret-up"></i></th>';
35
	} else if ($_GET['sort'] == "ident_desc")
36
	{
37
		print '<th class="ident"><a href="'.$page_url.'&sort=ident_asc" class="active">'._("Ident").'</a> <i class="fa fa-caret-down"></i></th>';
38
	} else {
39
		print '<th class="ident"><a href="'.$page_url.'&sort=ident_asc">'._("Ident").'</a> <i class="fa fa-sort small"></i></th>';
40
	}
41 View Code Duplication
	if ($_GET['sort'] == "aircraft_asc")
42
	{
43
		print '<th class="type"><a href="'.$page_url.'&sort=aircraft_desc" class="active">'._("Aircraft").'</a> <i class="fa fa-caret-up"></i></th>';
44
	} else if ($_GET['sort'] == "aircraft_desc")
45
	{
46
		print '<th class="type"><a href="'.$page_url.'&sort=aircraft_asc" class="active">'._("Aircraft").'</a> <i class="fa fa-caret-down"></i></th>';
47
	} else {
48
		print '<th class="type"><a href="'.$page_url.'&sort=aircraft_asc">'._("Aircraft").'</a> <i class="fa fa-sort small"></i></th>';
49
	}
50 View Code Duplication
	if ($_GET['sort'] == "airport_departure_asc")
51
	{
52
		print '<th class="departure"><a href="'.$page_url.'&sort=airport_departure_desc" class="active"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></a> <i class="fa fa-caret-up"></i></th>';
53
	} else if ($_GET['sort'] == "airport_departure_desc")
54
	{
55
		print '<th class="departure"><a href="'.$page_url.'&sort=airport_departure_asc" class="active"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></a> <i class="fa fa-caret-down"></i></th>';
56
	} else {
57
		print '<th class="departure"><a href="'.$page_url.'&sort=airport_departure_asc"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></a> <i class="fa fa-sort small"></i></th>';
58
	}
59 View Code Duplication
	if ($_GET['sort'] == "airport_arrival_asc")
60
	{
61
		print '<th class="arrival"><a href="'.$page_url.'&sort=airport_arrival_desc" class="active"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></a> <i class="fa fa-caret-up"></i></th>';
62
	} else if ($_GET['sort'] == "airport_arrival_desc")
63
	{
64
		print '<th class="arrival"><a href="'.$page_url.'&sort=airport_arrival_asc" class="active"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></a> <i class="fa fa-caret-down"></i></th>';
65
	} else {
66
		print '<th class="arrival"><a href="'.$page_url.'&sort=airport_arrival_asc"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></a> <i class="fa fa-sort small"></i></th>';
67
	}
68
	print '<th class="routestop"><span class="nomobile">'._("Route stop").'</span><span class="mobile">'._("Stop").'</span></a></th>';
69
	if (isset($_GET['dist']) && $_GET['dist'] != '') {
70
		if ($_GET['sort'] == "distance_asc")
71
		{
72
			print '<th class="distance"><a href="'.$page_url.'&sort=distance_desc" class="active"><span class="nomobile">'._("Distance").'</span><span class="mobile">'._("Distance").'</span></a> <i class="fa fa-caret-up"></i></th>';
73
		} elseif ($_GET['sort'] == "distance_desc")
74
		{
75
			print '<th class="distance"><a href="'.$page_url.'&sort=distance_asc" class="active"><span class="nomobile">'._("Distance").'</span><span class="mobile">'._("Distance").'</span></a> <i class="fa fa-caret-down"></i></th>';
76
		} else {
77
			print '<th class="distance"><a href="'.$page_url.'&sort=distance_desc" class="active"><span class="nomobile">'._("Distance").'</span><span class="mobile">'._("Distance").'</span></a> <i class="fa fa-sort small"></i></th>';
78
		}
79
	}
80 View Code Duplication
	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
81
		print '<th class="pilot"><span class="nomobile">'._("Pilot name").'</span><span class="mobile">'._("Pilot").'</span></a></th>';
82
	} else {
83
		print '<th class="owner"><span class="nomobile">'._("Owner name").'</span><span class="mobile">'._("Owner").'</span></a></th>';
84
	}
85 View Code Duplication
	if ($_GET['sort'] == "date_asc")
86
	{
87
		print '<th class="time"><a href="'.$page_url.'&sort=date_desc" class="active">'._("Date").'</a> <i class="fa fa-caret-up"></i></th>';
88
	} else if ($_GET['sort'] == "date_desc")
89
	{
90
		print '<th class="time"><a href="'.$page_url.'&sort=date_asc" class="active">'._("Date").'</a> <i class="fa fa-caret-down"></i></th>';
91
	} else {
92
		print '<th class="time"><a href="'.$page_url.'&sort=date_asc">'._("Date").'</a> <i class="fa fa-sort small"></i></th>';
93
	}
94
	print '<th class="more"></th>';
95
	print '</thead>';
96
} else if (strtolower($current_page) == "upcoming"){
97
	print '<thead>';
98
	if ($_GET['sort'] == "airline_name_asc")
99
	{
100
		print '<th class="logo"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airline_name_desc" class="active">'._("Airline").'</a> <i class="fa fa-caret-up"></i></th>';
101
	} else if ($_GET['sort'] == "airline_name_desc")
102
	{
103
		print '<th class="logo"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airline_name_asc" class="active">'._("Airline").'</a> <i class="fa fa-caret-down"></i></th>';
104
	} else {
105
		print '<th class="logo"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airline_name_asc">'._("Airline").'</a> <i class="fa fa-sort small"></i></th>';
106
	}
107
	if ($_GET['sort'] == "ident_asc")
108
	{
109
		print '<th class="ident"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/ident_desc" class="active">'._("Ident").'</a> <i class="fa fa-caret-up"></i></th>';
110
	} else if ($_GET['sort'] == "ident_desc")
111
	{
112
		print '<th class="ident"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/ident_asc" class="active">'._("Ident").'</a> <i class="fa fa-caret-down"></i></th>';
113
	} else {
114
		print '<th class="ident"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/ident_asc">'._("Ident").'</a> <i class="fa fa-sort small"></i></th>';
115
	}
116 View Code Duplication
	if ($_GET['sort'] == "airport_departure_asc")
117
	{
118
		print '<th class="departure"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_departure_desc" class="active"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></a> <i class="fa fa-caret-up"></i></th>';
119
	} else if ($_GET['sort'] == "airport_departure_desc")
120
	{
121
		print '<th class="departure"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_departure_asc" class="active"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></a> <i class="fa fa-caret-down"></i></th>';
122
	} else {
123
		print '<th class="departure"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_departure_asc"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></a> <i class="fa fa-sort small"></i></th>';
124
	}
125 View Code Duplication
	if ($_GET['sort'] == "airport_arrival_asc")
126
	{
127
		print '<th class="arrival"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_arrival_desc" class="active"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></a> <i class="fa fa-caret-up"></i></th>';
128
	} else if ($_GET['sort'] == "airport_arrival_desc")
129
	{
130
		print '<th class="arrival"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_arrival_asc" class="active"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></a> <i class="fa fa-caret-down"></i></th>';
131
	} else {
132
		print '<th class="arrival"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_arrival_asc"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></a> <i class="fa fa-sort small"></i></th>';
133
	}
134 View Code Duplication
	if ($_GET['sort'] == "date_asc")
135
	{
136
		print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_desc" class="active">'._("Expected Time").'</a> <i class="fa fa-caret-up"></i></th>';
137
	} else if ($_GET['sort'] == "date_desc")
138
	{
139
		print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_asc" class="active">'._("Expected Time").'</a> <i class="fa fa-caret-down"></i></th>';
140
	} else {
141
		print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_asc">'._("Expected Time").'</a> <i class="fa fa-sort small"></i></th>';
142
	}
143
	print '</thead>';
144
} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){
145
	print '<thead>';
146
	print '<th class="aircraft_thumbnail"></th>';
147
	print '<th class="logo">'._("Airline").'</th>';
148
	print '<th class="ident">'._("Ident").'</th>';
149
	print '<th class="message">'._("Message").'</th>';
150
	print '<th class="time">'._("Date").'</th>';
151
	print '<th class="more"></th>';
152
	print '</thead>';
153
} else {
154
155
	if ($hide_th_links === true){
156
		print '<thead>';
157
		print '<th class="aircraft_thumbnail"></th>';
158
		if ($_GET['sort'] == "airline_name_asc")
159
		{
160
			print '<th class="logo">'._("Airline").'</th>';
161
		} else if ($_GET['sort'] == "airline_name_desc")
162
		{
163
			print '<th class="logo">'._("Airline").'</th>';
164
		} else {
165
			print '<th class="logo">'._("Airline").'</th>';
166
		}
167
		if ($_GET['sort'] == "ident_asc")
168
		{
169
			print '<th class="ident">'._("Ident").'</th>';
170
		} else if ($_GET['sort'] == "ident_desc")
171
		{
172
			print '<th class="ident">'._("Ident").'</th>';
173
		} else {
174
			print '<th class="ident">'._("Ident").'</th>';
175
		}
176
		if ($_GET['sort'] == "aircraft_asc")
177
		{
178
			print '<th class="type">'._("Aircraft").'</th>';
179
		} else if ($_GET['sort'] == "aircraft_desc")
180
		{
181
			print '<th class="type">'._("Aircraft").'</th>';
182
		} else {
183
			print '<th class="type">'._("Aircraft").'</th>';
184
		}
185
		if ($_GET['sort'] == "airport_departure_asc")
186
		{
187
			print '<th class="departure"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></th>';
188 View Code Duplication
		} else if ($_GET['sort'] == "airport_departure_desc")
189
		{
190
			print '<th class="departure"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></th>';
191
		} else {
192
			print '<th class="departure"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></th>';
193
		}
194
		if ($_GET['sort'] == "airport_arrival_asc")
195
		{
196
			print '<th class="arrival"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></th>';
197 View Code Duplication
		} else if ($_GET['sort'] == "airport_arrival_desc")
198
		{
199
			print '<th class="arrival"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></th>';
200
		} else {
201
			print '<th class="arrival"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></th>';
202
		}                                               
203
		print '<th class="route"><span class="nomobile">'._("Route").'</span><span class="mobile">'._("Route").'</span></th>';
204 View Code Duplication
		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
205
			print '<th class="pilot"><span class="nomobile">'._("Pilot name").'</span><span class="mobile">'._("Pilot").'</span></a></th>';
206
		} else {
207
			print '<th class="owner"><span class="nomobile">'._("Owner name").'</span><span class="mobile">'._("Owner").'</span></a></th>';
208
		}
209
		
210
		if (strtolower($current_page) == "date")
211
		{
212 View Code Duplication
			if ($_GET['sort'] == "date_asc")
213
			{
214
				print '<th class="time">'._("Time").'</th>';
215
			} else if ($_GET['sort'] == "date_desc")
216
			{
217
				print '<th class="time">'._("Time").'</th>';
218
			} else {
219
				print '<th class="time">'._("Time").'</th>';
220
			}
221 View Code Duplication
		} elseif (strtolower($current_page) == "currently") {
222
			if ($_GET['sort'] == "date_asc")
223
			{
224
				print '<th class="time">'._("Date first seen").'</th>';
225
			} else if ($_GET['sort'] == "date_desc")
226
			{
227
				print '<th class="time">'._("Date first seen").'</th>';
228
			} else {
229
				print '<th class="time">'._("Date first seen").'</th>';
230
			}
231
		} else {
232
			if ($_GET['sort'] == "date_asc")
233
			{
234
				print '<th class="time">'._("Date").'</th>';
235
			} else if ($_GET['sort'] == "date_desc")
236
			{
237
				print '<th class="time">'._("Date").'</th>';
238
			} else {
239
				print '<th class="time">'._("Date").'</th>';
240
			}
241
		}
242
		print '<th class="more"></th>';
243
		print '</thead>';
244
	} else {
245
		print '<thead>';
246
		print '<th class="aircraft_thumbnail"></th>';
247
		if ($_GET['sort'] == "airline_name_asc")
248
		{
249
			print '<th class="logo"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airline_name_desc" class="active">'._("Airline").'</a> <i class="fa fa-caret-up"></i></th>';
250
		} else if ($_GET['sort'] == "airline_name_desc")
251
		{
252
			print '<th class="logo"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airline_name_asc" class="active">'._("Airline").'</a> <i class="fa fa-caret-down"></i></th>';
253
		} else {
254
			print '<th class="logo"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airline_name_asc">'._("Airline").'</a> <i class="fa fa-sort small"></i></th>';
255
		}
256
		if ($_GET['sort'] == "ident_asc")
257
		{
258
			print '<th class="ident"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/ident_desc" class="active">'._("Ident").'</a> <i class="fa fa-caret-up"></i></th>';
259
		} else if ($_GET['sort'] == "ident_desc")
260
		{
261
			print '<th class="ident"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/ident_asc" class="active">'._("Ident").'</a> <i class="fa fa-caret-down"></i></th>';
262
		} else {
263
			print '<th class="ident"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/ident_asc">'._("Ident").'</a> <i class="fa fa-sort small"></i></th>';
264
		}
265
		if ($_GET['sort'] == "aircraft_asc")
266
		{
267
			print '<th class="type"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/aircraft_desc" class="active">'._("Aircraft").'</a> <i class="fa fa-caret-up"></i></th>';
268
		} else if ($_GET['sort'] == "aircraft_desc")
269
		{
270
			print '<th class="type"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/aircraft_asc" class="active">'._("Aircraft").'</a> <i class="fa fa-caret-down"></i></th>';
271
		} else {
272
			print '<th class="type"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/aircraft_asc">'._("Aircraft").'</a> <i class="fa fa-sort small"></i></th>';
273
		}
274 View Code Duplication
		if ($_GET['sort'] == "airport_departure_asc")
275
		{
276
			print '<th class="departure"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_departure_desc" class="active"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></a> <i class="fa fa-caret-up"></i></th>';
277
		} else if ($_GET['sort'] == "airport_departure_desc")
278
		{
279
			print '<th class="departure"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_departure_asc" class="active"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></a> <i class="fa fa-caret-down"></i></th>';
280
		} else {
281
			print '<th class="departure"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_departure_asc"><span class="nomobile">'._("Coming from").'</span><span class="mobile">'._("From").'</span></a> <i class="fa fa-sort small"></i></th>';
282
		}
283 View Code Duplication
		if ($_GET['sort'] == "airport_arrival_asc")
284
		{
285
			print '<th class="arrival"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_arrival_desc" class="active"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></a> <i class="fa fa-caret-up"></i></th>';
286
		} else if ($_GET['sort'] == "airport_arrival_desc")
287
		{
288
			print '<th class="arrival"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_arrival_asc" class="active"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></a> <i class="fa fa-caret-down"></i></th>';
289
		} else {
290
			print '<th class="arrival"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/airport_arrival_asc"><span class="nomobile">'._("Flying to").'</span><span class="mobile">'._("To").'</span></a> <i class="fa fa-sort small"></i></th>';
291
		}
292
		print '<th class="routestop"><span class="nomobile">'._("Route stop").'</span><span class="mobile">Stop</span></a></th>';
293 View Code Duplication
		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
294
			print '<th class="pilot"><span class="nomobile">'._("Pilot name").'</span><span class="mobile">'._("Pilot").'</span></a></th>';
295
		} else {
296
			print '<th class="owner"><span class="nomobile">'._("Owner name").'</span><span class="mobile">'._("Owner").'</span></a></th>';
297
		}
298
		if (strtolower($current_page) == "date")
299
		{
300 View Code Duplication
			if ($_GET['sort'] == "date_asc")
301
			{
302
				print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_desc" class="active">'._("Time").'</a> <i class="fa fa-caret-up"></i></th>';
303
			} else if ($_GET['sort'] == "date_desc")
304
			{
305
				print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_asc" class="active">'._("Time").'</a> <i class="fa fa-caret-down"></i></th>';
306
			} else {
307
				print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_asc">'._("Time").'</a> <i class="fa fa-sort small"></i></th>';
308
			}
309 View Code Duplication
		} elseif (strtolower($current_page) == "currently") {
310
			if ($_GET['sort'] == "date_asc")
311
			{
312
				print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_desc" class="active">'._("Date first seen").'</a> <i class="fa fa-caret-up"></i></th>';
313
			} else if ($_GET['sort'] == "date_desc")
314
			{
315
				print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_asc" class="active">'._("Date first seen").'</a> <i class="fa fa-caret-down"></i></th>';
316
			} else {
317
				print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_asc">'._("Date first seen").'</a> <i class="fa fa-sort small"></i></th>';
318
			}
319
		} else {
320
			if ($_GET['sort'] == "date_asc")
321
			{
322
				print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_desc" class="active">'._("Date").'</a> <i class="fa fa-caret-up"></i></th>';
323
			} else if ($_GET['sort'] == "date_desc")
324
			{
325
				print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_asc" class="active">'._("Date").'</a> <i class="fa fa-caret-down"></i></th>';
326
			} else {
327
				print '<th class="time"><a href="'.$page_url.'/'.$limit_start.','.$limit_end.'/date_asc">'._("Date").'</a> <i class="fa fa-sort small"></i></th>';
328
			}
329
		}
330
		print '<th class="more"></th>';
331
		print '</thead>';
332
	}
333
}
334
335
print '<tbody>'."\n";
336
foreach($spotter_array as $spotter_item)
337
{
338
	if (isset($globalTimezone))
339
	{
340
		date_default_timezone_set($globalTimezone);
341
	} else date_default_timezone_set('UTC');
342
	if ($showSpecial === true)
343
	{
344
		print '<tr class="special">'."\n";
345
		print '<td colspan="9"><h4>'.$spotter_item['registration'].' - '.$spotter_item['highlight'].'</h4></td>'."\n";
346
		print '</tr>'."\n";
347
	}
348
	if (strtolower($current_page) == "upcoming" && date("ga") == date("ga", strtotime($spotter_item['date_iso_8601'])))
349
	{
350
		print '<tr class="currentHour">';
351
	} else {
352
		print '<tr>';
353
	}
354
	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive" || strtolower($current_page) == "currently") {
355
		if ($spotter_item['image_thumbnail'] != "")
356
		{
357
			print '<td class="aircraft_thumbnail">'."\n";
358
			
359
			if ($spotter_item['image_source'] == 'planespotters') {
360 View Code Duplication
				if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
361
				else {
362
					$planespotter_url_array = explode("_", $spotter_item['image']);
363
					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
364
                                        $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
365
				}
366
				if (isset($spotter_item['airline_name'])) {
367
					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
368
				} else {
369
					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
370
				}
371
                        } else {
372 View Code Duplication
                    		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
373
                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
374
                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
375
				if (isset($spotter_item['airline_name'])) {
376
					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
377 View Code Duplication
				} else {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
378
					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
379
				}
380
			}
381
			print '</td>'."\n";
382 View Code Duplication
		} else {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
383
			print '<td class="aircraft_thumbnail">'."\n";
384
			print '<img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" />'."\n";
385
			print '</td>'."\n";
386
		}
387
	}
388
	if(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){
389
		if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
390
		    $spotter_item['squawk'] = '-';
391
		}
392
		if ($spotter_item['image_thumbnail'] != "")
393
		{
394
			print '<td class="aircraft_thumbnail">'."\n";
395
			//print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
396
			if ($spotter_item['image_source'] == 'planespotters') {
397 View Code Duplication
				if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
398
				else {
399
					$planespotter_url_array = explode("_", $spotter_array[0]['image']);
400
					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
401
                                        $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
402
				}
403
				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
404
					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
405 View Code Duplication
				} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
406
					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
407
				} elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) {
408
					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
409 View Code Duplication
				} else {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
410
					print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
411
				}
412
			} else {
413 View Code Duplication
                    		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
414
                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
415
                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
416
				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
417
					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
418 View Code Duplication
				} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
419
					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
420
				} elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) {
421
					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - Not available" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - Not available" data-content="Registration: '.$spotter_item['registration'].'<br />Aircraft: ('.$spotter_item['aircraft_type'].')<br />Airline: Not available<br />Squawk: '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
422 View Code Duplication
				} else {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
423
					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
424
				}
425
			}
426
			print '</td>'."\n";
427
		} else {
428
			print '<td class="aircraft_thumbnail">'."\n";
429
       //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
430
	//}
431
			if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) {
432
				print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n";
433 View Code Duplication
			} elseif (!isset($spotter_item['aircraft_name'])) {
434
				print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n";
435
			} elseif (!isset($spotter_item['airline_name'])) {
436
				print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n";
437 View Code Duplication
			} else {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
438
				print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n";
439
			}
440
			print '</td>'."\n";
441
		}
442
	}
443
	if (isset($globalIVAO) && $globalIVAO && (@getimagesize('images/airlines/'.$spotter_item['airline_icao'].'.gif') || @getimagesize($globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.gif')))
444
	{
445
		print '<td class="logo">'."\n";
446
		print '<a href="'.$globalURL.'/airline/'.$spotter_item['airline_icao'].'"><img src="'.$globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.gif" alt="'._("Click to see airline information").'" title="'._("Click to see airline information").'" /></a>'."\n";
447
		print '</td>'."\n";
448
	} elseif ((!isset($globalIVAO) || !$globalIVAO) && (@getimagesize('images/airlines/'.$spotter_item['airline_icao'].'.png') || @getimagesize($globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.png')))
449
	{
450
		print '<td class="logo">'."\n";
451
		print '<a href="'.$globalURL.'/airline/'.$spotter_item['airline_icao'].'"><img src="'.$globalURL.'/images/airlines/'.$spotter_item['airline_icao'].'.png" alt="'._("Click to see airline information").'" title="'._("Click to see airline information").'" /></a>'."\n";
452
		print '</td>'."\n";
453
	} else {
454
		print '<td class="logo-no-image">'."\n";
455
		if (isset($spotter_item['airline_icao']) && $spotter_item['airline_icao'] != 'NA')
456
		{
457
			print '<a href="'.$globalURL.'/airline/'.$spotter_item['airline_icao'].'">'.$spotter_item['airline_name'].'</a>'."\n";
458
		} else {
459
			print '<a href="'.$globalURL.'/airline/NA">'._("Not Available").'</a>'."\n";
460
		}
461
		print '</td>'."\n";
462
	}
463
	// Aircraft ident
464
	print '<td class="ident">'."\n";
465 View Code Duplication
	if ($spotter_item['ident'] != "")
466
	{
467
		print '<a href="'.$globalURL.'/ident/'.$spotter_item['ident'].'">'.$spotter_item['ident'].'</a>'."\n";
468
	} else {
469
		print 'N/A'."\n";
470
	}
471
	print '</td>'."\n";
472
	// Aircraft type
473
	if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){
474
		print '<td class="type">'."\n";
475
		if (!isset($spotter_item['aircraft_name'])) {
476
			print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'._("Not available").'</a></span>'."\n";
477
		} else {
478
			print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n";
479
		}
480
		print '<span class="mobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n";
481
		print '</td>'."\n";
482
	}
483
	if (strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") {
484
	// Departure Airport
485
	print '<td class="departure_airport">'."\n";
486
	if (!isset($spotter_item['departure_airport']) || !isset($spotter_item['departure_airport_city']) || (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] == 'NA')) {
487
		print '<span class="nomobile"><a href="'.$globalURL.'/airport/NA">'._("Not available").'</a></span>'."\n";
488
		print '<span class="mobile"><a href="'.$globalURL.'/airport/NA">'._("Not available").'</a></span>'."\n";
489
	} else {
490
		print '<span class="nomobile"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'">'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].' ('.$spotter_item['departure_airport'].')</a></span>'."\n";
491
		print '<span class="mobile"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'">'.$spotter_item['departure_airport'].'</a></span>'."\n";
492
	}
493
	if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
494 View Code Duplication
		if ($spotter_item['departure_airport_time'] > 2460) {
495
			$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
496
		} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
497
		if ($spotter_item['real_departure_airport_time'] > 2460) {
498
			$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
499
		} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
500
		print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
501 View Code Duplication
	} elseif (isset($spotter_item['real_departure_airport_time'])) {
502
		if ($spotter_item['real_departure_airport_time'] > 2460) {
503
			$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
504
		} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
505
		print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
506
	} elseif (isset($spotter_item['departure_airport_time'])) {
507 View Code Duplication
		if ($spotter_item['departure_airport_time'] > 2460) {
508
			$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
509
		} else {
510
			$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
511
		}
512
		print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n";
513
	}
514
	if ($spotter_item['departure_airport'] != 'NA') {
515
		require_once(dirname(__FILE__).'/require/class.Spotter.php');
516
		$Spotter = new Spotter();
517 View Code Duplication
		if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '' && isset($spotter_item['last_longitude']) && $spotter_item['last_longitude'] != '') {
518
			$latitude = $spotter_item['last_latitude'];
519
			$longitude = $spotter_item['last_longitude'];
520
		} else {
521
			$latitude = $spotter_item['latitude'];
522
			$longitude = $spotter_item['longitude'];
523
		}
524
		$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
525 View Code Duplication
		if ($distance != '') {
526
		    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
527
			    echo '<br/><i>'.round($distance*0.539957).' nm</i>';
528
		    } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
529
			    echo '<br/><i>'.round($distance*0.621371).' mi</i>';
530
		    } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
531
			    echo '<br/><i>'.$distance.' km</i>';
532
		    }
533
		}
534
	}
535
	print '</td>'."\n";
536
	// Arrival Airport
537
	print '<td class="arrival_airport">'."\n";
538
	if (!isset($spotter_item['arrival_airport']) || !isset($spotter_item['arrival_airport_city'])) {
539
		if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != 'NA') {
540
			print '<span class="nomobile"><a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n";
541
			print '<span class="mobile"><a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n";
542 View Code Duplication
		} else {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
543
			print '<span class="nomobile"><a href="'.$globalURL.'/airport/NA">'._("Not available").'</a></span>'."\n";
544
			print '<span class="mobile"><a href="'.$globalURL.'/airport/NA">'._("Not available").'</a></span>'."\n";
545
		}
546
	} else {
547
		if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) {
548
			print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n";
549
			if (!isset($Spotter)) $Spotter = new Spotter();
550
			$arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
551
			print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n";
552
			print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n";
553
			print '<span class="mobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n";
554
		} elseif ($spotter_item['arrival_airport'] != 'NA') {
555
			print '<span class="nomobile"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n";
556
			print '<span class="mobile"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport'].'</a></span>'."\n";
557 View Code Duplication
		} else {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
558
			print '<span class="nomobile"><a href="'.$globalURL.'/airport/NA">'._("Not Available").'</a></span>'."\n";
559
			print '<span class="mobile"><a href="'.$globalURL.'/airport/NA">'._("Not Available").'</a></span>'."\n";
560
		}
561
	}
562
	if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
563 View Code Duplication
		if ($spotter_item['arrival_airport_time'] > 2460) {
564
			$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
565
		} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
566
		if ($spotter_item['real_arrival_airport_time'] > 2460) {
567
			$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
568
		} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
569
		print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
570 View Code Duplication
	} elseif (isset($spotter_item['real_arrival_airport_time'])) {
571
		if ($spotter_item['real_arrival_airport_time'] > 2460) {
572
			$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
573
		} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
574
		print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
575
	} elseif (isset($spotter_item['arrival_airport_time'])) {
576 View Code Duplication
		if ($spotter_item['arrival_airport_time'] > 2460) {
577
			$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
578
		} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
579
		print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
580
	}
581
	if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
582 View Code Duplication
		if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '' && isset($spotter_item['last_longitude']) && $spotter_item['last_longitude'] != '') {
583
			$latitude = $spotter_item['last_latitude'];
584
			$longitude = $spotter_item['last_longitude'];
585
		} else {
586
			$latitude = $spotter_item['latitude'];
587
			$longitude = $spotter_item['longitude'];
588
		}
589
		$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
590 View Code Duplication
		if ($distance != '') {
591
		    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
592
			    echo '<br/><i>'.round($distance*0.539957).' nm</i>';
593
		    } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
594
			    echo '<br/><i>'.round($distance*0.621371).' mi</i>';
595
		    } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
596
			    echo '<br/><i>'.$distance.' km</i>';
597
		    }
598
		}
599
	}
600
	print '</td>'."\n";
601
	// Route stop
602
	if(strtolower($current_page) != "upcoming"){
603
		print '<td class="route_stop">'."\n";
604
		if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '') {
605
			print '<span class="nomobile">-</span>'."\n";
606
			print '<span class="mobile">-</span>'."\n";
607
		} else {
608
			foreach ($spotter_item['route_stop_details'] as $rst) {
609
				print '<span class="nomobile"><a href="'.$globalURL.'/airport/'.$rst['airport_icao'].'">'.$rst['airport_city'].', '.$rst['airport_country'].' ('.$rst['airport_icao'].')</a></span>'."\n";
610
				print '<span class="mobile"><a href="'.$globalURL.'/airport/'.$rst['airport_icao'].'">'.$rst['airport_icao'].'</a></span><br />'."\n";
611
			}
612
		}
613
		print '</td>'."\n";
614
	}
615
	if (isset($_GET['dist']) && $_GET['dist'] != '') {
616
		print '<td class="distance">'."\n";
617
		if (!isset($spotter_item['distance']) || $spotter_item['distance'] == '') {
618
			print '<span class="nomobile">-</span>'."\n";
619
			print '<span class="mobile">-</span>'."\n";
620
		} else {
621
			//if (!isset($globalUnitDistance) || $globalUnitDistance == 'km') {
622
			if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
623
				print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n";
624
				print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n";
625
			//} elseif ($globalUnitDistance == 'mi') {
626
			} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
627
				print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n";
628
				print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n";
629
			//} elseif ($globalUnitDistance == 'nm') {
630
			} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
631
				print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n";
632
				print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n";
633
			}
634
		}
635
		
636
		print '</td>'."\n";
637
	}
638
	if(strtolower($current_page) != "upcoming"){
639
		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
640
			print '<td class="pilot">'."\n";
641
			if ((!isset($spotter_item['pilot_id']) || $spotter_item['pilot_id'] == '') && (!isset($spotter_item['pilot_name']) || $spotter_item['pilot_name'] == '')) {
642
				print '<span class="nomobile">-</span>'."\n";
643
				print '<span class="mobile">-</span>'."\n";
644
			} elseif ((!isset($spotter_item['pilot_id']) || $spotter_item['pilot_id'] == '') && (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '')) {
645
				print '<span class="nomobile">'.$spotter_item['pilot_name'].'</span>'."\n";
646
				print '<span class="mobile">'.$spotter_item['pilot_name'].'-</span>'."\n";
647
			} else {
648
				if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'whazzup') {
649
					print '<span class="nomobile"><a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a></span>'."\n";
650
					print '<span class="mobile"><a href="https://www.ivao.aero/Member.aspx?ID='.$spotter_item['pilot_id'].'">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</a></span>'."\n";
651 View Code Duplication
				} else {
1 ignored issue
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
652
					print '<span class="nomobile">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</span>'."\n";
653
					print '<span class="mobile">'.$spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')</span>'."\n";
654
				}
655
			}
656
			print '</td>'."\n";
657
		} else {
658
			print '<td class="owner">'."\n";
659
			if (!isset($spotter_item['aircraft_owner']) || $spotter_item['aircraft_owner'] == '') {
660
				print '<span class="nomobile">-</span>'."\n";
661
				print '<span class="mobile">-</span>'."\n";
662
			} else {
663
				print '<span class="nomobile">'.$spotter_item['aircraft_owner'].'</span>'."\n";
664
				print '<span class="mobile">'.$spotter_item['aircraft_owner'].'</span>'."\n";
665
			}
666
			print '</td>'."\n";
667
		
668
		}
669
	}
670
671
	}
672
	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
673
		if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') {
674
			print '<td class="message"><p>'."\n";
675
			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
676
			print '</p><p class="decode">';
677
			$decode_array = json_decode($spotter_item['decode']);
678
			foreach ($decode_array as $key => $value) {
679
				print '<b>'.$key.'</b> : '.$value.' ';
680
			}
681
			print '</p>';
682
			print '</td>'."\n";
683
		} else {
684
			print '<td class="message">'."\n";
685
			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
686
			print '</td>'."\n";
687
		}
688
	}
689
	// Date
690
	if (strtolower($current_page) == "date")
691
	{
692
		print '<td class="time">'."\n";
693
		print '<span class="nomobile"><a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'">'.date("g:i a T", strtotime($spotter_item['date_iso_8601'])).'</a></span>'."\n";
694
		print '<span class="mobile"><a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'">'.date("g:i a T", strtotime($spotter_item['date_iso_8601'])).'</a></span>'."\n";
695
		print '</td>'."\n";
696
	} else if (strtolower($current_page) == "index")
697
	{
698
		print '<td class="time">'."\n";
699
		print '<span class="nomobile"><a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'">'.$spotter_item['date'].'</a></span>'."\n";
700
		print '<span class="mobile"><a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'">'.$spotter_item['date'].'</a></span>'."\n";
701
		print '</td>'."\n";
702
	} else if (strtolower($current_page) == "upcoming")
703
	{
704
		print '<td class="time">';
705
		//print '<span>'.date("ga", strtotime($spotter_item['date_iso_8601'])).'</span>';
706
		print '<span>'.date("g:i a", strtotime($spotter_item['date_iso_8601'])).'</span>';
707
		print '</td>';
708
	} elseif (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive")
709
	{
710
		print '<td class="date">'."\n";
711
		print '<span class="nomobile">'.date("r", strtotime($spotter_item['date'].' UTC')).'</span>'."\n";
712
		print '<span class="mobile">'.date("j/n/Y g:i a", strtotime($spotter_item['date'].' UTC')).'</span>'."\n";
713
		print '</td>'."\n";
714
	} else {
715
		print '<td class="date">'."\n";
716
		print '<span class="nomobile"><a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'">'.date("r", $spotter_item['date_unix']).'</a></span>'."\n";
717
		print '<span class="mobile"><a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'">'.date("j/n/Y g:i a", strtotime($spotter_item['date_iso_8601'])).'</a></span>'."\n";
718
		print '</td>'."\n";
719
	}
720
	if (strtolower($current_page) != "upcoming")
721
	{
722
		print '<td class="more">';
723
		print '<ul class="nav nav-pills">';
724
		print '<li class="dropdown">';
725
		print '<a class="dropdown-toggle " data-toggle="dropdown" href="#"><span class="caret"></span></a>';
726
		print '<ul class="dropdown-menu pull-right" role="menu">';
727
		if (isset($spotter_item['spotter_id'])) {
728
			print '<li><a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'">'._("Detailed Flight Information").'</a></li>';
729
			print '<li><a href="'.$globalURL.'/search/xml?q='.$spotter_item['spotter_id'].'&download=true"><i class="fa fa-download"></i>'._("Download Flight Data").' (XML)</a></li>';
730
			print '<li><hr /></li>';
731
		}
732
		if (isset($spotter_item['registration']) && $spotter_item['registration'] != "")
733
		{
734
			print '<li><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'">'._("Aircraft History").' ('.$spotter_item['registration'].')</a></li>';
735
		}
736 View Code Duplication
		if (isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != "")
737
		{
738
			print '<li><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_item['aircraft_manufacturer'])).'">'._("Manufacturer Profile").'</a></li>';
739
		}
740 View Code Duplication
		if (isset($spotter_item['aircraft_type']) && $spotter_item['aircraft_type'] != "" && isset($spotter_item['airline_icao']) && $spotter_item['airline_icao'] != "")
741
		{
742
			print '<li><a href="'.$globalURL.'/search?aircraft='.$spotter_item['aircraft_type'].'&airline='.$spotter_item['airline_icao'].'">'._("Flights of Aircraft Type &amp; Airline").'</a></li>';
743
			print '<li><hr /></li>';
744
		}
745 View Code Duplication
		if (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != "" && $spotter_item['arrival_airport'] != "")
746
		{
747
			print '<li><a href="'.$globalURL.'/route/'.$spotter_item['departure_airport'].'/'.$spotter_item['arrival_airport'].'">'._("Route Profile").'</a></li>';
748
		}
749 View Code Duplication
		if (isset($spotter_item['airline_country']) && $spotter_item['airline_country'] != "")
750
		{
751
			print '<li><a href="'.$globalURL.'/country/'.strtolower(str_replace(" ", "-", $spotter_item['airline_country'])).'">'._("Airline Country Profile").'</a></li>';
752
			print '<li><hr /></li>';
753
		}
754 View Code Duplication
		if (isset($spotter_item['departure_airport_country']) && $spotter_item['departure_airport_country'] != "")
755
		{
756
			print '<li><a href="'.$globalURL.'/country/'.strtolower(str_replace(" ", "-", $spotter_item['departure_airport_country'])).'">'._("Departure Airport Country Profile").'</a></li>';
757
		}
758 View Code Duplication
		if (isset($spotter_item['arrival_airport_country']) && $spotter_item['arrival_airport_country'] != "")
759
		{
760
			print '<li><a href="'.$globalURL.'/country/'.strtolower(str_replace(" ", "-", $spotter_item['arrival_airport_country'])).'">'._("Arrival Airport Country Profile").'</a></li>';
761
		}
762
		print '</ul>';
763
		print '</li>';
764
		print '</ul>';
765
		print '</td>';
766
	}
767
	print '</tr>'."\n";
768
}
769
print '<tbody>'."\n";
770
print '</table>'."\n";
771
print '</div>'."\n";
772
?>