Completed
Push — master ( 5e8324...900e93 )
by Yannick
06:22
created
airport-statistics-arrival-airport-country.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<option></option>';
24 24
 	$Stats = new Stats();
25 25
 	$airport_names = $Stats->getAllAirportNames();
26
-	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
26
+	if (empty($airport_names)) {
27
+		$airport_names = $Spotter->getAllAirportNames();
28
+	}
27 29
 	ksort($airport_names);
28 30
 	foreach($airport_names as $airport_name)
29 31
 	{
Please login to merge, or discard this patch.
airport-statistics-route.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<option></option>';
24 24
 	$Stats = new Stats();
25 25
 	$airport_names = $Stats->getAllAirportNames();
26
-	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
26
+	if (empty($airport_names)) {
27
+		$airport_names = $Spotter->getAllAirportNames();
28
+	}
27 29
 	ksort($airport_names);
28 30
 	foreach($airport_names as $airport_name)
29 31
 	{
Please login to merge, or discard this patch.
incident-detailed.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,12 @@
 block discarded – undo
58 58
 if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) {
59 59
 	include('table-output.php');
60 60
 	print '<div class="pagination">';
61
-	if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">&laquo;'._("Previous Page").'</a>';
62
-	if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'&raquo;</a>';
61
+	if ($limit_previous_1 >= 0) {
62
+		print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">&laquo;'._("Previous Page").'</a>';
63
+	}
64
+	if ($spotter_array[0]['query_number_rows'] == $absolute_difference) {
65
+		print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'&raquo;</a>';
66
+	}
63 67
 	print '</div>';
64 68
 }
65 69
 print '</div>';
Please login to merge, or discard this patch.
airport-statistics-registration.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<option></option>';
24 24
 	$Stats = new Stats();
25 25
 	$airport_names = $Stats->getAllAirportNames();
26
-	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
26
+	if (empty($airport_names)) {
27
+		$airport_names = $Spotter->getAllAirportNames();
28
+	}
27 29
 	ksort($airport_names);
28 30
 	foreach($airport_names as $airport_name)
29 31
 	{
Please login to merge, or discard this patch.
airport-statistics-time.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<option></option>';
24 24
 	$Stats = new Stats();
25 25
 	$airport_names = $Stats->getAllAirportNames();
26
-	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
26
+	if (empty($airport_names)) {
27
+		$airport_names = $Spotter->getAllAirportNames();
28
+	}
27 29
 	ksort($airport_names);
28 30
 	foreach($airport_names as $airport_name)
29 31
 	{
Please login to merge, or discard this patch.
aircraft.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 	print '<h1>'._("Aircrafts Types").'</h1>';
17 17
 
18 18
 	$aircraft_types = $Stats->getAllAircraftTypes();
19
-	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes();
19
+	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') {
20
+		$aircraft_types = $Spotter->getAllAircraftTypes();
21
+	}
20 22
 	$previous = null;
21 23
 	print '<div class="alphabet-legend">';
22 24
 	foreach($aircraft_types as $value) {
@@ -24,10 +26,14 @@  discard block
 block discarded – undo
24 26
 		$firstLetter = substr($value['aircraft_manufacturer'], 0, 1);
25 27
 		if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
26 28
 		{
27
-			if ($previous !== null) print ' | ';
29
+			if ($previous !== null) {
30
+				print ' | ';
31
+			}
28 32
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
29 33
 		}
30
-		if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter;
34
+		if ($firstLetter != '(' && $firstLetter != ')') {
35
+			$previous = $firstLetter;
36
+		}
31 37
 	}
32 38
 	print '</div>';
33 39
 	$previous = null;
@@ -38,10 +44,14 @@  discard block
 block discarded – undo
38 44
 		{
39 45
 			if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
40 46
 			{
41
-				if ($previous !== null) print '</div>';
47
+				if ($previous !== null) {
48
+					print '</div>';
49
+				}
42 50
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
43 51
 			}
44
-			if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter;
52
+			if ($firstLetter != '(' && $firstLetter != ')') {
53
+				$previous = $firstLetter;
54
+			}
45 55
 			print '<div class="alphabet-item">';
46 56
 			print '<a href="'.$globalURL.'/aircraft/'.$value['aircraft_icao'].'">';
47 57
 			if ($value['aircraft_name'] == '') {
Please login to merge, or discard this patch.
require/class.Accident.php 1 patch
Braces   +75 added lines, -27 removed lines patch added patch discarded remove patch
@@ -96,8 +96,11 @@  discard block
 block discarded – undo
96 96
 			$data = array();
97 97
 			if ($row['registration'] != '') {
98 98
 				$image_array = $Image->getSpotterImage($row['registration']);
99
-				if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
100
-				else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
99
+				if (count($image_array) > 0) {
100
+					$data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
101
+				} else {
102
+					$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
103
+				}
101 104
 				$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
102 105
 				$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
103 106
 				if (!empty($aircraft_info)) {
@@ -113,17 +116,30 @@  discard block
 block discarded – undo
113 116
 					$data['aircraft_base'] = $owner_data['base'];
114 117
 					$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
115 118
 				}
116
-			} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
117
-			if ($row['registration'] == '') $row['registration'] = 'NA';
118
-			if ($row['ident'] == '') $row['ident'] = 'NA';
119
+			} else {
120
+				$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
121
+			}
122
+			if ($row['registration'] == '') {
123
+				$row['registration'] = 'NA';
124
+			}
125
+			if ($row['ident'] == '') {
126
+				$row['ident'] = 'NA';
127
+			}
119 128
 			$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
120 129
 			if (isset($identicao[0])) {
121 130
 				if (substr($row['ident'],0,2) == 'AF') {
122
-					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
123
-					else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
124
-				} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
131
+					if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
132
+						$icao = $row['ident'];
133
+					} else {
134
+						$icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
135
+					}
136
+				} else {
137
+					$icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
138
+				}
125 139
 				$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
126
-			} else $icao = $row['ident'];
140
+			} else {
141
+				$icao = $row['ident'];
142
+			}
127 143
 			$icao = $Translation->checkTranslation($icao,false);
128 144
 			//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
129 145
 			if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
@@ -138,10 +154,14 @@  discard block
 block discarded – undo
138 154
 				//else echo 'No data...'."\n";
139 155
 			}
140 156
 			$data = array_merge($row,$data);
141
-			if ($data['ident'] == null) $data['ident'] = $icao;
157
+			if ($data['ident'] == null) {
158
+				$data['ident'] = $icao;
159
+			}
142 160
 			if ($data['title'] == null) {
143 161
 				$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
144
-			} else $data['message'] = strtolower($data['title']);
162
+			} else {
163
+				$data['message'] = strtolower($data['title']);
164
+			}
145 165
 			$ids = $Spotter->getAllIDByRegistration($data['registration']);
146 166
 			$date = $data['date'];
147 167
 			if (isset($ids[$date])) {
@@ -158,8 +178,9 @@  discard block
 block discarded – undo
158 178
 		if (isset($result)) {
159 179
 			$result[0]['query_number_rows'] = $i;
160 180
 			return $result;
181
+		} else {
182
+			return array();
161 183
 		}
162
-		else return array();
163 184
 	}
164 185
 	
165 186
 	/*
@@ -198,7 +219,9 @@  discard block
 block discarded – undo
198 219
 	*/
199 220
 	public function import($file) {
200 221
 		global $globalTransaction, $globalDebug;
201
-		if ($globalDebug) echo 'Import '.$file."\n";
222
+		if ($globalDebug) {
223
+			echo 'Import '.$file."\n";
224
+		}
202 225
 		$result = array();
203 226
 		if (file_exists($file)) {
204 227
 			if (($handle = fopen($file,'r')) !== FALSE) {
@@ -209,8 +232,11 @@  discard block
 block discarded – undo
209 232
 				}
210 233
 				fclose($handle);
211 234
 			}
212
-			if (!empty($result)) $this->add($result,true);
213
-			elseif ($globalDebug) echo 'Nothing to import';
235
+			if (!empty($result)) {
236
+				$this->add($result,true);
237
+			} elseif ($globalDebug) {
238
+				echo 'Nothing to import';
239
+			}
214 240
 		}
215 241
 	}
216 242
 
@@ -246,14 +272,23 @@  discard block
 block discarded – undo
246 272
 					}
247 273
 				}
248 274
 				fclose($handle);
249
-			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
250
-		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
275
+			} elseif ($globalDebug) {
276
+				echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
277
+			}
278
+		} elseif ($globalDebug) {
279
+			echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
280
+		}
251 281
 		$result = $Common->arr_diff($all_md5_new,$all_md5);
252
-		if (empty($result) && $globalDebug) echo 'Nothing to update';
282
+		if (empty($result) && $globalDebug) {
283
+			echo 'Nothing to update';
284
+		}
253 285
 		foreach ($result as $file => $md5) {
254 286
 			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
255
-			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
256
-			elseif ($globalDebug) echo 'Download '.$file.' failed';
287
+			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) {
288
+				$this->import(dirname(__FILE__).'/../install/tmp/'.$file);
289
+			} elseif ($globalDebug) {
290
+				echo 'Download '.$file.' failed';
291
+			}
257 292
 		}
258 293
 	}
259 294
 
@@ -270,13 +305,17 @@  discard block
 block discarded – undo
270 305
 		$Image = new Image();
271 306
 		$Spotter = new Spotter();
272 307
 
273
-		if (empty($crash)) return false;
308
+		if (empty($crash)) {
309
+			return false;
310
+		}
274 311
 		if (!$new) {
275 312
 			$query_delete = 'DELETE FROM accidents WHERE source = :source';
276 313
 			$sthd = $Connection->db->prepare($query_delete);
277 314
 			$sthd->execute(array(':source' => $crash[0]['source']));
278 315
 		}
279
-		if ($globalTransaction) $Connection->db->beginTransaction();
316
+		if ($globalTransaction) {
317
+			$Connection->db->beginTransaction();
318
+		}
280 319
 		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
281 320
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
282 321
 		$sth_check = $Connection->db->prepare($query_check);
@@ -291,7 +330,9 @@  discard block
 block discarded – undo
291 330
 					return $value === "" ? NULL : $value;
292 331
 				}, $cr);
293 332
 				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
294
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
333
+					if (strpos($cr['registration'],'-') === FALSE) {
334
+						$cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
335
+					}
295 336
 					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
296 337
 					$sth_check->execute($query_check_values);
297 338
 					$result_check = $sth_check->fetch(PDO::FETCH_ASSOC);
@@ -313,9 +354,13 @@  discard block
 block discarded – undo
313 354
 					$Connection->db->beginTransaction();
314 355
 				}
315 356
 			}
316
-			if ($globalTransaction) $Connection->db->commit();
357
+			if ($globalTransaction) {
358
+				$Connection->db->commit();
359
+			}
317 360
 		} catch(PDOException $e) {
318
-			if ($globalTransaction) $Connection->db->rollBack();
361
+			if ($globalTransaction) {
362
+				$Connection->db->rollBack();
363
+			}
319 364
 			echo $e->getMessage();
320 365
 		}
321 366
 		$sth_check->closeCursor();
@@ -354,8 +399,11 @@  discard block
 block discarded – undo
354 399
 			return "error : ".$e->getMessage();
355 400
 		}
356 401
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
357
-		if ($row['nb'] > 0) return false;
358
-		else return true;
402
+		if ($row['nb'] > 0) {
403
+			return false;
404
+		} else {
405
+			return true;
406
+		}
359 407
 	}
360 408
 
361 409
 	public static function insert_last_accidents_update() {
Please login to merge, or discard this patch.
accident-latest.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,8 +58,12 @@
 block discarded – undo
58 58
 if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) {
59 59
 	include('table-output.php');
60 60
 	print '<div class="pagination">';
61
-	if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">&laquo;'._("Previous Page").'</a>';
62
-	if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'&raquo;</a>';
61
+	if ($limit_previous_1 >= 0) {
62
+		print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">&laquo;'._("Previous Page").'</a>';
63
+	}
64
+	if ($spotter_array[0]['query_number_rows'] == $absolute_difference) {
65
+		print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'&raquo;</a>';
66
+	}
63 67
 	print '</div>';
64 68
 }
65 69
 print '</div>';
Please login to merge, or discard this patch.
statistics-airline-country.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Airline by Country");
7
-if (!isset($filter_name)) $filter_name = '';
7
+if (!isset($filter_name)) {
8
+	$filter_name = '';
9
+}
8 10
 require_once('header.php');
9 11
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
10 12
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.