@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * @param Array $headers header to submit with the form |
15 | 15 | * @return String the result |
16 | 16 | */ |
17 | - public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') { |
|
17 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') { |
|
18 | 18 | global $globalProxy, $globalForceIPv4; |
19 | 19 | $ch = curl_init(); |
20 | 20 | curl_setopt($ch, CURLOPT_URL, $url); |
21 | 21 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
22 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
22 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
23 | 23 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
24 | 24 | } |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
30 | 30 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
31 | 31 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
32 | - curl_setopt($ch,CURLOPT_ENCODING , "gzip"); |
|
32 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
33 | 33 | //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'); |
34 | 34 | // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0'); |
35 | 35 | if ($useragent == '') { |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | } |
40 | 40 | if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
41 | 41 | else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
42 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
|
42 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback")); |
|
43 | 43 | if ($type == 'post') { |
44 | 44 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
45 | 45 | if (is_array($data)) { |
46 | 46 | curl_setopt($ch, CURLOPT_POST, count($data)); |
47 | 47 | $data_string = ''; |
48 | - foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
48 | + foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
49 | 49 | rtrim($data_string, '&'); |
50 | 50 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
51 | 51 | } else { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | if ($cookie != '') { |
59 | 59 | if (is_array($cookie)) { |
60 | - curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';')); |
|
60 | + curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';')); |
|
61 | 61 | } else { |
62 | 62 | curl_setopt($ch, CURLOPT_COOKIE, $cookie); |
63 | 63 | } |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | $info = curl_getinfo($ch); |
70 | 70 | //var_dump($info); |
71 | 71 | curl_close($ch); |
72 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
72 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
73 | 73 | echo "Cloudflare Detected\n"; |
74 | 74 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
75 | 75 | $useragent = UAgent::random(); |
76 | 76 | cloudflare::useUserAgent($useragent); |
77 | 77 | if ($clearanceCookie = cloudflare::bypass($url)) { |
78 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
78 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
79 | 79 | } |
80 | 80 | } else { |
81 | 81 | return $result; |
@@ -106,20 +106,20 @@ discard block |
||
106 | 106 | fclose($fp); |
107 | 107 | } |
108 | 108 | |
109 | - public static function gunzip($in_file,$out_file_name = '') { |
|
109 | + public static function gunzip($in_file, $out_file_name = '') { |
|
110 | 110 | //echo $in_file.' -> '.$out_file_name."\n"; |
111 | 111 | $buffer_size = 4096; // read 4kb at a time |
112 | 112 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
113 | 113 | if ($in_file != '' && file_exists($in_file)) { |
114 | 114 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
115 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
116 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
115 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
116 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
117 | 117 | else { |
118 | 118 | echo 'gzopen not available'; |
119 | 119 | die; |
120 | 120 | } |
121 | 121 | $out_file = fopen($out_file_name, 'wb'); |
122 | - while(!gzeof($file)) { |
|
122 | + while (!gzeof($file)) { |
|
123 | 123 | fwrite($out_file, gzread($file, $buffer_size)); |
124 | 124 | } |
125 | 125 | fclose($out_file); |
@@ -127,19 +127,19 @@ discard block |
||
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - public static function bunzip2($in_file,$out_file_name = '') { |
|
130 | + public static function bunzip2($in_file, $out_file_name = '') { |
|
131 | 131 | //echo $in_file.' -> '.$out_file_name."\n"; |
132 | 132 | $buffer_size = 4096; // read 4kb at a time |
133 | 133 | if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
134 | 134 | if ($in_file != '' && file_exists($in_file)) { |
135 | 135 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
136 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
136 | + if (function_exists('bzopen')) $file = bzopen($in_file, 'rb'); |
|
137 | 137 | else { |
138 | 138 | echo 'bzopen not available'; |
139 | 139 | die; |
140 | 140 | } |
141 | 141 | $out_file = fopen($out_file_name, 'wb'); |
142 | - while(!feof($file)) { |
|
142 | + while (!feof($file)) { |
|
143 | 143 | fwrite($out_file, bzread($file, $buffer_size)); |
144 | 144 | } |
145 | 145 | fclose($out_file); |
@@ -157,27 +157,27 @@ discard block |
||
157 | 157 | if ($data == '') return array(); |
158 | 158 | $html = str_get_html($data); |
159 | 159 | if ($html === false) return array(); |
160 | - $tabledata=array(); |
|
161 | - foreach($html->find('tr') as $element) |
|
160 | + $tabledata = array(); |
|
161 | + foreach ($html->find('tr') as $element) |
|
162 | 162 | { |
163 | 163 | $td = array(); |
164 | - foreach( $element->find('th') as $row) |
|
164 | + foreach ($element->find('th') as $row) |
|
165 | 165 | { |
166 | 166 | $td [] = trim($row->plaintext); |
167 | 167 | } |
168 | - $td=array_filter($td); |
|
168 | + $td = array_filter($td); |
|
169 | 169 | $tabledata[] = $td; |
170 | 170 | |
171 | 171 | $td = array(); |
172 | 172 | $tdi = array(); |
173 | - foreach( $element->find('td') as $row) |
|
173 | + foreach ($element->find('td') as $row) |
|
174 | 174 | { |
175 | 175 | $td [] = trim($row->plaintext); |
176 | 176 | $tdi [] = trim($row->innertext); |
177 | 177 | } |
178 | - $td=array_filter($td); |
|
179 | - $tdi=array_filter($tdi); |
|
180 | - $tabledata[]=array_merge($td,$tdi); |
|
178 | + $td = array_filter($td); |
|
179 | + $tdi = array_filter($tdi); |
|
180 | + $tabledata[] = array_merge($td, $tdi); |
|
181 | 181 | } |
182 | 182 | $html->clear(); |
183 | 183 | unset($html); |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | public function text2array($data) { |
193 | 193 | $html = str_get_html($data); |
194 | 194 | if ($html === false) return array(); |
195 | - $tabledata=array(); |
|
196 | - foreach($html->find('p') as $element) |
|
195 | + $tabledata = array(); |
|
196 | + foreach ($html->find('p') as $element) |
|
197 | 197 | { |
198 | 198 | $tabledata [] = trim($element->plaintext); |
199 | 199 | } |
@@ -213,11 +213,11 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
215 | 215 | if ($lat == $latc && $lon == $lonc) return 0; |
216 | - $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; |
|
216 | + $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; |
|
217 | 217 | if ($unit == "km") { |
218 | - return round($dist * 1.609344); |
|
218 | + return round($dist*1.609344); |
|
219 | 219 | } elseif ($unit == "m") { |
220 | - return round($dist * 1.609344 * 1000); |
|
220 | + return round($dist*1.609344*1000); |
|
221 | 221 | } elseif ($unit == "mile" || $unit == "mi") { |
222 | 222 | return round($dist); |
223 | 223 | } elseif ($unit == "nm") { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | * @param float $distance distance covered |
234 | 234 | * @return whether distance is realistic |
235 | 235 | */ |
236 | - public function withinThreshold ($timeDifference, $distance) { |
|
236 | + public function withinThreshold($timeDifference, $distance) { |
|
237 | 237 | $x = abs($timeDifference); |
238 | 238 | $d = abs($distance); |
239 | 239 | if ($x == 0 || $d == 0) return true; |
@@ -249,12 +249,12 @@ discard block |
||
249 | 249 | return ($array !== array_values($array)); |
250 | 250 | } |
251 | 251 | |
252 | - public function isInteger($input){ |
|
252 | + public function isInteger($input) { |
|
253 | 253 | return(ctype_digit(strval($input))); |
254 | 254 | } |
255 | 255 | |
256 | 256 | |
257 | - public function convertDec($dms,$latlong) { |
|
257 | + public function convertDec($dms, $latlong) { |
|
258 | 258 | if ($latlong == 'latitude') { |
259 | 259 | $deg = substr($dms, 0, 2); |
260 | 260 | $min = substr($dms, 2, 4); |
@@ -262,10 +262,10 @@ discard block |
||
262 | 262 | $deg = substr($dms, 0, 3); |
263 | 263 | $min = substr($dms, 3, 5); |
264 | 264 | } |
265 | - return $deg+(($min*60)/3600); |
|
265 | + return $deg + (($min*60)/3600); |
|
266 | 266 | } |
267 | 267 | |
268 | - public function convertDM($coord,$latlong) { |
|
268 | + public function convertDM($coord, $latlong) { |
|
269 | 269 | if ($latlong == 'latitude') { |
270 | 270 | if ($coord < 0) $NSEW = 'S'; |
271 | 271 | else $NSEW = 'N'; |
@@ -275,9 +275,9 @@ discard block |
||
275 | 275 | } |
276 | 276 | $coord = abs($coord); |
277 | 277 | $deg = floor($coord); |
278 | - $coord = ($coord-$deg)*60; |
|
278 | + $coord = ($coord - $deg)*60; |
|
279 | 279 | $min = $coord; |
280 | - return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW); |
|
280 | + return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -289,8 +289,8 @@ discard block |
||
289 | 289 | public function xcopy($source, $dest) |
290 | 290 | { |
291 | 291 | $files = glob($source.'*.*'); |
292 | - foreach($files as $file){ |
|
293 | - $file_to_go = str_replace($source,$dest,$file); |
|
292 | + foreach ($files as $file) { |
|
293 | + $file_to_go = str_replace($source, $dest, $file); |
|
294 | 294 | copy($file, $file_to_go); |
295 | 295 | } |
296 | 296 | return true; |
@@ -301,9 +301,9 @@ discard block |
||
301 | 301 | * @param String $url url to check |
302 | 302 | * @return bool Return true on succes false on failure |
303 | 303 | */ |
304 | - public function urlexist($url){ |
|
305 | - $headers=get_headers($url); |
|
306 | - return stripos($headers[0],"200 OK")?true:false; |
|
304 | + public function urlexist($url) { |
|
305 | + $headers = get_headers($url); |
|
306 | + return stripos($headers[0], "200 OK") ? true : false; |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | /** |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | public function hex2str($hex) { |
315 | 315 | $str = ''; |
316 | 316 | $hexln = strlen($hex); |
317 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
317 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
318 | 318 | return $str; |
319 | 319 | } |
320 | 320 | |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | * @return String Return result |
325 | 325 | */ |
326 | 326 | public function hex2rgb($hex) { |
327 | - $hex = str_replace('#','',$hex); |
|
327 | + $hex = str_replace('#', '', $hex); |
|
328 | 328 | return sscanf($hex, "%02x%02x%02x"); |
329 | 329 | } |
330 | 330 | |
@@ -332,33 +332,33 @@ discard block |
||
332 | 332 | //difference in longitudinal coordinates |
333 | 333 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
334 | 334 | //difference in the phi of latitudinal coordinates |
335 | - $dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4)); |
|
335 | + $dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4)); |
|
336 | 336 | //we need to recalculate $dLon if it is greater than pi |
337 | - if(abs($dLon) > pi()) { |
|
338 | - if($dLon > 0) { |
|
339 | - $dLon = (2 * pi() - $dLon) * -1; |
|
337 | + if (abs($dLon) > pi()) { |
|
338 | + if ($dLon > 0) { |
|
339 | + $dLon = (2*pi() - $dLon)*-1; |
|
340 | 340 | } else { |
341 | - $dLon = 2 * pi() + $dLon; |
|
341 | + $dLon = 2*pi() + $dLon; |
|
342 | 342 | } |
343 | 343 | } |
344 | 344 | //return the angle, normalized |
345 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
345 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
346 | 346 | } |
347 | 347 | |
348 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.2) { |
|
348 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.2) { |
|
349 | 349 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
350 | - $a = -($lon2-$lon1); |
|
350 | + $a = -($lon2 - $lon1); |
|
351 | 351 | $b = $lat2 - $lat1; |
352 | - $c = -($a*$lat1+$b*$lon1); |
|
353 | - $d = $a*$lat3+$b*$lon3+$c; |
|
352 | + $c = -($a*$lat1 + $b*$lon1); |
|
353 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
354 | 354 | if ($d > -$approx && $d < $approx) return true; |
355 | 355 | else return false; |
356 | 356 | } |
357 | 357 | |
358 | 358 | public function array_merge_noappend() { |
359 | 359 | $output = array(); |
360 | - foreach(func_get_args() as $array) { |
|
361 | - foreach($array as $key => $value) { |
|
360 | + foreach (func_get_args() as $array) { |
|
361 | + foreach ($array as $key => $value) { |
|
362 | 362 | $output[$key] = isset($output[$key]) ? |
363 | 363 | array_merge($output[$key], $value) : $value; |
364 | 364 | } |
@@ -422,34 +422,34 @@ discard block |
||
422 | 422 | return $result; |
423 | 423 | } |
424 | 424 | |
425 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){ |
|
425 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) { |
|
426 | 426 | global $globalMapRefresh; |
427 | 427 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
428 | 428 | $r = 6378; |
429 | 429 | $latitude = deg2rad($latitude); |
430 | 430 | $longitude = deg2rad($longitude); |
431 | 431 | $bearing = deg2rad($heading); |
432 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
433 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
434 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
432 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
433 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
434 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
435 | 435 | } |
436 | 436 | |
437 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
437 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
438 | 438 | // distance in meter |
439 | 439 | $R = 6378.14; |
440 | - $latitude1 = $latitude * (M_PI/180); |
|
441 | - $longitude1 = $longitude * (M_PI/180); |
|
442 | - $brng = $bearing * (M_PI/180); |
|
440 | + $latitude1 = $latitude*(M_PI/180); |
|
441 | + $longitude1 = $longitude*(M_PI/180); |
|
442 | + $brng = $bearing*(M_PI/180); |
|
443 | 443 | $d = $distance; |
444 | 444 | |
445 | 445 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
446 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
446 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
447 | 447 | |
448 | - $latitude2 = $latitude2 * (180/M_PI); |
|
449 | - $longitude2 = $longitude2 * (180/M_PI); |
|
448 | + $latitude2 = $latitude2*(180/M_PI); |
|
449 | + $longitude2 = $longitude2*(180/M_PI); |
|
450 | 450 | |
451 | - $flat = round ($latitude2,6); |
|
452 | - $flong = round ($longitude2,6); |
|
451 | + $flat = round($latitude2, 6); |
|
452 | + $flong = round($longitude2, 6); |
|
453 | 453 | /* |
454 | 454 | $dx = $distance*cos($bearing); |
455 | 455 | $dy = $distance*sin($bearing); |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | $flong = $longitude + $dlong; |
459 | 459 | $flat = $latitude + $dlat; |
460 | 460 | */ |
461 | - return array('latitude' => $flat,'longitude' => $flong); |
|
461 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -472,14 +472,14 @@ discard block |
||
472 | 472 | * @param integer $level GZIP compression level (default: 9) |
473 | 473 | * @return string New filename (with .gz appended) if success, or false if operation fails |
474 | 474 | */ |
475 | - public function gzCompressFile($source, $level = 9){ |
|
476 | - $dest = $source . '.gz'; |
|
477 | - $mode = 'wb' . $level; |
|
475 | + public function gzCompressFile($source, $level = 9) { |
|
476 | + $dest = $source.'.gz'; |
|
477 | + $mode = 'wb'.$level; |
|
478 | 478 | $error = false; |
479 | 479 | if ($fp_out = gzopen($dest, $mode)) { |
480 | - if ($fp_in = fopen($source,'rb')) { |
|
480 | + if ($fp_in = fopen($source, 'rb')) { |
|
481 | 481 | while (!feof($fp_in)) |
482 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
482 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
483 | 483 | fclose($fp_in); |
484 | 484 | } else { |
485 | 485 | $error = true; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | } |
496 | 496 | |
497 | 497 | public function remove_accents($string) { |
498 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
498 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
499 | 499 | $chars = array( |
500 | 500 | // Decompositions for Latin-1 Supplement |
501 | 501 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
553 | 553 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
554 | 554 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
555 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
555 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
556 | 556 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
557 | 557 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
558 | 558 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -568,13 +568,13 @@ discard block |
||
568 | 568 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
569 | 569 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
570 | 570 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
571 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
572 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
573 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
574 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
575 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
576 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
577 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
571 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
572 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
573 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
574 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
575 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
576 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
577 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
578 | 578 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
579 | 579 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
580 | 580 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) { |
609 | 609 | if (is_numeric($string[$i]) && $concat_flag) { |
610 | 610 | $int .= $string[$i]; |
611 | - } elseif(!$concat && $concat_flag && strlen($int) > 0) { |
|
611 | + } elseif (!$concat && $concat_flag && strlen($int) > 0) { |
|
612 | 612 | $concat_flag = false; |
613 | 613 | } |
614 | 614 | } |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | $slice = array_slice($arr, $offset + 1, $length); |
655 | 655 | return implode("", $slice); |
656 | 656 | } else { |
657 | - return mb_substr($string,$offset,$length,'UTF-8'); |
|
657 | + return mb_substr($string, $offset, $length, 'UTF-8'); |
|
658 | 658 | } |
659 | 659 | } |
660 | 660 | } |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | |
8 | 8 | if (isset($_POST['pilot'])) |
9 | 9 | { |
10 | - header('Location: '.$globalURL.'/pilot/'.filter_input(INPUT_POST,'pilot',FILTER_SANITIZE_STRING)); |
|
10 | + header('Location: '.$globalURL.'/pilot/'.filter_input(INPUT_POST, 'pilot', FILTER_SANITIZE_STRING)); |
|
11 | 11 | //} else if (isset($_GET['airport'])){ |
12 | 12 | } else { |
13 | - $Spotter= new Spotter(); |
|
13 | + $Spotter = new Spotter(); |
|
14 | 14 | $Stats = new Stats(); |
15 | 15 | $Common = new Common(); |
16 | 16 | $title = _("Pilots"); |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | //ksort($pilot_names); |
25 | 25 | $previous = null; |
26 | 26 | print '<div class="alphabet-legend">'; |
27 | - foreach($pilot_names as $value) { |
|
27 | + foreach ($pilot_names as $value) { |
|
28 | 28 | $firstLetter = strtoupper($Common->replace_mb_substr($value['pilot_name'], 0, 1)); |
29 | - if($previous !== $firstLetter && $firstLetter != "'") |
|
29 | + if ($previous !== $firstLetter && $firstLetter != "'") |
|
30 | 30 | { |
31 | - if ($previous !== null){ |
|
31 | + if ($previous !== null) { |
|
32 | 32 | print ' | '; |
33 | 33 | } |
34 | 34 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | } |
38 | 38 | print '</div>'; |
39 | 39 | $previous = null; |
40 | - foreach($pilot_names as $value) { |
|
40 | + foreach ($pilot_names as $value) { |
|
41 | 41 | $firstLetter = strtoupper($Common->replace_mb_substr($value['pilot_name'], 0, 1)); |
42 | 42 | if ($firstLetter != "") |
43 | 43 | { |
44 | - if($previous !== $firstLetter && $firstLetter != "'") |
|
44 | + if ($previous !== $firstLetter && $firstLetter != "'") |
|
45 | 45 | { |
46 | - if ($previous !== null){ |
|
46 | + if ($previous !== null) { |
|
47 | 47 | print '</div>'; |
48 | 48 | } |
49 | 49 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -8,15 +8,15 @@ discard block |
||
8 | 8 | if (isset($_POST['airport'])) |
9 | 9 | { |
10 | 10 | header('Location: '.$globalURL.'/airport/'.$_POST['airport']); |
11 | -} else if (isset($_GET['airport'])){ |
|
11 | +} else if (isset($_GET['airport'])) { |
|
12 | 12 | $Spotter = new Spotter(); |
13 | 13 | //calculuation for the pagination |
14 | - if($_GET['limit'] == "") |
|
14 | + if ($_GET['limit'] == "") |
|
15 | 15 | { |
16 | 16 | $limit_start = 0; |
17 | 17 | $limit_end = 25; |
18 | 18 | $absolute_difference = 25; |
19 | - } else { |
|
19 | + } else { |
|
20 | 20 | $limit_explode = explode(",", $_GET['limit']); |
21 | 21 | $limit_start = $limit_explode[0]; |
22 | 22 | $limit_end = $limit_explode[1]; |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | $limit_previous_1 = $limit_start - $absolute_difference; |
31 | 31 | $limit_previous_2 = $limit_end - $absolute_difference; |
32 | 32 | |
33 | - $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
34 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
33 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
34 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
35 | 35 | $page_url = $globalURL.'/airport/'.$airport; |
36 | - $spotter_array = $Spotter->getSpotterDataByAirport($airport,$limit_start.",".$absolute_difference, $sort); |
|
36 | + $spotter_array = $Spotter->getSpotterDataByAirport($airport, $limit_start.",".$absolute_difference, $sort); |
|
37 | 37 | $airport_array = $Spotter->getAllAirportInfo($airport); |
38 | 38 | |
39 | 39 | if (!empty($airport_array)) |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | $airport_names = $Spotter->getAllAirportNames(); |
53 | 53 | } |
54 | 54 | ksort($airport_names); |
55 | - foreach($airport_names as $airport_name) |
|
55 | + foreach ($airport_names as $airport_name) |
|
56 | 56 | { |
57 | - if($airport == $airport_name['airport_icao']) |
|
57 | + if ($airport == $airport_name['airport_icao']) |
|
58 | 58 | { |
59 | 59 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
60 | 60 | } else { |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | print '<div class="table column">'; |
88 | 88 | if ($airport_array[0]['iata'] != "NA") |
89 | 89 | { |
90 | - print '<p>'.sprintf(_("The table below shows the route(s) aircrafts have used to/from <strong>%s</strong>, sorted by the most recent one."),$airport_array[0]['name']).'</p>'; |
|
90 | + print '<p>'.sprintf(_("The table below shows the route(s) aircrafts have used to/from <strong>%s</strong>, sorted by the most recent one."), $airport_array[0]['name']).'</p>'; |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | include('table-output.php'); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | print '<p>'._("Sorry, the airport does not exist in this database. :(").'</p>'; |
110 | 110 | } |
111 | 111 | } else { |
112 | - $Spotter= new Spotter(); |
|
112 | + $Spotter = new Spotter(); |
|
113 | 113 | $Stats = new Stats(); |
114 | 114 | $Common = new Common(); |
115 | 115 | $title = _("Airports"); |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | ksort($airport_names); |
124 | 124 | $previous = null; |
125 | 125 | print '<div class="alphabet-legend">'; |
126 | - foreach($airport_names as $value) { |
|
126 | + foreach ($airport_names as $value) { |
|
127 | 127 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airport_city'], 0, 1)); |
128 | - if($previous !== $firstLetter) |
|
128 | + if ($previous !== $firstLetter) |
|
129 | 129 | { |
130 | - if ($previous !== null){ |
|
130 | + if ($previous !== null) { |
|
131 | 131 | print ' | '; |
132 | 132 | } |
133 | 133 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | } |
137 | 137 | print '</div>'; |
138 | 138 | $previous = null; |
139 | - foreach($airport_names as $value) { |
|
139 | + foreach ($airport_names as $value) { |
|
140 | 140 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airport_city'], 0, 1)); |
141 | 141 | if ($firstLetter != "") |
142 | 142 | { |
143 | - if($previous !== $firstLetter) |
|
143 | + if ($previous !== $firstLetter) |
|
144 | 144 | { |
145 | - if ($previous !== null){ |
|
145 | + if ($previous !== null) { |
|
146 | 146 | print '</div>'; |
147 | 147 | } |
148 | 148 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | print '<div class="column">'; |
18 | 18 | print '<h1>'._("Airlines").'</h1>'; |
19 | 19 | if (isset($_POST['airline_type'])) { |
20 | - $airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING); |
|
20 | + $airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING); |
|
21 | 21 | //$airline_names = $Spotter->getAllAirlineNames($airline_type); |
22 | 22 | } else { |
23 | 23 | //$airline_names = $Spotter->getAllAirlineNames(); |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | print '<div class="alphabet">'; |
30 | 30 | foreach ($alliances as $alliance) { |
31 | 31 | print '<div class="alphabet-airline alphabet-item">'; |
32 | - print '<a href="'.$globalURL.'/airline/alliance_'.str_replace(' ','_',$alliance['alliance']).'">'; |
|
33 | - if (file_exists('images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png')) |
|
32 | + print '<a href="'.$globalURL.'/airline/alliance_'.str_replace(' ', '_', $alliance['alliance']).'">'; |
|
33 | + if (file_exists('images/airlines/'.str_replace(' ', '_', $alliance['alliance']).'.png')) |
|
34 | 34 | { |
35 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> '; |
|
35 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ', '_', $alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> '; |
|
36 | 36 | } else print $alliance['alliance']; |
37 | 37 | print '</a>'; |
38 | 38 | print '</div>'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $Stats = new Stats(); |
56 | 56 | if (isset($_POST['airline_type'])) |
57 | 57 | { |
58 | - $airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING); |
|
58 | + $airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING); |
|
59 | 59 | //$airline_names = $Stats->getAllAirlineNames($airline_type); |
60 | 60 | $airline_names = $Spotter->getAllAirlineNames($airline_type); |
61 | 61 | } else { |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | } |
69 | 69 | $previous = null; |
70 | 70 | print '<div class="alphabet-legend">'; |
71 | - foreach($airline_names as $value) |
|
71 | + foreach ($airline_names as $value) |
|
72 | 72 | { |
73 | 73 | //echo $value['airline_name']."\n"; |
74 | 74 | //echo mb_substr($value['airline_name'],0,1).' - '.$value['airline_name']."\n"; |
75 | 75 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airline_name'], 0, 1)); |
76 | - if($previous !== $firstLetter) |
|
76 | + if ($previous !== $firstLetter) |
|
77 | 77 | { |
78 | 78 | if ($previous !== null) print ' | '; |
79 | 79 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | } |
83 | 83 | print '</div>'; |
84 | 84 | $previous = null; |
85 | - foreach($airline_names as $value) { |
|
85 | + foreach ($airline_names as $value) { |
|
86 | 86 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airline_name'], 0, 1)); |
87 | 87 | if ($firstLetter != "") |
88 | 88 | { |
89 | - if($previous !== $firstLetter) |
|
89 | + if ($previous !== $firstLetter) |
|
90 | 90 | { |
91 | 91 | if ($previous !== null) print '</div>'; |
92 | 92 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -33,7 +33,9 @@ discard block |
||
33 | 33 | if (file_exists('images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png')) |
34 | 34 | { |
35 | 35 | print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> '; |
36 | - } else print $alliance['alliance']; |
|
36 | + } else { |
|
37 | + print $alliance['alliance']; |
|
38 | + } |
|
37 | 39 | print '</a>'; |
38 | 40 | print '</div>'; |
39 | 41 | } |
@@ -42,13 +44,21 @@ discard block |
||
42 | 44 | } |
43 | 45 | print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">'; |
44 | 46 | print '<option value="all"'; |
45 | - if ($airline_type == 'all') print 'selected="selected" '; |
|
47 | + if ($airline_type == 'all') { |
|
48 | + print 'selected="selected" '; |
|
49 | + } |
|
46 | 50 | print '>'._("All").'</option><option value="passenger"'; |
47 | - if ($airline_type == 'passenger') print 'selected="selected" '; |
|
51 | + if ($airline_type == 'passenger') { |
|
52 | + print 'selected="selected" '; |
|
53 | + } |
|
48 | 54 | print '>'._("Passenger").'</option><option value="cargo"'; |
49 | - if ($airline_type == 'cargo') print 'selected="selected" '; |
|
55 | + if ($airline_type == 'cargo') { |
|
56 | + print 'selected="selected" '; |
|
57 | + } |
|
50 | 58 | print '>'._("Cargo").'</option><option value="military"'; |
51 | - if ($airline_type == 'military') print 'selected="selected" '; |
|
59 | + if ($airline_type == 'military') { |
|
60 | + print 'selected="selected" '; |
|
61 | + } |
|
52 | 62 | print '>'._("Military").'</option></select>'; |
53 | 63 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>'; |
54 | 64 | |
@@ -75,7 +85,9 @@ discard block |
||
75 | 85 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airline_name'], 0, 1)); |
76 | 86 | if($previous !== $firstLetter) |
77 | 87 | { |
78 | - if ($previous !== null) print ' | '; |
|
88 | + if ($previous !== null) { |
|
89 | + print ' | '; |
|
90 | + } |
|
79 | 91 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
80 | 92 | } |
81 | 93 | $previous = $firstLetter; |
@@ -88,7 +100,9 @@ discard block |
||
88 | 100 | { |
89 | 101 | if($previous !== $firstLetter) |
90 | 102 | { |
91 | - if ($previous !== null) print '</div>'; |
|
103 | + if ($previous !== null) { |
|
104 | + print '</div>'; |
|
105 | + } |
|
92 | 106 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
93 | 107 | } |
94 | 108 | $previous = $firstLetter; |
@@ -102,10 +116,14 @@ discard block |
||
102 | 116 | } elseif (file_exists('images/airlines/'.$value['airline_icao'].'.png')) |
103 | 117 | { |
104 | 118 | print '<img src="'.$globalURL.'/images/airlines/'.$value['airline_icao'].'.png" alt="'._("Click to see airline activity").'" title="'._("Click to see airline activity").'" /> '; |
105 | - if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
119 | + if (isset($value['ban_eu']) && $value['ban_eu'] == 1) { |
|
120 | + print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
121 | + } |
|
106 | 122 | } else { |
107 | 123 | print $value['airline_name']; |
108 | - if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
124 | + if (isset($value['ban_eu']) && $value['ban_eu'] == 1) { |
|
125 | + print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> '; |
|
126 | + } |
|
109 | 127 | } |
110 | 128 | print '</a>'; |
111 | 129 | print '</div>'; |
@@ -7,10 +7,10 @@ discard block |
||
7 | 7 | |
8 | 8 | if (isset($_POST['owner'])) |
9 | 9 | { |
10 | - header('Location: '.$globalURL.'/owner/'.filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING)); |
|
10 | + header('Location: '.$globalURL.'/owner/'.filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING)); |
|
11 | 11 | //} else if (isset($_GET['airport'])){ |
12 | 12 | } else { |
13 | - $Spotter= new Spotter(); |
|
13 | + $Spotter = new Spotter(); |
|
14 | 14 | $Stats = new Stats(); |
15 | 15 | $Common = new Common(); |
16 | 16 | $title = _("Owners"); |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | ksort($owner_names); |
25 | 25 | $previous = null; |
26 | 26 | print '<div class="alphabet-legend">'; |
27 | - foreach($owner_names as $value) { |
|
27 | + foreach ($owner_names as $value) { |
|
28 | 28 | $firstLetter = $Common->remove_accents(strtoupper($Common->replace_mb_substr($value['owner_name'], 0, 1))); |
29 | - if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
29 | + if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
30 | 30 | { |
31 | - if ($previous !== null){ |
|
31 | + if ($previous !== null) { |
|
32 | 32 | print ' | '; |
33 | 33 | } |
34 | 34 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | } |
38 | 38 | print '</div>'; |
39 | 39 | $previous = null; |
40 | - foreach($owner_names as $value) { |
|
40 | + foreach ($owner_names as $value) { |
|
41 | 41 | $firstLetter = $Common->remove_accents(strtoupper($Common->replace_mb_substr($value['owner_name'], 0, 1))); |
42 | 42 | if ($firstLetter != "") |
43 | 43 | { |
44 | - if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
44 | + if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
45 | 45 | { |
46 | - if ($previous !== null){ |
|
46 | + if ($previous !== null) { |
|
47 | 47 | print '</div>'; |
48 | 48 | } |
49 | 49 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |