Completed
Push — master ( 2ae3e5...aafa66 )
by Yannick
29:36
created
aircraft-data.php 1 patch
Braces   +52 added lines, -19 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@  discard block
 block discarded – undo
58 58
 	{
59 59
 		if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
60 60
 			$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
61
-		} else $image = $spotter_item['image_thumbnail'];
61
+		} else {
62
+			$image = $spotter_item['image_thumbnail'];
63
+		}
62 64
 	}
63 65
 	/* else {
64 66
 		$image = "images/placeholder_thumb.png";
@@ -73,8 +75,12 @@  discard block
 block discarded – undo
73 75
 	}
74 76
 	print '<div class="right">';
75 77
 	print '<div class="callsign-details">';
76
-	if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
77
-	if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
78
+	if ($spotter_item['ident'] != 'Not Available') {
79
+		print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
80
+	}
81
+	if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') {
82
+		print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
83
+	}
78 84
 	print '</div>';
79 85
 	if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') {
80 86
 		print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
@@ -106,13 +112,21 @@  discard block
 block discarded – undo
106 112
 	print '</div>';
107 113
 	print '<div id="aircraft">';
108 114
 	print '<span>'._("Aircraft").'</span>';
109
-	if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
115
+	if (isset($spotter_item['aircraft_wiki'])) {
116
+		print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
117
+	}
110 118
 	if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') {
111 119
 		$aircraft_names = explode('/',$spotter_item['aircraft_name']);
112
-		if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
113
-		else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>';
114
-	} elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
115
-	else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
120
+		if (count($aircraft_names) == 1) {
121
+			print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
122
+		} else {
123
+			print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>';
124
+		}
125
+	} elseif (isset($spotter_item['aircraft_type'])) {
126
+		print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
127
+	} else {
128
+		print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
129
+	}
116 130
 	
117 131
 	print '</div>';
118 132
 	print '<div id ="altitude"><span>'._("Altitude").'</span>';
@@ -125,11 +139,17 @@  discard block
 block discarded – undo
125 139
 	}
126 140
 
127 141
 	if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
128
-		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
129
-		else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
142
+		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
143
+			print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
144
+		} else {
145
+			print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
146
+		}
130 147
 	} else {
131
-		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
132
-		else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
148
+		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
149
+			print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
150
+		} else {
151
+			print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
152
+		}
133 153
 	}
134 154
 
135 155
 	if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) {
@@ -143,7 +163,9 @@  discard block
 block discarded – undo
143 163
 		print '</i>';
144 164
 	}
145 165
 	print '</div>';
146
-	if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
166
+	if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') {
167
+		print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
168
+	}
147 169
 	print '<div id="speed"><span>'._("Speed").'</span>';
148 170
 	if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
149 171
 		print round($spotter_item['ground_speed']*1.15078).' mph';
@@ -185,8 +207,11 @@  discard block
 block discarded – undo
185 207
 	}
186 208
 	if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') {
187 209
 		print '<div id="pilot"><span>'._("Pilot").'</span>';
188
-		if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
189
-		else print $spotter_item['pilot_name'];
210
+		if (isset($spotter_item['pilot_id'])) {
211
+			print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
212
+		} else {
213
+			print $spotter_item['pilot_name'];
214
+		}
190 215
 		print '</div>';
191 216
 	}
192 217
 	if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') {
@@ -212,10 +237,18 @@  discard block
 block discarded – undo
212 237
 	}
213 238
 	print '</div>';
214 239
 	print '</div>';
215
-	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
216
-	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
217
-	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
218
-	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
240
+	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') {
241
+		print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
242
+	}
243
+	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') {
244
+		print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
245
+	}
246
+	if (isset($spotter_item['acars']['message'])) {
247
+		print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
248
+	}
249
+	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) {
250
+		print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
251
+	}
219 252
 	print '</div>';
220 253
 }
221 254
 ?>
Please login to merge, or discard this patch.
require/class.Common.php 1 patch
Braces   +110 added lines, -48 removed lines patch added patch discarded remove patch
@@ -37,8 +37,11 @@  discard block
 block discarded – undo
37 37
 		} else {
38 38
 			curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
39 39
 		}
40
-		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
41
-		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
40
+		if ($timeout == '') {
41
+			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
42
+		} else {
43
+			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
44
+		}
42 45
 		curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
43 46
 		if ($type == 'post') {
44 47
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@@ -51,7 +54,9 @@  discard block
 block discarded – undo
51 54
 			} else {
52 55
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
53 56
 			}
54
-		} elseif ($type != 'get' && $type != '') curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
57
+		} elseif ($type != 'get' && $type != '') {
58
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
59
+		}
55 60
 		if ($headers != '') {
56 61
 			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
57 62
 		}
@@ -95,8 +100,9 @@  discard block
 block discarded – undo
95 100
 	private function curlResponseHeaderCallback($ch, $headerLine) {
96 101
 		//global $cookies;
97 102
 		$cookies = array();
98
-		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1)
99
-			$cookies[] = $cookie;
103
+		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) {
104
+					$cookies[] = $cookie;
105
+		}
100 106
 		return strlen($headerLine); // Needed by curl
101 107
 	}
102 108
 
@@ -107,7 +113,9 @@  discard block
 block discarded – undo
107 113
 		curl_setopt($ch, CURLOPT_URL, $url);
108 114
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
109 115
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
110
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
116
+		if ($referer != '') {
117
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
118
+		}
111 119
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
112 120
 			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
113 121
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
@@ -119,7 +127,9 @@  discard block
 block discarded – undo
119 127
 		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');
120 128
 		curl_setopt($ch, CURLOPT_FILE, $fp);
121 129
 		curl_exec($ch);
122
-		if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch);
130
+		if (curl_errno($ch) && $globalDebug) {
131
+			echo 'Download error: '.curl_error($ch);
132
+		}
123 133
 		curl_close($ch);
124 134
 		fclose($fp);
125 135
 	}
@@ -127,12 +137,16 @@  discard block
 block discarded – undo
127 137
 	public static function gunzip($in_file,$out_file_name = '') {
128 138
 		//echo $in_file.' -> '.$out_file_name."\n";
129 139
 		$buffer_size = 4096; // read 4kb at a time
130
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
140
+		if ($out_file_name == '') {
141
+			$out_file_name = str_replace('.gz', '', $in_file);
142
+		}
131 143
 		if ($in_file != '' && file_exists($in_file)) {
132 144
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
133
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
134
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
135
-			else {
145
+			if (function_exists('gzopen')) {
146
+				$file = gzopen($in_file,'rb');
147
+			} elseif (function_exists('gzopen64')) {
148
+				$file = gzopen64($in_file,'rb');
149
+			} else {
136 150
 				echo 'gzopen not available';
137 151
 				die;
138 152
 			}
@@ -148,11 +162,14 @@  discard block
 block discarded – undo
148 162
 	public static function bunzip2($in_file,$out_file_name = '') {
149 163
 		//echo $in_file.' -> '.$out_file_name."\n";
150 164
 		$buffer_size = 4096; // read 4kb at a time
151
-		if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); 
165
+		if ($out_file_name == '') {
166
+			$out_file_name = str_replace('.bz2', '', $in_file);
167
+		}
152 168
 		if ($in_file != '' && file_exists($in_file)) {
153 169
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
154
-			if (function_exists('bzopen')) $file = bzopen($in_file,'rb');
155
-			else {
170
+			if (function_exists('bzopen')) {
171
+				$file = bzopen($in_file,'rb');
172
+			} else {
156 173
 				echo 'bzopen not available';
157 174
 				die;
158 175
 			}
@@ -171,10 +188,16 @@  discard block
 block discarded – undo
171 188
 	* @return Array array of the tables in HTML page
172 189
 	*/
173 190
 	public function table2array($data) {
174
-		if (!is_string($data)) return array();
175
-		if ($data == '') return array();
191
+		if (!is_string($data)) {
192
+			return array();
193
+		}
194
+		if ($data == '') {
195
+			return array();
196
+		}
176 197
 		$html = str_get_html($data);
177
-		if ($html === false) return array();
198
+		if ($html === false) {
199
+			return array();
200
+		}
178 201
 		$tabledata=array();
179 202
 		foreach($html->find('tr') as $element)
180 203
 		{
@@ -209,7 +232,9 @@  discard block
 block discarded – undo
209 232
 	*/
210 233
 	public function text2array($data) {
211 234
 		$html = str_get_html($data);
212
-		if ($html === false) return array();
235
+		if ($html === false) {
236
+			return array();
237
+		}
213 238
 		$tabledata=array();
214 239
 		foreach($html->find('p') as $element)
215 240
 		{
@@ -230,7 +255,9 @@  discard block
 block discarded – undo
230 255
 	* @return Float Distance in $unit
231 256
 	*/
232 257
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
233
-		if ($lat == $latc && $lon == $lonc) return 0;
258
+		if ($lat == $latc && $lon == $lonc) {
259
+			return 0;
260
+		}
234 261
 		$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;
235 262
 		if ($unit == "km") {
236 263
 			return round($dist * 1.609344);
@@ -276,7 +303,9 @@  discard block
 block discarded – undo
276 303
 		$dX = $latc - $lat;
277 304
 		$dY = $lonc - $lon;
278 305
 		$azimuth = rad2deg(atan2($dY,$dX));
279
-		if ($azimuth < 0) return $azimuth+360;
306
+		if ($azimuth < 0) {
307
+			return $azimuth+360;
308
+		}
280 309
 		return $azimuth;
281 310
 	}
282 311
 	
@@ -290,10 +319,16 @@  discard block
 block discarded – undo
290 319
 	public function withinThreshold ($timeDifference, $distance) {
291 320
 		$x = abs($timeDifference);
292 321
 		$d = abs($distance);
293
-		if ($x == 0 || $d == 0) return true;
322
+		if ($x == 0 || $d == 0) {
323
+			return true;
324
+		}
294 325
 		// may be due to Internet jitter; distance is realistic
295
-		if ($x < 0.7 && $d < 2000) return true;
296
-		else return $d/$x < 1500*0.27778; // 1500 km/h max
326
+		if ($x < 0.7 && $d < 2000) {
327
+			return true;
328
+		} else {
329
+			return $d/$x < 1500*0.27778;
330
+		}
331
+		// 1500 km/h max
297 332
 	}
298 333
 
299 334
 
@@ -322,11 +357,17 @@  discard block
 block discarded – undo
322 357
 	
323 358
 	public function convertDM($coord,$latlong) {
324 359
 		if ($latlong == 'latitude') {
325
-			if ($coord < 0) $NSEW = 'S';
326
-			else $NSEW = 'N';
360
+			if ($coord < 0) {
361
+				$NSEW = 'S';
362
+			} else {
363
+				$NSEW = 'N';
364
+			}
327 365
 		} else {
328
-			if ($coord < 0) $NSEW = 'W';
329
-			else $NSEW = 'E';
366
+			if ($coord < 0) {
367
+				$NSEW = 'W';
368
+			} else {
369
+				$NSEW = 'E';
370
+			}
330 371
 		}
331 372
 		$coord = abs($coord);
332 373
 		$deg = floor($coord);
@@ -369,7 +410,9 @@  discard block
 block discarded – undo
369 410
 	public function hex2str($hex) {
370 411
 		$str = '';
371 412
 		$hexln = strlen($hex);
372
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
413
+		for($i=0;$i<$hexln;$i+=2) {
414
+			$str .= chr(hexdec(substr($hex,$i,2)));
415
+		}
373 416
 		return $str;
374 417
 	}
375 418
 	
@@ -406,8 +449,11 @@  discard block
 block discarded – undo
406 449
 		$b = $lat2 - $lat1;
407 450
 		$c = -($a*$lat1+$b*$lon1);
408 451
 		$d = $a*$lat3+$b*$lon3+$c;
409
-		if ($d > -$approx && $d < $approx) return true;
410
-		else return false;
452
+		if ($d > -$approx && $d < $approx) {
453
+			return true;
454
+		} else {
455
+			return false;
456
+		}
411 457
 	}
412 458
 	
413 459
 	public function array_merge_noappend() {
@@ -466,7 +512,9 @@  discard block
 block discarded – undo
466 512
 			return $result;
467 513
 		}
468 514
 		$handle = @opendir('./locale');
469
-		if ($handle === false) return $result;
515
+		if ($handle === false) {
516
+			return $result;
517
+		}
470 518
 		while (false !== ($file = readdir($handle))) {
471 519
 			$path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
472 520
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -537,8 +585,9 @@  discard block
 block discarded – undo
537 585
 		$error = false; 
538 586
 		if ($fp_out = gzopen($dest, $mode)) { 
539 587
 			if ($fp_in = fopen($source,'rb')) { 
540
-				while (!feof($fp_in)) 
541
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
588
+				while (!feof($fp_in)) {
589
+									gzwrite($fp_out, fread($fp_in, 1024 * 512));
590
+				}
542 591
 				fclose($fp_in); 
543 592
 			} else {
544 593
 				$error = true; 
@@ -547,14 +596,17 @@  discard block
 block discarded – undo
547 596
 		} else {
548 597
 			$error = true; 
549 598
 		}
550
-		if ($error)
551
-			return false; 
552
-		else
553
-			return $dest; 
599
+		if ($error) {
600
+					return false;
601
+		} else {
602
+					return $dest;
603
+		}
554 604
 	} 
555 605
 	
556 606
 	public function remove_accents($string) {
557
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
607
+		if ( !preg_match('/[\x80-\xff]/', $string) ) {
608
+			return $string;
609
+		}
558 610
 		$chars = array(
559 611
 		    // Decompositions for Latin-1 Supplement
560 612
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -678,7 +730,9 @@  discard block
 block discarded – undo
678 730
 		$ip = gethostbyname($host);
679 731
 		$s = socket_create(AF_INET, SOCK_STREAM, 0);
680 732
 		$r = @socket_connect($s, $ip, $port);
681
-		if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
733
+		if (!socket_set_nonblock($s)) {
734
+			echo "Unable to set nonblock on socket\n";
735
+		}
682 736
 		if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
683 737
 			return $s;
684 738
 		}
@@ -723,18 +777,22 @@  discard block
 block discarded – undo
723 777
 		//NOTE: use a trailing slash for folders!!!
724 778
 		//see http://bugs.php.net/bug.php?id=27609
725 779
 		//see http://bugs.php.net/bug.php?id=30931
726
-		if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
780
+		if ($path{strlen($path)-1}=='/') {
781
+			// recursively return a temporary file path
727 782
 			return $this->is__writable($path.uniqid(mt_rand()).'.tmp');
728
-		else if (is_dir($path))
729
-			return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
783
+		} else if (is_dir($path)) {
784
+					return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
785
+		}
730 786
 		// check tmp file for read/write capabilities
731 787
 		$rm = file_exists($path);
732 788
 		$f = @fopen($path, 'a');
733
-		if ($f===false)
734
-			return false;
789
+		if ($f===false) {
790
+					return false;
791
+		}
735 792
 		fclose($f);
736
-		if (!$rm)
737
-			unlink($path);
793
+		if (!$rm) {
794
+					unlink($path);
795
+		}
738 796
 		return true;
739 797
 	}
740 798
 	
@@ -750,7 +808,9 @@  discard block
 block discarded – undo
750 808
 	 * @return Array Coordinate of the route
751 809
 	*/
752 810
 	public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) {
753
-		if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
811
+		if ($nbpts <= 2) {
812
+			return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
813
+		}
754 814
 		$sx = deg2rad($begin_lon);
755 815
 		$sy = deg2rad($begin_lat);
756 816
 		$ex = deg2rad($end_lon);
@@ -759,7 +819,9 @@  discard block
 block discarded – undo
759 819
 		$h = $sy - $ey;
760 820
 		$z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2);
761 821
 		$g = 2.0*asin(sqrt($z));
762
-		if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
822
+		if ($g == M_PI || is_nan($g)) {
823
+			return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
824
+		}
763 825
 		$first_pass = array();
764 826
 		$delta = 1.0/($nbpts-1);
765 827
 		for ($i =0; $i < $nbpts; ++$i) {
Please login to merge, or discard this patch.