Completed
Push — master ( 8b0327...527817 )
by Yannick
07:05
created
require/class.Stats.php 1 patch
Braces   +122 added lines, -46 removed lines patch added patch discarded remove patch
@@ -72,8 +72,11 @@  discard block
 block discarded – undo
72 72
 
73 73
 
74 74
 	public function countAllAircraftTypes($limit = true) {
75
-		if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
76
-		else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' ORDER BY aircraft_icao_count DESC";
75
+		if ($limit) {
76
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0";
77
+		} else {
78
+			$query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' ORDER BY aircraft_icao_count DESC";
79
+		}
77 80
                  try {
78 81
                         $sth = $this->db->prepare($query);
79 82
                         $sth->execute();
@@ -88,8 +91,11 @@  discard block
 block discarded – undo
88 91
                 return $all;
89 92
 	}
90 93
 	public function countAllAirlineCountries($limit = true) {
91
-		if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
92
-		else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao GROUP BY airline_country ORDER BY airline_country_count DESC";
94
+		if ($limit) {
95
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0";
96
+		} else {
97
+			$query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao GROUP BY airline_country ORDER BY airline_country_count DESC";
98
+		}
93 99
                  try {
94 100
                         $sth = $this->db->prepare($query);
95 101
                         $sth->execute();
@@ -105,8 +111,11 @@  discard block
 block discarded – undo
105 111
                 return $all;
106 112
 	}
107 113
 	public function countAllAircraftManufacturers($limit = true) {
108
-		if ($limit) $query = "SELECT aircraft.manufacturer AS aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft,aircraft WHERE stats_aircraft.aircraft_icao=aircraft.icao GROUP BY aircraft.manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
109
-		else $query = "SELECT aircraft.manufacturer AS aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft,aircraft WHERE stats_aircraft.aircraft_icao=aircraft.icao GROUP BY aircraft.manufacturer ORDER BY aircraft_manufacturer_count DESC";
114
+		if ($limit) {
115
+			$query = "SELECT aircraft.manufacturer AS aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft,aircraft WHERE stats_aircraft.aircraft_icao=aircraft.icao GROUP BY aircraft.manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0";
116
+		} else {
117
+			$query = "SELECT aircraft.manufacturer AS aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft,aircraft WHERE stats_aircraft.aircraft_icao=aircraft.icao GROUP BY aircraft.manufacturer ORDER BY aircraft_manufacturer_count DESC";
118
+		}
110 119
                  try {
111 120
                         $sth = $this->db->prepare($query);
112 121
                         $sth->execute();
@@ -122,8 +131,11 @@  discard block
 block discarded – undo
122 131
 	}
123 132
 
124 133
 	public function countAllArrivalCountries($limit = true) {
125
-		if ($limit) $query = "SELECT airport_country AS arrival_airport_country, arrival as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' LIMIT 10 OFFSET 0";
126
-		else $query = "SELECT airport_country AS arrival_airport_country, arrival as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly'";
134
+		if ($limit) {
135
+			$query = "SELECT airport_country AS arrival_airport_country, arrival as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' LIMIT 10 OFFSET 0";
136
+		} else {
137
+			$query = "SELECT airport_country AS arrival_airport_country, arrival as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly'";
138
+		}
127 139
                  try {
128 140
                         $sth = $this->db->prepare($query);
129 141
                         $sth->execute();
@@ -138,8 +150,11 @@  discard block
 block discarded – undo
138 150
                 return $all;
139 151
 	}
140 152
 	public function countAllDepartureCountries($limit = true) {
141
-		if ($limit) $query = "SELECT airport_country AS departure_airport_country, departure as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' LIMIT 10 OFFSET 0";
142
-		else $query = "SELECT airport_country AS departure_airport_country, departure as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly'";
153
+		if ($limit) {
154
+			$query = "SELECT airport_country AS departure_airport_country, departure as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' LIMIT 10 OFFSET 0";
155
+		} else {
156
+			$query = "SELECT airport_country AS departure_airport_country, departure as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly'";
157
+		}
143 158
                  try {
144 159
                         $sth = $this->db->prepare($query);
145 160
                         $sth->execute();
@@ -155,8 +170,11 @@  discard block
 block discarded – undo
155 170
 	}
156 171
 
157 172
 	public function countAllAirlines($limit = true) {
158
-		if ($limit) $query = "SELECT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = airline_icao ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
159
-		else $query = "SELECT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = airline_icao ORDER BY airline_count DESC";
173
+		if ($limit) {
174
+			$query = "SELECT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = airline_icao ORDER BY airline_count DESC LIMIT 10 OFFSET 0";
175
+		} else {
176
+			$query = "SELECT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = airline_icao ORDER BY airline_count DESC";
177
+		}
160 178
                  try {
161 179
                         $sth = $this->db->prepare($query);
162 180
                         $sth->execute();
@@ -171,8 +189,11 @@  discard block
 block discarded – undo
171 189
                 return $all;
172 190
 	}
173 191
 	public function countAllAircraftRegistrations($limit = true) {
174
-		if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
175
-		else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao ORDER BY aircraft_registration_count DESC";
192
+		if ($limit) {
193
+			$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0";
194
+		} else {
195
+			$query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao ORDER BY aircraft_registration_count DESC";
196
+		}
176 197
                  try {
177 198
                         $sth = $this->db->prepare($query);
178 199
                         $sth->execute();
@@ -187,8 +208,11 @@  discard block
 block discarded – undo
187 208
                 return $all;
188 209
 	}
189 210
 	public function countAllCallsigns($limit = true) {
190
-		if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
191
-		else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao ORDER BY callsign_icao_count DESC";
211
+		if ($limit) {
212
+			$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0";
213
+		} else {
214
+			$query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao ORDER BY callsign_icao_count DESC";
215
+		}
192 216
                  try {
193 217
                         $sth = $this->db->prepare($query);
194 218
                         $sth->execute();
@@ -205,8 +229,11 @@  discard block
 block discarded – undo
205 229
 	public function countAllFlightOverCountries($limit = true) {
206 230
 		$Connection = new Connection();
207 231
 		if ($Connection->tableExists('countries')) {
208
-			if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
209
-			else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 ORDER BY flight_count DESC";
232
+			if ($limit) {
233
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 ORDER BY flight_count DESC LIMIT 20 OFFSET 0";
234
+			} else {
235
+				$query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 ORDER BY flight_count DESC";
236
+			}
210 237
 			 try {
211 238
 				$sth = $this->db->prepare($query);
212 239
 				$sth->execute();
@@ -226,8 +253,11 @@  discard block
 block discarded – undo
226 253
 		}
227 254
 	}
228 255
 	public function countAllPilots($limit = true) {
229
-		if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
230
-		else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot ORDER BY pilot_count DESC";
256
+		if ($limit) {
257
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot ORDER BY pilot_count DESC LIMIT 10 OFFSET 0";
258
+		} else {
259
+			$query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot ORDER BY pilot_count DESC";
260
+		}
231 261
                  try {
232 262
                         $sth = $this->db->prepare($query);
233 263
                         $sth->execute();
@@ -242,8 +272,11 @@  discard block
 block discarded – undo
242 272
                 return $all;
243 273
 	}
244 274
 	public function countAllOwners($limit = true) {
245
-		if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
246
-		else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner ORDER BY owner_count DESC";
275
+		if ($limit) {
276
+			$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner ORDER BY owner_count DESC LIMIT 10 OFFSET 0";
277
+		} else {
278
+			$query = "SELECT owner_name, cnt AS owner_count FROM stats_owner ORDER BY owner_count DESC";
279
+		}
247 280
                  try {
248 281
                         $sth = $this->db->prepare($query);
249 282
                         $sth->execute();
@@ -258,8 +291,11 @@  discard block
 block discarded – undo
258 291
                 return $all;
259 292
 	}
260 293
 	public function countAllDepartureAirports($limit = true) {
261
-		if ($limit) $query = "SELECT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' LIMIT 10 OFFSET 0";
262
-		else $query = "SELECT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly'";
294
+		if ($limit) {
295
+			$query = "SELECT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' LIMIT 10 OFFSET 0";
296
+		} else {
297
+			$query = "SELECT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly'";
298
+		}
263 299
                  try {
264 300
                         $sth = $this->db->prepare($query);
265 301
                         $sth->execute();
@@ -281,7 +317,9 @@  discard block
 block discarded – undo
281 317
         			$icao = $value['airport_departure_icao'];
282 318
         			if (isset($all[$icao])) {                                                           
283 319
         				$all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
284
-        			} else $all[$icao] = $value;
320
+        			} else {
321
+        				$all[$icao] = $value;
322
+        			}
285 323
         		}
286 324
         		$count = array();
287 325
         		foreach ($all as $key => $row) {
@@ -292,8 +330,11 @@  discard block
 block discarded – undo
292 330
                 return $all;
293 331
 	}
294 332
 	public function countAllArrivalAirports($limit = true) {
295
-		if ($limit) $query = "SELECT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' LIMIT 10 OFFSET 0";
296
-		else $query = "SELECT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly'";
333
+		if ($limit) {
334
+			$query = "SELECT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' LIMIT 10 OFFSET 0";
335
+		} else {
336
+			$query = "SELECT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly'";
337
+		}
297 338
                  try {
298 339
                         $sth = $this->db->prepare($query);
299 340
                         $sth->execute();
@@ -315,7 +356,9 @@  discard block
 block discarded – undo
315 356
         			$icao = $value['airport_arrival_icao'];
316 357
         			if (isset($all[$icao])) {
317 358
         				$all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
318
-        			} else $all[$icao] = $value;
359
+        			} else {
360
+        				$all[$icao] = $value;
361
+        			}
319 362
         		}
320 363
         		$count = array();
321 364
         		foreach ($all as $key => $row) {
@@ -328,11 +371,17 @@  discard block
 block discarded – undo
328 371
 	public function countAllMonthsLastYear($limit = true) {
329 372
 		global $globalDBdriver;
330 373
 		if ($globalDBdriver == 'mysql') {
331
-			if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH)";
332
-			else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth'";
374
+			if ($limit) {
375
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH)";
376
+			} else {
377
+				$query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth'";
378
+			}
333 379
 		} else {
334
-			if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS'";
335
-			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'";
380
+			if ($limit) {
381
+				$query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS'";
382
+			} else {
383
+				$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'";
384
+			}
336 385
 		}
337 386
 		$query_data = array();
338 387
                  try {
@@ -435,8 +484,11 @@  discard block
 block discarded – undo
435 484
 	public function countAllHours($orderby = 'hour',$limit = true) {
436 485
 		global $globalTimezone, $globalDBdriver;
437 486
 
438
-		if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour'";
439
-		else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour'";
487
+		if ($limit) {
488
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour'";
489
+		} else {
490
+			$query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour'";
491
+		}
440 492
 		if ($orderby == 'hour') {
441 493
 			if ($globalDBdriver == 'mysql') {
442 494
 				$query .= " ORDER BY flight_date ASC";
@@ -444,7 +496,9 @@  discard block
 block discarded – undo
444 496
 				$query .= " ORDER BY CAST(flight_date AS integer) ASC";
445 497
 			}
446 498
 		}
447
-		if ($orderby == 'count') $query .= " ORDER BY hour_count DESC";
499
+		if ($orderby == 'count') {
500
+			$query .= " ORDER BY hour_count DESC";
501
+		}
448 502
                  try {
449 503
                         $sth = $this->db->prepare($query);
450 504
                         $sth->execute();
@@ -924,13 +978,17 @@  discard block
 block discarded – undo
924 978
 			$alldata = $Spotter->countAllMonths();
925 979
 			$lastyear = false;
926 980
 			foreach ($alldata as $number) {
927
-				if ($number['year_name'] != date('Y')) $lastyear = true;
981
+				if ($number['year_name'] != date('Y')) {
982
+					$lastyear = true;
983
+				}
928 984
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
929 985
 			}
930 986
 			$alldata = $Spotter->countAllMilitaryMonths();
931 987
 			$lastyear = false;
932 988
 			foreach ($alldata as $number) {
933
-				if ($number['year_name'] != date('Y')) $lastyear = true;
989
+				if ($number['year_name'] != date('Y')) {
990
+					$lastyear = true;
991
+				}
934 992
 				$this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
935 993
 			}
936 994
 			$alldata = $Spotter->countAllMonthsOwners();
@@ -1026,7 +1084,9 @@  discard block
 block discarded – undo
1026 1084
 					}
1027 1085
 				}
1028 1086
 			}
1029
-			if (!isset($globalArchiveMonths) || $globalArchiveMonths == '') $globalArchiveMonths = 2;
1087
+			if (!isset($globalArchiveMonths) || $globalArchiveMonths == '') {
1088
+				$globalArchiveMonths = 2;
1089
+			}
1030 1090
 			if ($globalArchiveMonths > 0) {
1031 1091
 				$alldata = $Spotter->countAllAircraftTypes(false,$globalArchiveMonths);
1032 1092
 				foreach ($alldata as $number) {
@@ -1069,7 +1129,9 @@  discard block
 block discarded – undo
1069 1129
     					$icao = $value['airport_departure_icao'];
1070 1130
         				if (isset($alldata[$icao])) {                                                           
1071 1131
         					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1072
-	        			} else $alldata[$icao] = $value;
1132
+	        			} else {
1133
+	        				$alldata[$icao] = $value;
1134
+	        			}
1073 1135
     				}
1074 1136
         			$count = array();
1075 1137
         			foreach ($alldata as $key => $row) {
@@ -1092,7 +1154,9 @@  discard block
 block discarded – undo
1092 1154
     					$icao = $value['airport_arrival_icao'];
1093 1155
         				if (isset($alldata[$icao])) {                                                           
1094 1156
         					$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1095
-	        			} else $alldata[$icao] = $value;
1157
+	        			} else {
1158
+	        				$alldata[$icao] = $value;
1159
+	        			}
1096 1160
     				}
1097 1161
         			$count = array();
1098 1162
         			foreach ($alldata as $key => $row) {
@@ -1139,7 +1203,9 @@  discard block
 block discarded – undo
1139 1203
 			echo 'Update stats !'."\n";
1140 1204
 			if (isset($last_update[0]['value'])) {
1141 1205
 				$last_update_day = $last_update[0]['value'];
1142
-			} else $last_update_day = '2012-12-12 12:12:12';
1206
+			} else {
1207
+				$last_update_day = '2012-12-12 12:12:12';
1208
+			}
1143 1209
 			$Spotter = new Spotter($this->db);
1144 1210
 			$alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day);
1145 1211
 			foreach ($alldata as $number) {
@@ -1176,7 +1242,9 @@  discard block
 block discarded – undo
1176 1242
     				$icao = $value['airport_departure_icao'];
1177 1243
         			if (isset($alldata[$icao])) {                                                           
1178 1244
     					$alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count'];
1179
-        			} else $alldata[$icao] = $value;
1245
+        			} else {
1246
+        				$alldata[$icao] = $value;
1247
+        			}
1180 1248
 			}
1181 1249
     			$count = array();
1182 1250
     			foreach ($alldata as $key => $row) {
@@ -1198,7 +1266,9 @@  discard block
 block discarded – undo
1198 1266
     				$icao = $value['airport_arrival_icao'];
1199 1267
         			if (isset($alldata[$icao])) {                                                           
1200 1268
         				$alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count'];
1201
-	        		} else $alldata[$icao] = $value;
1269
+	        		} else {
1270
+	        			$alldata[$icao] = $value;
1271
+	        		}
1202 1272
     			}
1203 1273
         		$count = array();
1204 1274
         		foreach ($alldata as $key => $row) {
@@ -1224,7 +1294,9 @@  discard block
 block discarded – undo
1224 1294
 			$alldata = $Spotter->countAllMonths();
1225 1295
 			$lastyear = false;
1226 1296
 			foreach ($alldata as $number) {
1227
-				if ($number['year_name'] != date('Y')) $lastyear = true;
1297
+				if ($number['year_name'] != date('Y')) {
1298
+					$lastyear = true;
1299
+				}
1228 1300
 				$this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])));
1229 1301
 			}
1230 1302
 			$alldata = $Spotter->countAllMilitaryMonths();
@@ -1265,7 +1337,9 @@  discard block
 block discarded – undo
1265 1337
     				$icao = $value['departure_airport_icao'];
1266 1338
         			if (isset($alldata[$icao])) {                                                           
1267 1339
         				$alldata[$icao]['departure_airport_count'] = $alldata[$icao]['departure_airport_count'] + $value['departure_airport_count'];
1268
-	        		} else $alldata[$icao] = $value;
1340
+	        		} else {
1341
+	        			$alldata[$icao] = $value;
1342
+	        		}
1269 1343
     			}
1270 1344
         		$count = array();
1271 1345
         		foreach ($alldata as $key => $row) {
@@ -1287,7 +1361,9 @@  discard block
 block discarded – undo
1287 1361
     				$icao = $value['arrival_airport_icao'];
1288 1362
         			if (isset($alldata[$icao])) {                                                           
1289 1363
         				$alldata[$icao]['arrival_airport_icao_count'] = $alldata[$icao]['arrival_airport_count'] + $value['arrival_airport_count'];
1290
-	        		} else $alldata[$icao] = $value;
1364
+	        		} else {
1365
+	        			$alldata[$icao] = $value;
1366
+	        		}
1291 1367
     			}
1292 1368
         		$count = array();
1293 1369
         		foreach ($alldata as $key => $row) {
Please login to merge, or discard this patch.