Completed
Push — master ( a80977...554d4d )
by Yannick
61:39 queued 35:08
created
search-yaml.php 2 patches
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7 7
 	//for the date manipulation into the query
8
-	if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
8
+	if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
9 9
 		$start_date = $_GET['start_date'].":00";
10 10
 		$end_date = $_GET['end_date'].":00";
11 11
 		$sql_date = $start_date.",".$end_date;
12
-	} else if($_GET['start_date'] != ""){
12
+	} else if ($_GET['start_date'] != "") {
13 13
 		$start_date = $_GET['start_date'].":00";
14 14
 		$sql_date = $start_date;
15
-	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
15
+	} else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18 18
 	} else $sql_date = '';
@@ -20,37 +20,37 @@  discard block
 block discarded – undo
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22 22
 	//for altitude manipulation
23
-	if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
25
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT);
23
+	if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") {
24
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
25
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT);
26 26
 		$sql_altitude = $start_altitude.",".$end_altitude;
27
-	} else if($_GET['highest_altitude'] != ""){
28
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
27
+	} else if ($_GET['highest_altitude'] != "") {
28
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
29 29
 		$sql_altitude = $end_altitude;
30
-	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
30
+	} else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") {
31
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000";
32 32
 		$sql_altitude = $start_altitude;
33 33
 	} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37
-if(!isset($_GET['limit'])) {
37
+if (!isset($_GET['limit'])) {
38 38
 	if (!isset($_GET['number_results'])) {
39 39
 		$limit_start = 0;
40 40
 		$limit_end = 25;
41 41
 		$absolute_difference = 25;
42 42
 	} else {
43
-		if ($_GET['number_results'] > 1000){
43
+		if ($_GET['number_results'] > 1000) {
44 44
 			$_GET['number_results'] = 1000;
45 45
 		}
46 46
 		$limit_start = 0;
47
-		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
48
-		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
47
+		$limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
48
+		$absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
49 49
 	}
50
-}  else {
50
+} else {
51 51
 	$limit_explode = explode(",", $_GET['limit']);
52
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
53
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
52
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
53
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
54 54
 }
55 55
 
56 56
 $absolute_difference = abs($limit_start - $limit_end);
@@ -67,27 +67,27 @@  discard block
 block discarded – undo
67 67
 
68 68
 if (isset($_GET['sort'])) $sort = $_GET['sort'];
69 69
 else $sort = '';
70
-$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
71
-$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
72
-$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
73
-$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING);
74
-$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING);
75
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
76
-$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING);
77
-$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING);
78
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
79
-$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING);
80
-$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING);
81
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
82
-$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING);
83
-$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING);
84
-$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING);
85
-$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING);
86
-$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'');
70
+$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
71
+$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING);
72
+$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING);
73
+$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING);
74
+$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING);
75
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
76
+$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING);
77
+$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING);
78
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
79
+$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING);
80
+$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING);
81
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
82
+$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING);
83
+$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING);
84
+$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING);
85
+$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING);
86
+$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '');
87 87
 
88 88
 $output = "-flights:\n";
89 89
 if (!empty($spotter_array)) {
90
-	foreach($spotter_array as $spotter_item) {
90
+	foreach ($spotter_array as $spotter_item) {
91 91
 		$output .= ' - id: '.$spotter_item['spotter_id'];
92 92
 		$output .= "\n";
93 93
 		$output .= ' - ident: '.$spotter_item['ident'];
Please login to merge, or discard this patch.
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit'])) {
@@ -47,7 +55,7 @@  discard block
 block discarded – undo
47 55
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
48 56
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 	}
50
-}  else {
58
+} else {
51 59
 	$limit_explode = explode(",", $_GET['limit']);
52 60
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
53 61
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -65,8 +73,11 @@  discard block
 block discarded – undo
65 73
 
66 74
 header("Content-type: text/yaml");
67 75
 
68
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
69
-else $sort = '';
76
+if (isset($_GET['sort'])) {
77
+	$sort = $_GET['sort'];
78
+} else {
79
+	$sort = '';
80
+}
70 81
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
71 82
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
72 83
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
search-csv.php 2 patches
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@  discard block
 block discarded – undo
6 6
 
7 7
 if (isset($_GET['start_date'])) {
8 8
 	//for the date manipulation into the query
9
-	if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
+	if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
10 10
 		$start_date = $_GET['start_date'].":00";
11 11
 		$end_date = $_GET['end_date'].":00";
12 12
 		$sql_date = $start_date.",".$end_date;
13
-	} else if($_GET['start_date'] != ""){
13
+	} else if ($_GET['start_date'] != "") {
14 14
 		$start_date = $_GET['start_date'].":00";
15 15
 		$sql_date = $start_date;
16
-	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
+	} else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
17 17
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
18 18
 		$sql_date = $end_date;
19 19
 	} else $sql_date = '';
@@ -21,38 +21,38 @@  discard block
 block discarded – undo
21 21
 
22 22
 if (isset($_GET['highest_altitude'])) {
23 23
 	//for altitude manipulation
24
-	if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
+	if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") {
25 25
 		$end_altitude = $_GET['highest_altitude'];
26 26
 		$start_altitude = $_GET['lowest_altitude'];
27 27
 		$sql_altitude = $start_altitude.",".$end_altitude;
28
-	} else if($_GET['highest_altitude'] != ""){
28
+	} else if ($_GET['highest_altitude'] != "") {
29 29
 		$end_altitude = $_GET['highest_altitude'];
30 30
 		$sql_altitude = $end_altitude;
31
-	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
+	} else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") {
32 32
 		$start_altitude = $_GET['lowest_altitude'].",60000";
33 33
 		$sql_altitude = $start_altitude;
34 34
 	} else $sql_altitude = '';
35 35
 } else $sql_altitude = '';
36 36
 
37 37
 //calculuation for the pagination
38
-if(!isset($_GET['limit']))
38
+if (!isset($_GET['limit']))
39 39
 {
40 40
 	if (!isset($_GET['number_results'])) {
41 41
 		$limit_start = 0;
42 42
 		$limit_end = 25;
43 43
 		$absolute_difference = 25;
44 44
 	} else {
45
-		if ($_GET['number_results'] > 1000){
45
+		if ($_GET['number_results'] > 1000) {
46 46
 			$_GET['number_results'] = 1000;
47 47
 		}
48 48
 		$limit_start = 0;
49
-		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50
-		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49
+		$limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
50
+		$absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
51 51
 	}
52
-}  else {
52
+} else {
53 53
 	$limit_explode = explode(",", $_GET['limit']);
54
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
55
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
54
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
55
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
56 56
 }
57 57
 $absolute_difference = abs($limit_start - $limit_end);
58 58
 $limit_next = $limit_end + $absolute_difference;
@@ -69,29 +69,29 @@  discard block
 block discarded – undo
69 69
 if (isset($_GET['sort'])) $sort = $_GET['sort'];
70 70
 else $sort = '';
71 71
 
72
-$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73
-$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
74
-$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
75
-$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING);
76
-$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING);
77
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
78
-$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING);
79
-$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING);
80
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
81
-$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING);
82
-$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING);
83
-$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING);
84
-$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING);
85
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
86
-$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING);
87
-$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING);
88
-$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'');
72
+$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
73
+$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING);
74
+$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING);
75
+$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING);
76
+$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING);
77
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
78
+$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING);
79
+$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING);
80
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
81
+$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING);
82
+$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING);
83
+$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING);
84
+$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING);
85
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
86
+$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING);
87
+$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING);
88
+$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '');
89 89
  
90 90
       
91 91
 $output = "id,ident,registration,aircraft_icao,aircraft_name,aircraft_manufacturer,airline,airline_icao,airline_iata,airline_country,airline_callsign,airline_type,departure_airport_city,departure_airport_country,departure_airport_iata,departure_airport_icao,departure_airport_latitude,departure_airport_longitude,departure_airport_altitude,arrival_airport_city,arrival_airport_country,arrival_airport_iata,arrival_airport_icao,arrival_airport_latitude,arrival_airport_longitude,arrival_airport_altitude,latitude,longitude,altitude,ground_speed,heading,heading_name,waypoints,date\n";
92 92
 
93 93
 if (!empty($spotter_array)) {
94
-	foreach($spotter_array as $spotter_item) {
94
+	foreach ($spotter_array as $spotter_item) {
95 95
 		$output .= $spotter_item['spotter_id'].',';
96 96
 		$output .= $spotter_item['ident'].',';
97 97
 		$output .= $spotter_item['registration'].',';
Please login to merge, or discard this patch.
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,8 +16,12 @@  discard block
 block discarded – undo
16 16
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
17 17
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
18 18
 		$sql_date = $end_date;
19
-	} else $sql_date = '';
20
-} else $sql_date = '';
19
+	} else {
20
+		$sql_date = '';
21
+	}
22
+	} else {
23
+	$sql_date = '';
24
+}
21 25
 
22 26
 if (isset($_GET['highest_altitude'])) {
23 27
 	//for altitude manipulation
@@ -31,8 +35,12 @@  discard block
 block discarded – undo
31 35
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
32 36
 		$start_altitude = $_GET['lowest_altitude'].",60000";
33 37
 		$sql_altitude = $start_altitude;
34
-	} else $sql_altitude = '';
35
-} else $sql_altitude = '';
38
+	} else {
39
+		$sql_altitude = '';
40
+	}
41
+	} else {
42
+	$sql_altitude = '';
43
+}
36 44
 
37 45
 //calculuation for the pagination
38 46
 if(!isset($_GET['limit']))
@@ -49,7 +57,7 @@  discard block
 block discarded – undo
49 57
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
51 59
 	}
52
-}  else {
60
+} else {
53 61
 	$limit_explode = explode(",", $_GET['limit']);
54 62
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
55 63
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -66,8 +74,11 @@  discard block
 block discarded – undo
66 74
 
67 75
 header("Content-type: text/csv");
68 76
 
69
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
70
-else $sort = '';
77
+if (isset($_GET['sort'])) {
78
+	$sort = $_GET['sort'];
79
+} else {
80
+	$sort = '';
81
+}
71 82
 
72 83
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73 84
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
ident-statistics-airline.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
 	die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
-$spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
12
+$spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", $sort);
13 13
 
14 14
 if (!empty($spotter_array))
15 15
 {
16
-	$title = sprintf(_("Most Common Airlines of %s"),$spotter_array[0]['ident']);
16
+	$title = sprintf(_("Most Common Airlines of %s"), $spotter_array[0]['ident']);
17 17
 	require_once('header.php');
18 18
 	print '<div class="info column">';
19 19
 	print '<h1>'.$spotter_array[0]['ident'].'</h1>';
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	include('ident-sub-menu.php');
25 25
 	print '<div class="column">';
26 26
 	print '<h2>'._("Most Common Airlines").'</h2>';
27
-	print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights using the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
27
+	print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights using the ident/callsign <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>';
28 28
 
29 29
 	$airline_array = $Spotter->countAllAirlinesByIdent($ident);
30 30
 	if (!empty($airline_array))
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 		print '</thead>';
42 42
 		print '<tbody>';
43 43
 		$i = 1;
44
-		foreach($airline_array as $airline_item)
44
+		foreach ($airline_array as $airline_item)
45 45
 		{
46 46
 			print '<tr>';
47 47
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
highlights-display.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 require_once('header.php');
8 8
 
9 9
 //calculuation for the pagination
10
-if(!isset($_GET['limit']))
10
+if (!isset($_GET['limit']))
11 11
 {
12 12
 	$limit_start = 0;
13 13
 	$limit_end = 28;
14 14
 	$absolute_difference = 28;
15 15
 } else {
16 16
 	$limit_explode = explode(",", $_GET['limit']);
17
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
18
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
17
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
18
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
19 19
 	if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) {
20 20
 		$limit_start = 0;
21 21
 		$limit_end = 25;
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 print '<div class="column">';	
40 40
 print '<p>'._("The view below shows all aircrafts that have been selected to have some sort of special characteristic about them, such as unique liveries, destinations etc.").'</p>';
41 41
 
42
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
42
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
43 43
 if ($sort != '') {
44 44
 	$spotter_array = $Spotter->getSpotterDataByHighlight($limit_start.",".$absolute_difference, $sort);
45 45
 } else {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 if (!empty($spotter_array))
49 49
 {
50 50
 	print '<div class="dispay-view">';
51
-	foreach($spotter_array as $spotter_item)
51
+	foreach ($spotter_array as $spotter_item)
52 52
 	{
53 53
 		if (isset($spotter_item['image']) && $spotter_item['image'] != "")
54 54
 		{
Please login to merge, or discard this patch.
country-statistics-manufacturer.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
 	die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$country = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)));
11
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
10
+$country = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)));
11
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
12 12
 if (isset($_GET['sort'])) {
13 13
 	$spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort);
14 14
 } else {
@@ -17,16 +17,16 @@  discard block
 block discarded – undo
17 17
 
18 18
 if (!empty($spotter_array))
19 19
 {
20
-	$title = sprintf(_("Most Common Aircraft Manufacturer from %s"),$country);
20
+	$title = sprintf(_("Most Common Aircraft Manufacturer from %s"), $country);
21 21
 	require_once('header.php');
22 22
 	print '<div class="select-item">';
23 23
 	print '<form action="'.$globalURL.'/country" method="post">';
24 24
 	print '<select name="country" class="selectpicker" data-live-search="true">';
25 25
 	print '<option></option>';
26 26
 	$all_countries = $Spotter->getAllCountries();
27
-	foreach($all_countries as $all_country)
27
+	foreach ($all_countries as $all_country)
28 28
 	{
29
-		if($country == $all_country['country'])
29
+		if ($country == $all_country['country'])
30 30
 		{
31 31
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>';
32 32
 		} else {
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	if ($_GET['country'] != "NA")
42 42
 	{
43 43
 		print '<div class="info column">';
44
-		print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"),$country).'</h1>';
44
+		print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"), $country).'</h1>';
45 45
 		print '</div>';
46 46
 	} else {
47 47
 		print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>';
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	include('country-sub-menu.php');
51 51
 	print '<div class="column">';
52 52
 	print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>';
53
-	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of airlines or departure/arrival airports from <strong>%s</strong>."),$country).'</p>';
53
+	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of airlines or departure/arrival airports from <strong>%s</strong>."), $country).'</p>';
54 54
 	$manufacturers_array = $Spotter->countAllAircraftManufacturerByCountry($country);
55 55
 	if (!empty($manufacturers_array))
56 56
 	{
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		print '</thead>';
64 64
 		print '<tbody>';
65 65
 		$i = 1;
66
-		foreach($manufacturers_array as $manufacturer_item)
66
+		foreach ($manufacturers_array as $manufacturer_item)
67 67
 		{
68 68
 			print '<tr>';
69 69
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
statistics.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 ?>
250 250
                 <div class="more">
251 251
             	    <?php
252
-            	    /*
252
+					/*
253 253
             		if ($year != '' && $month != '') {
254 254
             	    ?>
255 255
             	    <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
             	    <?php
261 261
             		}
262 262
             		*/
263
-            	    ?>
263
+					?>
264 264
                 </div>
265 265
             </div>
266 266
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 ?>
295 295
                 <div class="more">
296 296
             	    <?php
297
-            	    /*
297
+					/*
298 298
             		if ($year != '' && $month != '') {
299 299
             	    ?>
300 300
             	    <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
             	    <?php
306 306
             		}
307 307
             		*/
308
-            	    ?>
308
+					?>
309 309
                 </div>
310 310
             </div>
311 311
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
Please login to merge, or discard this patch.
Spacing   +148 added lines, -148 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 }
24 24
 
25 25
 if (!isset($filter_name)) $filter_name = '';
26
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
26
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
27 27
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
28 28
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
29 29
 }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
33 33
 	if (isset($airline_info[0]['name'])) {
34 34
 		$airline_name = $airline_info[0]['name'];
35
-	} elseif (strpos($airline_icao,'alliance_') !== FALSE) {
35
+	} elseif (strpos($airline_icao, 'alliance_') !== FALSE) {
36 36
 		$alliance_name = $airline_icao;
37 37
 	}
38 38
 }
@@ -42,8 +42,8 @@  discard block
 block discarded – undo
42 42
 	$title = _("Statistics");
43 43
 }
44 44
 
45
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
45
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
46
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
47 47
 
48 48
 require_once('header.php');
49 49
 
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		date_default_timezone_set('UTC');
71 71
 		$lastupdate = strtotime($last_update[0]['value']);
72 72
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
73
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
73
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
74 74
 	}
75 75
 }
76 76
 ?>
@@ -82,31 +82,31 @@  discard block
 block discarded – undo
82 82
 <?php
83 83
 if ($type == 'aircraft') {
84 84
 ?>
85
-        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span>
86
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
87
-        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
88
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
85
+        <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span>
86
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
87
+        <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
88
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
89 89
 <?php
90 90
 	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
91 91
 ?>
92
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
93
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
92
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span>
93
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
94 94
 <?php
95 95
 	}
96 96
 	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
97 97
 ?>
98
-    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
99
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
98
+    	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span>
99
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
100 100
 <?php
101 101
 	}
102 102
 ?>
103
-        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
104
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
103
+        <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
104
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
105 105
 <?php
106 106
 	if ($airline_icao == '') {
107 107
 ?>
108
-        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
109
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
108
+        <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span>
109
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
110 110
 <?php
111 111
 	}
112 112
 ?>
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
 	if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) {
115 115
 		if ($airline_icao == '' || $airline_icao == 'all') {
116 116
 ?>
117
-        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span>
118
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
117
+        <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span>
118
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
119 119
 <?php
120 120
 		}
121 121
 	}
@@ -123,22 +123,22 @@  discard block
 block discarded – undo
123 123
 <?php
124 124
 } elseif ($type == 'marine') {
125 125
 ?>
126
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span>
127
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
128
-	<span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span>
129
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
126
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span>
127
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
128
+	<span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span>
129
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
130 130
 <?php
131 131
 } elseif ($type == 'tracker') {
132 132
 ?>
133
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span>
134
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
135
-	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span>
136
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
133
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span>
134
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
135
+	<span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span>
136
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
137 137
 <?php
138 138
 }
139 139
 ?>
140 140
     </p>
141
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
141
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
142 142
     <div class="specific-stats">
143 143
 <?php
144 144
 if ($type == 'aircraft') {
@@ -147,13 +147,13 @@  discard block
 block discarded – undo
147 147
             <div class="col-md-6">
148 148
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
149 149
 <?php
150
-	$aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
150
+	$aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month);
151 151
 	if (count($aircraft_array) == 0) {
152 152
 		print _("No data available");
153 153
 	} else {
154 154
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
155 155
 		$aircraft_data = '';
156
-		foreach($aircraft_array as $aircraft_item) {
156
+		foreach ($aircraft_array as $aircraft_item) {
157 157
 			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
158 158
 			else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
159 159
 		}
@@ -182,16 +182,16 @@  discard block
 block discarded – undo
182 182
 ?>
183 183
                 </div>
184 184
             </div>
185
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
185
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
186 186
 <?php
187 187
 	if ($airline_icao == '' || $airline_icao == 'all') {
188
-		$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
188
+		$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month);
189 189
 		if (count($airline_array) > 0) {
190 190
 			print '<div class="col-md-6">';
191 191
 			print '<h2>'._("Top 10 Most Common Airline").'</h2>';
192 192
 			print '<div id="chart2" class="chart" width="100%"></div><script>';
193 193
 			$airline_data = '';
194
-			foreach($airline_array as $airline_item) {
194
+			foreach ($airline_array as $airline_item) {
195 195
 				$airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
196 196
 			}
197 197
 			$airline_data = substr($airline_data, 0, -1);
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 		}
217 217
 ?>
218 218
         </div>
219
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
219
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
220 220
 <?php
221 221
 	}
222 222
 }
@@ -228,12 +228,12 @@  discard block
 block discarded – undo
228 228
             <div class="col-md-6">
229 229
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
230 230
 <?php
231
-	$marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month);
231
+	$marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month);
232 232
 	if (count($marine_array) == 0) print _("No data available");
233 233
 	else {
234 234
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
235 235
 		$marine_data = '';
236
-		foreach($marine_array as $marine_item) {
236
+		foreach ($marine_array as $marine_item) {
237 237
 			$marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
238 238
 		}
239 239
 		$marine_data = substr($marine_data, 0, -1);
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             	    ?>
264 264
                 </div>
265 265
             </div>
266
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
266
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
267 267
 <!--	</div>-->
268 268
 <?php
269 269
 }
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
             <div class="col-md-6">
274 274
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
275 275
 <?php
276
-	$tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
276
+	$tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month);
277 277
 	if (count($tracker_array) == 0) print _("No data available");
278 278
 	else {
279 279
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
280 280
 		$tracker_data = '';
281
-		foreach($tracker_array as $tracker_item) {
281
+		foreach ($tracker_array as $tracker_item) {
282 282
 			$tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],';
283 283
 		}
284 284
 		$tracker_data = substr($tracker_data, 0, -1);
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
             	    ?>
309 309
                 </div>
310 310
             </div>
311
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
311
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
312 312
 <!--	</div>-->
313 313
 <?php
314 314
 }
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		else {
324 324
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
325 325
 			$owner_data = '';
326
-			foreach($owner_array as $owner_item) {
326
+			foreach ($owner_array as $owner_item) {
327 327
 				$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
328 328
 			}
329 329
 			$owner_data = substr($owner_data, 0, -1);
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
                 </div>
344 344
                 -->
345 345
             </div>
346
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
346
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
347 347
             <div class="col-md-6">
348 348
                 <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2>
349 349
 <?php
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 		else {
353 353
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
354 354
 			$owner_data = '';
355
-			foreach($countries_array as $owner_item) {
355
+			foreach ($countries_array as $owner_item) {
356 356
 				$owner_data .= '["'.$owner_item['country_name'].'",'.$owner_item['country_count'].'],';
357 357
 			}
358 358
 			$owner_data = substr($owner_data, 0, -1);
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                 -->
374 374
             </div>
375 375
             
376
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
376
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
377 377
 ²	</div>
378 378
         <div class="row column">
379 379
             <div class="col-md-6">
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 		else {
385 385
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
386 386
 			$launch_site_data = '';
387
-			foreach($launch_site_array as $launch_site_item) {
387
+			foreach ($launch_site_array as $launch_site_item) {
388 388
 				$launch_site_data .= '["'.$launch_site_item['launch_site'].'",'.$launch_site_item['launch_site_count'].'],';
389 389
 			}
390 390
 			$launch_site_data = substr($launch_site_data, 0, -1);
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
 ?>
412 412
         <div class="row column">
413 413
 <?php
414
-	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month);
414
+	$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month);
415 415
 	//if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
416 416
 	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
417 417
 		if (empty($flightover_array)) {
@@ -422,12 +422,12 @@  discard block
 block discarded – undo
422 422
 ?>
423 423
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
424 424
 <?php
425
-		$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
425
+		$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month);
426 426
 		if (count($pilot_array) == 0) print _("No data available");
427 427
 		else {
428 428
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
429 429
 			$pilot_data = '';
430
-			foreach($pilot_array as $pilot_item) {
430
+			foreach ($pilot_array as $pilot_item) {
431 431
 				$pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
432 432
 			}
433 433
 			$pilot_data = substr($pilot_data, 0, -1);
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 ?>
449 449
             </div>
450 450
 
451
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
451
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
452 452
 <?php
453 453
 	}
454 454
 	// else {
@@ -457,12 +457,12 @@  discard block
 block discarded – undo
457 457
             <div class="col-md-6">
458 458
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
459 459
 <?php
460
-		$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
460
+		$owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month);
461 461
 		if (count($owner_array) == 0) print _("No data available");
462 462
 		else {
463 463
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
464 464
 			$owner_data = '';
465
-			foreach($owner_array as $owner_item) {
465
+			foreach ($owner_array as $owner_item) {
466 466
 				$owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
467 467
 			}
468 468
 			$owner_data = substr($owner_data, 0, -1);
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                 </div>
482 482
             </div>
483 483
         
484
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
484
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
485 485
 <?php
486 486
 	}
487 487
 	if (!empty($flightover_array)) {
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
496 496
 			print 'var series = [';
497 497
 			$flightover_data = '';
498
-			foreach($flightover_array as $flightover_item) {
498
+			foreach ($flightover_array as $flightover_item) {
499 499
 				$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
500 500
 			}
501 501
 			$flightover_data = substr($flightover_data, 0, -1);
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 	}
541 541
 ?>
542 542
         </div>
543
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
543
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
544 544
         </div>
545 545
 <?php
546 546
 }
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
557 557
 		print 'var series = [';
558 558
 		$flightover_data = '';
559
-		foreach($flightover_array as $flightover_item) {
559
+		foreach ($flightover_array as $flightover_item) {
560 560
 			$flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
561 561
 		}
562 562
 		$flightover_data = substr($flightover_data, 0, -1);
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
614 614
 		print 'var series = [';
615 615
 		$flightover_data = '';
616
-		foreach($flightover_array as $flightover_item) {
616
+		foreach ($flightover_array as $flightover_item) {
617 617
 			$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
618 618
 		}
619 619
 		$flightover_data = substr($flightover_data, 0, -1);
@@ -663,14 +663,14 @@  discard block
 block discarded – undo
663 663
         <div class="row column">
664 664
             <div class="col-md-6">
665 665
 <?php
666
-	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
666
+	$airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month);
667 667
 	if (count($airport_airport_array) > 0) {
668 668
 		print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
669 669
 		print '<div id="chart3" class="chart" width="100%"></div><script>';
670 670
 		print "\n";
671 671
 		print 'var series = [';
672 672
 		$airport_data = '';
673
-		foreach($airport_airport_array as $airport_item) {
673
+		foreach ($airport_airport_array as $airport_item) {
674 674
 			$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
675 675
 		}
676 676
 		$airport_data = substr($airport_data, 0, -1);
@@ -720,18 +720,18 @@  discard block
 block discarded – undo
720 720
 	}
721 721
 ?>
722 722
             </div>
723
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
723
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
724 724
 
725 725
             <div class="col-md-6">
726 726
 <?php
727
-	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
727
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month);
728 728
 	if (count($airport_airport_array2) > 0) {
729 729
 		print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
730 730
 		print '<div id="chart4" class="chart" width="100%"></div><script>';
731 731
 		print "\n";
732 732
 		print 'var series = [';
733 733
 		$airport_data = '';
734
-		foreach($airport_airport_array2 as $airport_item)
734
+		foreach ($airport_airport_array2 as $airport_item)
735 735
 		{
736 736
 			$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
737 737
 		}
@@ -783,7 +783,7 @@  discard block
 block discarded – undo
783 783
 ?>
784 784
             </div>
785 785
         </div>
786
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
786
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
787 787
 <?php 
788 788
 }
789 789
 if ($type == 'aircraft') {
@@ -795,18 +795,18 @@  discard block
 block discarded – undo
795 795
             <div class="col-md-6">
796 796
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
797 797
 <?php
798
-		$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
798
+		$year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
799 799
 		if (count($year_array) == 0) print _("No data available");
800 800
 		else {
801 801
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
802 802
 			$year_data = '';
803 803
 			$year_cnt = '';
804
-			foreach($year_array as $year_item) {
804
+			foreach ($year_array as $year_item) {
805 805
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
806 806
 				$year_cnt .= $year_item['date_count'].',';
807 807
 			}
808 808
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
809
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
809
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
810 810
 			print 'c3.generate({
811 811
 			    bindto: "#chart8",
812 812
 			    data: { x: "x",
@@ -819,22 +819,22 @@  discard block
 block discarded – undo
819 819
                     <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
820 820
                 </div>
821 821
             </div>
822
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
822
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
823 823
             <div class="col-md-6">
824 824
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
825 825
 <?php
826
-		$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
826
+		$month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
827 827
 		if (count($month_array) == 0) print _("No data available");
828 828
 		else {
829 829
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
830 830
 			$month_data = '';
831 831
 			$month_cnt = '';
832
-			foreach($month_array as $month_item) {
832
+			foreach ($month_array as $month_item) {
833 833
 				$month_data .= '"'.$month_item['date_name'].'",';
834 834
 				$month_cnt .= $month_item['date_count'].',';
835 835
 			}
836 836
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
837
-			$month_cnt = "['flights',".substr($month_cnt,0,-1)."]";
837
+			$month_cnt = "['flights',".substr($month_cnt, 0, -1)."]";
838 838
 			print 'c3.generate({
839 839
 			    bindto: "#chart9",
840 840
 			    data: { x: "x",
@@ -847,23 +847,23 @@  discard block
 block discarded – undo
847 847
                     <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
848 848
                 </div>
849 849
             </div>
850
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
850
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
851 851
 
852 852
             <div class="col-md-6">
853 853
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
854 854
 <?php
855
-		$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
855
+		$date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
856 856
 		if (empty($date_array)) print _("No data available");
857 857
 		else {
858 858
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
859 859
 			$date_data = '';
860 860
 			$date_cnt = '';
861
-			foreach($date_array as $date_item) {
861
+			foreach ($date_array as $date_item) {
862 862
 				$date_data .= '"'.$date_item['date_name'].'",';
863 863
 				$date_cnt .= $date_item['date_count'].',';
864 864
 			}
865 865
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
866
-			$date_cnt = "['flights',".substr($date_cnt,0,-1)."]";
866
+			$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]";
867 867
 			print 'c3.generate({
868 868
 			    bindto: "#chart5",
869 869
 			    data: { x: "x",
@@ -876,22 +876,22 @@  discard block
 block discarded – undo
876 876
                     <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
877 877
                 </div>
878 878
             </div>
879
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
879
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
880 880
             <div class="col-md-6">
881 881
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
882 882
 <?php
883
-		$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
883
+		$hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
884 884
 		if (empty($hour_array)) print _("No data available");
885 885
 		else {
886 886
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
887 887
 			$hour_data = '';
888 888
 			$hour_cnt = '';
889
-			foreach($hour_array as $hour_item) {
889
+			foreach ($hour_array as $hour_item) {
890 890
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
891 891
 				$hour_cnt .= $hour_item['hour_count'].',';
892 892
 			}
893 893
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
894
-			$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
894
+			$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
895 895
 			print 'c3.generate({
896 896
 			    bindto: "#chart6",
897 897
 			    data: {
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
                     <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
905 905
                 </div>
906 906
             </div>
907
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
907
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
908 908
         </div>
909 909
 <?php
910 910
 	}
@@ -920,18 +920,18 @@  discard block
 block discarded – undo
920 920
             <div class="col-md-6">
921 921
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
922 922
 <?php
923
-		$year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name);
923
+		$year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name);
924 924
 		if (count($year_array) == 0) print _("No data available");
925 925
 		else {
926 926
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
927 927
 			$year_data = '';
928 928
 			$year_cnt = '';
929
-			foreach($year_array as $year_item) {
929
+			foreach ($year_array as $year_item) {
930 930
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
931 931
 				$year_cnt .= $year_item['date_count'].',';
932 932
 			}
933 933
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
934
-			$year_cnt = "['vessels',".substr($year_cnt,0,-1)."]";
934
+			$year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]";
935 935
 			print 'c3.generate({
936 936
 			    bindto: "#chart8",
937 937
 			    data: { x: "x",
@@ -945,22 +945,22 @@  discard block
 block discarded – undo
945 945
                 </div>
946 946
             </div>
947 947
             
948
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
948
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
949 949
             <div class="col-md-6">
950 950
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
951 951
 <?php
952
-		$month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name);
952
+		$month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name);
953 953
 		if (count($month_array) == 0) print _("No data available");
954 954
 		else {
955 955
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
956 956
 			$month_data = '';
957 957
 			$month_cnt = '';
958
-			foreach($month_array as $month_item) {
958
+			foreach ($month_array as $month_item) {
959 959
 				$month_data .= '"'.$month_item['date_name'].'",';
960 960
 				$month_cnt .= $month_item['date_count'].',';
961 961
 			}
962 962
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
963
-			$month_cnt = "['vessels',".substr($month_cnt,0,-1)."]";
963
+			$month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]";
964 964
 			print 'c3.generate({
965 965
 			    bindto: "#chart9",
966 966
 			    data: { x: "x",
@@ -973,23 +973,23 @@  discard block
 block discarded – undo
973 973
                     <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
974 974
                 </div>
975 975
             </div>
976
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
976
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
977 977
 
978 978
             <div class="col-md-6">
979 979
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
980 980
 <?php
981
-		$date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name);
981
+		$date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name);
982 982
 		if (empty($date_array)) print _("No data available");
983 983
 		else {
984 984
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
985 985
 			$date_data = '';
986 986
 			$date_cnt = '';
987
-			foreach($date_array as $date_item) {
987
+			foreach ($date_array as $date_item) {
988 988
 				$date_data .= '"'.$date_item['date_name'].'",';
989 989
 				$date_cnt .= $date_item['date_count'].',';
990 990
 			}
991 991
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
992
-			$date_cnt = "['vessels',".substr($date_cnt,0,-1)."]";
992
+			$date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]";
993 993
 			print 'c3.generate({
994 994
 			    bindto: "#chart5",
995 995
 			    data: { x: "x",
@@ -1002,22 +1002,22 @@  discard block
 block discarded – undo
1002 1002
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1003 1003
                 </div>
1004 1004
             </div>
1005
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1005
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1006 1006
             <div class="col-md-6">
1007 1007
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1008 1008
 <?php
1009
-		$hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name);
1009
+		$hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name);
1010 1010
 		if (empty($hour_array)) print _("No data available");
1011 1011
 		else {
1012 1012
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1013 1013
 			$hour_data = '';
1014 1014
 			$hour_cnt = '';
1015
-			foreach($hour_array as $hour_item) {
1015
+			foreach ($hour_array as $hour_item) {
1016 1016
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
1017 1017
 				$hour_cnt .= $hour_item['hour_count'].',';
1018 1018
 			}
1019 1019
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
1020
-			$hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]";
1020
+			$hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]";
1021 1021
 			print 'c3.generate({
1022 1022
 			    bindto: "#chart6",
1023 1023
 			    data: {
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
                     <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1031 1031
                 </div>
1032 1032
             </div>
1033
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1033
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1034 1034
         </div>
1035 1035
 <?php
1036 1036
 	}
@@ -1052,12 +1052,12 @@  discard block
 block discarded – undo
1052 1052
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
1053 1053
 			$year_data = '';
1054 1054
 			$year_cnt = '';
1055
-			foreach($year_array as $year_item) {
1055
+			foreach ($year_array as $year_item) {
1056 1056
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1057 1057
 				$year_cnt .= $year_item['date_count'].',';
1058 1058
 			}
1059 1059
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1060
-			$year_cnt = "['trackers',".substr($year_cnt,0,-1)."]";
1060
+			$year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]";
1061 1061
 			print 'c3.generate({
1062 1062
 			    bindto: "#chart8",
1063 1063
 			    data: { x: "x",
@@ -1071,7 +1071,7 @@  discard block
 block discarded – undo
1071 1071
                 </div>
1072 1072
             </div>
1073 1073
             
1074
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1074
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1075 1075
             <div class="col-md-6">
1076 1076
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1077 1077
 <?php
@@ -1081,12 +1081,12 @@  discard block
 block discarded – undo
1081 1081
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
1082 1082
 			$month_data = '';
1083 1083
 			$month_cnt = '';
1084
-			foreach($month_array as $month_item) {
1084
+			foreach ($month_array as $month_item) {
1085 1085
 				$month_data .= '"'.$month_item['date_name'].'",';
1086 1086
 				$month_cnt .= $month_item['date_count'].',';
1087 1087
 			}
1088 1088
 			$month_data = "['x',".substr($month_data, 0, -1)."]";
1089
-			$month_cnt = "['trackers',".substr($month_cnt,0,-1)."]";
1089
+			$month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]";
1090 1090
 			print 'c3.generate({
1091 1091
 			    bindto: "#chart9",
1092 1092
 			    data: { x: "x",
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
                     <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1100 1100
                 </div>
1101 1101
             </div>
1102
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1102
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1103 1103
 
1104 1104
             <div class="col-md-6">
1105 1105
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
@@ -1110,12 +1110,12 @@  discard block
 block discarded – undo
1110 1110
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1111 1111
 			$date_data = '';
1112 1112
 			$date_cnt = '';
1113
-			foreach($date_array as $date_item) {
1113
+			foreach ($date_array as $date_item) {
1114 1114
 				$date_data .= '"'.$date_item['date_name'].'",';
1115 1115
 				$date_cnt .= $date_item['date_count'].',';
1116 1116
 			}
1117 1117
 			$date_data = "['x',".substr($date_data, 0, -1)."]";
1118
-			$date_cnt = "['trackers',".substr($date_cnt,0,-1)."]";
1118
+			$date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]";
1119 1119
 			print 'c3.generate({
1120 1120
 			    bindto: "#chart5",
1121 1121
 			    data: { x: "x",
@@ -1128,22 +1128,22 @@  discard block
 block discarded – undo
1128 1128
                     <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1129 1129
                 </div>
1130 1130
             </div>
1131
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1131
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1132 1132
             <div class="col-md-6">
1133 1133
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1134 1134
 <?php
1135
-		$hour_array = $Tracker->countAllHours('hour',true);
1135
+		$hour_array = $Tracker->countAllHours('hour', true);
1136 1136
 		if (empty($hour_array)) print _("No data available");
1137 1137
 		else {
1138 1138
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1139 1139
 			$hour_data = '';
1140 1140
 			$hour_cnt = '';
1141
-			foreach($hour_array as $hour_item) {
1141
+			foreach ($hour_array as $hour_item) {
1142 1142
 				$hour_data .= '"'.$hour_item['hour_name'].':00",';
1143 1143
 				$hour_cnt .= $hour_item['hour_count'].',';
1144 1144
 			}
1145 1145
 			$hour_data = "[".substr($hour_data, 0, -1)."]";
1146
-			$hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]";
1146
+			$hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]";
1147 1147
 			print 'c3.generate({
1148 1148
 			    bindto: "#chart6",
1149 1149
 			    data: {
@@ -1156,7 +1156,7 @@  discard block
 block discarded – undo
1156 1156
                     <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1157 1157
                 </div>
1158 1158
             </div>
1159
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1159
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1160 1160
         </div>
1161 1161
 <?php
1162 1162
 	}
@@ -1178,12 +1178,12 @@  discard block
 block discarded – undo
1178 1178
 			print '<div id="chart21" class="chart" width="100%"></div><script>';
1179 1179
 			$year_data = '';
1180 1180
 			$year_cnt = '';
1181
-			foreach($year_array as $year_item) {
1181
+			foreach ($year_array as $year_item) {
1182 1182
 				$year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",';
1183 1183
 				$year_cnt .= $year_item['date_count'].',';
1184 1184
 			}
1185 1185
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1186
-			$year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1186
+			$year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]";
1187 1187
 			print 'c3.generate({
1188 1188
 			    bindto: "#chart21",
1189 1189
 			    data: { x: "x",
@@ -1199,7 +1199,7 @@  discard block
 block discarded – undo
1199 1199
             -->
1200 1200
             </div>
1201 1201
             
1202
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1202
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1203 1203
             <div class="col-md-6">
1204 1204
                 <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2>
1205 1205
 <?php
@@ -1209,12 +1209,12 @@  discard block
 block discarded – undo
1209 1209
 			print '<div id="chart22" class="chart" width="100%"></div><script>';
1210 1210
 			$year_data = '';
1211 1211
 			$year_cnt = '';
1212
-			foreach($year_array as $year_item) {
1212
+			foreach ($year_array as $year_item) {
1213 1213
 				$year_data .= '"'.$year_item['year_name'].'-01-01'.'",';
1214 1214
 				$year_cnt .= $year_item['date_count'].',';
1215 1215
 			}
1216 1216
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1217
-			$year_cnt = "['satellite',".substr($year_cnt,0,-1)."]";
1217
+			$year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]";
1218 1218
 			print 'c3.generate({
1219 1219
 			    bindto: "#chart22",
1220 1220
 			    data: { x: "x",
@@ -1230,7 +1230,7 @@  discard block
 block discarded – undo
1230 1230
             -->
1231 1231
             </div>
1232 1232
             
1233
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1233
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1234 1234
         </div>
1235 1235
 <?php
1236 1236
 	}
@@ -1252,12 +1252,12 @@  discard block
 block discarded – undo
1252 1252
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
1253 1253
 			$year_data = '';
1254 1254
 			$year_cnt = '';
1255
-			foreach($year_array as $year_item) {
1255
+			foreach ($year_array as $year_item) {
1256 1256
 				$year_data .= '"'.$year_item['year'].'-01-01",';
1257 1257
 				$year_cnt .= $year_item['count'].',';
1258 1258
 			}
1259 1259
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1260
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1260
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1261 1261
 			print 'c3.generate({
1262 1262
 			    bindto: "#chart32",
1263 1263
 			    data: { x: "x",
@@ -1270,7 +1270,7 @@  discard block
 block discarded – undo
1270 1270
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1271 1271
                 </div>
1272 1272
             </div>
1273
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1273
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1274 1274
 
1275 1275
         <div class="row column">
1276 1276
             <div class="col-md-6">
@@ -1282,12 +1282,12 @@  discard block
 block discarded – undo
1282 1282
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
1283 1283
 			$year_data = '';
1284 1284
 			$year_cnt = '';
1285
-			foreach($year_array as $year_item) {
1285
+			foreach ($year_array as $year_item) {
1286 1286
 				$year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",';
1287 1287
 				$year_cnt .= $year_item['count'].',';
1288 1288
 			}
1289 1289
 			$year_data = "['x',".substr($year_data, 0, -1)."]";
1290
-			$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
1290
+			$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
1291 1291
 			print 'c3.generate({
1292 1292
 			    bindto: "#chart33",
1293 1293
 			    data: { x: "x",
@@ -1300,7 +1300,7 @@  discard block
 block discarded – undo
1300 1300
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
1301 1301
                 </div>
1302 1302
             </div>
1303
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1303
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1304 1304
 <br/>
1305 1305
 <?php
1306 1306
 	}
@@ -1314,19 +1314,19 @@  discard block
 block discarded – undo
1314 1314
 	//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
1315 1315
 	if ($year == '' && $month == '') {
1316 1316
 		if ($type == 'aircraft') {
1317
-			$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
1317
+			$polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d'));
1318 1318
 		} elseif ($type == 'marine') {
1319
-			$polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d'));
1319
+			$polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d'));
1320 1320
 		} elseif ($type == 'tracker') {
1321
-			$polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d'));
1321
+			$polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d'));
1322 1322
 		}
1323 1323
 	} else {
1324 1324
 		if ($type == 'aircraft') {
1325
-			$polar = $Stats->getStatsSource('polar',$year,$month);
1325
+			$polar = $Stats->getStatsSource('polar', $year, $month);
1326 1326
 		} elseif ($type == 'marine') {
1327
-			$polar = $Stats->getStatsSource('polar_marine',$year,$month);
1327
+			$polar = $Stats->getStatsSource('polar_marine', $year, $month);
1328 1328
 		} elseif ($type == 'tracker') {
1329
-			$polar = $Stats->getStatsSource('polar_tracker',$year,$month);
1329
+			$polar = $Stats->getStatsSource('polar_tracker', $year, $month);
1330 1330
 		}
1331 1331
 	}
1332 1332
 	if (!empty($polar)) {
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 			unset($polar_data);
1336 1336
 			$Spotter = new Spotter();
1337 1337
 			$data = json_decode($eachpolar['source_data']);
1338
-			foreach($data as $value => $key) {
1338
+			foreach ($data as $value => $key) {
1339 1339
 				$direction = $Spotter->parseDirection(($value*22.5));
1340 1340
 				$distance = $key;
1341 1341
 				$unit = 'km';
@@ -1355,7 +1355,7 @@  discard block
 block discarded – undo
1355 1355
 ?>
1356 1356
             <div class="col-md-6">
1357 1357
                 <h4><?php print $eachpolar['source_name']; ?></h4>
1358
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1358
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
1359 1359
         	<script>
1360 1360
         	    (function() {
1361 1361
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -1379,7 +1379,7 @@  discard block
 block discarded – undo
1379 1379
 		      color: color,
1380 1380
 		      unit: '<?php echo $unit; ?>'
1381 1381
 		    };
1382
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1382
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
1383 1383
 		    })();
1384 1384
 		</script>
1385 1385
             </div>
@@ -1394,19 +1394,19 @@  discard block
 block discarded – undo
1394 1394
 	//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
1395 1395
 	if ($year == '' && $month == '') {
1396 1396
 		if ($type == 'aircraft') {
1397
-			$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
1397
+			$msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d'));
1398 1398
 		} elseif ($type == 'marine') {
1399
-			$msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d'));
1399
+			$msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d'));
1400 1400
 		} elseif ($type == 'tracker') {
1401
-			$msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d'));
1401
+			$msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d'));
1402 1402
 		}
1403 1403
 	} else {
1404 1404
 		if ($type == 'aircraft') {
1405
-			$msg = $Stats->getStatsSource('msg',$year,$month);
1405
+			$msg = $Stats->getStatsSource('msg', $year, $month);
1406 1406
 		} elseif ($type == 'marine') {
1407
-			$msg = $Stats->getStatsSource('msg_marine',$year,$month);
1407
+			$msg = $Stats->getStatsSource('msg_marine', $year, $month);
1408 1408
 		} elseif ($type == 'tracker') {
1409
-			$msg = $Stats->getStatsSource('msg_tracker',$year,$month);
1409
+			$msg = $Stats->getStatsSource('msg_tracker', $year, $month);
1410 1410
 		}
1411 1411
 	}
1412 1412
 	if (!empty($msg)) {
@@ -1414,13 +1414,13 @@  discard block
 block discarded – undo
1414 1414
 		foreach ($msg as $eachmsg) {
1415 1415
 			//$eachmsg = $msg[0];
1416 1416
 			$data = $eachmsg['source_data'];
1417
-			if ($data > 500) $max = (round(($data+100)/100))*100;
1417
+			if ($data > 500) $max = (round(($data + 100)/100))*100;
1418 1418
 			else $max = 500;
1419 1419
 ?>
1420
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1420
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1421 1421
         	<script>
1422 1422
 		      var g = new JustGage({
1423
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
1423
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
1424 1424
 			    value: <?php echo $data; ?>,
1425 1425
 			    min: 0,
1426 1426
 			    max: <?php print $max; ?>,
@@ -1442,19 +1442,19 @@  discard block
 block discarded – undo
1442 1442
 	//$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
1443 1443
 	if ($year == '' && $month == '') {
1444 1444
 		if ($type == 'aircraft') {
1445
-			$hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d'));
1445
+			$hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d'));
1446 1446
 		} elseif ($type == 'marine') {
1447
-			$hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d'));
1447
+			$hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d'));
1448 1448
 		} elseif ($type == 'tracker') {
1449
-			$hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d'));
1449
+			$hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d'));
1450 1450
 		}
1451 1451
 	} else {
1452 1452
 		if ($type == 'aircraft') {
1453
-			$hist = $Stats->getStatsSource('hist',$year,$month);
1453
+			$hist = $Stats->getStatsSource('hist', $year, $month);
1454 1454
 		} elseif ($type == 'marine') {
1455
-			$hist = $Stats->getStatsSource('hist_marine',$year,$month);
1455
+			$hist = $Stats->getStatsSource('hist_marine', $year, $month);
1456 1456
 		} elseif ($type == 'tracker') {
1457
-			$hist = $Stats->getStatsSource('hist_tracker',$year,$month);
1457
+			$hist = $Stats->getStatsSource('hist_tracker', $year, $month);
1458 1458
 		}
1459 1459
 	}
1460 1460
 	foreach ($hist as $hists) {
@@ -1464,7 +1464,7 @@  discard block
 block discarded – undo
1464 1464
 		$source = $hists['source_name'];
1465 1465
 		$hist_array = json_decode($hists['source_data']);
1466 1466
 		$unit = 'km';
1467
-		foreach($hist_array as $distance => $nb) {
1467
+		foreach ($hist_array as $distance => $nb) {
1468 1468
 			if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1469 1469
 				$distance = round($distance*0.539957);
1470 1470
 				$unit = 'nm';
@@ -1484,18 +1484,18 @@  discard block
 block discarded – undo
1484 1484
 		$nb_data = "['flights',".substr($nb_data, 0, -1)."]";
1485 1485
 ?>
1486 1486
             <div class="col-md-6">
1487
-                <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2>
1487
+                <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2>
1488 1488
 <?php
1489
-		print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>';
1489
+		print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>';
1490 1490
 		print 'c3.generate({
1491
-		    bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'",
1491
+		    bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'",
1492 1492
 		    data: { x: "x",
1493 1493
 		    columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}},
1494 1494
 		    axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});';
1495 1495
 		print '</script>';
1496 1496
 ?>
1497 1497
     	    </div>
1498
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
1498
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
1499 1499
 <?php
1500 1500
 	}
1501 1501
 ?>
Please login to merge, or discard this patch.
Braces   +169 added lines, -80 removed lines patch added patch discarded remove patch
@@ -22,11 +22,15 @@  discard block
 block discarded – undo
22 22
 	require_once('require/class.Spotter.php');
23 23
 }
24 24
 
25
-if (!isset($filter_name)) $filter_name = '';
25
+if (!isset($filter_name)) {
26
+	$filter_name = '';
27
+}
26 28
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
27 29
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
28
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
29
-}
30
+	if (isset($globalFilter['airline'])) {
31
+		$airline_icao = $globalFilter['airline'][0];
32
+	}
33
+	}
30 34
 if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') {
31 35
 	$Spotter = new Spotter();
32 36
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
@@ -61,7 +65,12 @@  discard block
 block discarded – undo
61 65
 <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script>
62 66
 <div class="column">
63 67
     <div class="info">
64
-            <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1>
68
+            <h1><?php if (isset($airline_name)) {
69
+	echo _("Statistics for ").$airline_name;
70
+} else {
71
+	echo _("Statistics");
72
+}
73
+?></h1>
65 74
 <?php 
66 75
 if ($type == 'aircraft') {
67 76
 	$last_update = $Stats->getLastStatsUpdate();
@@ -69,7 +78,9 @@  discard block
 block discarded – undo
69 78
 	if (isset($last_update[0]['value'])) {
70 79
 		date_default_timezone_set('UTC');
71 80
 		$lastupdate = strtotime($last_update[0]['value']);
72
-		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
81
+		if (isset($globalTimezone) && $globalTimezone != '') {
82
+			date_default_timezone_set($globalTimezone);
83
+		}
73 84
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
74 85
 	}
75 86
 }
@@ -154,8 +165,11 @@  discard block
 block discarded – undo
154 165
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
155 166
 		$aircraft_data = '';
156 167
 		foreach($aircraft_array as $aircraft_item) {
157
-			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
158
-			else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
168
+			if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') {
169
+				$aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
170
+			} else {
171
+				$aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
172
+			}
159 173
 		}
160 174
 		$aircraft_data = substr($aircraft_data, 0, -1);
161 175
 		print 'var series = ['.$aircraft_data.'];';
@@ -172,11 +186,17 @@  discard block
 block discarded – undo
172 186
 <?php
173 187
 	if ($year != '' && $month != '') {
174 188
 ?>
175
-            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
189
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
190
+	echo '/'.$airline_icao;
191
+}
192
+?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
176 193
 <?php
177 194
 	} else {
178 195
 ?>
179
-            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
196
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
197
+	echo '/'.$airline_icao;
198
+}
199
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
180 200
 <?php
181 201
 	}
182 202
 ?>
@@ -205,11 +225,15 @@  discard block
 block discarded – undo
205 225
 			print '</script>';
206 226
 			if ($year != '' && $month != '') {
207 227
 				print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
208
-				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
228
+				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
229
+					echo '/'.$airline_icao;
230
+				}
209 231
 				print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
210 232
 			} else {
211 233
 				print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
212
-				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
234
+				if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
235
+					echo '/'.$airline_icao;
236
+				}
213 237
 				print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
214 238
 			}
215 239
 			print '</div>';
@@ -229,8 +253,9 @@  discard block
 block discarded – undo
229 253
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
230 254
 <?php
231 255
 	$marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month);
232
-	if (count($marine_array) == 0) print _("No data available");
233
-	else {
256
+	if (count($marine_array) == 0) {
257
+		print _("No data available");
258
+	} else {
234 259
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
235 260
 		$marine_data = '';
236 261
 		foreach($marine_array as $marine_item) {
@@ -274,8 +299,9 @@  discard block
 block discarded – undo
274 299
                 <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2>
275 300
 <?php
276 301
 	$tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month);
277
-	if (count($tracker_array) == 0) print _("No data available");
278
-	else {
302
+	if (count($tracker_array) == 0) {
303
+		print _("No data available");
304
+	} else {
279 305
 		print '<div id="chart1" class="chart" width="100%"></div><script>';
280 306
 		$tracker_data = '';
281 307
 		foreach($tracker_array as $tracker_item) {
@@ -319,8 +345,9 @@  discard block
 block discarded – undo
319 345
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
320 346
 <?php
321 347
 		$owner_array = $Satellite->countAllOwners(true);
322
-		if (count($owner_array) == 0) print _("No data available");
323
-		else {
348
+		if (count($owner_array) == 0) {
349
+			print _("No data available");
350
+		} else {
324 351
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
325 352
 			$owner_data = '';
326 353
 			foreach($owner_array as $owner_item) {
@@ -339,7 +366,10 @@  discard block
 block discarded – undo
339 366
 ?>
340 367
                <!--
341 368
                 <div class="more">
342
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
369
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
370
+	echo '/'.$airline_icao;
371
+}
372
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
343 373
                 </div>
344 374
                 -->
345 375
             </div>
@@ -348,8 +378,9 @@  discard block
 block discarded – undo
348 378
                 <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2>
349 379
 <?php
350 380
 		$countries_array = $Satellite->countAllCountriesOwners(true);
351
-		if (count($countries_array) == 0) print _("No data available");
352
-		else {
381
+		if (count($countries_array) == 0) {
382
+			print _("No data available");
383
+		} else {
353 384
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
354 385
 			$owner_data = '';
355 386
 			foreach($countries_array as $owner_item) {
@@ -368,7 +399,10 @@  discard block
 block discarded – undo
368 399
 ?>
369 400
 	    <!--
370 401
                 <div class="more">
371
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
402
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
403
+	echo '/'.$airline_icao;
404
+}
405
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
372 406
                 </div>
373 407
                 -->
374 408
             </div>
@@ -380,8 +414,9 @@  discard block
 block discarded – undo
380 414
                 <h2><?php echo _("Top 10 Most Common Launch Sites"); ?></h2>
381 415
 <?php
382 416
 		$launch_site_array = $Satellite->countAllLaunchSite(true);
383
-		if (count($launch_site_array) == 0) print _("No data available");
384
-		else {
417
+		if (count($launch_site_array) == 0) {
418
+			print _("No data available");
419
+		} else {
385 420
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
386 421
 			$launch_site_data = '';
387 422
 			foreach($launch_site_array as $launch_site_item) {
@@ -400,7 +435,10 @@  discard block
 block discarded – undo
400 435
 ?>
401 436
                <!--
402 437
                 <div class="more">
403
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
438
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
439
+	echo '/'.$airline_icao;
440
+}
441
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
404 442
                 </div>
405 443
                 -->
406 444
             </div>
@@ -423,8 +461,9 @@  discard block
 block discarded – undo
423 461
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
424 462
 <?php
425 463
 		$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
426
-		if (count($pilot_array) == 0) print _("No data available");
427
-		else {
464
+		if (count($pilot_array) == 0) {
465
+			print _("No data available");
466
+		} else {
428 467
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
429 468
 			$pilot_data = '';
430 469
 			foreach($pilot_array as $pilot_item) {
@@ -442,7 +481,9 @@  discard block
 block discarded – undo
442 481
 		}
443 482
 		print '<div class="more">';
444 483
 		print '<a href="'.$globalURL.'/statistics/pilot'; 
445
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
484
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
485
+			echo '/'.$airline_icao;
486
+		}
446 487
 		print'" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
447 488
 		print '</div>';
448 489
 ?>
@@ -458,8 +499,9 @@  discard block
 block discarded – undo
458 499
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
459 500
 <?php
460 501
 		$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
461
-		if (count($owner_array) == 0) print _("No data available");
462
-		else {
502
+		if (count($owner_array) == 0) {
503
+			print _("No data available");
504
+		} else {
463 505
 			print '<div id="chart7" class="chart" width="100%"></div><script>';
464 506
 			$owner_data = '';
465 507
 			foreach($owner_array as $owner_item) {
@@ -477,7 +519,10 @@  discard block
 block discarded – undo
477 519
 		}
478 520
 ?>
479 521
                 <div class="more">
480
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
522
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
523
+	echo '/'.$airline_icao;
524
+}
525
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
481 526
                 </div>
482 527
             </div>
483 528
         
@@ -490,8 +535,9 @@  discard block
 block discarded – undo
490 535
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
491 536
 <?php
492 537
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
493
-		if (count($flightover_array) == 0) print _("No data available");
494
-		else {
538
+		if (count($flightover_array) == 0) {
539
+			print _("No data available");
540
+		} else {
495 541
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
496 542
 			print 'var series = [';
497 543
 			$flightover_data = '';
@@ -533,7 +579,10 @@  discard block
 block discarded – undo
533 579
 		}
534 580
 ?>
535 581
                 <div class="more">
536
-                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
582
+                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
583
+	echo '/'.$airline_icao;
584
+}
585
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
537 586
                 </div>
538 587
             </div>
539 588
 <?php
@@ -551,8 +600,9 @@  discard block
 block discarded – undo
551 600
 	<div class="col-md-6">
552 601
             <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2>
553 602
 <?php
554
-	if (count($flightover_array) == 0) print _("No data available");
555
-	else {
603
+	if (count($flightover_array) == 0) {
604
+		print _("No data available");
605
+	} else {
556 606
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
557 607
 		print 'var series = [';
558 608
 		$flightover_data = '';
@@ -608,8 +658,9 @@  discard block
 block discarded – undo
608 658
 	<div class="col-md-6">
609 659
             <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2>
610 660
 <?php
611
-	if (count($flightover_array) == 0) print _("No data available");
612
-	else {
661
+	if (count($flightover_array) == 0) {
662
+		print _("No data available");
663
+	} else {
613 664
 		print '<div id="chart10" class="chart" width="100%"></div><script>';
614 665
 		print 'var series = [';
615 666
 		$flightover_data = '';
@@ -715,7 +766,9 @@  discard block
 block discarded – undo
715 766
 		});";
716 767
 		print '</script>';
717 768
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; 
718
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
769
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
770
+			echo '/'.$airline_icao;
771
+		}
719 772
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
720 773
 	}
721 774
 ?>
@@ -777,7 +830,9 @@  discard block
 block discarded – undo
777 830
 		});";
778 831
 		print '</script>';
779 832
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
780
-		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
833
+		if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
834
+			echo '/'.$airline_icao;
835
+		}
781 836
 		print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
782 837
 	}
783 838
 ?>
@@ -796,8 +851,9 @@  discard block
 block discarded – undo
796 851
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
797 852
 <?php
798 853
 		$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
799
-		if (count($year_array) == 0) print _("No data available");
800
-		else {
854
+		if (count($year_array) == 0) {
855
+			print _("No data available");
856
+		} else {
801 857
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
802 858
 			$year_data = '';
803 859
 			$year_cnt = '';
@@ -816,7 +872,10 @@  discard block
 block discarded – undo
816 872
 		}
817 873
 ?>
818 874
                 <div class="more">
819
-                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
875
+                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
876
+	echo '/'.$airline_icao;
877
+}
878
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
820 879
                 </div>
821 880
             </div>
822 881
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -824,8 +883,9 @@  discard block
 block discarded – undo
824 883
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
825 884
 <?php
826 885
 		$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
827
-		if (count($month_array) == 0) print _("No data available");
828
-		else {
886
+		if (count($month_array) == 0) {
887
+			print _("No data available");
888
+		} else {
829 889
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
830 890
 			$month_data = '';
831 891
 			$month_cnt = '';
@@ -844,7 +904,10 @@  discard block
 block discarded – undo
844 904
 		}
845 905
 ?>
846 906
                 <div class="more">
847
-                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
907
+                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
908
+	echo '/'.$airline_icao;
909
+}
910
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
848 911
                 </div>
849 912
             </div>
850 913
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -853,8 +916,9 @@  discard block
 block discarded – undo
853 916
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
854 917
 <?php
855 918
 		$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
856
-		if (empty($date_array)) print _("No data available");
857
-		else {
919
+		if (empty($date_array)) {
920
+			print _("No data available");
921
+		} else {
858 922
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
859 923
 			$date_data = '';
860 924
 			$date_cnt = '';
@@ -873,7 +937,10 @@  discard block
 block discarded – undo
873 937
 		}
874 938
 ?>
875 939
                 <div class="more">
876
-                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
940
+                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
941
+	echo '/'.$airline_icao;
942
+}
943
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
877 944
                 </div>
878 945
             </div>
879 946
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -881,8 +948,9 @@  discard block
 block discarded – undo
881 948
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
882 949
 <?php
883 950
 		$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
884
-		if (empty($hour_array)) print _("No data available");
885
-		else {
951
+		if (empty($hour_array)) {
952
+			print _("No data available");
953
+		} else {
886 954
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
887 955
 			$hour_data = '';
888 956
 			$hour_cnt = '';
@@ -901,7 +969,10 @@  discard block
 block discarded – undo
901 969
 		}
902 970
 ?>
903 971
                 <div class="more">
904
-                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
972
+                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
973
+	echo '/'.$airline_icao;
974
+}
975
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
905 976
                 </div>
906 977
             </div>
907 978
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -921,8 +992,9 @@  discard block
 block discarded – undo
921 992
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
922 993
 <?php
923 994
 		$year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name);
924
-		if (count($year_array) == 0) print _("No data available");
925
-		else {
995
+		if (count($year_array) == 0) {
996
+			print _("No data available");
997
+		} else {
926 998
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
927 999
 			$year_data = '';
928 1000
 			$year_cnt = '';
@@ -950,8 +1022,9 @@  discard block
 block discarded – undo
950 1022
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
951 1023
 <?php
952 1024
 		$month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name);
953
-		if (count($month_array) == 0) print _("No data available");
954
-		else {
1025
+		if (count($month_array) == 0) {
1026
+			print _("No data available");
1027
+		} else {
955 1028
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
956 1029
 			$month_data = '';
957 1030
 			$month_cnt = '';
@@ -979,8 +1052,9 @@  discard block
 block discarded – undo
979 1052
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
980 1053
 <?php
981 1054
 		$date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name);
982
-		if (empty($date_array)) print _("No data available");
983
-		else {
1055
+		if (empty($date_array)) {
1056
+			print _("No data available");
1057
+		} else {
984 1058
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
985 1059
 			$date_data = '';
986 1060
 			$date_cnt = '';
@@ -1007,8 +1081,9 @@  discard block
 block discarded – undo
1007 1081
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1008 1082
 <?php
1009 1083
 		$hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name);
1010
-		if (empty($hour_array)) print _("No data available");
1011
-		else {
1084
+		if (empty($hour_array)) {
1085
+			print _("No data available");
1086
+		} else {
1012 1087
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1013 1088
 			$hour_data = '';
1014 1089
 			$hour_cnt = '';
@@ -1047,8 +1122,9 @@  discard block
 block discarded – undo
1047 1122
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
1048 1123
 <?php
1049 1124
 		$year_array = $Tracker->countAllMonthsLastYear(true);
1050
-		if (count($year_array) == 0) print _("No data available");
1051
-		else {
1125
+		if (count($year_array) == 0) {
1126
+			print _("No data available");
1127
+		} else {
1052 1128
 			print '<div id="chart8" class="chart" width="100%"></div><script>';
1053 1129
 			$year_data = '';
1054 1130
 			$year_cnt = '';
@@ -1076,8 +1152,9 @@  discard block
 block discarded – undo
1076 1152
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
1077 1153
 <?php
1078 1154
 		$month_array = $Tracker->countAllDatesLastMonth();
1079
-		if (count($month_array) == 0) print _("No data available");
1080
-		else {
1155
+		if (count($month_array) == 0) {
1156
+			print _("No data available");
1157
+		} else {
1081 1158
 			print '<div id="chart9" class="chart" width="100%"></div><script>';
1082 1159
 			$month_data = '';
1083 1160
 			$month_cnt = '';
@@ -1105,8 +1182,9 @@  discard block
 block discarded – undo
1105 1182
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
1106 1183
 <?php
1107 1184
 		$date_array = $Tracker->countAllDatesLast7Days();
1108
-		if (empty($date_array)) print _("No data available");
1109
-		else {
1185
+		if (empty($date_array)) {
1186
+			print _("No data available");
1187
+		} else {
1110 1188
 			print '<div id="chart5" class="chart" width="100%"></div><script>';
1111 1189
 			$date_data = '';
1112 1190
 			$date_cnt = '';
@@ -1133,8 +1211,9 @@  discard block
 block discarded – undo
1133 1211
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
1134 1212
 <?php
1135 1213
 		$hour_array = $Tracker->countAllHours('hour',true);
1136
-		if (empty($hour_array)) print _("No data available");
1137
-		else {
1214
+		if (empty($hour_array)) {
1215
+			print _("No data available");
1216
+		} else {
1138 1217
 			print '<div id="chart6" class="chart" width="100%"></div><script>';
1139 1218
 			$hour_data = '';
1140 1219
 			$hour_cnt = '';
@@ -1173,8 +1252,9 @@  discard block
 block discarded – undo
1173 1252
                 <h2><?php echo _("Busiest Launch Months of the last 12 Months"); ?></h2>
1174 1253
 <?php
1175 1254
 		$year_array = $Satellite->countAllMonthsLastYear();
1176
-		if (count($year_array) == 0) print _("No data available");
1177
-		else {
1255
+		if (count($year_array) == 0) {
1256
+			print _("No data available");
1257
+		} else {
1178 1258
 			print '<div id="chart21" class="chart" width="100%"></div><script>';
1179 1259
 			$year_data = '';
1180 1260
 			$year_cnt = '';
@@ -1204,8 +1284,9 @@  discard block
 block discarded – undo
1204 1284
                 <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2>
1205 1285
 <?php
1206 1286
 		$year_array = $Satellite->countAllYears();
1207
-		if (count($year_array) == 0) print _("No data available");
1208
-		else {
1287
+		if (count($year_array) == 0) {
1288
+			print _("No data available");
1289
+		} else {
1209 1290
 			print '<div id="chart22" class="chart" width="100%"></div><script>';
1210 1291
 			$year_data = '';
1211 1292
 			$year_cnt = '';
@@ -1247,8 +1328,9 @@  discard block
 block discarded – undo
1247 1328
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
1248 1329
 <?php
1249 1330
 		$year_array = $Stats->countFatalitiesByYear();
1250
-		if (count($year_array) == 0) print _("No data available");
1251
-		else {
1331
+		if (count($year_array) == 0) {
1332
+			print _("No data available");
1333
+		} else {
1252 1334
 			print '<div id="chart32" class="chart" width="100%"></div><script>';
1253 1335
 			$year_data = '';
1254 1336
 			$year_cnt = '';
@@ -1277,8 +1359,9 @@  discard block
 block discarded – undo
1277 1359
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
1278 1360
 <?php
1279 1361
 		$year_array = $Stats->countFatalitiesLast12Months();
1280
-		if (count($year_array) == 0) print _("No data available");
1281
-		else {
1362
+		if (count($year_array) == 0) {
1363
+			print _("No data available");
1364
+		} else {
1282 1365
 			print '<div id="chart33" class="chart" width="100%"></div><script>';
1283 1366
 			$year_data = '';
1284 1367
 			$year_cnt = '';
@@ -1349,8 +1432,11 @@  discard block
 block discarded – undo
1349 1432
 					$distance = $distance;
1350 1433
 					$unit = 'km';
1351 1434
 				}
1352
-				if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1353
-				else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1435
+				if (!isset($polar_data)) {
1436
+					$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1437
+				} else {
1438
+					$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1439
+				}
1354 1440
 			}
1355 1441
 ?>
1356 1442
             <div class="col-md-6">
@@ -1414,9 +1500,12 @@  discard block
 block discarded – undo
1414 1500
 		foreach ($msg as $eachmsg) {
1415 1501
 			//$eachmsg = $msg[0];
1416 1502
 			$data = $eachmsg['source_data'];
1417
-			if ($data > 500) $max = (round(($data+100)/100))*100;
1418
-			else $max = 500;
1419
-?>
1503
+			if ($data > 500) {
1504
+				$max = (round(($data+100)/100))*100;
1505
+			} else {
1506
+				$max = 500;
1507
+			}
1508
+			?>
1420 1509
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1421 1510
         	<script>
1422 1511
 		      var g = new JustGage({
Please login to merge, or discard this patch.
require/class.Stats.php 4 patches
Doc Comments   +35 added lines patch added patch discarded remove patch
@@ -18,6 +18,10 @@  discard block
 block discarded – undo
18 18
 		$this->db = $Connection->db();
19 19
 	}
20 20
 
21
+	/**
22
+	 * @param string $type
23
+	 * @param string $stats_date
24
+	 */
21 25
 	public function addLastStatsUpdate($type,$stats_date) {
22 26
 		$query = "DELETE FROM config WHERE name = :type;
23 27
 			    INSERT INTO config (name,value) VALUES (:type,:stats_date);";
@@ -1368,6 +1372,10 @@  discard block
 block discarded – undo
1368 1372
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1369 1373
 		return $all;
1370 1374
 	}
1375
+
1376
+	/**
1377
+	 * @param string $type
1378
+	 */
1371 1379
 	public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') {
1372 1380
 		if ($filter_name == '') $filter_name = $this->filter_name;
1373 1381
 		$query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -1379,6 +1387,11 @@  discard block
 block discarded – undo
1379 1387
 			echo "error : ".$e->getMessage();
1380 1388
 		}
1381 1389
 	}
1390
+
1391
+	/**
1392
+	 * @param string $type
1393
+	 * @param string $year
1394
+	 */
1382 1395
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') {
1383 1396
 		if ($filter_name == '') $filter_name = $this->filter_name;
1384 1397
 		global $globalArchiveMonths, $globalDBdriver;
@@ -1578,6 +1591,10 @@  discard block
 block discarded – undo
1578 1591
 		else return 0;
1579 1592
 	}
1580 1593
 
1594
+	/**
1595
+	 * @param string $type
1596
+	 * @param string $stats_date
1597
+	 */
1581 1598
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1582 1599
 		global $globalDBdriver;
1583 1600
 		if ($filter_name == '') $filter_name = $this->filter_name;
@@ -1631,6 +1648,9 @@  discard block
 block discarded – undo
1631 1648
         }
1632 1649
         */
1633 1650
 
1651
+	/**
1652
+	 * @param string $stats_type
1653
+	 */
1634 1654
 	public function getStatsSource($stats_type,$year = '',$month = '',$day = '') {
1635 1655
 		global $globalDBdriver;
1636 1656
 		$query = "SELECT * FROM stats_source WHERE stats_type = :stats_type";
@@ -1674,6 +1694,9 @@  discard block
 block discarded – undo
1674 1694
 		return $all;
1675 1695
 	}
1676 1696
 
1697
+	/**
1698
+	 * @param string $stats_type
1699
+	 */
1677 1700
 	public function addStatSource($data,$source_name,$stats_type,$date) {
1678 1701
 		global $globalDBdriver;
1679 1702
 		if ($globalDBdriver == 'mysql') {
@@ -1689,6 +1712,10 @@  discard block
 block discarded – undo
1689 1712
 			return "error : ".$e->getMessage();
1690 1713
 		}
1691 1714
 	}
1715
+
1716
+	/**
1717
+	 * @param string $type
1718
+	 */
1692 1719
 	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
1693 1720
 		$query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
1694 1721
 		$query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
@@ -1955,6 +1982,10 @@  discard block
 block discarded – undo
1955 1982
 			return "error : ".$e->getMessage();
1956 1983
 		}
1957 1984
 	}
1985
+
1986
+	/**
1987
+	 * @param string $type
1988
+	 */
1958 1989
 	public function deleteStatFlight($type) {
1959 1990
 		$query = "DELETE FROM stats_flight WHERE stats_type = :type";
1960 1991
 		$query_values = array(':type' => $type);
@@ -1965,6 +1996,10 @@  discard block
 block discarded – undo
1965 1996
 			return "error : ".$e->getMessage();
1966 1997
 		}
1967 1998
 	}
1999
+
2000
+	/**
2001
+	 * @param string $type
2002
+	 */
1968 2003
 	public function deleteStatAirport($type) {
1969 2004
 		$query = "DELETE FROM stats_airport WHERE stats_type = :type";
1970 2005
 		$query_values = array(':type' => $type);
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -404,17 +404,17 @@  discard block
 block discarded – undo
404 404
 			}
405 405
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
406 406
 		} else $all = array();
407
-                if (empty($all)) {
408
-	                $Spotter = new Spotter($this->db);
409
-            		$filters = array();
407
+				if (empty($all)) {
408
+					$Spotter = new Spotter($this->db);
409
+					$filters = array();
410 410
 			$filters = array('year' => $year,'month' => $month);
411
-            		if ($filter_name != '') {
412
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
411
+					if ($filter_name != '') {
412
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
413 413
 			}
414 414
 			//$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month);
415
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
416
-                }
417
-                return $all;
415
+					$all = $Spotter->countAllAirlines($limit,0,'',$filters);
416
+				}
417
+				return $all;
418 418
 	}
419 419
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
420 420
 		global $globalStatsFilters;
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 			return "error : ".$e->getMessage();
1612 1612
 		}
1613 1613
 	}
1614
-        /*
1614
+		/*
1615 1615
 	public function getStatsSource($date,$stats_type = '') {
1616 1616
 		if ($stats_type == '') {
1617 1617
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
Please login to merge, or discard this patch.
Spacing   +540 added lines, -540 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 		$this->db = $Connection->db();
19 19
 	}
20 20
 
21
-	public function addLastStatsUpdate($type,$stats_date) {
21
+	public function addLastStatsUpdate($type, $stats_date) {
22 22
 		$query = "DELETE FROM config WHERE name = :type;
23 23
 			    INSERT INTO config (name,value) VALUES (:type,:stats_date);";
24
-		$query_values = array('type' => $type,':stats_date' => $stats_date);
24
+		$query_values = array('type' => $type, ':stats_date' => $stats_date);
25 25
 		try {
26 26
 			$sth = $this->db->prepare($query);
27 27
 			$sth->execute($query_values);
28
-		} catch(PDOException $e) {
28
+		} catch (PDOException $e) {
29 29
 			return "error : ".$e->getMessage();
30 30
 		}
31 31
 	}
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 		try {
36 36
 			$sth = $this->db->prepare($query);
37 37
 			$sth->execute(array(':type' => $type));
38
-		} catch(PDOException $e) {
38
+		} catch (PDOException $e) {
39 39
 			echo "error : ".$e->getMessage();
40 40
 		}
41 41
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		try {
57 57
 			$sth = $this->db->prepare($query);
58 58
 			$sth->execute(array(':filter_name' => $filter_name));
59
-		} catch(PDOException $e) {
59
+		} catch (PDOException $e) {
60 60
 			return "error : ".$e->getMessage();
61 61
 		}
62 62
 	}
@@ -69,14 +69,14 @@  discard block
 block discarded – undo
69 69
 		try {
70 70
 			$sth = $this->db->prepare($query);
71 71
 			$sth->execute();
72
-		} catch(PDOException $e) {
72
+		} catch (PDOException $e) {
73 73
 			return "error : ".$e->getMessage();
74 74
 		}
75 75
 		$query = "DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_callsign WHERE filter_name = :filter_name;DELETE FROM stats_country WHERE filter_name = :filter_name;DELETE FROM stats_owner WHERE filter_name = :filter_name;DELETE FROM stats_pilot WHERE filter_name = :filter_name;DELETE FROM stats_registration WHERE filter_name = :filter_name;";
76 76
 		try {
77 77
 			$sth = $this->db->prepare($query);
78 78
 			$sth->execute(array(':filter_name' => $filter_name));
79
-		} catch(PDOException $e) {
79
+		} catch (PDOException $e) {
80 80
 			return "error : ".$e->getMessage();
81 81
 		}
82 82
 	}
@@ -88,77 +88,77 @@  discard block
 block discarded – undo
88 88
 		 try {
89 89
 			$sth = $this->db->prepare($query);
90 90
 			$sth->execute(array(':filter_name' => $filter_name));
91
-		} catch(PDOException $e) {
91
+		} catch (PDOException $e) {
92 92
 			echo "error : ".$e->getMessage();
93 93
 		}
94 94
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
95 95
 		if (empty($all)) {
96 96
 			$filters = array();
97 97
 			if ($filter_name != '') {
98
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
98
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
99 99
 			}
100 100
 			$Spotter = new Spotter($this->db);
101
-			$all = $Spotter->getAllAirlineNames('',NULL,$filters);
101
+			$all = $Spotter->getAllAirlineNames('', NULL, $filters);
102 102
 		}
103 103
 		return $all;
104 104
 	}
105
-	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
105
+	public function getAllAircraftTypes($stats_airline = '', $filter_name = '') {
106 106
 		if ($filter_name == '') $filter_name = $this->filter_name;
107 107
 		$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
108 108
 		try {
109 109
 			$sth = $this->db->prepare($query);
110
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
111
-		} catch(PDOException $e) {
110
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
111
+		} catch (PDOException $e) {
112 112
 			echo "error : ".$e->getMessage();
113 113
 		}
114 114
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
115 115
 		return $all;
116 116
 	}
117
-	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
117
+	public function getAllManufacturers($stats_airline = '', $filter_name = '') {
118 118
 		if ($filter_name == '') $filter_name = $this->filter_name;
119 119
 		$query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
120 120
 		try {
121 121
 			$sth = $this->db->prepare($query);
122
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
123
-		} catch(PDOException $e) {
122
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
123
+		} catch (PDOException $e) {
124 124
 			echo "error : ".$e->getMessage();
125 125
 		}
126 126
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
127 127
 		return $all;
128 128
 	}
129
-	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
129
+	public function getAllAirportNames($stats_airline = '', $filter_name = '') {
130 130
 		if ($filter_name == '') $filter_name = $this->filter_name;
131 131
 		$query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
132 132
 		try {
133 133
 			$sth = $this->db->prepare($query);
134
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
135
-		} catch(PDOException $e) {
134
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
135
+		} catch (PDOException $e) {
136 136
 			echo "error : ".$e->getMessage();
137 137
 		}
138 138
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
139 139
 		return $all;
140 140
 	}
141 141
 
142
-	public function getAllOwnerNames($stats_airline = '',$filter_name = '') {
142
+	public function getAllOwnerNames($stats_airline = '', $filter_name = '') {
143 143
 		if ($filter_name == '') $filter_name = $this->filter_name;
144 144
 		$query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC";
145 145
 		try {
146 146
 			$sth = $this->db->prepare($query);
147
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
148
-		} catch(PDOException $e) {
147
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
148
+		} catch (PDOException $e) {
149 149
 			echo "error : ".$e->getMessage();
150 150
 		}
151 151
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
152 152
 		return $all;
153 153
 	}
154 154
 
155
-	public function getAllPilotNames($stats_airline = '',$filter_name = '') {
155
+	public function getAllPilotNames($stats_airline = '', $filter_name = '') {
156 156
 		if ($filter_name == '') $filter_name = $this->filter_name;
157 157
 		$query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC";
158 158
 		try {
159 159
 			$sth = $this->db->prepare($query);
160
-			$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
161
-		} catch(PDOException $e) {
160
+			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
161
+		} catch (PDOException $e) {
162 162
 			echo "error : ".$e->getMessage();
163 163
 		}
164 164
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -166,23 +166,23 @@  discard block
 block discarded – undo
166 166
 	}
167 167
 
168 168
 
169
-	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
169
+	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
170 170
 		global $globalStatsFilters;
171 171
 		if ($filter_name == '') $filter_name = $this->filter_name;
172
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
172
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
173 173
 			$Spotter = new Spotter($this->db);
174
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
174
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
175 175
 			$alliance_airlines = array();
176 176
 			foreach ($airlines as $airline) {
177
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
177
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
178 178
 			}
179 179
 			if ($year == '' && $month == '') {
180
-				if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
181
-				else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
180
+				if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
181
+				else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
182 182
 				try {
183 183
 					$sth = $this->db->prepare($query);
184 184
 					$sth->execute(array(':filter_name' => $filter_name));
185
-				} catch(PDOException $e) {
185
+				} catch (PDOException $e) {
186 186
 					echo "error : ".$e->getMessage();
187 187
 				}
188 188
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -193,29 +193,29 @@  discard block
 block discarded – undo
193 193
 				else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
194 194
 				try {
195 195
 					$sth = $this->db->prepare($query);
196
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
197
-				} catch(PDOException $e) {
196
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
197
+				} catch (PDOException $e) {
198 198
 					echo "error : ".$e->getMessage();
199 199
 				}
200 200
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
201 201
 			} else $all = array();
202 202
 		}
203 203
 		if (empty($all)) {
204
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
205
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
204
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
205
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
206 206
 			} else {
207
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
207
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
208 208
 			}
209 209
 			if ($filter_name != '') {
210
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
210
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
211 211
 			}
212 212
 			$Spotter = new Spotter($this->db);
213 213
 			//$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month);
214
-			$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters);
214
+			$all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters);
215 215
 		}
216 216
 		return $all;
217 217
 	}
218
-	public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') {
218
+	public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') {
219 219
 		global $globalStatsFilters;
220 220
 		if ($filter_name == '') $filter_name = $this->filter_name;
221 221
 		if ($year == '' && $month == '') {
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 			try {
225 225
 				$sth = $this->db->prepare($query);
226 226
 				$sth->execute(array(':filter_name' => $filter_name));
227
-			} catch(PDOException $e) {
227
+			} catch (PDOException $e) {
228 228
 				echo "error : ".$e->getMessage();
229 229
 			}
230 230
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -232,32 +232,32 @@  discard block
 block discarded – undo
232 232
 		if (empty($all)) {
233 233
 			$Spotter = new Spotter($this->db);
234 234
 			$filters = array();
235
-			$filters = array('year' => $year,'month' => $month);
235
+			$filters = array('year' => $year, 'month' => $month);
236 236
 			if ($filter_name != '') {
237
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
237
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
238 238
 			}
239 239
 			//$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month);
240
-			$all = $Spotter->countAllAirlineCountries($limit,$filters);
240
+			$all = $Spotter->countAllAirlineCountries($limit, $filters);
241 241
 		}
242 242
 		return $all;
243 243
 	}
244
-	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') {
244
+	public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
245 245
 		global $globalStatsFilters;
246 246
 		if ($filter_name == '') $filter_name = $this->filter_name;
247
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
247
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
248 248
 			$Spotter = new Spotter($this->db);
249
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
249
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
250 250
 			$alliance_airlines = array();
251 251
 			foreach ($airlines as $airline) {
252
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
252
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
253 253
 			}
254 254
 			if ($year == '' && $month == '') {
255
-				if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
256
-				else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
255
+				if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
256
+				else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
257 257
 				try {
258 258
 					$sth = $this->db->prepare($query);
259 259
 					$sth->execute(array(':filter_name' => $filter_name));
260
-				} catch(PDOException $e) {
260
+				} catch (PDOException $e) {
261 261
 					echo "error : ".$e->getMessage();
262 262
 				}
263 263
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -268,21 +268,21 @@  discard block
 block discarded – undo
268 268
 				else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
269 269
 				try {
270 270
 					$sth = $this->db->prepare($query);
271
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
272
-				} catch(PDOException $e) {
271
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
272
+				} catch (PDOException $e) {
273 273
 					echo "error : ".$e->getMessage();
274 274
 				}
275 275
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
276 276
 			} else $all = array();
277 277
 		}
278 278
 		if (empty($all)) {
279
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
280
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
279
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
280
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
281 281
 			} else {
282
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
282
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
283 283
 			}
284 284
 			if ($filter_name != '') {
285
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
285
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
286 286
 			}
287 287
 			$Spotter = new Spotter($this->db);
288 288
 			//$all = $Spotter->countAllAircraftManufacturers($filters,$year,$month);
@@ -291,23 +291,23 @@  discard block
 block discarded – undo
291 291
 		return $all;
292 292
 	}
293 293
 
294
-	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
294
+	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
295 295
 		global $globalStatsFilters;
296 296
 		if ($filter_name == '') $filter_name = $this->filter_name;
297
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
297
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
298 298
 			$Spotter = new Spotter($this->db);
299
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
299
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
300 300
 			$alliance_airlines = array();
301 301
 			foreach ($airlines as $airline) {
302
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
302
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
303 303
 			}
304 304
 			if ($year == '' && $month == '') {
305
-				if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
306
-				else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
305
+				if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
306
+				else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
307 307
 				try {
308 308
 					$sth = $this->db->prepare($query);
309 309
 					$sth->execute(array(':filter_name' => $filter_name));
310
-				} catch(PDOException $e) {
310
+				} catch (PDOException $e) {
311 311
 					echo "error : ".$e->getMessage();
312 312
 				}
313 313
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -318,61 +318,61 @@  discard block
 block discarded – undo
318 318
 				else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
319 319
 				try {
320 320
 					$sth = $this->db->prepare($query);
321
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
322
-				} catch(PDOException $e) {
321
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
322
+				} catch (PDOException $e) {
323 323
 					echo "error : ".$e->getMessage();
324 324
 				}
325 325
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
326 326
 			} else $all = array();
327 327
 		}
328 328
 		if (empty($all)) {
329
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
330
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
329
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
330
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
331 331
 			} else {
332
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
332
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
333 333
 			}
334 334
 			if ($filter_name != '') {
335
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
335
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
336 336
 			}
337 337
 			$Spotter = new Spotter($this->db);
338 338
 			//$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month);
339
-			$all = $Spotter->countAllArrivalCountries($limit,$filters);
339
+			$all = $Spotter->countAllArrivalCountries($limit, $filters);
340 340
 		}
341 341
 		return $all;
342 342
 	}
343 343
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
344 344
 		global $globalStatsFilters;
345 345
 		if ($filter_name == '') $filter_name = $this->filter_name;
346
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
346
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
347 347
 			$Spotter = new Spotter($this->db);
348
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
348
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
349 349
 			$alliance_airlines = array();
350 350
 			foreach ($airlines as $airline) {
351
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
351
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
352 352
 			}
353
-			if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
354
-			else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
353
+			if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
354
+			else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
355 355
 			$query_values = array(':filter_name' => $filter_name);
356 356
 		} else {
357 357
 			if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
358 358
 			else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
359
-			$query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
359
+			$query_values = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
360 360
 		}
361 361
 		try {
362 362
 			$sth = $this->db->prepare($query);
363 363
 			$sth->execute($query_values);
364
-		} catch(PDOException $e) {
364
+		} catch (PDOException $e) {
365 365
 			echo "error : ".$e->getMessage();
366 366
 		}
367 367
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
368 368
 		if (empty($all)) {
369
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
370
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
369
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
370
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
371 371
 			} else {
372
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
372
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
373 373
 			}
374 374
 			if ($filter_name != '') {
375
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
375
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
376 376
 			}
377 377
 			$Spotter = new Spotter($this->db);
378 378
 			//$all = $Spotter->countAllDepartureCountries($filters,$year,$month);
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
 		return $all;
382 382
 	}
383 383
 
384
-	public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') {
384
+	public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') {
385 385
 		global $globalStatsFilters, $globalVATSIM, $globalIVAO;
386 386
 		if ($filter_name == '') $filter_name = $this->filter_name;
387 387
 		if ($year == '' && $month == '') {
@@ -390,7 +390,7 @@  discard block
 block discarded – undo
390 390
 			if (isset($forsource)) {
391 391
 				if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
392 392
 				else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC";
393
-				$query_values = array(':filter_name' => $filter_name,':forsource' => $forsource);
393
+				$query_values = array(':filter_name' => $filter_name, ':forsource' => $forsource);
394 394
 			} else {
395 395
 				if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
396 396
 				else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC";
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
 			try {
400 400
 				$sth = $this->db->prepare($query);
401 401
 				$sth->execute($query_values);
402
-			} catch(PDOException $e) {
402
+			} catch (PDOException $e) {
403 403
 				echo "error : ".$e->getMessage();
404 404
 			}
405 405
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -407,32 +407,32 @@  discard block
 block discarded – undo
407 407
                 if (empty($all)) {
408 408
 	                $Spotter = new Spotter($this->db);
409 409
             		$filters = array();
410
-			$filters = array('year' => $year,'month' => $month);
410
+			$filters = array('year' => $year, 'month' => $month);
411 411
             		if ($filter_name != '') {
412
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
412
+            			$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
413 413
 			}
414 414
 			//$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month);
415
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters);
415
+    		        $all = $Spotter->countAllAirlines($limit, 0, '', $filters);
416 416
                 }
417 417
                 return $all;
418 418
 	}
419
-	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
419
+	public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
420 420
 		global $globalStatsFilters;
421 421
 		if ($filter_name == '') $filter_name = $this->filter_name;
422
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
422
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
423 423
 			$Spotter = new Spotter($this->db);
424
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
424
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
425 425
 			$alliance_airlines = array();
426 426
 			foreach ($airlines as $airline) {
427
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
427
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
428 428
 			}
429 429
 			if ($year == '' && $month == '') {
430
-				if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
431
-				else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
430
+				if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
431
+				else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
432 432
 				try {
433 433
 					$sth = $this->db->prepare($query);
434 434
 					$sth->execute(array(':filter_name' => $filter_name));
435
-				} catch(PDOException $e) {
435
+				} catch (PDOException $e) {
436 436
 					echo "error : ".$e->getMessage();
437 437
 				}
438 438
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -443,45 +443,45 @@  discard block
 block discarded – undo
443 443
 				else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
444 444
 				try {
445 445
 					$sth = $this->db->prepare($query);
446
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
447
-				} catch(PDOException $e) {
446
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
447
+				} catch (PDOException $e) {
448 448
 					echo "error : ".$e->getMessage();
449 449
 				}
450 450
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
451 451
 			} else $all = array();
452 452
 		}
453 453
 		if (empty($all)) {
454
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
455
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
454
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
455
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
456 456
 			} else {
457
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
457
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
458 458
 			}
459 459
 			if ($filter_name != '') {
460
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
460
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
461 461
 			}
462 462
 			$Spotter = new Spotter($this->db);
463 463
 			//$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month);
464
-			$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters);
464
+			$all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters);
465 465
 		}
466 466
 		return $all;
467 467
 	}
468
-	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
468
+	public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
469 469
 		global $globalStatsFilters;
470 470
 		if ($filter_name == '') $filter_name = $this->filter_name;
471
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
471
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
472 472
 			$Spotter = new Spotter($this->db);
473
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
473
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
474 474
 			$alliance_airlines = array();
475 475
 			foreach ($airlines as $airline) {
476
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
476
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
477 477
 			}
478 478
 			if ($year == '' && $month == '') {
479
-				if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
480
-				else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
479
+				if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
480
+				else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
481 481
 				 try {
482 482
 					$sth = $this->db->prepare($query);
483 483
 					$sth->execute(array(':filter_name' => $filter_name));
484
-				} catch(PDOException $e) {
484
+				} catch (PDOException $e) {
485 485
 					echo "error : ".$e->getMessage();
486 486
 				}
487 487
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -492,46 +492,46 @@  discard block
 block discarded – undo
492 492
 				else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
493 493
 				 try {
494 494
 					$sth = $this->db->prepare($query);
495
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
496
-				} catch(PDOException $e) {
495
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
496
+				} catch (PDOException $e) {
497 497
 					echo "error : ".$e->getMessage();
498 498
 				}
499 499
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
500 500
 			} else $all = array();
501 501
 		}
502 502
 		if (empty($all)) {
503
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
504
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
503
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
504
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
505 505
 			} else {
506
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
506
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
507 507
 			}
508 508
 			if ($filter_name != '') {
509
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
509
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
510 510
 			}
511 511
 			$Spotter = new Spotter($this->db);
512 512
 			//$all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month);
513
-			$all = $Spotter->countAllCallsigns($limit,0,'',$filters);
513
+			$all = $Spotter->countAllCallsigns($limit, 0, '', $filters);
514 514
 		}
515 515
 		return $all;
516 516
 	}
517
-	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') {
517
+	public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
518 518
 		$Connection = new Connection();
519 519
 		if ($filter_name == '') $filter_name = $this->filter_name;
520 520
 		if ($Connection->tableExists('countries')) {
521
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
521
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
522 522
 				$Spotter = new Spotter($this->db);
523
-				$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
523
+				$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
524 524
 				if ($year == '' && $month == '') {
525 525
 					$alliance_airlines = array();
526 526
 					foreach ($airlines as $airline) {
527
-						$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
527
+						$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
528 528
 					}
529
-					if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
530
-					else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC";
529
+					if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
530
+					else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC";
531 531
 					 try {
532 532
 						$sth = $this->db->prepare($query);
533 533
 						$sth->execute(array(':filter_name' => $filter_name));
534
-					} catch(PDOException $e) {
534
+					} catch (PDOException $e) {
535 535
 						echo "error : ".$e->getMessage();
536 536
 					}
537 537
 					$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -543,8 +543,8 @@  discard block
 block discarded – undo
543 543
 					else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
544 544
 					 try {
545 545
 						$sth = $this->db->prepare($query);
546
-						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
547
-					} catch(PDOException $e) {
546
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
547
+					} catch (PDOException $e) {
548 548
 						echo "error : ".$e->getMessage();
549 549
 					}
550 550
 					$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 			return array();
562 562
 		}
563 563
 	}
564
-	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') {
564
+	public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
565 565
 		global $globalStatsFilters;
566 566
 		if ($filter_name == '') $filter_name = $this->filter_name;
567 567
 		if ($year == '' && $month == '') {
@@ -569,41 +569,41 @@  discard block
 block discarded – undo
569 569
 			else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
570 570
 			try {
571 571
 				$sth = $this->db->prepare($query);
572
-				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
573
-			} catch(PDOException $e) {
572
+				$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
573
+			} catch (PDOException $e) {
574 574
 				echo "error : ".$e->getMessage();
575 575
 			}
576 576
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
577 577
 		} else $all = array();
578 578
 		if (empty($all)) {
579
-			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
579
+			$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
580 580
 			if ($filter_name != '') {
581
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
581
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
582 582
 			}
583 583
 			$Spotter = new Spotter($this->db);
584 584
 			//$all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month);
585
-			$all = $Spotter->countAllPilots($limit,0,'',$filters);
585
+			$all = $Spotter->countAllPilots($limit, 0, '', $filters);
586 586
 		}
587 587
 		return $all;
588 588
 	}
589 589
 
590
-	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') {
590
+	public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
591 591
 		global $globalStatsFilters;
592 592
 		if ($filter_name == '') $filter_name = $this->filter_name;
593
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
593
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
594 594
 			$Spotter = new Spotter($this->db);
595
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
595
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
596 596
 			if ($year == '' && $month == '') {
597 597
 				$alliance_airlines = array();
598 598
 				foreach ($airlines as $airline) {
599
-					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
599
+					$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
600 600
 				}
601
-				if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
602
-				else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC";
601
+				if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
602
+				else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC";
603 603
 				try {
604 604
 					$sth = $this->db->prepare($query);
605 605
 					$sth->execute(array(':filter_name' => $filter_name));
606
-				} catch(PDOException $e) {
606
+				} catch (PDOException $e) {
607 607
 					echo "error : ".$e->getMessage();
608 608
 				}
609 609
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -614,45 +614,45 @@  discard block
 block discarded – undo
614 614
 				else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
615 615
 				try {
616 616
 					$sth = $this->db->prepare($query);
617
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
618
-				} catch(PDOException $e) {
617
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
618
+				} catch (PDOException $e) {
619 619
 					echo "error : ".$e->getMessage();
620 620
 				}
621 621
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
622 622
 			} else $all = array();
623 623
 		}
624 624
 		if (empty($all)) {
625
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
626
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
625
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
626
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
627 627
 			} else {
628
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
628
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
629 629
 			}
630 630
 			if ($filter_name != '') {
631
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
631
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
632 632
 			}
633 633
 			$Spotter = new Spotter($this->db);
634 634
 			//$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month);
635
-			$all = $Spotter->countAllOwners($limit,0,'',$filters);
635
+			$all = $Spotter->countAllOwners($limit, 0, '', $filters);
636 636
 		}
637 637
 		return $all;
638 638
 	}
639
-	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
639
+	public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
640 640
 		global $globalStatsFilters;
641 641
 		if ($filter_name == '') $filter_name = $this->filter_name;
642
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
642
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
643 643
 			$Spotter = new Spotter($this->db);
644
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
644
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
645 645
 			if ($year == '' && $month == '') {
646 646
 				$alliance_airlines = array();
647 647
 				foreach ($airlines as $airline) {
648
-					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
648
+					$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
649 649
 				}
650
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
651
-				else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
650
+				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
651
+				else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
652 652
 				try {
653 653
 					$sth = $this->db->prepare($query);
654 654
 					$sth->execute(array(':filter_name' => $filter_name));
655
-				} catch(PDOException $e) {
655
+				} catch (PDOException $e) {
656 656
 					echo "error : ".$e->getMessage();
657 657
 				}
658 658
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -663,27 +663,27 @@  discard block
 block discarded – undo
663 663
 				else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
664 664
 				try {
665 665
 					$sth = $this->db->prepare($query);
666
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
667
-				} catch(PDOException $e) {
666
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
667
+				} catch (PDOException $e) {
668 668
 					echo "error : ".$e->getMessage();
669 669
 				}
670 670
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
671 671
 			} else $all = array();
672 672
 		}
673 673
 		if (empty($all)) {
674
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
675
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
674
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
675
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
676 676
 			} else {
677
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
677
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
678 678
 			}
679 679
 			if ($filter_name != '') {
680
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
680
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
681 681
 			}
682 682
 			$Spotter = new Spotter($this->db);
683 683
 //            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month);
684 684
   //      		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month);
685
-			$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters);
686
-			$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters);
685
+			$pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters);
686
+			$dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters);
687 687
 			$all = array();
688 688
 			foreach ($pall as $value) {
689 689
 				$icao = $value['airport_departure_icao'];
@@ -699,27 +699,27 @@  discard block
 block discarded – undo
699 699
 			foreach ($all as $key => $row) {
700 700
 				$count[$key] = $row['airport_departure_icao_count'];
701 701
 			}
702
-			array_multisort($count,SORT_DESC,$all);
702
+			array_multisort($count, SORT_DESC, $all);
703 703
 		}
704 704
 		return $all;
705 705
 	}
706
-	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
706
+	public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
707 707
 		global $globalStatsFilters;
708 708
 		if ($filter_name == '') $filter_name = $this->filter_name;
709
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
709
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
710 710
 			$Spotter = new Spotter($this->db);
711
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
711
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
712 712
 			if ($year == '' && $month == '') {
713 713
 				$alliance_airlines = array();
714 714
 				foreach ($airlines as $airline) {
715
-					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
715
+					$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
716 716
 				}
717
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
718
-				else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
717
+				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
718
+				else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
719 719
 				try {
720 720
 					$sth = $this->db->prepare($query);
721 721
 					$sth->execute(array(':filter_name' => $filter_name));
722
-				} catch(PDOException $e) {
722
+				} catch (PDOException $e) {
723 723
 					echo "error : ".$e->getMessage();
724 724
 				}
725 725
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -730,27 +730,27 @@  discard block
 block discarded – undo
730 730
 				else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
731 731
 				try {
732 732
 					$sth = $this->db->prepare($query);
733
-					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
734
-				} catch(PDOException $e) {
733
+					$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
734
+				} catch (PDOException $e) {
735 735
 					echo "error : ".$e->getMessage();
736 736
 				}
737 737
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
738 738
 			} else $all = array();
739 739
 		}
740 740
 		if (empty($all)) {
741
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
742
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
741
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
742
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
743 743
 			} else {
744
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
744
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
745 745
 			}
746 746
 			if ($filter_name != '') {
747
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
747
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
748 748
 			}
749 749
 			$Spotter = new Spotter($this->db);
750 750
 //			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month);
751 751
 //			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month);
752
-			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters);
753
-			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters);
752
+			$pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters);
753
+			$dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters);
754 754
 			$all = array();
755 755
 			foreach ($pall as $value) {
756 756
 				$icao = $value['airport_arrival_icao'];
@@ -766,26 +766,26 @@  discard block
 block discarded – undo
766 766
 			foreach ($all as $key => $row) {
767 767
 				$count[$key] = $row['airport_arrival_icao_count'];
768 768
 			}
769
-			array_multisort($count,SORT_DESC,$all);
769
+			array_multisort($count, SORT_DESC, $all);
770 770
 		}
771 771
 		return $all;
772 772
 	}
773
-	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
773
+	public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') {
774 774
 		global $globalDBdriver, $globalStatsFilters;
775 775
 		if ($filter_name == '') $filter_name = $this->filter_name;
776
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
776
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
777 777
 			$Spotter = new Spotter($this->db);
778
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
778
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
779 779
 			$alliance_airlines = array();
780 780
 			foreach ($airlines as $airline) {
781
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
781
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
782 782
 			}
783 783
 			if ($globalDBdriver == 'mysql') {
784
-				if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
785
-				else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
784
+				if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
785
+				else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
786 786
 			} else {
787
-				if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
788
-				else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
787
+				if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
788
+				else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
789 789
 			}
790 790
 			$query_data = array(':filter_name' => $filter_name);
791 791
 		} else {
@@ -796,23 +796,23 @@  discard block
 block discarded – undo
796 796
 				if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
797 797
 				else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
798 798
 			}
799
-			$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
799
+			$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
800 800
 		}
801 801
 		try {
802 802
 			$sth = $this->db->prepare($query);
803 803
 			$sth->execute($query_data);
804
-		} catch(PDOException $e) {
804
+		} catch (PDOException $e) {
805 805
 			echo "error : ".$e->getMessage();
806 806
 		}
807 807
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
808 808
 		if (empty($all)) {
809
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
810
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
809
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
810
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
811 811
 			} else {
812 812
 				$filters = array('airlines' => array($stats_airline));
813 813
 			}
814 814
 			if ($filter_name != '') {
815
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
815
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
816 816
 			}
817 817
 			$Spotter = new Spotter($this->db);
818 818
 			$all = $Spotter->countAllMonthsLastYear($filters);
@@ -820,57 +820,57 @@  discard block
 block discarded – undo
820 820
 		return $all;
821 821
 	}
822 822
 	
823
-	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
823
+	public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') {
824 824
 		global $globalStatsFilters;
825 825
 		if ($filter_name == '') $filter_name = $this->filter_name;
826
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
826
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
827 827
 			$Spotter = new Spotter($this->db);
828
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
828
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
829 829
 			$alliance_airlines = array();
830 830
 			foreach ($airlines as $airline) {
831
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
831
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
832 832
 			}
833
-			$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline  IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
833
+			$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline  IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
834 834
 			$query_data = array(':filter_name' => $filter_name);
835 835
 		} else {
836 836
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name";
837
-			$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
837
+			$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
838 838
 		}
839 839
 		try {
840 840
 			$sth = $this->db->prepare($query);
841 841
 			$sth->execute($query_data);
842
-		} catch(PDOException $e) {
842
+		} catch (PDOException $e) {
843 843
 			echo "error : ".$e->getMessage();
844 844
 		}
845 845
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
846 846
 		if (empty($all)) {
847
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
848
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
847
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
848
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
849 849
 			} else {
850 850
 				$filters = array('airlines' => array($stats_airline));
851 851
 			}
852 852
 			if ($filter_name != '') {
853
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
853
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
854 854
 			}
855 855
 			$Spotter = new Spotter($this->db);
856 856
 			$all = $Spotter->countAllDatesLastMonth($filters);
857 857
 		}
858 858
 		return $all;
859 859
 	}
860
-	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
860
+	public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') {
861 861
 		global $globalDBdriver, $globalStatsFilters;
862 862
 		if ($filter_name == '') $filter_name = $this->filter_name;
863
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
863
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
864 864
 			$Spotter = new Spotter($this->db);
865
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
865
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
866 866
 			$alliance_airlines = array();
867 867
 			foreach ($airlines as $airline) {
868
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
868
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
869 869
 			}
870 870
 			if ($globalDBdriver == 'mysql') {
871
-				$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
871
+				$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
872 872
 			} else {
873
-				$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
873
+				$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
874 874
 			}
875 875
 			$query_data = array(':filter_name' => $filter_name);
876 876
 		} else {
@@ -879,60 +879,60 @@  discard block
 block discarded – undo
879 879
 			} else {
880 880
 				$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
881 881
 			}
882
-			$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
882
+			$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
883 883
 		}
884 884
 		try {
885 885
 			$sth = $this->db->prepare($query);
886 886
 			$sth->execute($query_data);
887
-		} catch(PDOException $e) {
887
+		} catch (PDOException $e) {
888 888
 			echo "error : ".$e->getMessage();
889 889
 		}
890 890
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
891 891
 		if (empty($all)) {
892
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
893
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
892
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
893
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
894 894
 			} else {
895 895
 				$filters = array('airlines' => array($stats_airline));
896 896
 			}
897 897
 			if ($filter_name != '') {
898
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
898
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
899 899
 			}
900 900
 			$Spotter = new Spotter($this->db);
901 901
 			$all = $Spotter->countAllDatesLast7Days($filters);
902 902
 		}
903 903
 		return $all;
904 904
 	}
905
-	public function countAllDates($stats_airline = '',$filter_name = '') {
905
+	public function countAllDates($stats_airline = '', $filter_name = '') {
906 906
 		global $globalStatsFilters;
907 907
 		if ($filter_name == '') $filter_name = $this->filter_name;
908
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
908
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
909 909
 			$Spotter = new Spotter($this->db);
910
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
910
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
911 911
 			$alliance_airlines = array();
912 912
 			foreach ($airlines as $airline) {
913
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
913
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
914 914
 			}
915
-			$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC";
915
+			$query = "SELECT flight_date as date_name, SUM(cnt) as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date ORDER BY date_count DESC";
916 916
 			$query_data = array(':filter_name' => $filter_name);
917 917
 		} else {
918 918
 			$query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date_count DESC";
919
-			$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
919
+			$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
920 920
 		}
921 921
 		try {
922 922
 			$sth = $this->db->prepare($query);
923 923
 			$sth->execute($query_data);
924
-		} catch(PDOException $e) {
924
+		} catch (PDOException $e) {
925 925
 			echo "error : ".$e->getMessage();
926 926
 		}
927 927
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
928 928
 		if (empty($all)) {
929
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
930
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
929
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
930
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
931 931
 			} else {
932 932
 				$filters = array('airlines' => array($stats_airline));
933 933
 			}
934 934
 			if ($filter_name != '') {
935
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
935
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
936 936
 			}
937 937
 			$Spotter = new Spotter($this->db);
938 938
 			$all = $Spotter->countAllDates($filters);
@@ -947,34 +947,34 @@  discard block
 block discarded – undo
947 947
 		try {
948 948
 			$sth = $this->db->prepare($query);
949 949
 			$sth->execute($query_data);
950
-		} catch(PDOException $e) {
950
+		} catch (PDOException $e) {
951 951
 			echo "error : ".$e->getMessage();
952 952
 		}
953 953
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
954 954
 		if (empty($all)) {
955 955
 			$filters = array();
956 956
 			if ($filter_name != '') {
957
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
957
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
958 958
 			}
959 959
 			$Spotter = new Spotter($this->db);
960 960
 			$all = $Spotter->countAllDatesByAirlines($filters);
961 961
 		}
962 962
 		return $all;
963 963
 	}
964
-	public function countAllMonths($stats_airline = '',$filter_name = '') {
964
+	public function countAllMonths($stats_airline = '', $filter_name = '') {
965 965
 		global $globalStatsFilters, $globalDBdriver;
966 966
 		if ($filter_name == '') $filter_name = $this->filter_name;
967
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
967
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
968 968
 			$Spotter = new Spotter($this->db);
969
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
969
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
970 970
 			$alliance_airlines = array();
971 971
 			foreach ($airlines as $airline) {
972
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
972
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
973 973
 			}
974 974
 			if ($globalDBdriver == 'mysql') {
975
-				$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC";
975
+				$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC";
976 976
 			} else {
977
-				$query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC";
977
+				$query = "SELECT EXTRACT(YEAR FROM stats_date) AS year_name,EXTRACT(MONTH FROM stats_date) AS month_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date ORDER BY date_count DESC";
978 978
 			}
979 979
 			$query_data = array(':filter_name' => $filter_name);
980 980
 		} else {
@@ -988,18 +988,18 @@  discard block
 block discarded – undo
988 988
 		try {
989 989
 			$sth = $this->db->prepare($query);
990 990
 			$sth->execute($query_data);
991
-		} catch(PDOException $e) {
991
+		} catch (PDOException $e) {
992 992
 			echo "error : ".$e->getMessage();
993 993
 		}
994 994
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
995 995
 		if (empty($all)) {
996
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
997
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
996
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
997
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
998 998
 			} else {
999 999
 				$filters = array('airlines' => array($stats_airline));
1000 1000
 			}
1001 1001
 			if ($filter_name != '') {
1002
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1002
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1003 1003
 			}
1004 1004
 			$Spotter = new Spotter($this->db);
1005 1005
 			$all = $Spotter->countAllMonths($filters);
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 		try {
1017 1017
 			$sth = $this->db->prepare($query);
1018 1018
 			$sth->execute();
1019
-		} catch(PDOException $e) {
1019
+		} catch (PDOException $e) {
1020 1020
 			echo "error : ".$e->getMessage();
1021 1021
 		}
1022 1022
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 		try {
1037 1037
 			$sth = $this->db->prepare($query);
1038 1038
 			$sth->execute();
1039
-		} catch(PDOException $e) {
1039
+		} catch (PDOException $e) {
1040 1040
 			echo "error : ".$e->getMessage();
1041 1041
 		}
1042 1042
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1053,32 +1053,32 @@  discard block
 block discarded – undo
1053 1053
 		try {
1054 1054
 			$sth = $this->db->prepare($query);
1055 1055
 			$sth->execute(array(':filter_name' => $filter_name));
1056
-		} catch(PDOException $e) {
1056
+		} catch (PDOException $e) {
1057 1057
 			echo "error : ".$e->getMessage();
1058 1058
 		}
1059 1059
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1060 1060
 		if (empty($all)) {
1061 1061
 			$filters = array();
1062 1062
 			if ($filter_name != '') {
1063
-					$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1063
+					$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1064 1064
 			}
1065 1065
 			$Spotter = new Spotter($this->db);
1066 1066
 			$all = $Spotter->countAllMilitaryMonths($filters);
1067 1067
 		}
1068 1068
 		return $all;
1069 1069
 	}
1070
-	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
1070
+	public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') {
1071 1071
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
1072 1072
 		if ($filter_name == '') $filter_name = $this->filter_name;
1073
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1073
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1074 1074
 			$Spotter = new Spotter($this->db);
1075
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1075
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1076 1076
 			$alliance_airlines = array();
1077 1077
 			foreach ($airlines as $airline) {
1078
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1078
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1079 1079
 			}
1080
-			if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1081
-			else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1080
+			if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1081
+			else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1082 1082
 			$query_data = array(':filter_name' => $filter_name);
1083 1083
 		} else {
1084 1084
 			if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -1096,37 +1096,37 @@  discard block
 block discarded – undo
1096 1096
 		try {
1097 1097
 			$sth = $this->db->prepare($query);
1098 1098
 			$sth->execute($query_data);
1099
-		} catch(PDOException $e) {
1099
+		} catch (PDOException $e) {
1100 1100
 			echo "error : ".$e->getMessage();
1101 1101
 		}
1102 1102
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1103 1103
 		if (empty($all)) {
1104
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1105
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1104
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1105
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1106 1106
 			} else {
1107 1107
 				$filters = array('airlines' => array($stats_airline));
1108 1108
 			}
1109 1109
 			if ($filter_name != '') {
1110
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1110
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1111 1111
 			}
1112 1112
 			$Spotter = new Spotter($this->db);
1113
-			$all = $Spotter->countAllHours($orderby,$filters);
1113
+			$all = $Spotter->countAllHours($orderby, $filters);
1114 1114
 		}
1115 1115
 		return $all;
1116 1116
 	}
1117
-	public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') {
1117
+	public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') {
1118 1118
 		global $globalStatsFilters;
1119 1119
 		if ($filter_name == '') $filter_name = $this->filter_name;
1120 1120
 		if ($year == '') $year = date('Y');
1121
-		$all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month);
1121
+		$all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month);
1122 1122
 		if (empty($all)) {
1123
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1124
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
1123
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1124
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
1125 1125
 			} else {
1126
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
1126
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
1127 1127
 			}
1128 1128
 			if ($filter_name != '') {
1129
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1129
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1130 1130
 			}
1131 1131
 			$Spotter = new Spotter($this->db);
1132 1132
 			//$all = $Spotter->countOverallFlights($filters,$year,$month);
@@ -1134,16 +1134,16 @@  discard block
 block discarded – undo
1134 1134
 		}
1135 1135
 		return $all;
1136 1136
 	}
1137
-	public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') {
1137
+	public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') {
1138 1138
 		global $globalStatsFilters;
1139 1139
 		if ($filter_name == '') $filter_name = $this->filter_name;
1140 1140
 		if ($year == '') $year = date('Y');
1141
-		$all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month);
1141
+		$all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month);
1142 1142
 		if (empty($all)) {
1143 1143
 			$filters = array();
1144
-			$filters = array('year' => $year,'month' => $month);
1144
+			$filters = array('year' => $year, 'month' => $month);
1145 1145
 			if ($filter_name != '') {
1146
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1146
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1147 1147
 			}
1148 1148
 			$Spotter = new Spotter($this->db);
1149 1149
 			//$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month);
@@ -1151,19 +1151,19 @@  discard block
 block discarded – undo
1151 1151
 		}
1152 1152
 		return $all;
1153 1153
 	}
1154
-	public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') {
1154
+	public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') {
1155 1155
 		global $globalStatsFilters;
1156 1156
 		if ($filter_name == '') $filter_name = $this->filter_name;
1157 1157
 		if ($year == '') $year = date('Y');
1158
-		$all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month);
1158
+		$all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month);
1159 1159
 		if (empty($all)) {
1160
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1161
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
1160
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1161
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
1162 1162
 			} else {
1163
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
1163
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
1164 1164
 			}
1165 1165
 			if ($filter_name != '') {
1166
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1166
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1167 1167
 			}
1168 1168
 			$Spotter = new Spotter($this->db);
1169 1169
 			//$all = $Spotter->countOverallArrival($filters,$year,$month);
@@ -1171,48 +1171,48 @@  discard block
 block discarded – undo
1171 1171
 		}
1172 1172
 		return $all;
1173 1173
 	}
1174
-	public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') {
1174
+	public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') {
1175 1175
 		global $globalStatsFilters;
1176 1176
 		if ($filter_name == '') $filter_name = $this->filter_name;
1177
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1177
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1178 1178
 			$Spotter = new Spotter($this->db);
1179
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1179
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1180 1180
 			if ($year == '' && $month == '') {
1181 1181
 				$alliance_airlines = array();
1182 1182
 				foreach ($airlines as $airline) {
1183
-					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1183
+					$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1184 1184
 				}
1185
-				$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1185
+				$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1186 1186
 				try {
1187 1187
 					$sth = $this->db->prepare($query);
1188 1188
 					$sth->execute(array(':filter_name' => $filter_name));
1189
-				} catch(PDOException $e) {
1189
+				} catch (PDOException $e) {
1190 1190
 					echo "error : ".$e->getMessage();
1191 1191
 				}
1192 1192
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1193 1193
 				$all = $result[0]['nb'];
1194
-			} else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1194
+			} else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month);
1195 1195
 		} else {
1196 1196
 			if ($year == '' && $month == '') {
1197 1197
 				$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
1198 1198
 				try {
1199 1199
 					$sth = $this->db->prepare($query);
1200
-					$sth->execute(array(':filter_name' => $filter_name,':stats_airline' => $stats_airline));
1201
-				} catch(PDOException $e) {
1200
+					$sth->execute(array(':filter_name' => $filter_name, ':stats_airline' => $stats_airline));
1201
+				} catch (PDOException $e) {
1202 1202
 					echo "error : ".$e->getMessage();
1203 1203
 				}
1204 1204
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1205 1205
 				$all = $result[0]['nb'];
1206
-			} else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1206
+			} else $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month);
1207 1207
 		}
1208 1208
 		if (empty($all)) {
1209
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1210
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
1209
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1210
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
1211 1211
 			} else {
1212
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
1212
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
1213 1213
 			}
1214 1214
 			if ($filter_name != '') {
1215
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1215
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1216 1216
 			}
1217 1217
 			$Spotter = new Spotter($this->db);
1218 1218
 			//$all = $Spotter->countOverallAircrafts($filters,$year,$month);
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
 		}
1221 1221
 		return $all;
1222 1222
 	}
1223
-	public function countOverallAirlines($filter_name = '',$year = '',$month = '') {
1223
+	public function countOverallAirlines($filter_name = '', $year = '', $month = '') {
1224 1224
 		global $globalStatsFilters;
1225 1225
 		if ($filter_name == '') $filter_name = $this->filter_name;
1226 1226
 		if ($year == '' && $month == '') {
@@ -1228,17 +1228,17 @@  discard block
 block discarded – undo
1228 1228
 			try {
1229 1229
 				$sth = $this->db->prepare($query);
1230 1230
 				$sth->execute(array(':filter_name' => $filter_name));
1231
-			} catch(PDOException $e) {
1231
+			} catch (PDOException $e) {
1232 1232
 				echo "error : ".$e->getMessage();
1233 1233
 			}
1234 1234
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1235 1235
 			$all = $result[0]['nb_airline'];
1236
-		} else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
1236
+		} else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month);
1237 1237
 		if (empty($all)) {
1238 1238
 			$filters = array();
1239
-			$filters = array('year' => $year,'month' => $month);
1239
+			$filters = array('year' => $year, 'month' => $month);
1240 1240
 			if ($filter_name != '') {
1241
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1241
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1242 1242
 			}
1243 1243
 			$Spotter = new Spotter($this->db);
1244 1244
 			//$all = $Spotter->countOverallAirlines($filters,$year,$month);
@@ -1246,29 +1246,29 @@  discard block
 block discarded – undo
1246 1246
 		}
1247 1247
 		return $all;
1248 1248
 	}
1249
-	public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') {
1249
+	public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') {
1250 1250
 		global $globalStatsFilters;
1251 1251
 		if ($filter_name == '') $filter_name = $this->filter_name;
1252
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1252
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1253 1253
 			$Spotter = new Spotter($this->db);
1254
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1254
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1255 1255
 			if ($year == '' && $month == '') {
1256 1256
 				$alliance_airlines = array();
1257 1257
 				foreach ($airlines as $airline) {
1258
-					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1258
+					$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1259 1259
 				}
1260
-				$query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1260
+				$query = "SELECT count(*) as nb FROM stats_owner WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1261 1261
 				$query_values = array(':filter_name' => $filter_name);
1262 1262
 				try {
1263 1263
 					$sth = $this->db->prepare($query);
1264 1264
 					$sth->execute($query_values);
1265
-				} catch(PDOException $e) {
1265
+				} catch (PDOException $e) {
1266 1266
 					echo "error : ".$e->getMessage();
1267 1267
 				}
1268 1268
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1269 1269
 				$all = $result[0]['nb'];
1270 1270
 			} else {
1271
-				$all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month);
1271
+				$all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month);
1272 1272
 			}
1273 1273
 		} else {
1274 1274
 			if ($year == '' && $month == '') {
@@ -1277,23 +1277,23 @@  discard block
 block discarded – undo
1277 1277
 				try {
1278 1278
 					$sth = $this->db->prepare($query);
1279 1279
 					$sth->execute($query_values);
1280
-				} catch(PDOException $e) {
1280
+				} catch (PDOException $e) {
1281 1281
 					echo "error : ".$e->getMessage();
1282 1282
 				}
1283 1283
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1284 1284
 				$all = $result[0]['nb'];
1285 1285
 			} else {
1286
-				$all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month);
1286
+				$all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month);
1287 1287
 			}
1288 1288
 		}
1289 1289
 		if (empty($all)) {
1290
-			if (strpos($stats_airline,'alliance_') !== FALSE) {
1291
-				$filters = array('alliance' => str_replace('_',' ',str_replace('alliance_','',$stats_airline)),'year' => $year,'month' => $month);
1290
+			if (strpos($stats_airline, 'alliance_') !== FALSE) {
1291
+				$filters = array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)), 'year' => $year, 'month' => $month);
1292 1292
 			} else {
1293
-				$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
1293
+				$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
1294 1294
 			}
1295 1295
 			if ($filter_name != '') {
1296
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1296
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1297 1297
 			}
1298 1298
 			$Spotter = new Spotter($this->db);
1299 1299
 			//$all = $Spotter->countOverallOwners($filters,$year,$month);
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
 		}
1302 1302
 		return $all;
1303 1303
 	}
1304
-	public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') {
1304
+	public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') {
1305 1305
 		global $globalStatsFilters;
1306 1306
 		if ($filter_name == '') $filter_name = $this->filter_name;
1307 1307
 		//if ($year == '') $year = date('Y');
@@ -1311,18 +1311,18 @@  discard block
 block discarded – undo
1311 1311
 			try {
1312 1312
 				$sth = $this->db->prepare($query);
1313 1313
 				$sth->execute($query_values);
1314
-			} catch(PDOException $e) {
1314
+			} catch (PDOException $e) {
1315 1315
 				echo "error : ".$e->getMessage();
1316 1316
 			}
1317 1317
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1318 1318
 			$all = $result[0]['nb'];
1319 1319
 		} else {
1320
-			$all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month);
1320
+			$all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month);
1321 1321
 		}
1322 1322
 		if (empty($all)) {
1323
-			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
1323
+			$filters = array('airlines' => array($stats_airline), 'year' => $year, 'month' => $month);
1324 1324
 			if ($filter_name != '') {
1325
-				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
1325
+				$filters = array_merge($filters, $globalStatsFilters[$filter_name]);
1326 1326
 			}
1327 1327
 			$Spotter = new Spotter($this->db);
1328 1328
 			//$all = $Spotter->countOverallPilots($filters,$year,$month);
@@ -1331,104 +1331,104 @@  discard block
 block discarded – undo
1331 1331
 		return $all;
1332 1332
 	}
1333 1333
 
1334
-	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
1334
+	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') {
1335 1335
 		if ($filter_name == '') $filter_name = $this->filter_name;
1336
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1336
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1337 1337
 			$Spotter = new Spotter($this->db);
1338
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1338
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1339 1339
 			$alliance_airlines = array();
1340 1340
 			foreach ($airlines as $airline) {
1341
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1341
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1342 1342
 			}
1343
-			$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY date";
1344
-			$query_values = array(':airport_icao' => $airport_icao,':filter_name' => $filter_name);
1343
+			$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name ORDER BY date";
1344
+			$query_values = array(':airport_icao' => $airport_icao, ':filter_name' => $filter_name);
1345 1345
 		} else {
1346 1346
 			$query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date";
1347
-			$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1347
+			$query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1348 1348
 		}
1349 1349
 		try {
1350 1350
 			$sth = $this->db->prepare($query);
1351 1351
 			$sth->execute($query_values);
1352
-		} catch(PDOException $e) {
1352
+		} catch (PDOException $e) {
1353 1353
 			echo "error : ".$e->getMessage();
1354 1354
 		}
1355 1355
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1356 1356
 		return $all;
1357 1357
 	}
1358
-	public function getStats($type,$stats_airline = '', $filter_name = '') {
1358
+	public function getStats($type, $stats_airline = '', $filter_name = '') {
1359 1359
 		if ($filter_name == '') $filter_name = $this->filter_name;
1360 1360
 		$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
1361
-		$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1361
+		$query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1362 1362
 		try {
1363 1363
 			$sth = $this->db->prepare($query);
1364 1364
 			$sth->execute($query_values);
1365
-		} catch(PDOException $e) {
1365
+		} catch (PDOException $e) {
1366 1366
 			echo "error : ".$e->getMessage();
1367 1367
 		}
1368 1368
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1369 1369
 		return $all;
1370 1370
 	}
1371
-	public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') {
1371
+	public function deleteStatsByType($type, $stats_airline = '', $filter_name = '') {
1372 1372
 		if ($filter_name == '') $filter_name = $this->filter_name;
1373 1373
 		$query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name";
1374
-		$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1374
+		$query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1375 1375
 		try {
1376 1376
 			$sth = $this->db->prepare($query);
1377 1377
 			$sth->execute($query_values);
1378
-		} catch(PDOException $e) {
1378
+		} catch (PDOException $e) {
1379 1379
 			echo "error : ".$e->getMessage();
1380 1380
 		}
1381 1381
 	}
1382
-	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') {
1382
+	public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') {
1383 1383
 		if ($filter_name == '') $filter_name = $this->filter_name;
1384 1384
 		global $globalArchiveMonths, $globalDBdriver;
1385
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1385
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1386 1386
 			$Spotter = new Spotter($this->db);
1387
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1387
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1388 1388
 			$alliance_airlines = array();
1389 1389
 			foreach ($airlines as $airline) {
1390
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1390
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1391 1391
 			}
1392 1392
 			if ($globalDBdriver == 'mysql') {
1393 1393
 				if ($month == '') {
1394
-					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1394
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1395 1395
 					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name);
1396 1396
 				} else {
1397
-					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1398
-					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month);
1397
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1398
+					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month);
1399 1399
 				}
1400 1400
 			} else {
1401 1401
 				if ($month == '') {
1402
-					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1402
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1403 1403
 					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name);
1404 1404
 				} else {
1405
-					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1406
-					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name,':month' => $month);
1405
+					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1406
+					$query_values = array(':type' => $type, ':year' => $year, ':filter_name' => $filter_name, ':month' => $month);
1407 1407
 				}
1408 1408
 			}
1409 1409
 		} else {
1410 1410
 			if ($globalDBdriver == 'mysql') {
1411 1411
 				if ($month == '') {
1412 1412
 					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
1413
-					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1413
+					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1414 1414
 				} else {
1415 1415
 					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name";
1416
-					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month);
1416
+					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month);
1417 1417
 				}
1418 1418
 			} else {
1419 1419
 				if ($month == '') {
1420 1420
 					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name";
1421
-					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1421
+					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1422 1422
 				} else {
1423 1423
 					$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name";
1424
-					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month);
1424
+					$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month);
1425 1425
 				}
1426 1426
 			}
1427 1427
 		}
1428 1428
 		try {
1429 1429
 			$sth = $this->db->prepare($query);
1430 1430
 			$sth->execute($query_values);
1431
-		} catch(PDOException $e) {
1431
+		} catch (PDOException $e) {
1432 1432
 			echo "error : ".$e->getMessage();
1433 1433
 		}
1434 1434
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1437,17 +1437,17 @@  discard block
 block discarded – undo
1437 1437
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
1438 1438
 		global $globalArchiveMonths, $globalDBdriver;
1439 1439
 		if ($filter_name == '') $filter_name = $this->filter_name;
1440
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1440
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1441 1441
 			$Spotter = new Spotter($this->db);
1442
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1442
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1443 1443
 			$alliance_airlines = array();
1444 1444
 			foreach ($airlines as $airline) {
1445
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1445
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1446 1446
 			}
1447 1447
 			if ($globalDBdriver == 'mysql') {
1448
-				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1448
+				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1449 1449
 			} else {
1450
-				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1450
+				$query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1451 1451
 			}
1452 1452
 			$query_values = array(':type' => $type, ':filter_name' => $filter_name);
1453 1453
 		} else {
@@ -1461,7 +1461,7 @@  discard block
 block discarded – undo
1461 1461
 		try {
1462 1462
 			$sth = $this->db->prepare($query);
1463 1463
 			$sth->execute($query_values);
1464
-		} catch(PDOException $e) {
1464
+		} catch (PDOException $e) {
1465 1465
 			echo "error : ".$e->getMessage();
1466 1466
 		}
1467 1467
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1470,17 +1470,17 @@  discard block
 block discarded – undo
1470 1470
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
1471 1471
 		global $globalArchiveMonths, $globalDBdriver;
1472 1472
 		if ($filter_name == '') $filter_name = $this->filter_name;
1473
-		if (strpos($stats_airline,'alliance_') !== FALSE) {
1473
+		if (strpos($stats_airline, 'alliance_') !== FALSE) {
1474 1474
 			$Spotter = new Spotter($this->db);
1475
-			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
1475
+			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_', ' ', str_replace('alliance_', '', $stats_airline)));
1476 1476
 			$alliance_airlines = array();
1477 1477
 			foreach ($airlines as $airline) {
1478
-				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1478
+				$alliance_airlines = array_merge($alliance_airlines, array($airline['airline_icao']));
1479 1479
 			}
1480 1480
 			if ($globalDBdriver == 'mysql') {
1481
-				$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1481
+				$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1482 1482
 			} else {
1483
-				$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name";
1483
+				$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline IN ('".implode("','", $alliance_airlines)."') AND filter_name = :filter_name";
1484 1484
 			}
1485 1485
 		} else {
1486 1486
 			if ($globalDBdriver == 'mysql') {
@@ -1492,7 +1492,7 @@  discard block
 block discarded – undo
1492 1492
 		try {
1493 1493
 			$sth = $this->db->prepare($query);
1494 1494
 			$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
1495
-		} catch(PDOException $e) {
1495
+		} catch (PDOException $e) {
1496 1496
 			echo "error : ".$e->getMessage();
1497 1497
 		}
1498 1498
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1509,7 +1509,7 @@  discard block
 block discarded – undo
1509 1509
 		try {
1510 1510
 			$sth = $this->db->prepare($query);
1511 1511
 			$sth->execute(array(':filter_name' => $filter_name));
1512
-		} catch(PDOException $e) {
1512
+		} catch (PDOException $e) {
1513 1513
 			echo "error : ".$e->getMessage();
1514 1514
 		}
1515 1515
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1526,20 +1526,20 @@  discard block
 block discarded – undo
1526 1526
 		try {
1527 1527
 			$sth = $this->db->prepare($query);
1528 1528
 			$sth->execute(array(':filter_name' => $filter_name));
1529
-		} catch(PDOException $e) {
1529
+		} catch (PDOException $e) {
1530 1530
 			echo "error : ".$e->getMessage();
1531 1531
 		}
1532 1532
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1533 1533
 		return $all[0]['total'];
1534 1534
 	}
1535
-	public function getStatsOwner($owner_name,$filter_name = '') {
1535
+	public function getStatsOwner($owner_name, $filter_name = '') {
1536 1536
 		global $globalArchiveMonths, $globalDBdriver;
1537 1537
 		if ($filter_name == '') $filter_name = $this->filter_name;
1538 1538
 		$query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name";
1539 1539
 		try {
1540 1540
 			$sth = $this->db->prepare($query);
1541
-			$sth->execute(array(':filter_name' => $filter_name,':owner_name' => $owner_name));
1542
-		} catch(PDOException $e) {
1541
+			$sth->execute(array(':filter_name' => $filter_name, ':owner_name' => $owner_name));
1542
+		} catch (PDOException $e) {
1543 1543
 			echo "error : ".$e->getMessage();
1544 1544
 		}
1545 1545
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1557,20 +1557,20 @@  discard block
 block discarded – undo
1557 1557
 		try {
1558 1558
 			$sth = $this->db->prepare($query);
1559 1559
 			$sth->execute(array(':filter_name' => $filter_name));
1560
-		} catch(PDOException $e) {
1560
+		} catch (PDOException $e) {
1561 1561
 			echo "error : ".$e->getMessage();
1562 1562
 		}
1563 1563
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1564 1564
 		return $all[0]['total'];
1565 1565
 	}
1566
-	public function getStatsPilot($pilot,$filter_name = '') {
1566
+	public function getStatsPilot($pilot, $filter_name = '') {
1567 1567
 		global $globalArchiveMonths, $globalDBdriver;
1568 1568
 		if ($filter_name == '') $filter_name = $this->filter_name;
1569 1569
 		$query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)";
1570 1570
 		try {
1571 1571
 			$sth = $this->db->prepare($query);
1572
-			$sth->execute(array(':filter_name' => $filter_name,':pilot' => $pilot));
1573
-		} catch(PDOException $e) {
1572
+			$sth->execute(array(':filter_name' => $filter_name, ':pilot' => $pilot));
1573
+		} catch (PDOException $e) {
1574 1574
 			echo "error : ".$e->getMessage();
1575 1575
 		}
1576 1576
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -1578,7 +1578,7 @@  discard block
 block discarded – undo
1578 1578
 		else return 0;
1579 1579
 	}
1580 1580
 
1581
-	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1581
+	public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
1582 1582
 		global $globalDBdriver;
1583 1583
 		if ($filter_name == '') $filter_name = $this->filter_name;
1584 1584
 		if ($globalDBdriver == 'mysql') {
@@ -1586,15 +1586,15 @@  discard block
 block discarded – undo
1586 1586
 		} else {
1587 1587
 			$query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1588 1588
 		}
1589
-		$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1589
+		$query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1590 1590
 		try {
1591 1591
 			$sth = $this->db->prepare($query);
1592 1592
 			$sth->execute($query_values);
1593
-		} catch(PDOException $e) {
1593
+		} catch (PDOException $e) {
1594 1594
 			return "error : ".$e->getMessage();
1595 1595
 		}
1596 1596
 	}
1597
-	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1597
+	public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') {
1598 1598
 		global $globalDBdriver;
1599 1599
 		if ($filter_name == '') $filter_name = $this->filter_name;
1600 1600
 		if ($globalDBdriver == 'mysql') {
@@ -1603,11 +1603,11 @@  discard block
 block discarded – undo
1603 1603
 			//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
1604 1604
 			$query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE  stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1605 1605
 		}
1606
-		$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1606
+		$query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1607 1607
 		try {
1608 1608
 			$sth = $this->db->prepare($query);
1609 1609
 			$sth->execute($query_values);
1610
-		} catch(PDOException $e) {
1610
+		} catch (PDOException $e) {
1611 1611
 			return "error : ".$e->getMessage();
1612 1612
 		}
1613 1613
 	}
@@ -1631,75 +1631,75 @@  discard block
 block discarded – undo
1631 1631
         }
1632 1632
         */
1633 1633
 
1634
-	public function getStatsSource($stats_type,$year = '',$month = '',$day = '') {
1634
+	public function getStatsSource($stats_type, $year = '', $month = '', $day = '') {
1635 1635
 		global $globalDBdriver;
1636 1636
 		$query = "SELECT * FROM stats_source WHERE stats_type = :stats_type";
1637 1637
 		$query_values = array();
1638 1638
 		if ($globalDBdriver == 'mysql') {
1639 1639
 			if ($year != '') {
1640 1640
 				$query .= ' AND YEAR(stats_date) = :year';
1641
-				$query_values = array_merge($query_values,array(':year' => $year));
1641
+				$query_values = array_merge($query_values, array(':year' => $year));
1642 1642
 			}
1643 1643
 			if ($month != '') {
1644 1644
 				$query .= ' AND MONTH(stats_date) = :month';
1645
-				$query_values = array_merge($query_values,array(':month' => $month));
1645
+				$query_values = array_merge($query_values, array(':month' => $month));
1646 1646
 			}
1647 1647
 			if ($day != '') {
1648 1648
 				$query .= ' AND DAY(stats_date) = :day';
1649
-				$query_values = array_merge($query_values,array(':day' => $day));
1649
+				$query_values = array_merge($query_values, array(':day' => $day));
1650 1650
 			}
1651 1651
 		} else {
1652 1652
 			if ($year != '') {
1653 1653
 				$query .= ' AND EXTRACT(YEAR FROM stats_date) = :year';
1654
-				$query_values = array_merge($query_values,array(':year' => $year));
1654
+				$query_values = array_merge($query_values, array(':year' => $year));
1655 1655
 			}
1656 1656
 			if ($month != '') {
1657 1657
 				$query .= ' AND EXTRACT(MONTH FROM stats_date) = :month';
1658
-				$query_values = array_merge($query_values,array(':month' => $month));
1658
+				$query_values = array_merge($query_values, array(':month' => $month));
1659 1659
 			}
1660 1660
 			if ($day != '') {
1661 1661
 				$query .= ' AND EXTRACT(DAY FROM stats_date) = :day';
1662
-				$query_values = array_merge($query_values,array(':day' => $day));
1662
+				$query_values = array_merge($query_values, array(':day' => $day));
1663 1663
 			}
1664 1664
 		}
1665 1665
 		$query .= " ORDER BY source_name";
1666
-		$query_values = array_merge($query_values,array(':stats_type' => $stats_type));
1666
+		$query_values = array_merge($query_values, array(':stats_type' => $stats_type));
1667 1667
 		try {
1668 1668
 			$sth = $this->db->prepare($query);
1669 1669
 			$sth->execute($query_values);
1670
-		} catch(PDOException $e) {
1670
+		} catch (PDOException $e) {
1671 1671
 			echo "error : ".$e->getMessage();
1672 1672
 		}
1673 1673
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1674 1674
 		return $all;
1675 1675
 	}
1676 1676
 
1677
-	public function addStatSource($data,$source_name,$stats_type,$date) {
1677
+	public function addStatSource($data, $source_name, $stats_type, $date) {
1678 1678
 		global $globalDBdriver;
1679 1679
 		if ($globalDBdriver == 'mysql') {
1680 1680
 			$query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data";
1681 1681
 		} else {
1682 1682
 			$query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; 
1683 1683
 		}
1684
-		$query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
1684
+		$query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type);
1685 1685
 		try {
1686 1686
 			$sth = $this->db->prepare($query);
1687 1687
 			$sth->execute($query_values);
1688
-		} catch(PDOException $e) {
1688
+		} catch (PDOException $e) {
1689 1689
 			return "error : ".$e->getMessage();
1690 1690
 		}
1691 1691
 	}
1692
-	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
1692
+	public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') {
1693 1693
 		$query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
1694
-		$query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1694
+		$query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1695 1695
 		try {
1696 1696
 			$sth = $this->db->prepare($query);
1697 1697
 			$sth->execute($query_values);
1698
-		} catch(PDOException $e) {
1698
+		} catch (PDOException $e) {
1699 1699
 			return "error : ".$e->getMessage();
1700 1700
 		}
1701 1701
 	}
1702
-	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) {
1702
+	public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) {
1703 1703
 		global $globalDBdriver;
1704 1704
 		if ($globalDBdriver == 'mysql') {
1705 1705
 			if ($reset) {
@@ -1714,15 +1714,15 @@  discard block
 block discarded – undo
1714 1714
 				$query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1715 1715
 			}
1716 1716
 		}
1717
-		$query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1717
+		$query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1718 1718
 		try {
1719 1719
 			$sth = $this->db->prepare($query);
1720 1720
 			$sth->execute($query_values);
1721
-		} catch(PDOException $e) {
1721
+		} catch (PDOException $e) {
1722 1722
 			return "error : ".$e->getMessage();
1723 1723
 		}
1724 1724
 	}
1725
-	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) {
1725
+	public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) {
1726 1726
 		global $globalDBdriver;
1727 1727
 		if ($globalDBdriver == 'mysql') {
1728 1728
 			if ($reset) {
@@ -1737,15 +1737,15 @@  discard block
 block discarded – undo
1737 1737
 				$query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; 
1738 1738
 			}
1739 1739
 		}
1740
-		$query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1740
+		$query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name);
1741 1741
 		try {
1742 1742
 			$sth = $this->db->prepare($query);
1743 1743
 			$sth->execute($query_values);
1744
-		} catch(PDOException $e) {
1744
+		} catch (PDOException $e) {
1745 1745
 			return "error : ".$e->getMessage();
1746 1746
 		}
1747 1747
 	}
1748
-	public function addStatCountry($iso2,$iso3,$name,$cnt,$airline_icao = '',$filter_name = '',$reset = false) {
1748
+	public function addStatCountry($iso2, $iso3, $name, $cnt, $airline_icao = '', $filter_name = '', $reset = false) {
1749 1749
 		global $globalDBdriver;
1750 1750
 		if ($globalDBdriver == 'mysql') {
1751 1751
 			if ($reset) {
@@ -1760,15 +1760,15 @@  discard block
 block discarded – undo
1760 1760
 				$query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline; INSERT INTO stats_country (iso2,iso3,name,cnt,stats_airline,filter_name) SELECT :iso2,:iso3,:name,:cnt,:airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name AND stats_airline = :airline);"; 
1761 1761
 			}
1762 1762
 		}
1763
-		$query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name,':airline' => $airline_icao);
1763
+		$query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name, ':airline' => $airline_icao);
1764 1764
 		try {
1765 1765
 			$sth = $this->db->prepare($query);
1766 1766
 			$sth->execute($query_values);
1767
-		} catch(PDOException $e) {
1767
+		} catch (PDOException $e) {
1768 1768
 			return "error : ".$e->getMessage();
1769 1769
 		}
1770 1770
 	}
1771
-	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) {
1771
+	public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) {
1772 1772
 		global $globalDBdriver;
1773 1773
 		if ($globalDBdriver == 'mysql') {
1774 1774
 			if ($reset) {
@@ -1783,15 +1783,15 @@  discard block
 block discarded – undo
1783 1783
 				$query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1784 1784
 			}
1785 1785
 		}
1786
-		$query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1786
+		$query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1787 1787
 		try {
1788 1788
 			$sth = $this->db->prepare($query);
1789 1789
 			$sth->execute($query_values);
1790
-		} catch(PDOException $e) {
1790
+		} catch (PDOException $e) {
1791 1791
 			return "error : ".$e->getMessage();
1792 1792
 		}
1793 1793
 	}
1794
-	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) {
1794
+	public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) {
1795 1795
 		global $globalDBdriver;
1796 1796
 		if ($globalDBdriver == 'mysql') {
1797 1797
 			if ($reset) {
@@ -1806,15 +1806,15 @@  discard block
 block discarded – undo
1806 1806
 				$query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; 
1807 1807
 			}
1808 1808
 		}
1809
-		$query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1809
+		$query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name);
1810 1810
 		try {
1811 1811
 			$sth = $this->db->prepare($query);
1812 1812
 			$sth->execute($query_values);
1813
-		} catch(PDOException $e) {
1813
+		} catch (PDOException $e) {
1814 1814
 			return "error : ".$e->getMessage();
1815 1815
 		}
1816 1816
 	}
1817
-	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) {
1817
+	public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) {
1818 1818
 		global $globalDBdriver;
1819 1819
 		if ($globalDBdriver == 'mysql') {
1820 1820
 			if ($reset) {
@@ -1829,15 +1829,15 @@  discard block
 block discarded – undo
1829 1829
 				$query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1830 1830
 			}
1831 1831
 		}
1832
-		$query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1832
+		$query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1833 1833
 		try {
1834 1834
 			$sth = $this->db->prepare($query);
1835 1835
 			$sth->execute($query_values);
1836
-		} catch(PDOException $e) {
1836
+		} catch (PDOException $e) {
1837 1837
 			return "error : ".$e->getMessage();
1838 1838
 		}
1839 1839
 	}
1840
-	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) {
1840
+	public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) {
1841 1841
 		global $globalDBdriver;
1842 1842
 		if ($globalDBdriver == 'mysql') {
1843 1843
 			if ($reset) {
@@ -1852,15 +1852,15 @@  discard block
 block discarded – undo
1852 1852
 				$query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; 
1853 1853
 			}
1854 1854
 		}
1855
-		$query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source);
1855
+		$query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source);
1856 1856
 		try {
1857 1857
 			$sth = $this->db->prepare($query);
1858 1858
 			$sth->execute($query_values);
1859
-		} catch(PDOException $e) {
1859
+		} catch (PDOException $e) {
1860 1860
 			return "error : ".$e->getMessage();
1861 1861
 		}
1862 1862
 	}
1863
-	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) {
1863
+	public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) {
1864 1864
 		global $globalDBdriver;
1865 1865
 		if ($airport_icao != '') {
1866 1866
 			if ($globalDBdriver == 'mysql') {
@@ -1876,16 +1876,16 @@  discard block
 block discarded – undo
1876 1876
 					$query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1877 1877
 				}
1878 1878
 			}
1879
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1879
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1880 1880
 			try {
1881 1881
 				$sth = $this->db->prepare($query);
1882 1882
 				$sth->execute($query_values);
1883
-			} catch(PDOException $e) {
1883
+			} catch (PDOException $e) {
1884 1884
 				return "error : ".$e->getMessage();
1885 1885
 			}
1886 1886
 		}
1887 1887
 	}
1888
-	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1888
+	public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') {
1889 1889
 		global $globalDBdriver;
1890 1890
 		if ($airport_icao != '') {
1891 1891
 			if ($globalDBdriver == 'mysql') {
@@ -1893,16 +1893,16 @@  discard block
 block discarded – undo
1893 1893
 			} else {
1894 1894
 				$query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1895 1895
 			}
1896
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1896
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1897 1897
 			 try {
1898 1898
 				$sth = $this->db->prepare($query);
1899 1899
 				$sth->execute($query_values);
1900
-			} catch(PDOException $e) {
1900
+			} catch (PDOException $e) {
1901 1901
 				return "error : ".$e->getMessage();
1902 1902
 			}
1903 1903
 		}
1904 1904
 	}
1905
-	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) {
1905
+	public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) {
1906 1906
 		global $globalDBdriver;
1907 1907
 		if ($airport_icao != '') {
1908 1908
 			if ($globalDBdriver == 'mysql') {
@@ -1918,16 +1918,16 @@  discard block
 block discarded – undo
1918 1918
 					$query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; 
1919 1919
 				}
1920 1920
 			}
1921
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1921
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1922 1922
 			try {
1923 1923
 				$sth = $this->db->prepare($query);
1924 1924
 				$sth->execute($query_values);
1925
-			} catch(PDOException $e) {
1925
+			} catch (PDOException $e) {
1926 1926
 				return "error : ".$e->getMessage();
1927 1927
 			}
1928 1928
 		}
1929 1929
 	}
1930
-	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1930
+	public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') {
1931 1931
 		global $globalDBdriver;
1932 1932
 		if ($airport_icao != '') {
1933 1933
 			if ($globalDBdriver == 'mysql') {
@@ -1935,11 +1935,11 @@  discard block
 block discarded – undo
1935 1935
 			} else {
1936 1936
 				$query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; 
1937 1937
 			}
1938
-			$query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name);
1938
+			$query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1939 1939
 			try {
1940 1940
 				$sth = $this->db->prepare($query);
1941 1941
 				$sth->execute($query_values);
1942
-			} catch(PDOException $e) {
1942
+			} catch (PDOException $e) {
1943 1943
 				return "error : ".$e->getMessage();
1944 1944
 			}
1945 1945
 		}
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
 		try {
1952 1952
 			$sth = $this->db->prepare($query);
1953 1953
 			$sth->execute($query_values);
1954
-		} catch(PDOException $e) {
1954
+		} catch (PDOException $e) {
1955 1955
 			return "error : ".$e->getMessage();
1956 1956
 		}
1957 1957
 	}
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
 		try {
1962 1962
 			$sth = $this->db->prepare($query);
1963 1963
 			$sth->execute($query_values);
1964
-		} catch(PDOException $e) {
1964
+		} catch (PDOException $e) {
1965 1965
 			return "error : ".$e->getMessage();
1966 1966
 		}
1967 1967
 	}
@@ -1971,13 +1971,13 @@  discard block
 block discarded – undo
1971 1971
 		try {
1972 1972
 			$sth = $this->db->prepare($query);
1973 1973
 			$sth->execute($query_values);
1974
-		} catch(PDOException $e) {
1974
+		} catch (PDOException $e) {
1975 1975
 			return "error : ".$e->getMessage();
1976 1976
 		}
1977 1977
 	}
1978 1978
 
1979 1979
 	public function addOldStats() {
1980
-		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear, $globalAccidents;
1980
+		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear, $globalAccidents;
1981 1981
 		$Common = new Common();
1982 1982
 		$Connection = new Connection();
1983 1983
 		date_default_timezone_set('UTC');
@@ -1995,41 +1995,41 @@  discard block
 block discarded – undo
1995 1995
 			$Spotter = new Spotter($this->db);
1996 1996
 
1997 1997
 			if ($globalDebug) echo 'Count all aircraft types...'."\n";
1998
-			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1998
+			$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day);
1999 1999
 			foreach ($alldata as $number) {
2000
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset);
2000
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset);
2001 2001
 			}
2002 2002
 			if ($globalDebug) echo 'Count all airlines...'."\n";
2003
-			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
2003
+			$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day);
2004 2004
 			foreach ($alldata as $number) {
2005
-				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset);
2005
+				$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset);
2006 2006
 			}
2007 2007
 			if ($globalDebug) echo 'Count all registrations...'."\n";
2008
-			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
2008
+			$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day);
2009 2009
 			foreach ($alldata as $number) {
2010
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset);
2010
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset);
2011 2011
 			}
2012 2012
 			if ($globalDebug) echo 'Count all callsigns...'."\n";
2013
-			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
2013
+			$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day);
2014 2014
 			foreach ($alldata as $number) {
2015
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
2015
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset);
2016 2016
 			}
2017 2017
 			if ($globalDebug) echo 'Count all owners...'."\n";
2018
-			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
2018
+			$alldata = $Spotter->countAllOwners(false, 0, $last_update_day);
2019 2019
 			foreach ($alldata as $number) {
2020
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset);
2020
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset);
2021 2021
 			}
2022 2022
 			if ($globalDebug) echo 'Count all pilots...'."\n";
2023
-			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
2023
+			$alldata = $Spotter->countAllPilots(false, 0, $last_update_day);
2024 2024
 			foreach ($alldata as $number) {
2025 2025
 				if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name'];
2026
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset);
2026
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset);
2027 2027
 			}
2028 2028
 			
2029 2029
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
2030
-			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
2030
+			$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day);
2031 2031
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
2032
-			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
2032
+			$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day);
2033 2033
 			if ($globalDebug) echo 'Order departure airports...'."\n";
2034 2034
 			$alldata = array();
2035 2035
 			foreach ($pall as $value) {
@@ -2046,14 +2046,14 @@  discard block
 block discarded – undo
2046 2046
 			foreach ($alldata as $key => $row) {
2047 2047
 				$count[$key] = $row['airport_departure_icao_count'];
2048 2048
 			}
2049
-			array_multisort($count,SORT_DESC,$alldata);
2049
+			array_multisort($count, SORT_DESC, $alldata);
2050 2050
 			foreach ($alldata as $number) {
2051
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset);
2051
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', '', $reset);
2052 2052
 			}
2053 2053
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
2054
-			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
2054
+			$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day);
2055 2055
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
2056
-			$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
2056
+			$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day);
2057 2057
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
2058 2058
 			$alldata = array();
2059 2059
 			foreach ($pall as $value) {
@@ -2070,18 +2070,18 @@  discard block
 block discarded – undo
2070 2070
 			foreach ($alldata as $key => $row) {
2071 2071
 				$count[$key] = $row['airport_arrival_icao_count'];
2072 2072
 			}
2073
-			array_multisort($count,SORT_DESC,$alldata);
2073
+			array_multisort($count, SORT_DESC, $alldata);
2074 2074
 			foreach ($alldata as $number) {
2075
-				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset);
2075
+				echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', '', $reset);
2076 2076
 			}
2077 2077
 			if ($Connection->tableExists('countries')) {
2078 2078
 				if ($globalDebug) echo 'Count all flights by countries...'."\n";
2079 2079
 				//$SpotterArchive = new SpotterArchive();
2080 2080
 				//$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
2081 2081
 				$Spotter = new Spotter($this->db);
2082
-				$alldata = $Spotter->countAllFlightOverCountries(false,0,$last_update_day);
2082
+				$alldata = $Spotter->countAllFlightOverCountries(false, 0, $last_update_day);
2083 2083
 				foreach ($alldata as $number) {
2084
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'','',$reset);
2084
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', '', $reset);
2085 2085
 				}
2086 2086
 			}
2087 2087
 			
@@ -2091,12 +2091,12 @@  discard block
 block discarded – undo
2091 2091
 				$this->deleteStatsByType('fatalities_byyear');
2092 2092
 				$alldata = $Accident->countFatalitiesByYear();
2093 2093
 				foreach ($alldata as $number) {
2094
-					$this->addStat('fatalities_byyear',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,1,1,$number['year'])));
2094
+					$this->addStat('fatalities_byyear', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, 1, 1, $number['year'])));
2095 2095
 				}
2096 2096
 				$this->deleteStatsByType('fatalities_bymonth');
2097 2097
 				$alldata = $Accident->countFatalitiesLast12Months();
2098 2098
 				foreach ($alldata as $number) {
2099
-					$this->addStat('fatalities_bymonth',$number['count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month'],1,$number['year'])));
2099
+					$this->addStat('fatalities_bymonth', $number['count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month'], 1, $number['year'])));
2100 2100
 				}
2101 2101
 			}
2102 2102
 
@@ -2110,37 +2110,37 @@  discard block
 block discarded – undo
2110 2110
 			$lastyear = false;
2111 2111
 			foreach ($alldata as $number) {
2112 2112
 				if ($number['year_name'] != date('Y')) $lastyear = true;
2113
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2113
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2114 2114
 			}
2115 2115
 			if ($globalDebug) echo 'Count all military flights by months...'."\n";
2116 2116
 			$alldata = $Spotter->countAllMilitaryMonths($filter_last_month);
2117 2117
 			foreach ($alldata as $number) {
2118
-				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2118
+				$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2119 2119
 			}
2120 2120
 			if ($globalDebug) echo 'Count all owners by months...'."\n";
2121 2121
 			$alldata = $Spotter->countAllMonthsOwners($filter_last_month);
2122 2122
 			foreach ($alldata as $number) {
2123
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2123
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2124 2124
 			}
2125 2125
 			if ($globalDebug) echo 'Count all pilots by months...'."\n";
2126 2126
 			$alldata = $Spotter->countAllMonthsPilots($filter_last_month);
2127 2127
 			foreach ($alldata as $number) {
2128
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2128
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2129 2129
 			}
2130 2130
 			if ($globalDebug) echo 'Count all airlines by months...'."\n";
2131 2131
 			$alldata = $Spotter->countAllMonthsAirlines($filter_last_month);
2132 2132
 			foreach ($alldata as $number) {
2133
-				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2133
+				$this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2134 2134
 			}
2135 2135
 			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
2136 2136
 			$alldata = $Spotter->countAllMonthsAircrafts($filter_last_month);
2137 2137
 			foreach ($alldata as $number) {
2138
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2138
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2139 2139
 			}
2140 2140
 			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
2141 2141
 			$alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month);
2142 2142
 			foreach ($alldata as $number) {
2143
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2143
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])));
2144 2144
 			}
2145 2145
 			if ($globalDebug) echo 'Airports data...'."\n";
2146 2146
 			if ($globalDebug) echo '...Departure'."\n";
@@ -2185,7 +2185,7 @@  discard block
 block discarded – undo
2185 2185
 			}
2186 2186
 			$alldata = $pall;
2187 2187
 			foreach ($alldata as $number) {
2188
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
2188
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']);
2189 2189
 			}
2190 2190
 			echo '...Arrival'."\n";
2191 2191
 			$pall = $Spotter->getLast7DaysAirportsArrival();
@@ -2226,7 +2226,7 @@  discard block
 block discarded – undo
2226 2226
 			}
2227 2227
 			$alldata = $pall;
2228 2228
 			foreach ($alldata as $number) {
2229
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
2229
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']);
2230 2230
 			}
2231 2231
 
2232 2232
 			echo 'Flights data...'."\n";
@@ -2234,28 +2234,28 @@  discard block
 block discarded – undo
2234 2234
 			echo '-> countAllDatesLastMonth...'."\n";
2235 2235
 			$alldata = $Spotter->countAllDatesLastMonth($filter_last_month);
2236 2236
 			foreach ($alldata as $number) {
2237
-				$this->addStatFlight('month',$number['date_name'],$number['date_count']);
2237
+				$this->addStatFlight('month', $number['date_name'], $number['date_count']);
2238 2238
 			}
2239 2239
 			echo '-> countAllDates...'."\n";
2240 2240
 			$previousdata = $this->countAllDates();
2241 2241
 			$previousdatabyairlines = $this->countAllDatesByAirlines();
2242 2242
 			$this->deleteStatFlight('date');
2243
-			$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter_last_month));
2243
+			$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter_last_month));
2244 2244
 			$values = array();
2245 2245
 			foreach ($alldata as $cnt) {
2246 2246
 				$values[] = $cnt['date_count'];
2247 2247
 			}
2248
-			array_multisort($values,SORT_DESC,$alldata);
2249
-			array_splice($alldata,11);
2248
+			array_multisort($values, SORT_DESC, $alldata);
2249
+			array_splice($alldata, 11);
2250 2250
 			foreach ($alldata as $number) {
2251
-				$this->addStatFlight('date',$number['date_name'],$number['date_count']);
2251
+				$this->addStatFlight('date', $number['date_name'], $number['date_count']);
2252 2252
 			}
2253 2253
 			
2254 2254
 			$this->deleteStatFlight('hour');
2255 2255
 			echo '-> countAllHours...'."\n";
2256
-			$alldata = $Spotter->countAllHours('hour',$filter_last_month);
2256
+			$alldata = $Spotter->countAllHours('hour', $filter_last_month);
2257 2257
 			foreach ($alldata as $number) {
2258
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count']);
2258
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count']);
2259 2259
 			}
2260 2260
 
2261 2261
 			// Count by airlines
@@ -2264,42 +2264,42 @@  discard block
 block discarded – undo
2264 2264
 				if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n";
2265 2265
 				$SpotterArchive = new SpotterArchive();
2266 2266
 				//$Spotter = new Spotter($this->db);
2267
-				$alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day);
2267
+				$alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false, 0, $last_update_day);
2268 2268
 				//$alldata = $Spotter->countAllFlightOverCountriesByAirlines(false,0,$last_update_day);
2269 2269
 				foreach ($alldata as $number) {
2270
-					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset);
2270
+					$this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], $number['airline_icao'], '', $reset);
2271 2271
 				}
2272 2272
 			}
2273 2273
 			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
2274 2274
 			$Spotter = new Spotter($this->db);
2275
-			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
2275
+			$alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day);
2276 2276
 			foreach ($alldata as $number) {
2277
-				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset);
2277
+				$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset);
2278 2278
 			}
2279 2279
 			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
2280
-			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
2280
+			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day);
2281 2281
 			foreach ($alldata as $number) {
2282
-				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset);
2282
+				$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset);
2283 2283
 			}
2284 2284
 			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
2285
-			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
2285
+			$alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day);
2286 2286
 			foreach ($alldata as $number) {
2287
-				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
2287
+				$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset);
2288 2288
 			}
2289 2289
 			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
2290
-			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
2290
+			$alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day);
2291 2291
 			foreach ($alldata as $number) {
2292
-				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset);
2292
+				$this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset);
2293 2293
 			}
2294 2294
 			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
2295
-			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
2295
+			$alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day);
2296 2296
 			foreach ($alldata as $number) {
2297
-				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset);
2297
+				$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset);
2298 2298
 			}
2299 2299
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
2300
-			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
2300
+			$pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day);
2301 2301
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
2302
-			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
2302
+			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day);
2303 2303
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
2304 2304
 			//$alldata = array();
2305 2305
 			foreach ($dall as $value) {
@@ -2319,12 +2319,12 @@  discard block
 block discarded – undo
2319 2319
 			}
2320 2320
 			$alldata = $pall;
2321 2321
 			foreach ($alldata as $number) {
2322
-				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset);
2322
+				echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao'], '', $reset);
2323 2323
 			}
2324 2324
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
2325
-			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
2325
+			$pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day);
2326 2326
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
2327
-			$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
2327
+			$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day);
2328 2328
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
2329 2329
 			//$alldata = array();
2330 2330
 			foreach ($dall as $value) {
@@ -2344,7 +2344,7 @@  discard block
 block discarded – undo
2344 2344
 			}
2345 2345
 			$alldata = $pall;
2346 2346
 			foreach ($alldata as $number) {
2347
-				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
2347
+				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao'], '', $reset);
2348 2348
 			}
2349 2349
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
2350 2350
 			$Spotter = new Spotter($this->db);
@@ -2352,27 +2352,27 @@  discard block
 block discarded – undo
2352 2352
 			$lastyear = false;
2353 2353
 			foreach ($alldata as $number) {
2354 2354
 				if ($number['year_name'] != date('Y')) $lastyear = true;
2355
-				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2355
+				$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
2356 2356
 			}
2357 2357
 			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
2358 2358
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month);
2359 2359
 			foreach ($alldata as $number) {
2360
-				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2360
+				$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
2361 2361
 			}
2362 2362
 			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
2363 2363
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month);
2364 2364
 			foreach ($alldata as $number) {
2365
-				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2365
+				$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
2366 2366
 			}
2367 2367
 			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
2368 2368
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month);
2369 2369
 			foreach ($alldata as $number) {
2370
-				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2370
+				$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
2371 2371
 			}
2372 2372
 			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
2373 2373
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month);
2374 2374
 			foreach ($alldata as $number) {
2375
-				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2375
+				$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']);
2376 2376
 			}
2377 2377
 			if ($globalDebug) echo '...Departure'."\n";
2378 2378
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
@@ -2395,7 +2395,7 @@  discard block
 block discarded – undo
2395 2395
 			}
2396 2396
 			$alldata = $pall;
2397 2397
 			foreach ($alldata as $number) {
2398
-				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
2398
+				$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']);
2399 2399
 			}
2400 2400
 			if ($globalDebug) echo '...Arrival'."\n";
2401 2401
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
@@ -2418,32 +2418,32 @@  discard block
 block discarded – undo
2418 2418
 			}
2419 2419
 			$alldata = $pall;
2420 2420
 			foreach ($alldata as $number) {
2421
-				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
2421
+				$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']);
2422 2422
 			}
2423 2423
 
2424 2424
 			if ($globalDebug) echo 'Flights data...'."\n";
2425 2425
 			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2426 2426
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month);
2427 2427
 			foreach ($alldata as $number) {
2428
-				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
2428
+				$this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']);
2429 2429
 			}
2430 2430
 			if ($globalDebug) echo '-> countAllDates...'."\n";
2431 2431
 			//$previousdata = $this->countAllDatesByAirlines();
2432
-			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month));
2432
+			$alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines($filter_last_month));
2433 2433
 			$values = array();
2434 2434
 			foreach ($alldata as $cnt) {
2435 2435
 				$values[] = $cnt['date_count'];
2436 2436
 			}
2437
-			array_multisort($values,SORT_DESC,$alldata);
2438
-			array_splice($alldata,11);
2437
+			array_multisort($values, SORT_DESC, $alldata);
2438
+			array_splice($alldata, 11);
2439 2439
 			foreach ($alldata as $number) {
2440
-				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
2440
+				$this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']);
2441 2441
 			}
2442 2442
 			
2443 2443
 			if ($globalDebug) echo '-> countAllHours...'."\n";
2444
-			$alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month);
2444
+			$alldata = $Spotter->countAllHoursByAirlines('hour', $filter_last_month);
2445 2445
 			foreach ($alldata as $number) {
2446
-				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
2446
+				$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']);
2447 2447
 			}
2448 2448
 
2449 2449
 			// Stats by filters
@@ -2466,7 +2466,7 @@  discard block
 block discarded – undo
2466 2466
 						$last_update_day = date('Y').'-01-01 00:00:00';
2467 2467
 					}
2468 2468
 				}
2469
-				if (isset($filter['DeleteLastYearStats']) && date('Y',strtotime($last_update_day)) != date('Y')) {
2469
+				if (isset($filter['DeleteLastYearStats']) && date('Y', strtotime($last_update_day)) != date('Y')) {
2470 2470
 					$last_update_day = date('Y').'-01-01 00:00:00';
2471 2471
 					$reset = true;
2472 2472
 				}
@@ -2475,32 +2475,32 @@  discard block
 block discarded – undo
2475 2475
 				// Count by filter
2476 2476
 				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2477 2477
 				$Spotter = new Spotter($this->db);
2478
-				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
2478
+				$alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter);
2479 2479
 				foreach ($alldata as $number) {
2480
-					$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset);
2480
+					$this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset);
2481 2481
 				}
2482
-				$alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter);
2482
+				$alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter);
2483 2483
 				foreach ($alldata as $number) {
2484
-					$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset);
2484
+					$this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset);
2485 2485
 				}
2486
-				$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter);
2486
+				$alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter);
2487 2487
 				foreach ($alldata as $number) {
2488
-					$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset);
2488
+					$this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset);
2489 2489
 				}
2490
-				$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter);
2490
+				$alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter);
2491 2491
 				foreach ($alldata as $number) {
2492
-					$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset);
2492
+					$this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset);
2493 2493
 				}
2494
-				$alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter);
2494
+				$alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter);
2495 2495
 				foreach ($alldata as $number) {
2496
-					$this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset);
2496
+					$this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset);
2497 2497
 				}
2498
-				$alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter);
2498
+				$alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter);
2499 2499
 				foreach ($alldata as $number) {
2500
-					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset);
2500
+					$this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset);
2501 2501
 				}
2502
-				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
2503
-				$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
2502
+				$pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter);
2503
+				$dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter);
2504 2504
 				$alldata = array();
2505 2505
 				foreach ($pall as $value) {
2506 2506
 					$icao = $value['airport_departure_icao'];
@@ -2516,12 +2516,12 @@  discard block
 block discarded – undo
2516 2516
 				foreach ($alldata as $key => $row) {
2517 2517
 					$count[$key] = $row['airport_departure_icao_count'];
2518 2518
 				}
2519
-				array_multisort($count,SORT_DESC,$alldata);
2519
+				array_multisort($count, SORT_DESC, $alldata);
2520 2520
 				foreach ($alldata as $number) {
2521
-					echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset);
2521
+					echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset);
2522 2522
 				}
2523
-				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter);
2524
-				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
2523
+				$pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter);
2524
+				$dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter);
2525 2525
 				$alldata = array();
2526 2526
 				foreach ($pall as $value) {
2527 2527
 					$icao = $value['airport_arrival_icao'];
@@ -2537,40 +2537,40 @@  discard block
 block discarded – undo
2537 2537
 				foreach ($alldata as $key => $row) {
2538 2538
 					$count[$key] = $row['airport_arrival_icao_count'];
2539 2539
 				}
2540
-				array_multisort($count,SORT_DESC,$alldata);
2540
+				array_multisort($count, SORT_DESC, $alldata);
2541 2541
 				foreach ($alldata as $number) {
2542
-					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset);
2542
+					echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset);
2543 2543
 				}
2544 2544
 				$Spotter = new Spotter($this->db);
2545 2545
 				$alldata = $Spotter->countAllMonths($filter);
2546 2546
 				$lastyear = false;
2547 2547
 				foreach ($alldata as $number) {
2548 2548
 					if ($number['year_name'] != date('Y')) $lastyear = true;
2549
-					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2549
+					$this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2550 2550
 				}
2551 2551
 				$alldata = $Spotter->countAllMonthsOwners($filter);
2552 2552
 				foreach ($alldata as $number) {
2553
-					$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2553
+					$this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2554 2554
 				}
2555 2555
 				$alldata = $Spotter->countAllMonthsPilots($filter);
2556 2556
 				foreach ($alldata as $number) {
2557
-					$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2557
+					$this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2558 2558
 				}
2559 2559
 				$alldata = $Spotter->countAllMilitaryMonths($filter);
2560 2560
 				foreach ($alldata as $number) {
2561
-					$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2561
+					$this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2562 2562
 				}
2563 2563
 				$alldata = $Spotter->countAllMonthsAircrafts($filter);
2564 2564
 				foreach ($alldata as $number) {
2565
-					$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2565
+					$this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2566 2566
 				}
2567 2567
 				$alldata = $Spotter->countAllMonthsRealArrivals($filter);
2568 2568
 				foreach ($alldata as $number) {
2569
-					$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2569
+					$this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name);
2570 2570
 				}
2571 2571
 				echo '...Departure'."\n";
2572
-				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
2573
-				$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
2572
+				$pall = $Spotter->getLast7DaysAirportsDeparture('', $filter);
2573
+				$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter);
2574 2574
 				foreach ($dall as $value) {
2575 2575
 					$icao = $value['departure_airport_icao'];
2576 2576
 					$ddate = $value['date'];
@@ -2588,11 +2588,11 @@  discard block
 block discarded – undo
2588 2588
 				}
2589 2589
 				$alldata = $pall;
2590 2590
 				foreach ($alldata as $number) {
2591
-					$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name);
2591
+					$this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name);
2592 2592
 				}
2593 2593
 				echo '...Arrival'."\n";
2594
-				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
2595
-				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
2594
+				$pall = $Spotter->getLast7DaysAirportsArrival('', $filter);
2595
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter);
2596 2596
 				foreach ($dall as $value) {
2597 2597
 					$icao = $value['arrival_airport_icao'];
2598 2598
 					$ddate = $value['date'];
@@ -2610,39 +2610,39 @@  discard block
 block discarded – undo
2610 2610
 				}
2611 2611
 				$alldata = $pall;
2612 2612
 				foreach ($alldata as $number) {
2613
-					$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name);
2613
+					$this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name);
2614 2614
 				}
2615 2615
 				echo 'Flights data...'."\n";
2616 2616
 				echo '-> countAllDatesLastMonth...'."\n";
2617 2617
 				$alldata = $Spotter->countAllDatesLastMonth($filter);
2618 2618
 				foreach ($alldata as $number) {
2619
-					$this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name);
2619
+					$this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name);
2620 2620
 				}
2621 2621
 				echo '-> countAllDates...'."\n";
2622
-				$previousdata = $this->countAllDates('',$filter_name);
2623
-				$alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter));
2622
+				$previousdata = $this->countAllDates('', $filter_name);
2623
+				$alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter));
2624 2624
 				$values = array();
2625 2625
 				foreach ($alldata as $cnt) {
2626 2626
 					$values[] = $cnt['date_count'];
2627 2627
 				}
2628
-				array_multisort($values,SORT_DESC,$alldata);
2629
-				array_splice($alldata,11);
2628
+				array_multisort($values, SORT_DESC, $alldata);
2629
+				array_splice($alldata, 11);
2630 2630
 				foreach ($alldata as $number) {
2631
-					$this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name);
2631
+					$this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name);
2632 2632
 				}
2633 2633
 				
2634 2634
 				echo '-> countAllHours...'."\n";
2635
-				$alldata = $Spotter->countAllHours('hour',$filter);
2635
+				$alldata = $Spotter->countAllHours('hour', $filter);
2636 2636
 				foreach ($alldata as $number) {
2637
-					$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name);
2637
+					$this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name);
2638 2638
 				}
2639 2639
 				echo 'Insert last stats update date...'."\n";
2640 2640
 				date_default_timezone_set('UTC');
2641
-				$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s'));
2641
+				$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s'));
2642 2642
 				if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) {
2643
-					if (date('Y',strtotime($last_update_day)) != date('Y')) {
2643
+					if (date('Y', strtotime($last_update_day)) != date('Y')) {
2644 2644
 						$this->deleteOldStats($filter_name);
2645
-						$this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00');
2645
+						$this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00');
2646 2646
 					}
2647 2647
 				}
2648 2648
 			}
@@ -2653,16 +2653,16 @@  discard block
 block discarded – undo
2653 2653
 				// SUM all previous month to put as year
2654 2654
 				$previous_year = date('Y');
2655 2655
 				$previous_year--;
2656
-				$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2657
-				$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2658
-				$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2659
-				$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00');
2656
+				$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2657
+				$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2658
+				$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2659
+				$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00');
2660 2660
 				$allairlines = $this->getAllAirlineNames();
2661 2661
 				foreach ($allairlines as $data) {
2662
-					$this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2663
-					$this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2664
-					$this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2665
-					$this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']);
2662
+					$this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2663
+					$this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2664
+					$this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2665
+					$this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']);
2666 2666
 				}
2667 2667
 				
2668 2668
 				if (isset($globalArchiveYear) && $globalArchiveYear) {
@@ -2671,7 +2671,7 @@  discard block
 block discarded – undo
2671 2671
 						try {
2672 2672
 							$sth = $this->db->prepare($query);
2673 2673
 							$sth->execute();
2674
-						} catch(PDOException $e) {
2674
+						} catch (PDOException $e) {
2675 2675
 							return "error : ".$e->getMessage().' - query : '.$query."\n";
2676 2676
 						}
2677 2677
 					}
@@ -2680,15 +2680,15 @@  discard block
 block discarded – undo
2680 2680
 					try {
2681 2681
 						$sth = $this->db->prepare($query);
2682 2682
 						$sth->execute();
2683
-					} catch(PDOException $e) {
2683
+					} catch (PDOException $e) {
2684 2684
 						return "error : ".$e->getMessage().' - query : '.$query."\n";
2685 2685
 					}
2686 2686
 				}
2687 2687
 				if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) {
2688 2688
 					$last_update = $this->getLastStatsUpdate('last_update_stats');
2689
-					if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) {
2689
+					if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) {
2690 2690
 						$this->deleteOldStats();
2691
-						$this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00');
2691
+						$this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00');
2692 2692
 						$lastyearupdate = true;
2693 2693
 					}
2694 2694
 				}
@@ -2710,7 +2710,7 @@  discard block
 block discarded – undo
2710 2710
 					try {
2711 2711
 						$sth = $this->db->prepare($query);
2712 2712
 						$sth->execute();
2713
-					} catch(PDOException $e) {
2713
+					} catch (PDOException $e) {
2714 2714
 						return "error : ".$e->getMessage();
2715 2715
 					}
2716 2716
 				}
@@ -2724,14 +2724,14 @@  discard block
 block discarded – undo
2724 2724
 				try {
2725 2725
 					$sth = $this->db->prepare($query);
2726 2726
 					$sth->execute();
2727
-				} catch(PDOException $e) {
2727
+				} catch (PDOException $e) {
2728 2728
 					return "error : ".$e->getMessage();
2729 2729
 				}
2730 2730
 			}
2731 2731
 			if (!isset($lastyearupdate)) {
2732 2732
 				echo 'Insert last stats update date...'."\n";
2733 2733
 				date_default_timezone_set('UTC');
2734
-				$this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s'));
2734
+				$this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s'));
2735 2735
 			}
2736 2736
 			if ($globalStatsResetYear) {
2737 2737
 				require_once(dirname(__FILE__).'/../install/class.settings.php');
Please login to merge, or discard this patch.
Braces   +580 added lines, -204 removed lines patch added patch discarded remove patch
@@ -13,7 +13,9 @@  discard block
 block discarded – undo
13 13
 	
14 14
 	public function __construct($dbc = null) {
15 15
 		global $globalFilterName;
16
-		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
16
+		if (isset($globalFilterName)) {
17
+			$this->filter_name = $globalFilterName;
18
+		}
17 19
 		$Connection = new Connection($dbc);
18 20
 		$this->db = $Connection->db();
19 21
 	}
@@ -83,7 +85,9 @@  discard block
 block discarded – undo
83 85
 
84 86
 	public function getAllAirlineNames($filter_name = '') {
85 87
 		global $globalStatsFilters;
86
-		if ($filter_name == '') $filter_name = $this->filter_name;
88
+		if ($filter_name == '') {
89
+			$filter_name = $this->filter_name;
90
+		}
87 91
 		$query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
88 92
 		 try {
89 93
 			$sth = $this->db->prepare($query);
@@ -103,7 +107,9 @@  discard block
 block discarded – undo
103 107
 		return $all;
104 108
 	}
105 109
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
106
-		if ($filter_name == '') $filter_name = $this->filter_name;
110
+		if ($filter_name == '') {
111
+			$filter_name = $this->filter_name;
112
+		}
107 113
 		$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
108 114
 		try {
109 115
 			$sth = $this->db->prepare($query);
@@ -115,7 +121,9 @@  discard block
 block discarded – undo
115 121
 		return $all;
116 122
 	}
117 123
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
118
-		if ($filter_name == '') $filter_name = $this->filter_name;
124
+		if ($filter_name == '') {
125
+			$filter_name = $this->filter_name;
126
+		}
119 127
 		$query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC";
120 128
 		try {
121 129
 			$sth = $this->db->prepare($query);
@@ -127,7 +135,9 @@  discard block
 block discarded – undo
127 135
 		return $all;
128 136
 	}
129 137
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
130
-		if ($filter_name == '') $filter_name = $this->filter_name;
138
+		if ($filter_name == '') {
139
+			$filter_name = $this->filter_name;
140
+		}
131 141
 		$query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC";
132 142
 		try {
133 143
 			$sth = $this->db->prepare($query);
@@ -140,7 +150,9 @@  discard block
 block discarded – undo
140 150
 	}
141 151
 
142 152
 	public function getAllOwnerNames($stats_airline = '',$filter_name = '') {
143
-		if ($filter_name == '') $filter_name = $this->filter_name;
153
+		if ($filter_name == '') {
154
+			$filter_name = $this->filter_name;
155
+		}
144 156
 		$query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC";
145 157
 		try {
146 158
 			$sth = $this->db->prepare($query);
@@ -153,7 +165,9 @@  discard block
 block discarded – undo
153 165
 	}
154 166
 
155 167
 	public function getAllPilotNames($stats_airline = '',$filter_name = '') {
156
-		if ($filter_name == '') $filter_name = $this->filter_name;
168
+		if ($filter_name == '') {
169
+			$filter_name = $this->filter_name;
170
+		}
157 171
 		$query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC";
158 172
 		try {
159 173
 			$sth = $this->db->prepare($query);
@@ -168,7 +182,9 @@  discard block
 block discarded – undo
168 182
 
169 183
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
170 184
 		global $globalStatsFilters;
171
-		if ($filter_name == '') $filter_name = $this->filter_name;
185
+		if ($filter_name == '') {
186
+			$filter_name = $this->filter_name;
187
+		}
172 188
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
173 189
 			$Spotter = new Spotter($this->db);
174 190
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -177,8 +193,11 @@  discard block
 block discarded – undo
177 193
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
178 194
 			}
179 195
 			if ($year == '' && $month == '') {
180
-				if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
181
-				else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
196
+				if ($limit) {
197
+					$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
198
+				} else {
199
+					$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
200
+				}
182 201
 				try {
183 202
 					$sth = $this->db->prepare($query);
184 203
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -186,11 +205,16 @@  discard block
 block discarded – undo
186 205
 					echo "error : ".$e->getMessage();
187 206
 				}
188 207
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
189
-			} else $all = array();
208
+			} else {
209
+				$all = array();
210
+			}
190 211
 		} else {
191 212
 			if ($year == '' && $month == '') {
192
-				if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
193
-				else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
213
+				if ($limit) {
214
+					$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
215
+				} else {
216
+					$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC";
217
+				}
194 218
 				try {
195 219
 					$sth = $this->db->prepare($query);
196 220
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -198,7 +222,9 @@  discard block
 block discarded – undo
198 222
 					echo "error : ".$e->getMessage();
199 223
 				}
200 224
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
201
-			} else $all = array();
225
+			} else {
226
+				$all = array();
227
+			}
202 228
 		}
203 229
 		if (empty($all)) {
204 230
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -217,10 +243,15 @@  discard block
 block discarded – undo
217 243
 	}
218 244
 	public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') {
219 245
 		global $globalStatsFilters;
220
-		if ($filter_name == '') $filter_name = $this->filter_name;
246
+		if ($filter_name == '') {
247
+			$filter_name = $this->filter_name;
248
+		}
221 249
 		if ($year == '' && $month == '') {
222
-			if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
223
-			else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC";
250
+			if ($limit) {
251
+				$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
252
+			} else {
253
+				$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count, countries.iso3 AS airline_country_iso3 FROM stats_airline,airlines,countries WHERE countries.name = airlines.country AND stats_airline.airline_icao=airlines.icao AND filter_name = :filter_name GROUP BY airline_country, countries.iso3 ORDER BY airline_country_count DESC";
254
+			}
224 255
 			try {
225 256
 				$sth = $this->db->prepare($query);
226 257
 				$sth->execute(array(':filter_name' => $filter_name));
@@ -228,7 +259,9 @@  discard block
 block discarded – undo
228 259
 				echo "error : ".$e->getMessage();
229 260
 			}
230 261
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
231
-		} else $all = array();
262
+		} else {
263
+			$all = array();
264
+		}
232 265
 		if (empty($all)) {
233 266
 			$Spotter = new Spotter($this->db);
234 267
 			$filters = array();
@@ -243,7 +276,9 @@  discard block
 block discarded – undo
243 276
 	}
244 277
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') {
245 278
 		global $globalStatsFilters;
246
-		if ($filter_name == '') $filter_name = $this->filter_name;
279
+		if ($filter_name == '') {
280
+			$filter_name = $this->filter_name;
281
+		}
247 282
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
248 283
 			$Spotter = new Spotter($this->db);
249 284
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -252,8 +287,11 @@  discard block
 block discarded – undo
252 287
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
253 288
 			}
254 289
 			if ($year == '' && $month == '') {
255
-				if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
256
-				else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
290
+				if ($limit) {
291
+					$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
292
+				} else {
293
+					$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
294
+				}
257 295
 				try {
258 296
 					$sth = $this->db->prepare($query);
259 297
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -261,11 +299,16 @@  discard block
 block discarded – undo
261 299
 					echo "error : ".$e->getMessage();
262 300
 				}
263 301
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
264
-			} else $all = array();
302
+			} else {
303
+				$all = array();
304
+			}
265 305
 		} else {
266 306
 			if ($year == '' && $month == '') {
267
-				if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
268
-				else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
307
+				if ($limit) {
308
+					$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
309
+				} else {
310
+					$query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC";
311
+				}
269 312
 				try {
270 313
 					$sth = $this->db->prepare($query);
271 314
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -273,7 +316,9 @@  discard block
 block discarded – undo
273 316
 					echo "error : ".$e->getMessage();
274 317
 				}
275 318
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
276
-			} else $all = array();
319
+			} else {
320
+				$all = array();
321
+			}
277 322
 		}
278 323
 		if (empty($all)) {
279 324
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -293,7 +338,9 @@  discard block
 block discarded – undo
293 338
 
294 339
 	public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
295 340
 		global $globalStatsFilters;
296
-		if ($filter_name == '') $filter_name = $this->filter_name;
341
+		if ($filter_name == '') {
342
+			$filter_name = $this->filter_name;
343
+		}
297 344
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
298 345
 			$Spotter = new Spotter($this->db);
299 346
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -302,8 +349,11 @@  discard block
 block discarded – undo
302 349
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
303 350
 			}
304 351
 			if ($year == '' && $month == '') {
305
-				if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
306
-				else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
352
+				if ($limit) {
353
+					$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
354
+				} else {
355
+					$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
356
+				}
307 357
 				try {
308 358
 					$sth = $this->db->prepare($query);
309 359
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -311,11 +361,16 @@  discard block
 block discarded – undo
311 361
 					echo "error : ".$e->getMessage();
312 362
 				}
313 363
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
314
-			} else $all = array();
364
+			} else {
365
+				$all = array();
366
+			}
315 367
 		} else {
316 368
 			if ($year == '' && $month == '') {
317
-				if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
318
-				else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
369
+				if ($limit) {
370
+					$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0";
371
+				} else {
372
+					$query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_aiport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country, countries.iso3 ORDER BY airport_arrival_country_count DESC";
373
+				}
319 374
 				try {
320 375
 					$sth = $this->db->prepare($query);
321 376
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -323,7 +378,9 @@  discard block
 block discarded – undo
323 378
 					echo "error : ".$e->getMessage();
324 379
 				}
325 380
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
326
-			} else $all = array();
381
+			} else {
382
+				$all = array();
383
+			}
327 384
 		}
328 385
 		if (empty($all)) {
329 386
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -342,7 +399,9 @@  discard block
 block discarded – undo
342 399
 	}
343 400
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
344 401
 		global $globalStatsFilters;
345
-		if ($filter_name == '') $filter_name = $this->filter_name;
402
+		if ($filter_name == '') {
403
+			$filter_name = $this->filter_name;
404
+		}
346 405
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
347 406
 			$Spotter = new Spotter($this->db);
348 407
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -350,12 +409,18 @@  discard block
 block discarded – undo
350 409
 			foreach ($airlines as $airline) {
351 410
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
352 411
 			}
353
-			if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
354
-			else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
412
+			if ($limit) {
413
+				$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
414
+			} else {
415
+				$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
416
+			}
355 417
 			$query_values = array(':filter_name' => $filter_name);
356 418
 		} else {
357
-			if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
358
-			else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
419
+			if ($limit) {
420
+				$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.name = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
421
+			} else {
422
+				$query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count, countries.iso3 as airport_departure_country_iso3 FROM stats_airport, countries WHERE countries.iso3 = stats_airport.airport_country AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country, countries.iso3 ORDER BY airport_departure_country_count DESC";
423
+			}
359 424
 			$query_values = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
360 425
 		}
361 426
 		try {
@@ -383,17 +448,29 @@  discard block
 block discarded – undo
383 448
 
384 449
 	public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') {
385 450
 		global $globalStatsFilters, $globalVATSIM, $globalIVAO;
386
-		if ($filter_name == '') $filter_name = $this->filter_name;
451
+		if ($filter_name == '') {
452
+			$filter_name = $this->filter_name;
453
+		}
387 454
 		if ($year == '' && $month == '') {
388
-			if ($globalVATSIM) $forsource = 'vatsim';
389
-			if ($globalIVAO) $forsource = 'ivao';
455
+			if ($globalVATSIM) {
456
+				$forsource = 'vatsim';
457
+			}
458
+			if ($globalIVAO) {
459
+				$forsource = 'ivao';
460
+			}
390 461
 			if (isset($forsource)) {
391
-				if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
392
-				else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC";
462
+				if ($limit) {
463
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
464
+				} else {
465
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource = :forsource ORDER BY airline_count DESC";
466
+				}
393 467
 				$query_values = array(':filter_name' => $filter_name,':forsource' => $forsource);
394 468
 			} else {
395
-				if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
396
-				else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC";
469
+				if ($limit) {
470
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
471
+				} else {
472
+					$query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao AND filter_name = :filter_name AND airlines.forsource IS NULL ORDER BY airline_count DESC";
473
+				}
397 474
 				$query_values = array(':filter_name' => $filter_name);
398 475
 			}
399 476
 			try {
@@ -403,7 +480,9 @@  discard block
 block discarded – undo
403 480
 				echo "error : ".$e->getMessage();
404 481
 			}
405 482
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
406
-		} else $all = array();
483
+		} else {
484
+			$all = array();
485
+		}
407 486
                 if (empty($all)) {
408 487
 	                $Spotter = new Spotter($this->db);
409 488
             		$filters = array();
@@ -418,7 +497,9 @@  discard block
 block discarded – undo
418 497
 	}
419 498
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
420 499
 		global $globalStatsFilters;
421
-		if ($filter_name == '') $filter_name = $this->filter_name;
500
+		if ($filter_name == '') {
501
+			$filter_name = $this->filter_name;
502
+		}
422 503
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
423 504
 			$Spotter = new Spotter($this->db);
424 505
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -427,8 +508,11 @@  discard block
 block discarded – undo
427 508
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
428 509
 			}
429 510
 			if ($year == '' && $month == '') {
430
-				if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
431
-				else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
511
+				if ($limit) {
512
+					$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
513
+				} else {
514
+					$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
515
+				}
432 516
 				try {
433 517
 					$sth = $this->db->prepare($query);
434 518
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -436,11 +520,16 @@  discard block
 block discarded – undo
436 520
 					echo "error : ".$e->getMessage();
437 521
 				}
438 522
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
439
-			} else $all = array();
523
+			} else {
524
+				$all = array();
525
+			}
440 526
 		} else {
441 527
 			if ($year == '' && $month == '') {
442
-				if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
443
-				else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
528
+				if ($limit) {
529
+					$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
530
+				} else {
531
+					$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC";
532
+				}
444 533
 				try {
445 534
 					$sth = $this->db->prepare($query);
446 535
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -448,7 +537,9 @@  discard block
 block discarded – undo
448 537
 					echo "error : ".$e->getMessage();
449 538
 				}
450 539
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
451
-			} else $all = array();
540
+			} else {
541
+				$all = array();
542
+			}
452 543
 		}
453 544
 		if (empty($all)) {
454 545
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -467,7 +558,9 @@  discard block
 block discarded – undo
467 558
 	}
468 559
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
469 560
 		global $globalStatsFilters;
470
-		if ($filter_name == '') $filter_name = $this->filter_name;
561
+		if ($filter_name == '') {
562
+			$filter_name = $this->filter_name;
563
+		}
471 564
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
472 565
 			$Spotter = new Spotter($this->db);
473 566
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -476,8 +569,11 @@  discard block
 block discarded – undo
476 569
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
477 570
 			}
478 571
 			if ($year == '' && $month == '') {
479
-				if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
480
-				else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
572
+				if ($limit) {
573
+					$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
574
+				} else {
575
+					$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
576
+				}
481 577
 				 try {
482 578
 					$sth = $this->db->prepare($query);
483 579
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -485,11 +581,16 @@  discard block
 block discarded – undo
485 581
 					echo "error : ".$e->getMessage();
486 582
 				}
487 583
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
488
-			} else $all = array();
584
+			} else {
585
+				$all = array();
586
+			}
489 587
 		} else {
490 588
 			if ($year == '' && $month == '') {
491
-				if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
492
-				else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
589
+				if ($limit) {
590
+					$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
591
+				} else {
592
+					$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC";
593
+				}
493 594
 				 try {
494 595
 					$sth = $this->db->prepare($query);
495 596
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -497,7 +598,9 @@  discard block
 block discarded – undo
497 598
 					echo "error : ".$e->getMessage();
498 599
 				}
499 600
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
500
-			} else $all = array();
601
+			} else {
602
+				$all = array();
603
+			}
501 604
 		}
502 605
 		if (empty($all)) {
503 606
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -516,7 +619,9 @@  discard block
 block discarded – undo
516 619
 	}
517 620
 	public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') {
518 621
 		$Connection = new Connection();
519
-		if ($filter_name == '') $filter_name = $this->filter_name;
622
+		if ($filter_name == '') {
623
+			$filter_name = $this->filter_name;
624
+		}
520 625
 		if ($Connection->tableExists('countries')) {
521 626
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
522 627
 				$Spotter = new Spotter($this->db);
@@ -526,8 +631,11 @@  discard block
 block discarded – undo
526 631
 					foreach ($airlines as $airline) {
527 632
 						$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
528 633
 					}
529
-					if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
530
-					else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC";
634
+					if ($limit) {
635
+						$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
636
+					} else {
637
+						$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY flight_count DESC";
638
+					}
531 639
 					 try {
532 640
 						$sth = $this->db->prepare($query);
533 641
 						$sth->execute(array(':filter_name' => $filter_name));
@@ -536,11 +644,16 @@  discard block
 block discarded – undo
536 644
 					}
537 645
 					$all = $sth->fetchAll(PDO::FETCH_ASSOC);
538 646
 					return $all;
539
-				} else return array();
647
+				} else {
648
+					return array();
649
+				}
540 650
 			} else {
541 651
 				if ($year == '' && $month == '') {
542
-					if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
543
-					else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
652
+					if ($limit) {
653
+						$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
654
+					} else {
655
+						$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC";
656
+					}
544 657
 					 try {
545 658
 						$sth = $this->db->prepare($query);
546 659
 						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -549,7 +662,9 @@  discard block
 block discarded – undo
549 662
 					}
550 663
 					$all = $sth->fetchAll(PDO::FETCH_ASSOC);
551 664
 					return $all;
552
-				} else return array();
665
+				} else {
666
+					return array();
667
+				}
553 668
 			}
554 669
 		} else {
555 670
 			/*
@@ -563,10 +678,15 @@  discard block
 block discarded – undo
563 678
 	}
564 679
 	public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') {
565 680
 		global $globalStatsFilters;
566
-		if ($filter_name == '') $filter_name = $this->filter_name;
681
+		if ($filter_name == '') {
682
+			$filter_name = $this->filter_name;
683
+		}
567 684
 		if ($year == '' && $month == '') {
568
-			if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
569
-			else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
685
+			if ($limit) {
686
+				$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
687
+			} else {
688
+				$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC";
689
+			}
570 690
 			try {
571 691
 				$sth = $this->db->prepare($query);
572 692
 				$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -574,7 +694,9 @@  discard block
 block discarded – undo
574 694
 				echo "error : ".$e->getMessage();
575 695
 			}
576 696
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
577
-		} else $all = array();
697
+		} else {
698
+			$all = array();
699
+		}
578 700
 		if (empty($all)) {
579 701
 			$filters = array('airlines' => array($stats_airline),'year' => $year,'month' => $month);
580 702
 			if ($filter_name != '') {
@@ -589,7 +711,9 @@  discard block
 block discarded – undo
589 711
 
590 712
 	public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') {
591 713
 		global $globalStatsFilters;
592
-		if ($filter_name == '') $filter_name = $this->filter_name;
714
+		if ($filter_name == '') {
715
+			$filter_name = $this->filter_name;
716
+		}
593 717
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
594 718
 			$Spotter = new Spotter($this->db);
595 719
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -598,8 +722,11 @@  discard block
 block discarded – undo
598 722
 				foreach ($airlines as $airline) {
599 723
 					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
600 724
 				}
601
-				if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
602
-				else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC";
725
+				if ($limit) {
726
+					$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
727
+				} else {
728
+					$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY owner_count DESC";
729
+				}
603 730
 				try {
604 731
 					$sth = $this->db->prepare($query);
605 732
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -607,11 +734,16 @@  discard block
 block discarded – undo
607 734
 					echo "error : ".$e->getMessage();
608 735
 				}
609 736
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
610
-			} else $all = array();
737
+			} else {
738
+				$all = array();
739
+			}
611 740
 		} else {
612 741
 			if ($year == '' && $month == '') {
613
-				if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
614
-				else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
742
+				if ($limit) {
743
+					$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
744
+				} else {
745
+					$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC";
746
+				}
615 747
 				try {
616 748
 					$sth = $this->db->prepare($query);
617 749
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -619,7 +751,9 @@  discard block
 block discarded – undo
619 751
 					echo "error : ".$e->getMessage();
620 752
 				}
621 753
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
622
-			} else $all = array();
754
+			} else {
755
+				$all = array();
756
+			}
623 757
 		}
624 758
 		if (empty($all)) {
625 759
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -638,7 +772,9 @@  discard block
 block discarded – undo
638 772
 	}
639 773
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
640 774
 		global $globalStatsFilters;
641
-		if ($filter_name == '') $filter_name = $this->filter_name;
775
+		if ($filter_name == '') {
776
+			$filter_name = $this->filter_name;
777
+		}
642 778
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
643 779
 			$Spotter = new Spotter($this->db);
644 780
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -647,8 +783,11 @@  discard block
 block discarded – undo
647 783
 				foreach ($airlines as $airline) {
648 784
 					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
649 785
 				}
650
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
651
-				else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
786
+				if ($limit) {
787
+					$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
788
+				} else {
789
+					$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
790
+				}
652 791
 				try {
653 792
 					$sth = $this->db->prepare($query);
654 793
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -656,11 +795,16 @@  discard block
 block discarded – undo
656 795
 					echo "error : ".$e->getMessage();
657 796
 				}
658 797
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
659
-			} else $all = array();
798
+			} else {
799
+				$all = array();
800
+			}
660 801
 		} else {
661 802
 			if ($year == '' && $month == '') {
662
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
663
-				else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
803
+				if ($limit) {
804
+					$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0";
805
+				} else {
806
+					$query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count, airport.latitude AS airport_departure_latitude, airport.longitude AS airport_departure_longitude FROM stats_airport,airport WHERE airport.icao = stats_airport.airport_icao AND departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC";
807
+				}
664 808
 				try {
665 809
 					$sth = $this->db->prepare($query);
666 810
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -668,7 +812,9 @@  discard block
 block discarded – undo
668 812
 					echo "error : ".$e->getMessage();
669 813
 				}
670 814
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
671
-			} else $all = array();
815
+			} else {
816
+				$all = array();
817
+			}
672 818
 		}
673 819
 		if (empty($all)) {
674 820
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -693,7 +839,9 @@  discard block
 block discarded – undo
693 839
 				$icao = $value['airport_departure_icao'];
694 840
 				if (isset($all[$icao])) {
695 841
 					$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
696
-				} else $all[$icao] = $value;
842
+				} else {
843
+					$all[$icao] = $value;
844
+				}
697 845
 			}
698 846
 			$count = array();
699 847
 			foreach ($all as $key => $row) {
@@ -705,7 +853,9 @@  discard block
 block discarded – undo
705 853
 	}
706 854
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
707 855
 		global $globalStatsFilters;
708
-		if ($filter_name == '') $filter_name = $this->filter_name;
856
+		if ($filter_name == '') {
857
+			$filter_name = $this->filter_name;
858
+		}
709 859
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
710 860
 			$Spotter = new Spotter($this->db);
711 861
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -714,8 +864,11 @@  discard block
 block discarded – undo
714 864
 				foreach ($airlines as $airline) {
715 865
 					$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
716 866
 				}
717
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
718
-				else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
867
+				if ($limit) {
868
+					$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
869
+				} else {
870
+					$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
871
+				}
719 872
 				try {
720 873
 					$sth = $this->db->prepare($query);
721 874
 					$sth->execute(array(':filter_name' => $filter_name));
@@ -723,11 +876,16 @@  discard block
 block discarded – undo
723 876
 					echo "error : ".$e->getMessage();
724 877
 				}
725 878
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
726
-			} else $all = array();
879
+			} else {
880
+				$all = array();
881
+			}
727 882
 		} else {
728 883
 			if ($year == '' && $month == '') {
729
-				if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
730
-				else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
884
+				if ($limit) {
885
+					$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0";
886
+				} else {
887
+					$query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count, airport.latitude AS airport_arrival_latitude, airport.longitude AS airport_arrival_longitude FROM stats_airport, airport WHERE airport.icao = stats_airport.airport_icao AND arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC";
888
+				}
731 889
 				try {
732 890
 					$sth = $this->db->prepare($query);
733 891
 					$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
@@ -735,7 +893,9 @@  discard block
 block discarded – undo
735 893
 					echo "error : ".$e->getMessage();
736 894
 				}
737 895
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
738
-			} else $all = array();
896
+			} else {
897
+				$all = array();
898
+			}
739 899
 		}
740 900
 		if (empty($all)) {
741 901
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -760,7 +920,9 @@  discard block
 block discarded – undo
760 920
 				$icao = $value['airport_arrival_icao'];
761 921
 				if (isset($all[$icao])) {
762 922
 					$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
763
-				} else $all[$icao] = $value;
923
+				} else {
924
+					$all[$icao] = $value;
925
+				}
764 926
 			}
765 927
 			$count = array();
766 928
 			foreach ($all as $key => $row) {
@@ -772,7 +934,9 @@  discard block
 block discarded – undo
772 934
 	}
773 935
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
774 936
 		global $globalDBdriver, $globalStatsFilters;
775
-		if ($filter_name == '') $filter_name = $this->filter_name;
937
+		if ($filter_name == '') {
938
+			$filter_name = $this->filter_name;
939
+		}
776 940
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
777 941
 			$Spotter = new Spotter($this->db);
778 942
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -781,20 +945,32 @@  discard block
 block discarded – undo
781 945
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
782 946
 			}
783 947
 			if ($globalDBdriver == 'mysql') {
784
-				if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
785
-				else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
948
+				if ($limit) {
949
+					$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
950
+				} else {
951
+					$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
952
+				}
786 953
 			} else {
787
-				if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
788
-				else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
954
+				if ($limit) {
955
+					$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
956
+				} else {
957
+					$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, SUM(cnt) as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY stats_date";
958
+				}
789 959
 			}
790 960
 			$query_data = array(':filter_name' => $filter_name);
791 961
 		} else {
792 962
 			if ($globalDBdriver == 'mysql') {
793
-				if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
794
-				else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
963
+				if ($limit) {
964
+					$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline AND filter_name = :filter_name";
965
+				} else {
966
+					$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
967
+				}
795 968
 			} else {
796
-				if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
797
-				else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
969
+				if ($limit) {
970
+					$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name";
971
+				} else {
972
+					$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
973
+				}
798 974
 			}
799 975
 			$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
800 976
 		}
@@ -822,7 +998,9 @@  discard block
 block discarded – undo
822 998
 	
823 999
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
824 1000
 		global $globalStatsFilters;
825
-		if ($filter_name == '') $filter_name = $this->filter_name;
1001
+		if ($filter_name == '') {
1002
+			$filter_name = $this->filter_name;
1003
+		}
826 1004
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
827 1005
 			$Spotter = new Spotter($this->db);
828 1006
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -859,7 +1037,9 @@  discard block
 block discarded – undo
859 1037
 	}
860 1038
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
861 1039
 		global $globalDBdriver, $globalStatsFilters;
862
-		if ($filter_name == '') $filter_name = $this->filter_name;
1040
+		if ($filter_name == '') {
1041
+			$filter_name = $this->filter_name;
1042
+		}
863 1043
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
864 1044
 			$Spotter = new Spotter($this->db);
865 1045
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -904,7 +1084,9 @@  discard block
 block discarded – undo
904 1084
 	}
905 1085
 	public function countAllDates($stats_airline = '',$filter_name = '') {
906 1086
 		global $globalStatsFilters;
907
-		if ($filter_name == '') $filter_name = $this->filter_name;
1087
+		if ($filter_name == '') {
1088
+			$filter_name = $this->filter_name;
1089
+		}
908 1090
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
909 1091
 			$Spotter = new Spotter($this->db);
910 1092
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -941,7 +1123,9 @@  discard block
 block discarded – undo
941 1123
 	}
942 1124
 	public function countAllDatesByAirlines($filter_name = '') {
943 1125
 		global $globalStatsFilters;
944
-		if ($filter_name == '') $filter_name = $this->filter_name;
1126
+		if ($filter_name == '') {
1127
+			$filter_name = $this->filter_name;
1128
+		}
945 1129
 		$query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name";
946 1130
 		$query_data = array('filter_name' => $filter_name);
947 1131
 		try {
@@ -963,7 +1147,9 @@  discard block
 block discarded – undo
963 1147
 	}
964 1148
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
965 1149
 		global $globalStatsFilters, $globalDBdriver;
966
-		if ($filter_name == '') $filter_name = $this->filter_name;
1150
+		if ($filter_name == '') {
1151
+			$filter_name = $this->filter_name;
1152
+		}
967 1153
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
968 1154
 			$Spotter = new Spotter($this->db);
969 1155
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1048,7 +1234,9 @@  discard block
 block discarded – undo
1048 1234
 	}
1049 1235
 	public function countAllMilitaryMonths($filter_name = '') {
1050 1236
 		global $globalStatsFilters;
1051
-		if ($filter_name == '') $filter_name = $this->filter_name;
1237
+		if ($filter_name == '') {
1238
+			$filter_name = $this->filter_name;
1239
+		}
1052 1240
 		$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth' AND filter_name = :filter_name";
1053 1241
 		try {
1054 1242
 			$sth = $this->db->prepare($query);
@@ -1069,7 +1257,9 @@  discard block
 block discarded – undo
1069 1257
 	}
1070 1258
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
1071 1259
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
1072
-		if ($filter_name == '') $filter_name = $this->filter_name;
1260
+		if ($filter_name == '') {
1261
+			$filter_name = $this->filter_name;
1262
+		}
1073 1263
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1074 1264
 			$Spotter = new Spotter($this->db);
1075 1265
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1077,12 +1267,18 @@  discard block
 block discarded – undo
1077 1267
 			foreach ($airlines as $airline) {
1078 1268
 				$alliance_airlines = array_merge($alliance_airlines,array($airline['airline_icao']));
1079 1269
 			}
1080
-			if ($limit) $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1081
-			else $query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1270
+			if ($limit) {
1271
+				$query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1272
+			} else {
1273
+				$query = "SELECT flight_date as hour_name, SUM(cnt) as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline IN ('".implode("','",$alliance_airlines)."') AND filter_name = :filter_name GROUP BY flight_date";
1274
+			}
1082 1275
 			$query_data = array(':filter_name' => $filter_name);
1083 1276
 		} else {
1084
-			if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
1085
-			else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
1277
+			if ($limit) {
1278
+				$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
1279
+			} else {
1280
+				$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name";
1281
+			}
1086 1282
 			$query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
1087 1283
 		}
1088 1284
 		if ($orderby == 'hour') {
@@ -1092,7 +1288,9 @@  discard block
 block discarded – undo
1092 1288
 				$query .= " ORDER BY CAST(flight_date AS integer) ASC";
1093 1289
 			}
1094 1290
 		}
1095
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
1291
+		if ($orderby == 'count') {
1292
+			$query .= " ORDER BY hour_count DESC";
1293
+		}
1096 1294
 		try {
1097 1295
 			$sth = $this->db->prepare($query);
1098 1296
 			$sth->execute($query_data);
@@ -1116,8 +1314,12 @@  discard block
 block discarded – undo
1116 1314
 	}
1117 1315
 	public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') {
1118 1316
 		global $globalStatsFilters;
1119
-		if ($filter_name == '') $filter_name = $this->filter_name;
1120
-		if ($year == '') $year = date('Y');
1317
+		if ($filter_name == '') {
1318
+			$filter_name = $this->filter_name;
1319
+		}
1320
+		if ($year == '') {
1321
+			$year = date('Y');
1322
+		}
1121 1323
 		$all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month);
1122 1324
 		if (empty($all)) {
1123 1325
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -1136,8 +1338,12 @@  discard block
 block discarded – undo
1136 1338
 	}
1137 1339
 	public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') {
1138 1340
 		global $globalStatsFilters;
1139
-		if ($filter_name == '') $filter_name = $this->filter_name;
1140
-		if ($year == '') $year = date('Y');
1341
+		if ($filter_name == '') {
1342
+			$filter_name = $this->filter_name;
1343
+		}
1344
+		if ($year == '') {
1345
+			$year = date('Y');
1346
+		}
1141 1347
 		$all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month);
1142 1348
 		if (empty($all)) {
1143 1349
 			$filters = array();
@@ -1153,8 +1359,12 @@  discard block
 block discarded – undo
1153 1359
 	}
1154 1360
 	public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') {
1155 1361
 		global $globalStatsFilters;
1156
-		if ($filter_name == '') $filter_name = $this->filter_name;
1157
-		if ($year == '') $year = date('Y');
1362
+		if ($filter_name == '') {
1363
+			$filter_name = $this->filter_name;
1364
+		}
1365
+		if ($year == '') {
1366
+			$year = date('Y');
1367
+		}
1158 1368
 		$all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month);
1159 1369
 		if (empty($all)) {
1160 1370
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -1173,7 +1383,9 @@  discard block
 block discarded – undo
1173 1383
 	}
1174 1384
 	public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') {
1175 1385
 		global $globalStatsFilters;
1176
-		if ($filter_name == '') $filter_name = $this->filter_name;
1386
+		if ($filter_name == '') {
1387
+			$filter_name = $this->filter_name;
1388
+		}
1177 1389
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1178 1390
 			$Spotter = new Spotter($this->db);
1179 1391
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1191,7 +1403,9 @@  discard block
 block discarded – undo
1191 1403
 				}
1192 1404
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1193 1405
 				$all = $result[0]['nb'];
1194
-			} else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1406
+			} else {
1407
+				$all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1408
+			}
1195 1409
 		} else {
1196 1410
 			if ($year == '' && $month == '') {
1197 1411
 				$query = "SELECT COUNT(*) AS nb FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -1203,7 +1417,9 @@  discard block
 block discarded – undo
1203 1417
 				}
1204 1418
 				$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1205 1419
 				$all = $result[0]['nb'];
1206
-			} else $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1420
+			} else {
1421
+				$all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month);
1422
+			}
1207 1423
 		}
1208 1424
 		if (empty($all)) {
1209 1425
 			if (strpos($stats_airline,'alliance_') !== FALSE) {
@@ -1222,7 +1438,9 @@  discard block
 block discarded – undo
1222 1438
 	}
1223 1439
 	public function countOverallAirlines($filter_name = '',$year = '',$month = '') {
1224 1440
 		global $globalStatsFilters;
1225
-		if ($filter_name == '') $filter_name = $this->filter_name;
1441
+		if ($filter_name == '') {
1442
+			$filter_name = $this->filter_name;
1443
+		}
1226 1444
 		if ($year == '' && $month == '') {
1227 1445
 			$query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name";
1228 1446
 			try {
@@ -1233,7 +1451,9 @@  discard block
 block discarded – undo
1233 1451
 			}
1234 1452
 			$result = $sth->fetchAll(PDO::FETCH_ASSOC);
1235 1453
 			$all = $result[0]['nb_airline'];
1236
-		} else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
1454
+		} else {
1455
+			$all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
1456
+		}
1237 1457
 		if (empty($all)) {
1238 1458
 			$filters = array();
1239 1459
 			$filters = array('year' => $year,'month' => $month);
@@ -1248,7 +1468,9 @@  discard block
 block discarded – undo
1248 1468
 	}
1249 1469
 	public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') {
1250 1470
 		global $globalStatsFilters;
1251
-		if ($filter_name == '') $filter_name = $this->filter_name;
1471
+		if ($filter_name == '') {
1472
+			$filter_name = $this->filter_name;
1473
+		}
1252 1474
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1253 1475
 			$Spotter = new Spotter($this->db);
1254 1476
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1303,7 +1525,9 @@  discard block
 block discarded – undo
1303 1525
 	}
1304 1526
 	public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') {
1305 1527
 		global $globalStatsFilters;
1306
-		if ($filter_name == '') $filter_name = $this->filter_name;
1528
+		if ($filter_name == '') {
1529
+			$filter_name = $this->filter_name;
1530
+		}
1307 1531
 		//if ($year == '') $year = date('Y');
1308 1532
 		if ($year == '' && $month == '') {
1309 1533
 			$query = "SELECT count(*) as nb FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
@@ -1332,7 +1556,9 @@  discard block
 block discarded – undo
1332 1556
 	}
1333 1557
 
1334 1558
 	public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') {
1335
-		if ($filter_name == '') $filter_name = $this->filter_name;
1559
+		if ($filter_name == '') {
1560
+			$filter_name = $this->filter_name;
1561
+		}
1336 1562
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1337 1563
 			$Spotter = new Spotter($this->db);
1338 1564
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1356,7 +1582,9 @@  discard block
 block discarded – undo
1356 1582
 		return $all;
1357 1583
 	}
1358 1584
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
1359
-		if ($filter_name == '') $filter_name = $this->filter_name;
1585
+		if ($filter_name == '') {
1586
+			$filter_name = $this->filter_name;
1587
+		}
1360 1588
 		$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
1361 1589
 		$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1362 1590
 		try {
@@ -1369,7 +1597,9 @@  discard block
 block discarded – undo
1369 1597
 		return $all;
1370 1598
 	}
1371 1599
 	public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') {
1372
-		if ($filter_name == '') $filter_name = $this->filter_name;
1600
+		if ($filter_name == '') {
1601
+			$filter_name = $this->filter_name;
1602
+		}
1373 1603
 		$query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name";
1374 1604
 		$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1375 1605
 		try {
@@ -1380,7 +1610,9 @@  discard block
 block discarded – undo
1380 1610
 		}
1381 1611
 	}
1382 1612
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') {
1383
-		if ($filter_name == '') $filter_name = $this->filter_name;
1613
+		if ($filter_name == '') {
1614
+			$filter_name = $this->filter_name;
1615
+		}
1384 1616
 		global $globalArchiveMonths, $globalDBdriver;
1385 1617
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1386 1618
 			$Spotter = new Spotter($this->db);
@@ -1436,7 +1668,9 @@  discard block
 block discarded – undo
1436 1668
 	}
1437 1669
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
1438 1670
 		global $globalArchiveMonths, $globalDBdriver;
1439
-		if ($filter_name == '') $filter_name = $this->filter_name;
1671
+		if ($filter_name == '') {
1672
+			$filter_name = $this->filter_name;
1673
+		}
1440 1674
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1441 1675
 			$Spotter = new Spotter($this->db);
1442 1676
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1469,7 +1703,9 @@  discard block
 block discarded – undo
1469 1703
 	}
1470 1704
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
1471 1705
 		global $globalArchiveMonths, $globalDBdriver;
1472
-		if ($filter_name == '') $filter_name = $this->filter_name;
1706
+		if ($filter_name == '') {
1707
+			$filter_name = $this->filter_name;
1708
+		}
1473 1709
 		if (strpos($stats_airline,'alliance_') !== FALSE) {
1474 1710
 			$Spotter = new Spotter($this->db);
1475 1711
 			$airlines = $Spotter->getAllAirlineNamesByAlliance(str_replace('_',' ',str_replace('alliance_','',$stats_airline)));
@@ -1500,7 +1736,9 @@  discard block
 block discarded – undo
1500 1736
 	}
1501 1737
 	public function getStatsAirlineTotal($filter_name = '') {
1502 1738
 		global $globalArchiveMonths, $globalDBdriver;
1503
-		if ($filter_name == '') $filter_name = $this->filter_name;
1739
+		if ($filter_name == '') {
1740
+			$filter_name = $this->filter_name;
1741
+		}
1504 1742
 		if ($globalDBdriver == 'mysql') {
1505 1743
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
1506 1744
 		} else {
@@ -1517,7 +1755,9 @@  discard block
 block discarded – undo
1517 1755
 	}
1518 1756
 	public function getStatsOwnerTotal($filter_name = '') {
1519 1757
 		global $globalArchiveMonths, $globalDBdriver;
1520
-		if ($filter_name == '') $filter_name = $this->filter_name;
1758
+		if ($filter_name == '') {
1759
+			$filter_name = $this->filter_name;
1760
+		}
1521 1761
 		if ($globalDBdriver == 'mysql') {
1522 1762
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
1523 1763
 		} else {
@@ -1534,7 +1774,9 @@  discard block
 block discarded – undo
1534 1774
 	}
1535 1775
 	public function getStatsOwner($owner_name,$filter_name = '') {
1536 1776
 		global $globalArchiveMonths, $globalDBdriver;
1537
-		if ($filter_name == '') $filter_name = $this->filter_name;
1777
+		if ($filter_name == '') {
1778
+			$filter_name = $this->filter_name;
1779
+		}
1538 1780
 		$query = "SELECT cnt FROM stats_owner WHERE filter_name = :filter_name AND owner_name = :owner_name";
1539 1781
 		try {
1540 1782
 			$sth = $this->db->prepare($query);
@@ -1543,12 +1785,17 @@  discard block
 block discarded – undo
1543 1785
 			echo "error : ".$e->getMessage();
1544 1786
 		}
1545 1787
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1546
-		if (isset($all[0]['cnt'])) return $all[0]['cnt'];
1547
-		else return 0;
1788
+		if (isset($all[0]['cnt'])) {
1789
+			return $all[0]['cnt'];
1790
+		} else {
1791
+			return 0;
1792
+		}
1548 1793
 	}
1549 1794
 	public function getStatsPilotTotal($filter_name = '') {
1550 1795
 		global $globalArchiveMonths, $globalDBdriver;
1551
-		if ($filter_name == '') $filter_name = $this->filter_name;
1796
+		if ($filter_name == '') {
1797
+			$filter_name = $this->filter_name;
1798
+		}
1552 1799
 		if ($globalDBdriver == 'mysql') {
1553 1800
 			$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
1554 1801
 		} else {
@@ -1565,7 +1812,9 @@  discard block
 block discarded – undo
1565 1812
 	}
1566 1813
 	public function getStatsPilot($pilot,$filter_name = '') {
1567 1814
 		global $globalArchiveMonths, $globalDBdriver;
1568
-		if ($filter_name == '') $filter_name = $this->filter_name;
1815
+		if ($filter_name == '') {
1816
+			$filter_name = $this->filter_name;
1817
+		}
1569 1818
 		$query = "SELECT cnt FROM stats_pilot WHERE filter_name = :filter_name AND (pilot_name = :pilot OR pilot_id = :pilot)";
1570 1819
 		try {
1571 1820
 			$sth = $this->db->prepare($query);
@@ -1574,13 +1823,18 @@  discard block
 block discarded – undo
1574 1823
 			echo "error : ".$e->getMessage();
1575 1824
 		}
1576 1825
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1577
-		if (isset($all[0]['cnt'])) return $all[0]['cnt'];
1578
-		else return 0;
1826
+		if (isset($all[0]['cnt'])) {
1827
+			return $all[0]['cnt'];
1828
+		} else {
1829
+			return 0;
1830
+		}
1579 1831
 	}
1580 1832
 
1581 1833
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1582 1834
 		global $globalDBdriver;
1583
-		if ($filter_name == '') $filter_name = $this->filter_name;
1835
+		if ($filter_name == '') {
1836
+			$filter_name = $this->filter_name;
1837
+		}
1584 1838
 		if ($globalDBdriver == 'mysql') {
1585 1839
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt";
1586 1840
 		} else {
@@ -1596,7 +1850,9 @@  discard block
 block discarded – undo
1596 1850
 	}
1597 1851
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
1598 1852
 		global $globalDBdriver;
1599
-		if ($filter_name == '') $filter_name = $this->filter_name;
1853
+		if ($filter_name == '') {
1854
+			$filter_name = $this->filter_name;
1855
+		}
1600 1856
 		if ($globalDBdriver == 'mysql') {
1601 1857
 			$query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
1602 1858
 		} else {
@@ -1982,10 +2238,14 @@  discard block
 block discarded – undo
1982 2238
 		$Connection = new Connection();
1983 2239
 		date_default_timezone_set('UTC');
1984 2240
 		$last_update = $this->getLastStatsUpdate('last_update_stats');
1985
-			if ($globalDebug) echo 'Update stats !'."\n";
2241
+			if ($globalDebug) {
2242
+				echo 'Update stats !'."\n";
2243
+			}
1986 2244
 			if (isset($last_update[0]['value'])) {
1987 2245
 				$last_update_day = $last_update[0]['value'];
1988
-			} else $last_update_day = '2012-12-12 12:12:12';
2246
+			} else {
2247
+				$last_update_day = '2012-12-12 12:12:12';
2248
+			}
1989 2249
 			$reset = false;
1990 2250
 			//if ($globalStatsResetYear && date('Y',strtotime($last_update_day)) != date('Y')) {
1991 2251
 			if ($globalStatsResetYear) {
@@ -1994,43 +2254,63 @@  discard block
 block discarded – undo
1994 2254
 			}
1995 2255
 			$Spotter = new Spotter($this->db);
1996 2256
 
1997
-			if ($globalDebug) echo 'Count all aircraft types...'."\n";
2257
+			if ($globalDebug) {
2258
+				echo 'Count all aircraft types...'."\n";
2259
+			}
1998 2260
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1999 2261
 			foreach ($alldata as $number) {
2000 2262
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset);
2001 2263
 			}
2002
-			if ($globalDebug) echo 'Count all airlines...'."\n";
2264
+			if ($globalDebug) {
2265
+				echo 'Count all airlines...'."\n";
2266
+			}
2003 2267
 			$alldata = $Spotter->countAllAirlines(false,0,$last_update_day);
2004 2268
 			foreach ($alldata as $number) {
2005 2269
 				$this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset);
2006 2270
 			}
2007
-			if ($globalDebug) echo 'Count all registrations...'."\n";
2271
+			if ($globalDebug) {
2272
+				echo 'Count all registrations...'."\n";
2273
+			}
2008 2274
 			$alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day);
2009 2275
 			foreach ($alldata as $number) {
2010 2276
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset);
2011 2277
 			}
2012
-			if ($globalDebug) echo 'Count all callsigns...'."\n";
2278
+			if ($globalDebug) {
2279
+				echo 'Count all callsigns...'."\n";
2280
+			}
2013 2281
 			$alldata = $Spotter->countAllCallsigns(false,0,$last_update_day);
2014 2282
 			foreach ($alldata as $number) {
2015 2283
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
2016 2284
 			}
2017
-			if ($globalDebug) echo 'Count all owners...'."\n";
2285
+			if ($globalDebug) {
2286
+				echo 'Count all owners...'."\n";
2287
+			}
2018 2288
 			$alldata = $Spotter->countAllOwners(false,0,$last_update_day);
2019 2289
 			foreach ($alldata as $number) {
2020 2290
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset);
2021 2291
 			}
2022
-			if ($globalDebug) echo 'Count all pilots...'."\n";
2292
+			if ($globalDebug) {
2293
+				echo 'Count all pilots...'."\n";
2294
+			}
2023 2295
 			$alldata = $Spotter->countAllPilots(false,0,$last_update_day);
2024 2296
 			foreach ($alldata as $number) {
2025
-				if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') $number['pilot_id'] = $number['pilot_name'];
2297
+				if ($number['pilot_id'] == 0 || $number['pilot_id'] == '') {
2298
+					$number['pilot_id'] = $number['pilot_name'];
2299
+				}
2026 2300
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset);
2027 2301
 			}
2028 2302
 			
2029
-			if ($globalDebug) echo 'Count all departure airports...'."\n";
2303
+			if ($globalDebug) {
2304
+				echo 'Count all departure airports...'."\n";
2305
+			}
2030 2306
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
2031
-			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
2307
+			if ($globalDebug) {
2308
+				echo 'Count all detected departure airports...'."\n";
2309
+			}
2032 2310
 			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
2033
-			if ($globalDebug) echo 'Order departure airports...'."\n";
2311
+			if ($globalDebug) {
2312
+				echo 'Order departure airports...'."\n";
2313
+			}
2034 2314
 			$alldata = array();
2035 2315
 			foreach ($pall as $value) {
2036 2316
 				$icao = $value['airport_departure_icao'];
@@ -2040,7 +2320,9 @@  discard block
 block discarded – undo
2040 2320
 				$icao = $value['airport_departure_icao'];
2041 2321
 				if (isset($alldata[$icao])) {
2042 2322
 					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
2043
-				} else $alldata[$icao] = $value;
2323
+				} else {
2324
+					$alldata[$icao] = $value;
2325
+				}
2044 2326
 			}
2045 2327
 			$count = array();
2046 2328
 			foreach ($alldata as $key => $row) {
@@ -2050,11 +2332,17 @@  discard block
 block discarded – undo
2050 2332
 			foreach ($alldata as $number) {
2051 2333
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset);
2052 2334
 			}
2053
-			if ($globalDebug) echo 'Count all arrival airports...'."\n";
2335
+			if ($globalDebug) {
2336
+				echo 'Count all arrival airports...'."\n";
2337
+			}
2054 2338
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
2055
-			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
2339
+			if ($globalDebug) {
2340
+				echo 'Count all detected arrival airports...'."\n";
2341
+			}
2056 2342
 			$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
2057
-			if ($globalDebug) echo 'Order arrival airports...'."\n";
2343
+			if ($globalDebug) {
2344
+				echo 'Order arrival airports...'."\n";
2345
+			}
2058 2346
 			$alldata = array();
2059 2347
 			foreach ($pall as $value) {
2060 2348
 				$icao = $value['airport_arrival_icao'];
@@ -2064,7 +2352,9 @@  discard block
 block discarded – undo
2064 2352
 				$icao = $value['airport_arrival_icao'];
2065 2353
 				if (isset($alldata[$icao])) {
2066 2354
 					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
2067
-				} else $alldata[$icao] = $value;
2355
+				} else {
2356
+					$alldata[$icao] = $value;
2357
+				}
2068 2358
 			}
2069 2359
 			$count = array();
2070 2360
 			foreach ($alldata as $key => $row) {
@@ -2075,7 +2365,9 @@  discard block
 block discarded – undo
2075 2365
 				echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset);
2076 2366
 			}
2077 2367
 			if ($Connection->tableExists('countries')) {
2078
-				if ($globalDebug) echo 'Count all flights by countries...'."\n";
2368
+				if ($globalDebug) {
2369
+					echo 'Count all flights by countries...'."\n";
2370
+				}
2079 2371
 				//$SpotterArchive = new SpotterArchive();
2080 2372
 				//$alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day);
2081 2373
 				$Spotter = new Spotter($this->db);
@@ -2086,7 +2378,9 @@  discard block
 block discarded – undo
2086 2378
 			}
2087 2379
 			
2088 2380
 			if (isset($globalAccidents) && $globalAccidents) {
2089
-				if ($globalDebug) echo 'Count fatalities stats...'."\n";
2381
+				if ($globalDebug) {
2382
+					echo 'Count fatalities stats...'."\n";
2383
+				}
2090 2384
 				$Accident = new Accident();
2091 2385
 				$this->deleteStatsByType('fatalities_byyear');
2092 2386
 				$alldata = $Accident->countFatalitiesByYear();
@@ -2102,48 +2396,68 @@  discard block
 block discarded – undo
2102 2396
 
2103 2397
 			// Add by month using getstat if month finish...
2104 2398
 			//if (date('m',strtotime($last_update_day)) != date('m')) {
2105
-			if ($globalDebug) echo 'Count all flights by months...'."\n";
2399
+			if ($globalDebug) {
2400
+				echo 'Count all flights by months...'."\n";
2401
+			}
2106 2402
 			$last_month = date('Y-m-01 00:00:00', strtotime('-1 month', strtotime($last_update_day)));
2107 2403
 			$filter_last_month = array('since_date' => $last_month);
2108 2404
 			$Spotter = new Spotter($this->db);
2109 2405
 			$alldata = $Spotter->countAllMonths($filter_last_month);
2110 2406
 			$lastyear = false;
2111 2407
 			foreach ($alldata as $number) {
2112
-				if ($number['year_name'] != date('Y')) $lastyear = true;
2408
+				if ($number['year_name'] != date('Y')) {
2409
+					$lastyear = true;
2410
+				}
2113 2411
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2114 2412
 			}
2115
-			if ($globalDebug) echo 'Count all military flights by months...'."\n";
2413
+			if ($globalDebug) {
2414
+				echo 'Count all military flights by months...'."\n";
2415
+			}
2116 2416
 			$alldata = $Spotter->countAllMilitaryMonths($filter_last_month);
2117 2417
 			foreach ($alldata as $number) {
2118 2418
 				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2119 2419
 			}
2120
-			if ($globalDebug) echo 'Count all owners by months...'."\n";
2420
+			if ($globalDebug) {
2421
+				echo 'Count all owners by months...'."\n";
2422
+			}
2121 2423
 			$alldata = $Spotter->countAllMonthsOwners($filter_last_month);
2122 2424
 			foreach ($alldata as $number) {
2123 2425
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2124 2426
 			}
2125
-			if ($globalDebug) echo 'Count all pilots by months...'."\n";
2427
+			if ($globalDebug) {
2428
+				echo 'Count all pilots by months...'."\n";
2429
+			}
2126 2430
 			$alldata = $Spotter->countAllMonthsPilots($filter_last_month);
2127 2431
 			foreach ($alldata as $number) {
2128 2432
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2129 2433
 			}
2130
-			if ($globalDebug) echo 'Count all airlines by months...'."\n";
2434
+			if ($globalDebug) {
2435
+				echo 'Count all airlines by months...'."\n";
2436
+			}
2131 2437
 			$alldata = $Spotter->countAllMonthsAirlines($filter_last_month);
2132 2438
 			foreach ($alldata as $number) {
2133 2439
 				$this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2134 2440
 			}
2135
-			if ($globalDebug) echo 'Count all aircrafts by months...'."\n";
2441
+			if ($globalDebug) {
2442
+				echo 'Count all aircrafts by months...'."\n";
2443
+			}
2136 2444
 			$alldata = $Spotter->countAllMonthsAircrafts($filter_last_month);
2137 2445
 			foreach ($alldata as $number) {
2138 2446
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2139 2447
 			}
2140
-			if ($globalDebug) echo 'Count all real arrivals by months...'."\n";
2448
+			if ($globalDebug) {
2449
+				echo 'Count all real arrivals by months...'."\n";
2450
+			}
2141 2451
 			$alldata = $Spotter->countAllMonthsRealArrivals($filter_last_month);
2142 2452
 			foreach ($alldata as $number) {
2143 2453
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
2144 2454
 			}
2145
-			if ($globalDebug) echo 'Airports data...'."\n";
2146
-			if ($globalDebug) echo '...Departure'."\n";
2455
+			if ($globalDebug) {
2456
+				echo 'Airports data...'."\n";
2457
+			}
2458
+			if ($globalDebug) {
2459
+				echo '...Departure'."\n";
2460
+			}
2147 2461
 			$this->deleteStatAirport('daily');
2148 2462
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
2149 2463
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
@@ -2261,7 +2575,9 @@  discard block
 block discarded – undo
2261 2575
 			// Count by airlines
2262 2576
 			echo '--- Stats by airlines ---'."\n";
2263 2577
 			if ($Connection->tableExists('countries')) {
2264
-				if ($globalDebug) echo 'Count all flights by countries by airlines...'."\n";
2578
+				if ($globalDebug) {
2579
+					echo 'Count all flights by countries by airlines...'."\n";
2580
+				}
2265 2581
 				$SpotterArchive = new SpotterArchive();
2266 2582
 				//$Spotter = new Spotter($this->db);
2267 2583
 				$alldata = $SpotterArchive->countAllFlightOverCountriesByAirlines(false,0,$last_update_day);
@@ -2270,37 +2586,53 @@  discard block
 block discarded – undo
2270 2586
 					$this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],$number['airline_icao'],'',$reset);
2271 2587
 				}
2272 2588
 			}
2273
-			if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n";
2589
+			if ($globalDebug) {
2590
+				echo 'Count all aircraft types by airlines...'."\n";
2591
+			}
2274 2592
 			$Spotter = new Spotter($this->db);
2275 2593
 			$alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day);
2276 2594
 			foreach ($alldata as $number) {
2277 2595
 				$this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset);
2278 2596
 			}
2279
-			if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n";
2597
+			if ($globalDebug) {
2598
+				echo 'Count all aircraft registrations by airlines...'."\n";
2599
+			}
2280 2600
 			$alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day);
2281 2601
 			foreach ($alldata as $number) {
2282 2602
 				$this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset);
2283 2603
 			}
2284
-			if ($globalDebug) echo 'Count all callsigns by airlines...'."\n";
2604
+			if ($globalDebug) {
2605
+				echo 'Count all callsigns by airlines...'."\n";
2606
+			}
2285 2607
 			$alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day);
2286 2608
 			foreach ($alldata as $number) {
2287 2609
 				$this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset);
2288 2610
 			}
2289
-			if ($globalDebug) echo 'Count all owners by airlines...'."\n";
2611
+			if ($globalDebug) {
2612
+				echo 'Count all owners by airlines...'."\n";
2613
+			}
2290 2614
 			$alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day);
2291 2615
 			foreach ($alldata as $number) {
2292 2616
 				$this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset);
2293 2617
 			}
2294
-			if ($globalDebug) echo 'Count all pilots by airlines...'."\n";
2618
+			if ($globalDebug) {
2619
+				echo 'Count all pilots by airlines...'."\n";
2620
+			}
2295 2621
 			$alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day);
2296 2622
 			foreach ($alldata as $number) {
2297 2623
 				$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset);
2298 2624
 			}
2299
-			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
2625
+			if ($globalDebug) {
2626
+				echo 'Count all departure airports by airlines...'."\n";
2627
+			}
2300 2628
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
2301
-			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
2629
+			if ($globalDebug) {
2630
+				echo 'Count all detected departure airports by airlines...'."\n";
2631
+			}
2302 2632
 			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
2303
-			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
2633
+			if ($globalDebug) {
2634
+				echo 'Order detected departure airports by airlines...'."\n";
2635
+			}
2304 2636
 			//$alldata = array();
2305 2637
 			foreach ($dall as $value) {
2306 2638
 				$icao = $value['airport_departure_icao'];
@@ -2321,11 +2653,17 @@  discard block
 block discarded – undo
2321 2653
 			foreach ($alldata as $number) {
2322 2654
 				echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset);
2323 2655
 			}
2324
-			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
2656
+			if ($globalDebug) {
2657
+				echo 'Count all arrival airports by airlines...'."\n";
2658
+			}
2325 2659
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
2326
-			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
2660
+			if ($globalDebug) {
2661
+				echo 'Count all detected arrival airports by airlines...'."\n";
2662
+			}
2327 2663
 			$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
2328
-			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
2664
+			if ($globalDebug) {
2665
+				echo 'Order arrival airports by airlines...'."\n";
2666
+			}
2329 2667
 			//$alldata = array();
2330 2668
 			foreach ($dall as $value) {
2331 2669
 				$icao = $value['airport_arrival_icao'];
@@ -2344,37 +2682,53 @@  discard block
 block discarded – undo
2344 2682
 			}
2345 2683
 			$alldata = $pall;
2346 2684
 			foreach ($alldata as $number) {
2347
-				if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
2685
+				if ($number['airline_icao'] != '') {
2686
+					echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset);
2687
+				}
2688
+			}
2689
+			if ($globalDebug) {
2690
+				echo 'Count all flights by months by airlines...'."\n";
2348 2691
 			}
2349
-			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
2350 2692
 			$Spotter = new Spotter($this->db);
2351 2693
 			$alldata = $Spotter->countAllMonthsByAirlines($filter_last_month);
2352 2694
 			$lastyear = false;
2353 2695
 			foreach ($alldata as $number) {
2354
-				if ($number['year_name'] != date('Y')) $lastyear = true;
2696
+				if ($number['year_name'] != date('Y')) {
2697
+					$lastyear = true;
2698
+				}
2355 2699
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2356 2700
 			}
2357
-			if ($globalDebug) echo 'Count all owners by months by airlines...'."\n";
2701
+			if ($globalDebug) {
2702
+				echo 'Count all owners by months by airlines...'."\n";
2703
+			}
2358 2704
 			$alldata = $Spotter->countAllMonthsOwnersByAirlines($filter_last_month);
2359 2705
 			foreach ($alldata as $number) {
2360 2706
 				$this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2361 2707
 			}
2362
-			if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n";
2708
+			if ($globalDebug) {
2709
+				echo 'Count all pilots by months by airlines...'."\n";
2710
+			}
2363 2711
 			$alldata = $Spotter->countAllMonthsPilotsByAirlines($filter_last_month);
2364 2712
 			foreach ($alldata as $number) {
2365 2713
 				$this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2366 2714
 			}
2367
-			if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n";
2715
+			if ($globalDebug) {
2716
+				echo 'Count all aircrafts by months by airlines...'."\n";
2717
+			}
2368 2718
 			$alldata = $Spotter->countAllMonthsAircraftsByAirlines($filter_last_month);
2369 2719
 			foreach ($alldata as $number) {
2370 2720
 				$this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2371 2721
 			}
2372
-			if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n";
2722
+			if ($globalDebug) {
2723
+				echo 'Count all real arrivals by months by airlines...'."\n";
2724
+			}
2373 2725
 			$alldata = $Spotter->countAllMonthsRealArrivalsByAirlines($filter_last_month);
2374 2726
 			foreach ($alldata as $number) {
2375 2727
 				$this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']);
2376 2728
 			}
2377
-			if ($globalDebug) echo '...Departure'."\n";
2729
+			if ($globalDebug) {
2730
+				echo '...Departure'."\n";
2731
+			}
2378 2732
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
2379 2733
 			$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
2380 2734
 			foreach ($dall as $value) {
@@ -2397,7 +2751,9 @@  discard block
 block discarded – undo
2397 2751
 			foreach ($alldata as $number) {
2398 2752
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']);
2399 2753
 			}
2400
-			if ($globalDebug) echo '...Arrival'."\n";
2754
+			if ($globalDebug) {
2755
+				echo '...Arrival'."\n";
2756
+			}
2401 2757
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
2402 2758
 			$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
2403 2759
 			foreach ($dall as $value) {
@@ -2421,13 +2777,19 @@  discard block
 block discarded – undo
2421 2777
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']);
2422 2778
 			}
2423 2779
 
2424
-			if ($globalDebug) echo 'Flights data...'."\n";
2425
-			if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n";
2780
+			if ($globalDebug) {
2781
+				echo 'Flights data...'."\n";
2782
+			}
2783
+			if ($globalDebug) {
2784
+				echo '-> countAllDatesLastMonth...'."\n";
2785
+			}
2426 2786
 			$alldata = $Spotter->countAllDatesLastMonthByAirlines($filter_last_month);
2427 2787
 			foreach ($alldata as $number) {
2428 2788
 				$this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']);
2429 2789
 			}
2430
-			if ($globalDebug) echo '-> countAllDates...'."\n";
2790
+			if ($globalDebug) {
2791
+				echo '-> countAllDates...'."\n";
2792
+			}
2431 2793
 			//$previousdata = $this->countAllDatesByAirlines();
2432 2794
 			$alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines($filter_last_month));
2433 2795
 			$values = array();
@@ -2440,21 +2802,27 @@  discard block
 block discarded – undo
2440 2802
 				$this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']);
2441 2803
 			}
2442 2804
 			
2443
-			if ($globalDebug) echo '-> countAllHours...'."\n";
2805
+			if ($globalDebug) {
2806
+				echo '-> countAllHours...'."\n";
2807
+			}
2444 2808
 			$alldata = $Spotter->countAllHoursByAirlines('hour',$filter_last_month);
2445 2809
 			foreach ($alldata as $number) {
2446 2810
 				$this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']);
2447 2811
 			}
2448 2812
 
2449 2813
 			// Stats by filters
2450
-			if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array();
2814
+			if (!isset($globalStatsFilters) || $globalStatsFilters == '') {
2815
+				$globalStatsFilters = array();
2816
+			}
2451 2817
 			foreach ($globalStatsFilters as $name => $filter) {
2452 2818
 				//$filter_name = $filter['name'];
2453 2819
 				$filter_name = $name;
2454 2820
 				$reset = false;
2455 2821
 				$last_update = $this->getLastStatsUpdate('last_update_stats_'.$filter_name);
2456 2822
 				if (isset($filter['resetall']) && isset($last_update[0]['value']) && strtotime($filter['resetall']) > strtotime($last_update[0]['value'])) {
2457
-					if ($globalDebug) echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n";
2823
+					if ($globalDebug) {
2824
+						echo '!!! Delete stats for filter '.$filter_name.' !!!'."\n";
2825
+					}
2458 2826
 					$this->deleteOldStats($filter_name);
2459 2827
 					unset($last_update);
2460 2828
 				}
@@ -2473,7 +2841,9 @@  discard block
 block discarded – undo
2473 2841
 				
2474 2842
 
2475 2843
 				// Count by filter
2476
-				if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n";
2844
+				if ($globalDebug) {
2845
+					echo '--- Stats for filter '.$filter_name.' ---'."\n";
2846
+				}
2477 2847
 				$Spotter = new Spotter($this->db);
2478 2848
 				$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter);
2479 2849
 				foreach ($alldata as $number) {
@@ -2510,7 +2880,9 @@  discard block
 block discarded – undo
2510 2880
 					$icao = $value['airport_departure_icao'];
2511 2881
 					if (isset($alldata[$icao])) {
2512 2882
 						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
2513
-					} else $alldata[$icao] = $value;
2883
+					} else {
2884
+						$alldata[$icao] = $value;
2885
+					}
2514 2886
 				}
2515 2887
 				$count = array();
2516 2888
 				foreach ($alldata as $key => $row) {
@@ -2531,7 +2903,9 @@  discard block
 block discarded – undo
2531 2903
 					$icao = $value['airport_arrival_icao'];
2532 2904
 					if (isset($alldata[$icao])) {
2533 2905
 						$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
2534
-					} else $alldata[$icao] = $value;
2906
+					} else {
2907
+						$alldata[$icao] = $value;
2908
+					}
2535 2909
 				}
2536 2910
 				$count = array();
2537 2911
 				foreach ($alldata as $key => $row) {
@@ -2545,7 +2919,9 @@  discard block
 block discarded – undo
2545 2919
 				$alldata = $Spotter->countAllMonths($filter);
2546 2920
 				$lastyear = false;
2547 2921
 				foreach ($alldata as $number) {
2548
-					if ($number['year_name'] != date('Y')) $lastyear = true;
2922
+					if ($number['year_name'] != date('Y')) {
2923
+						$lastyear = true;
2924
+					}
2549 2925
 					$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name);
2550 2926
 				}
2551 2927
 				$alldata = $Spotter->countAllMonthsOwners($filter);
Please login to merge, or discard this patch.
airline-statistics-registration.php 2 patches
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -42,7 +42,9 @@  discard block
 block discarded – undo
42 42
 	}
43 43
 	$Stats = new Stats();
44 44
 	$airline_names = $Stats->getAllAirlineNames();
45
-	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
45
+	if (empty($airline_names)) {
46
+		$airline_names = $Spotter->getAllAirlineNames();
47
+	}
46 48
 	foreach($airline_names as $airline_name)
47 49
 	{
48 50
 		if($airline == $airline_name['airline_icao'])
@@ -65,8 +67,7 @@  discard block
 block discarded – undo
65 67
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
66 68
 			{
67 69
 				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" />';
68
-			}
69
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
70
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
70 71
 			{
71 72
 				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" />';
72 73
 			}
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@  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 12
 $alliance = false;
13
-if (strpos($airline,'alliance_') !== FALSE) {
13
+if (strpos($airline, 'alliance_') !== FALSE) {
14 14
 	$alliance = true;
15 15
 } else {
16
-	$spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1","");
16
+	$spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", "");
17 17
 }
18 18
 
19 19
 if (!empty($spotter_array) || $alliance === true)
20 20
 {
21 21
 	if ($alliance) {
22
-		$title = sprintf(_("Most Common Aircraft by Registration from %s"),str_replace('_',' ',str_replace('alliance_','',$airline)));
22
+		$title = sprintf(_("Most Common Aircraft by Registration from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline)));
23 23
 	} else {
24
-		$title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
24
+		$title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']);
25 25
 	}
26 26
 	require_once('header.php');
27 27
 
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 	$alliances = $Spotter->getAllAllianceNames();
33 33
 	if (!empty($alliances)) {
34 34
 		foreach ($alliances as $al) {
35
-			if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) {
36
-				print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>';
35
+			if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) {
36
+				print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>';
37 37
 			} else {
38
-				print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>';
38
+				print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>';
39 39
 			}
40 40
 		}
41 41
 		print '<option disabled>──────────────────</option>';
@@ -43,9 +43,9 @@  discard block
 block discarded – undo
43 43
 	$Stats = new Stats();
44 44
 	$airline_names = $Stats->getAllAirlineNames();
45 45
 	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
46
-	foreach($airline_names as $airline_name)
46
+	foreach ($airline_names as $airline_name)
47 47
 	{
48
-		if($airline == $airline_name['airline_icao'])
48
+		if ($airline == $airline_name['airline_icao'])
49 49
 		{
50 50
 			print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
51 51
 		} else {
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
 			print '</div>';
80 80
 		} else {
81 81
 			print '<div class="info column">';
82
-			print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>';
83
-			if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png'))
82
+			print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>';
83
+			if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png'))
84 84
 			{
85
-				print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />';
85
+				print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />';
86 86
 			}
87
-			print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>';
87
+			print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>';
88 88
 			print '</div>';
89 89
 		}
90 90
 	} else {
@@ -95,9 +95,9 @@  discard block
 block discarded – undo
95 95
 	print '<div class="column">';
96 96
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
97 97
 	if ($alliance) {
98
-		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>';
98
+		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>';
99 99
 	} else {
100
-		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
100
+		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>';
101 101
 	}
102 102
 	/*
103 103
 	if ($alliance) {
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 		$aircraft_array = $Spotter->countAllAircraftRegistrationByAirline($airline);
107 107
 	}
108 108
 	*/
109
-	$aircraft_array = $Stats->countAllAircraftRegistrations(true,$airline);
109
+	$aircraft_array = $Stats->countAllAircraftRegistrations(true, $airline);
110 110
 	if (!empty($aircraft_array))
111 111
 	{
112 112
 		print '<div class="table-responsive">';
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 		print '</thead>';
122 122
 		print '<tbody>';
123 123
 		$i = 1;
124
-		foreach($aircraft_array as $aircraft_item)
124
+		foreach ($aircraft_array as $aircraft_item)
125 125
 		{
126 126
 			print '<tr>';
127 127
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
airline-detailed.php 2 patches
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19 19
 		$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
20 20
 		$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -46,7 +46,9 @@  discard block
 block discarded – undo
46 46
 		} else {
47 47
 			if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) {
48 48
 				$title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
49
-			} else $title = '';
49
+			} else {
50
+				$title = '';
51
+			}
50 52
 		}
51 53
 		require_once('header.php');
52 54
 	  
@@ -67,7 +69,9 @@  discard block
 block discarded – undo
67 69
 		}
68 70
 		$Stats = new Stats();
69 71
 		$airline_names = $Stats->getAllAirlineNames();
70
-		if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
72
+		if (empty($airline_names)) {
73
+			$airline_names = $Spotter->getAllAirlineNames();
74
+		}
71 75
 		foreach($airline_names as $airline_name)
72 76
 		{
73 77
 			if($airline == $airline_name['airline_icao'])
@@ -97,10 +101,16 @@  discard block
 block discarded – undo
97 101
 				print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['airline_name'].'</div>';
98 102
 				print '<div><span class="label">'._("Country").'</span>'.$spotter_array[0]['airline_country'].'</div>';
99 103
 				print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['airline_icao'].'</div>';
100
-				if (isset($spotter_array[0]['airline_iata'])) print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>';
101
-				if (isset($spotter_array[0]['airline_callsign'])) print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; 
104
+				if (isset($spotter_array[0]['airline_iata'])) {
105
+					print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>';
106
+				}
107
+				if (isset($spotter_array[0]['airline_callsign'])) {
108
+					print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>';
109
+				}
102 110
 				print '<div><span class="label">'._("Type").'</span>'.ucwords($spotter_array[0]['airline_type']).'</div>';
103
-				if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>';
111
+				if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) {
112
+					print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>';
113
+				}
104 114
 				print '</div>';
105 115
 			} else {
106 116
 				print '<div class="info column">';
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -4,20 +4,20 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 
7
-if (!isset($_GET['airline'])){
7
+if (!isset($_GET['airline'])) {
8 8
 	header('Location: '.$globalURL.'/airline');
9
-} else{
9
+} else {
10 10
 	$Spotter = new Spotter();
11 11
 	//calculuation for the pagination
12
-	if(!isset($_GET['limit']) || $_GET['limit'] == "")
12
+	if (!isset($_GET['limit']) || $_GET['limit'] == "")
13 13
 	{
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19
-		$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
20
-		$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
19
+		$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
20
+		$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
21 21
 		if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) {
22 22
 			$limit_start = 0;
23 23
 			$limit_end = 25;
@@ -28,24 +28,24 @@  discard block
 block discarded – undo
28 28
 	$limit_previous_1 = $limit_start - $absolute_difference;
29 29
 	$limit_previous_2 = $limit_end - $absolute_difference;
30 30
 	
31
-	$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
31
+	$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
32 32
 	$page_url = $globalURL.'/airline/'.$airline;
33 33
 	$alliance = false;
34
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
35
-	if (strpos($airline,'alliance_') !== FALSE) {
36
-		$spotter_array = $Spotter->getSpotterDataByAirline('',$limit_start.",".$absolute_difference, $sort,array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline))));
34
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
35
+	if (strpos($airline, 'alliance_') !== FALSE) {
36
+		$spotter_array = $Spotter->getSpotterDataByAirline('', $limit_start.",".$absolute_difference, $sort, array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $airline))));
37 37
 		$alliance = true;
38 38
 	} else {
39
-		$spotter_array = $Spotter->getSpotterDataByAirline($airline,$limit_start.",".$absolute_difference, $sort);
39
+		$spotter_array = $Spotter->getSpotterDataByAirline($airline, $limit_start.",".$absolute_difference, $sort);
40 40
 	}
41 41
 	
42 42
 	if (!empty($spotter_array))
43 43
 	{
44 44
 		if ($alliance) {
45
-			$title = sprintf(_("Detailed View for %s"),str_replace('_',' ',str_replace('alliance_','',$airline)));
45
+			$title = sprintf(_("Detailed View for %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline)));
46 46
 		} else {
47 47
 			if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) {
48
-				$title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
48
+				$title = sprintf(_("Detailed View for %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']);
49 49
 			} else $title = '';
50 50
 		}
51 51
 		require_once('header.php');
@@ -57,10 +57,10 @@  discard block
 block discarded – undo
57 57
 		$alliances = $Spotter->getAllAllianceNames();
58 58
 		if (!empty($alliances)) {
59 59
 			foreach ($alliances as $al) {
60
-				if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) {
61
-					print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>';
60
+				if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) {
61
+					print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>';
62 62
 				} else {
63
-					print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>';
63
+					print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>';
64 64
 				}
65 65
 			}
66 66
 			print '<option disabled>───────────────</option>';
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
 		$Stats = new Stats();
69 69
 		$airline_names = $Stats->getAllAirlineNames();
70 70
 		if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
71
-		foreach($airline_names as $airline_name)
71
+		foreach ($airline_names as $airline_name)
72 72
 		{
73
-			if($airline == $airline_name['airline_icao'])
73
+			if ($airline == $airline_name['airline_icao'])
74 74
 			{
75 75
 				print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
76 76
 			} else {
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 				print '</div>';
105 105
 			} else {
106 106
 				print '<div class="info column">';
107
-				print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>';
108
-				if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png'))
107
+				print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>';
108
+				if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png'))
109 109
 				{
110
-					print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />';
110
+					print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />';
111 111
 				}
112
-				print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>';
112
+				print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>';
113 113
 				print '</div>';
114 114
 			}
115 115
 		} else {
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 		include('airline-sub-menu.php');
120 120
 		print '<div class="table column">';
121 121
 		if (isset($spotter_array[0]['airline_name']) && $alliance === false) {
122
-			print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
122
+			print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>';
123 123
 		}
124 124
 
125 125
 		include('table-output.php');  
Please login to merge, or discard this patch.