Completed
Push — master ( 9aa308...c4688e )
by Yannick
07:45
created
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.
statistics-airline.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Airline");
7 7
 require_once('header.php');
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
10 12
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
11 13
 include('statistics-sub-menu.php'); 
Please login to merge, or discard this patch.
pilot.php 1 patch
Braces   +11 added lines, -4 removed lines patch added patch discarded remove patch
@@ -31,7 +31,9 @@  discard block
 block discarded – undo
31 31
 			}
32 32
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
33 33
 		}
34
-		if ($firstLetter != "'") $previous = $firstLetter;
34
+		if ($firstLetter != "'") {
35
+			$previous = $firstLetter;
36
+		}
35 37
 	}
36 38
 	print '</div>';
37 39
 	$previous = null;
@@ -46,10 +48,15 @@  discard block
 block discarded – undo
46 48
 				}
47 49
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
48 50
 			}
49
-			if ($firstLetter != "'") $previous = $firstLetter;
51
+			if ($firstLetter != "'") {
52
+				$previous = $firstLetter;
53
+			}
50 54
 			print '<div class="alphabet-item">';
51
-			if (isset($value['pilot_id']) && $value['pilot_id'] != '') print '<a href="'.$globalURL.'/pilot/'.$value['pilot_id'].'">'.$value['pilot_name'].' ('.$value['pilot_id'].')';
52
-			else print '<a href="'.$globalURL.'/pilot/'.$value['pilot_name'].'">'.$value['pilot_name'];
55
+			if (isset($value['pilot_id']) && $value['pilot_id'] != '') {
56
+				print '<a href="'.$globalURL.'/pilot/'.$value['pilot_id'].'">'.$value['pilot_name'].' ('.$value['pilot_id'].')';
57
+			} else {
58
+				print '<a href="'.$globalURL.'/pilot/'.$value['pilot_name'].'">'.$value['pilot_name'];
59
+			}
53 60
 			print '</a>';
54 61
 			print '</div>';
55 62
 		}
Please login to merge, or discard this patch.
owner.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
 			}
34 34
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
35 35
 		}
36
-		if ($firstLetter != "'" && $firstLetter != '"') $previous = $firstLetter;
36
+		if ($firstLetter != "'" && $firstLetter != '"') {
37
+			$previous = $firstLetter;
38
+		}
37 39
 	}
38 40
 	print '</div>';
39 41
 	$previous = null;
@@ -48,7 +50,9 @@  discard block
 block discarded – undo
48 50
 				}
49 51
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
50 52
 			}
51
-			if ($firstLetter != "'" && $firstLetter != '"') $previous = $firstLetter;
53
+			if ($firstLetter != "'" && $firstLetter != '"') {
54
+				$previous = $firstLetter;
55
+			}
52 56
 			print '<div class="alphabet-item">';
53 57
 			print '<a href="'.$globalURL.'/owner/'.$value['owner_name'].'">';
54 58
 			print $value['owner_name'];
Please login to merge, or discard this patch.
require/class.Common.php 1 patch
Braces   +60 added lines, -25 removed lines patch added patch discarded remove patch
@@ -27,8 +27,11 @@  discard block
 block discarded – undo
27 27
 		} else {
28 28
 			curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
29 29
 		}
30
-		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
31
-		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
30
+		if ($timeout == '') {
31
+			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
32
+		} else {
33
+			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
34
+		}
32 35
 		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
33 36
 		if ($type == 'post') {
34 37
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@@ -74,8 +77,9 @@  discard block
 block discarded – undo
74 77
 	private function curlResponseHeaderCallback($ch, $headerLine) {
75 78
 		//global $cookies;
76 79
 		$cookies = array();
77
-		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1)
78
-			$cookies[] = $cookie;
80
+		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) {
81
+					$cookies[] = $cookie;
82
+		}
79 83
 		return strlen($headerLine); // Needed by curl
80 84
 	}
81 85
 
@@ -86,11 +90,15 @@  discard block
 block discarded – undo
86 90
 		curl_setopt($ch, CURLOPT_URL, $url);
87 91
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
88 92
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
89
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
93
+		if ($referer != '') {
94
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
95
+		}
90 96
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
91 97
 		curl_setopt($ch, CURLOPT_FILE, $fp);
92 98
 		curl_exec($ch);
93
-		if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch);
99
+		if (curl_errno($ch) && $globalDebug) {
100
+			echo 'Download error: '.curl_error($ch);
101
+		}
94 102
 		curl_close($ch);
95 103
 		fclose($fp);
96 104
 	}
@@ -101,10 +109,16 @@  discard block
 block discarded – undo
101 109
 	* @return Array array of the tables in HTML page
102 110
 	*/
103 111
 	public function table2array($data) {
104
-		if (!is_string($data)) return array();
105
-		if ($data == '') return array();
112
+		if (!is_string($data)) {
113
+			return array();
114
+		}
115
+		if ($data == '') {
116
+			return array();
117
+		}
106 118
 		$html = str_get_html($data);
107
-		if ($html === false) return array();
119
+		if ($html === false) {
120
+			return array();
121
+		}
108 122
 		$tabledata=array();
109 123
 		foreach($html->find('tr') as $element)
110 124
 		{
@@ -139,7 +153,9 @@  discard block
 block discarded – undo
139 153
 	*/
140 154
 	public function text2array($data) {
141 155
 		$html = str_get_html($data);
142
-		if ($html === false) return array();
156
+		if ($html === false) {
157
+			return array();
158
+		}
143 159
 		$tabledata=array();
144 160
 		foreach($html->find('p') as $element)
145 161
 		{
@@ -160,7 +176,9 @@  discard block
 block discarded – undo
160 176
 	* @return Float Distance in $unit
161 177
 	*/
162 178
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
163
-		if ($lat == $latc && $lon == $lonc) return 0;
179
+		if ($lat == $latc && $lon == $lonc) {
180
+			return 0;
181
+		}
164 182
 		$dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515;
165 183
 		if ($unit == "km") {
166 184
 			return round($dist * 1.609344);
@@ -184,10 +202,16 @@  discard block
 block discarded – undo
184 202
 	public function withinThreshold ($timeDifference, $distance) {
185 203
 		$x = abs($timeDifference);
186 204
 		$d = abs($distance);
187
-		if ($x == 0 || $d == 0) return true;
205
+		if ($x == 0 || $d == 0) {
206
+			return true;
207
+		}
188 208
 		// may be due to Internet jitter; distance is realistic
189
-		if ($x < 0.7 && $d < 2000) return true;
190
-		else return $d/$x < 1500*0.27778; // 1500 km/h max
209
+		if ($x < 0.7 && $d < 2000) {
210
+			return true;
211
+		} else {
212
+			return $d/$x < 1500*0.27778;
213
+		}
214
+		// 1500 km/h max
191 215
 	}
192 216
 
193 217
 
@@ -247,7 +271,9 @@  discard block
 block discarded – undo
247 271
 	public function hex2str($hex) {
248 272
 		$str = '';
249 273
 		$hexln = strlen($hex);
250
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
274
+		for($i=0;$i<$hexln;$i+=2) {
275
+			$str .= chr(hexdec(substr($hex,$i,2)));
276
+		}
251 277
 		return $str;
252 278
 	}
253 279
 	
@@ -275,8 +301,11 @@  discard block
 block discarded – undo
275 301
 		$b = $lat2 - $lat1;
276 302
 		$c = -($a*$lat1+$b*$lon1);
277 303
 		$d = $a*$lat3+$b*$lon3+$c;
278
-		if ($d > -$approx && $d < $approx) return true;
279
-		else return false;
304
+		if ($d > -$approx && $d < $approx) {
305
+			return true;
306
+		} else {
307
+			return false;
308
+		}
280 309
 	}
281 310
 	
282 311
 	public function array_merge_noappend() {
@@ -312,7 +341,9 @@  discard block
 block discarded – undo
312 341
 			return $result;
313 342
 		}
314 343
 		$handle = @opendir('./locale');
315
-		if ($handle === false) return $result;
344
+		if ($handle === false) {
345
+			return $result;
346
+		}
316 347
 		while (false !== ($file = readdir($handle))) {
317 348
 			$path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
318 349
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -379,8 +410,9 @@  discard block
 block discarded – undo
379 410
 		$error = false; 
380 411
 		if ($fp_out = gzopen($dest, $mode)) { 
381 412
 			if ($fp_in = fopen($source,'rb')) { 
382
-				while (!feof($fp_in)) 
383
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
413
+				while (!feof($fp_in)) {
414
+									gzwrite($fp_out, fread($fp_in, 1024 * 512));
415
+				}
384 416
 				fclose($fp_in); 
385 417
 			} else {
386 418
 				$error = true; 
@@ -389,14 +421,17 @@  discard block
 block discarded – undo
389 421
 		} else {
390 422
 			$error = true; 
391 423
 		}
392
-		if ($error)
393
-			return false; 
394
-		else
395
-			return $dest; 
424
+		if ($error) {
425
+					return false;
426
+		} else {
427
+					return $dest;
428
+		}
396 429
 	} 
397 430
 	
398 431
 	public function remove_accents($string) {
399
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
432
+		if ( !preg_match('/[\x80-\xff]/', $string) ) {
433
+			return $string;
434
+		}
400 435
 		$chars = array(
401 436
 		    // Decompositions for Latin-1 Supplement
402 437
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
Please login to merge, or discard this patch.