Completed
Push — master ( 5156bc...853695 )
by Yannick
10:50
created
airline-statistics-route.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/airline');
8 8
         die();
9 9
 }
10
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", "");
13 13
 
14 14
 if (!empty($spotter_array))
15 15
 {
16
-	$title = sprintf(_("Most Common Routes from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
16
+	$title = sprintf(_("Most Common Routes from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']);
17 17
 	require_once('header.php');
18 18
 	print '<div class="select-item">';
19 19
 	print '<form action="'.$globalURL.'/airline" method="post">';
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
 	$Stats = new Stats();
23 23
 	$airline_names = $Stats->getAllAirlineNames();
24 24
 	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
25
-	foreach($airline_names as $airline_name)
25
+	foreach ($airline_names as $airline_name)
26 26
 	{
27
-		if($airline == $airline_name['airline_icao'])
27
+		if ($airline == $airline_name['airline_icao'])
28 28
 		{
29 29
 			print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
30 30
 		} else {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	include('airline-sub-menu.php');
63 63
 	 print '<div class="column">';
64 64
 	print '<h2>'._("Most Common Routes").'</h2>';
65
-	print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
65
+	print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>';
66 66
 	$route_array = $Spotter->countAllRoutesByAirline($airline);
67 67
 	if (!empty($route_array))
68 68
 	{
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 		print '</thead>';
79 79
 		print '<tbody>';
80 80
 		$i = 1;
81
-		foreach($route_array as $route_item)
81
+		foreach ($route_array as $route_item)
82 82
 		{
83 83
 			print '<tr>';
84 84
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,9 @@  discard block
 block discarded – undo
21 21
 	print '<option></option>';
22 22
 	$Stats = new Stats();
23 23
 	$airline_names = $Stats->getAllAirlineNames();
24
-	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
24
+	if (empty($airline_names)) {
25
+		$airline_names = $Spotter->getAllAirlineNames();
26
+	}
25 27
 	foreach($airline_names as $airline_name)
26 28
 	{
27 29
 		if($airline == $airline_name['airline_icao'])
@@ -43,8 +45,7 @@  discard block
 block discarded – undo
43 45
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
44 46
 			{
45 47
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
46
-			}
47
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
48
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
48 49
 			{
49 50
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
50 51
 			}
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['airline'])) {
7
-        header('Location: '.$globalURL.'/airline');
8
-        die();
7
+		header('Location: '.$globalURL.'/airline');
8
+		die();
9 9
 }
10 10
 $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
Please login to merge, or discard this patch.
date-statistics-arrival-airport.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING);
8
-$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING);
8
+$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort);
9 9
 
10 10
 if (!empty($spotter_array))
11 11
 {
12
-	$title = sprintf(_("Most Common Arrival Airports on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
12
+	$title = sprintf(_("Most Common Arrival Airports on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
13 13
 
14 14
 	require_once('header.php');
15 15
 	print '<div class="select-item">';
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>';
28 28
 	print '<br />';  
29 29
 	print '<div class="info column">';
30
-	print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
30
+	print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
31 31
 	print '</div>';
32 32
 
33 33
 	include('date-sub-menu.php');
34 34
 	print '<div class="column">';
35 35
 	print '<h2>'._("Most Common Arrival Airports").'</h2>';
36
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
36
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
37 37
 	$airport_airport_array = $Spotter->countAllArrivalAirportsByDate($date);
38 38
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
39 39
     	<script>
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
         	["'._("Airport").'", "'._("# of times").'"],';
49 49
 
50 50
 	$airport_data = '';
51
-	foreach($airport_airport_array as $airport_item)
51
+	foreach ($airport_airport_array as $airport_item)
52 52
 	{
53 53
 		$name = $airport_item['airport_arrival_city'].', '.$airport_item['airport_arrival_country'].' ('.$airport_item['airport_arrival_icao'].')';
54 54
 		$name = str_replace("'", "", $name);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 	print '</thead>';
88 88
 	print '<tbody>';
89 89
 	$i = 1;
90
-	foreach($airport_airport_array as $airport_item)
90
+	foreach ($airport_airport_array as $airport_item)
91 91
 	{
92 92
 		print '<tr>';
93 93
 		print '<td><strong>'.$i.'</strong></td>';
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	$title = _("Unknown Date");
113 113
 	require_once('header.php');
114 114
 	print '<h1>'._("Error").'</h1>';
115
-	print '<p>'._("Sorry, this date does not exist in this database. :(");'</p>';
115
+	print '<p>'._("Sorry, this date does not exist in this database. :("); '</p>';
116 116
 }
117 117
 
118 118
 require_once('footer.php');
Please login to merge, or discard this patch.
manufacturer-statistics-departure-airport.php 3 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
         die();
9 9
 }
10 10
 $Spotter = new Spotter();
11
-$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
11
+$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)));
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort);
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Departure Airports from %s"),$manufacturer);
17
+	$title = sprintf(_("Most Common Departure Airports from %s"), $manufacturer);
18 18
 
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25 25
 	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
-	foreach($all_manufacturers as $all_manufacturer)
26
+	foreach ($all_manufacturers as $all_manufacturer)
27 27
 	{
28
-		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
28
+		if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
29 29
 		{
30 30
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
31 31
 		} else {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	include('manufacturer-sub-menu.php');
45 45
 	print '<div class="column">';
46 46
 	print '<h2>'._("Most Common Departure Airports").'</h2>';
47
-	print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s</strong>."),$manufacturer).'</p>';
47
+	print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s</strong>."), $manufacturer).'</p>';
48 48
 	$airport_airport_array = $Spotter->countAllDepartureAirportsByManufacturer($manufacturer);
49 49
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>
50 50
     	<script>
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
         	["'._("Airport").'", "'._("# of times").'"],';
60 60
 
61 61
 	$airport_data = '';
62
-	foreach($airport_airport_array as $airport_item)
62
+	foreach ($airport_airport_array as $airport_item)
63 63
 	{
64 64
 		$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
65 65
 		$name = str_replace("'", "", $name);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	print '</thead>';
99 99
 	print '<tbody>';
100 100
 	$i = 1;
101
-	foreach($airport_airport_array as $airport_item)
101
+	foreach ($airport_airport_array as $airport_item)
102 102
 	{
103 103
 		print '<tr>';
104 104
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
25
+	if (empty($all_manufacturers)) {
26
+		$all_manufacturers = $Spotter->getAllManufacturers();
27
+	}
26 28
 	foreach($all_manufacturers as $all_manufacturer)
27 29
 	{
28 30
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['aircraft_manufacturer'])) {
7
-        header('Location: '.$globalURL.'/manufacturer');
8
-        die();
7
+		header('Location: '.$globalURL.'/manufacturer');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
Please login to merge, or discard this patch.
aircraft.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,10 +19,10 @@  discard block
 block discarded – undo
19 19
 	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes();
20 20
 	$previous = null;
21 21
 	print '<div class="alphabet-legend">';
22
-	foreach($aircraft_types as $value) {
22
+	foreach ($aircraft_types as $value) {
23 23
 		//$firstLetter = substr($value['aircraft_name'], 0, 1);
24 24
 		$firstLetter = substr($value['aircraft_manufacturer'], 0, 1);
25
-		if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
25
+		if ($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
26 26
 		{
27 27
 			if ($previous !== null) print ' | ';
28 28
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 	print '</div>';
33 33
 	$previous = null;
34
-	foreach($aircraft_types as $value) {
34
+	foreach ($aircraft_types as $value) {
35 35
 		//$firstLetter = substr($value['aircraft_name'], 0, 1);
36 36
 		$firstLetter = substr($value['aircraft_manufacturer'], 0, 1);
37 37
 		if ($firstLetter != "")
38 38
 		{
39
-			if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
39
+			if ($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
40 40
 			{
41 41
 				if ($previous !== null) print '</div>';
42 42
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 	print '<h1>'._("Aircrafts Types").'</h1>';
17 17
 
18 18
 	$aircraft_types = $Stats->getAllAircraftTypes();
19
-	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes();
19
+	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') {
20
+		$aircraft_types = $Spotter->getAllAircraftTypes();
21
+	}
20 22
 	$previous = null;
21 23
 	print '<div class="alphabet-legend">';
22 24
 	foreach($aircraft_types as $value) {
@@ -24,10 +26,14 @@  discard block
 block discarded – undo
24 26
 		$firstLetter = substr($value['aircraft_manufacturer'], 0, 1);
25 27
 		if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
26 28
 		{
27
-			if ($previous !== null) print ' | ';
29
+			if ($previous !== null) {
30
+				print ' | ';
31
+			}
28 32
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
29 33
 		}
30
-		if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter;
34
+		if ($firstLetter != '(' && $firstLetter != ')') {
35
+			$previous = $firstLetter;
36
+		}
31 37
 	}
32 38
 	print '</div>';
33 39
 	$previous = null;
@@ -38,10 +44,14 @@  discard block
 block discarded – undo
38 44
 		{
39 45
 			if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
40 46
 			{
41
-				if ($previous !== null) print '</div>';
47
+				if ($previous !== null) {
48
+					print '</div>';
49
+				}
42 50
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
43 51
 			}
44
-			if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter;
52
+			if ($firstLetter != '(' && $firstLetter != ')') {
53
+				$previous = $firstLetter;
54
+			}
45 55
 			print '<div class="alphabet-item">';
46 56
 			print '<a href="'.$globalURL.'/aircraft/'.$value['aircraft_icao'].'">';
47 57
 			if ($value['aircraft_name'] == '') {
Please login to merge, or discard this patch.
statistics-fatalities-month.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
             	["'._("Month").'", "'._("# of Fatalities").'"], ';
24 24
 
25 25
 $date_data = '';
26
-foreach($date_array as $date_item)
26
+foreach ($date_array as $date_item)
27 27
 {
28
-	$date_data .= '[ "'.date('F, Y',strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'",'.$date_item['count'].'],';
28
+	$date_data .= '[ "'.date('F, Y', strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'",'.$date_item['count'].'],';
29 29
 }
30 30
 $date_data = substr($date_data, 0, -1);
31 31
 print $date_data;
@@ -50,13 +50,13 @@  discard block
 block discarded – undo
50 50
 
51 51
 if (!empty($date_array))
52 52
 {
53
-	foreach($date_array as $key => $row) {
53
+	foreach ($date_array as $key => $row) {
54 54
 		$years[$key] = $row['year'];
55 55
 		$months[$key] = $row['month'];
56 56
 		$counts[$key] = $row['count'];
57 57
 	}
58 58
 //	array_multisort($years,SORT_DESC,$months,SORT_DESC,$date_array);
59
-	array_multisort($counts,SORT_DESC,$date_array);
59
+	array_multisort($counts, SORT_DESC, $date_array);
60 60
 	print '<div class="table-responsive">';
61 61
 	print '<table class="common-date table-striped">';
62 62
 	print '<thead>';
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
 	print '</thead>';
67 67
 	print '<tbody>';
68 68
 	$i = 1;
69
-	foreach($date_array as $date_item)
69
+	foreach ($date_array as $date_item)
70 70
 	{
71 71
 		print '<tr>';
72 72
 		print '<td><strong>'.$i.'</strong></td>';
73 73
 		print '<td>';
74
-		print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$date_item['month'].'">'.date('F, Y',strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>';
74
+		print '<a href="'.$globalURL.'/accident/'.$date_item['year'].'-'.$date_item['month'].'">'.date('F, Y', strtotime($date_item['year'].'-'.$date_item['month'].'-01')).'</a>';
75 75
 		print '</td>';
76 76
 		print '<td>';
77 77
 		print $date_item['count'];
Please login to merge, or discard this patch.
require/class.Accident.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,12 +23,12 @@
 block discarded – undo
23 23
 	}
24 24
 	
25 25
 	/**
26
-	* Get Accidents data from DB
27
-	* @param String $limit Limit
28
-	* @param String $type Set type accident or incident
29
-	* @param String $date get data for a date
30
-	* @return Array Return Accidents data in array
31
-	*/
26
+	 * Get Accidents data from DB
27
+	 * @param String $limit Limit
28
+	 * @param String $type Set type accident or incident
29
+	 * @param String $date get data for a date
30
+	 * @return Array Return Accidents data in array
31
+	 */
32 32
 	public function getAccidentData($limit = '',$type = '',$date = '') {
33 33
 		global $globalURL, $globalDBdriver;
34 34
 		$Image = new Image($this->db);
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 	* @param String $date get data for a date
30 30
 	* @return Array Return Accidents data in array
31 31
 	*/
32
-	public function getAccidentData($limit = '',$type = '',$date = '') {
32
+	public function getAccidentData($limit = '', $type = '', $date = '') {
33 33
 		global $globalURL, $globalDBdriver;
34 34
 		$Image = new Image($this->db);
35 35
 		$Spotter = new Spotter($this->db);
36 36
 		$Translation = new Translation($this->db);
37
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
37
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
38 38
 		date_default_timezone_set('UTC');
39 39
 		$result = array();
40 40
 		$limit_query = '';
41 41
 		if ($limit != "")
42 42
 		{
43 43
 			$limit_array = explode(",", $limit);
44
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
45
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
44
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
45
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
46 46
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
47 47
 			{
48 48
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 
52 52
 		if ($type != '') {
53 53
 			if ($date != '') {
54
-				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) {
54
+				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) {
55 55
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
56 56
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
57 57
 				} else {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
60 60
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
61 61
 				}
62
-				$query_values = array(':type' => $type,':date' => $date);
62
+				$query_values = array(':type' => $type, ':date' => $date);
63 63
 			} else {
64 64
 				$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
65 65
 				//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			}
68 68
 		} else {
69 69
 			if ($date != '') {
70
-				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) {
70
+				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) {
71 71
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
72 72
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
73 73
 				} else {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		try {
87 87
 			$sth = $this->db->prepare($query);
88 88
 			$sth->execute($query_values);
89
-		} catch(PDOException $e) {
89
+		} catch (PDOException $e) {
90 90
 			echo "error : ".$e->getMessage();
91 91
 		}
92 92
 		$i = 0;
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 			$data = array();
97 97
 			if ($row['registration'] != '') {
98 98
 				$image_array = $Image->getSpotterImage($row['registration']);
99
-				if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
100
-				else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
99
+				if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website']));
100
+				else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
101 101
 				$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
102 102
 				$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
103 103
 				if (!empty($aircraft_info)) {
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 					$data['aircraft_name'] = $aircraft_info[0]['type'];
106 106
 					$data['aircraft_manufacturer'] = $aircraft_info[0]['manufacturer'];
107 107
 				} else {
108
-					$data = array_merge($data,array('aircraft_type' => 'NA'));
108
+					$data = array_merge($data, array('aircraft_type' => 'NA'));
109 109
 				}
110 110
 				$owner_data = $Spotter->getAircraftOwnerByRegistration($row['registration']);
111 111
 				if (!empty($owner_data)) {
@@ -113,18 +113,18 @@  discard block
 block discarded – undo
113 113
 					$data['aircraft_base'] = $owner_data['base'];
114 114
 					$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
115 115
 				}
116
-			} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
116
+			} else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
117 117
 			if ($row['registration'] == '') $row['registration'] = 'NA';
118 118
 			if ($row['ident'] == '') $row['ident'] = 'NA';
119
-			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
119
+			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 3));
120 120
 			if (isset($identicao[0])) {
121
-				if (substr($row['ident'],0,2) == 'AF') {
122
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
123
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
124
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
125
-				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
121
+				if (substr($row['ident'], 0, 2) == 'AF') {
122
+					if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
123
+					else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0');
124
+				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0');
125
+				$data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name']));
126 126
 			} else $icao = $row['ident'];
127
-			$icao = $Translation->checkTranslation($icao,false);
127
+			$icao = $Translation->checkTranslation($icao, false);
128 128
 			//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
129 129
 			if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
130 130
 				//echo 'Check airline info... for '.$row['airline_name'].' ';
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 				if (!empty($airline_info)) {
134 134
 					//echo 'data found !'."\n";
135 135
 					//print_r($airline_info);
136
-					$data = array_merge($data,$airline_info);
136
+					$data = array_merge($data, $airline_info);
137 137
 				} 
138 138
 				//else echo 'No data...'."\n";
139 139
 			}
140
-			$data = array_merge($row,$data);
140
+			$data = array_merge($row, $data);
141 141
 			if ($data['ident'] == null) $data['ident'] = $icao;
142 142
 			if ($data['title'] == null) {
143 143
 				$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
 		try {
172 172
 			$sth = $this->db->prepare($query);
173 173
 			$sth->execute();
174
-		} catch(PDOException $e) {
174
+		} catch (PDOException $e) {
175 175
 			echo "Error : ".$e->getMessage();
176 176
 		}
177 177
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 		try {
187 187
 			$sth = $this->db->prepare($query);
188 188
 			$sth->execute();
189
-		} catch(PDOException $e) {
189
+		} catch (PDOException $e) {
190 190
 			echo "Error : ".$e->getMessage();
191 191
 		}
192 192
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
 		if ($globalDebug) echo 'Import '.$file."\n";
202 202
 		$result = array();
203 203
 		if (file_exists($file)) {
204
-			if (($handle = fopen($file,'r')) !== FALSE) {
205
-				while (($data = fgetcsv($handle,2000,",")) !== FALSE) {
204
+			if (($handle = fopen($file, 'r')) !== FALSE) {
205
+				while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) {
206 206
 					if (isset($data[1]) && $data[1] != '0000-00-00 00:00:00') {
207
-						$result[] = array('registration' => $data[0],'date' => strtotime($data[1]),'url' => $data[2],'country' => $data[3],'place' => $data[4],'title' => $data[5],'fatalities' => $data[6],'latitude' => $data[7],'longitude' => $data[8],'type' => $data[9],'ident' => $data[10],'aircraft_manufacturer' => $data[11],'aircraft_name' => $data[12],'operator' => $data[13],'source' => 'website_fam');
207
+						$result[] = array('registration' => $data[0], 'date' => strtotime($data[1]), 'url' => $data[2], 'country' => $data[3], 'place' => $data[4], 'title' => $data[5], 'fatalities' => $data[6], 'latitude' => $data[7], 'longitude' => $data[8], 'type' => $data[9], 'ident' => $data[10], 'aircraft_manufacturer' => $data[11], 'aircraft_name' => $data[12], 'operator' => $data[13], 'source' => 'website_fam');
208 208
 					}
209 209
 				}
210 210
 				fclose($handle);
211 211
 			}
212
-			if (!empty($result)) $this->add($result,true);
212
+			if (!empty($result)) $this->add($result, true);
213 213
 			elseif ($globalDebug) echo 'Nothing to import';
214 214
 		}
215 215
 	}
@@ -225,8 +225,8 @@  discard block
 block discarded – undo
225 225
 		$all_md5_new = array();
226 226
 		if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) {
227 227
 			if ($this->check_accidents_nb() > 0) {
228
-				if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) {
229
-					while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) {
228
+				if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) {
229
+					while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
230 230
 						if (isset($data[1])) {
231 231
 							$year = $data[0];
232 232
 							$all_md5[$year] = $data[1];
@@ -236,10 +236,10 @@  discard block
 block discarded – undo
236 236
 				}
237 237
 			}
238 238
 		}
239
-		$Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5',dirname(__FILE__).'/../install/tmp/cr-all.md5');
239
+		$Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5', dirname(__FILE__).'/../install/tmp/cr-all.md5');
240 240
 		if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) {
241
-			if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) {
242
-				while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) {
241
+			if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) {
242
+				while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
243 243
 					if (isset($data[1])) {
244 244
 						$year = $data[0];
245 245
 						$all_md5_new[$year] = $data[1];
@@ -248,10 +248,10 @@  discard block
 block discarded – undo
248 248
 				fclose($handle);
249 249
 			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
250 250
 		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
251
-		$result = $Common->arr_diff($all_md5_new,$all_md5);
251
+		$result = $Common->arr_diff($all_md5_new, $all_md5);
252 252
 		if (empty($result) && $globalDebug) echo 'Nothing to update';
253 253
 		foreach ($result as $file => $md5) {
254
-			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
254
+			$Common->download('http://data.flightairmap.fr/data/cr/'.$file, dirname(__FILE__).'/../install/tmp/'.$file);
255 255
 			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
256 256
 			elseif ($globalDebug) echo 'Download '.$file.' failed';
257 257
 		}
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	* Add data to DB
262 262
 	* @param Array $crash An array with accidents/incidents data
263 263
 	*/
264
-	public function add($crash,$new = false) {
264
+	public function add($crash, $new = false) {
265 265
 		global $globalTransaction, $globalDebug;
266 266
 		require_once('class.Connection.php');
267 267
 		require_once('class.Image.php');
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			$sthd->execute(array(':source' => $crash[0]['source']));
278 278
 		}
279 279
 		if ($globalTransaction) $Connection->db->beginTransaction();
280
-		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
280
+		$initial_array = array('ident' => null, 'type' => 'accident', 'url' => null, 'registration' => null, 'date' => null, 'place' => null, 'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '', 'source' => '', 'aircraft_manufacturer' => null, 'aircraft_name' => null, 'operator' => null);
281 281
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
282 282
 		$sth_check = $Connection->db->prepare($query_check);
283 283
 		$query = 'INSERT INTO accidents (aircraft_manufacturer,aircraft_name,ident,registration,date,url,country,place,title,fatalities,latitude,longitude,type,airline_name,source) VALUES (:aircraft_manufacturer,:aircraft_name,:ident,:registration,:date,:url,:country,:place,:title,:fatalities,:latitude,:longitude,:type,:airline_name,:source)';
@@ -290,31 +290,31 @@  discard block
 block discarded – undo
290 290
 				$cr = array_map(function($value) {
291 291
 					return $value === "" ? NULL : $value;
292 292
 				}, $cr);
293
-				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
294
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
295
-					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
293
+				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/', $cr['registration'])) {
294
+					if (strpos($cr['registration'], '-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
295
+					$query_check_values = array(':registration' => $cr['registration'], ':date' => date('Y-m-d', $cr['date']), ':type' => $cr['type'], ':source' => $cr['source']);
296 296
 					$sth_check->execute($query_check_values);
297 297
 					$result_check = $sth_check->fetch(PDO::FETCH_ASSOC);
298 298
 					if ($result_check['nb'] == 0) {
299
-						$query_values = array(':registration' => trim($cr['registration']),':date' => date('Y-m-d',$cr['date']),':url' => $cr['url'],':country' => $cr['country'],':place' => $cr['place'],':title' => $cr['title'],':fatalities' => $cr['fatalities'],':latitude' => $cr['latitude'],':longitude' => $cr['longitude'],':type' => $cr['type'],':source' => $cr['source'],':ident' => $cr['ident'],':aircraft_manufacturer' => $cr['aircraft_manufacturer'],':aircraft_name' => $cr['aircraft_name'],':airline_name' => $cr['operator']);
299
+						$query_values = array(':registration' => trim($cr['registration']), ':date' => date('Y-m-d', $cr['date']), ':url' => $cr['url'], ':country' => $cr['country'], ':place' => $cr['place'], ':title' => $cr['title'], ':fatalities' => $cr['fatalities'], ':latitude' => $cr['latitude'], ':longitude' => $cr['longitude'], ':type' => $cr['type'], ':source' => $cr['source'], ':ident' => $cr['ident'], ':aircraft_manufacturer' => $cr['aircraft_manufacturer'], ':aircraft_name' => $cr['aircraft_name'], ':airline_name' => $cr['operator']);
300 300
 						$sth->execute($query_values);
301
-						if ($cr['date'] > time()-(30*86400)) {
301
+						if ($cr['date'] > time() - (30*86400)) {
302 302
 							if (empty($Image->getSpotterImage($cr['registration']))) {
303 303
 								//if ($globalDebug) echo 'Get image...'."\n";
304 304
 								$Image->addSpotterImage($cr['registration']);
305 305
 							}
306 306
 							// elseif ($globalDebug) echo 'Image already in DB'."\n";
307 307
 						}
308
-						$Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date']));
308
+						$Spotter->setHighlightFlightByRegistration($cr['registration'], $cr['title'], date('Y-m-d', $cr['date']));
309 309
 					}
310 310
 				}
311
-				if ($globalTransaction && $j % 1000 == 0) {
311
+				if ($globalTransaction && $j%1000 == 0) {
312 312
 					$Connection->db->commit();
313 313
 					$Connection->db->beginTransaction();
314 314
 				}
315 315
 			}
316 316
 			if ($globalTransaction) $Connection->db->commit();
317
-		} catch(PDOException $e) {
317
+		} catch (PDOException $e) {
318 318
 			if ($globalTransaction) $Connection->db->rollBack();
319 319
 			echo $e->getMessage();
320 320
 		}
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 			$Connection = new Connection();
333 333
 			$sth = $Connection->db->prepare($query);
334 334
 			$sth->execute();
335
-		} catch(PDOException $e) {
335
+		} catch (PDOException $e) {
336 336
 			return "error : ".$e->getMessage();
337 337
 		}
338 338
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -350,7 +350,7 @@  discard block
 block discarded – undo
350 350
 			$Connection = new Connection();
351 351
 			$sth = $Connection->db->prepare($query);
352 352
 			$sth->execute();
353
-		} catch(PDOException $e) {
353
+		} catch (PDOException $e) {
354 354
 			return "error : ".$e->getMessage();
355 355
 		}
356 356
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 			$Connection = new Connection();
366 366
 			$sth = $Connection->db->prepare($query);
367 367
 			$sth->execute();
368
-		} catch(PDOException $e) {
368
+		} catch (PDOException $e) {
369 369
 			return "error : ".$e->getMessage();
370 370
 		}
371 371
 	}
Please login to merge, or discard this patch.
Braces   +75 added lines, -27 removed lines patch added patch discarded remove patch
@@ -96,8 +96,11 @@  discard block
 block discarded – undo
96 96
 			$data = array();
97 97
 			if ($row['registration'] != '') {
98 98
 				$image_array = $Image->getSpotterImage($row['registration']);
99
-				if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
100
-				else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
99
+				if (count($image_array) > 0) {
100
+					$data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
101
+				} else {
102
+					$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
103
+				}
101 104
 				$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
102 105
 				$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
103 106
 				if (!empty($aircraft_info)) {
@@ -113,17 +116,30 @@  discard block
 block discarded – undo
113 116
 					$data['aircraft_base'] = $owner_data['base'];
114 117
 					$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
115 118
 				}
116
-			} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
117
-			if ($row['registration'] == '') $row['registration'] = 'NA';
118
-			if ($row['ident'] == '') $row['ident'] = 'NA';
119
+			} else {
120
+				$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
121
+			}
122
+			if ($row['registration'] == '') {
123
+				$row['registration'] = 'NA';
124
+			}
125
+			if ($row['ident'] == '') {
126
+				$row['ident'] = 'NA';
127
+			}
119 128
 			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
120 129
 			if (isset($identicao[0])) {
121 130
 				if (substr($row['ident'],0,2) == 'AF') {
122
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
123
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
124
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
131
+					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
132
+						$icao = $row['ident'];
133
+					} else {
134
+						$icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
135
+					}
136
+				} else {
137
+					$icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
138
+				}
125 139
 				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
126
-			} else $icao = $row['ident'];
140
+			} else {
141
+				$icao = $row['ident'];
142
+			}
127 143
 			$icao = $Translation->checkTranslation($icao,false);
128 144
 			//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
129 145
 			if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
@@ -138,10 +154,14 @@  discard block
 block discarded – undo
138 154
 				//else echo 'No data...'."\n";
139 155
 			}
140 156
 			$data = array_merge($row,$data);
141
-			if ($data['ident'] == null) $data['ident'] = $icao;
157
+			if ($data['ident'] == null) {
158
+				$data['ident'] = $icao;
159
+			}
142 160
 			if ($data['title'] == null) {
143 161
 				$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
144
-			} else $data['message'] = strtolower($data['title']);
162
+			} else {
163
+				$data['message'] = strtolower($data['title']);
164
+			}
145 165
 			$ids = $Spotter->getAllIDByRegistration($data['registration']);
146 166
 			$date = $data['date'];
147 167
 			if (isset($ids[$date])) {
@@ -158,8 +178,9 @@  discard block
 block discarded – undo
158 178
 		if (isset($result)) {
159 179
 			$result[0]['query_number_rows'] = $i;
160 180
 			return $result;
181
+		} else {
182
+			return array();
161 183
 		}
162
-		else return array();
163 184
 	}
164 185
 	
165 186
 	/*
@@ -198,7 +219,9 @@  discard block
 block discarded – undo
198 219
 	*/
199 220
 	public function import($file) {
200 221
 		global $globalTransaction, $globalDebug;
201
-		if ($globalDebug) echo 'Import '.$file."\n";
222
+		if ($globalDebug) {
223
+			echo 'Import '.$file."\n";
224
+		}
202 225
 		$result = array();
203 226
 		if (file_exists($file)) {
204 227
 			if (($handle = fopen($file,'r')) !== FALSE) {
@@ -209,8 +232,11 @@  discard block
 block discarded – undo
209 232
 				}
210 233
 				fclose($handle);
211 234
 			}
212
-			if (!empty($result)) $this->add($result,true);
213
-			elseif ($globalDebug) echo 'Nothing to import';
235
+			if (!empty($result)) {
236
+				$this->add($result,true);
237
+			} elseif ($globalDebug) {
238
+				echo 'Nothing to import';
239
+			}
214 240
 		}
215 241
 	}
216 242
 
@@ -246,14 +272,23 @@  discard block
 block discarded – undo
246 272
 					}
247 273
 				}
248 274
 				fclose($handle);
249
-			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
250
-		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
275
+			} elseif ($globalDebug) {
276
+				echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
277
+			}
278
+		} elseif ($globalDebug) {
279
+			echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
280
+		}
251 281
 		$result = $Common->arr_diff($all_md5_new,$all_md5);
252
-		if (empty($result) && $globalDebug) echo 'Nothing to update';
282
+		if (empty($result) && $globalDebug) {
283
+			echo 'Nothing to update';
284
+		}
253 285
 		foreach ($result as $file => $md5) {
254 286
 			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
255
-			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
256
-			elseif ($globalDebug) echo 'Download '.$file.' failed';
287
+			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) {
288
+				$this->import(dirname(__FILE__).'/../install/tmp/'.$file);
289
+			} elseif ($globalDebug) {
290
+				echo 'Download '.$file.' failed';
291
+			}
257 292
 		}
258 293
 	}
259 294
 
@@ -270,13 +305,17 @@  discard block
 block discarded – undo
270 305
 		$Image = new Image();
271 306
 		$Spotter = new Spotter();
272 307
 
273
-		if (empty($crash)) return false;
308
+		if (empty($crash)) {
309
+			return false;
310
+		}
274 311
 		if (!$new) {
275 312
 			$query_delete = 'DELETE FROM accidents WHERE source = :source';
276 313
 			$sthd = $Connection->db->prepare($query_delete);
277 314
 			$sthd->execute(array(':source' => $crash[0]['source']));
278 315
 		}
279
-		if ($globalTransaction) $Connection->db->beginTransaction();
316
+		if ($globalTransaction) {
317
+			$Connection->db->beginTransaction();
318
+		}
280 319
 		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
281 320
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
282 321
 		$sth_check = $Connection->db->prepare($query_check);
@@ -291,7 +330,9 @@  discard block
 block discarded – undo
291 330
 					return $value === "" ? NULL : $value;
292 331
 				}, $cr);
293 332
 				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
294
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
333
+					if (strpos($cr['registration'],'-') === FALSE) {
334
+						$cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
335
+					}
295 336
 					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
296 337
 					$sth_check->execute($query_check_values);
297 338
 					$result_check = $sth_check->fetch(PDO::FETCH_ASSOC);
@@ -313,9 +354,13 @@  discard block
 block discarded – undo
313 354
 					$Connection->db->beginTransaction();
314 355
 				}
315 356
 			}
316
-			if ($globalTransaction) $Connection->db->commit();
357
+			if ($globalTransaction) {
358
+				$Connection->db->commit();
359
+			}
317 360
 		} catch(PDOException $e) {
318
-			if ($globalTransaction) $Connection->db->rollBack();
361
+			if ($globalTransaction) {
362
+				$Connection->db->rollBack();
363
+			}
319 364
 			echo $e->getMessage();
320 365
 		}
321 366
 		$sth_check->closeCursor();
@@ -354,8 +399,11 @@  discard block
 block discarded – undo
354 399
 			return "error : ".$e->getMessage();
355 400
 		}
356 401
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
357
-		if ($row['nb'] > 0) return false;
358
-		else return true;
402
+		if ($row['nb'] > 0) {
403
+			return false;
404
+		} else {
405
+			return true;
406
+		}
359 407
 	}
360 408
 
361 409
 	public static function insert_last_accidents_update() {
Please login to merge, or discard this patch.
statistics-fatalities-year.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
             	["'._("Year").'", "'._("# of Fatalities").'"], ';
24 24
 
25 25
 $date_data = '';
26
-foreach($date_array as $date_item)
26
+foreach ($date_array as $date_item)
27 27
 {
28 28
 	$date_data .= '[ "'.$date_item['year'].'",'.$date_item['count'].'],';
29 29
 }
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
 
51 51
 if (!empty($date_array))
52 52
 {
53
-	foreach($date_array as $key => $row) {
53
+	foreach ($date_array as $key => $row) {
54 54
 		$years[$key] = $row['year'];
55 55
 		$counts[$key] = $row['count'];
56 56
 	}
57 57
 	//array_multisort($years,SORT_DESC,$date_array);
58
-	array_multisort($counts,SORT_DESC,$date_array);
58
+	array_multisort($counts, SORT_DESC, $date_array);
59 59
 	print '<div class="table-responsive">';
60 60
 	print '<table class="common-date table-striped">';
61 61
 	print '<thead>';
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	print '</thead>';
66 66
 	print '<tbody>';
67 67
 	$i = 1;
68
-	foreach($date_array as $date_item)
68
+	foreach ($date_array as $date_item)
69 69
 	{
70 70
 		print '<tr>';
71 71
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
statistics.php 3 patches
Indentation   +213 added lines, -213 removed lines patch added patch discarded remove patch
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
40 40
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
41 41
 	}
42
-    ?>
42
+	?>
43 43
     </div>
44 44
     <?php    
45 45
 	// print_r($Stats->getAllAirlineNames()); 
46
-    ?>
46
+	?>
47 47
     <?php include('statistics-sub-menu.php'); ?>
48 48
     <p class="global-stats">
49 49
         <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span> <?php echo _("Flights"); ?></span>
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span>
52 52
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
53 53
 	<?php
54
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
54
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
55 55
 	?>
56 56
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span> <?php echo _("Pilots"); ?></span>
57 57
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
58 58
         <?php
59
-    	    } else {
60
-    	?>
59
+			} else {
60
+		?>
61 61
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span> <?php echo _("Owners"); ?></span>
62 62
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
63 63
     	<?php
64
-    	    }
65
-    	?>
64
+			}
65
+		?>
66 66
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span> <?php echo _("Aircrafts types"); ?></span>
67 67
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
68 68
         <?php
69
-    		if ($airline_icao == '') {
70
-    	?>
69
+			if ($airline_icao == '') {
70
+		?>
71 71
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span> <?php echo _("Airlines"); ?></span>
72 72
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
73 73
 	<?php
@@ -88,25 +88,25 @@  discard block
 block discarded – undo
88 88
             <div class="col-md-6">
89 89
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 90
                  <?php
91
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
-		    if (count($aircraft_array) == 0) print _("No data available");
93
-		    else {
91
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
+			if (count($aircraft_array) == 0) print _("No data available");
93
+			else {
94 94
 
95
-                    print '<div id="chart1" class="chart" width="100%"></div>
95
+					print '<div id="chart1" class="chart" width="100%"></div>
96 96
                     <script> 
97 97
                         google.load("visualization", "1", {packages:["corechart"]});
98 98
                       google.setOnLoadCallback(drawChart1);
99 99
                       function drawChart1() {
100 100
                         var data = google.visualization.arrayToDataTable([
101 101
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
102
-                            $aircraft_data = '';
103
-                          foreach($aircraft_array as $aircraft_item)
104
-                                    {
105
-                                            $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106
-                                    }
107
-                                    $aircraft_data = substr($aircraft_data, 0, -1);
108
-                                    print $aircraft_data;
109
-                        print ']);
102
+							$aircraft_data = '';
103
+						  foreach($aircraft_array as $aircraft_item)
104
+									{
105
+											$aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106
+									}
107
+									$aircraft_data = substr($aircraft_data, 0, -1);
108
+									print $aircraft_data;
109
+						print ']);
110 110
 
111 111
                         var options = {
112 112
                             chartArea: {"width": "80%", "height": "60%"},
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
                               drawChart1();
122 122
                             });
123 123
                   </script>';
124
-                  }
125
-                  ?>
124
+				  }
125
+				  ?>
126 126
                 <div class="more">
127 127
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
128 128
                 </div>
@@ -130,26 +130,26 @@  discard block
 block discarded – undo
130 130
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
131 131
 <?php
132 132
 //    echo $airline_icao;
133
-    if ($airline_icao == '' || $airline_icao == 'all') {
133
+	if ($airline_icao == '' || $airline_icao == 'all') {
134 134
 	$airline_array = $Stats->countAllAirlines(true,$filter_name);
135 135
 	if (count($airline_array) > 0) {
136
-            print '<div class="col-md-6">';
137
-	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
138
-	    print '<div id="chart2" class="chart" width="100%"></div>
136
+			print '<div class="col-md-6">';
137
+		print '<h2>'._("Top 10 Most Common Airline").'</h2>';
138
+		print '<div id="chart2" class="chart" width="100%"></div>
139 139
                     <script> 
140 140
                         google.load("visualization", "1", {packages:["corechart"]});
141 141
                       google.setOnLoadCallback(drawChart2);
142 142
                       function drawChart2() {
143 143
                         var data = google.visualization.arrayToDataTable([
144 144
                             ["'._("Airline").'", "'._("# of times").'"], ';
145
-	    $airline_data = '';
146
-	    foreach($airline_array as $airline_item)
147
-	    {
145
+		$airline_data = '';
146
+		foreach($airline_array as $airline_item)
147
+		{
148 148
 		$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
149
-	    }
150
-	    $airline_data = substr($airline_data, 0, -1);
151
-	    print $airline_data;
152
-	    print ']);
149
+		}
150
+		$airline_data = substr($airline_data, 0, -1);
151
+		print $airline_data;
152
+		print ']);
153 153
 
154 154
                         var options = {
155 155
                             chartArea: {"width": "80%", "height": "60%"},
@@ -164,23 +164,23 @@  discard block
 block discarded – undo
164 164
                               drawChart2();
165 165
                             });
166 166
                   </script>';
167
-	    print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
168
-    	    print '</div>';
167
+		print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
168
+			print '</div>';
169 169
 	}
170 170
 ?>
171 171
         </div>
172 172
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
173 173
 <?php
174
-    }
174
+	}
175 175
 ?>
176 176
         <div class="row column">
177 177
 <?php
178
-    $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
179
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
178
+	$flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
179
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
180 180
 	if (empty($flightover_array)) {
181
-	    print '<div class="col-md-12">';
181
+		print '<div class="col-md-12">';
182 182
 	} else {
183
-            print '<div class="col-md-6">';
183
+			print '<div class="col-md-6">';
184 184
 	}
185 185
 ?>
186 186
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
@@ -188,21 +188,21 @@  discard block
 block discarded – undo
188 188
 	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
189 189
 	if (count($pilot_array) == 0) print _("No data available");
190 190
 	else {
191
-	    print '<div id="chart7" class="chart" width="100%"></div>
191
+		print '<div id="chart7" class="chart" width="100%"></div>
192 192
                     <script> 
193 193
                         google.load("visualization", "1", {packages:["corechart"]});
194 194
                       google.setOnLoadCallback(drawChart7);
195 195
                       function drawChart7() {
196 196
                         var data = google.visualization.arrayToDataTable([
197 197
                             ["'._("Pilots").'", "'._("# of times").'"], ';
198
-	    $pilot_data = '';
199
-	    foreach($pilot_array as $pilot_item)
200
-	    {
198
+		$pilot_data = '';
199
+		foreach($pilot_array as $pilot_item)
200
+		{
201 201
 		$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
202
-	    }
203
-	    $pilot_data = substr($pilot_data, 0, -1);
204
-	    print $pilot_data;
205
-	    print ']);
202
+		}
203
+		$pilot_data = substr($pilot_data, 0, -1);
204
+		print $pilot_data;
205
+		print ']);
206 206
 
207 207
                         var options = {
208 208
                             chartArea: {"width": "80%", "height": "60%"},
@@ -217,7 +217,7 @@  discard block
 block discarded – undo
217 217
                               drawChart7();
218 218
                             });
219 219
                   </script>';
220
-        }
220
+		}
221 221
 ?>
222 222
                 <div class="more">
223 223
                     <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
         
227 227
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
228 228
 <?php
229
-    } else {
229
+	} else {
230 230
 ?>
231 231
             <div class="col-md-6">
232 232
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
@@ -234,21 +234,21 @@  discard block
 block discarded – undo
234 234
 	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
235 235
 	if (count($owner_array) == 0) print _("No data available");
236 236
 	else {
237
-	    print '<div id="chart7" class="chart" width="100%"></div>
237
+		print '<div id="chart7" class="chart" width="100%"></div>
238 238
                     <script> 
239 239
                         google.load("visualization", "1", {packages:["corechart"]});
240 240
                       google.setOnLoadCallback(drawChart7);
241 241
                       function drawChart7() {
242 242
                         var data = google.visualization.arrayToDataTable([
243 243
                             ["'._("Owner").'", "'._("# of times").'"], ';
244
-                            $owner_data = '';
245
-	    foreach($owner_array as $owner_item)
246
-	    {
244
+							$owner_data = '';
245
+		foreach($owner_array as $owner_item)
246
+		{
247 247
 		$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
248
-	    }
249
-	    $owner_data = substr($owner_data, 0, -1);
250
-	    print $owner_data;
251
-	    print ']);
248
+		}
249
+		$owner_data = substr($owner_data, 0, -1);
250
+		print $owner_data;
251
+		print ']);
252 252
 
253 253
                         var options = {
254 254
                             chartArea: {"width": "80%", "height": "60%"},
@@ -272,8 +272,8 @@  discard block
 block discarded – undo
272 272
         
273 273
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
274 274
 <?php
275
-    }
276
-    if (!empty($flightover_array)) {
275
+	}
276
+	if (!empty($flightover_array)) {
277 277
 ?>
278 278
             <div class="col-md-6">
279 279
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
@@ -281,21 +281,21 @@  discard block
 block discarded – undo
281 281
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
282 282
 	if (count($flightover_array) == 0) print _("No data available");
283 283
 	else {
284
-	    print '<div id="chart10" class="chart" width="100%"></div>
284
+		print '<div id="chart10" class="chart" width="100%"></div>
285 285
                     <script> 
286 286
                         google.load("visualization", "1", {packages:["corechart"]});
287 287
                       google.setOnLoadCallback(drawChart10);
288 288
                       function drawChart10() {
289 289
                         var data = google.visualization.arrayToDataTable([
290 290
                             ["'._("Country").'", "'._("# of times").'"], ';
291
-                            $flightover_data = '';
292
-	    foreach($flightover_array as $flightover_item)
293
-	    {
291
+							$flightover_data = '';
292
+		foreach($flightover_array as $flightover_item)
293
+		{
294 294
 		$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
295
-	    }
296
-	    $flightover_data = substr($flightover_data, 0, -1);
297
-	    print $flightover_data;
298
-	    print ']);
295
+		}
296
+		$flightover_data = substr($flightover_data, 0, -1);
297
+		print $flightover_data;
298
+		print ']);
299 299
 
300 300
                         var options = {
301 301
                             chartArea: {"width": "80%", "height": "60%"},
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                 </div>
320 320
             </div>
321 321
 <?php
322
-    }
322
+	}
323 323
 ?>
324 324
         </div>
325 325
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -329,8 +329,8 @@  discard block
 block discarded – undo
329 329
         <div class="row column">
330 330
             <div class="col-md-6">
331 331
 <?php
332
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
333
-    if (count($airport_airport_array) > 0) {
332
+	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
333
+	if (count($airport_airport_array) > 0) {
334 334
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
335 335
 	print '<div id="chart3" class="chart" width="100%"></div>
336 336
                 <script>
@@ -343,13 +343,13 @@  discard block
 block discarded – undo
343 343
 
344 344
                 var data = google.visualization.arrayToDataTable([ 
345 345
                     ["'._("Airport").'", "'._("# of times").'"],';
346
-                    $airport_data = '';
346
+					$airport_data = '';
347 347
 	foreach($airport_airport_array as $airport_item)
348 348
 	{
349
-	    $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
350
-	    $name = str_replace("'", "", $name);
351
-	    $name = str_replace('"', "", $name);
352
-	    $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
349
+		$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
350
+		$name = str_replace("'", "", $name);
351
+		$name = str_replace('"', "", $name);
352
+		$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
353 353
 	}
354 354
 	$airport_data = substr($airport_data, 0, -1);
355 355
 	print $airport_data;
@@ -368,15 +368,15 @@  discard block
 block discarded – undo
368 368
               }
369 369
                 </script>';
370 370
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
371
-    }
371
+	}
372 372
 ?>
373 373
             </div>
374 374
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
375 375
 
376 376
             <div class="col-md-6">
377 377
 <?php
378
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
379
-    if (count($airport_airport_array2) > 0) {
378
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
379
+	if (count($airport_airport_array2) > 0) {
380 380
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
381 381
 	print '<div id="chart4" class="chart" width="100%"></div>
382 382
                 <script>
@@ -392,9 +392,9 @@  discard block
 block discarded – undo
392 392
 	$airport_data2 = '';
393 393
 	foreach($airport_airport_array2 as $airport_item2)
394 394
 	{
395
-	    $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
396
-	    $name2 = str_replace(array("'",'"'), '', $name2);
397
-	    $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
395
+		$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
396
+		$name2 = str_replace(array("'",'"'), '', $name2);
397
+		$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
398 398
 	}
399 399
 	$airport_data2 = substr($airport_data2, 0, -1);
400 400
 	print $airport_data2;
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
               }
414 414
                 </script>';
415 415
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
416
-    }
416
+	}
417 417
 ?>
418 418
             </div>
419 419
         </div>
@@ -423,24 +423,24 @@  discard block
 block discarded – undo
423 423
             <div class="col-md-6">
424 424
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
425 425
                 <?php
426
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
427
-		    if (count($year_array) == 0) print _("No data available");
428
-		    else {
429
-                  print '<div id="chart8" class="chart" width="100%"></div>
426
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
427
+			if (count($year_array) == 0) print _("No data available");
428
+			else {
429
+				  print '<div id="chart8" class="chart" width="100%"></div>
430 430
                     <script> 
431 431
                         google.load("visualization", "1", {packages:["corechart"]});
432 432
                       google.setOnLoadCallback(drawChart8);
433 433
                       function drawChart8() {
434 434
                         var data = google.visualization.arrayToDataTable([
435 435
                             ["'._("Month").'", "'._("# of Flights").'"], ';
436
-                            $year_data = '';
437
-                          foreach($year_array as $year_item)
438
-                                    {
439
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
440
-                                    }
441
-                                    $year_data = substr($year_data, 0, -1);
442
-                                    print $year_data;
443
-                        print ']);
436
+							$year_data = '';
437
+						  foreach($year_array as $year_item)
438
+									{
439
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
440
+									}
441
+									$year_data = substr($year_data, 0, -1);
442
+									print $year_data;
443
+						print ']);
444 444
 
445 445
                         var options = {
446 446
                             legend: {position: "none"},
@@ -458,8 +458,8 @@  discard block
 block discarded – undo
458 458
                               drawChart8();
459 459
                             });
460 460
                   </script>';
461
-                  }
462
-                  ?>
461
+				  }
462
+				  ?>
463 463
                 <div class="more">
464 464
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
465 465
                 </div>
@@ -469,24 +469,24 @@  discard block
 block discarded – undo
469 469
             <div class="col-md-6">
470 470
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
471 471
                 <?php
472
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
473
-		    if (count($month_array) == 0) print _("No data available");
474
-		    else {
475
-                  print '<div id="chart9" class="chart" width="100%"></div>
472
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
473
+			if (count($month_array) == 0) print _("No data available");
474
+			else {
475
+				  print '<div id="chart9" class="chart" width="100%"></div>
476 476
                     <script> 
477 477
                         google.load("visualization", "1", {packages:["corechart"]});
478 478
                       google.setOnLoadCallback(drawChart9);
479 479
                       function drawChart9() {
480 480
                         var data = google.visualization.arrayToDataTable([
481 481
                             ["'._("Day").'", "'._("# of Flights").'"], ';
482
-                            $month_data = '';
483
-                          foreach($month_array as $month_item)
484
-                                    {
485
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
486
-                                    }
487
-                                    $month_data = substr($month_data, 0, -1);
488
-                                    print $month_data;
489
-                        print ']);
482
+							$month_data = '';
483
+						  foreach($month_array as $month_item)
484
+									{
485
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
486
+									}
487
+									$month_data = substr($month_data, 0, -1);
488
+									print $month_data;
489
+						print ']);
490 490
 
491 491
                         var options = {
492 492
                             legend: {position: "none"},
@@ -504,8 +504,8 @@  discard block
 block discarded – undo
504 504
                               drawChart9();
505 505
                             });
506 506
                   </script>';
507
-                  }
508
-                  ?>
507
+				  }
508
+				  ?>
509 509
                 <div class="more">
510 510
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
511 511
                 </div>
@@ -515,25 +515,25 @@  discard block
 block discarded – undo
515 515
             <div class="col-md-6">
516 516
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
517 517
                 <?php
518
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
519
-		    if (empty($date_array)) print _("No data available");
520
-		    else {
521
-                  print '<div id="chart5" class="chart" width="100%"></div>
518
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
519
+			if (empty($date_array)) print _("No data available");
520
+			else {
521
+				  print '<div id="chart5" class="chart" width="100%"></div>
522 522
                     <script> 
523 523
                         google.load("visualization", "1", {packages:["corechart"]});
524 524
                       google.setOnLoadCallback(drawChart5);
525 525
                       function drawChart5() {
526 526
                         var data = google.visualization.arrayToDataTable([
527 527
                             ["'._("Date").'", "'._("# of Flights").'"], ';
528
-                            $date_data = '';
528
+							$date_data = '';
529 529
                         
530
-                          foreach($date_array as $date_item)
531
-                                    {
532
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
533
-                                    }
534
-                                    $date_data = substr($date_data, 0, -1);
535
-                                    print $date_data;
536
-                        print ']);
530
+						  foreach($date_array as $date_item)
531
+									{
532
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
533
+									}
534
+									$date_data = substr($date_data, 0, -1);
535
+									print $date_data;
536
+						print ']);
537 537
 
538 538
                         var options = {
539 539
                             legend: {position: "none"},
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
                               drawChart5();
552 552
                             });
553 553
                   </script>';
554
-                  }
555
-                  ?>
554
+				  }
555
+				  ?>
556 556
                 <div class="more">
557 557
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
558 558
                 </div>
@@ -562,25 +562,25 @@  discard block
 block discarded – undo
562 562
             <div class="col-md-6">
563 563
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
564 564
                 <?php
565
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
566
-		    if (empty($hour_array)) print _("No data available");
567
-		    else {
565
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
566
+			if (empty($hour_array)) print _("No data available");
567
+			else {
568 568
 
569
-                  print '<div id="chart6" class="chart" width="100%"></div>
569
+				  print '<div id="chart6" class="chart" width="100%"></div>
570 570
                     <script> 
571 571
                         google.load("visualization", "1", {packages:["corechart"]});
572 572
                       google.setOnLoadCallback(drawChart6);
573 573
                       function drawChart6() {
574 574
                         var data = google.visualization.arrayToDataTable([
575 575
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
576
-                            $hour_data = '';
577
-                          foreach($hour_array as $hour_item)
578
-                                    {
579
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
580
-                                    }
581
-                                    $hour_data = substr($hour_data, 0, -1);
582
-                                    print $hour_data;
583
-                        print ']);
576
+							$hour_data = '';
577
+						  foreach($hour_array as $hour_item)
578
+									{
579
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
580
+									}
581
+									$hour_data = substr($hour_data, 0, -1);
582
+									print $hour_data;
583
+						print ']);
584 584
 
585 585
                         var options = {
586 586
                             legend: {position: "none"},
@@ -598,8 +598,8 @@  discard block
 block discarded – undo
598 598
                               drawChart6();
599 599
                             });
600 600
                   </script>';
601
-                  }
602
-                ?>
601
+				  }
602
+				?>
603 603
                 <div class="more">
604 604
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
605 605
                 </div>
@@ -607,32 +607,32 @@  discard block
 block discarded – undo
607 607
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
608 608
         </div>
609 609
 <?php
610
-    if (isset($globalAccidents) && $globalAccidents) {
610
+	if (isset($globalAccidents) && $globalAccidents) {
611 611
 ?>
612 612
         <div class="row column">
613 613
             <div class="col-md-6">
614 614
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
615 615
                 <?php
616
-		    require_once('require/class.Accident.php');
617
-            	    $Accident = new Accident();
618
-                  $year_array = $Accident->countFatalitiesByYear($filter_name);
619
-		    if (count($year_array) == 0) print _("No data available");
620
-		    else {
621
-                  print '<div id="chart32" class="chart" width="100%"></div>
616
+			require_once('require/class.Accident.php');
617
+					$Accident = new Accident();
618
+				  $year_array = $Accident->countFatalitiesByYear($filter_name);
619
+			if (count($year_array) == 0) print _("No data available");
620
+			else {
621
+				  print '<div id="chart32" class="chart" width="100%"></div>
622 622
                     <script> 
623 623
                         google.load("visualization", "1", {packages:["corechart"]});
624 624
                       google.setOnLoadCallback(drawChart32);
625 625
                       function drawChart32() {
626 626
                         var data = google.visualization.arrayToDataTable([
627 627
                             ["'._("Year").'", "'._("# of Fatalities").'"], ';
628
-                            $year_data = '';
629
-                          foreach($year_array as $year_item)
630
-                                    {
631
-                                        $year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
632
-                                    }
633
-                                    $year_data = substr($year_data, 0, -1);
634
-                                    print $year_data;
635
-                        print ']);
628
+							$year_data = '';
629
+						  foreach($year_array as $year_item)
630
+									{
631
+										$year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
632
+									}
633
+									$year_data = substr($year_data, 0, -1);
634
+									print $year_data;
635
+						print ']);
636 636
 
637 637
                         var options = {
638 638
                             legend: {position: "none"},
@@ -650,8 +650,8 @@  discard block
 block discarded – undo
650 650
                               drawChart32();
651 651
                             });
652 652
                   </script>';
653
-                  }
654
-                  ?>
653
+				  }
654
+				  ?>
655 655
                 <div class="more">
656 656
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
657 657
                 </div>
@@ -662,26 +662,26 @@  discard block
 block discarded – undo
662 662
             <div class="col-md-6">
663 663
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
664 664
                 <?php
665
-		    require_once('require/class.Accident.php');
666
-            	    $Accident = new Accident();
667
-                  $year_array = $Accident->countFatalitiesLast12Months($filter_name);
668
-		    if (count($year_array) == 0) print _("No data available");
669
-		    else {
670
-                  print '<div id="chart33" class="chart" width="100%"></div>
665
+			require_once('require/class.Accident.php');
666
+					$Accident = new Accident();
667
+				  $year_array = $Accident->countFatalitiesLast12Months($filter_name);
668
+			if (count($year_array) == 0) print _("No data available");
669
+			else {
670
+				  print '<div id="chart33" class="chart" width="100%"></div>
671 671
                     <script> 
672 672
                         google.load("visualization", "1", {packages:["corechart"]});
673 673
                       google.setOnLoadCallback(drawChart33);
674 674
                       function drawChart33() {
675 675
                         var data = google.visualization.arrayToDataTable([
676 676
                             ["'._("Month").'", "'._("# of Fatalities").'"], ';
677
-                            $year_data = '';
678
-                          foreach($year_array as $year_item)
679
-                                    {
680
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
681
-                                    }
682
-                                    $year_data = substr($year_data, 0, -1);
683
-                                    print $year_data;
684
-                        print ']);
677
+							$year_data = '';
678
+						  foreach($year_array as $year_item)
679
+									{
680
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
681
+									}
682
+									$year_data = substr($year_data, 0, -1);
683
+									print $year_data;
684
+						print ']);
685 685
 
686 686
                         var options = {
687 687
                             legend: {position: "none"},
@@ -699,8 +699,8 @@  discard block
 block discarded – undo
699 699
                               drawChart33();
700 700
                             });
701 701
                   </script>';
702
-                  }
703
-                  ?>
702
+				  }
703
+				  ?>
704 704
                 <div class="more">
705 705
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
706 706
                 </div>
@@ -708,25 +708,25 @@  discard block
 block discarded – undo
708 708
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
709 709
 <br/>
710 710
 <?php
711
-    }
711
+	}
712 712
 ?>
713 713
 
714 714
 <?php
715
-    if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') {
715
+	if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') {
716 716
 ?>
717 717
         <div class="row column">
718 718
         	<?php
719
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
720
-        	    if (!empty($polar)) {
721
-            		print '<h2>'._("Coverage pattern").'</h2>';
722
-        		foreach ($polar as $eachpolar) {
723
-        		    unset($polar_data);
724
-	        	    $Spotter = new Spotter();
725
-        		    $data = json_decode($eachpolar['source_data']);
726
-        		    foreach($data as $value => $key) {
727
-        			$direction = $Spotter->parseDirection(($value*22.5));
728
-        			$distance = $key;
729
-        			$unit = 'km';
719
+				$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
720
+				if (!empty($polar)) {
721
+					print '<h2>'._("Coverage pattern").'</h2>';
722
+				foreach ($polar as $eachpolar) {
723
+					unset($polar_data);
724
+					$Spotter = new Spotter();
725
+					$data = json_decode($eachpolar['source_data']);
726
+					foreach($data as $value => $key) {
727
+					$direction = $Spotter->parseDirection(($value*22.5));
728
+					$distance = $key;
729
+					$unit = 'km';
730 730
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
731 731
 					$distance = round($distance*0.539957);
732 732
 					$unit = 'nm';
@@ -737,10 +737,10 @@  discard block
 block discarded – undo
737 737
 					$distance = $distance;
738 738
 					$unit = 'km';
739 739
 				}
740
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
741
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
742
-        		    }
743
-        	?>
740
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
741
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
742
+					}
743
+			?>
744 744
             <div class="col-md-6">
745 745
                 <h4><?php print $eachpolar['source_name']; ?></h4>
746 746
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -772,22 +772,22 @@  discard block
 block discarded – undo
772 772
 		</script>
773 773
             </div>
774 774
             <?php
775
-        	    }
776
-        	}
777
-            ?>
775
+				}
776
+			}
777
+			?>
778 778
         </div>
779 779
         <div class="row column">
780 780
             <div class="col-md-6">
781 781
         	<?php
782
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
783
-        	    if (!empty($msg)) {
784
-            		print '<h2>'._("Messages received").'</h2>';
785
-        		foreach ($msg as $eachmsg) {
786
-        		    //$eachmsg = $msg[0];
787
-        		    $data = $eachmsg['source_data'];
788
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
789
-        		    else $max = 500;
790
-        	?>
782
+				$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
783
+				if (!empty($msg)) {
784
+					print '<h2>'._("Messages received").'</h2>';
785
+				foreach ($msg as $eachmsg) {
786
+					//$eachmsg = $msg[0];
787
+					$data = $eachmsg['source_data'];
788
+					if ($data > 500) $max = (round(($data+100)/100))*100;
789
+					else $max = 500;
790
+			?>
791 791
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
792 792
         	<script>
793 793
 		      var g = new JustGage({
@@ -803,9 +803,9 @@  discard block
 block discarded – undo
803 803
 			  });
804 804
 		</script>
805 805
             <?php
806
-        	   }
807
-        	}
808
-            ?>
806
+			   }
807
+			}
808
+			?>
809 809
             </div>
810 810
         </div>
811 811
         <div class="row column">
@@ -832,19 +832,19 @@  discard block
 block discarded – undo
832 832
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
833 833
 			}
834 834
 			$hist_data = substr($hist_data, 0, -1);
835
-            ?>
835
+			?>
836 836
             <div class="col-md-6">
837 837
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
838 838
                 <?php
839
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
839
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
840 840
                     <script> 
841 841
                         google.load("visualization", "1", {packages:["corechart"]});
842 842
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
843 843
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
844 844
                         var data = google.visualization.arrayToDataTable([
845 845
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
846
-                            print $hist_data;
847
-                        print ']);
846
+							print $hist_data;
847
+						print ']);
848 848
 
849 849
                         var options = {
850 850
                             legend: {position: "none"},
@@ -862,15 +862,15 @@  discard block
 block discarded – undo
862 862
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
863 863
                             });
864 864
                   </script>';
865
-        	?>
865
+			?>
866 866
     	    </div>
867 867
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
868 868
         	<?php
869
-                  }
870
-                ?>
869
+				  }
870
+				?>
871 871
         </div>
872 872
 <?php
873
-    }
873
+	}
874 874
 ?>
875 875
     </div>
876 876
 </div>  
Please login to merge, or discard this patch.
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
 $title = _("Statistics");
8 8
 
9 9
 if (!isset($filter_name)) $filter_name = '';
10
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
11 11
 if ($airline_icao == 'all') {
12 12
 	unset($_COOKIE['stats_airline_icao']);
13
-	setcookie('stats_airline_icao', '', time()-3600);
13
+	setcookie('stats_airline_icao', '', time() - 3600);
14 14
 	$airline_icao = '';
15 15
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
16 16
 	$airline_icao = $_COOKIE['stats_airline_icao'];
17 17
 } elseif ($airline_icao == '' && isset($globalFilter)) {
18 18
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
19 19
 }
20
-setcookie('stats_airline_icao',$airline_icao);
20
+setcookie('stats_airline_icao', $airline_icao);
21 21
 require_once('header.php');
22 22
 
23 23
 ?>
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		date_default_timezone_set('UTC');
38 38
 		$lastupdate = strtotime($last_update[0]['value']);
39 39
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
40
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
40
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
41 41
 	}
42 42
     ?>
43 43
     </div>
@@ -46,30 +46,30 @@  discard block
 block discarded – undo
46 46
     ?>
47 47
     <?php include('statistics-sub-menu.php'); ?>
48 48
     <p class="global-stats">
49
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span> <?php echo _("Flights"); ?></span>
50
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
51
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span>
52
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
49
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name)); ?></span> <?php echo _("Flights"); ?></span>
50
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
51
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span>
52
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
53 53
 	<?php
54 54
 	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
55 55
 	?>
56
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span> <?php echo _("Pilots"); ?></span>
57
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
56
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name)); ?></span> <?php echo _("Pilots"); ?></span>
57
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
58 58
         <?php
59 59
     	    } else {
60 60
     	?>
61
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span> <?php echo _("Owners"); ?></span>
62
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
61
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name)); ?></span> <?php echo _("Owners"); ?></span>
62
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
63 63
     	<?php
64 64
     	    }
65 65
     	?>
66
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span> <?php echo _("Aircrafts types"); ?></span>
67
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
66
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name)); ?></span> <?php echo _("Aircrafts types"); ?></span>
67
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
68 68
         <?php
69 69
     		if ($airline_icao == '') {
70 70
     	?>
71 71
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span> <?php echo _("Airlines"); ?></span>
72
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
72
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
73 73
 	<?php
74 74
 		}
75 75
 	?>
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
78 78
 	?>
79 79
         <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name)); ?></span> <?php echo _("Military"); ?></span>
80
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
80
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
81 81
 	<?php
82 82
 		}
83 83
 	?>
84 84
     </p>
85
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
85
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
86 86
     <div class="specific-stats">
87 87
         <div class="row column">
88 88
             <div class="col-md-6">
89 89
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 90
                  <?php
91
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
91
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name);
92 92
 		    if (count($aircraft_array) == 0) print _("No data available");
93 93
 		    else {
94 94
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                         var data = google.visualization.arrayToDataTable([
101 101
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
102 102
                             $aircraft_data = '';
103
-                          foreach($aircraft_array as $aircraft_item)
103
+                          foreach ($aircraft_array as $aircraft_item)
104 104
                                     {
105 105
                                             $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106 106
                                     }
@@ -127,11 +127,11 @@  discard block
 block discarded – undo
127 127
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
128 128
                 </div>
129 129
             </div>
130
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
130
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
131 131
 <?php
132 132
 //    echo $airline_icao;
133 133
     if ($airline_icao == '' || $airline_icao == 'all') {
134
-	$airline_array = $Stats->countAllAirlines(true,$filter_name);
134
+	$airline_array = $Stats->countAllAirlines(true, $filter_name);
135 135
 	if (count($airline_array) > 0) {
136 136
             print '<div class="col-md-6">';
137 137
 	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
                         var data = google.visualization.arrayToDataTable([
144 144
                             ["'._("Airline").'", "'._("# of times").'"], ';
145 145
 	    $airline_data = '';
146
-	    foreach($airline_array as $airline_item)
146
+	    foreach ($airline_array as $airline_item)
147 147
 	    {
148 148
 		$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
149 149
 	    }
@@ -169,13 +169,13 @@  discard block
 block discarded – undo
169 169
 	}
170 170
 ?>
171 171
         </div>
172
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
172
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
173 173
 <?php
174 174
     }
175 175
 ?>
176 176
         <div class="row column">
177 177
 <?php
178
-    $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
178
+    $flightover_array = $Stats->countAllFlightOverCountries($airline_icao, $filter_name);
179 179
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
180 180
 	if (empty($flightover_array)) {
181 181
 	    print '<div class="col-md-12">';
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 ?>
186 186
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
187 187
 <?php
188
-	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
188
+	$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name);
189 189
 	if (count($pilot_array) == 0) print _("No data available");
190 190
 	else {
191 191
 	    print '<div id="chart7" class="chart" width="100%"></div>
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
                         var data = google.visualization.arrayToDataTable([
197 197
                             ["'._("Pilots").'", "'._("# of times").'"], ';
198 198
 	    $pilot_data = '';
199
-	    foreach($pilot_array as $pilot_item)
199
+	    foreach ($pilot_array as $pilot_item)
200 200
 	    {
201 201
 		$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
202 202
 	    }
@@ -224,14 +224,14 @@  discard block
 block discarded – undo
224 224
                 </div>
225 225
             </div>
226 226
         
227
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
227
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
228 228
 <?php
229 229
     } else {
230 230
 ?>
231 231
             <div class="col-md-6">
232 232
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
233 233
 <?php
234
-	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
234
+	$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name);
235 235
 	if (count($owner_array) == 0) print _("No data available");
236 236
 	else {
237 237
 	    print '<div id="chart7" class="chart" width="100%"></div>
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                         var data = google.visualization.arrayToDataTable([
243 243
                             ["'._("Owner").'", "'._("# of times").'"], ';
244 244
                             $owner_data = '';
245
-	    foreach($owner_array as $owner_item)
245
+	    foreach ($owner_array as $owner_item)
246 246
 	    {
247 247
 		$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
248 248
 	    }
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
                 </div>
271 271
             </div>
272 272
         
273
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
273
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
274 274
 <?php
275 275
     }
276 276
     if (!empty($flightover_array)) {
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                         var data = google.visualization.arrayToDataTable([
290 290
                             ["'._("Country").'", "'._("# of times").'"], ';
291 291
                             $flightover_data = '';
292
-	    foreach($flightover_array as $flightover_item)
292
+	    foreach ($flightover_array as $flightover_item)
293 293
 	    {
294 294
 		$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
295 295
 	    }
@@ -322,14 +322,14 @@  discard block
 block discarded – undo
322 322
     }
323 323
 ?>
324 324
         </div>
325
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
325
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
326 326
 
327 327
     	
328 328
         </div>
329 329
         <div class="row column">
330 330
             <div class="col-md-6">
331 331
 <?php
332
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
332
+    $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name);
333 333
     if (count($airport_airport_array) > 0) {
334 334
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
335 335
 	print '<div id="chart3" class="chart" width="100%"></div>
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                 var data = google.visualization.arrayToDataTable([ 
345 345
                     ["'._("Airport").'", "'._("# of times").'"],';
346 346
                     $airport_data = '';
347
-	foreach($airport_airport_array as $airport_item)
347
+	foreach ($airport_airport_array as $airport_item)
348 348
 	{
349 349
 	    $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
350 350
 	    $name = str_replace("'", "", $name);
@@ -371,11 +371,11 @@  discard block
 block discarded – undo
371 371
     }
372 372
 ?>
373 373
             </div>
374
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
374
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
375 375
 
376 376
             <div class="col-md-6">
377 377
 <?php
378
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
378
+    $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name);
379 379
     if (count($airport_airport_array2) > 0) {
380 380
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
381 381
 	print '<div id="chart4" class="chart" width="100%"></div>
@@ -390,10 +390,10 @@  discard block
 block discarded – undo
390 390
                 var data = google.visualization.arrayToDataTable([ 
391 391
                     ["'._("Airport").'", "'._("# of times").'"],';
392 392
 	$airport_data2 = '';
393
-	foreach($airport_airport_array2 as $airport_item2)
393
+	foreach ($airport_airport_array2 as $airport_item2)
394 394
 	{
395 395
 	    $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
396
-	    $name2 = str_replace(array("'",'"'), '', $name2);
396
+	    $name2 = str_replace(array("'", '"'), '', $name2);
397 397
 	    $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
398 398
 	}
399 399
 	$airport_data2 = substr($airport_data2, 0, -1);
@@ -417,13 +417,13 @@  discard block
 block discarded – undo
417 417
 ?>
418 418
             </div>
419 419
         </div>
420
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
420
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
421 421
 
422 422
         <div class="row column">
423 423
             <div class="col-md-6">
424 424
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
425 425
                 <?php
426
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
426
+                  $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
427 427
 		    if (count($year_array) == 0) print _("No data available");
428 428
 		    else {
429 429
                   print '<div id="chart8" class="chart" width="100%"></div>
@@ -434,9 +434,9 @@  discard block
 block discarded – undo
434 434
                         var data = google.visualization.arrayToDataTable([
435 435
                             ["'._("Month").'", "'._("# of Flights").'"], ';
436 436
                             $year_data = '';
437
-                          foreach($year_array as $year_item)
437
+                          foreach ($year_array as $year_item)
438 438
                                     {
439
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
439
+                                        $year_data .= '[ "'.date('F, Y', strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
440 440
                                     }
441 441
                                     $year_data = substr($year_data, 0, -1);
442 442
                                     print $year_data;
@@ -464,12 +464,12 @@  discard block
 block discarded – undo
464 464
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
465 465
                 </div>
466 466
             </div>
467
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
467
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
468 468
 
469 469
             <div class="col-md-6">
470 470
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
471 471
                 <?php
472
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
472
+                  $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
473 473
 		    if (count($month_array) == 0) print _("No data available");
474 474
 		    else {
475 475
                   print '<div id="chart9" class="chart" width="100%"></div>
@@ -480,9 +480,9 @@  discard block
 block discarded – undo
480 480
                         var data = google.visualization.arrayToDataTable([
481 481
                             ["'._("Day").'", "'._("# of Flights").'"], ';
482 482
                             $month_data = '';
483
-                          foreach($month_array as $month_item)
483
+                          foreach ($month_array as $month_item)
484 484
                                     {
485
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
485
+                                        $month_data .= '[ "'.date('F j, Y', strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
486 486
                                     }
487 487
                                     $month_data = substr($month_data, 0, -1);
488 488
                                     print $month_data;
@@ -510,12 +510,12 @@  discard block
 block discarded – undo
510 510
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
511 511
                 </div>
512 512
             </div>
513
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
513
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
514 514
 
515 515
             <div class="col-md-6">
516 516
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
517 517
                 <?php
518
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
518
+                    $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
519 519
 		    if (empty($date_array)) print _("No data available");
520 520
 		    else {
521 521
                   print '<div id="chart5" class="chart" width="100%"></div>
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
                             ["'._("Date").'", "'._("# of Flights").'"], ';
528 528
                             $date_data = '';
529 529
                         
530
-                          foreach($date_array as $date_item)
530
+                          foreach ($date_array as $date_item)
531 531
                                     {
532 532
                                         $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
533 533
                                     }
@@ -557,12 +557,12 @@  discard block
 block discarded – undo
557 557
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
558 558
                 </div>
559 559
             </div>
560
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
560
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
561 561
 
562 562
             <div class="col-md-6">
563 563
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
564 564
                 <?php
565
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
565
+                  $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
566 566
 		    if (empty($hour_array)) print _("No data available");
567 567
 		    else {
568 568
 
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
                         var data = google.visualization.arrayToDataTable([
575 575
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
576 576
                             $hour_data = '';
577
-                          foreach($hour_array as $hour_item)
577
+                          foreach ($hour_array as $hour_item)
578 578
                                     {
579 579
                                         $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
580 580
                                     }
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
605 605
                 </div>
606 606
             </div>
607
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
607
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
608 608
         </div>
609 609
 <?php
610 610
     if (isset($globalAccidents) && $globalAccidents) {
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
                         var data = google.visualization.arrayToDataTable([
627 627
                             ["'._("Year").'", "'._("# of Fatalities").'"], ';
628 628
                             $year_data = '';
629
-                          foreach($year_array as $year_item)
629
+                          foreach ($year_array as $year_item)
630 630
                                     {
631 631
                                         $year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
632 632
                                     }
@@ -656,7 +656,7 @@  discard block
 block discarded – undo
656 656
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
657 657
                 </div>
658 658
             </div>
659
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
659
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
660 660
 
661 661
         <div class="row column">
662 662
             <div class="col-md-6">
@@ -675,9 +675,9 @@  discard block
 block discarded – undo
675 675
                         var data = google.visualization.arrayToDataTable([
676 676
                             ["'._("Month").'", "'._("# of Fatalities").'"], ';
677 677
                             $year_data = '';
678
-                          foreach($year_array as $year_item)
678
+                          foreach ($year_array as $year_item)
679 679
                                     {
680
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
680
+                                        $year_data .= '[ "'.date('F, Y', strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
681 681
                                     }
682 682
                                     $year_data = substr($year_data, 0, -1);
683 683
                                     print $year_data;
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
706 706
                 </div>
707 707
             </div>
708
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
708
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
709 709
 <br/>
710 710
 <?php
711 711
     }
@@ -716,14 +716,14 @@  discard block
 block discarded – undo
716 716
 ?>
717 717
         <div class="row column">
718 718
         	<?php
719
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
719
+        	    $polar = $Stats->getStatsSource(date('Y-m-d'), 'polar');
720 720
         	    if (!empty($polar)) {
721 721
             		print '<h2>'._("Coverage pattern").'</h2>';
722 722
         		foreach ($polar as $eachpolar) {
723 723
         		    unset($polar_data);
724 724
 	        	    $Spotter = new Spotter();
725 725
         		    $data = json_decode($eachpolar['source_data']);
726
-        		    foreach($data as $value => $key) {
726
+        		    foreach ($data as $value => $key) {
727 727
         			$direction = $Spotter->parseDirection(($value*22.5));
728 728
         			$distance = $key;
729 729
         			$unit = 'km';
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
         	?>
744 744
             <div class="col-md-6">
745 745
                 <h4><?php print $eachpolar['source_name']; ?></h4>
746
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
746
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
747 747
         	<script>
748 748
         	    (function() {
749 749
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 		      color: color,
768 768
 		      unit: '<?php echo $unit; ?>'
769 769
 		    };
770
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
770
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
771 771
 		    })();
772 772
 		</script>
773 773
             </div>
@@ -779,19 +779,19 @@  discard block
 block discarded – undo
779 779
         <div class="row column">
780 780
             <div class="col-md-6">
781 781
         	<?php
782
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
782
+        	    $msg = $Stats->getStatsSource(date('Y-m-d'), 'msg');
783 783
         	    if (!empty($msg)) {
784 784
             		print '<h2>'._("Messages received").'</h2>';
785 785
         		foreach ($msg as $eachmsg) {
786 786
         		    //$eachmsg = $msg[0];
787 787
         		    $data = $eachmsg['source_data'];
788
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
788
+        		    if ($data > 500) $max = (round(($data + 100)/100))*100;
789 789
         		    else $max = 500;
790 790
         	?>
791
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
791
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
792 792
         	<script>
793 793
 		      var g = new JustGage({
794
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
794
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
795 795
 			    value: <?php echo $data; ?>,
796 796
 			    min: 0,
797 797
 			    max: <?php print $max; ?>,
@@ -811,12 +811,12 @@  discard block
 block discarded – undo
811 811
         <div class="row column">
812 812
 
813 813
             <?php
814
-		$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
814
+		$hist = $Stats->getStatsSource(date('Y-m-d'), 'hist');
815 815
 		foreach ($hist as $hists) {
816 816
 			$hist_data = '';
817 817
 			$source = $hists['source_name'];
818 818
 			$hist_array = json_decode($hists['source_data']);
819
-			foreach($hist_array as $distance => $nb)
819
+			foreach ($hist_array as $distance => $nb)
820 820
 			{
821 821
 				$unit = 'km';
822 822
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -834,13 +834,13 @@  discard block
 block discarded – undo
834 834
 			$hist_data = substr($hist_data, 0, -1);
835 835
             ?>
836 836
             <div class="col-md-6">
837
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
837
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
838 838
                 <?php
839
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
839
+                  print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div>
840 840
                     <script> 
841 841
                         google.load("visualization", "1", {packages:["corechart"]});
842
-                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
843
-                      function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
842
+                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ', '_', strtolower($source)).');
843
+                      function drawCharthist_'.str_replace(' ', '_', strtolower($source)).'() {
844 844
                         var data = google.visualization.arrayToDataTable([
845 845
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
846 846
                             print $hist_data;
@@ -855,16 +855,16 @@  discard block
 block discarded – undo
855 855
                             colors: ["#1a3151"]
856 856
                         };
857 857
 
858
-                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ','_',strtolower($source)).'"));
858
+                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ', '_', strtolower($source)).'"));
859 859
                         chart.draw(data, options);
860 860
                       }
861 861
                       $(window).resize(function(){
862
-                              drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
862
+                              drawCharthist_'.str_replace(' ', '_', strtolower($source)).'();
863 863
                             });
864 864
                   </script>';
865 865
         	?>
866 866
     	    </div>
867
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
867
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
868 868
         	<?php
869 869
                   }
870 870
                 ?>
Please login to merge, or discard this patch.
Braces   +50 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 $Stats = new Stats();
7 7
 $title = _("Statistics");
8 8
 
9
-if (!isset($filter_name)) $filter_name = '';
9
+if (!isset($filter_name)) {
10
+	$filter_name = '';
11
+}
10 12
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 13
 if ($airline_icao == 'all') {
12 14
 	unset($_COOKIE['stats_airline_icao']);
@@ -15,8 +17,10 @@  discard block
 block discarded – undo
15 17
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
16 18
 	$airline_icao = $_COOKIE['stats_airline_icao'];
17 19
 } elseif ($airline_icao == '' && isset($globalFilter)) {
18
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
19
-}
20
+	if (isset($globalFilter['airline'])) {
21
+		$airline_icao = $globalFilter['airline'][0];
22
+	}
23
+	}
20 24
 setcookie('stats_airline_icao',$airline_icao);
21 25
 require_once('header.php');
22 26
 
@@ -36,7 +40,9 @@  discard block
 block discarded – undo
36 40
 	if (isset($last_update[0]['value'])) {
37 41
 		date_default_timezone_set('UTC');
38 42
 		$lastupdate = strtotime($last_update[0]['value']);
39
-		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
43
+		if (isset($globalTimezone) && $globalTimezone != '') {
44
+			date_default_timezone_set($globalTimezone);
45
+		}
40 46
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
41 47
 	}
42 48
     ?>
@@ -89,8 +95,9 @@  discard block
 block discarded – undo
89 95
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 96
                  <?php
91 97
                   $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
92
-		    if (count($aircraft_array) == 0) print _("No data available");
93
-		    else {
98
+		    if (count($aircraft_array) == 0) {
99
+		    	print _("No data available");
100
+		    } else {
94 101
 
95 102
                     print '<div id="chart1" class="chart" width="100%"></div>
96 103
                     <script> 
@@ -186,8 +193,9 @@  discard block
 block discarded – undo
186 193
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
187 194
 <?php
188 195
 	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
189
-	if (count($pilot_array) == 0) print _("No data available");
190
-	else {
196
+	if (count($pilot_array) == 0) {
197
+		print _("No data available");
198
+	} else {
191 199
 	    print '<div id="chart7" class="chart" width="100%"></div>
192 200
                     <script> 
193 201
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -232,8 +240,9 @@  discard block
 block discarded – undo
232 240
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
233 241
 <?php
234 242
 	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
235
-	if (count($owner_array) == 0) print _("No data available");
236
-	else {
243
+	if (count($owner_array) == 0) {
244
+		print _("No data available");
245
+	} else {
237 246
 	    print '<div id="chart7" class="chart" width="100%"></div>
238 247
                     <script> 
239 248
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -279,8 +288,9 @@  discard block
 block discarded – undo
279 288
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
280 289
 <?php
281 290
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
282
-	if (count($flightover_array) == 0) print _("No data available");
283
-	else {
291
+	if (count($flightover_array) == 0) {
292
+		print _("No data available");
293
+	} else {
284 294
 	    print '<div id="chart10" class="chart" width="100%"></div>
285 295
                     <script> 
286 296
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -424,8 +434,9 @@  discard block
 block discarded – undo
424 434
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
425 435
                 <?php
426 436
                   $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
427
-		    if (count($year_array) == 0) print _("No data available");
428
-		    else {
437
+		    if (count($year_array) == 0) {
438
+		    	print _("No data available");
439
+		    } else {
429 440
                   print '<div id="chart8" class="chart" width="100%"></div>
430 441
                     <script> 
431 442
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -470,8 +481,9 @@  discard block
 block discarded – undo
470 481
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
471 482
                 <?php
472 483
                   $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
473
-		    if (count($month_array) == 0) print _("No data available");
474
-		    else {
484
+		    if (count($month_array) == 0) {
485
+		    	print _("No data available");
486
+		    } else {
475 487
                   print '<div id="chart9" class="chart" width="100%"></div>
476 488
                     <script> 
477 489
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -516,8 +528,9 @@  discard block
 block discarded – undo
516 528
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
517 529
                 <?php
518 530
                     $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
519
-		    if (empty($date_array)) print _("No data available");
520
-		    else {
531
+		    if (empty($date_array)) {
532
+		    	print _("No data available");
533
+		    } else {
521 534
                   print '<div id="chart5" class="chart" width="100%"></div>
522 535
                     <script> 
523 536
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -563,8 +576,9 @@  discard block
 block discarded – undo
563 576
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
564 577
                 <?php
565 578
                   $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
566
-		    if (empty($hour_array)) print _("No data available");
567
-		    else {
579
+		    if (empty($hour_array)) {
580
+		    	print _("No data available");
581
+		    } else {
568 582
 
569 583
                   print '<div id="chart6" class="chart" width="100%"></div>
570 584
                     <script> 
@@ -616,8 +630,9 @@  discard block
 block discarded – undo
616 630
 		    require_once('require/class.Accident.php');
617 631
             	    $Accident = new Accident();
618 632
                   $year_array = $Accident->countFatalitiesByYear($filter_name);
619
-		    if (count($year_array) == 0) print _("No data available");
620
-		    else {
633
+		    if (count($year_array) == 0) {
634
+		    	print _("No data available");
635
+		    } else {
621 636
                   print '<div id="chart32" class="chart" width="100%"></div>
622 637
                     <script> 
623 638
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -665,8 +680,9 @@  discard block
 block discarded – undo
665 680
 		    require_once('require/class.Accident.php');
666 681
             	    $Accident = new Accident();
667 682
                   $year_array = $Accident->countFatalitiesLast12Months($filter_name);
668
-		    if (count($year_array) == 0) print _("No data available");
669
-		    else {
683
+		    if (count($year_array) == 0) {
684
+		    	print _("No data available");
685
+		    } else {
670 686
                   print '<div id="chart33" class="chart" width="100%"></div>
671 687
                     <script> 
672 688
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -737,8 +753,11 @@  discard block
 block discarded – undo
737 753
 					$distance = $distance;
738 754
 					$unit = 'km';
739 755
 				}
740
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
741
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
756
+        			if (!isset($polar_data)) {
757
+        				$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
758
+        			} else {
759
+        	    			$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
760
+        	    		}
742 761
         		    }
743 762
         	?>
744 763
             <div class="col-md-6">
@@ -785,8 +804,11 @@  discard block
 block discarded – undo
785 804
         		foreach ($msg as $eachmsg) {
786 805
         		    //$eachmsg = $msg[0];
787 806
         		    $data = $eachmsg['source_data'];
788
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
789
-        		    else $max = 500;
807
+        		    if ($data > 500) {
808
+        		    	$max = (round(($data+100)/100))*100;
809
+        		    } else {
810
+        		    	$max = 500;
811
+        		    }
790 812
         	?>
791 813
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
792 814
         	<script>
Please login to merge, or discard this patch.
table-output.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -390,17 +390,17 @@  discard block
 block discarded – undo
390 390
 				else {
391 391
 					$planespotter_url_array = explode("_", $spotter_item['image']);
392 392
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
393
-                                        $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
393
+										$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
394 394
 				}
395 395
 				if (isset($spotter_item['airline_name'])) {
396 396
 					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>';
397 397
 				} else {
398 398
 					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>';
399 399
 				}
400
-                        } else {
401
-                    		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
402
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
403
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
400
+						} else {
401
+							if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
402
+							$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
403
+							} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
404 404
 				if (isset($spotter_item['airline_name'])) {
405 405
 					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>';
406 406
 				} else {
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
 		}
416 416
 	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
417 417
 		if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
418
-		    $spotter_item['squawk'] = '-';
418
+			$spotter_item['squawk'] = '-';
419 419
 		}
420 420
 		if ($spotter_item['image_thumbnail'] != "")
421 421
 		{
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 				else {
427 427
 					$planespotter_url_array = explode("_", $spotter_array[0]['image']);
428 428
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
429
-                                        $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
429
+										$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
430 430
 				}
431 431
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
432 432
 					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>';
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
 					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>';
439 439
 				}
440 440
 			} else {
441
-                    		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
442
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
443
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
441
+							if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
442
+							$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
443
+							} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
444 444
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
445 445
 					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>';
446 446
 				} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 			print '</td>'."\n";
455 455
 		} else {
456 456
 			print '<td class="aircraft_thumbnail">'."\n";
457
-       //   	 	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>';
457
+	   //   	 	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>';
458 458
 	//}
459 459
 			if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) {
460 460
 				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";
@@ -559,13 +559,13 @@  discard block
 block discarded – undo
559 559
 				$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
560 560
 			} else $distance = '';
561 561
 			if ($distance != '') {
562
-			    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
563
-				    echo '<br/><i>'.round($distance*0.539957).' nm</i>';
564
-			    } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
565
-				    echo '<br/><i>'.round($distance*0.621371).' mi</i>';
566
-			    } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
567
-				    echo '<br/><i>'.$distance.' km</i>';
568
-			    }
562
+				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
563
+					echo '<br/><i>'.round($distance*0.539957).' nm</i>';
564
+				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
565
+					echo '<br/><i>'.round($distance*0.621371).' mi</i>';
566
+				} elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
567
+					echo '<br/><i>'.$distance.' km</i>';
568
+				}
569 569
 			}
570 570
 		}
571 571
 		print '</td>'."\n";
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 	}
95 95
 	print '<th class="more"></th>';
96 96
 	print '</thead>';
97
-} else if (strtolower($current_page) == "upcoming"){
97
+} else if (strtolower($current_page) == "upcoming") {
98 98
 	print '<thead>';
99 99
 	if ($_GET['sort'] == "airline_name_asc")
100 100
 	{
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 	*/
146 146
 	print '</thead>';
147
-} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){
147
+} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
148 148
 	print '<thead>';
149 149
 	print '<th class="aircraft_thumbnail"></th>';
150 150
 	print '<th class="logo">'._("Airline").'</th>';
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	print '</thead>';
182 182
 } else {
183 183
 
184
-	if ($hide_th_links === true){
184
+	if ($hide_th_links === true) {
185 185
 		print '<thead>';
186 186
 		print '<th class="aircraft_thumbnail"></th>';
187 187
 		if ($_GET['sort'] == "airline_name_asc")
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 }
363 363
 
364 364
 print '<tbody>'."\n";
365
-foreach($spotter_array as $spotter_item)
365
+foreach ($spotter_array as $spotter_item)
366 366
 {
367 367
 	if (isset($globalTimezone))
368 368
 	{
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
393 393
                                         $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
394 394
 				}
395 395
 				if (isset($spotter_item['airline_name'])) {
396
-					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>';
396
+					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>';
397 397
 				} else {
398
-					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>';
398
+					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>';
399 399
 				}
400 400
                         } else {
401 401
                     		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
402
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
402
+                    		$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
403 403
                     		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
404 404
 				if (isset($spotter_item['airline_name'])) {
405 405
 					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>';
@@ -413,7 +413,7 @@  discard block
 block discarded – undo
413 413
 			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";
414 414
 			print '</td>'."\n";
415 415
 		}
416
-	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
416
+	} elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") {
417 417
 		if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
418 418
 		    $spotter_item['squawk'] = '-';
419 419
 		}
@@ -429,17 +429,17 @@  discard block
 block discarded – undo
429 429
                                         $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
430 430
 				}
431 431
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
432
-					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>';
432
+					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>';
433 433
 				} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
434
-					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>';
434
+					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>';
435 435
 				} elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) {
436
-					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>';
436
+					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>';
437 437
 				} else {
438
-					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>';
438
+					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>';
439 439
 				}
440 440
 			} else {
441 441
                     		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
442
-                    		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
442
+                    		$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
443 443
                     		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
444 444
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
445 445
 					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>';
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	}
503 503
 	print '</td>'."\n";
504 504
 	// Aircraft type
505
-	if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){
505
+	if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") {
506 506
 		print '<td class="type">'."\n";
507 507
 		if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) {
508 508
 			print '<span class="nomobile">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</span>'."\n";
@@ -526,22 +526,22 @@  discard block
 block discarded – undo
526 526
 		}
527 527
 		if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
528 528
 			if ($spotter_item['departure_airport_time'] > 2460) {
529
-				$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
530
-			} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
529
+				$departure_airport_time = date('H:m', $spotter_item['departure_airport_time']);
530
+			} else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2);
531 531
 			if ($spotter_item['real_departure_airport_time'] > 2460) {
532
-				$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
532
+				$real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']);
533 533
 			} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
534 534
 			print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
535 535
 		} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
536 536
 			if ($spotter_item['real_departure_airport_time'] > 2460) {
537
-				$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
537
+				$real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']);
538 538
 			} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
539 539
 			print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
540 540
 		} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
541 541
 			if ($spotter_item['departure_airport_time'] > 2460) {
542
-				$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
542
+				$departure_airport_time = date('H:m', $spotter_item['departure_airport_time']);
543 543
 			} else {
544
-				$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
544
+				$departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2);
545 545
 			}
546 546
 			print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n";
547 547
 		}
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 					$latitude = $spotter_item['latitude'];
557 557
 					$longitude = $spotter_item['longitude'];
558 558
 				}
559
-				$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
559
+				$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude);
560 560
 			} else $distance = '';
561 561
 			if ($distance != '') {
562 562
 			    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -597,20 +597,20 @@  discard block
 block discarded – undo
597 597
 		}
598 598
 		if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
599 599
 			if ($spotter_item['arrival_airport_time'] > 2460) {
600
-				$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
600
+				$arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']);
601 601
 			} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
602 602
 			if ($spotter_item['real_arrival_airport_time'] > 2460) {
603
-				$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
603
+				$real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']);
604 604
 			} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
605 605
 			print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
606 606
 		} elseif (isset($spotter_item['real_arrival_airport_time'])) {
607 607
 			if ($spotter_item['real_arrival_airport_time'] > 2460) {
608
-				$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
608
+				$real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']);
609 609
 			} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
610 610
 			print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
611 611
 		} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
612 612
 			if ($spotter_item['arrival_airport_time'] > 2460) {
613
-				$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
613
+				$arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']);
614 614
 			} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
615 615
 			print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
616 616
 		}
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 					$latitude = $spotter_item['latitude'];
624 624
 					$longitude = $spotter_item['longitude'];
625 625
 				}
626
-				$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
626
+				$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude);
627 627
 			} else $distance = '';
628 628
 			if ($distance != '') {
629 629
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 		print '</td>'."\n";
639 639
 		if ((isset($globalIvAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalVAM) && $globalVAM) || (isset($globalphpVMS) && $globalphpVMS)) {
640 640
 			// Route stop
641
-			if(strtolower($current_page) != "upcoming"){
641
+			if (strtolower($current_page) != "upcoming") {
642 642
 				print '<td class="route_stop">'."\n";
643 643
 				if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') {
644 644
 					print '<span class="nomobile">-</span>'."\n";
@@ -663,21 +663,21 @@  discard block
 block discarded – undo
663 663
 			} else {
664 664
 				//if (!isset($globalUnitDistance) || $globalUnitDistance == 'km') {
665 665
 				if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
666
-					print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n";
667
-					print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n";
666
+					print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n";
667
+					print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n";
668 668
 				//} elseif ($globalUnitDistance == 'mi') {
669 669
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
670
-					print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n";
671
-					print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n";
670
+					print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n";
671
+					print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n";
672 672
 				//} elseif ($globalUnitDistance == 'nm') {
673 673
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
674
-					print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n";
675
-					print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n";
674
+					print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n";
675
+					print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n";
676 676
 				}
677 677
 			}
678 678
 			print '</td>'."\n";
679 679
 		}
680
-		if(strtolower($current_page) != "upcoming"){
680
+		if (strtolower($current_page) != "upcoming") {
681 681
 			if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
682 682
 				print '<td class="pilot">'."\n";
683 683
 				if ((!isset($spotter_item['pilot_id']) || $spotter_item['pilot_id'] == '') && (!isset($spotter_item['pilot_name']) || $spotter_item['pilot_name'] == '')) {
@@ -712,7 +712,7 @@  discard block
 block discarded – undo
712 712
 	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
713 713
 		if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') {
714 714
 			print '<td class="message"><p>'."\n";
715
-			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
715
+			print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
716 716
 			print '</p><p class="decode">';
717 717
 			$decode_array = json_decode($spotter_item['decode']);
718 718
 			foreach ($decode_array as $key => $value) {
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 			print '</td>'."\n";
723 723
 		} else {
724 724
 			print '<td class="message">'."\n";
725
-			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
725
+			print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
726 726
 			print '</td>'."\n";
727 727
 		}
728 728
 	}
@@ -747,7 +747,7 @@  discard block
 block discarded – undo
747 747
 		}
748 748
 		print '</td>'."\n";
749 749
 		print '<td class="message">'."\n";
750
-		print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
750
+		print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
751 751
 		print '</td>'."\n";
752 752
 	}
753 753
 	if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") {
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 		print '</td>'."\n";
774 774
 		*/
775 775
 		print '<td class="message">'."\n";
776
-		print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
776
+		print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
777 777
 		print '</td>'."\n";
778 778
 	}
779 779
 	// Date
Please login to merge, or discard this patch.
Braces   +45 added lines, -17 removed lines patch added patch discarded remove patch
@@ -367,7 +367,9 @@  discard block
 block discarded – undo
367 367
 	if (isset($globalTimezone))
368 368
 	{
369 369
 		date_default_timezone_set($globalTimezone);
370
-	} else date_default_timezone_set('UTC');
370
+	} else {
371
+		date_default_timezone_set('UTC');
372
+	}
371 373
 	if ($showSpecial === true)
372 374
 	{
373 375
 		print '<tr class="special">'."\n";
@@ -386,8 +388,9 @@  discard block
 block discarded – undo
386 388
 			print '<td class="aircraft_thumbnail">'."\n";
387 389
 			
388 390
 			if ($spotter_item['image_source'] == 'planespotters') {
389
-				if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
390
-				else {
391
+				if ($spotter_item['image_source_website'] != '') {
392
+					$image_src = $spotter_item['image_source_website'];
393
+				} else {
391 394
 					$planespotter_url_array = explode("_", $spotter_item['image']);
392 395
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
393 396
                                         $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -400,7 +403,9 @@  discard block
 block discarded – undo
400 403
                         } else {
401 404
                     		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
402 405
                     		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
403
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
406
+                    		} else {
407
+                    			$image_thumbnail = $spotter_item['image_thumbnail'];
408
+                    		}
404 409
 				if (isset($spotter_item['airline_name'])) {
405 410
 					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>';
406 411
 				} else {
@@ -422,8 +427,9 @@  discard block
 block discarded – undo
422 427
 			print '<td class="aircraft_thumbnail">'."\n";
423 428
 			//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>';
424 429
 			if ($spotter_item['image_source'] == 'planespotters') {
425
-				if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
426
-				else {
430
+				if ($spotter_item['image_source_website'] != '') {
431
+					$image_src = $spotter_item['image_source_website'];
432
+				} else {
427 433
 					$planespotter_url_array = explode("_", $spotter_array[0]['image']);
428 434
 					$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
429 435
                                         $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -440,7 +446,9 @@  discard block
 block discarded – undo
440 446
 			} else {
441 447
                     		if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
442 448
                     		$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
443
-                    		} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
449
+                    		} else {
450
+                    			$image_thumbnail = $spotter_item['image_thumbnail'];
451
+                    		}
444 452
 				if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
445 453
 					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>';
446 454
 				} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -527,15 +535,21 @@  discard block
 block discarded – undo
527 535
 		if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
528 536
 			if ($spotter_item['departure_airport_time'] > 2460) {
529 537
 				$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
530
-			} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
538
+			} else {
539
+				$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
540
+			}
531 541
 			if ($spotter_item['real_departure_airport_time'] > 2460) {
532 542
 				$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
533
-			} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
543
+			} else {
544
+				$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
545
+			}
534 546
 			print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
535 547
 		} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
536 548
 			if ($spotter_item['real_departure_airport_time'] > 2460) {
537 549
 				$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
538
-			} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
550
+			} else {
551
+				$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
552
+			}
539 553
 			print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
540 554
 		} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
541 555
 			if ($spotter_item['departure_airport_time'] > 2460) {
@@ -557,7 +571,9 @@  discard block
 block discarded – undo
557 571
 					$longitude = $spotter_item['longitude'];
558 572
 				}
559 573
 				$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
560
-			} else $distance = '';
574
+			} else {
575
+				$distance = '';
576
+			}
561 577
 			if ($distance != '') {
562 578
 			    if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
563 579
 				    echo '<br/><i>'.round($distance*0.539957).' nm</i>';
@@ -582,7 +598,9 @@  discard block
 block discarded – undo
582 598
 		} else {
583 599
 			if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) {
584 600
 				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";
585
-				if (!isset($Spotter)) $Spotter = new Spotter();
601
+				if (!isset($Spotter)) {
602
+					$Spotter = new Spotter();
603
+				}
586 604
 				$arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']);
587 605
 				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";
588 606
 				print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n";
@@ -598,20 +616,28 @@  discard block
 block discarded – undo
598 616
 		if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
599 617
 			if ($spotter_item['arrival_airport_time'] > 2460) {
600 618
 				$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
601
-			} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
619
+			} else {
620
+				$arrival_airport_time = $spotter_item['arrival_airport_time'];
621
+			}
602 622
 			if ($spotter_item['real_arrival_airport_time'] > 2460) {
603 623
 				$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
604
-			} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
624
+			} else {
625
+				$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
626
+			}
605 627
 			print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
606 628
 		} elseif (isset($spotter_item['real_arrival_airport_time'])) {
607 629
 			if ($spotter_item['real_arrival_airport_time'] > 2460) {
608 630
 				$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
609
-			} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
631
+			} else {
632
+				$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
633
+			}
610 634
 			print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
611 635
 		} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
612 636
 			if ($spotter_item['arrival_airport_time'] > 2460) {
613 637
 				$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
614
-			} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
638
+			} else {
639
+				$arrival_airport_time = $spotter_item['arrival_airport_time'];
640
+			}
615 641
 			print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
616 642
 		}
617 643
 		if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
@@ -624,7 +650,9 @@  discard block
 block discarded – undo
624 650
 					$longitude = $spotter_item['longitude'];
625 651
 				}
626 652
 				$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
627
-			} else $distance = '';
653
+			} else {
654
+				$distance = '';
655
+			}
628 656
 			if ($distance != '') {
629 657
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
630 658
 					echo '<br/><i>'.round($distance*0.539957).' nm</i>';
Please login to merge, or discard this patch.