Completed
Push — master ( 708bc7...3d67e6 )
by Yannick
30:22
created
js/map-aircraft.3d.js.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -662,9 +662,9 @@
 block discarded – undo
662 662
 //	var timeline = new Cesium.Timeline(viewer);
663 663
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
664 664
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
665
-	//this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
666
-	$(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
667
-	//		this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
665
+	//this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
666
+	$(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
667
+	//		this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
668 668
 
669 669
 }
670 670
 
Please login to merge, or discard this patch.
Braces   +24 added lines, -4 removed lines patch added patch discarded remove patch
@@ -218,7 +218,12 @@  discard block
 block discarded – undo
218 218
 			<?php
219 219
 			    } else {
220 220
 			?>
221
-			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
221
+			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
222
+	print $globalMapRefresh*2000;
223
+} else {
224
+	print '60000';
225
+}
226
+?>)) {
222 227
 				viewer.dataSources.get(dsn).entities.remove(entity);
223 228
 				czmlds.entities.removeById(entityid);
224 229
 			}
@@ -502,7 +507,12 @@  discard block
 block discarded – undo
502 507
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
503 508
 ?>
504 509
 update_polarLayer();
505
-setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
510
+setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) {
511
+	print $globalMapRefresh*1000*2;
512
+} else {
513
+	print '60000';
514
+}
515
+?>);
506 516
 <?php
507 517
 		}
508 518
 ?>
@@ -613,7 +623,12 @@  discard block
 block discarded – undo
613 623
 				}
614 624
 			}
615 625
 		}
616
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
626
+	,<?php if (isset($globalMapRefresh)) {
627
+	print $globalMapRefresh*1000;
628
+} else {
629
+	print '30000';
630
+}
631
+?>);
617 632
 } else {
618 633
 	//var widget = new Cesium.CesiumWidget('archivebox');
619 634
 //	var timeline = new Cesium.Timeline(viewer);
@@ -632,7 +647,12 @@  discard block
 block discarded – undo
632 647
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
633 648
 ?>
634 649
 update_atcLayer();
635
-setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
650
+setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) {
651
+	print $globalMapRefresh*1000*2;
652
+} else {
653
+	print '60000';
654
+}
655
+?>);
636 656
 <?php
637 657
     }
638 658
 ?>
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -265,22 +265,22 @@  discard block
 block discarded – undo
265 265
 			var entityid = entity.id;
266 266
 			var lastupdateentity = entity.properties.lastupdate;
267 267
 			<?php 
268
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
269
-			    // Remove flights not in latest CZML
268
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
269
+				// Remove flights not in latest CZML
270 270
 			?>
271 271
 			if (lastupdateentity != lastupdate) {
272 272
 				viewer.dataSources.get(dsn).entities.remove(entity);
273 273
 				czmlds.entities.removeById(entityid);
274 274
 			}
275 275
 			<?php
276
-			    } else {
276
+				} else {
277 277
 			?>
278 278
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
279 279
 				viewer.dataSources.get(dsn).entities.remove(entity);
280 280
 				czmlds.entities.removeById(entityid);
281 281
 			}
282 282
 			<?php
283
-			    }
283
+				}
284 284
 			?>
285 285
 		}
286 286
 	}
@@ -708,12 +708,12 @@  discard block
 block discarded – undo
708 708
 	update_airportsLayer();
709 709
 }
710 710
 <?php
711
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
711
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
712 712
 ?>
713 713
 update_atcLayer();
714 714
 setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
715 715
 <?php
716
-    }
716
+	}
717 717
 ?>
718 718
 
719 719
 function iconColor(color) {
Please login to merge, or discard this patch.
marine-data.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65 65
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
66
-	} else $image = $spotter_item['image_thumbnail'];
66
+	} else {
67
+		$image = $spotter_item['image_thumbnail'];
68
+	}
67 69
 
68 70
 }
69 71
 /* else {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@  discard block
 block discarded – undo
9 9
 
10 10
 $from_archive = false;
11 11
 if (isset($_GET['ident'])) {
12
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
13 13
 	if (isset($_GET['currenttime'])) {
14
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
14
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
15 15
 		$currenttime = round($currenttime/1000);
16
-		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident,$currenttime);
16
+		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident, $currenttime);
17 17
 		
18 18
 		if (empty($spotter_array)) {
19 19
 			$from_archive = true;
20
-			$spotter_array = $MarineArchive->getDateArchiveMarineDataByIdent($ident,$currenttime);
20
+			$spotter_array = $MarineArchive->getDateArchiveMarineDataByIdent($ident, $currenttime);
21 21
 		}
22 22
 		
23 23
 	} else {
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 }
33 33
 if (isset($_GET['fammarine_id'])) {
34
-	$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
34
+	$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
35 35
 	if (isset($_GET['currenttime'])) {
36
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
36
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
37 37
 		$currenttime = round($currenttime/1000);
38
-		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id,$currenttime);
38
+		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id, $currenttime);
39 39
 		
40 40
 		if (empty($spotter_array)) {
41 41
 			$from_archive = true;
42 42
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
43
-			$spotter_array = $MarineArchive->getDateArchiveMarineDataById($flightaware_id,$currenttime);
43
+			$spotter_array = $MarineArchive->getDateArchiveMarineDataById($flightaware_id, $currenttime);
44 44
 		}
45 45
 		
46 46
 	} else {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
65
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
66 66
 	} else $image = $spotter_item['image_thumbnail'];
67 67
 
68 68
 }
Please login to merge, or discard this patch.
tracker-data.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65 65
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
66
-	} else $image = $spotter_item['image_thumbnail'];
66
+	} else {
67
+		$image = $spotter_item['image_thumbnail'];
68
+	}
67 69
 
68 70
 }
69 71
 /* else {
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 print '<div class="details">';
79 79
 print '<div><span>'._("Altitude").'</span>';
80 80
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
81
-    try {
81
+	try {
82 82
 	$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
83
-    } catch(Exception $e) {
84
-    }
83
+	} catch(Exception $e) {
84
+	}
85 85
 }
86 86
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
87 87
 	print $spotter_item['altitude'].' feet (FL'.$spotter_item['altitude'].')';
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 	print round($spotter_item['altitude']*0.3048).' m (FL'.round($spotter_item['altitude']/100).')';
90 90
 }
91 91
 if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*0.3048) {
92
-    print '<br>';
93
-    print '<span>'._("Ground Altitude").'</span>';
94
-    if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
92
+	print '<br>';
93
+	print '<span>'._("Ground Altitude").'</span>';
94
+	if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
95 95
 	print round($groundAltitude*3.28084).' feet';
96
-    } else {
96
+	} else {
97 97
 	print round($groundAltitude).' m';
98
-    }
99
-    print '</i>';
98
+	}
99
+	print '</i>';
100 100
 }
101 101
 print '</div>';
102 102
 print '<div><span>'._("Speed").'</span>';
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
14
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident,$currenttime);
18
+		$spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident, $currenttime);
19 19
 		if (empty($spotter_array)) {
20 20
 			$from_archive = true;
21
-			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataByIdent($ident,$currenttime);
21
+			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataByIdent($ident, $currenttime);
22 22
 		}
23 23
 		
24 24
 	} else {
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	}
31 31
 }
32 32
 if (isset($_GET['famtrackid'])) {
33
-	$famtrackid = urldecode(filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING));
33
+	$famtrackid = urldecode(filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING));
34 34
 	if (isset($_GET['currenttime'])) {
35
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
35
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
36 36
 		$currenttime = round($currenttime/1000);
37
-		$spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid,$currenttime);
37
+		$spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid, $currenttime);
38 38
 		
39 39
 		if (empty($spotter_array)) {
40 40
 			$from_archive = true;
41 41
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
42
-			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataById($famtrackid,$currenttime);
42
+			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataById($famtrackid, $currenttime);
43 43
 		}
44 44
 		
45 45
 	} else {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
60 60
 {
61 61
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
62
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
62
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
63 63
 	} else $image = $spotter_item['image_thumbnail'];
64 64
 
65 65
 }
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 print '<div><span>'._("Altitude").'</span>';
80 80
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
81 81
     try {
82
-	$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
83
-    } catch(Exception $e) {
82
+	$groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']);
83
+    } catch (Exception $e) {
84 84
     }
85 85
 }
86 86
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
Please login to merge, or discard this patch.
accident.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/require/settings.php');
3
-$date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING);
3
+$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING);
4 4
 if ($date == '') $date = date('Y-m-d');
5 5
 header('Location: '.$globalURL.'/accident/'.$date);
6 6
 ?>
7 7
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/require/settings.php');
3 3
 $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING);
4
-if ($date == '') $date = date('Y-m-d');
4
+if ($date == '') {
5
+	$date = date('Y-m-d');
6
+}
5 7
 header('Location: '.$globalURL.'/accident/'.$date);
6 8
 ?>
7 9
\ No newline at end of file
Please login to merge, or discard this patch.
statistics-fatalities-year.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 print '<div id="chart" class="chart" width="100%"></div><script>';
20 20
 $year_data = '';
21 21
 $year_cnt = '';
22
-foreach($date_array as $year_item)
22
+foreach ($date_array as $year_item)
23 23
 {
24 24
 	$year_data .= '"'.$year_item['year'].'-01-01",';
25 25
 	$year_cnt .= $year_item['count'].',';
26 26
 }
27 27
 $year_data = "['x',".substr($year_data, 0, -1)."]";
28
-$year_cnt = "['flights',".substr($year_cnt,0,-1)."]";
28
+$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]";
29 29
 print 'c3.generate({
30 30
     bindto: "#chart",
31 31
     data: { x: "x",
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 
36 36
 if (!empty($date_array))
37 37
 {
38
-	foreach($date_array as $key => $row) {
38
+	foreach ($date_array as $key => $row) {
39 39
 		$years[$key] = $row['year'];
40 40
 		$counts[$key] = $row['count'];
41 41
 	}
42 42
 	//array_multisort($years,SORT_DESC,$date_array);
43
-	array_multisort($counts,SORT_DESC,$date_array);
43
+	array_multisort($counts, SORT_DESC, $date_array);
44 44
 	print '<div class="table-responsive">';
45 45
 	print '<table class="common-date table-striped">';
46 46
 	print '<thead>';
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	print '</thead>';
51 51
 	print '<tbody>';
52 52
 	$i = 1;
53
-	foreach($date_array as $date_item)
53
+	foreach ($date_array as $date_item)
54 54
 	{
55 55
 		print '<tr>';
56 56
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
statistics-route-airport.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 $route_array = $Spotter->countAllRoutes();
19 19
 print '<div id="chart" class="chart" width="100%"></div><script>';
20 20
 $route_data = '';
21
-foreach($route_array as $route_item)
21
+foreach ($route_array as $route_item)
22 22
 {
23 23
 	$route_data .= '[ "'.$route_item['airport_departure_icao'].' - '.$route_item['airport_arrival_icao'].'",'.$route_item['route_count'].'],';
24 24
 }
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	print '</thead>';
47 47
 	print '<tbody>';
48 48
 	$i = 1;
49
-	foreach($route_array as $route_item)
49
+	foreach ($route_array as $route_item)
50 50
 	{
51 51
 		print '<tr>';
52 52
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 $title = _("Statistics").' - '._("Most common Route by Airport");
7 7
 require_once('header.php');
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 include('statistics-sub-menu.php'); 
10 12
 
11 13
 print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
Please login to merge, or discard this patch.
incident.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/require/settings.php');
3
-$date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING);
3
+$date = filter_input(INPUT_POST, 'date', FILTER_SANITIZE_STRING);
4 4
 if ($date == '') $date = date('Y-m-d');
5 5
 header('Location: '.$globalURL.'/incident/'.$date);
6 6
 ?>
7 7
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/require/settings.php');
3 3
 $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING);
4
-if ($date == '') $date = date('Y-m-d');
4
+if ($date == '') {
5
+	$date = date('Y-m-d');
6
+}
5 7
 header('Location: '.$globalURL.'/incident/'.$date);
6 8
 ?>
7 9
\ No newline at end of file
Please login to merge, or discard this patch.
date-statistics-departure-airport-country.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3,13 +3,13 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING);
8
-$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING);
8
+$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort);
9 9
 
10 10
 if (!empty($spotter_array))
11 11
 {
12
-	$title = sprintf(_("Most Common Departure Airports by Country on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
12
+	$title = sprintf(_("Most Common Departure Airports by Country on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
13 13
 
14 14
 	require_once('header.php');
15 15
 	print '<div class="select-item">';
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 	print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>';
28 28
 	print '<br />';
29 29
 	print '<div class="info column">';
30
-	print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
30
+	print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
31 31
 	print '</div>';
32 32
 
33 33
 	include('date-sub-menu.php');
34 34
 	print '<div class="column">';
35 35
 	print '<h2>'._("Most Common Departure Airports by Country").'</h2>';
36
-	print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
36
+	print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
37 37
 	$airport_country_array = $Spotter->countAllDepartureAirportCountriesByDate($date);
38 38
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
39 39
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	print '<div id="chartCountry" class="chart" width="100%"></div><script>';
42 42
 	print 'var series = [';
43 43
 	$country_data = '';
44
-	foreach($airport_country_array as $airport_item)
44
+	foreach ($airport_country_array as $airport_item)
45 45
 	{
46 46
 		$country_data .= '[ "'.$airport_item['departure_airport_country_iso3'].'",'.$airport_item['airport_departure_country_count'].'],';
47 47
 	}
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 		print '</thead>';
90 90
 		print '<tbody>';
91 91
 		$i = 1;
92
-		foreach($airport_country_array as $airport_item)
92
+		foreach ($airport_country_array as $airport_item)
93 93
 		{
94 94
 			print '<tr>';
95 95
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
require/class.Common.php 4 patches
Indentation   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
 	//protected $cookies = array();
8 8
 	
9 9
 	/**
10
-	* Get data from form result
11
-	* @param String $url form URL
12
-	* @param String $type type of submit form method (get or post)
13
-	* @param String|Array $data values form post method
14
-	* @param Array $headers header to submit with the form
15
-	* @return String the result
16
-	*/
10
+	 * Get data from form result
11
+	 * @param String $url form URL
12
+	 * @param String $type type of submit form method (get or post)
13
+	 * @param String|Array $data values form post method
14
+	 * @param Array $headers header to submit with the form
15
+	 * @return String the result
16
+	 */
17 17
 	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') {
18 18
 		global $globalProxy, $globalForceIPv4;
19 19
 		$ch = curl_init();
@@ -107,10 +107,10 @@  discard block
 block discarded – undo
107 107
 	}
108 108
 	
109 109
 	/**
110
-	* Convert a HTML table to an array
111
-	* @param String $data HTML page
112
-	* @return Array array of the tables in HTML page
113
-	*/
110
+	 * Convert a HTML table to an array
111
+	 * @param String $data HTML page
112
+	 * @return Array array of the tables in HTML page
113
+	 */
114 114
 	public function table2array($data) {
115 115
 		if (!is_string($data)) return array();
116 116
 		if ($data == '') return array();
@@ -144,10 +144,10 @@  discard block
 block discarded – undo
144 144
 	}
145 145
 	
146 146
 	/**
147
-	* Convert <p> part of a HTML page to an array
148
-	* @param String $data HTML page
149
-	* @return Array array of the <p> in HTML page
150
-	*/
147
+	 * Convert <p> part of a HTML page to an array
148
+	 * @param String $data HTML page
149
+	 * @return Array array of the <p> in HTML page
150
+	 */
151 151
 	public function text2array($data) {
152 152
 		$html = str_get_html($data);
153 153
 		if ($html === false) return array();
@@ -162,14 +162,14 @@  discard block
 block discarded – undo
162 162
 	}
163 163
 
164 164
 	/**
165
-	* Give distance between 2 coordonnates
166
-	* @param Float $lat latitude of first point
167
-	* @param Float $lon longitude of first point
168
-	* @param Float $latc latitude of second point
169
-	* @param Float $lonc longitude of second point
170
-	* @param String $unit km else no unit used
171
-	* @return Float Distance in $unit
172
-	*/
165
+	 * Give distance between 2 coordonnates
166
+	 * @param Float $lat latitude of first point
167
+	 * @param Float $lon longitude of first point
168
+	 * @param Float $latc latitude of second point
169
+	 * @param Float $lonc longitude of second point
170
+	 * @param String $unit km else no unit used
171
+	 * @return Float Distance in $unit
172
+	 */
173 173
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
174 174
 		if ($lat == $latc && $lon == $lonc) return 0;
175 175
 		$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;
@@ -187,11 +187,11 @@  discard block
 block discarded – undo
187 187
 	}
188 188
 
189 189
 	/**
190
-	* Check is distance realistic
191
-	* @param int $timeDifference the time between the reception of both messages
192
-	* @param float $distance distance covered
193
-	* @return whether distance is realistic
194
-	*/
190
+	 * Check is distance realistic
191
+	 * @param int $timeDifference the time between the reception of both messages
192
+	 * @param float $distance distance covered
193
+	 * @return whether distance is realistic
194
+	 */
195 195
 	public function withinThreshold ($timeDifference, $distance) {
196 196
 		$x = abs($timeDifference);
197 197
 		$d = abs($distance);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 	}
210 210
 
211 211
 	public function isInteger($input){
212
-	    return(ctype_digit(strval($input)));
212
+		return(ctype_digit(strval($input)));
213 213
 	}
214 214
 
215 215
 
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
 	}
241 241
 	
242 242
 	/**
243
-	* Copy folder contents
244
-	* @param       string   $source    Source path
245
-	* @param       string   $dest      Destination path
246
-	* @return      bool     Returns true on success, false on failure
247
-	*/
243
+	 * Copy folder contents
244
+	 * @param       string   $source    Source path
245
+	 * @param       string   $dest      Destination path
246
+	 * @return      bool     Returns true on success, false on failure
247
+	 */
248 248
 	public function xcopy($source, $dest)
249 249
 	{
250 250
 		$files = glob($source.'*.*');
@@ -256,20 +256,20 @@  discard block
 block discarded – undo
256 256
 	}
257 257
 	
258 258
 	/**
259
-	* Check if an url exist
260
-	* @param	String $url url to check
261
-	* @return	bool Return true on succes false on failure
262
-	*/
259
+	 * Check if an url exist
260
+	 * @param	String $url url to check
261
+	 * @return	bool Return true on succes false on failure
262
+	 */
263 263
 	public function urlexist($url){
264 264
 		$headers=get_headers($url);
265 265
 		return stripos($headers[0],"200 OK")?true:false;
266 266
 	}
267 267
 	
268 268
 	/**
269
-	* Convert hexa to string
270
-	* @param	String $hex data in hexa
271
-	* @return	String Return result
272
-	*/
269
+	 * Convert hexa to string
270
+	 * @param	String $hex data in hexa
271
+	 * @return	String Return result
272
+	 */
273 273
 	public function hex2str($hex) {
274 274
 		$str = '';
275 275
 		$hexln = strlen($hex);
@@ -278,10 +278,10 @@  discard block
 block discarded – undo
278 278
 	}
279 279
 	
280 280
 	/**
281
-	* Convert hexa color to rgb
282
-	* @param	String $hex data in hexa
283
-	* @return	String Return result
284
-	*/
281
+	 * Convert hexa color to rgb
282
+	 * @param	String $hex data in hexa
283
+	 * @return	String Return result
284
+	 */
285 285
 	public function hex2rgb($hex) {
286 286
 		$hex = str_replace('#','',$hex);
287 287
 		return sscanf($hex, "%02x%02x%02x"); 
@@ -359,9 +359,9 @@  discard block
 block discarded – undo
359 359
 	}
360 360
 	
361 361
 	/**
362
-	* Returns list of available locales
363
-	*
364
-	* @return array
362
+	 * Returns list of available locales
363
+	 *
364
+	 * @return array
365 365
 	 */
366 366
 	public function listLocaleDir()
367 367
 	{
@@ -456,100 +456,100 @@  discard block
 block discarded – undo
456 456
 	public function remove_accents($string) {
457 457
 		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
458 458
 		$chars = array(
459
-		    // Decompositions for Latin-1 Supplement
460
-		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
461
-		    chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
462
-		    chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
463
-		    chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
464
-		    chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
465
-		    chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
466
-		    chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
467
-		    chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
468
-		    chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
469
-		    chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
470
-		    chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
471
-		    chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
472
-		    chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
473
-		    chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
474
-		    chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
475
-		    chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
476
-		    chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
477
-		    chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
478
-		    chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
479
-		    chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
480
-		    chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
481
-		    chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
482
-		    chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
483
-		    chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
484
-		    chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
485
-		    chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
486
-		    chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
487
-		    chr(195).chr(191) => 'y',
488
-		    // Decompositions for Latin Extended-A
489
-		    chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
490
-		    chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
491
-		    chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
492
-		    chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
493
-		    chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
494
-		    chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
495
-		    chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
496
-		    chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
497
-		    chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
498
-		    chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
499
-		    chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
500
-		    chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
501
-		    chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
502
-		    chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
503
-		    chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
504
-		    chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
505
-		    chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
506
-		    chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
507
-		    chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
508
-		    chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
509
-		    chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
510
-		    chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
511
-		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
512
-		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
513
-		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
514
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
515
-		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
516
-		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
517
-		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
518
-		    chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
519
-		    chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
520
-		    chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
521
-		    chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
522
-		    chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
523
-		    chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
524
-		    chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
525
-		    chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
526
-		    chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
527
-		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
528
-		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
529
-		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
530
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
531
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
532
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
533
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
534
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
535
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
536
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
537
-		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
538
-		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
539
-		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
540
-		    chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
541
-		    chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
542
-		    chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
543
-		    chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
544
-		    chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
545
-		    chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
546
-		    chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
547
-		    chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
548
-		    chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
549
-		    chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
550
-		    chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
551
-		    chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
552
-		    chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
459
+			// Decompositions for Latin-1 Supplement
460
+			chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
461
+			chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
462
+			chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
463
+			chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
464
+			chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
465
+			chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
466
+			chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
467
+			chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
468
+			chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
469
+			chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
470
+			chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
471
+			chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
472
+			chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
473
+			chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
474
+			chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
475
+			chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
476
+			chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
477
+			chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
478
+			chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
479
+			chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
480
+			chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
481
+			chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
482
+			chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
483
+			chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
484
+			chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
485
+			chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
486
+			chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
487
+			chr(195).chr(191) => 'y',
488
+			// Decompositions for Latin Extended-A
489
+			chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
490
+			chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
491
+			chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
492
+			chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
493
+			chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
494
+			chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
495
+			chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
496
+			chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
497
+			chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
498
+			chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
499
+			chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
500
+			chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
501
+			chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
502
+			chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
503
+			chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
504
+			chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
505
+			chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
506
+			chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
507
+			chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
508
+			chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
509
+			chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
510
+			chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
511
+			chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
512
+			chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
513
+			chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
514
+			chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
515
+			chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
516
+			chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
517
+			chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
518
+			chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
519
+			chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
520
+			chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
521
+			chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
522
+			chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
523
+			chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
524
+			chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
525
+			chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
526
+			chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
527
+			chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
528
+			chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
529
+			chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
530
+			chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
531
+			chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
532
+			chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
533
+			chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
534
+			chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
535
+			chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
536
+			chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
537
+			chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
538
+			chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
539
+			chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
540
+			chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
541
+			chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
542
+			chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
543
+			chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
544
+			chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
545
+			chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
546
+			chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
547
+			chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
548
+			chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
549
+			chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
550
+			chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
551
+			chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
552
+			chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
553 553
 		);
554 554
 		$string = strtr($string, $chars);
555 555
 		return $string;
Please login to merge, or discard this patch.
Doc Comments   +15 added lines, -2 removed lines patch added patch discarded remove patch
@@ -90,6 +90,10 @@  discard block
 block discarded – undo
90 90
 		return strlen($headerLine); // Needed by curl
91 91
 	}
92 92
 
93
+	/**
94
+	 * @param string $url
95
+	 * @param string $file
96
+	 */
93 97
 	public static function download($url, $file, $referer = '') {
94 98
 		global $globalDebug;
95 99
 		$fp = fopen($file, 'w');
@@ -106,6 +110,9 @@  discard block
 block discarded – undo
106 110
 		fclose($fp);
107 111
 	}
108 112
 
113
+	/**
114
+	 * @param string $in_file
115
+	 */
109 116
 	public static function gunzip($in_file,$out_file_name = '') {
110 117
 		//echo $in_file.' -> '.$out_file_name."\n";
111 118
 		$buffer_size = 4096; // read 4kb at a time
@@ -211,7 +218,7 @@  discard block
 block discarded – undo
211 218
 	* Check is distance realistic
212 219
 	* @param int $timeDifference the time between the reception of both messages
213 220
 	* @param float $distance distance covered
214
-	* @return whether distance is realistic
221
+	* @return boolean distance is realistic
215 222
 	*/
216 223
 	public function withinThreshold ($timeDifference, $distance) {
217 224
 		$x = abs($timeDifference);
@@ -234,6 +241,9 @@  discard block
 block discarded – undo
234 241
 	}
235 242
 
236 243
 
244
+	/**
245
+	 * @param string $latlong
246
+	 */
237 247
 	public function convertDec($dms,$latlong) {
238 248
 		if ($latlong == 'latitude') {
239 249
 			$deg = substr($dms, 0, 2);
@@ -245,6 +255,9 @@  discard block
 block discarded – undo
245 255
 		return $deg+(($min*60)/3600);
246 256
 	}
247 257
 	
258
+	/**
259
+	 * @param string $latlong
260
+	 */
248 261
 	public function convertDM($coord,$latlong) {
249 262
 		if ($latlong == 'latitude') {
250 263
 			if ($coord < 0) $NSEW = 'S';
@@ -382,7 +395,7 @@  discard block
 block discarded – undo
382 395
 	/**
383 396
 	* Returns list of available locales
384 397
 	*
385
-	* @return array
398
+	* @return string[]
386 399
 	 */
387 400
 	public function listLocaleDir()
388 401
 	{
Please login to merge, or discard this patch.
Braces   +98 added lines, -44 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");
@@ -85,8 +88,9 @@  discard block
 block discarded – undo
85 88
 	private function curlResponseHeaderCallback($ch, $headerLine) {
86 89
 		//global $cookies;
87 90
 		$cookies = array();
88
-		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1)
89
-			$cookies[] = $cookie;
91
+		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) {
92
+					$cookies[] = $cookie;
93
+		}
90 94
 		return strlen($headerLine); // Needed by curl
91 95
 	}
92 96
 
@@ -97,11 +101,15 @@  discard block
 block discarded – undo
97 101
 		curl_setopt($ch, CURLOPT_URL, $url);
98 102
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
99 103
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
100
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
104
+		if ($referer != '') {
105
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
106
+		}
101 107
 		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');
102 108
 		curl_setopt($ch, CURLOPT_FILE, $fp);
103 109
 		curl_exec($ch);
104
-		if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch);
110
+		if (curl_errno($ch) && $globalDebug) {
111
+			echo 'Download error: '.curl_error($ch);
112
+		}
105 113
 		curl_close($ch);
106 114
 		fclose($fp);
107 115
 	}
@@ -109,12 +117,16 @@  discard block
 block discarded – undo
109 117
 	public static function gunzip($in_file,$out_file_name = '') {
110 118
 		//echo $in_file.' -> '.$out_file_name."\n";
111 119
 		$buffer_size = 4096; // read 4kb at a time
112
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
120
+		if ($out_file_name == '') {
121
+			$out_file_name = str_replace('.gz', '', $in_file);
122
+		}
113 123
 		if ($in_file != '' && file_exists($in_file)) {
114 124
 			// 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');
117
-			else {
125
+			if (function_exists('gzopen')) {
126
+				$file = gzopen($in_file,'rb');
127
+			} elseif (function_exists('gzopen64')) {
128
+				$file = gzopen64($in_file,'rb');
129
+			} else {
118 130
 				echo 'gzopen not available';
119 131
 				die;
120 132
 			}
@@ -130,11 +142,14 @@  discard block
 block discarded – undo
130 142
 	public static function bunzip2($in_file,$out_file_name = '') {
131 143
 		//echo $in_file.' -> '.$out_file_name."\n";
132 144
 		$buffer_size = 4096; // read 4kb at a time
133
-		if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); 
145
+		if ($out_file_name == '') {
146
+			$out_file_name = str_replace('.bz2', '', $in_file);
147
+		}
134 148
 		if ($in_file != '' && file_exists($in_file)) {
135 149
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
136
-			if (function_exists('bzopen')) $file = bzopen($in_file,'rb');
137
-			else {
150
+			if (function_exists('bzopen')) {
151
+				$file = bzopen($in_file,'rb');
152
+			} else {
138 153
 				echo 'bzopen not available';
139 154
 				die;
140 155
 			}
@@ -153,10 +168,16 @@  discard block
 block discarded – undo
153 168
 	* @return Array array of the tables in HTML page
154 169
 	*/
155 170
 	public function table2array($data) {
156
-		if (!is_string($data)) return array();
157
-		if ($data == '') return array();
171
+		if (!is_string($data)) {
172
+			return array();
173
+		}
174
+		if ($data == '') {
175
+			return array();
176
+		}
158 177
 		$html = str_get_html($data);
159
-		if ($html === false) return array();
178
+		if ($html === false) {
179
+			return array();
180
+		}
160 181
 		$tabledata=array();
161 182
 		foreach($html->find('tr') as $element)
162 183
 		{
@@ -191,7 +212,9 @@  discard block
 block discarded – undo
191 212
 	*/
192 213
 	public function text2array($data) {
193 214
 		$html = str_get_html($data);
194
-		if ($html === false) return array();
215
+		if ($html === false) {
216
+			return array();
217
+		}
195 218
 		$tabledata=array();
196 219
 		foreach($html->find('p') as $element)
197 220
 		{
@@ -212,7 +235,9 @@  discard block
 block discarded – undo
212 235
 	* @return Float Distance in $unit
213 236
 	*/
214 237
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
215
-		if ($lat == $latc && $lon == $lonc) return 0;
238
+		if ($lat == $latc && $lon == $lonc) {
239
+			return 0;
240
+		}
216 241
 		$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 242
 		if ($unit == "km") {
218 243
 			return round($dist * 1.609344);
@@ -236,10 +261,16 @@  discard block
 block discarded – undo
236 261
 	public function withinThreshold ($timeDifference, $distance) {
237 262
 		$x = abs($timeDifference);
238 263
 		$d = abs($distance);
239
-		if ($x == 0 || $d == 0) return true;
264
+		if ($x == 0 || $d == 0) {
265
+			return true;
266
+		}
240 267
 		// may be due to Internet jitter; distance is realistic
241
-		if ($x < 0.7 && $d < 2000) return true;
242
-		else return $d/$x < 1500*0.27778; // 1500 km/h max
268
+		if ($x < 0.7 && $d < 2000) {
269
+			return true;
270
+		} else {
271
+			return $d/$x < 1500*0.27778;
272
+		}
273
+		// 1500 km/h max
243 274
 	}
244 275
 
245 276
 
@@ -267,11 +298,17 @@  discard block
 block discarded – undo
267 298
 	
268 299
 	public function convertDM($coord,$latlong) {
269 300
 		if ($latlong == 'latitude') {
270
-			if ($coord < 0) $NSEW = 'S';
271
-			else $NSEW = 'N';
301
+			if ($coord < 0) {
302
+				$NSEW = 'S';
303
+			} else {
304
+				$NSEW = 'N';
305
+			}
272 306
 		} else {
273
-			if ($coord < 0) $NSEW = 'W';
274
-			else $NSEW = 'E';
307
+			if ($coord < 0) {
308
+				$NSEW = 'W';
309
+			} else {
310
+				$NSEW = 'E';
311
+			}
275 312
 		}
276 313
 		$coord = abs($coord);
277 314
 		$deg = floor($coord);
@@ -314,7 +351,9 @@  discard block
 block discarded – undo
314 351
 	public function hex2str($hex) {
315 352
 		$str = '';
316 353
 		$hexln = strlen($hex);
317
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
354
+		for($i=0;$i<$hexln;$i+=2) {
355
+			$str .= chr(hexdec(substr($hex,$i,2)));
356
+		}
318 357
 		return $str;
319 358
 	}
320 359
 	
@@ -351,8 +390,11 @@  discard block
 block discarded – undo
351 390
 		$b = $lat2 - $lat1;
352 391
 		$c = -($a*$lat1+$b*$lon1);
353 392
 		$d = $a*$lat3+$b*$lon3+$c;
354
-		if ($d > -$approx && $d < $approx) return true;
355
-		else return false;
393
+		if ($d > -$approx && $d < $approx) {
394
+			return true;
395
+		} else {
396
+			return false;
397
+		}
356 398
 	}
357 399
 	
358 400
 	public function array_merge_noappend() {
@@ -411,7 +453,9 @@  discard block
 block discarded – undo
411 453
 			return $result;
412 454
 		}
413 455
 		$handle = @opendir('./locale');
414
-		if ($handle === false) return $result;
456
+		if ($handle === false) {
457
+			return $result;
458
+		}
415 459
 		while (false !== ($file = readdir($handle))) {
416 460
 			$path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
417 461
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -478,8 +522,9 @@  discard block
 block discarded – undo
478 522
 		$error = false; 
479 523
 		if ($fp_out = gzopen($dest, $mode)) { 
480 524
 			if ($fp_in = fopen($source,'rb')) { 
481
-				while (!feof($fp_in)) 
482
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
525
+				while (!feof($fp_in)) {
526
+									gzwrite($fp_out, fread($fp_in, 1024 * 512));
527
+				}
483 528
 				fclose($fp_in); 
484 529
 			} else {
485 530
 				$error = true; 
@@ -488,14 +533,17 @@  discard block
 block discarded – undo
488 533
 		} else {
489 534
 			$error = true; 
490 535
 		}
491
-		if ($error)
492
-			return false; 
493
-		else
494
-			return $dest; 
536
+		if ($error) {
537
+					return false;
538
+		} else {
539
+					return $dest;
540
+		}
495 541
 	} 
496 542
 	
497 543
 	public function remove_accents($string) {
498
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
544
+		if ( !preg_match('/[\x80-\xff]/', $string) ) {
545
+			return $string;
546
+		}
499 547
 		$chars = array(
500 548
 		    // Decompositions for Latin-1 Supplement
501 549
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -619,7 +667,9 @@  discard block
 block discarded – undo
619 667
 		$ip = gethostbyname($host);
620 668
 		$s = socket_create(AF_INET, SOCK_STREAM, 0);
621 669
 		$r = @socket_connect($s, $ip, $port);
622
-		if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
670
+		if (!socket_set_nonblock($s)) {
671
+			echo "Unable to set nonblock on socket\n";
672
+		}
623 673
 		if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
624 674
 			return $s;
625 675
 		}
@@ -664,18 +714,22 @@  discard block
 block discarded – undo
664 714
 		//NOTE: use a trailing slash for folders!!!
665 715
 		//see http://bugs.php.net/bug.php?id=27609
666 716
 		//see http://bugs.php.net/bug.php?id=30931
667
-		if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
717
+		if ($path{strlen($path)-1}=='/') {
718
+			// recursively return a temporary file path
668 719
 			return $this->is__writable($path.uniqid(mt_rand()).'.tmp');
669
-		else if (is_dir($path))
670
-			return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
720
+		} else if (is_dir($path)) {
721
+					return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
722
+		}
671 723
 		// check tmp file for read/write capabilities
672 724
 		$rm = file_exists($path);
673 725
 		$f = @fopen($path, 'a');
674
-		if ($f===false)
675
-			return false;
726
+		if ($f===false) {
727
+					return false;
728
+		}
676 729
 		fclose($f);
677
-		if (!$rm)
678
-			unlink($path);
730
+		if (!$rm) {
731
+					unlink($path);
732
+		}
679 733
 		return true;
680 734
 	}
681 735
 }
Please login to merge, or discard this patch.
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -14,12 +14,12 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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.15) {
348
+	public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.15) {
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,7 +422,7 @@  discard block
 block discarded – undo
422 422
 		return $result;
423 423
 	}
424 424
 
425
-	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = ''){
425
+	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = '') {
426 426
 		global $globalMapRefresh;
427 427
 		if ($seconds == '') {
428 428
 			$distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000;
@@ -433,27 +433,27 @@  discard block
 block discarded – undo
433 433
 		$latitude = deg2rad($latitude);
434 434
 		$longitude = deg2rad($longitude);
435 435
 		$bearing = deg2rad($heading); 
436
-		$latitude2 =  asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) );
437
-		$longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) );
438
-		return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.',''));
436
+		$latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing)));
437
+		$longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2)));
438
+		return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', ''));
439 439
 	}
440 440
 	
441
-	public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) {
441
+	public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) {
442 442
 		// distance in meter
443 443
 		$R = 6378.14;
444
-		$latitude1 = $latitude * (M_PI/180);
445
-		$longitude1 = $longitude * (M_PI/180);
446
-		$brng = $bearing * (M_PI/180);
444
+		$latitude1 = $latitude*(M_PI/180);
445
+		$longitude1 = $longitude*(M_PI/180);
446
+		$brng = $bearing*(M_PI/180);
447 447
 		$d = $distance;
448 448
 
449 449
 		$latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng));
450
-		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2));
450
+		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2));
451 451
 
452
-		$latitude2 = $latitude2 * (180/M_PI);
453
-		$longitude2 = $longitude2 * (180/M_PI);
452
+		$latitude2 = $latitude2*(180/M_PI);
453
+		$longitude2 = $longitude2*(180/M_PI);
454 454
 
455
-		$flat = round ($latitude2,6);
456
-		$flong = round ($longitude2,6);
455
+		$flat = round($latitude2, 6);
456
+		$flong = round($longitude2, 6);
457 457
 /*
458 458
 		$dx = $distance*cos($bearing);
459 459
 		$dy = $distance*sin($bearing);
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 		$flong = $longitude + $dlong;
463 463
 		$flat = $latitude + $dlat;
464 464
 */
465
-		return array('latitude' => $flat,'longitude' => $flong);
465
+		return array('latitude' => $flat, 'longitude' => $flong);
466 466
 	}
467 467
 
468 468
 	/**
@@ -476,14 +476,14 @@  discard block
 block discarded – undo
476 476
 	 * @param integer $level GZIP compression level (default: 9)
477 477
 	 * @return string New filename (with .gz appended) if success, or false if operation fails
478 478
 	 */
479
-	public function gzCompressFile($source, $level = 9){ 
480
-		$dest = $source . '.gz'; 
481
-		$mode = 'wb' . $level; 
479
+	public function gzCompressFile($source, $level = 9) { 
480
+		$dest = $source.'.gz'; 
481
+		$mode = 'wb'.$level; 
482 482
 		$error = false; 
483 483
 		if ($fp_out = gzopen($dest, $mode)) { 
484
-			if ($fp_in = fopen($source,'rb')) { 
484
+			if ($fp_in = fopen($source, 'rb')) { 
485 485
 				while (!feof($fp_in)) 
486
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
486
+					gzwrite($fp_out, fread($fp_in, 1024*512)); 
487 487
 				fclose($fp_in); 
488 488
 			} else {
489 489
 				$error = true; 
@@ -499,7 +499,7 @@  discard block
 block discarded – undo
499 499
 	} 
500 500
 	
501 501
 	public function remove_accents($string) {
502
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
502
+		if (!preg_match('/[\x80-\xff]/', $string)) return $string;
503 503
 		$chars = array(
504 504
 		    // Decompositions for Latin-1 Supplement
505 505
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
557 557
 		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
558 558
 		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
559
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
559
+		    chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij',
560 560
 		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
561 561
 		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
562 562
 		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
@@ -572,13 +572,13 @@  discard block
 block discarded – undo
572 572
 		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
573 573
 		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
574 574
 		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
575
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
576
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
577
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
578
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
579
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
580
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
581
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
575
+		    chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
576
+		    chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
577
+		    chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
578
+		    chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
579
+		    chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
580
+		    chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
581
+		    chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
582 582
 		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
583 583
 		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
584 584
 		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 		for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) {
613 613
 			if (is_numeric($string[$i]) && $concat_flag) {
614 614
 				$int .= $string[$i];
615
-			} elseif(!$concat && $concat_flag && strlen($int) > 0) {
615
+			} elseif (!$concat && $concat_flag && strlen($int) > 0) {
616 616
 				$concat_flag = false;
617 617
 			}
618 618
 		}
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 			$slice = array_slice($arr, $offset + 1, $length);
659 659
 			return implode("", $slice);
660 660
 		} else {
661
-			return mb_substr($string,$offset,$length,'UTF-8');
661
+			return mb_substr($string, $offset, $length, 'UTF-8');
662 662
 		}
663 663
 	}
664 664
 
@@ -668,14 +668,14 @@  discard block
 block discarded – undo
668 668
 		//NOTE: use a trailing slash for folders!!!
669 669
 		//see http://bugs.php.net/bug.php?id=27609
670 670
 		//see http://bugs.php.net/bug.php?id=30931
671
-		if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
671
+		if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path
672 672
 			return $this->is__writable($path.uniqid(mt_rand()).'.tmp');
673 673
 		else if (is_dir($path))
674 674
 			return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
675 675
 		// check tmp file for read/write capabilities
676 676
 		$rm = file_exists($path);
677 677
 		$f = @fopen($path, 'a');
678
-		if ($f===false)
678
+		if ($f === false)
679 679
 			return false;
680 680
 		fclose($f);
681 681
 		if (!$rm)
Please login to merge, or discard this patch.