Completed
Push — master ( 4407ee...8e145a )
by Yannick
06:51
created
statistics-owner.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11
-    unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
13
-    $airline_icao = '';
11
+	unset($_COOKIE['stats_airline_icao']);
12
+	setcookie('stats_airline_icao', '', time()-3600);
13
+	$airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15
-    $airline_icao = $_COOKIE['stats_airline_icao'];
15
+	$airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
17
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19 19
 setcookie('stats_airline_icao',$airline_icao);
20 20
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
           function drawChart() {
36 36
             var data = google.visualization.arrayToDataTable([
37 37
             	["'._("Owner").'", "'._("# of times").'"], ';
38
-            	$owner_data = '';
38
+				$owner_data = '';
39 39
 		foreach($owner_array as $owner_item)
40 40
 		{
41 41
 			$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
42 42
 		}
43 43
 		$owner_data = substr($owner_data, 0, -1);
44 44
 		print $owner_data;
45
-            print ']);
45
+			print ']);
46 46
     
47 47
             var options = {
48 48
             	chartArea: {"width": "80%", "height": "60%"},
Please login to merge, or discard this patch.
statistics-pilot.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11
-    unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
13
-    $airline_icao = '';
11
+	unset($_COOKIE['stats_airline_icao']);
12
+	setcookie('stats_airline_icao', '', time()-3600);
13
+	$airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15
-    $airline_icao = $_COOKIE['stats_airline_icao'];
15
+	$airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
17
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19 19
 setcookie('stats_airline_icao',$airline_icao);
20 20
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
@@ -36,14 +36,14 @@  discard block
 block discarded – undo
36 36
           function drawChart() {
37 37
             var data = google.visualization.arrayToDataTable([
38 38
             	["'._("Pilot").'", "'._("# of times").'"], ';
39
-            	$pilot_data = '';
39
+				$pilot_data = '';
40 40
 		foreach($pilot_array as $pilot_item)
41 41
 		{
42 42
 			$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
43 43
 		}
44 44
 		$pilot_data = substr($pilot_data, 0, -1);
45 45
 		print $pilot_data;
46
-            print ']);
46
+			print ']);
47 47
     
48 48
             var options = {
49 49
             	chartArea: {"width": "80%", "height": "60%"},
Please login to merge, or discard this patch.
require/class.Stats.php 1 patch
Indentation   +737 added lines, -737 removed lines patch added patch discarded remove patch
@@ -15,33 +15,33 @@  discard block
 block discarded – undo
15 15
 		if (isset($globalFilterName)) $this->filter_name = $globalFilterName;
16 16
 		$Connection = new Connection($dbc);
17 17
 		$this->db = $Connection->db();
18
-        }
18
+		}
19 19
               
20 20
 	public function addLastStatsUpdate($type,$stats_date) {
21
-                $query = "DELETE FROM config WHERE name = :type;
21
+				$query = "DELETE FROM config WHERE name = :type;
22 22
             		INSERT INTO config (name,value) VALUES (:type,:stats_date);";
23
-                $query_values = array('type' => $type,':stats_date' => $stats_date);
24
-                 try {
25
-                        $sth = $this->db->prepare($query);
26
-                        $sth->execute($query_values);
27
-                } catch(PDOException $e) {
28
-                        return "error : ".$e->getMessage();
29
-                }
30
-        }
23
+				$query_values = array('type' => $type,':stats_date' => $stats_date);
24
+				 try {
25
+						$sth = $this->db->prepare($query);
26
+						$sth->execute($query_values);
27
+				} catch(PDOException $e) {
28
+						return "error : ".$e->getMessage();
29
+				}
30
+		}
31 31
 
32 32
 	public function getLastStatsUpdate($type = 'last_update_stats') {
33
-                $query = "SELECT value FROM config WHERE name = :type";
34
-                 try {
35
-                        $sth = $this->db->prepare($query);
36
-                        $sth->execute(array(':type' => $type));
37
-                } catch(PDOException $e) {
38
-                        echo "error : ".$e->getMessage();
39
-                }
40
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
-                return $all;
42
-        }
43
-        public function deleteStats($filter_name = '') {
44
-        	/*
33
+				$query = "SELECT value FROM config WHERE name = :type";
34
+				 try {
35
+						$sth = $this->db->prepare($query);
36
+						$sth->execute(array(':type' => $type));
37
+				} catch(PDOException $e) {
38
+						echo "error : ".$e->getMessage();
39
+				}
40
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
41
+				return $all;
42
+		}
43
+		public function deleteStats($filter_name = '') {
44
+			/*
45 45
         	$query = "DELETE FROM config WHERE name = 'last_update_stats'";
46 46
                  try {
47 47
                         $sth = $this->db->prepare($query);
@@ -50,80 +50,80 @@  discard block
 block discarded – undo
50 50
                         return "error : ".$e->getMessage();
51 51
                 }
52 52
                 */
53
-        	$query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport 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_flight 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;";
54
-                 try {
55
-                        $sth = $this->db->prepare($query);
56
-                        $sth->execute(array(':filter_name' => $filter_name));
57
-                } catch(PDOException $e) {
58
-                        return "error : ".$e->getMessage();
59
-                }
60
-        }
61
-        public function deleteOldStats($filter_name = '') {
53
+			$query = "DELETE FROM stats WHERE filter_name = :filter_name;DELETE FROM stats_aircraft WHERE filter_name = :filter_name;DELETE FROM stats_airline WHERE filter_name = :filter_name;DELETE FROM stats_airport 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_flight 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;";
54
+				 try {
55
+						$sth = $this->db->prepare($query);
56
+						$sth->execute(array(':filter_name' => $filter_name));
57
+				} catch(PDOException $e) {
58
+						return "error : ".$e->getMessage();
59
+				}
60
+		}
61
+		public function deleteOldStats($filter_name = '') {
62 62
         	
63
-        	$query = "DELETE FROM config WHERE name = 'last_update_stats'";
64
-                 try {
65
-                        $sth = $this->db->prepare($query);
66
-                        $sth->execute();
67
-                } catch(PDOException $e) {
68
-                        return "error : ".$e->getMessage();
69
-                }
63
+			$query = "DELETE FROM config WHERE name = 'last_update_stats'";
64
+				 try {
65
+						$sth = $this->db->prepare($query);
66
+						$sth->execute();
67
+				} catch(PDOException $e) {
68
+						return "error : ".$e->getMessage();
69
+				}
70 70
                 
71
-        	$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;";
72
-                 try {
73
-                        $sth = $this->db->prepare($query);
74
-                        $sth->execute(array(':filter_name' => $filter_name));
75
-                } catch(PDOException $e) {
76
-                        return "error : ".$e->getMessage();
77
-                }
78
-        }
71
+			$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;";
72
+				 try {
73
+						$sth = $this->db->prepare($query);
74
+						$sth->execute(array(':filter_name' => $filter_name));
75
+				} catch(PDOException $e) {
76
+						return "error : ".$e->getMessage();
77
+				}
78
+		}
79 79
 	public function getAllAirlineNames($filter_name = '') {
80 80
 		if ($filter_name == '') $filter_name = $this->filter_name;
81
-                $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
82
-                 try {
83
-                        $sth = $this->db->prepare($query);
84
-                        $sth->execute(array(':filter_name' => $filter_name));
85
-                } catch(PDOException $e) {
86
-                        echo "error : ".$e->getMessage();
87
-                }
88
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
89
-                return $all;
90
-        }
81
+				$query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC";
82
+				 try {
83
+						$sth = $this->db->prepare($query);
84
+						$sth->execute(array(':filter_name' => $filter_name));
85
+				} catch(PDOException $e) {
86
+						echo "error : ".$e->getMessage();
87
+				}
88
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
89
+				return $all;
90
+		}
91 91
 	public function getAllAircraftTypes($stats_airline = '',$filter_name = '') {
92 92
 		if ($filter_name == '') $filter_name = $this->filter_name;
93
-                $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94
-                 try {
95
-                        $sth = $this->db->prepare($query);
96
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
97
-                } catch(PDOException $e) {
98
-                        echo "error : ".$e->getMessage();
99
-                }
100
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
101
-                return $all;
102
-        }
93
+				$query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC";
94
+				 try {
95
+						$sth = $this->db->prepare($query);
96
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
97
+				} catch(PDOException $e) {
98
+						echo "error : ".$e->getMessage();
99
+				}
100
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
101
+				return $all;
102
+		}
103 103
 	public function getAllManufacturers($stats_airline = '',$filter_name = '') {
104 104
 		if ($filter_name == '') $filter_name = $this->filter_name;
105
-                $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";
106
-                 try {
107
-                        $sth = $this->db->prepare($query);
108
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
109
-                } catch(PDOException $e) {
110
-                        echo "error : ".$e->getMessage();
111
-                }
112
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
113
-                return $all;
114
-        }
105
+				$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";
106
+				 try {
107
+						$sth = $this->db->prepare($query);
108
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
109
+				} catch(PDOException $e) {
110
+						echo "error : ".$e->getMessage();
111
+				}
112
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
113
+				return $all;
114
+		}
115 115
 	public function getAllAirportNames($stats_airline = '',$filter_name = '') {
116 116
 		if ($filter_name == '') $filter_name = $this->filter_name;
117
-                $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";
118
-                 try {
119
-                        $sth = $this->db->prepare($query);
120
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
121
-                } catch(PDOException $e) {
122
-                        echo "error : ".$e->getMessage();
123
-                }
124
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
125
-                return $all;
126
-        }
117
+				$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";
118
+				 try {
119
+						$sth = $this->db->prepare($query);
120
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
121
+				} catch(PDOException $e) {
122
+						echo "error : ".$e->getMessage();
123
+				}
124
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
125
+				return $all;
126
+		}
127 127
 
128 128
 
129 129
 	public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') {
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
 			}
141 141
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
142 142
 		} else $all = array();
143
-                if (empty($all)) {
144
-            	    $filters = array('airlines' => array($stats_airline));
145
-            	    if ($filter_name != '') {
146
-            		    $filters = array_merge($filters,$globalStatsFilters[$filter_name]);
147
-            	    }
148
-            	    $Spotter = new Spotter($this->db);
149
-            	    $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month);
150
-                }
151
-                return $all;
143
+				if (empty($all)) {
144
+					$filters = array('airlines' => array($stats_airline));
145
+					if ($filter_name != '') {
146
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
147
+					}
148
+					$Spotter = new Spotter($this->db);
149
+					$all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month);
150
+				}
151
+				return $all;
152 152
 	}
153 153
 	public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') {
154 154
 		global $globalStatsFilters;
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 			}
165 165
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
166 166
 		} else $all = array();
167
-                if (empty($all)) {
168
-            		$Spotter = new Spotter($this->db);
169
-            		$filters = array();
170
-            		if ($filter_name != '') {
171
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
167
+				if (empty($all)) {
168
+					$Spotter = new Spotter($this->db);
169
+					$filters = array();
170
+					if ($filter_name != '') {
171
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
172 172
 			}
173
-            		$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month);
174
-                }
175
-                return $all;
173
+					$all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month);
174
+				}
175
+				return $all;
176 176
 	}
177 177
 	public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') {
178 178
 		global $globalStatsFilters;
@@ -213,37 +213,37 @@  discard block
 block discarded – undo
213 213
 			}
214 214
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
215 215
 		} else $all = array();
216
-                if (empty($all)) {
216
+				if (empty($all)) {
217 217
 			$filters = array('airlines' => array($stats_airline));
218 218
 			if ($filter_name != '') {
219
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
219
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
220 220
 			}
221 221
 			$Spotter = new Spotter($this->db);
222 222
 			$all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month);
223
-                }
224
-                return $all;
223
+				}
224
+				return $all;
225 225
 	}
226 226
 	public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') {
227 227
 		global $globalStatsFilters;
228 228
 		if ($filter_name == '') $filter_name = $this->filter_name;
229 229
 		if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0";
230 230
 		else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC";
231
-                 try {
232
-                        $sth = $this->db->prepare($query);
233
-                        $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
234
-                } catch(PDOException $e) {
235
-                        echo "error : ".$e->getMessage();
236
-                }
237
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
238
-                if (empty($all)) {
231
+				 try {
232
+						$sth = $this->db->prepare($query);
233
+						$sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name));
234
+				} catch(PDOException $e) {
235
+						echo "error : ".$e->getMessage();
236
+				}
237
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
238
+				if (empty($all)) {
239 239
 			$filters = array('airlines' => array($stats_airline));
240 240
 			if ($filter_name != '') {
241
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
241
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
242 242
 			}
243 243
 			$Spotter = new Spotter($this->db);
244 244
 			$all = $Spotter->countAllDepartureCountries($filters,$year,$month);
245
-                }
246
-                return $all;
245
+				}
246
+				return $all;
247 247
 	}
248 248
 
249 249
 	public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') {
@@ -260,16 +260,16 @@  discard block
 block discarded – undo
260 260
 			}
261 261
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
262 262
 		} else $all = array();
263
-                if (empty($all)) {
264
-	                $Spotter = new Spotter($this->db);
265
-            		$filters = array();
266
-            		if ($filter_name != '') {
267
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
263
+				if (empty($all)) {
264
+					$Spotter = new Spotter($this->db);
265
+					$filters = array();
266
+					if ($filter_name != '') {
267
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
268 268
 			}
269 269
 
270
-    		        $all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month);
271
-                }
272
-                return $all;
270
+					$all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month);
271
+				}
272
+				return $all;
273 273
 	}
274 274
 	public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
275 275
 		global $globalStatsFilters;
@@ -285,15 +285,15 @@  discard block
 block discarded – undo
285 285
 			}
286 286
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
287 287
 		} else $all = array();
288
-                if (empty($all)) {
288
+				if (empty($all)) {
289 289
 			$filters = array('airlines' => array($stats_airline));
290 290
 			if ($filter_name != '') {
291 291
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
292 292
 			}
293
-	                $Spotter = new Spotter($this->db);
294
-    		        $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month);
295
-                }
296
-                return $all;
293
+					$Spotter = new Spotter($this->db);
294
+					$all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month);
295
+				}
296
+				return $all;
297 297
 	}
298 298
 	public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
299 299
 		global $globalStatsFilters;
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 					echo "error : ".$e->getMessage();
334 334
 				}
335 335
 				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
336
-                /*
336
+				/*
337 337
                 if (empty($all)) {
338 338
 	                $Spotter = new Spotter($this->db);
339 339
     		        $all = $Spotter->countAllFlightOverCountries($limit);
@@ -384,15 +384,15 @@  discard block
 block discarded – undo
384 384
 			}
385 385
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
386 386
 		} else $all = array();
387
-                if (empty($all)) {
387
+				if (empty($all)) {
388 388
 			$filters = array('airlines' => array($stats_airline));
389 389
 			if ($filter_name != '') {
390 390
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
391 391
 			}
392
-            		$Spotter = new Spotter($this->db);
393
-            		$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month);
394
-                }
395
-                return $all;
392
+					$Spotter = new Spotter($this->db);
393
+					$all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month);
394
+				}
395
+				return $all;
396 396
 	}
397 397
 	public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
398 398
 		global $globalStatsFilters;
@@ -408,33 +408,33 @@  discard block
 block discarded – undo
408 408
 			}
409 409
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
410 410
 		} else $all = array();
411
-                if (empty($all)) {
411
+				if (empty($all)) {
412 412
 			$filters = array('airlines' => array($stats_airline));
413
-            		if ($filter_name != '') {
414
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
415
-			}
416
-            		$Spotter = new Spotter($this->db);
417
-            		$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month);
418
-        		$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month);
419
-        		$all = array();
420
-        		foreach ($pall as $value) {
421
-        			$icao = $value['airport_departure_icao'];
422
-        			$all[$icao] = $value;
423
-        		}
413
+					if ($filter_name != '') {
414
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
415
+			}
416
+					$Spotter = new Spotter($this->db);
417
+					$pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month);
418
+				$dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month);
419
+				$all = array();
420
+				foreach ($pall as $value) {
421
+					$icao = $value['airport_departure_icao'];
422
+					$all[$icao] = $value;
423
+				}
424 424
         		
425
-        		foreach ($dall as $value) {
426
-        			$icao = $value['airport_departure_icao'];
427
-        			if (isset($all[$icao])) {
428
-        				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
429
-        			} else $all[$icao] = $value;
430
-        		}
431
-        		$count = array();
432
-        		foreach ($all as $key => $row) {
433
-        			$count[$key] = $row['airport_departure_icao_count'];
434
-        		}
435
-        		array_multisort($count,SORT_DESC,$all);
436
-                }
437
-                return $all;
425
+				foreach ($dall as $value) {
426
+					$icao = $value['airport_departure_icao'];
427
+					if (isset($all[$icao])) {
428
+						$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
429
+					} else $all[$icao] = $value;
430
+				}
431
+				$count = array();
432
+				foreach ($all as $key => $row) {
433
+					$count[$key] = $row['airport_departure_icao_count'];
434
+				}
435
+				array_multisort($count,SORT_DESC,$all);
436
+				}
437
+				return $all;
438 438
 	}
439 439
 	public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') {
440 440
 		global $globalStatsFilters;
@@ -458,26 +458,26 @@  discard block
 block discarded – undo
458 458
 			$Spotter = new Spotter($this->db);
459 459
 			$pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month);
460 460
 			$dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month);
461
-        		$all = array();
462
-        		foreach ($pall as $value) {
463
-        			$icao = $value['airport_arrival_icao'];
464
-        			$all[$icao] = $value;
465
-        		}
461
+				$all = array();
462
+				foreach ($pall as $value) {
463
+					$icao = $value['airport_arrival_icao'];
464
+					$all[$icao] = $value;
465
+				}
466 466
         		
467
-        		foreach ($dall as $value) {
468
-        			$icao = $value['airport_arrival_icao'];
469
-        			if (isset($all[$icao])) {
470
-        				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
471
-        			} else $all[$icao] = $value;
472
-        		}
473
-        		$count = array();
474
-        		foreach ($all as $key => $row) {
475
-        			$count[$key] = $row['airport_arrival_icao_count'];
476
-        		}
477
-        		array_multisort($count,SORT_DESC,$all);
478
-                }
467
+				foreach ($dall as $value) {
468
+					$icao = $value['airport_arrival_icao'];
469
+					if (isset($all[$icao])) {
470
+						$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
471
+					} else $all[$icao] = $value;
472
+				}
473
+				$count = array();
474
+				foreach ($all as $key => $row) {
475
+					$count[$key] = $row['airport_arrival_icao_count'];
476
+				}
477
+				array_multisort($count,SORT_DESC,$all);
478
+				}
479 479
  
480
-                return $all;
480
+				return $all;
481 481
 	}
482 482
 	public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') {
483 483
 		global $globalDBdriver, $globalStatsFilters;
@@ -490,23 +490,23 @@  discard block
 block discarded – undo
490 490
 			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";
491 491
 		}
492 492
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
493
-                 try {
494
-                        $sth = $this->db->prepare($query);
495
-                        $sth->execute($query_data);
496
-                } catch(PDOException $e) {
497
-                        echo "error : ".$e->getMessage();
498
-                }
499
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
500
-                if (empty($all)) {
493
+				 try {
494
+						$sth = $this->db->prepare($query);
495
+						$sth->execute($query_data);
496
+				} catch(PDOException $e) {
497
+						echo "error : ".$e->getMessage();
498
+				}
499
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
500
+				if (empty($all)) {
501 501
 			$filters = array('airlines' => array($stats_airline));
502 502
 			if ($filter_name != '') {
503 503
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
504 504
 			}
505
-            		$Spotter = new Spotter($this->db);
506
-            		$all = $Spotter->countAllMonthsLastYear($filters);
507
-                }
505
+					$Spotter = new Spotter($this->db);
506
+					$all = $Spotter->countAllMonthsLastYear($filters);
507
+				}
508 508
                 
509
-                return $all;
509
+				return $all;
510 510
 	}
511 511
 	
512 512
 	public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') {
@@ -514,22 +514,22 @@  discard block
 block discarded – undo
514 514
 		if ($filter_name == '') $filter_name = $this->filter_name;
515 515
 		$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";
516 516
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
517
-                 try {
518
-                        $sth = $this->db->prepare($query);
519
-                        $sth->execute($query_data);
520
-                } catch(PDOException $e) {
521
-                        echo "error : ".$e->getMessage();
522
-                }
523
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
524
-                if (empty($all)) {
517
+				 try {
518
+						$sth = $this->db->prepare($query);
519
+						$sth->execute($query_data);
520
+				} catch(PDOException $e) {
521
+						echo "error : ".$e->getMessage();
522
+				}
523
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
524
+				if (empty($all)) {
525 525
 			$filters = array('airlines' => array($stats_airline));
526 526
 			if ($filter_name != '') {
527 527
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
528 528
 			}
529
-            		$Spotter = new Spotter($this->db);
530
-            		$all = $Spotter->countAllDatesLastMonth($filters);
531
-                }
532
-                return $all;
529
+					$Spotter = new Spotter($this->db);
530
+					$all = $Spotter->countAllDatesLastMonth($filters);
531
+				}
532
+				return $all;
533 533
 	}
534 534
 	public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') {
535 535
 		global $globalDBdriver, $globalStatsFilters;
@@ -540,108 +540,108 @@  discard block
 block discarded – undo
540 540
 			$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";
541 541
 		}
542 542
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
543
-                 try {
544
-                        $sth = $this->db->prepare($query);
545
-                        $sth->execute($query_data);
546
-                } catch(PDOException $e) {
547
-                        echo "error : ".$e->getMessage();
548
-                }
549
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
550
-                if (empty($all)) {
543
+				 try {
544
+						$sth = $this->db->prepare($query);
545
+						$sth->execute($query_data);
546
+				} catch(PDOException $e) {
547
+						echo "error : ".$e->getMessage();
548
+				}
549
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
550
+				if (empty($all)) {
551 551
 			$filters = array('airlines' => array($stats_airline));
552 552
 			if ($filter_name != '') {
553 553
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
554 554
 			}
555
-            		$Spotter = new Spotter($this->db);
556
-            		$all = $Spotter->countAllDatesLast7Days($filters);
557
-                }
558
-                return $all;
555
+					$Spotter = new Spotter($this->db);
556
+					$all = $Spotter->countAllDatesLast7Days($filters);
557
+				}
558
+				return $all;
559 559
 	}
560 560
 	public function countAllDates($stats_airline = '',$filter_name = '') {
561 561
 		global $globalStatsFilters;
562 562
 		if ($filter_name == '') $filter_name = $this->filter_name;
563 563
 		$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";
564 564
 		$query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name);
565
-                 try {
566
-                        $sth = $this->db->prepare($query);
567
-                        $sth->execute($query_data);
568
-                } catch(PDOException $e) {
569
-                        echo "error : ".$e->getMessage();
570
-                }
571
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
572
-                if (empty($all)) {
565
+				 try {
566
+						$sth = $this->db->prepare($query);
567
+						$sth->execute($query_data);
568
+				} catch(PDOException $e) {
569
+						echo "error : ".$e->getMessage();
570
+				}
571
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
572
+				if (empty($all)) {
573 573
 			$filters = array('airlines' => array($stats_airline));
574 574
 			if ($filter_name != '') {
575
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
575
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
576 576
 			}
577
-            		$Spotter = new Spotter($this->db);
578
-            		$all = $Spotter->countAllDates($filters);
579
-                }
580
-                return $all;
577
+					$Spotter = new Spotter($this->db);
578
+					$all = $Spotter->countAllDates($filters);
579
+				}
580
+				return $all;
581 581
 	}
582 582
 	public function countAllDatesByAirlines($filter_name = '') {
583 583
 		global $globalStatsFilters;
584 584
 		if ($filter_name == '') $filter_name = $this->filter_name;
585 585
 		$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";
586 586
 		$query_data = array('filter_name' => $filter_name);
587
-                 try {
588
-                        $sth = $this->db->prepare($query);
589
-                        $sth->execute($query_data);
590
-                } catch(PDOException $e) {
591
-                        echo "error : ".$e->getMessage();
592
-                }
593
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
594
-                if (empty($all)) {
595
-            		$filters = array();
596
-            		if ($filter_name != '') {
597
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
587
+				 try {
588
+						$sth = $this->db->prepare($query);
589
+						$sth->execute($query_data);
590
+				} catch(PDOException $e) {
591
+						echo "error : ".$e->getMessage();
592
+				}
593
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
594
+				if (empty($all)) {
595
+					$filters = array();
596
+					if ($filter_name != '') {
597
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
598 598
 			}
599
-            		$Spotter = new Spotter($this->db);
600
-            		$all = $Spotter->countAllDatesByAirlines($filters);
601
-                }
602
-                return $all;
599
+					$Spotter = new Spotter($this->db);
600
+					$all = $Spotter->countAllDatesByAirlines($filters);
601
+				}
602
+				return $all;
603 603
 	}
604 604
 	public function countAllMonths($stats_airline = '',$filter_name = '') {
605 605
 		global $globalStatsFilters;
606 606
 		if ($filter_name == '') $filter_name = $this->filter_name;
607
-	    	$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
608
-                 try {
609
-                        $sth = $this->db->prepare($query);
610
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
611
-                } catch(PDOException $e) {
612
-                        echo "error : ".$e->getMessage();
613
-                }
614
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
615
-                if (empty($all)) {
607
+			$query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name";
608
+				 try {
609
+						$sth = $this->db->prepare($query);
610
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
611
+				} catch(PDOException $e) {
612
+						echo "error : ".$e->getMessage();
613
+				}
614
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
615
+				if (empty($all)) {
616 616
 			$filters = array('airlines' => array($stats_airline));
617 617
 			if ($filter_name != '') {
618 618
 				$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
619 619
 			}
620
-            		$Spotter = new Spotter($this->db);
621
-            		$all = $Spotter->countAllMonths($filters);
622
-                }
623
-                return $all;
620
+					$Spotter = new Spotter($this->db);
621
+					$all = $Spotter->countAllMonths($filters);
622
+				}
623
+				return $all;
624 624
 	}
625 625
 	public function countAllMilitaryMonths($filter_name = '') {
626 626
 		global $globalStatsFilters;
627 627
 		if ($filter_name == '') $filter_name = $this->filter_name;
628
-	    	$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";
629
-                 try {
630
-                        $sth = $this->db->prepare($query);
631
-                        $sth->execute(array(':filter_name' => $filter_name));
632
-                } catch(PDOException $e) {
633
-                        echo "error : ".$e->getMessage();
634
-                }
635
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
636
-                if (empty($all)) {
637
-            		$filters = array();
638
-            		if ($filter_name != '') {
639
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
628
+			$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";
629
+				 try {
630
+						$sth = $this->db->prepare($query);
631
+						$sth->execute(array(':filter_name' => $filter_name));
632
+				} catch(PDOException $e) {
633
+						echo "error : ".$e->getMessage();
634
+				}
635
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
636
+				if (empty($all)) {
637
+					$filters = array();
638
+					if ($filter_name != '') {
639
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
640 640
 			}
641
-            		$Spotter = new Spotter($this->db);
642
-            		$all = $Spotter->countAllMilitaryMonths($filters);
643
-                }
644
-                return $all;
641
+					$Spotter = new Spotter($this->db);
642
+					$all = $Spotter->countAllMilitaryMonths($filters);
643
+				}
644
+				return $all;
645 645
 	}
646 646
 	public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') {
647 647
 		global $globalTimezone, $globalDBdriver, $globalStatsFilters;
@@ -657,22 +657,22 @@  discard block
 block discarded – undo
657 657
 			$query .= " ORDER BY CAST(flight_date AS integer) ASC";
658 658
 		}
659 659
 		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
660
-                 try {
661
-                        $sth = $this->db->prepare($query);
662
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
663
-                } catch(PDOException $e) {
664
-                        echo "error : ".$e->getMessage();
665
-                }
666
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
667
-                if (empty($all)) {
660
+				 try {
661
+						$sth = $this->db->prepare($query);
662
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
663
+				} catch(PDOException $e) {
664
+						echo "error : ".$e->getMessage();
665
+				}
666
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
667
+				if (empty($all)) {
668 668
 			$filters = array('airlines' => array($stats_airline));
669 669
 			if ($filter_name != '') {
670
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
670
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
671 671
 			}
672
-            		$Spotter = new Spotter($this->db);
673
-            		$all = $Spotter->countAllHours($orderby,$filters);
674
-                }
675
-                return $all;
672
+					$Spotter = new Spotter($this->db);
673
+					$all = $Spotter->countAllHours($orderby,$filters);
674
+				}
675
+				return $all;
676 676
 	}
677 677
 	
678 678
 	public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') {
@@ -696,9 +696,9 @@  discard block
 block discarded – undo
696 696
 		if ($year == '') $year = date('Y');
697 697
 		$all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month);
698 698
 		if (empty($all)) {
699
-		        $filters = array();
700
-            		if ($filter_name != '') {
701
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
699
+				$filters = array();
700
+					if ($filter_name != '') {
701
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
702 702
 			}
703 703
 			$Spotter = new Spotter($this->db);
704 704
 			$all = $Spotter->countOverallMilitaryFlights($filters,$year,$month);
@@ -750,9 +750,9 @@  discard block
 block discarded – undo
750 750
 			$all = $result[0]['nb_airline'];
751 751
 		} else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month);
752 752
 		if (empty($all)) {
753
-            		$filters = array();
754
-            		if ($filter_name != '') {
755
-            			$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
753
+					$filters = array();
754
+					if ($filter_name != '') {
755
+						$filters = array_merge($filters,$globalStatsFilters[$filter_name]);
756 756
 			}
757 757
 			$Spotter = new Spotter($this->db);
758 758
 			$all = $Spotter->countOverallAirlines($filters,$year,$month);
@@ -805,33 +805,33 @@  discard block
 block discarded – undo
805 805
 		if ($filter_name == '') $filter_name = $this->filter_name;
806 806
 		$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";
807 807
 		$query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
808
-                 try {
809
-                        $sth = $this->db->prepare($query);
810
-                        $sth->execute($query_values);
811
-                } catch(PDOException $e) {
812
-                        echo "error : ".$e->getMessage();
813
-                }
814
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
815
-                return $all;
808
+				 try {
809
+						$sth = $this->db->prepare($query);
810
+						$sth->execute($query_values);
811
+				} catch(PDOException $e) {
812
+						echo "error : ".$e->getMessage();
813
+				}
814
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
815
+				return $all;
816 816
 	}
817 817
 	public function getStats($type,$stats_airline = '', $filter_name = '') {
818 818
 		if ($filter_name == '') $filter_name = $this->filter_name;
819
-                $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
820
-                $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
821
-                 try {
822
-                        $sth = $this->db->prepare($query);
823
-                        $sth->execute($query_values);
824
-                } catch(PDOException $e) {
825
-                        echo "error : ".$e->getMessage();
826
-                }
827
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
828
-                return $all;
829
-        }
819
+				$query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date";
820
+				$query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
821
+				 try {
822
+						$sth = $this->db->prepare($query);
823
+						$sth->execute($query_values);
824
+				} catch(PDOException $e) {
825
+						echo "error : ".$e->getMessage();
826
+				}
827
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
828
+				return $all;
829
+		}
830 830
 	public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') {
831 831
 		if ($filter_name == '') $filter_name = $this->filter_name;
832
-    		global $globalArchiveMonths, $globalDBdriver;
833
-    		if ($globalDBdriver == 'mysql') {
834
-    			if ($month == '') {
832
+			global $globalArchiveMonths, $globalDBdriver;
833
+			if ($globalDBdriver == 'mysql') {
834
+				if ($month == '') {
835 835
 				$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";
836 836
 				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
837 837
 			} else {
@@ -846,137 +846,137 @@  discard block
 block discarded – undo
846 846
 				$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";
847 847
 				$query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month);
848 848
 			}
849
-                }
850
-                 try {
851
-                        $sth = $this->db->prepare($query);
852
-                        $sth->execute($query_values);
853
-                } catch(PDOException $e) {
854
-                        echo "error : ".$e->getMessage();
855
-                }
856
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
857
-                return $all[0]['total'];
858
-        }
849
+				}
850
+				 try {
851
+						$sth = $this->db->prepare($query);
852
+						$sth->execute($query_values);
853
+				} catch(PDOException $e) {
854
+						echo "error : ".$e->getMessage();
855
+				}
856
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
857
+				return $all[0]['total'];
858
+		}
859 859
 	public function getStatsTotal($type, $stats_airline = '', $filter_name = '') {
860
-    		global $globalArchiveMonths, $globalDBdriver;
860
+			global $globalArchiveMonths, $globalDBdriver;
861 861
 		if ($filter_name == '') $filter_name = $this->filter_name;
862
-    		if ($globalDBdriver == 'mysql') {
862
+			if ($globalDBdriver == 'mysql') {
863 863
 			$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 = :stats_airline AND filter_name = :filter_name";
864 864
 		} else {
865 865
 			$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 = :stats_airline AND filter_name = :filter_name";
866
-                }
867
-                $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
868
-                 try {
869
-                        $sth = $this->db->prepare($query);
870
-                        $sth->execute($query_values);
871
-                } catch(PDOException $e) {
872
-                        echo "error : ".$e->getMessage();
873
-                }
874
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
875
-                return $all[0]['total'];
876
-        }
866
+				}
867
+				$query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name);
868
+				 try {
869
+						$sth = $this->db->prepare($query);
870
+						$sth->execute($query_values);
871
+				} catch(PDOException $e) {
872
+						echo "error : ".$e->getMessage();
873
+				}
874
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
875
+				return $all[0]['total'];
876
+		}
877 877
 	public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') {
878
-    		global $globalArchiveMonths, $globalDBdriver;
878
+			global $globalArchiveMonths, $globalDBdriver;
879 879
 		if ($filter_name == '') $filter_name = $this->filter_name;
880
-    		if ($globalDBdriver == 'mysql') {
880
+			if ($globalDBdriver == 'mysql') {
881 881
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
882
-                } else {
882
+				} else {
883 883
 			$query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name";
884
-                }
885
-                 try {
886
-                        $sth = $this->db->prepare($query);
887
-                        $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
888
-                } catch(PDOException $e) {
889
-                        echo "error : ".$e->getMessage();
890
-                }
891
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
892
-                return $all[0]['total'];
893
-        }
884
+				}
885
+				 try {
886
+						$sth = $this->db->prepare($query);
887
+						$sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name));
888
+				} catch(PDOException $e) {
889
+						echo "error : ".$e->getMessage();
890
+				}
891
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
892
+				return $all[0]['total'];
893
+		}
894 894
 	public function getStatsAirlineTotal($filter_name = '') {
895
-    		global $globalArchiveMonths, $globalDBdriver;
895
+			global $globalArchiveMonths, $globalDBdriver;
896 896
 		if ($filter_name == '') $filter_name = $this->filter_name;
897
-    		if ($globalDBdriver == 'mysql') {
897
+			if ($globalDBdriver == 'mysql') {
898 898
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
899
-                } else {
899
+				} else {
900 900
 			$query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name";
901
-                }
902
-                 try {
903
-                        $sth = $this->db->prepare($query);
904
-                        $sth->execute(array(':filter_name' => $filter_name));
905
-                } catch(PDOException $e) {
906
-                        echo "error : ".$e->getMessage();
907
-                }
908
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
909
-                return $all[0]['total'];
910
-        }
901
+				}
902
+				 try {
903
+						$sth = $this->db->prepare($query);
904
+						$sth->execute(array(':filter_name' => $filter_name));
905
+				} catch(PDOException $e) {
906
+						echo "error : ".$e->getMessage();
907
+				}
908
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
909
+				return $all[0]['total'];
910
+		}
911 911
 	public function getStatsOwnerTotal($filter_name = '') {
912
-    		global $globalArchiveMonths, $globalDBdriver;
912
+			global $globalArchiveMonths, $globalDBdriver;
913 913
 		if ($filter_name == '') $filter_name = $this->filter_name;
914
-    		if ($globalDBdriver == 'mysql') {
914
+			if ($globalDBdriver == 'mysql') {
915 915
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
916 916
 		} else {
917 917
 			$query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name";
918
-                }
919
-                 try {
920
-                        $sth = $this->db->prepare($query);
921
-                        $sth->execute(array(':filter_name' => $filter_name));
922
-                } catch(PDOException $e) {
923
-                        echo "error : ".$e->getMessage();
924
-                }
925
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
926
-                return $all[0]['total'];
927
-        }
918
+				}
919
+				 try {
920
+						$sth = $this->db->prepare($query);
921
+						$sth->execute(array(':filter_name' => $filter_name));
922
+				} catch(PDOException $e) {
923
+						echo "error : ".$e->getMessage();
924
+				}
925
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
926
+				return $all[0]['total'];
927
+		}
928 928
 	public function getStatsPilotTotal($filter_name = '') {
929
-    		global $globalArchiveMonths, $globalDBdriver;
929
+			global $globalArchiveMonths, $globalDBdriver;
930 930
 		if ($filter_name == '') $filter_name = $this->filter_name;
931
-    		if ($globalDBdriver == 'mysql') {
932
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
933
-            	} else {
934
-            		$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
935
-            	}
936
-                 try {
937
-                        $sth = $this->db->prepare($query);
938
-                        $sth->execute(array(':filter_name' => $filter_name));
939
-                } catch(PDOException $e) {
940
-                        echo "error : ".$e->getMessage();
941
-                }
942
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
943
-                return $all[0]['total'];
944
-        }
931
+			if ($globalDBdriver == 'mysql') {
932
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
933
+				} else {
934
+					$query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name";
935
+				}
936
+				 try {
937
+						$sth = $this->db->prepare($query);
938
+						$sth->execute(array(':filter_name' => $filter_name));
939
+				} catch(PDOException $e) {
940
+						echo "error : ".$e->getMessage();
941
+				}
942
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
943
+				return $all[0]['total'];
944
+		}
945 945
 
946 946
 	public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
947 947
 		global $globalDBdriver;
948 948
 		if ($filter_name == '') $filter_name = $this->filter_name;
949 949
 		if ($globalDBdriver == 'mysql') {
950 950
 			$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";
951
-                } else {
951
+				} else {
952 952
 			$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);"; 
953 953
 		}
954
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
955
-                 try {
956
-                        $sth = $this->db->prepare($query);
957
-                        $sth->execute($query_values);
958
-                } catch(PDOException $e) {
959
-                        return "error : ".$e->getMessage();
960
-                }
961
-        }
954
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
955
+				 try {
956
+						$sth = $this->db->prepare($query);
957
+						$sth->execute($query_values);
958
+				} catch(PDOException $e) {
959
+						return "error : ".$e->getMessage();
960
+				}
961
+		}
962 962
 	public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') {
963 963
 		global $globalDBdriver;
964 964
 		if ($filter_name == '') $filter_name = $this->filter_name;
965 965
 		if ($globalDBdriver == 'mysql') {
966 966
 			$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";
967 967
 		} else {
968
-            		//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
968
+					//$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date";
969 969
 			$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);"; 
970
-                }
971
-                $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
972
-                 try {
973
-                        $sth = $this->db->prepare($query);
974
-                        $sth->execute($query_values);
975
-                } catch(PDOException $e) {
976
-                        return "error : ".$e->getMessage();
977
-                }
978
-        }
979
-        /*
970
+				}
971
+				$query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
972
+				 try {
973
+						$sth = $this->db->prepare($query);
974
+						$sth->execute($query_values);
975
+				} catch(PDOException $e) {
976
+						return "error : ".$e->getMessage();
977
+				}
978
+		}
979
+		/*
980 980
 	public function getStatsSource($date,$stats_type = '') {
981 981
 		if ($stats_type == '') {
982 982
 			$query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name";
@@ -1045,25 +1045,25 @@  discard block
 block discarded – undo
1045 1045
 			$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";
1046 1046
 		} else {
1047 1047
 			$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);"; 
1048
-                }
1049
-                $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
1050
-                 try {
1051
-                        $sth = $this->db->prepare($query);
1052
-                        $sth->execute($query_values);
1053
-                } catch(PDOException $e) {
1054
-                        return "error : ".$e->getMessage();
1055
-                }
1056
-        }
1057
-	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
1058
-                $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
1059
-                $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1060
-                 try {
1061
-                        $sth = $this->db->prepare($query);
1062
-                        $sth->execute($query_values);
1063
-                } catch(PDOException $e) {
1064
-                        return "error : ".$e->getMessage();
1065
-                }
1066
-        }
1048
+				}
1049
+				$query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type);
1050
+				 try {
1051
+						$sth = $this->db->prepare($query);
1052
+						$sth->execute($query_values);
1053
+				} catch(PDOException $e) {
1054
+						return "error : ".$e->getMessage();
1055
+				}
1056
+		}
1057
+	public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') {
1058
+				$query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)";
1059
+				$query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1060
+				 try {
1061
+						$sth = $this->db->prepare($query);
1062
+						$sth->execute($query_values);
1063
+				} catch(PDOException $e) {
1064
+						return "error : ".$e->getMessage();
1065
+				}
1066
+		}
1067 1067
 	public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) {
1068 1068
 		global $globalDBdriver;
1069 1069
 		if ($globalDBdriver == 'mysql') {
@@ -1079,14 +1079,14 @@  discard block
 block discarded – undo
1079 1079
 				$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);"; 
1080 1080
 			}
1081 1081
 		}
1082
-                $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1083
-                 try {
1084
-                        $sth = $this->db->prepare($query);
1085
-                        $sth->execute($query_values);
1086
-                } catch(PDOException $e) {
1087
-                        return "error : ".$e->getMessage();
1088
-                }
1089
-        }
1082
+				$query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name);
1083
+				 try {
1084
+						$sth = $this->db->prepare($query);
1085
+						$sth->execute($query_values);
1086
+				} catch(PDOException $e) {
1087
+						return "error : ".$e->getMessage();
1088
+				}
1089
+		}
1090 1090
 	public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) {
1091 1091
 		global $globalDBdriver;
1092 1092
 		if ($globalDBdriver == 'mysql') {
@@ -1102,14 +1102,14 @@  discard block
 block discarded – undo
1102 1102
 				$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);"; 
1103 1103
 			}
1104 1104
 		}
1105
-                $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1106
-                 try {
1107
-                        $sth = $this->db->prepare($query);
1108
-                        $sth->execute($query_values);
1109
-                } catch(PDOException $e) {
1110
-                        return "error : ".$e->getMessage();
1111
-                }
1112
-        }
1105
+				$query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name);
1106
+				 try {
1107
+						$sth = $this->db->prepare($query);
1108
+						$sth->execute($query_values);
1109
+				} catch(PDOException $e) {
1110
+						return "error : ".$e->getMessage();
1111
+				}
1112
+		}
1113 1113
 	public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) {
1114 1114
 		global $globalDBdriver;
1115 1115
 		if ($globalDBdriver == 'mysql') {
@@ -1125,14 +1125,14 @@  discard block
 block discarded – undo
1125 1125
 				$query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; 
1126 1126
 			}
1127 1127
 		}
1128
-                $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1129
-                 try {
1130
-                        $sth = $this->db->prepare($query);
1131
-                        $sth->execute($query_values);
1132
-                } catch(PDOException $e) {
1133
-                        return "error : ".$e->getMessage();
1134
-                }
1135
-        }
1128
+				$query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name);
1129
+				 try {
1130
+						$sth = $this->db->prepare($query);
1131
+						$sth->execute($query_values);
1132
+				} catch(PDOException $e) {
1133
+						return "error : ".$e->getMessage();
1134
+				}
1135
+		}
1136 1136
 	public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) {
1137 1137
 		global $globalDBdriver;
1138 1138
 		if ($globalDBdriver == 'mysql') {
@@ -1148,14 +1148,14 @@  discard block
 block discarded – undo
1148 1148
 				$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);"; 
1149 1149
 			}
1150 1150
 		}
1151
-                $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);
1152
-                 try {
1153
-                        $sth = $this->db->prepare($query);
1154
-                        $sth->execute($query_values);
1155
-                } catch(PDOException $e) {
1156
-                        return "error : ".$e->getMessage();
1157
-                }
1158
-        }
1151
+				$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);
1152
+				 try {
1153
+						$sth = $this->db->prepare($query);
1154
+						$sth->execute($query_values);
1155
+				} catch(PDOException $e) {
1156
+						return "error : ".$e->getMessage();
1157
+				}
1158
+		}
1159 1159
 	public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) {
1160 1160
 		global $globalDBdriver;
1161 1161
 		if ($globalDBdriver == 'mysql') {
@@ -1171,14 +1171,14 @@  discard block
 block discarded – undo
1171 1171
 				$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);"; 
1172 1172
 			}
1173 1173
 		}
1174
-                $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1175
-                 try {
1176
-                        $sth = $this->db->prepare($query);
1177
-                        $sth->execute($query_values);
1178
-                } catch(PDOException $e) {
1179
-                        return "error : ".$e->getMessage();
1180
-                }
1181
-        }
1174
+				$query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name);
1175
+				 try {
1176
+						$sth = $this->db->prepare($query);
1177
+						$sth->execute($query_values);
1178
+				} catch(PDOException $e) {
1179
+						return "error : ".$e->getMessage();
1180
+				}
1181
+		}
1182 1182
 	public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) {
1183 1183
 		global $globalDBdriver;
1184 1184
 		if ($globalDBdriver == 'mysql') {
@@ -1194,14 +1194,14 @@  discard block
 block discarded – undo
1194 1194
 				$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);"; 
1195 1195
 			}
1196 1196
 		}
1197
-                $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1198
-                 try {
1199
-                        $sth = $this->db->prepare($query);
1200
-                        $sth->execute($query_values);
1201
-                } catch(PDOException $e) {
1202
-                        return "error : ".$e->getMessage();
1203
-                }
1204
-        }
1197
+				$query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name);
1198
+				 try {
1199
+						$sth = $this->db->prepare($query);
1200
+						$sth->execute($query_values);
1201
+				} catch(PDOException $e) {
1202
+						return "error : ".$e->getMessage();
1203
+				}
1204
+		}
1205 1205
 	public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) {
1206 1206
 		global $globalDBdriver;
1207 1207
 		if ($globalDBdriver == 'mysql') {
@@ -1217,14 +1217,14 @@  discard block
 block discarded – undo
1217 1217
 				$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);"; 
1218 1218
 			}
1219 1219
 		}
1220
-                $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);
1221
-                 try {
1222
-                        $sth = $this->db->prepare($query);
1223
-                        $sth->execute($query_values);
1224
-                } catch(PDOException $e) {
1225
-                        return "error : ".$e->getMessage();
1226
-                }
1227
-        }
1220
+				$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);
1221
+				 try {
1222
+						$sth = $this->db->prepare($query);
1223
+						$sth->execute($query_values);
1224
+				} catch(PDOException $e) {
1225
+						return "error : ".$e->getMessage();
1226
+				}
1227
+		}
1228 1228
 	public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) {
1229 1229
 		global $globalDBdriver;
1230 1230
 		if ($airport_icao != '') {
@@ -1248,8 +1248,8 @@  discard block
 block discarded – undo
1248 1248
 			} catch(PDOException $e) {
1249 1249
 				return "error : ".$e->getMessage();
1250 1250
 			}
1251
-                }
1252
-        }
1251
+				}
1252
+		}
1253 1253
 	public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') {
1254 1254
 		global $globalDBdriver;
1255 1255
 		if ($airport_icao != '') {
@@ -1265,8 +1265,8 @@  discard block
 block discarded – undo
1265 1265
 			} catch(PDOException $e) {
1266 1266
 				return "error : ".$e->getMessage();
1267 1267
 			}
1268
-                }
1269
-        }
1268
+				}
1269
+		}
1270 1270
 	public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) {
1271 1271
 		global $globalDBdriver;
1272 1272
 		if ($airport_icao != '') {
@@ -1283,15 +1283,15 @@  discard block
 block discarded – undo
1283 1283
 					$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);"; 
1284 1284
 				}
1285 1285
 			}
1286
-	                $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);
1286
+					$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);
1287 1287
 			 try {
1288
-                    		$sth = $this->db->prepare($query);
1289
-	                        $sth->execute($query_values);
1290
-    		        } catch(PDOException $e) {
1291
-            		        return "error : ".$e->getMessage();
1292
-	                }
1293
-	        }
1294
-        }
1288
+							$sth = $this->db->prepare($query);
1289
+							$sth->execute($query_values);
1290
+					} catch(PDOException $e) {
1291
+							return "error : ".$e->getMessage();
1292
+					}
1293
+			}
1294
+		}
1295 1295
 	public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') {
1296 1296
 		global $globalDBdriver;
1297 1297
 		if ($airport_icao != '') {
@@ -1307,46 +1307,46 @@  discard block
 block discarded – undo
1307 1307
 			} catch(PDOException $e) {
1308 1308
 				return "error : ".$e->getMessage();
1309 1309
 			}
1310
-                }
1311
-        }
1310
+				}
1311
+		}
1312 1312
 
1313 1313
 	public function deleteStat($id) {
1314
-                $query = "DELETE FROM stats WHERE stats_id = :id";
1315
-                $query_values = array(':id' => $id);
1316
-                 try {
1317
-                        $sth = $this->db->prepare($query);
1318
-                        $sth->execute($query_values);
1319
-                } catch(PDOException $e) {
1320
-                        return "error : ".$e->getMessage();
1321
-                }
1322
-        }
1314
+				$query = "DELETE FROM stats WHERE stats_id = :id";
1315
+				$query_values = array(':id' => $id);
1316
+				 try {
1317
+						$sth = $this->db->prepare($query);
1318
+						$sth->execute($query_values);
1319
+				} catch(PDOException $e) {
1320
+						return "error : ".$e->getMessage();
1321
+				}
1322
+		}
1323 1323
 	public function deleteStatFlight($type) {
1324
-                $query = "DELETE FROM stats_flight WHERE stats_type = :type";
1325
-                $query_values = array(':type' => $type);
1326
-                 try {
1327
-                        $sth = $this->db->prepare($query);
1328
-                        $sth->execute($query_values);
1329
-                } catch(PDOException $e) {
1330
-                        return "error : ".$e->getMessage();
1331
-                }
1332
-        }
1324
+				$query = "DELETE FROM stats_flight WHERE stats_type = :type";
1325
+				$query_values = array(':type' => $type);
1326
+				 try {
1327
+						$sth = $this->db->prepare($query);
1328
+						$sth->execute($query_values);
1329
+				} catch(PDOException $e) {
1330
+						return "error : ".$e->getMessage();
1331
+				}
1332
+		}
1333 1333
 	public function deleteStatAirport($type) {
1334
-                $query = "DELETE FROM stats_airport WHERE stats_type = :type";
1335
-                $query_values = array(':type' => $type);
1336
-                 try {
1337
-                        $sth = $this->db->prepare($query);
1338
-                        $sth->execute($query_values);
1339
-                } catch(PDOException $e) {
1340
-                        return "error : ".$e->getMessage();
1341
-                }
1342
-        }
1334
+				$query = "DELETE FROM stats_airport WHERE stats_type = :type";
1335
+				$query_values = array(':type' => $type);
1336
+				 try {
1337
+						$sth = $this->db->prepare($query);
1338
+						$sth->execute($query_values);
1339
+				} catch(PDOException $e) {
1340
+						return "error : ".$e->getMessage();
1341
+				}
1342
+		}
1343 1343
         
1344
-        public function addOldStats() {
1345
-    		global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear;
1346
-    		$Common = new Common();
1347
-    		$Connection = new Connection();
1348
-    		date_default_timezone_set('UTC');
1349
-    		$last_update = $this->getLastStatsUpdate('last_update_stats');
1344
+		public function addOldStats() {
1345
+			global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear;
1346
+			$Common = new Common();
1347
+			$Connection = new Connection();
1348
+			date_default_timezone_set('UTC');
1349
+			$last_update = $this->getLastStatsUpdate('last_update_stats');
1350 1350
 			if ($globalDebug) echo 'Update stats !'."\n";
1351 1351
 			if (isset($last_update[0]['value'])) {
1352 1352
 				$last_update_day = $last_update[0]['value'];
@@ -1392,24 +1392,24 @@  discard block
 block discarded – undo
1392 1392
 			if ($globalDebug) echo 'Count all departure airports...'."\n";
1393 1393
 			$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day);
1394 1394
 			if ($globalDebug) echo 'Count all detected departure airports...'."\n";
1395
-        		$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1395
+				$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day);
1396 1396
 			if ($globalDebug) echo 'Order departure airports...'."\n";
1397
-	        	$alldata = array();
1397
+				$alldata = array();
1398 1398
 	        	
1399
-    			foreach ($pall as $value) {
1400
-	        		$icao = $value['airport_departure_icao'];
1401
-    				$alldata[$icao] = $value;
1402
-	        	}
1403
-	        	foreach ($dall as $value) {
1404
-    				$icao = $value['airport_departure_icao'];
1405
-        			if (isset($alldata[$icao])) {
1406
-    					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1407
-        			} else $alldata[$icao] = $value;
1408
-			}
1409
-    			$count = array();
1410
-    			foreach ($alldata as $key => $row) {
1411
-    				$count[$key] = $row['airport_departure_icao_count'];
1412
-        		}
1399
+				foreach ($pall as $value) {
1400
+					$icao = $value['airport_departure_icao'];
1401
+					$alldata[$icao] = $value;
1402
+				}
1403
+				foreach ($dall as $value) {
1404
+					$icao = $value['airport_departure_icao'];
1405
+					if (isset($alldata[$icao])) {
1406
+						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1407
+					} else $alldata[$icao] = $value;
1408
+			}
1409
+				$count = array();
1410
+				foreach ($alldata as $key => $row) {
1411
+					$count[$key] = $row['airport_departure_icao_count'];
1412
+				}
1413 1413
 			array_multisort($count,SORT_DESC,$alldata);
1414 1414
 			foreach ($alldata as $number) {
1415 1415
 				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);
@@ -1417,25 +1417,25 @@  discard block
 block discarded – undo
1417 1417
 			if ($globalDebug) echo 'Count all arrival airports...'."\n";
1418 1418
 			$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day);
1419 1419
 			if ($globalDebug) echo 'Count all detected arrival airports...'."\n";
1420
-        		$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1420
+				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day);
1421 1421
 			if ($globalDebug) echo 'Order arrival airports...'."\n";
1422
-	        	$alldata = array();
1423
-    			foreach ($pall as $value) {
1424
-	        		$icao = $value['airport_arrival_icao'];
1425
-    				$alldata[$icao] = $value;
1426
-	        	}
1427
-	        	foreach ($dall as $value) {
1428
-    				$icao = $value['airport_arrival_icao'];
1429
-        			if (isset($alldata[$icao])) {
1430
-        				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1431
-	        		} else $alldata[$icao] = $value;
1432
-    			}
1433
-        		$count = array();
1434
-        		foreach ($alldata as $key => $row) {
1435
-        			$count[$key] = $row['airport_arrival_icao_count'];
1436
-	        	}
1437
-    			array_multisort($count,SORT_DESC,$alldata);
1438
-                        foreach ($alldata as $number) {
1422
+				$alldata = array();
1423
+				foreach ($pall as $value) {
1424
+					$icao = $value['airport_arrival_icao'];
1425
+					$alldata[$icao] = $value;
1426
+				}
1427
+				foreach ($dall as $value) {
1428
+					$icao = $value['airport_arrival_icao'];
1429
+					if (isset($alldata[$icao])) {
1430
+						$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1431
+					} else $alldata[$icao] = $value;
1432
+				}
1433
+				$count = array();
1434
+				foreach ($alldata as $key => $row) {
1435
+					$count[$key] = $row['airport_arrival_icao_count'];
1436
+				}
1437
+				array_multisort($count,SORT_DESC,$alldata);
1438
+						foreach ($alldata as $number) {
1439 1439
 				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);
1440 1440
 			}
1441 1441
 			if ($Connection->tableExists('countries')) {
@@ -1495,8 +1495,8 @@  discard block
 block discarded – undo
1495 1495
 //			$pall = $Spotter->getLast7DaysAirportsDeparture();
1496 1496
   //      		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1497 1497
 			$pall = $Spotter->getLast7DaysAirportsDeparture();
1498
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1499
-        		/*
1498
+				$dall = $Spotter->getLast7DaysDetectedAirportsDeparture();
1499
+				/*
1500 1500
 	        	$alldata = array();
1501 1501
     			foreach ($pall as $value) {
1502 1502
 	        		$icao = $value['departure_airport_icao'];
@@ -1515,29 +1515,29 @@  discard block
 block discarded – undo
1515 1515
 	        	}
1516 1516
     			array_multisort($count,SORT_DESC,$alldata);
1517 1517
     			*/
1518
-    			foreach ($dall as $value) {
1519
-    				$icao = $value['departure_airport_icao'];
1520
-    				$ddate = $value['date'];
1521
-    				$find = false;
1522
-    				foreach ($pall as $pvalue) {
1523
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1524
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1525
-    						$find = true;
1526
-    						break;
1527
-    					}
1528
-    				}
1529
-    				if ($find === false) {
1530
-    					$pall[] = $value;
1531
-    				}
1532
-    			}
1533
-    			$alldata = $pall;
1518
+				foreach ($dall as $value) {
1519
+					$icao = $value['departure_airport_icao'];
1520
+					$ddate = $value['date'];
1521
+					$find = false;
1522
+					foreach ($pall as $pvalue) {
1523
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1524
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1525
+							$find = true;
1526
+							break;
1527
+						}
1528
+					}
1529
+					if ($find === false) {
1530
+						$pall[] = $value;
1531
+					}
1532
+				}
1533
+				$alldata = $pall;
1534 1534
 			foreach ($alldata as $number) {
1535 1535
 				$this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']);
1536 1536
 			}
1537 1537
 			echo '...Arrival'."\n";
1538 1538
 			$pall = $Spotter->getLast7DaysAirportsArrival();
1539
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1540
-        		/*
1539
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrival();
1540
+				/*
1541 1541
 	        	$alldata = array();
1542 1542
     			foreach ($pall as $value) {
1543 1543
 	        		$icao = $value['arrival_airport_icao'];
@@ -1557,22 +1557,22 @@  discard block
 block discarded – undo
1557 1557
     			*/
1558 1558
 
1559 1559
 
1560
-    			foreach ($dall as $value) {
1561
-    				$icao = $value['arrival_airport_icao'];
1562
-    				$ddate = $value['date'];
1563
-    				$find = false;
1564
-    				foreach ($pall as $pvalue) {
1565
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1566
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1567
-    						$find = true;
1568
-    						break;
1569
-    					}
1570
-    				}
1571
-    				if ($find === false) {
1572
-    					$pall[] = $value;
1573
-    				}
1574
-    			}
1575
-    			$alldata = $pall;
1560
+				foreach ($dall as $value) {
1561
+					$icao = $value['arrival_airport_icao'];
1562
+					$ddate = $value['date'];
1563
+					$find = false;
1564
+					foreach ($pall as $pvalue) {
1565
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1566
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1567
+							$find = true;
1568
+							break;
1569
+						}
1570
+					}
1571
+					if ($find === false) {
1572
+						$pall[] = $value;
1573
+					}
1574
+				}
1575
+				$alldata = $pall;
1576 1576
 			foreach ($alldata as $number) {
1577 1577
 				$this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']);
1578 1578
 			}
@@ -1639,51 +1639,51 @@  discard block
 block discarded – undo
1639 1639
 			if ($globalDebug) echo 'Count all departure airports by airlines...'."\n";
1640 1640
 			$pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day);
1641 1641
 			if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n";
1642
-       			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1642
+	   			$dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day);
1643 1643
 			if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n";
1644
-	        	//$alldata = array();
1645
-    			foreach ($dall as $value) {
1646
-    				$icao = $value['airport_departure_icao'];
1647
-    				$dicao = $value['airline_icao'];
1648
-    				$find = false;
1649
-    				foreach ($pall as $pvalue) {
1650
-    					if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1651
-    						$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1652
-    						$find = true;
1653
-    						break;
1654
-    					}
1655
-    				}
1656
-    				if ($find === false) {
1657
-    					$pall[] = $value;
1658
-    				}
1659
-    			}
1660
-    			$alldata = $pall;
1644
+				//$alldata = array();
1645
+				foreach ($dall as $value) {
1646
+					$icao = $value['airport_departure_icao'];
1647
+					$dicao = $value['airline_icao'];
1648
+					$find = false;
1649
+					foreach ($pall as $pvalue) {
1650
+						if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1651
+							$pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1652
+							$find = true;
1653
+							break;
1654
+						}
1655
+					}
1656
+					if ($find === false) {
1657
+						$pall[] = $value;
1658
+					}
1659
+				}
1660
+				$alldata = $pall;
1661 1661
 			foreach ($alldata as $number) {
1662 1662
 				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);
1663 1663
 			}
1664 1664
 			if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n";
1665 1665
 			$pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day);
1666 1666
 			if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n";
1667
-        		$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1667
+				$dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day);
1668 1668
 			if ($globalDebug) echo 'Order arrival airports by airlines...'."\n";
1669
-	        	//$alldata = array();
1670
-    			foreach ($dall as $value) {
1671
-    				$icao = $value['airport_arrival_icao'];
1672
-    				$dicao = $value['airline_icao'];
1673
-    				$find = false;
1674
-    				foreach ($pall as $pvalue) {
1675
-    					if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1676
-    						$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1677
-    						$find = true;
1678
-    						break;
1679
-    					}
1680
-    				}
1681
-    				if ($find === false) {
1682
-    					$pall[] = $value;
1683
-    				}
1684
-    			}
1685
-    			$alldata = $pall;
1686
-                        foreach ($alldata as $number) {
1669
+				//$alldata = array();
1670
+				foreach ($dall as $value) {
1671
+					$icao = $value['airport_arrival_icao'];
1672
+					$dicao = $value['airline_icao'];
1673
+					$find = false;
1674
+					foreach ($pall as $pvalue) {
1675
+						if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) {
1676
+							$pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1677
+							$find = true;
1678
+							break;
1679
+						}
1680
+					}
1681
+					if ($find === false) {
1682
+						$pall[] = $value;
1683
+					}
1684
+				}
1685
+				$alldata = $pall;
1686
+						foreach ($alldata as $number) {
1687 1687
 				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);
1688 1688
 			}
1689 1689
 			if ($globalDebug) echo 'Count all flights by months by airlines...'."\n";
@@ -1716,47 +1716,47 @@  discard block
 block discarded – undo
1716 1716
 			}
1717 1717
 			if ($globalDebug) echo '...Departure'."\n";
1718 1718
 			$pall = $Spotter->getLast7DaysAirportsDepartureByAirlines();
1719
-        		$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1720
-    			foreach ($dall as $value) {
1721
-    				$icao = $value['departure_airport_icao'];
1722
-    				$airline = $value['airline_icao'];
1723
-    				$ddate = $value['date'];
1724
-    				$find = false;
1725
-    				foreach ($pall as $pvalue) {
1726
-    					if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1727
-    						$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1728
-    						$find = true;
1729
-    						break;
1730
-    					}
1731
-    				}
1732
-    				if ($find === false) {
1733
-    					$pall[] = $value;
1734
-    				}
1735
-    			}
1736
-    			$alldata = $pall;
1719
+				$dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines();
1720
+				foreach ($dall as $value) {
1721
+					$icao = $value['departure_airport_icao'];
1722
+					$airline = $value['airline_icao'];
1723
+					$ddate = $value['date'];
1724
+					$find = false;
1725
+					foreach ($pall as $pvalue) {
1726
+						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) {
1727
+							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1728
+							$find = true;
1729
+							break;
1730
+						}
1731
+					}
1732
+					if ($find === false) {
1733
+						$pall[] = $value;
1734
+					}
1735
+				}
1736
+				$alldata = $pall;
1737 1737
 			foreach ($alldata as $number) {
1738 1738
 				$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']);
1739 1739
 			}
1740 1740
 			if ($globalDebug) echo '...Arrival'."\n";
1741 1741
 			$pall = $Spotter->getLast7DaysAirportsArrivalByAirlines();
1742
-        		$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1743
-    			foreach ($dall as $value) {
1744
-    				$icao = $value['arrival_airport_icao'];
1745
-    				$airline = $value['airline_icao'];
1746
-    				$ddate = $value['date'];
1747
-    				$find = false;
1748
-    				foreach ($pall as $pvalue) {
1749
-    					if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1750
-    						$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1751
-    						$find = true;
1752
-    						break;
1753
-    					}
1754
-    				}
1755
-    				if ($find === false) {
1756
-    					$pall[] = $value;
1757
-    				}
1758
-    			}
1759
-    			$alldata = $pall;
1742
+				$dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines();
1743
+				foreach ($dall as $value) {
1744
+					$icao = $value['arrival_airport_icao'];
1745
+					$airline = $value['airline_icao'];
1746
+					$ddate = $value['date'];
1747
+					$find = false;
1748
+					foreach ($pall as $pvalue) {
1749
+						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) {
1750
+							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1751
+							$find = true;
1752
+							break;
1753
+						}
1754
+					}
1755
+					if ($find === false) {
1756
+						$pall[] = $value;
1757
+					}
1758
+				}
1759
+				$alldata = $pall;
1760 1760
 			foreach ($alldata as $number) {
1761 1761
 				$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']);
1762 1762
 			}
@@ -1827,44 +1827,44 @@  discard block
 block discarded – undo
1827 1827
 					$this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset);
1828 1828
 				}
1829 1829
 				$pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter);
1830
-	       			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1831
-		        	$alldata = array();
1832
-	    			foreach ($pall as $value) {
1833
-		        		$icao = $value['airport_departure_icao'];
1834
-    					$alldata[$icao] = $value;
1835
-	    			}
1836
-		        	foreach ($dall as $value) {
1837
-	    				$icao = $value['airport_departure_icao'];
1838
-        				if (isset($alldata[$icao])) {
1839
-    						$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1840
-        				} else $alldata[$icao] = $value;
1841
-				}
1842
-	    			$count = array();
1843
-    				foreach ($alldata as $key => $row) {
1844
-    					$count[$key] = $row['airport_departure_icao_count'];
1845
-    				}
1830
+		   			$dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter);
1831
+					$alldata = array();
1832
+					foreach ($pall as $value) {
1833
+						$icao = $value['airport_departure_icao'];
1834
+						$alldata[$icao] = $value;
1835
+					}
1836
+					foreach ($dall as $value) {
1837
+						$icao = $value['airport_departure_icao'];
1838
+						if (isset($alldata[$icao])) {
1839
+							$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1840
+						} else $alldata[$icao] = $value;
1841
+				}
1842
+					$count = array();
1843
+					foreach ($alldata as $key => $row) {
1844
+						$count[$key] = $row['airport_departure_icao_count'];
1845
+					}
1846 1846
 				array_multisort($count,SORT_DESC,$alldata);
1847 1847
 				foreach ($alldata as $number) {
1848
-    					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);
1848
+						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);
1849 1849
 				}
1850 1850
 				$pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter);
1851
-    				$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
1851
+					$dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter);
1852 1852
 				$alldata = array();
1853
-    				foreach ($pall as $value) {
1854
-		        		$icao = $value['airport_arrival_icao'];
1855
-    					$alldata[$icao] = $value;
1856
-	    			}
1857
-		        	foreach ($dall as $value) {
1858
-	    				$icao = $value['airport_arrival_icao'];
1859
-        				if (isset($alldata[$icao])) {
1860
-        					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1861
-		        		} else $alldata[$icao] = $value;
1862
-	    			}
1863
-        			$count = array();
1864
-        			foreach ($alldata as $key => $row) {
1865
-    					$count[$key] = $row['airport_arrival_icao_count'];
1866
-		        	}
1867
-        			array_multisort($count,SORT_DESC,$alldata);
1853
+					foreach ($pall as $value) {
1854
+						$icao = $value['airport_arrival_icao'];
1855
+						$alldata[$icao] = $value;
1856
+					}
1857
+					foreach ($dall as $value) {
1858
+						$icao = $value['airport_arrival_icao'];
1859
+						if (isset($alldata[$icao])) {
1860
+							$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1861
+						} else $alldata[$icao] = $value;
1862
+					}
1863
+					$count = array();
1864
+					foreach ($alldata as $key => $row) {
1865
+						$count[$key] = $row['airport_arrival_icao_count'];
1866
+					}
1867
+					array_multisort($count,SORT_DESC,$alldata);
1868 1868
 				foreach ($alldata as $number) {
1869 1869
 					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);
1870 1870
 				}
@@ -1897,45 +1897,45 @@  discard block
 block discarded – undo
1897 1897
 				}
1898 1898
 				echo '...Departure'."\n";
1899 1899
 				$pall = $Spotter->getLast7DaysAirportsDeparture('',$filter);
1900
-        			$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1900
+					$dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter);
1901 1901
 				foreach ($dall as $value) {
1902
-    					$icao = $value['departure_airport_icao'];
1903
-    					$ddate = $value['date'];
1904
-    					$find = false;
1905
-    					foreach ($pall as $pvalue) {
1906
-    						if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1907
-    							$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1908
-	    						$find = true;
1909
-    							break;
1910
-    						}
1911
-    					}
1912
-    					if ($find === false) {
1913
-    						$pall[] = $value;
1914
-	    				}
1915
-    				}
1916
-	    			$alldata = $pall;
1902
+						$icao = $value['departure_airport_icao'];
1903
+						$ddate = $value['date'];
1904
+						$find = false;
1905
+						foreach ($pall as $pvalue) {
1906
+							if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1907
+								$pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count'];
1908
+								$find = true;
1909
+								break;
1910
+							}
1911
+						}
1912
+						if ($find === false) {
1913
+							$pall[] = $value;
1914
+						}
1915
+					}
1916
+					$alldata = $pall;
1917 1917
 				foreach ($alldata as $number) {
1918 1918
 					$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);
1919 1919
 				}
1920 1920
 				echo '...Arrival'."\n";
1921 1921
 				$pall = $Spotter->getLast7DaysAirportsArrival('',$filter);
1922
-    				$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1922
+					$dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter);
1923 1923
 				foreach ($dall as $value) {
1924 1924
 					$icao = $value['arrival_airport_icao'];
1925 1925
 					$ddate = $value['date'];
1926
-    					$find = false;
1926
+						$find = false;
1927 1927
 					foreach ($pall as $pvalue) {
1928
-    						if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1929
-    							$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1930
-    							$find = true;
1931
-    							break;
1932
-	    					}
1933
-    					}
1934
-    					if ($find === false) {
1935
-    						$pall[] = $value;
1936
-	    				}
1937
-    				}
1938
-    				$alldata = $pall;
1928
+							if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) {
1929
+								$pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count'];
1930
+								$find = true;
1931
+								break;
1932
+							}
1933
+						}
1934
+						if ($find === false) {
1935
+							$pall[] = $value;
1936
+						}
1937
+					}
1938
+					$alldata = $pall;
1939 1939
 				foreach ($alldata as $number) {
1940 1940
 					$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);
1941 1941
 				}
Please login to merge, or discard this patch.
statistics-airport-departure-country.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11
-    unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
13
-    $airline_icao = '';
11
+	unset($_COOKIE['stats_airline_icao']);
12
+	setcookie('stats_airline_icao', '', time()-3600);
13
+	$airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15
-    $airline_icao = $_COOKIE['stats_airline_icao'];
15
+	$airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
17
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19 19
 setcookie('stats_airline_icao',$airline_icao);
20 20
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
statistics-sub-menu.php 1 patch
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		</form>
32 32
 	</div>
33 33
 <?php 
34
-    if (isset($year) && $year == '' && isset($month) && $month == '') {
34
+	if (isset($year) && $year == '' && isset($month) && $month == '') {
35 35
 ?>
36 36
 <div class="sub-menu sub-menu-container">
37 37
 	<ul class="nav">
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		    </ul>
87 87
 		</li>
88 88
 		<?php
89
-		    if (isset($globalAccidents) && $globalAccidents) {
89
+			if (isset($globalAccidents) && $globalAccidents) {
90 90
 		?>
91 91
 		<li class="dropdown">
92 92
 		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
@@ -98,12 +98,12 @@  discard block
 block discarded – undo
98 98
 		    </ul>
99 99
 		</li>
100 100
 		<?php
101
-		    }
101
+			}
102 102
 		?>
103 103
 	</ul>
104 104
 </div>
105 105
 <?php
106
-    } else {
106
+	} else {
107 107
 ?>
108 108
 <div class="sub-menu sub-menu-container">
109 109
 	<ul class="nav">
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 		</li>
163 163
 		-->
164 164
 		<?php
165
-		    if (isset($globalAccidents) && $globalAccidents) {
165
+			if (isset($globalAccidents) && $globalAccidents) {
166 166
 		?>
167 167
 		<!--
168 168
 		<li class="dropdown">
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 		</li>
177 177
 		-->
178 178
 		<?php
179
-		    }
179
+			}
180 180
 		?>
181 181
 	</ul>
182 182
 </div>
183 183
 <?php
184
-    }
184
+	}
185 185
 ?>
186 186
\ No newline at end of file
Please login to merge, or discard this patch.
statistics.php 1 patch
Indentation   +233 added lines, -233 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
44 44
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
45 45
 	}
46
-    ?>
46
+	?>
47 47
     </div>
48 48
     <?php include('statistics-sub-menu.php'); ?>
49 49
     <p class="global-stats">
@@ -52,23 +52,23 @@  discard block
 block discarded – undo
52 52
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
53 53
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
54 54
 	<?php
55
-	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
55
+		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
56 56
 	?>
57 57
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
58 58
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
59 59
         <?php
60
-    	    } else {
61
-    	?>
60
+			} else {
61
+		?>
62 62
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
63 63
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
64 64
     	<?php
65
-    	    }
66
-    	?>
65
+			}
66
+		?>
67 67
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
68 68
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
69 69
         <?php
70
-    		if ($airline_icao == '') {
71
-    	?>
70
+			if ($airline_icao == '') {
71
+		?>
72 72
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
73 73
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
74 74
 	<?php
@@ -89,25 +89,25 @@  discard block
 block discarded – undo
89 89
             <div class="col-md-6">
90 90
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
91 91
                  <?php
92
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
93
-		    if (count($aircraft_array) == 0) print _("No data available");
94
-		    else {
92
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
93
+			if (count($aircraft_array) == 0) print _("No data available");
94
+			else {
95 95
 
96
-                    print '<div id="chart1" class="chart" width="100%"></div>
96
+					print '<div id="chart1" class="chart" width="100%"></div>
97 97
                     <script> 
98 98
                         google.load("visualization", "1", {packages:["corechart"]});
99 99
                       google.setOnLoadCallback(drawChart1);
100 100
                       function drawChart1() {
101 101
                         var data = google.visualization.arrayToDataTable([
102 102
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
103
-                            $aircraft_data = '';
104
-                          foreach($aircraft_array as $aircraft_item)
105
-                                    {
106
-                                            $aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
107
-                                    }
108
-                                    $aircraft_data = substr($aircraft_data, 0, -1);
109
-                                    print $aircraft_data;
110
-                        print ']);
103
+							$aircraft_data = '';
104
+						  foreach($aircraft_array as $aircraft_item)
105
+									{
106
+											$aircraft_data .= '[ "'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
107
+									}
108
+									$aircraft_data = substr($aircraft_data, 0, -1);
109
+									print $aircraft_data;
110
+						print ']);
111 111
 
112 112
                         var options = {
113 113
                             chartArea: {"width": "80%", "height": "60%"},
@@ -122,45 +122,45 @@  discard block
 block discarded – undo
122 122
                               drawChart1();
123 123
                             });
124 124
                   </script>';
125
-                  }
126
-                  ?>
125
+				  }
126
+				  ?>
127 127
                 <div class="more">
128 128
             	    <?php
129
-            		if ($year != '' && $month != '') {
130
-            	    ?>
129
+					if ($year != '' && $month != '') {
130
+					?>
131 131
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
132 132
             	    <?php
133
-            		} else {
134
-            	    ?>
133
+					} else {
134
+					?>
135 135
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
136 136
             	    <?php
137
-            		}
138
-            	    ?>
137
+					}
138
+					?>
139 139
                 </div>
140 140
             </div>
141 141
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
142 142
 <?php
143 143
 //    echo $airline_icao;
144
-    if ($airline_icao == '' || $airline_icao == 'all') {
144
+	if ($airline_icao == '' || $airline_icao == 'all') {
145 145
 	$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month);
146 146
 	if (count($airline_array) > 0) {
147
-            print '<div class="col-md-6">';
148
-	    print '<h2>'._("Top 10 Most Common Airline").'</h2>';
149
-	    print '<div id="chart2" class="chart" width="100%"></div>
147
+			print '<div class="col-md-6">';
148
+		print '<h2>'._("Top 10 Most Common Airline").'</h2>';
149
+		print '<div id="chart2" class="chart" width="100%"></div>
150 150
                     <script> 
151 151
                         google.load("visualization", "1", {packages:["corechart"]});
152 152
                       google.setOnLoadCallback(drawChart2);
153 153
                       function drawChart2() {
154 154
                         var data = google.visualization.arrayToDataTable([
155 155
                             ["'._("Airline").'", "'._("# of times").'"], ';
156
-	    $airline_data = '';
157
-	    foreach($airline_array as $airline_item)
158
-	    {
156
+		$airline_data = '';
157
+		foreach($airline_array as $airline_item)
158
+		{
159 159
 		$airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
160
-	    }
161
-	    $airline_data = substr($airline_data, 0, -1);
162
-	    print $airline_data;
163
-	    print ']);
160
+		}
161
+		$airline_data = substr($airline_data, 0, -1);
162
+		print $airline_data;
163
+		print ']);
164 164
 
165 165
                         var options = {
166 166
                             chartArea: {"width": "80%", "height": "60%"},
@@ -175,27 +175,27 @@  discard block
 block discarded – undo
175 175
                               drawChart2();
176 176
                             });
177 177
                   </script>';
178
-	    if ($year != '' && $month != '') {
178
+		if ($year != '' && $month != '') {
179 179
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
180
-	    } else {
180
+		} else {
181 181
 		print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
182
-	    }
183
-    	    print '</div>';
182
+		}
183
+			print '</div>';
184 184
 	}
185 185
 ?>
186 186
         </div>
187 187
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
188 188
 <?php
189
-    }
189
+	}
190 190
 ?>
191 191
         <div class="row column">
192 192
 <?php
193
-    $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name,$year,$month);
194
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
193
+	$flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name,$year,$month);
194
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
195 195
 	if (empty($flightover_array)) {
196
-	    print '<div class="col-md-12">';
196
+		print '<div class="col-md-12">';
197 197
 	} else {
198
-            print '<div class="col-md-6">';
198
+			print '<div class="col-md-6">';
199 199
 	}
200 200
 ?>
201 201
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
@@ -203,21 +203,21 @@  discard block
 block discarded – undo
203 203
 	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
204 204
 	if (count($pilot_array) == 0) print _("No data available");
205 205
 	else {
206
-	    print '<div id="chart7" class="chart" width="100%"></div>
206
+		print '<div id="chart7" class="chart" width="100%"></div>
207 207
                     <script> 
208 208
                         google.load("visualization", "1", {packages:["corechart"]});
209 209
                       google.setOnLoadCallback(drawChart7);
210 210
                       function drawChart7() {
211 211
                         var data = google.visualization.arrayToDataTable([
212 212
                             ["'._("Pilots").'", "'._("# of times").'"], ';
213
-	    $pilot_data = '';
214
-	    foreach($pilot_array as $pilot_item)
215
-	    {
213
+		$pilot_data = '';
214
+		foreach($pilot_array as $pilot_item)
215
+		{
216 216
 		$pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
217
-	    }
218
-	    $pilot_data = substr($pilot_data, 0, -1);
219
-	    print $pilot_data;
220
-	    print ']);
217
+		}
218
+		$pilot_data = substr($pilot_data, 0, -1);
219
+		print $pilot_data;
220
+		print ']);
221 221
 
222 222
                         var options = {
223 223
                             chartArea: {"width": "80%", "height": "60%"},
@@ -232,8 +232,8 @@  discard block
 block discarded – undo
232 232
                               drawChart7();
233 233
                             });
234 234
                   </script>';
235
-        }
236
-        print '<div class="more">';
235
+		}
236
+		print '<div class="more">';
237 237
 	print '<a href="'.$globalURL.'/statistics/pilot" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
238 238
 	print '</div>';
239 239
 ?>
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
         
242 242
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
243 243
 <?php
244
-    } else {
244
+	} else {
245 245
 ?>
246 246
             <div class="col-md-6">
247 247
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
@@ -249,21 +249,21 @@  discard block
 block discarded – undo
249 249
 	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
250 250
 	if (count($owner_array) == 0) print _("No data available");
251 251
 	else {
252
-	    print '<div id="chart7" class="chart" width="100%"></div>
252
+		print '<div id="chart7" class="chart" width="100%"></div>
253 253
                     <script> 
254 254
                         google.load("visualization", "1", {packages:["corechart"]});
255 255
                       google.setOnLoadCallback(drawChart7);
256 256
                       function drawChart7() {
257 257
                         var data = google.visualization.arrayToDataTable([
258 258
                             ["'._("Owner").'", "'._("# of times").'"], ';
259
-                            $owner_data = '';
260
-	    foreach($owner_array as $owner_item)
261
-	    {
259
+							$owner_data = '';
260
+		foreach($owner_array as $owner_item)
261
+		{
262 262
 		$owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
263
-	    }
264
-	    $owner_data = substr($owner_data, 0, -1);
265
-	    print $owner_data;
266
-	    print ']);
263
+		}
264
+		$owner_data = substr($owner_data, 0, -1);
265
+		print $owner_data;
266
+		print ']);
267 267
 
268 268
                         var options = {
269 269
                             chartArea: {"width": "80%", "height": "60%"},
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
         
288 288
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
289 289
 <?php
290
-    }
291
-    if (!empty($flightover_array)) {
290
+	}
291
+	if (!empty($flightover_array)) {
292 292
 ?>
293 293
             <div class="col-md-6">
294 294
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
@@ -296,21 +296,21 @@  discard block
 block discarded – undo
296 296
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
297 297
 	if (count($flightover_array) == 0) print _("No data available");
298 298
 	else {
299
-	    print '<div id="chart10" class="chart" width="100%"></div>
299
+		print '<div id="chart10" class="chart" width="100%"></div>
300 300
                     <script> 
301 301
                         google.load("visualization", "1", {packages:["corechart"]});
302 302
                       google.setOnLoadCallback(drawChart10);
303 303
                       function drawChart10() {
304 304
                         var data = google.visualization.arrayToDataTable([
305 305
                             ["'._("Country").'", "'._("# of times").'"], ';
306
-                            $flightover_data = '';
307
-	    foreach($flightover_array as $flightover_item)
308
-	    {
306
+							$flightover_data = '';
307
+		foreach($flightover_array as $flightover_item)
308
+		{
309 309
 		$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
310
-	    }
311
-	    $flightover_data = substr($flightover_data, 0, -1);
312
-	    print $flightover_data;
313
-	    print ']);
310
+		}
311
+		$flightover_data = substr($flightover_data, 0, -1);
312
+		print $flightover_data;
313
+		print ']);
314 314
 
315 315
                         var options = {
316 316
                             chartArea: {"width": "80%", "height": "60%"},
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
                 </div>
335 335
             </div>
336 336
 <?php
337
-    }
337
+	}
338 338
 ?>
339 339
         </div>
340 340
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
         <div class="row column">
345 345
             <div class="col-md-6">
346 346
 <?php
347
-    $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
348
-    if (count($airport_airport_array) > 0) {
347
+	$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month);
348
+	if (count($airport_airport_array) > 0) {
349 349
 	print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>';
350 350
 	print '<div id="chart3" class="chart" width="100%"></div>
351 351
                 <script>
@@ -358,13 +358,13 @@  discard block
 block discarded – undo
358 358
 
359 359
                 var data = google.visualization.arrayToDataTable([ 
360 360
                     ["'._("Airport").'", "'._("# of times").'"],';
361
-                    $airport_data = '';
361
+					$airport_data = '';
362 362
 	foreach($airport_airport_array as $airport_item)
363 363
 	{
364
-	    $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
365
-	    $name = str_replace("'", "", $name);
366
-	    $name = str_replace('"', "", $name);
367
-	    $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
364
+		$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
365
+		$name = str_replace("'", "", $name);
366
+		$name = str_replace('"', "", $name);
367
+		$airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],';
368 368
 	}
369 369
 	$airport_data = substr($airport_data, 0, -1);
370 370
 	print $airport_data;
@@ -383,15 +383,15 @@  discard block
 block discarded – undo
383 383
               }
384 384
                 </script>';
385 385
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
386
-    }
386
+	}
387 387
 ?>
388 388
             </div>
389 389
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
390 390
 
391 391
             <div class="col-md-6">
392 392
 <?php
393
-    $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
394
-    if (count($airport_airport_array2) > 0) {
393
+	$airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month);
394
+	if (count($airport_airport_array2) > 0) {
395 395
 	print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>';
396 396
 	print '<div id="chart4" class="chart" width="100%"></div>
397 397
                 <script>
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 	$airport_data2 = '';
408 408
 	foreach($airport_airport_array2 as $airport_item2)
409 409
 	{
410
-	    $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
411
-	    $name2 = str_replace(array("'",'"'), '', $name2);
412
-	    $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
410
+		$name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
411
+		$name2 = str_replace(array("'",'"'), '', $name2);
412
+		$airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],';
413 413
 	}
414 414
 	$airport_data2 = substr($airport_data2, 0, -1);
415 415
 	print $airport_data2;
@@ -428,36 +428,36 @@  discard block
 block discarded – undo
428 428
               }
429 429
                 </script>';
430 430
 	print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
431
-    }
431
+	}
432 432
 ?>
433 433
             </div>
434 434
         </div>
435 435
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
436 436
 <?php
437
-    if ($year == '' && $month == '') {
437
+	if ($year == '' && $month == '') {
438 438
 ?>
439 439
         <div class="row column">
440 440
             <div class="col-md-6">
441 441
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
442 442
                 <?php
443
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
444
-		    if (count($year_array) == 0) print _("No data available");
445
-		    else {
446
-                  print '<div id="chart8" class="chart" width="100%"></div>
443
+				  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
444
+			if (count($year_array) == 0) print _("No data available");
445
+			else {
446
+				  print '<div id="chart8" class="chart" width="100%"></div>
447 447
                     <script> 
448 448
                         google.load("visualization", "1", {packages:["corechart"]});
449 449
                       google.setOnLoadCallback(drawChart8);
450 450
                       function drawChart8() {
451 451
                         var data = google.visualization.arrayToDataTable([
452 452
                             ["'._("Month").'", "'._("# of Flights").'"], ';
453
-                            $year_data = '';
454
-                          foreach($year_array as $year_item)
455
-                                    {
456
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
457
-                                    }
458
-                                    $year_data = substr($year_data, 0, -1);
459
-                                    print $year_data;
460
-                        print ']);
453
+							$year_data = '';
454
+						  foreach($year_array as $year_item)
455
+									{
456
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
457
+									}
458
+									$year_data = substr($year_data, 0, -1);
459
+									print $year_data;
460
+						print ']);
461 461
 
462 462
                         var options = {
463 463
                             legend: {position: "none"},
@@ -475,8 +475,8 @@  discard block
 block discarded – undo
475 475
                               drawChart8();
476 476
                             });
477 477
                   </script>';
478
-                  }
479
-                  ?>
478
+				  }
479
+				  ?>
480 480
                 <div class="more">
481 481
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
482 482
                 </div>
@@ -485,24 +485,24 @@  discard block
 block discarded – undo
485 485
             <div class="col-md-6">
486 486
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
487 487
                 <?php
488
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
489
-		    if (count($month_array) == 0) print _("No data available");
490
-		    else {
491
-                  print '<div id="chart9" class="chart" width="100%"></div>
488
+				  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
489
+			if (count($month_array) == 0) print _("No data available");
490
+			else {
491
+				  print '<div id="chart9" class="chart" width="100%"></div>
492 492
                     <script> 
493 493
                         google.load("visualization", "1", {packages:["corechart"]});
494 494
                       google.setOnLoadCallback(drawChart9);
495 495
                       function drawChart9() {
496 496
                         var data = google.visualization.arrayToDataTable([
497 497
                             ["'._("Day").'", "'._("# of Flights").'"], ';
498
-                            $month_data = '';
499
-                          foreach($month_array as $month_item)
500
-                                    {
501
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
502
-                                    }
503
-                                    $month_data = substr($month_data, 0, -1);
504
-                                    print $month_data;
505
-                        print ']);
498
+							$month_data = '';
499
+						  foreach($month_array as $month_item)
500
+									{
501
+										$month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
502
+									}
503
+									$month_data = substr($month_data, 0, -1);
504
+									print $month_data;
505
+						print ']);
506 506
 
507 507
                         var options = {
508 508
                             legend: {position: "none"},
@@ -520,8 +520,8 @@  discard block
 block discarded – undo
520 520
                               drawChart9();
521 521
                             });
522 522
                   </script>';
523
-                  }
524
-                  ?>
523
+				  }
524
+				  ?>
525 525
                 <div class="more">
526 526
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
527 527
                 </div>
@@ -531,25 +531,25 @@  discard block
 block discarded – undo
531 531
             <div class="col-md-6">
532 532
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
533 533
                 <?php
534
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
535
-		    if (empty($date_array)) print _("No data available");
536
-		    else {
537
-                  print '<div id="chart5" class="chart" width="100%"></div>
534
+					$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
535
+			if (empty($date_array)) print _("No data available");
536
+			else {
537
+				  print '<div id="chart5" class="chart" width="100%"></div>
538 538
                     <script> 
539 539
                         google.load("visualization", "1", {packages:["corechart"]});
540 540
                       google.setOnLoadCallback(drawChart5);
541 541
                       function drawChart5() {
542 542
                         var data = google.visualization.arrayToDataTable([
543 543
                             ["'._("Date").'", "'._("# of Flights").'"], ';
544
-                            $date_data = '';
544
+							$date_data = '';
545 545
                         
546
-                          foreach($date_array as $date_item)
547
-                                    {
548
-                                        $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
549
-                                    }
550
-                                    $date_data = substr($date_data, 0, -1);
551
-                                    print $date_data;
552
-                        print ']);
546
+						  foreach($date_array as $date_item)
547
+									{
548
+										$date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
549
+									}
550
+									$date_data = substr($date_data, 0, -1);
551
+									print $date_data;
552
+						print ']);
553 553
 
554 554
                         var options = {
555 555
                             legend: {position: "none"},
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
                               drawChart5();
568 568
                             });
569 569
                   </script>';
570
-                  }
571
-                  ?>
570
+				  }
571
+				  ?>
572 572
                 <div class="more">
573 573
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
574 574
                 </div>
@@ -577,25 +577,25 @@  discard block
 block discarded – undo
577 577
             <div class="col-md-6">
578 578
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
579 579
                 <?php
580
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
581
-		    if (empty($hour_array)) print _("No data available");
582
-		    else {
580
+				  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
581
+			if (empty($hour_array)) print _("No data available");
582
+			else {
583 583
 
584
-                  print '<div id="chart6" class="chart" width="100%"></div>
584
+				  print '<div id="chart6" class="chart" width="100%"></div>
585 585
                     <script> 
586 586
                         google.load("visualization", "1", {packages:["corechart"]});
587 587
                       google.setOnLoadCallback(drawChart6);
588 588
                       function drawChart6() {
589 589
                         var data = google.visualization.arrayToDataTable([
590 590
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
591
-                            $hour_data = '';
592
-                          foreach($hour_array as $hour_item)
593
-                                    {
594
-                                        $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
595
-                                    }
596
-                                    $hour_data = substr($hour_data, 0, -1);
597
-                                    print $hour_data;
598
-                        print ']);
591
+							$hour_data = '';
592
+						  foreach($hour_array as $hour_item)
593
+									{
594
+										$hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
595
+									}
596
+									$hour_data = substr($hour_data, 0, -1);
597
+									print $hour_data;
598
+						print ']);
599 599
 
600 600
                         var options = {
601 601
                             legend: {position: "none"},
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
                               drawChart6();
614 614
                             });
615 615
                   </script>';
616
-                  }
617
-                ?>
616
+				  }
617
+				?>
618 618
                 <div class="more">
619 619
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
620 620
                 </div>
@@ -622,36 +622,36 @@  discard block
 block discarded – undo
622 622
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
623 623
         </div>
624 624
 <?php
625
-    }
625
+	}
626 626
 ?>
627 627
 
628 628
 <?php
629
-    if ($year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
629
+	if ($year == '' && $month == '' && isset($globalAccidents) && $globalAccidents) {
630 630
 ?>
631 631
         <div class="row column">
632 632
             <div class="col-md-6">
633 633
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
634 634
                 <?php
635
-		    require_once('require/class.Accident.php');
636
-            	    $Accident = new Accident();
637
-                  $year_array = $Accident->countFatalitiesByYear($filter_name);
638
-		    if (count($year_array) == 0) print _("No data available");
639
-		    else {
640
-                  print '<div id="chart32" class="chart" width="100%"></div>
635
+			require_once('require/class.Accident.php');
636
+					$Accident = new Accident();
637
+				  $year_array = $Accident->countFatalitiesByYear($filter_name);
638
+			if (count($year_array) == 0) print _("No data available");
639
+			else {
640
+				  print '<div id="chart32" class="chart" width="100%"></div>
641 641
                     <script> 
642 642
                         google.load("visualization", "1", {packages:["corechart"]});
643 643
                       google.setOnLoadCallback(drawChart32);
644 644
                       function drawChart32() {
645 645
                         var data = google.visualization.arrayToDataTable([
646 646
                             ["'._("Year").'", "'._("# of Fatalities").'"], ';
647
-                            $year_data = '';
648
-                          foreach($year_array as $year_item)
649
-                                    {
650
-                                        $year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
651
-                                    }
652
-                                    $year_data = substr($year_data, 0, -1);
653
-                                    print $year_data;
654
-                        print ']);
647
+							$year_data = '';
648
+						  foreach($year_array as $year_item)
649
+									{
650
+										$year_data .= '[ "'.$year_item['year'].'",'.$year_item['count'].'],';
651
+									}
652
+									$year_data = substr($year_data, 0, -1);
653
+									print $year_data;
654
+						print ']);
655 655
 
656 656
                         var options = {
657 657
                             legend: {position: "none"},
@@ -669,8 +669,8 @@  discard block
 block discarded – undo
669 669
                               drawChart32();
670 670
                             });
671 671
                   </script>';
672
-                  }
673
-                  ?>
672
+				  }
673
+				  ?>
674 674
                 <div class="more">
675 675
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
676 676
                 </div>
@@ -681,26 +681,26 @@  discard block
 block discarded – undo
681 681
             <div class="col-md-6">
682 682
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
683 683
                 <?php
684
-		    require_once('require/class.Accident.php');
685
-            	    $Accident = new Accident();
686
-                  $year_array = $Accident->countFatalitiesLast12Months($filter_name);
687
-		    if (count($year_array) == 0) print _("No data available");
688
-		    else {
689
-                  print '<div id="chart33" class="chart" width="100%"></div>
684
+			require_once('require/class.Accident.php');
685
+					$Accident = new Accident();
686
+				  $year_array = $Accident->countFatalitiesLast12Months($filter_name);
687
+			if (count($year_array) == 0) print _("No data available");
688
+			else {
689
+				  print '<div id="chart33" class="chart" width="100%"></div>
690 690
                     <script> 
691 691
                         google.load("visualization", "1", {packages:["corechart"]});
692 692
                       google.setOnLoadCallback(drawChart33);
693 693
                       function drawChart33() {
694 694
                         var data = google.visualization.arrayToDataTable([
695 695
                             ["'._("Month").'", "'._("# of Fatalities").'"], ';
696
-                            $year_data = '';
697
-                          foreach($year_array as $year_item)
698
-                                    {
699
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
700
-                                    }
701
-                                    $year_data = substr($year_data, 0, -1);
702
-                                    print $year_data;
703
-                        print ']);
696
+							$year_data = '';
697
+						  foreach($year_array as $year_item)
698
+									{
699
+										$year_data .= '[ "'.date('F, Y',strtotime($year_item['year'].'-'.$year_item['month'].'-01')).'",'.$year_item['count'].'],';
700
+									}
701
+									$year_data = substr($year_data, 0, -1);
702
+									print $year_data;
703
+						print ']);
704 704
 
705 705
                         var options = {
706 706
                             legend: {position: "none"},
@@ -718,8 +718,8 @@  discard block
 block discarded – undo
718 718
                               drawChart33();
719 719
                             });
720 720
                   </script>';
721
-                  }
722
-                  ?>
721
+				  }
722
+				  ?>
723 723
                 <div class="more">
724 724
                     <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
725 725
                 </div>
@@ -727,30 +727,30 @@  discard block
 block discarded – undo
727 727
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
728 728
 <br/>
729 729
 <?php
730
-    }
730
+	}
731 731
 ?>
732 732
 
733 733
 <?php
734
-    if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '') {
734
+	if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '' && $year == '' && $month == '') {
735 735
 ?>
736 736
         <div class="row column">
737 737
         	<?php
738
-        	    //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
739
-        	    if ($year == '' && $month == '') {
740
-		        $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
741
-		    } else {
742
-        		$polar = $Stats->getStatsSource('polar',$year,$month);
743
-        	    }
744
-        	    if (!empty($polar)) {
745
-            		print '<h2>'._("Coverage pattern").'</h2>';
746
-        		foreach ($polar as $eachpolar) {
747
-        		    unset($polar_data);
748
-	        	    $Spotter = new Spotter();
749
-        		    $data = json_decode($eachpolar['source_data']);
750
-        		    foreach($data as $value => $key) {
751
-        			$direction = $Spotter->parseDirection(($value*22.5));
752
-        			$distance = $key;
753
-        			$unit = 'km';
738
+				//$polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
739
+				if ($year == '' && $month == '') {
740
+				$polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d'));
741
+			} else {
742
+				$polar = $Stats->getStatsSource('polar',$year,$month);
743
+				}
744
+				if (!empty($polar)) {
745
+					print '<h2>'._("Coverage pattern").'</h2>';
746
+				foreach ($polar as $eachpolar) {
747
+					unset($polar_data);
748
+					$Spotter = new Spotter();
749
+					$data = json_decode($eachpolar['source_data']);
750
+					foreach($data as $value => $key) {
751
+					$direction = $Spotter->parseDirection(($value*22.5));
752
+					$distance = $key;
753
+					$unit = 'km';
754 754
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
755 755
 					$distance = round($distance*0.539957);
756 756
 					$unit = 'nm';
@@ -761,10 +761,10 @@  discard block
 block discarded – undo
761 761
 					$distance = $distance;
762 762
 					$unit = 'km';
763 763
 				}
764
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
765
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
766
-        		    }
767
-        	?>
764
+					if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
765
+						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
766
+					}
767
+			?>
768 768
             <div class="col-md-6">
769 769
                 <h4><?php print $eachpolar['source_name']; ?></h4>
770 770
         	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
@@ -796,27 +796,27 @@  discard block
 block discarded – undo
796 796
 		</script>
797 797
             </div>
798 798
             <?php
799
-        	    }
800
-        	}
801
-            ?>
799
+				}
800
+			}
801
+			?>
802 802
         </div>
803 803
         <div class="row column">
804 804
             <div class="col-md-6">
805 805
         	<?php
806
-        	    //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
807
-        	    if ($year == '' && $month == '') {
808
-        		$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
809
-        	    } else {
810
-        		$msg = $Stats->getStatsSource('msg',$year,$month);
811
-        	    }
812
-        	    if (!empty($msg)) {
813
-            		print '<h2>'._("Messages received").'</h2>';
814
-        		foreach ($msg as $eachmsg) {
815
-        		    //$eachmsg = $msg[0];
816
-        		    $data = $eachmsg['source_data'];
817
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
818
-        		    else $max = 500;
819
-        	?>
806
+				//$msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
807
+				if ($year == '' && $month == '') {
808
+				$msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d'));
809
+				} else {
810
+				$msg = $Stats->getStatsSource('msg',$year,$month);
811
+				}
812
+				if (!empty($msg)) {
813
+					print '<h2>'._("Messages received").'</h2>';
814
+				foreach ($msg as $eachmsg) {
815
+					//$eachmsg = $msg[0];
816
+					$data = $eachmsg['source_data'];
817
+					if ($data > 500) $max = (round(($data+100)/100))*100;
818
+					else $max = 500;
819
+			?>
820 820
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
821 821
         	<script>
822 822
 		      var g = new JustGage({
@@ -832,9 +832,9 @@  discard block
 block discarded – undo
832 832
 			  });
833 833
 		</script>
834 834
             <?php
835
-        	   }
836
-        	}
837
-            ?>
835
+			   }
836
+			}
837
+			?>
838 838
             </div>
839 839
         </div>
840 840
         <div class="row column">
@@ -866,19 +866,19 @@  discard block
 block discarded – undo
866 866
 				$hist_data .= '[ "'.$distance.'",'.$nb.'],';
867 867
 			}
868 868
 			$hist_data = substr($hist_data, 0, -1);
869
-            ?>
869
+			?>
870 870
             <div class="col-md-6">
871 871
                 <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
872 872
                 <?php
873
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
873
+				  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
874 874
                     <script> 
875 875
                         google.load("visualization", "1", {packages:["corechart"]});
876 876
                       google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
877 877
                       function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
878 878
                         var data = google.visualization.arrayToDataTable([
879 879
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
880
-                            print $hist_data;
881
-                        print ']);
880
+							print $hist_data;
881
+						print ']);
882 882
 
883 883
                         var options = {
884 884
                             legend: {position: "none"},
@@ -896,15 +896,15 @@  discard block
 block discarded – undo
896 896
                               drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
897 897
                             });
898 898
                   </script>';
899
-        	?>
899
+			?>
900 900
     	    </div>
901 901
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
902 902
         	<?php
903
-                  }
904
-                ?>
903
+				  }
904
+				?>
905 905
         </div>
906 906
 <?php
907
-    }
907
+	}
908 908
 ?>
909 909
     </div>
910 910
 </div>  
Please login to merge, or discard this patch.
statistics-registration.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11
-    unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
13
-    $airline_icao = '';
11
+	unset($_COOKIE['stats_airline_icao']);
12
+	setcookie('stats_airline_icao', '', time()-3600);
13
+	$airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15
-    $airline_icao = $_COOKIE['stats_airline_icao'];
15
+	$airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
17
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19 19
 setcookie('stats_airline_icao',$airline_icao);
20 20
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
           function drawChart() {
38 38
             var data = google.visualization.arrayToDataTable([
39 39
             	["'._("Aircraft Manufacturer").'", "'._("# of times").'"], ';
40
-            	$registration_data = '';
40
+				$registration_data = '';
41 41
 foreach($registration_array as $registration_item)
42 42
 {
43 43
 	$registration_data .= '[ "'.$registration_item['registration'].' - '.$registration_item['aircraft_name'].' ('.$registration_item['aircraft_icao'].')",'.$registration_item['aircraft_registration_count'].'],';
Please login to merge, or discard this patch.
statistics-callsign.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11
-    unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
13
-    $airline_icao = '';
11
+	unset($_COOKIE['stats_airline_icao']);
12
+	setcookie('stats_airline_icao', '', time()-3600);
13
+	$airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15
-    $airline_icao = $_COOKIE['stats_airline_icao'];
15
+	$airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
17
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19 19
 setcookie('stats_airline_icao',$airline_icao);
20 20
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
statistics-airport-arrival.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@
 block discarded – undo
8 8
 if (!isset($filter_name)) $filter_name = '';
9 9
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 if ($airline_icao == 'all') {
11
-    unset($_COOKIE['stats_airline_icao']);
12
-    setcookie('stats_airline_icao', '', time()-3600);
13
-    $airline_icao = '';
11
+	unset($_COOKIE['stats_airline_icao']);
12
+	setcookie('stats_airline_icao', '', time()-3600);
13
+	$airline_icao = '';
14 14
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15
-    $airline_icao = $_COOKIE['stats_airline_icao'];
15
+	$airline_icao = $_COOKIE['stats_airline_icao'];
16 16
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
17
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18 18
 }
19 19
 setcookie('stats_airline_icao',$airline_icao);
20 20
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.