Completed
Push — master ( 7790d6...77bf2e )
by Yannick
10:45
created
owner-statistics-aircraft.php 3 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,23 +9,23 @@  discard block
 block discarded – undo
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
18
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
19 19
 $archive = false;
20
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
20
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
21 21
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
22 22
 	$archive = true;
23
-	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
23
+	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
24 24
 }
25 25
 
26 26
 if (!empty($spotter_array))
27 27
 {
28
-	$title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['aircraft_owner']);
28
+	$title = sprintf(_("Most Common Aircraft of %s"), $spotter_array[0]['aircraft_owner']);
29 29
 	require_once('header.php');
30 30
 	print '<div class="info column">';
31 31
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
 	include('owner-sub-menu.php');
37 37
 	print '<div class="column">';
38 38
 	print '<h2>'._("Most Common Aircraft").'</h2>';
39
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
39
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
40 40
 
41 41
 	if ($archive === false) {
42
-		$aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner,$filter);
42
+		$aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner, $filter);
43 43
 	} else {
44
-		$aircraft_array = $SpotterArchive->countAllAircraftTypesByOwner($owner,$filter);
44
+		$aircraft_array = $SpotterArchive->countAllAircraftTypesByOwner($owner, $filter);
45 45
 	}
46 46
 	if (!empty($aircraft_array))
47 47
 	{
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 		print '</thead>';
55 55
 		print '<tbody>';
56 56
 		$i = 1;
57
-		foreach($aircraft_array as $aircraft_item)
57
+		foreach ($aircraft_array as $aircraft_item)
58 58
 		{
59 59
 			print '<tr>';
60 60
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.SpotterArchive.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['owner'])) {
7
-        header('Location: '.$globalURL.'/owner');
8
-        die();
7
+		header('Location: '.$globalURL.'/owner');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-detailed.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
 //require_once('require/class.SpotterLive.php');
8 8
 require_once('require/class.SpotterArchive.php');
9 9
 
10
-if (!isset($_GET['owner'])){
10
+if (!isset($_GET['owner'])) {
11 11
 	header('Location: '.$globalURL.'');
12 12
 } else {
13 13
 	$Spotter = new Spotter();
14 14
 	$SpotterArchive = new SpotterArchive();
15 15
 	//$Translation = new Translation();
16 16
 	//calculuation for the pagination
17
-	if(!isset($_GET['limit']))
17
+	if (!isset($_GET['limit']))
18 18
 	{
19 19
 		$limit_start = 0;
20 20
 		$limit_end = 25;
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	} else {
23 23
 		$limit_explode = explode(",", $_GET['limit']);
24 24
 		if (isset($limit_explode[1])) {
25
-			$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
26
-			$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
25
+			$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
26
+			$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
27 27
 		} else {
28 28
 			$limit_start = 0;
29 29
 			$limit_end = 25;
@@ -40,21 +40,21 @@  discard block
 block discarded – undo
40 40
 	
41 41
 	$page_url = $globalURL.'/owner/'.$_GET['owner'];
42 42
 	
43
-	$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
44
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
45
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
43
+	$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
44
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
45
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
46
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
47 47
 	$filter = array();
48
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
49
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
50
-	$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
48
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
49
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
50
+	$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter);
51 51
 	if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
52
-		$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
52
+		$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter);
53 53
 	}
54 54
 
55 55
 	if (!empty($spotter_array))
56 56
 	{
57
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
57
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']);
58 58
 		//$ident = $spotter_array[0]['ident'];
59 59
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60 60
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -65,23 +65,23 @@  discard block
 block discarded – undo
65 65
 		$Stats = new Stats();
66 66
 		if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
67 67
 		else $flights = 0;
68
-		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
68
+		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner, $filter);
69 69
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
70
-		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
70
+		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner, $filter));
71 71
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
72
-		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter));
72
+		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner, $filter));
73 73
 		print '<div><span class="label">'._("Aircraft").'</span>'.$aircraft_registration.'</div>';
74
-		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter));
74
+		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner, $filter));
75 75
 		print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
76
-		$airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
76
+		$airlines = count($Spotter->countAllAirlinesByOwner($owner, $filter));
77 77
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
78
-		$duration = $Spotter->getFlightDurationByOwner($owner,$filter);
78
+		$duration = $Spotter->getFlightDurationByOwner($owner, $filter);
79 79
 		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
80 80
 		print '</div>';
81 81
 	
82 82
 		include('owner-sub-menu.php');
83 83
 		print '<div class="table column">';
84
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
84
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
85 85
 
86 86
 		include('table-output.php'); 
87 87
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,8 +45,12 @@  discard block
 block discarded – undo
45 45
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46 46
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
47 47
 	$filter = array();
48
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
49
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
48
+	if ($year != '') {
49
+		$filter = array_merge($filter,array('year' => $year));
50
+	}
51
+	if ($month != '') {
52
+		$filter = array_merge($filter,array('month' => $month));
53
+	}
50 54
 	$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
51 55
 	if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
52 56
 		$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -56,16 +60,25 @@  discard block
 block discarded – undo
56 60
 	{
57 61
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
58 62
 		//$ident = $spotter_array[0]['ident'];
59
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
63
+		if (isset($spotter_array[0]['latitude'])) {
64
+			$latitude = $spotter_array[0]['latitude'];
65
+		}
66
+		if (isset($spotter_array[0]['longitude'])) {
67
+			$longitude = $spotter_array[0]['longitude'];
68
+		}
61 69
 		require_once('header.php');
62 70
 		print '<div class="info column">';
63 71
 		print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
64 72
 		//print '<div><span class="label">'._("Owner").'</span>'.$spotter_array[0]['aircraft_owner'].'</div>';
65 73
 		$Stats = new Stats();
66
-		if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
67
-		else $flights = 0;
68
-		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
74
+		if ($year == '' && $month == '') {
75
+			$flights = $Stats->getStatsOwner($owner);
76
+		} else {
77
+			$flights = 0;
78
+		}
79
+		if ($flights == 0) {
80
+			$flights = $Spotter->countFlightsByOwner($owner,$filter);
81
+		}
69 82
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
70 83
 		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
71 84
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
@@ -76,7 +89,9 @@  discard block
 block discarded – undo
76 89
 		$airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
77 90
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
78 91
 		$duration = $Spotter->getFlightDurationByOwner($owner,$filter);
79
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
92
+		if ($duration != '0') {
93
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
94
+		}
80 95
 		print '</div>';
81 96
 	
82 97
 		include('owner-sub-menu.php');
Please login to merge, or discard this patch.
owner-statistics-arrival-airport.php 3 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,22 +9,22 @@  discard block
 block discarded – undo
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
18
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
19 19
 $archive = false;
20
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
20
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
21 21
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
22 22
 	$archive = true;
23
-	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
23
+	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
24 24
 }
25 25
 if (!empty($spotter_array))
26 26
 {
27
-	$title = sprintf(_("Most Common Arrival Airports of %s"),$spotter_array[0]['aircraft_owner']);
27
+	$title = sprintf(_("Most Common Arrival Airports of %s"), $spotter_array[0]['aircraft_owner']);
28 28
 	require_once('header.php');
29 29
 	print '<div class="info column">';
30 30
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	include('owner-sub-menu.php');
36 36
 	print '<div class="column">';
37 37
 	print '<h2>'._("Most Common Arrival Airports").'</h2>';
38
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
38
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
39 39
 	if ($archive === false) {
40
-		$airport_airport_array = $Spotter->countAllArrivalAirportsByOwner($owner,$filter);
40
+		$airport_airport_array = $Spotter->countAllArrivalAirportsByOwner($owner, $filter);
41 41
 	} else {
42
-		$airport_airport_array = $SpotterArchive->countAllArrivalAirportsByOwner($owner,$filter);
42
+		$airport_airport_array = $SpotterArchive->countAllArrivalAirportsByOwner($owner, $filter);
43 43
 	}
44 44
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
45 45
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	print '<script>';
49 49
 	print 'var series = [';
50 50
 	$airport_data = '';
51
-	foreach($airport_airport_array as $airport_item)
51
+	foreach ($airport_airport_array as $airport_item)
52 52
 	{
53 53
 		$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_name'].' ('.$airport_item['airport_arrival_icao'].')",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
54 54
 	}
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
 	print '</thead>';
104 104
 	print '<tbody>';
105 105
 	$i = 1;
106
-	foreach($airport_airport_array as $airport_item)
106
+	foreach ($airport_airport_array as $airport_item)
107 107
 	{
108 108
 		print '<tr>';
109 109
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.SpotterArchive.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['owner'])) {
7
-        header('Location: '.$globalURL.'/owner');
8
-        die();
7
+		header('Location: '.$globalURL.'/owner');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-statistics-route.php 3 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,22 +9,22 @@  discard block
 block discarded – undo
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
18
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
19 19
 $archive = false;
20
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
20
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
21 21
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
22 22
 	$archive = true;
23
-	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
23
+	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
24 24
 }
25 25
 if (!empty($spotter_array))
26 26
 {
27
-	$title = sprintf(_("Most Common Routes of %s"),$spotter_array[0]['aircraft_owner']);
27
+	$title = sprintf(_("Most Common Routes of %s"), $spotter_array[0]['aircraft_owner']);
28 28
 	require_once('header.php');
29 29
 	print '<div class="info column">';
30 30
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 	include('owner-sub-menu.php');
36 36
 	print '<div class="column">';
37 37
 	print '<h2>'._("Most Common Routes").'</h2>';
38
-	print '<p>'.sprintf(_("The statistic below shows the most common routes from flights owner by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
38
+	print '<p>'.sprintf(_("The statistic below shows the most common routes from flights owner by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
39 39
 	if ($archive === false) {
40
-		$route_array = $Spotter->countAllRoutesByOwner($owner,$filter);
40
+		$route_array = $Spotter->countAllRoutesByOwner($owner, $filter);
41 41
 	} else {
42
-		$route_array = $SpotterArchive->countAllRoutesByOwner($owner,$filter);
42
+		$route_array = $SpotterArchive->countAllRoutesByOwner($owner, $filter);
43 43
 	}
44 44
 	if (!empty($route_array))
45 45
 	{
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		print '</thead>';
56 56
 		print '<tbody>';
57 57
 		$i = 1;
58
-		foreach($route_array as $route_item)
58
+		foreach ($route_array as $route_item)
59 59
 		{
60 60
 			print '<tr>';
61 61
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.SpotterArchive.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['owner'])) {
7
-        header('Location: '.$globalURL.'/owner');
8
-        die();
7
+		header('Location: '.$globalURL.'/owner');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-statistics-manufacturer.php 3 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,21 +9,21 @@  discard block
 block discarded – undo
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
18
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
19 19
 $archive = false;
20
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
20
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
21 21
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
22
-	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
22
+	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
23 23
 }
24 24
 if (!empty($spotter_array))
25 25
 {
26
-	$title = sprintf(_("Most Common Aircraft Manufacturer of %s"),$spotter_array[0]['aircraft_owner']);
26
+	$title = sprintf(_("Most Common Aircraft Manufacturer of %s"), $spotter_array[0]['aircraft_owner']);
27 27
 	require_once('header.php');
28 28
 	print '<div class="info column">';
29 29
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
 	include('owner-sub-menu.php');
35 35
 	print '<div class="column">';
36 36
 	print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>';
37
-	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
37
+	print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
38 38
 
39 39
 	if ($archive === false) {
40
-		$manufacturers_array = $Spotter->countAllAircraftManufacturerByOwner($owner,$filter);
40
+		$manufacturers_array = $Spotter->countAllAircraftManufacturerByOwner($owner, $filter);
41 41
 	} else {
42
-		$manufacturers_array = $SpotterArchive->countAllAircraftManufacturerByOwner($owner,$filter);
42
+		$manufacturers_array = $SpotterArchive->countAllAircraftManufacturerByOwner($owner, $filter);
43 43
 	}
44 44
 	if (!empty($manufacturers_array))
45 45
 	{
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 		print '</thead>';
54 54
 		print '<tbody>';
55 55
 		$i = 1;
56
-		foreach($manufacturers_array as $manufacturer_item)
56
+		foreach ($manufacturers_array as $manufacturer_item)
57 57
 		{
58 58
 			print '<tr>';
59 59
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.SpotterArchive.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['owner'])) {
7
-        header('Location: '.$globalURL.'/owner');
8
-        die();
7
+		header('Location: '.$globalURL.'/owner');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-statistics-departure-airport-country.php 3 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -9,22 +9,22 @@  discard block
 block discarded – undo
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
18
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
19 19
 $archive = false;
20
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
20
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
21 21
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
22 22
 	$archive = true;
23
-	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
23
+	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
24 24
 }
25 25
 if (!empty($spotter_array))
26 26
 {
27
-	$title = sprintf(_("Most Common Departure Airports by Owner of %s"),$spotter_array[0]['aircraft_owner']);
27
+	$title = sprintf(_("Most Common Departure Airports by Owner of %s"), $spotter_array[0]['aircraft_owner']);
28 28
 	require_once('header.php');
29 29
 	print '<div class="info column">';
30 30
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	include('owner-sub-menu.php');
35 35
 	print '<div class="column">';
36 36
 	print '<h2>'._("Most Common Departure Airports by Country").'</h2>';
37
-	print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
37
+	print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
38 38
 	if ($archive === false) {
39
-		$airport_country_array = $Spotter->countAllDepartureAirportCountriesByOwner($owner,$filter);
39
+		$airport_country_array = $Spotter->countAllDepartureAirportCountriesByOwner($owner, $filter);
40 40
 	} else {
41
-		$airport_country_array = $SpotterArchive->countAllDepartureAirportCountriesByOwner($owner,$filter);
41
+		$airport_country_array = $SpotterArchive->countAllDepartureAirportCountriesByOwner($owner, $filter);
42 42
 	}
43 43
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
44 44
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	print '<div id="chartCountry" class="chart" width="100%"></div><script>';
47 47
 	print 'var series = [';
48 48
 	$country_data = '';
49
-	foreach($airport_country_array as $airport_item)
49
+	foreach ($airport_country_array as $airport_item)
50 50
 	{
51 51
 		$country_data .= '[ "'.$airport_item['airport_departure_country_iso3'].'",'.$airport_item['airport_departure_country_count'].'],';
52 52
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 		print '</thead>';
94 94
 		print '<tbody>';
95 95
 		$i = 1;
96
-		foreach($airport_country_array as $airport_item)
96
+		foreach ($airport_country_array as $airport_item)
97 97
 		{
98 98
 			print '<tr>';
99 99
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.SpotterArchive.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['owner'])) {
7
-        header('Location: '.$globalURL.'/owner');
8
-        die();
7
+		header('Location: '.$globalURL.'/owner');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-statistics-airline.php 3 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,22 +9,22 @@  discard block
 block discarded – undo
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
18
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
19 19
 $archive = false;
20
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
20
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
21 21
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
22 22
 	$archive = true;
23
-	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
23
+	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
24 24
 }
25 25
 if (!empty($spotter_array))
26 26
 {
27
-	$title = sprintf(_("Most Common Airlines of %s"),$spotter_array[0]['aircraft_owner']);
27
+	$title = sprintf(_("Most Common Airlines of %s"), $spotter_array[0]['aircraft_owner']);
28 28
 	require_once('header.php');
29 29
 	print '<div class="info column">';
30 30
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 	include('owner-sub-menu.php');
36 36
 	print '<div class="column">';
37 37
 	print '<h2>'._("Most Common Airlines").'</h2>';
38
-	print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
38
+	print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
39 39
 
40 40
 	if ($archive === false) {
41
-		$airline_array = $Spotter->countAllAirlinesByOwner($owner,$filter);
41
+		$airline_array = $Spotter->countAllAirlinesByOwner($owner, $filter);
42 42
 	} else {
43
-		$airline_array = $SpotterArchive->countAllAirlinesByOwner($owner,$filter);
43
+		$airline_array = $SpotterArchive->countAllAirlinesByOwner($owner, $filter);
44 44
 	}
45 45
 	if (!empty($airline_array))
46 46
 	{
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		print '</thead>';
57 57
 		print '<tbody>';
58 58
 		$i = 1;
59
-		foreach($airline_array as $airline_item)
59
+		foreach ($airline_array as $airline_item)
60 60
 		{
61 61
 			print '<tr>';
62 62
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.SpotterArchive.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['owner'])) {
7
-        header('Location: '.$globalURL.'/owner');
8
-        die();
7
+		header('Location: '.$globalURL.'/owner');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
require/class.Weather.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -11,12 +11,12 @@  discard block
 block discarded – undo
11 11
 	public function buildcloudlayer($metar) {
12 12
 		//print_r($metar);
13 13
 		$result = array();
14
-		foreach($metar['cloud'] as $key => $data) {
14
+		foreach ($metar['cloud'] as $key => $data) {
15 15
 			$alt_m = $metar['cloud'][$key]['level'];
16 16
 			$alt_ft = $alt_m*3.28084;
17 17
 			$pressure = $metar['QNH'];
18
-			$cumulus_base = 122.0 * ($metar['temperature'] - $metar['dew']);
19
-			$stratus_base = 100.0 * (100.0 * $metar['rh'])*0.3048;
18
+			$cumulus_base = 122.0*($metar['temperature'] - $metar['dew']);
19
+			$stratus_base = 100.0*(100.0*$metar['rh'])*0.3048;
20 20
 			$coverage_norm = 0.0;
21 21
 			if ($metar['cloud'][$key]['type'] == 'Few') {
22 22
 				$coverage_norm = 2.0/8.0;
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 					$layer_type = 'ns';
39 39
 				}
40 40
 			} else {
41
-				if ($cumulus_base * 0.80 < $alt_m && $cumulus_base * 1.20 > $alt_m) {
41
+				if ($cumulus_base*0.80 < $alt_m && $cumulus_base*1.20 > $alt_m) {
42 42
 					$layer_type = 'cu';
43
-				} elseif ($stratus_base * 0.80 < $alt_m && $stratus_base * 1.40 > $alt_m) {
43
+				} elseif ($stratus_base*0.80 < $alt_m && $stratus_base*1.40 > $alt_m) {
44 44
 					$layer_type = 'st';
45 45
 				} else {
46 46
 					if ($alt_ft < 2000) {
@@ -53,25 +53,25 @@  discard block
 block discarded – undo
53 53
 				}
54 54
 			}
55 55
 			//echo 'coverage norm : '.$coverage_norm.' - layer_type: '.$layer_type."\n";
56
-			$result[] = array('cov' => $coverage_norm, 'type' => $layer_type,'alt' => $alt_m,'rh' => $metar['rh']);
56
+			$result[] = array('cov' => $coverage_norm, 'type' => $layer_type, 'alt' => $alt_m, 'rh' => $metar['rh']);
57 57
 		}
58 58
 		if (count($result) < 2 && $metar['rh'] > 60) {
59
-			$result[] = array('cov' => 0.75, 'type' => 'ci','alt' => 4000,'rh' => $metar['rh']);
59
+			$result[] = array('cov' => 0.75, 'type' => 'ci', 'alt' => 4000, 'rh' => $metar['rh']);
60 60
 		}
61 61
 		return $result;
62 62
 	}
63 63
 	
64
-	public function openweathermap($latitude,$longitude) {
64
+	public function openweathermap($latitude, $longitude) {
65 65
 		global $globalOpenWeatherMapKey;
66 66
 		if ($globalOpenWeatherMapKey == '') return array();
67 67
 		$Common = new Common();
68 68
 		$url = 'http://api.openweathermap.org/data/2.5/weather?lat='.$latitude.'&lon='.$longitude.'&units=metric&appid='.$globalOpenWeatherMapKey;
69 69
 		//echo $url."\n";
70
-		$weatherdata = json_decode($Common->getData($url),true);
71
-		if (!isset($weatherdata['main']['temp']) || !isset($weatherdata['weather'][0]['id'])) return array('clouds' => array(),'rain' => array());
72
-		$dew = $weatherdata['main']['temp'] - ((100-$weatherdata['main']['humidity'])/5);
73
-		$cumulus_base = 122.0 * ($weatherdata['main']['temp'] - $dew);
74
-		$stratus_base = 100.0 * (100.0 * $weatherdata['main']['humidity'])*0.3048;
70
+		$weatherdata = json_decode($Common->getData($url), true);
71
+		if (!isset($weatherdata['main']['temp']) || !isset($weatherdata['weather'][0]['id'])) return array('clouds' => array(), 'rain' => array());
72
+		$dew = $weatherdata['main']['temp'] - ((100 - $weatherdata['main']['humidity'])/5);
73
+		$cumulus_base = 122.0*($weatherdata['main']['temp'] - $dew);
74
+		$stratus_base = 100.0*(100.0*$weatherdata['main']['humidity'])*0.3048;
75 75
 		$coverage_norm = 0.0;
76 76
 		if ($weatherdata['weather'][0]['id'] == 801) {
77 77
 			// few clouds
@@ -87,19 +87,19 @@  discard block
 block discarded – undo
87 87
 			$coverage_norm = 8.0/8.0;
88 88
 		}
89 89
 		$alt_m = 1000;
90
-		if ($cumulus_base * 0.80 < $alt_m && $cumulus_base * 1.20 > $alt_m) {
90
+		if ($cumulus_base*0.80 < $alt_m && $cumulus_base*1.20 > $alt_m) {
91 91
 			$layer_type = 'cu';
92
-		} elseif ($stratus_base * 0.80 < $alt_m && $stratus_base * 1.40 > $alt_m) {
92
+		} elseif ($stratus_base*0.80 < $alt_m && $stratus_base*1.40 > $alt_m) {
93 93
 			$layer_type = 'st';
94 94
 		} else {
95 95
 			$layer_type = 'st';
96 96
 		}
97 97
 		$result = array();
98
-		$result[] = array('cov' => $coverage_norm, 'type' => $layer_type,'alt' => $alt_m,'rh' => $weatherdata['main']['humidity']);
98
+		$result[] = array('cov' => $coverage_norm, 'type' => $layer_type, 'alt' => $alt_m, 'rh' => $weatherdata['main']['humidity']);
99 99
 		if ($weatherdata['main']['humidity'] > 60) {
100
-			$result[] = array('cov' => 0.75, 'type' => 'ci','alt' => 4000,'rh' => $weatherdata['main']['humidity']);
100
+			$result[] = array('cov' => 0.75, 'type' => 'ci', 'alt' => 4000, 'rh' => $weatherdata['main']['humidity']);
101 101
 		}
102
-		return array('clouds' => $result,'rain' => array('tmp' => $weatherdata['main']['temp'],'rh' => $weatherdata['main']['humidity']));
102
+		return array('clouds' => $result, 'rain' => array('tmp' => $weatherdata['main']['temp'], 'rh' => $weatherdata['main']['humidity']));
103 103
 	}
104 104
 	
105 105
 	public function nomad_wind($hour = '') {
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
 		
118 118
 		// http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_0p50.pl?file=gfs.t05z.pgrb2full.0p50.f000&lev_10_m_above_ground=on&lev_surface=on&var_TMP=on&var_UGRD=on&var_VGRD=on&leftlon=0&rightlon=360&toplat=90&bottomlat=-90&dir=/gfs.2017111717
119 119
 		$resolution = '0.5';
120
-		$baseurl = 'http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_'.($resolution === '1' ? '1p00':'0p50').'.pl';
121
-		$get = array('file' => 'gfs.t'.sprintf('%02d',(6*floor($hour/6))).($resolution === '1' ? 'z.pgrb2.1p00.f000' : 'z.pgrb2full.0p50.f000'),
120
+		$baseurl = 'http://nomads.ncep.noaa.gov/cgi-bin/filter_gfs_'.($resolution === '1' ? '1p00' : '0p50').'.pl';
121
+		$get = array('file' => 'gfs.t'.sprintf('%02d', (6*floor($hour/6))).($resolution === '1' ? 'z.pgrb2.1p00.f000' : 'z.pgrb2full.0p50.f000'),
122 122
 			'lev_10_m_above_ground' => 'on',
123 123
 			'lev_surface' => 'on',
124 124
 			'var_TMP' => 'on',
@@ -128,21 +128,21 @@  discard block
 block discarded – undo
128 128
 			'rightlon' => 360,
129 129
 			'toplat' => 90,
130 130
 			'bottomlat' => -90,
131
-			'dir' => '/gfs.'.date('Ymd').sprintf('%02d',(6*floor($hour/6)))
131
+			'dir' => '/gfs.'.date('Ymd').sprintf('%02d', (6*floor($hour/6)))
132 132
 		);
133 133
 		$url = $baseurl.'?'.http_build_query($get);
134 134
 		//echo $url;
135 135
 		$Common = new Common();
136
-		$Common->download($url,$windpathsrc);
136
+		$Common->download($url, $windpathsrc);
137 137
 		// Check if the downloaded file is in GRIB format
138
-		$file = fopen($windpathsrc,"r");
138
+		$file = fopen($windpathsrc, "r");
139 139
 		$firc = fgetc($file);
140 140
 		fclose($file);
141 141
 		if ($firc == 'G') {
142 142
 			system($grib2json.' --data --output '.$windpathdest.' --names --compact '.$windpathsrc);
143 143
 		} else {
144 144
 			// if not try previous run
145
-			if ($hour == date('G')) $this->nomad_wind(date('G')-6);
145
+			if ($hour == date('G')) $this->nomad_wind(date('G') - 6);
146 146
 		}
147 147
 	}
148 148
 
@@ -161,10 +161,10 @@  discard block
 block discarded – undo
161 161
 		$url = 'https://podaac.jpl.nasa.gov/ws/search/granule/?datasetId=PODAAC-OSCAR-03D01&itemsPerPage=1&sortBy=timeDesc&format=atom&pretty=false';
162 162
 		$Common = new Common();
163 163
 		$oscarlst = $Common->getData($url);
164
-		$oscarlst_xml = json_decode(json_encode(simplexml_load_string($oscarlst)),true);
164
+		$oscarlst_xml = json_decode(json_encode(simplexml_load_string($oscarlst)), true);
165 165
 		foreach ($oscarlst_xml['entry']['link'] as $oscarlnk) {
166 166
 			if ($oscarlnk['@attributes']['type'] == 'application/x-netcdf') {
167
-				$Common->download($oscarlnk['@attributes']['href'],$wavepathsrc.'.gz');
167
+				$Common->download($oscarlnk['@attributes']['href'], $wavepathsrc.'.gz');
168 168
 				break;
169 169
 			}
170 170
 		}
Please login to merge, or discard this patch.
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -63,12 +63,16 @@  discard block
 block discarded – undo
63 63
 	
64 64
 	public function openweathermap($latitude,$longitude) {
65 65
 		global $globalOpenWeatherMapKey;
66
-		if ($globalOpenWeatherMapKey == '') return array();
66
+		if ($globalOpenWeatherMapKey == '') {
67
+			return array();
68
+		}
67 69
 		$Common = new Common();
68 70
 		$url = 'http://api.openweathermap.org/data/2.5/weather?lat='.$latitude.'&lon='.$longitude.'&units=metric&appid='.$globalOpenWeatherMapKey;
69 71
 		//echo $url."\n";
70 72
 		$weatherdata = json_decode($Common->getData($url),true);
71
-		if (!isset($weatherdata['main']['temp']) || !isset($weatherdata['weather'][0]['id'])) return array('clouds' => array(),'rain' => array());
73
+		if (!isset($weatherdata['main']['temp']) || !isset($weatherdata['weather'][0]['id'])) {
74
+			return array('clouds' => array(),'rain' => array());
75
+		}
72 76
 		$dew = $weatherdata['main']['temp'] - ((100-$weatherdata['main']['humidity'])/5);
73 77
 		$cumulus_base = 122.0 * ($weatherdata['main']['temp'] - $dew);
74 78
 		$stratus_base = 100.0 * (100.0 * $weatherdata['main']['humidity'])*0.3048;
@@ -104,7 +108,9 @@  discard block
 block discarded – undo
104 108
 	
105 109
 	public function nomad_wind($hour = '') {
106 110
 		global $globalWindsPath;
107
-		if ($hour == '') $hour = date('G');
111
+		if ($hour == '') {
112
+			$hour = date('G');
113
+		}
108 114
 		if (isset($globalWindsPath) && $globalWindsPath != '') {
109 115
 			$grib2json = $globalWindsPath['grib2json'];
110 116
 			$windpathsrc = $globalWindsPath['source'];
@@ -142,7 +148,9 @@  discard block
 block discarded – undo
142 148
 			system($grib2json.' --data --output '.$windpathdest.' --names --compact '.$windpathsrc);
143 149
 		} else {
144 150
 			// if not try previous run
145
-			if ($hour == date('G')) $this->nomad_wind(date('G')-6);
151
+			if ($hour == date('G')) {
152
+				$this->nomad_wind(date('G')-6);
153
+			}
146 154
 		}
147 155
 	}
148 156
 
Please login to merge, or discard this patch.
require/class.Common.php 4 patches
Doc Comments   +14 added lines, -1 removed lines patch added patch discarded remove patch
@@ -133,6 +133,9 @@  discard block
 block discarded – undo
133 133
 		fclose($fp);
134 134
 	}
135 135
 
136
+	/**
137
+	 * @param string $in_file
138
+	 */
136 139
 	public static function gunzip($in_file,$out_file_name = '') {
137 140
 		//echo $in_file.' -> '.$out_file_name."\n";
138 141
 		$buffer_size = 4096; // read 4kb at a time
@@ -318,6 +321,9 @@  discard block
 block discarded – undo
318 321
 	}
319 322
 
320 323
 
324
+	/**
325
+	 * @param string $latlong
326
+	 */
321 327
 	public function convertDec($dms,$latlong) {
322 328
 		if ($latlong == 'latitude') {
323 329
 			$deg = substr($dms, 0, 2);
@@ -352,6 +358,9 @@  discard block
 block discarded – undo
352 358
 		return array('latitude' => round($latitude,5),'longitude' => round($longitude,5));
353 359
 	}
354 360
 	
361
+	/**
362
+	 * @param string $latlong
363
+	 */
355 364
 	public function convertDM($coord,$latlong) {
356 365
 		if ($latlong == 'latitude') {
357 366
 			if ($coord < 0) $NSEW = 'S';
@@ -504,7 +513,7 @@  discard block
 block discarded – undo
504 513
 	/**
505 514
 	* Returns list of available locales
506 515
 	*
507
-	* @return array
516
+	* @return string[]
508 517
 	 */
509 518
 	public function listLocaleDir()
510 519
 	{
@@ -765,6 +774,10 @@  discard block
 block discarded – undo
765 774
 	}
766 775
 
767 776
 	// Come from comment : http://php.net/manual/fr/function.is-writable.php#73596
777
+
778
+	/**
779
+	 * @param string $path
780
+	 */
768 781
 	public function is__writable($path) {
769 782
 		//will work in despite of Windows ACLs bug
770 783
 		//NOTE: use a trailing slash for folders!!!
Please login to merge, or discard this patch.
Indentation   +160 added lines, -160 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 	//protected $cookies = array();
15 15
 	
16 16
 	/**
17
-	* Get data from form result
18
-	* @param String $url form URL
19
-	* @param String $type type of submit form method (get or post)
20
-	* @param String|array $data values form post method
21
-	* @param array $headers header to submit with the form
22
-	* @return String the result
23
-	*/
17
+	 * Get data from form result
18
+	 * @param String $url form URL
19
+	 * @param String $type type of submit form method (get or post)
20
+	 * @param String|array $data values form post method
21
+	 * @param array $headers header to submit with the form
22
+	 * @return String the result
23
+	 */
24 24
 	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '', $sizelimit = false, $async = false, $getheaders = false) {
25 25
 		global $globalProxy, $globalForceIPv4;
26 26
 		$ch = curl_init();
@@ -175,10 +175,10 @@  discard block
 block discarded – undo
175 175
 	}
176 176
 
177 177
 	/**
178
-	* Convert a HTML table to an array
179
-	* @param String $data HTML page
180
-	* @return array array of the tables in HTML page
181
-	*/
178
+	 * Convert a HTML table to an array
179
+	 * @param String $data HTML page
180
+	 * @return array array of the tables in HTML page
181
+	 */
182 182
 	public function table2array($data) {
183 183
 		if (!is_string($data)) return array();
184 184
 		if ($data == '') return array();
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	}
213 213
 	
214 214
 	/**
215
-	* Convert <p> part of a HTML page to an array
216
-	* @param String $data HTML page
217
-	* @return array array of the <p> in HTML page
218
-	*/
215
+	 * Convert <p> part of a HTML page to an array
216
+	 * @param String $data HTML page
217
+	 * @return array array of the <p> in HTML page
218
+	 */
219 219
 	public function text2array($data) {
220 220
 		$html = str_get_html($data);
221 221
 		if ($html === false) return array();
@@ -230,14 +230,14 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 
232 232
 	/**
233
-	* Give distance between 2 coordonnates
234
-	* @param Float $lat latitude of first point
235
-	* @param Float $lon longitude of first point
236
-	* @param Float $latc latitude of second point
237
-	* @param Float $lonc longitude of second point
238
-	* @param String $unit km else no unit used
239
-	* @return Float Distance in $unit
240
-	*/
233
+	 * Give distance between 2 coordonnates
234
+	 * @param Float $lat latitude of first point
235
+	 * @param Float $lon longitude of first point
236
+	 * @param Float $latc latitude of second point
237
+	 * @param Float $lonc longitude of second point
238
+	 * @param String $unit km else no unit used
239
+	 * @return Float Distance in $unit
240
+	 */
241 241
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
242 242
 		if ($lat == $latc && $lon == $lonc) return 0;
243 243
 		$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;
@@ -255,12 +255,12 @@  discard block
 block discarded – undo
255 255
 	}
256 256
 
257 257
 	/**
258
-	* Give plunge between 2 altitudes and distance
259
-	* @param Float $initial_altitude altitude of first point in m
260
-	* @param Float $final_altitude altitude of second point in m
261
-	* @param String $distance distance between two points in m
262
-	* @return Float plunge
263
-	*/
258
+	 * Give plunge between 2 altitudes and distance
259
+	 * @param Float $initial_altitude altitude of first point in m
260
+	 * @param Float $final_altitude altitude of second point in m
261
+	 * @param String $distance distance between two points in m
262
+	 * @return Float plunge
263
+	 */
264 264
 	public function plunge($initial_altitude,$final_altitude,$distance) {
265 265
 		$plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance));
266 266
 		/*
@@ -274,13 +274,13 @@  discard block
 block discarded – undo
274 274
 	}
275 275
 
276 276
 	/**
277
-	* Give azimuth between 2 coordonnates
278
-	* @param Float $lat latitude of first point
279
-	* @param Float $lon longitude of first point
280
-	* @param Float $latc latitude of second point
281
-	* @param Float $lonc longitude of second point
282
-	* @return Float Azimuth
283
-	*/
277
+	 * Give azimuth between 2 coordonnates
278
+	 * @param Float $lat latitude of first point
279
+	 * @param Float $lon longitude of first point
280
+	 * @param Float $latc latitude of second point
281
+	 * @param Float $lonc longitude of second point
282
+	 * @return Float Azimuth
283
+	 */
284 284
 	public function azimuth($lat, $lon, $latc, $lonc) {
285 285
 		$dX = $latc - $lat;
286 286
 		$dY = $lonc - $lon;
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 	
292 292
 	
293 293
 	/**
294
-	* Check is distance realistic
295
-	* @param int $timeDifference the time between the reception of both messages
296
-	* @param float $distance distance covered
297
-	* @return bool whether distance is realistic
298
-	*/
294
+	 * Check is distance realistic
295
+	 * @param int $timeDifference the time between the reception of both messages
296
+	 * @param float $distance distance covered
297
+	 * @return bool whether distance is realistic
298
+	 */
299 299
 	public function withinThreshold ($timeDifference, $distance) {
300 300
 		$x = abs($timeDifference);
301 301
 		$d = abs($distance);
@@ -383,11 +383,11 @@  discard block
 block discarded – undo
383 383
 	}
384 384
 	
385 385
 	/**
386
-	* Copy folder contents
387
-	* @param       string   $source    Source path
388
-	* @param       string   $dest      Destination path
389
-	* @return      bool     Returns true on success, false on failure
390
-	*/
386
+	 * Copy folder contents
387
+	 * @param       string   $source    Source path
388
+	 * @param       string   $dest      Destination path
389
+	 * @return      bool     Returns true on success, false on failure
390
+	 */
391 391
 	public function xcopy($source, $dest)
392 392
 	{
393 393
 		$files = glob($source.'*.*');
@@ -399,20 +399,20 @@  discard block
 block discarded – undo
399 399
 	}
400 400
 	
401 401
 	/**
402
-	* Check if an url exist
403
-	* @param	String $url url to check
404
-	* @return	bool Return true on succes false on failure
405
-	*/
402
+	 * Check if an url exist
403
+	 * @param	String $url url to check
404
+	 * @return	bool Return true on succes false on failure
405
+	 */
406 406
 	public function urlexist($url){
407 407
 		$headers=get_headers($url);
408 408
 		return stripos($headers[0],"200 OK")?true:false;
409 409
 	}
410 410
 	
411 411
 	/**
412
-	* Convert hexa to string
413
-	* @param	String $hex data in hexa
414
-	* @return	String Return result
415
-	*/
412
+	 * Convert hexa to string
413
+	 * @param	String $hex data in hexa
414
+	 * @return	String Return result
415
+	 */
416 416
 	public function hex2str($hex) {
417 417
 		$str = '';
418 418
 		$hexln = strlen($hex);
@@ -421,10 +421,10 @@  discard block
 block discarded – undo
421 421
 	}
422 422
 	
423 423
 	/**
424
-	* Convert hexa color to rgb
425
-	* @param	String $hex data in hexa
426
-	* @return	String Return result
427
-	*/
424
+	 * Convert hexa color to rgb
425
+	 * @param	String $hex data in hexa
426
+	 * @return	String Return result
427
+	 */
428 428
 	public function hex2rgb($hex) {
429 429
 		$hex = str_replace('#','',$hex);
430 430
 		return sscanf($hex, "%02x%02x%02x"); 
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 	}
503 503
 	
504 504
 	/**
505
-	* Returns list of available locales
506
-	*
507
-	* @return array
505
+	 * Returns list of available locales
506
+	 *
507
+	 * @return array
508 508
 	 */
509 509
 	public function listLocaleDir()
510 510
 	{
@@ -603,100 +603,100 @@  discard block
 block discarded – undo
603 603
 	public function remove_accents($string) {
604 604
 		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
605 605
 		$chars = array(
606
-		    // Decompositions for Latin-1 Supplement
607
-		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
608
-		    chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
609
-		    chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
610
-		    chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
611
-		    chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
612
-		    chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
613
-		    chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
614
-		    chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
615
-		    chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
616
-		    chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
617
-		    chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
618
-		    chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
619
-		    chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
620
-		    chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
621
-		    chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
622
-		    chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
623
-		    chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
624
-		    chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
625
-		    chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
626
-		    chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
627
-		    chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
628
-		    chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
629
-		    chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
630
-		    chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
631
-		    chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
632
-		    chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
633
-		    chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
634
-		    chr(195).chr(191) => 'y',
635
-		    // Decompositions for Latin Extended-A
636
-		    chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
637
-		    chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
638
-		    chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
639
-		    chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
640
-		    chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
641
-		    chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
642
-		    chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
643
-		    chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
644
-		    chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
645
-		    chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
646
-		    chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
647
-		    chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
648
-		    chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
649
-		    chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
650
-		    chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
651
-		    chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
652
-		    chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
653
-		    chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
654
-		    chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
655
-		    chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
656
-		    chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
657
-		    chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
658
-		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
659
-		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
660
-		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
661
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
662
-		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
663
-		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
664
-		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
665
-		    chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
666
-		    chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
667
-		    chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
668
-		    chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
669
-		    chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
670
-		    chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
671
-		    chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
672
-		    chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
673
-		    chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
674
-		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
675
-		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
676
-		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
677
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
678
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
679
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
680
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
681
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
682
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
683
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
684
-		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
685
-		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
686
-		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
687
-		    chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
688
-		    chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
689
-		    chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
690
-		    chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
691
-		    chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
692
-		    chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
693
-		    chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
694
-		    chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
695
-		    chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
696
-		    chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
697
-		    chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
698
-		    chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
699
-		    chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
606
+			// Decompositions for Latin-1 Supplement
607
+			chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
608
+			chr(195).chr(130) => 'A', chr(195).chr(131) => 'A',
609
+			chr(195).chr(132) => 'A', chr(195).chr(133) => 'A',
610
+			chr(195).chr(135) => 'C', chr(195).chr(136) => 'E',
611
+			chr(195).chr(137) => 'E', chr(195).chr(138) => 'E',
612
+			chr(195).chr(139) => 'E', chr(195).chr(140) => 'I',
613
+			chr(195).chr(141) => 'I', chr(195).chr(142) => 'I',
614
+			chr(195).chr(143) => 'I', chr(195).chr(145) => 'N',
615
+			chr(195).chr(146) => 'O', chr(195).chr(147) => 'O',
616
+			chr(195).chr(148) => 'O', chr(195).chr(149) => 'O',
617
+			chr(195).chr(150) => 'O', chr(195).chr(153) => 'U',
618
+			chr(195).chr(154) => 'U', chr(195).chr(155) => 'U',
619
+			chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y',
620
+			chr(195).chr(159) => 's', chr(195).chr(160) => 'a',
621
+			chr(195).chr(161) => 'a', chr(195).chr(162) => 'a',
622
+			chr(195).chr(163) => 'a', chr(195).chr(164) => 'a',
623
+			chr(195).chr(165) => 'a', chr(195).chr(167) => 'c',
624
+			chr(195).chr(168) => 'e', chr(195).chr(169) => 'e',
625
+			chr(195).chr(170) => 'e', chr(195).chr(171) => 'e',
626
+			chr(195).chr(172) => 'i', chr(195).chr(173) => 'i',
627
+			chr(195).chr(174) => 'i', chr(195).chr(175) => 'i',
628
+			chr(195).chr(177) => 'n', chr(195).chr(178) => 'o',
629
+			chr(195).chr(179) => 'o', chr(195).chr(180) => 'o',
630
+			chr(195).chr(181) => 'o', chr(195).chr(182) => 'o',
631
+			chr(195).chr(182) => 'o', chr(195).chr(185) => 'u',
632
+			chr(195).chr(186) => 'u', chr(195).chr(187) => 'u',
633
+			chr(195).chr(188) => 'u', chr(195).chr(189) => 'y',
634
+			chr(195).chr(191) => 'y',
635
+			// Decompositions for Latin Extended-A
636
+			chr(196).chr(128) => 'A', chr(196).chr(129) => 'a',
637
+			chr(196).chr(130) => 'A', chr(196).chr(131) => 'a',
638
+			chr(196).chr(132) => 'A', chr(196).chr(133) => 'a',
639
+			chr(196).chr(134) => 'C', chr(196).chr(135) => 'c',
640
+			chr(196).chr(136) => 'C', chr(196).chr(137) => 'c',
641
+			chr(196).chr(138) => 'C', chr(196).chr(139) => 'c',
642
+			chr(196).chr(140) => 'C', chr(196).chr(141) => 'c',
643
+			chr(196).chr(142) => 'D', chr(196).chr(143) => 'd',
644
+			chr(196).chr(144) => 'D', chr(196).chr(145) => 'd',
645
+			chr(196).chr(146) => 'E', chr(196).chr(147) => 'e',
646
+			chr(196).chr(148) => 'E', chr(196).chr(149) => 'e',
647
+			chr(196).chr(150) => 'E', chr(196).chr(151) => 'e',
648
+			chr(196).chr(152) => 'E', chr(196).chr(153) => 'e',
649
+			chr(196).chr(154) => 'E', chr(196).chr(155) => 'e',
650
+			chr(196).chr(156) => 'G', chr(196).chr(157) => 'g',
651
+			chr(196).chr(158) => 'G', chr(196).chr(159) => 'g',
652
+			chr(196).chr(160) => 'G', chr(196).chr(161) => 'g',
653
+			chr(196).chr(162) => 'G', chr(196).chr(163) => 'g',
654
+			chr(196).chr(164) => 'H', chr(196).chr(165) => 'h',
655
+			chr(196).chr(166) => 'H', chr(196).chr(167) => 'h',
656
+			chr(196).chr(168) => 'I', chr(196).chr(169) => 'i',
657
+			chr(196).chr(170) => 'I', chr(196).chr(171) => 'i',
658
+			chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
659
+			chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
660
+			chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
661
+			chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
662
+			chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
663
+			chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
664
+			chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
665
+			chr(196).chr(186) => 'l', chr(196).chr(187) => 'L',
666
+			chr(196).chr(188) => 'l', chr(196).chr(189) => 'L',
667
+			chr(196).chr(190) => 'l', chr(196).chr(191) => 'L',
668
+			chr(197).chr(128) => 'l', chr(197).chr(129) => 'L',
669
+			chr(197).chr(130) => 'l', chr(197).chr(131) => 'N',
670
+			chr(197).chr(132) => 'n', chr(197).chr(133) => 'N',
671
+			chr(197).chr(134) => 'n', chr(197).chr(135) => 'N',
672
+			chr(197).chr(136) => 'n', chr(197).chr(137) => 'N',
673
+			chr(197).chr(138) => 'n', chr(197).chr(139) => 'N',
674
+			chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
675
+			chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
676
+			chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
677
+			chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
678
+			chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
679
+			chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
680
+			chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
681
+			chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
682
+			chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
683
+			chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
684
+			chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
685
+			chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
686
+			chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
687
+			chr(197).chr(166) => 'T', chr(197).chr(167) => 't',
688
+			chr(197).chr(168) => 'U', chr(197).chr(169) => 'u',
689
+			chr(197).chr(170) => 'U', chr(197).chr(171) => 'u',
690
+			chr(197).chr(172) => 'U', chr(197).chr(173) => 'u',
691
+			chr(197).chr(174) => 'U', chr(197).chr(175) => 'u',
692
+			chr(197).chr(176) => 'U', chr(197).chr(177) => 'u',
693
+			chr(197).chr(178) => 'U', chr(197).chr(179) => 'u',
694
+			chr(197).chr(180) => 'W', chr(197).chr(181) => 'w',
695
+			chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y',
696
+			chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z',
697
+			chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z',
698
+			chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z',
699
+			chr(197).chr(190) => 'z', chr(197).chr(191) => 's'
700 700
 		);
701 701
 		$string = strtr($string, $chars);
702 702
 		return $string;
@@ -837,7 +837,7 @@  discard block
 block discarded – undo
837 837
 			$dfX = $first_pass[$j][0];
838 838
 			$dfDiffLong = abs($dfX - $dfPrevX);
839 839
 			if ($dfDiffLong > $dfDiffSpace &&
840
-			    (($dfX > $dfLeftBorderX && $dfPrevX < $dfRightBorderX) || ($dfPrevX > $dfLeftBorderX && $dfX < $dfRightBorderX))) 
840
+				(($dfX > $dfLeftBorderX && $dfPrevX < $dfRightBorderX) || ($dfPrevX > $dfLeftBorderX && $dfX < $dfRightBorderX))) 
841 841
 			{
842 842
 				$bHasBigDiff = true;
843 843
 			} else if ($dfDiffLong > $dfMaxSmallDiffLong) {
@@ -857,8 +857,8 @@  discard block
 block discarded – undo
857 857
 					$dfX2 = floatval($first_pass[$k][0]);
858 858
 					$dfY2 = floatval($first_pass[$k][1]);
859 859
 					if ($dfX1 > -180 && $dfX1 < $dfRightBorderX && $dfX2 == 180 &&
860
-					    $k+1 < count($first_pass) &&
861
-					    $first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX)
860
+						$k+1 < count($first_pass) &&
861
+						$first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX)
862 862
 					{
863 863
 						$poNewLS[] = array(-180, $first_pass[$k][1]);
864 864
 						$k++;
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
 						$poNewLS[] = array($first_pass[$k][0], $first_pass[$k][1]);
867 867
 						continue;
868 868
 					} else if ($dfX1 > $dfLeftBorderX && $dfX1 < 180 && $dfX2 == -180 &&
869
-					    $k+1 < $first_pass_ln &&
870
-					    $first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180)
869
+						$k+1 < $first_pass_ln &&
870
+						$first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180)
871 871
 					{
872 872
 						$poNewLS[] = array(180, $first_pass[$k][1]);
873 873
 						$k++;
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -21,12 +21,12 @@  discard block
 block discarded – undo
21 21
 	* @param array $headers header to submit with the form
22 22
 	* @return String the result
23 23
 	*/
24
-	public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '', $sizelimit = false, $async = false, $getheaders = false) {
24
+	public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '', $sizelimit = false, $async = false, $getheaders = false) {
25 25
 		global $globalProxy, $globalForceIPv4;
26 26
 		$ch = curl_init();
27 27
 		curl_setopt($ch, CURLOPT_URL, $url);
28 28
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
29
-			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
29
+			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) {
30 30
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
31 31
 			}
32 32
 		}
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
38 38
 		curl_setopt($ch, CURLINFO_HEADER_OUT, true); 
39 39
 		if ($getheaders) curl_setopt($ch, CURLOPT_HEADER, 1); 
40
-		curl_setopt($ch,CURLOPT_ENCODING , "gzip");
40
+		curl_setopt($ch, CURLOPT_ENCODING, "gzip");
41 41
 		//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');
42 42
 //		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0');
43 43
 		if ($useragent == '') {
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
 			if (is_array($data)) {
54 54
 				curl_setopt($ch, CURLOPT_POST, count($data));
55 55
 				$data_string = '';
56
-				foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
56
+				foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; }
57 57
 				rtrim($data_string, '&');
58 58
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
59 59
 			} else {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 		}
66 66
 		if ($cookie != '') {
67 67
 			if (is_array($cookie)) {
68
-				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';'));
68
+				curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';'));
69 69
 			} else {
70 70
 				curl_setopt($ch, CURLOPT_COOKIE, $cookie);
71 71
 			}
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		if ($sizelimit === true) {
77 77
 			curl_setopt($ch, CURLOPT_BUFFERSIZE, 128);
78 78
 			curl_setopt($ch, CURLOPT_NOPROGRESS, false);
79
-			curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curlr,$downloadsize, $downloaded, $uploadsize, $uploaded){
79
+			curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curlr, $downloadsize, $downloaded, $uploadsize, $uploaded) {
80 80
 				return ($downloaded > (3*1024)) ? 1 : 0;
81 81
 			});
82 82
 		}
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 		$result = curl_exec($ch);
88 88
 		$info = curl_getinfo($ch);
89 89
 		curl_close($ch);
90
-		if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) {
90
+		if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) {
91 91
 			echo "Cloudflare Detected\n";
92 92
 			require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php');
93 93
 			$useragent = UAgent::random();
94 94
 			cloudflare::useUserAgent($useragent);
95 95
 			if ($clearanceCookie = cloudflare::bypass($url)) {
96
-				return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent);
96
+				return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent);
97 97
 			}
98 98
 		} else {
99 99
 			return $result;
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
119 119
 		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
120 120
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
121
-			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
121
+			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) {
122 122
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
123 123
 			}
124 124
 		}
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
 		fclose($fp);
134 134
 	}
135 135
 
136
-	public static function gunzip($in_file,$out_file_name = '') {
136
+	public static function gunzip($in_file, $out_file_name = '') {
137 137
 		//echo $in_file.' -> '.$out_file_name."\n";
138 138
 		$buffer_size = 4096; // read 4kb at a time
139 139
 		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
140 140
 		if ($in_file != '' && file_exists($in_file)) {
141 141
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
142
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
143
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
142
+			if (function_exists('gzopen')) $file = gzopen($in_file, 'rb');
143
+			elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb');
144 144
 			else {
145 145
 				echo 'gzopen not available';
146 146
 				die;
147 147
 			}
148 148
 			$out_file = fopen($out_file_name, 'wb'); 
149
-			while(!gzeof($file)) {
149
+			while (!gzeof($file)) {
150 150
 				fwrite($out_file, gzread($file, $buffer_size));
151 151
 			}  
152 152
 			fclose($out_file);
@@ -154,19 +154,19 @@  discard block
 block discarded – undo
154 154
 		}
155 155
 	}
156 156
 
157
-	public static function bunzip2($in_file,$out_file_name = '') {
157
+	public static function bunzip2($in_file, $out_file_name = '') {
158 158
 		//echo $in_file.' -> '.$out_file_name."\n";
159 159
 		$buffer_size = 4096; // read 4kb at a time
160 160
 		if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); 
161 161
 		if ($in_file != '' && file_exists($in_file)) {
162 162
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
163
-			if (function_exists('bzopen')) $file = bzopen($in_file,'rb');
163
+			if (function_exists('bzopen')) $file = bzopen($in_file, 'rb');
164 164
 			else {
165 165
 				echo 'bzopen not available';
166 166
 				die;
167 167
 			}
168 168
 			$out_file = fopen($out_file_name, 'wb'); 
169
-			while(!feof($file)) {
169
+			while (!feof($file)) {
170 170
 				fwrite($out_file, bzread($file, $buffer_size));
171 171
 			}  
172 172
 			fclose($out_file);
@@ -184,27 +184,27 @@  discard block
 block discarded – undo
184 184
 		if ($data == '') return array();
185 185
 		$html = str_get_html($data);
186 186
 		if ($html === false) return array();
187
-		$tabledata=array();
188
-		foreach($html->find('tr') as $element)
187
+		$tabledata = array();
188
+		foreach ($html->find('tr') as $element)
189 189
 		{
190 190
 			$td = array();
191
-			foreach( $element->find('th') as $row)
191
+			foreach ($element->find('th') as $row)
192 192
 			{
193 193
 				$td [] = trim($row->plaintext);
194 194
 			}
195
-			$td=array_filter($td);
195
+			$td = array_filter($td);
196 196
 			$tabledata[] = $td;
197 197
 
198 198
 			$td = array();
199 199
 			$tdi = array();
200
-			foreach( $element->find('td') as $row)
200
+			foreach ($element->find('td') as $row)
201 201
 			{
202 202
 				$td [] = trim($row->plaintext);
203 203
 				$tdi [] = trim($row->innertext);
204 204
 			}
205
-			$td=array_filter($td);
206
-			$tdi=array_filter($tdi);
207
-			$tabledata[]=array_merge($td,$tdi);
205
+			$td = array_filter($td);
206
+			$tdi = array_filter($tdi);
207
+			$tabledata[] = array_merge($td, $tdi);
208 208
 		}
209 209
 		$html->clear();
210 210
 		unset($html);
@@ -219,8 +219,8 @@  discard block
 block discarded – undo
219 219
 	public function text2array($data) {
220 220
 		$html = str_get_html($data);
221 221
 		if ($html === false) return array();
222
-		$tabledata=array();
223
-		foreach($html->find('p') as $element)
222
+		$tabledata = array();
223
+		foreach ($html->find('p') as $element)
224 224
 		{
225 225
 			$tabledata [] = trim($element->plaintext);
226 226
 		}
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
 	*/
241 241
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
242 242
 		if ($lat == $latc && $lon == $lonc) return 0;
243
-		$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;
243
+		$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;
244 244
 		if ($unit == "km") {
245
-			return round($dist * 1.609344);
245
+			return round($dist*1.609344);
246 246
 		} elseif ($unit == "m") {
247
-			return round($dist * 1.609344 * 1000);
247
+			return round($dist*1.609344*1000);
248 248
 		} elseif ($unit == "mile" || $unit == "mi") {
249 249
 			return round($dist);
250 250
 		} elseif ($unit == "nm") {
@@ -261,8 +261,8 @@  discard block
 block discarded – undo
261 261
 	* @param String $distance distance between two points in m
262 262
 	* @return Float plunge
263 263
 	*/
264
-	public function plunge($initial_altitude,$final_altitude,$distance) {
265
-		$plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance));
264
+	public function plunge($initial_altitude, $final_altitude, $distance) {
265
+		$plunge = rad2deg(asin(($final_altitude - $initial_altitude)/$distance));
266 266
 		/*
267 267
 		$siter = 6378137.0 + $initial_altitude;
268 268
 		$planer = 6378137.0 + $final_altitude;
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
 	public function azimuth($lat, $lon, $latc, $lonc) {
285 285
 		$dX = $latc - $lat;
286 286
 		$dY = $lonc - $lon;
287
-		$azimuth = rad2deg(atan2($dY,$dX));
288
-		if ($azimuth < 0) return $azimuth+360;
287
+		$azimuth = rad2deg(atan2($dY, $dX));
288
+		if ($azimuth < 0) return $azimuth + 360;
289 289
 		return $azimuth;
290 290
 	}
291 291
 	
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 	* @param float $distance distance covered
297 297
 	* @return bool whether distance is realistic
298 298
 	*/
299
-	public function withinThreshold ($timeDifference, $distance) {
299
+	public function withinThreshold($timeDifference, $distance) {
300 300
 		$x = abs($timeDifference);
301 301
 		$d = abs($distance);
302 302
 		if ($x == 0 || $d == 0) return true;
@@ -312,13 +312,13 @@  discard block
 block discarded – undo
312 312
 		return ($array !== array_values($array));
313 313
 	}
314 314
 
315
-	public function isInteger($input){
315
+	public function isInteger($input) {
316 316
 		//return(ctype_digit(strval($input)));
317
-		return preg_match('/^-?[0-9]+$/', (string)$input) ? true : false;
317
+		return preg_match('/^-?[0-9]+$/', (string) $input) ? true : false;
318 318
 	}
319 319
 
320 320
 
321
-	public function convertDec($dms,$latlong) {
321
+	public function convertDec($dms, $latlong) {
322 322
 		if ($latlong == 'latitude') {
323 323
 			$deg = substr($dms, 0, 2);
324 324
 			$min = substr($dms, 2, 4);
@@ -326,33 +326,33 @@  discard block
 block discarded – undo
326 326
 			$deg = substr($dms, 0, 3);
327 327
 			$min = substr($dms, 3, 5);
328 328
 		}
329
-		return $deg+(($min*60)/3600);
329
+		return $deg + (($min*60)/3600);
330 330
 	}
331 331
 	
332 332
 	public function convertDecLatLong($coord) {
333 333
 		//N43°36.763' W5°46.845'
334
-		$coords = explode(' ',$coord);
334
+		$coords = explode(' ', $coord);
335 335
 		$latitude = '';
336 336
 		$longitude = '';
337 337
 		foreach ($coords as $latlong) {
338
-			$type = substr($latlong,0,1);
339
-			$degmin = explode('°',substr($latlong,1,-1));
338
+			$type = substr($latlong, 0, 1);
339
+			$degmin = explode('°', substr($latlong, 1, -1));
340 340
 			$deg = $degmin[0];
341 341
 			$min = $degmin[1];
342 342
 			if ($type == 'N') {
343
-				$latitude = $deg+(($min*60)/3600);
343
+				$latitude = $deg + (($min*60)/3600);
344 344
 			} elseif ($type == 'S') {
345
-				$latitude = -($deg+(($min*60)/3600));
345
+				$latitude = -($deg + (($min*60)/3600));
346 346
 			} elseif ($type == 'E') {
347
-				$longitude = ($deg+(($min*60)/3600));
347
+				$longitude = ($deg + (($min*60)/3600));
348 348
 			} elseif ($type == 'W') {
349
-				$longitude = -($deg+(($min*60)/3600));
349
+				$longitude = -($deg + (($min*60)/3600));
350 350
 			}
351 351
 		}
352
-		return array('latitude' => round($latitude,5),'longitude' => round($longitude,5));
352
+		return array('latitude' => round($latitude, 5), 'longitude' => round($longitude, 5));
353 353
 	}
354 354
 	
355
-	public function convertDM($coord,$latlong) {
355
+	public function convertDM($coord, $latlong) {
356 356
 		if ($latlong == 'latitude') {
357 357
 			if ($coord < 0) $NSEW = 'S';
358 358
 			else $NSEW = 'N';
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 		}
363 363
 		$coord = abs($coord);
364 364
 		$deg = floor($coord);
365
-		$coord = ($coord-$deg)*60;
365
+		$coord = ($coord - $deg)*60;
366 366
 		$min = $coord;
367
-		return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW);
367
+		return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW);
368 368
 	}
369
-	public function convertDMS($coord,$latlong) {
369
+	public function convertDMS($coord, $latlong) {
370 370
 		if ($latlong == 'latitude') {
371 371
 			if ($coord < 0) $NSEW = 'S';
372 372
 			else $NSEW = 'N';
@@ -376,10 +376,10 @@  discard block
 block discarded – undo
376 376
 		}
377 377
 		$coord = abs($coord);
378 378
 		$deg = floor($coord);
379
-		$coord = ($coord-$deg)*60;
379
+		$coord = ($coord - $deg)*60;
380 380
 		$min = floor($coord);
381
-		$sec = round(($coord-$min)*60);
382
-		return array('deg' => $deg,'min' => $min,'sec' => $sec,'NSEW' => $NSEW);
381
+		$sec = round(($coord - $min)*60);
382
+		return array('deg' => $deg, 'min' => $min, 'sec' => $sec, 'NSEW' => $NSEW);
383 383
 	}
384 384
 	
385 385
 	/**
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
 	public function xcopy($source, $dest)
392 392
 	{
393 393
 		$files = glob($source.'*.*');
394
-		foreach($files as $file){
395
-			$file_to_go = str_replace($source,$dest,$file);
394
+		foreach ($files as $file) {
395
+			$file_to_go = str_replace($source, $dest, $file);
396 396
 			copy($file, $file_to_go);
397 397
 		}
398 398
 		return true;
@@ -403,9 +403,9 @@  discard block
 block discarded – undo
403 403
 	* @param	String $url url to check
404 404
 	* @return	bool Return true on succes false on failure
405 405
 	*/
406
-	public function urlexist($url){
407
-		$headers=get_headers($url);
408
-		return stripos($headers[0],"200 OK")?true:false;
406
+	public function urlexist($url) {
407
+		$headers = get_headers($url);
408
+		return stripos($headers[0], "200 OK") ?true:false;
409 409
 	}
410 410
 	
411 411
 	/**
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 	public function hex2str($hex) {
417 417
 		$str = '';
418 418
 		$hexln = strlen($hex);
419
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
419
+		for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2)));
420 420
 		return $str;
421 421
 	}
422 422
 	
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 	* @return	String Return result
427 427
 	*/
428 428
 	public function hex2rgb($hex) {
429
-		$hex = str_replace('#','',$hex);
429
+		$hex = str_replace('#', '', $hex);
430 430
 		return sscanf($hex, "%02x%02x%02x"); 
431 431
 	}
432 432
 	
@@ -434,33 +434,33 @@  discard block
 block discarded – undo
434 434
 		//difference in longitudinal coordinates
435 435
 		$dLon = deg2rad($lon2) - deg2rad($lon1);
436 436
 		//difference in the phi of latitudinal coordinates
437
-		$dPhi = log(tan(deg2rad($lat2) / 2 + M_PI / 4) / tan(deg2rad($lat1) / 2 + M_PI / 4));
437
+		$dPhi = log(tan(deg2rad($lat2)/2 + M_PI/4)/tan(deg2rad($lat1)/2 + M_PI/4));
438 438
 		//we need to recalculate $dLon if it is greater than pi
439
-		if(abs($dLon) > M_PI) {
440
-			if($dLon > 0) {
441
-				$dLon = (2 * M_PI - $dLon) * -1;
439
+		if (abs($dLon) > M_PI) {
440
+			if ($dLon > 0) {
441
+				$dLon = (2*M_PI - $dLon)*-1;
442 442
 			} else {
443
-				$dLon = 2 * M_PI + $dLon;
443
+				$dLon = 2*M_PI + $dLon;
444 444
 			}
445 445
 		}
446 446
 		//return the angle, normalized
447
-		return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360;
447
+		return (rad2deg(atan2($dLon, $dPhi)) + 360)%360;
448 448
 	}
449 449
 
450
-	public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.15) {
450
+	public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.15) {
451 451
 		//$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1);
452
-		$a = -($lon2-$lon1);
452
+		$a = -($lon2 - $lon1);
453 453
 		$b = $lat2 - $lat1;
454
-		$c = -($a*$lat1+$b*$lon1);
455
-		$d = $a*$lat3+$b*$lon3+$c;
454
+		$c = -($a*$lat1 + $b*$lon1);
455
+		$d = $a*$lat3 + $b*$lon3 + $c;
456 456
 		if ($d > -$approx && $d < $approx) return true;
457 457
 		else return false;
458 458
 	}
459 459
 	
460 460
 	public function array_merge_noappend() {
461 461
 		$output = array();
462
-		foreach(func_get_args() as $array) {
463
-			foreach($array as $key => $value) {
462
+		foreach (func_get_args() as $array) {
463
+			foreach ($array as $key => $value) {
464 464
 				$output[$key] = isset($output[$key]) ?
465 465
 				array_merge($output[$key], $value) : $value;
466 466
 			}
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 		return $result;
525 525
 	}
526 526
 
527
-	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = ''){
527
+	public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = '') {
528 528
 		global $globalMapRefresh;
529 529
 		if ($seconds == '') {
530 530
 			$distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000;
@@ -535,27 +535,27 @@  discard block
 block discarded – undo
535 535
 		$latitude = deg2rad($latitude);
536 536
 		$longitude = deg2rad($longitude);
537 537
 		$bearing = deg2rad($heading); 
538
-		$latitude2 =  asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) );
539
-		$longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) );
540
-		return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.',''));
538
+		$latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing)));
539
+		$longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2)));
540
+		return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', ''));
541 541
 	}
542 542
 	
543
-	public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) {
543
+	public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) {
544 544
 		// distance in meter
545 545
 		$R = 6378.14;
546
-		$latitude1 = $latitude * (M_PI/180);
547
-		$longitude1 = $longitude * (M_PI/180);
548
-		$brng = $bearing * (M_PI/180);
546
+		$latitude1 = $latitude*(M_PI/180);
547
+		$longitude1 = $longitude*(M_PI/180);
548
+		$brng = $bearing*(M_PI/180);
549 549
 		$d = $distance;
550 550
 
551 551
 		$latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng));
552
-		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2));
552
+		$longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2));
553 553
 
554
-		$latitude2 = $latitude2 * (180/M_PI);
555
-		$longitude2 = $longitude2 * (180/M_PI);
554
+		$latitude2 = $latitude2*(180/M_PI);
555
+		$longitude2 = $longitude2*(180/M_PI);
556 556
 
557
-		$flat = round ($latitude2,6);
558
-		$flong = round ($longitude2,6);
557
+		$flat = round($latitude2, 6);
558
+		$flong = round($longitude2, 6);
559 559
 /*
560 560
 		$dx = $distance*cos($bearing);
561 561
 		$dy = $distance*sin($bearing);
@@ -564,7 +564,7 @@  discard block
 block discarded – undo
564 564
 		$flong = $longitude + $dlong;
565 565
 		$flat = $latitude + $dlat;
566 566
 */
567
-		return array('latitude' => $flat,'longitude' => $flong);
567
+		return array('latitude' => $flat, 'longitude' => $flong);
568 568
 	}
569 569
 
570 570
 	/**
@@ -578,14 +578,14 @@  discard block
 block discarded – undo
578 578
 	 * @param integer $level GZIP compression level (default: 9)
579 579
 	 * @return string New filename (with .gz appended) if success, or false if operation fails
580 580
 	 */
581
-	public function gzCompressFile($source, $level = 9){ 
582
-		$dest = $source . '.gz'; 
583
-		$mode = 'wb' . $level; 
581
+	public function gzCompressFile($source, $level = 9) { 
582
+		$dest = $source.'.gz'; 
583
+		$mode = 'wb'.$level; 
584 584
 		$error = false; 
585 585
 		if ($fp_out = gzopen($dest, $mode)) { 
586
-			if ($fp_in = fopen($source,'rb')) { 
586
+			if ($fp_in = fopen($source, 'rb')) { 
587 587
 				while (!feof($fp_in)) 
588
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
588
+					gzwrite($fp_out, fread($fp_in, 1024*512)); 
589 589
 				fclose($fp_in); 
590 590
 			} else {
591 591
 				$error = true; 
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 	} 
602 602
 	
603 603
 	public function remove_accents($string) {
604
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
604
+		if (!preg_match('/[\x80-\xff]/', $string)) return $string;
605 605
 		$chars = array(
606 606
 		    // Decompositions for Latin-1 Supplement
607 607
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 		    chr(196).chr(172) => 'I', chr(196).chr(173) => 'i',
659 659
 		    chr(196).chr(174) => 'I', chr(196).chr(175) => 'i',
660 660
 		    chr(196).chr(176) => 'I', chr(196).chr(177) => 'i',
661
-		    chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij',
661
+		    chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij',
662 662
 		    chr(196).chr(180) => 'J', chr(196).chr(181) => 'j',
663 663
 		    chr(196).chr(182) => 'K', chr(196).chr(183) => 'k',
664 664
 		    chr(196).chr(184) => 'k', chr(196).chr(185) => 'L',
@@ -674,13 +674,13 @@  discard block
 block discarded – undo
674 674
 		    chr(197).chr(140) => 'O', chr(197).chr(141) => 'o',
675 675
 		    chr(197).chr(142) => 'O', chr(197).chr(143) => 'o',
676 676
 		    chr(197).chr(144) => 'O', chr(197).chr(145) => 'o',
677
-		    chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe',
678
-		    chr(197).chr(148) => 'R',chr(197).chr(149) => 'r',
679
-		    chr(197).chr(150) => 'R',chr(197).chr(151) => 'r',
680
-		    chr(197).chr(152) => 'R',chr(197).chr(153) => 'r',
681
-		    chr(197).chr(154) => 'S',chr(197).chr(155) => 's',
682
-		    chr(197).chr(156) => 'S',chr(197).chr(157) => 's',
683
-		    chr(197).chr(158) => 'S',chr(197).chr(159) => 's',
677
+		    chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe',
678
+		    chr(197).chr(148) => 'R', chr(197).chr(149) => 'r',
679
+		    chr(197).chr(150) => 'R', chr(197).chr(151) => 'r',
680
+		    chr(197).chr(152) => 'R', chr(197).chr(153) => 'r',
681
+		    chr(197).chr(154) => 'S', chr(197).chr(155) => 's',
682
+		    chr(197).chr(156) => 'S', chr(197).chr(157) => 's',
683
+		    chr(197).chr(158) => 'S', chr(197).chr(159) => 's',
684 684
 		    chr(197).chr(160) => 'S', chr(197).chr(161) => 's',
685 685
 		    chr(197).chr(162) => 'T', chr(197).chr(163) => 't',
686 686
 		    chr(197).chr(164) => 'T', chr(197).chr(165) => 't',
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 		for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) {
715 715
 			if (is_numeric($string[$i]) && $concat_flag) {
716 716
 				$int .= $string[$i];
717
-			} elseif(!$concat && $concat_flag && strlen($int) > 0) {
717
+			} elseif (!$concat && $concat_flag && strlen($int) > 0) {
718 718
 				$concat_flag = false;
719 719
 			}
720 720
 		}
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 			$slice = array_slice($arr, $offset + 1, $length);
761 761
 			return implode("", $slice);
762 762
 		} else {
763
-			return mb_substr($string,$offset,$length,'UTF-8');
763
+			return mb_substr($string, $offset, $length, 'UTF-8');
764 764
 		}
765 765
 	}
766 766
 
@@ -770,14 +770,14 @@  discard block
 block discarded – undo
770 770
 		//NOTE: use a trailing slash for folders!!!
771 771
 		//see http://bugs.php.net/bug.php?id=27609
772 772
 		//see http://bugs.php.net/bug.php?id=30931
773
-		if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
773
+		if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path
774 774
 			return $this->is__writable($path.uniqid(mt_rand()).'.tmp');
775 775
 		else if (is_dir($path))
776 776
 			return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
777 777
 		// check tmp file for read/write capabilities
778 778
 		$rm = file_exists($path);
779 779
 		$f = @fopen($path, 'a');
780
-		if ($f===false)
780
+		if ($f === false)
781 781
 			return false;
782 782
 		fclose($f);
783 783
 		if (!$rm)
@@ -796,29 +796,29 @@  discard block
 block discarded – undo
796 796
 	 * @param Integer $offset Controls the likelyhood that lines will be split which cross the dateline
797 797
 	 * @return Array Coordinate of the route
798 798
 	*/
799
-	public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) {
800
-		if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
799
+	public function greatcircle($begin_lat, $begin_lon, $end_lat, $end_lon, $nbpts = 20, $offset = 10) {
800
+		if ($nbpts <= 2) return array(array($begin_lon, $begin_lat), array($end_lon, $end_lat));
801 801
 		$sx = deg2rad($begin_lon);
802 802
 		$sy = deg2rad($begin_lat);
803 803
 		$ex = deg2rad($end_lon);
804 804
 		$ey = deg2rad($end_lat);
805 805
 		$w = $sx - $ex;
806 806
 		$h = $sy - $ey;
807
-		$z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2);
807
+		$z = pow(sin($h/2.0), 2) + cos($sy)*cos($ey)*pow(sin($w/2.0), 2);
808 808
 		$g = 2.0*asin(sqrt($z));
809
-		if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
809
+		if ($g == M_PI || is_nan($g)) return array(array($begin_lon, $begin_lat), array($end_lon, $end_lat));
810 810
 		$first_pass = array();
811
-		$delta = 1.0/($nbpts-1);
812
-		for ($i =0; $i < $nbpts; ++$i) {
811
+		$delta = 1.0/($nbpts - 1);
812
+		for ($i = 0; $i < $nbpts; ++$i) {
813 813
 			$step = $delta*$i;
814
-			$A = sin((1 - $step) * $g) / sin($g);
815
-			$B = sin($step * $g) / sin($g);
816
-			$x = $A * cos($sy) * cos($sx) + $B * cos($ey) * cos($ex);
817
-			$y = $A * cos($sy) * sin($sx) + $B * cos($ey) * sin($ex);
818
-			$z = $A * sin($sy) + $B * sin($ey);
814
+			$A = sin((1 - $step)*$g)/sin($g);
815
+			$B = sin($step*$g)/sin($g);
816
+			$x = $A*cos($sy)*cos($sx) + $B*cos($ey)*cos($ex);
817
+			$y = $A*cos($sy)*sin($sx) + $B*cos($ey)*sin($ex);
818
+			$z = $A*sin($sy) + $B*sin($ey);
819 819
 			$lat = rad2deg(atan2($z, sqrt(pow($x, 2) + pow($y, 2))));
820 820
 			$lon = rad2deg(atan2($y, $x));
821
-			$first_pass[] = array($lon,$lat);
821
+			$first_pass[] = array($lon, $lat);
822 822
 		}
823 823
 		$bHasBigDiff = false;
824 824
 		$dfMaxSmallDiffLong = 0;
@@ -833,7 +833,7 @@  discard block
 block discarded – undo
833 833
 		// https://github.com/OSGeo/gdal/blob/7bfb9c452a59aac958bff0c8386b891edf8154ca/gdal/ogr/ogrgeometryfactory.cpp#L2342
834 834
 		$first_pass_ln = count($first_pass);
835 835
 		for ($j = 1; $j < $first_pass_ln; ++$j) {
836
-			$dfPrevX = $first_pass[$j-1][0];
836
+			$dfPrevX = $first_pass[$j - 1][0];
837 837
 			$dfX = $first_pass[$j][0];
838 838
 			$dfDiffLong = abs($dfX - $dfPrevX);
839 839
 			if ($dfDiffLong > $dfDiffSpace &&
@@ -851,14 +851,14 @@  discard block
 block discarded – undo
851 851
 			//$poMulti[] = $poNewLS;
852 852
 			for ($k = 0; $k < $first_pass_ln; ++$k) {
853 853
 				$dfX0 = floatval($first_pass[$k][0]);
854
-				if ($k > 0 &&  abs($dfX0 - $first_pass[$k-1][0]) > $dfDiffSpace) {
855
-					$dfX1 = floatval($first_pass[$k-1][0]);
856
-					$dfY1 = floatval($first_pass[$k-1][1]);
854
+				if ($k > 0 && abs($dfX0 - $first_pass[$k - 1][0]) > $dfDiffSpace) {
855
+					$dfX1 = floatval($first_pass[$k - 1][0]);
856
+					$dfY1 = floatval($first_pass[$k - 1][1]);
857 857
 					$dfX2 = floatval($first_pass[$k][0]);
858 858
 					$dfY2 = floatval($first_pass[$k][1]);
859 859
 					if ($dfX1 > -180 && $dfX1 < $dfRightBorderX && $dfX2 == 180 &&
860
-					    $k+1 < count($first_pass) &&
861
-					    $first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX)
860
+					    $k + 1 < count($first_pass) &&
861
+					    $first_pass[$k - 1][0] > -180 && $first_pass[$k - 1][0] < $dfRightBorderX)
862 862
 					{
863 863
 						$poNewLS[] = array(-180, $first_pass[$k][1]);
864 864
 						$k++;
@@ -866,8 +866,8 @@  discard block
 block discarded – undo
866 866
 						$poNewLS[] = array($first_pass[$k][0], $first_pass[$k][1]);
867 867
 						continue;
868 868
 					} else if ($dfX1 > $dfLeftBorderX && $dfX1 < 180 && $dfX2 == -180 &&
869
-					    $k+1 < $first_pass_ln &&
870
-					    $first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180)
869
+					    $k + 1 < $first_pass_ln &&
870
+					    $first_pass[$k - 1][0] > $dfLeftBorderX && $first_pass[$k - 1][0] < 180)
871 871
 					{
872 872
 						$poNewLS[] = array(180, $first_pass[$k][1]);
873 873
 						$k++;
@@ -890,12 +890,12 @@  discard block
 block discarded – undo
890 890
 					}
891 891
 					if ($dfX1 <= 180 && $dfX2 >= 180 && $dfX1 < $dfX2)
892 892
 					{
893
-						$dfRatio = (180 - $dfX1) / ($dfX2 - $dfX1);
894
-						$dfY = $dfRatio * $dfY2 + (1 - $dfRatio) * $dfY1;
895
-						$poNewLS[] = array($first_pass[$k-1][0] > $dfLeftBorderX ? 180 : -180, $dfY);
893
+						$dfRatio = (180 - $dfX1)/($dfX2 - $dfX1);
894
+						$dfY = $dfRatio*$dfY2 + (1 - $dfRatio)*$dfY1;
895
+						$poNewLS[] = array($first_pass[$k - 1][0] > $dfLeftBorderX ? 180 : -180, $dfY);
896 896
 						$poMulti[] = $poNewLS;
897 897
 						$poNewLS = array();
898
-						$poNewLS[] = array($first_pass[$k-1][0] > $dfLeftBorderX ? -180 : 180, $dfY);
898
+						$poNewLS[] = array($first_pass[$k - 1][0] > $dfLeftBorderX ? -180 : 180, $dfY);
899 899
 						//$poMulti[] = $poNewLS;
900 900
 					} else {
901 901
 						//$poNewLS[] = array();
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 			$poNewLS0 = array();
914 914
 			//$poMulti[] = $poNewLS0;
915 915
 			for ($l = 0; $l < $first_pass_ln; ++$l) {
916
-				$poNewLS0[] = array($first_pass[$l][0],$first_pass[$l][1]);
916
+				$poNewLS0[] = array($first_pass[$l][0], $first_pass[$l][1]);
917 917
 			}
918 918
 			$poMulti[] = $poNewLS0;
919 919
 		}
Please login to merge, or discard this patch.
Braces   +123 added lines, -53 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@  discard block
 block discarded – undo
36 36
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
37 37
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
38 38
 		curl_setopt($ch, CURLINFO_HEADER_OUT, true); 
39
-		if ($getheaders) curl_setopt($ch, CURLOPT_HEADER, 1); 
39
+		if ($getheaders) {
40
+			curl_setopt($ch, CURLOPT_HEADER, 1);
41
+		}
40 42
 		curl_setopt($ch,CURLOPT_ENCODING , "gzip");
41 43
 		//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');
42 44
 //		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0');
@@ -45,8 +47,11 @@  discard block
 block discarded – undo
45 47
 		} else {
46 48
 			curl_setopt($ch, CURLOPT_USERAGENT, $useragent);
47 49
 		}
48
-		if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); 
49
-		else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); 
50
+		if ($timeout == '') {
51
+			curl_setopt($ch, CURLOPT_TIMEOUT, 10);
52
+		} else {
53
+			curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
54
+		}
50 55
 		//curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback"));
51 56
 		if ($type == 'post') {
52 57
 			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
@@ -59,7 +64,9 @@  discard block
 block discarded – undo
59 64
 			} else {
60 65
 				curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
61 66
 			}
62
-		} elseif ($type != 'get' && $type != '') curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
67
+		} elseif ($type != 'get' && $type != '') {
68
+			curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type);
69
+		}
63 70
 		if ($headers != '') {
64 71
 			curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
65 72
 		}
@@ -103,8 +110,9 @@  discard block
 block discarded – undo
103 110
 	private function curlResponseHeaderCallback($ch, $headerLine) {
104 111
 		global $curl_cookies;
105 112
 		$curl_cookies = array();
106
-		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1)
107
-			$curl_cookies[] = $cookie;
113
+		if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) {
114
+					$curl_cookies[] = $cookie;
115
+		}
108 116
 		return strlen($headerLine); // Needed by curl
109 117
 	}
110 118
 
@@ -116,7 +124,9 @@  discard block
 block discarded – undo
116 124
 		curl_setopt($ch, CURLOPT_URL, $url);
117 125
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
118 126
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
119
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
127
+		if ($referer != '') {
128
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
129
+		}
120 130
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
121 131
 			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
122 132
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
@@ -128,7 +138,9 @@  discard block
 block discarded – undo
128 138
 		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');
129 139
 		curl_setopt($ch, CURLOPT_FILE, $fp);
130 140
 		curl_exec($ch);
131
-		if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch);
141
+		if (curl_errno($ch) && $globalDebug) {
142
+			echo 'Download error: '.curl_error($ch);
143
+		}
132 144
 		curl_close($ch);
133 145
 		fclose($fp);
134 146
 	}
@@ -136,12 +148,16 @@  discard block
 block discarded – undo
136 148
 	public static function gunzip($in_file,$out_file_name = '') {
137 149
 		//echo $in_file.' -> '.$out_file_name."\n";
138 150
 		$buffer_size = 4096; // read 4kb at a time
139
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
151
+		if ($out_file_name == '') {
152
+			$out_file_name = str_replace('.gz', '', $in_file);
153
+		}
140 154
 		if ($in_file != '' && file_exists($in_file)) {
141 155
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
142
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
143
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
144
-			else {
156
+			if (function_exists('gzopen')) {
157
+				$file = gzopen($in_file,'rb');
158
+			} elseif (function_exists('gzopen64')) {
159
+				$file = gzopen64($in_file,'rb');
160
+			} else {
145 161
 				echo 'gzopen not available';
146 162
 				die;
147 163
 			}
@@ -157,11 +173,14 @@  discard block
 block discarded – undo
157 173
 	public static function bunzip2($in_file,$out_file_name = '') {
158 174
 		//echo $in_file.' -> '.$out_file_name."\n";
159 175
 		$buffer_size = 4096; // read 4kb at a time
160
-		if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); 
176
+		if ($out_file_name == '') {
177
+			$out_file_name = str_replace('.bz2', '', $in_file);
178
+		}
161 179
 		if ($in_file != '' && file_exists($in_file)) {
162 180
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
163
-			if (function_exists('bzopen')) $file = bzopen($in_file,'rb');
164
-			else {
181
+			if (function_exists('bzopen')) {
182
+				$file = bzopen($in_file,'rb');
183
+			} else {
165 184
 				echo 'bzopen not available';
166 185
 				die;
167 186
 			}
@@ -180,10 +199,16 @@  discard block
 block discarded – undo
180 199
 	* @return array array of the tables in HTML page
181 200
 	*/
182 201
 	public function table2array($data) {
183
-		if (!is_string($data)) return array();
184
-		if ($data == '') return array();
202
+		if (!is_string($data)) {
203
+			return array();
204
+		}
205
+		if ($data == '') {
206
+			return array();
207
+		}
185 208
 		$html = str_get_html($data);
186
-		if ($html === false) return array();
209
+		if ($html === false) {
210
+			return array();
211
+		}
187 212
 		$tabledata=array();
188 213
 		foreach($html->find('tr') as $element)
189 214
 		{
@@ -218,7 +243,9 @@  discard block
 block discarded – undo
218 243
 	*/
219 244
 	public function text2array($data) {
220 245
 		$html = str_get_html($data);
221
-		if ($html === false) return array();
246
+		if ($html === false) {
247
+			return array();
248
+		}
222 249
 		$tabledata=array();
223 250
 		foreach($html->find('p') as $element)
224 251
 		{
@@ -239,7 +266,9 @@  discard block
 block discarded – undo
239 266
 	* @return Float Distance in $unit
240 267
 	*/
241 268
 	public function distance($lat, $lon, $latc, $lonc, $unit = 'km') {
242
-		if ($lat == $latc && $lon == $lonc) return 0;
269
+		if ($lat == $latc && $lon == $lonc) {
270
+			return 0;
271
+		}
243 272
 		$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;
244 273
 		if ($unit == "km") {
245 274
 			return round($dist * 1.609344);
@@ -285,7 +314,9 @@  discard block
 block discarded – undo
285 314
 		$dX = $latc - $lat;
286 315
 		$dY = $lonc - $lon;
287 316
 		$azimuth = rad2deg(atan2($dY,$dX));
288
-		if ($azimuth < 0) return $azimuth+360;
317
+		if ($azimuth < 0) {
318
+			return $azimuth+360;
319
+		}
289 320
 		return $azimuth;
290 321
 	}
291 322
 	
@@ -299,10 +330,16 @@  discard block
 block discarded – undo
299 330
 	public function withinThreshold ($timeDifference, $distance) {
300 331
 		$x = abs($timeDifference);
301 332
 		$d = abs($distance);
302
-		if ($x == 0 || $d == 0) return true;
333
+		if ($x == 0 || $d == 0) {
334
+			return true;
335
+		}
303 336
 		// may be due to Internet jitter; distance is realistic
304
-		if ($x < 0.7 && $d < 2000) return true;
305
-		else return $d/$x < 1500*0.27778; // 1500 km/h max
337
+		if ($x < 0.7 && $d < 2000) {
338
+			return true;
339
+		} else {
340
+			return $d/$x < 1500*0.27778;
341
+		}
342
+		// 1500 km/h max
306 343
 	}
307 344
 
308 345
 
@@ -354,11 +391,17 @@  discard block
 block discarded – undo
354 391
 	
355 392
 	public function convertDM($coord,$latlong) {
356 393
 		if ($latlong == 'latitude') {
357
-			if ($coord < 0) $NSEW = 'S';
358
-			else $NSEW = 'N';
394
+			if ($coord < 0) {
395
+				$NSEW = 'S';
396
+			} else {
397
+				$NSEW = 'N';
398
+			}
359 399
 		} else {
360
-			if ($coord < 0) $NSEW = 'W';
361
-			else $NSEW = 'E';
400
+			if ($coord < 0) {
401
+				$NSEW = 'W';
402
+			} else {
403
+				$NSEW = 'E';
404
+			}
362 405
 		}
363 406
 		$coord = abs($coord);
364 407
 		$deg = floor($coord);
@@ -368,11 +411,17 @@  discard block
 block discarded – undo
368 411
 	}
369 412
 	public function convertDMS($coord,$latlong) {
370 413
 		if ($latlong == 'latitude') {
371
-			if ($coord < 0) $NSEW = 'S';
372
-			else $NSEW = 'N';
414
+			if ($coord < 0) {
415
+				$NSEW = 'S';
416
+			} else {
417
+				$NSEW = 'N';
418
+			}
373 419
 		} else {
374
-			if ($coord < 0) $NSEW = 'W';
375
-			else $NSEW = 'E';
420
+			if ($coord < 0) {
421
+				$NSEW = 'W';
422
+			} else {
423
+				$NSEW = 'E';
424
+			}
376 425
 		}
377 426
 		$coord = abs($coord);
378 427
 		$deg = floor($coord);
@@ -416,7 +465,9 @@  discard block
 block discarded – undo
416 465
 	public function hex2str($hex) {
417 466
 		$str = '';
418 467
 		$hexln = strlen($hex);
419
-		for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2)));
468
+		for($i=0;$i<$hexln;$i+=2) {
469
+			$str .= chr(hexdec(substr($hex,$i,2)));
470
+		}
420 471
 		return $str;
421 472
 	}
422 473
 	
@@ -453,8 +504,11 @@  discard block
 block discarded – undo
453 504
 		$b = $lat2 - $lat1;
454 505
 		$c = -($a*$lat1+$b*$lon1);
455 506
 		$d = $a*$lat3+$b*$lon3+$c;
456
-		if ($d > -$approx && $d < $approx) return true;
457
-		else return false;
507
+		if ($d > -$approx && $d < $approx) {
508
+			return true;
509
+		} else {
510
+			return false;
511
+		}
458 512
 	}
459 513
 	
460 514
 	public function array_merge_noappend() {
@@ -513,7 +567,9 @@  discard block
 block discarded – undo
513 567
 			return $result;
514 568
 		}
515 569
 		$handle = @opendir('./locale');
516
-		if ($handle === false) return $result;
570
+		if ($handle === false) {
571
+			return $result;
572
+		}
517 573
 		while (false !== ($file = readdir($handle))) {
518 574
 			$path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo';
519 575
 			if ($file != "." && $file != ".." && @file_exists($path)) {
@@ -584,8 +640,9 @@  discard block
 block discarded – undo
584 640
 		$error = false; 
585 641
 		if ($fp_out = gzopen($dest, $mode)) { 
586 642
 			if ($fp_in = fopen($source,'rb')) { 
587
-				while (!feof($fp_in)) 
588
-					gzwrite($fp_out, fread($fp_in, 1024 * 512)); 
643
+				while (!feof($fp_in)) {
644
+									gzwrite($fp_out, fread($fp_in, 1024 * 512));
645
+				}
589 646
 				fclose($fp_in); 
590 647
 			} else {
591 648
 				$error = true; 
@@ -594,14 +651,17 @@  discard block
 block discarded – undo
594 651
 		} else {
595 652
 			$error = true; 
596 653
 		}
597
-		if ($error)
598
-			return false; 
599
-		else
600
-			return $dest; 
654
+		if ($error) {
655
+					return false;
656
+		} else {
657
+					return $dest;
658
+		}
601 659
 	} 
602 660
 	
603 661
 	public function remove_accents($string) {
604
-		if ( !preg_match('/[\x80-\xff]/', $string) ) return $string;
662
+		if ( !preg_match('/[\x80-\xff]/', $string) ) {
663
+			return $string;
664
+		}
605 665
 		$chars = array(
606 666
 		    // Decompositions for Latin-1 Supplement
607 667
 		    chr(195).chr(128) => 'A', chr(195).chr(129) => 'A',
@@ -725,7 +785,9 @@  discard block
 block discarded – undo
725 785
 		$ip = gethostbyname($host);
726 786
 		$s = socket_create(AF_INET, SOCK_STREAM, 0);
727 787
 		$r = @socket_connect($s, $ip, $port);
728
-		if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
788
+		if (!socket_set_nonblock($s)) {
789
+			echo "Unable to set nonblock on socket\n";
790
+		}
729 791
 		if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
730 792
 			return $s;
731 793
 		}
@@ -770,18 +832,22 @@  discard block
 block discarded – undo
770 832
 		//NOTE: use a trailing slash for folders!!!
771 833
 		//see http://bugs.php.net/bug.php?id=27609
772 834
 		//see http://bugs.php.net/bug.php?id=30931
773
-		if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
835
+		if ($path{strlen($path)-1}=='/') {
836
+			// recursively return a temporary file path
774 837
 			return $this->is__writable($path.uniqid(mt_rand()).'.tmp');
775
-		else if (is_dir($path))
776
-			return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
838
+		} else if (is_dir($path)) {
839
+					return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
840
+		}
777 841
 		// check tmp file for read/write capabilities
778 842
 		$rm = file_exists($path);
779 843
 		$f = @fopen($path, 'a');
780
-		if ($f===false)
781
-			return false;
844
+		if ($f===false) {
845
+					return false;
846
+		}
782 847
 		fclose($f);
783
-		if (!$rm)
784
-			unlink($path);
848
+		if (!$rm) {
849
+					unlink($path);
850
+		}
785 851
 		return true;
786 852
 	}
787 853
 	
@@ -797,7 +863,9 @@  discard block
 block discarded – undo
797 863
 	 * @return Array Coordinate of the route
798 864
 	*/
799 865
 	public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) {
800
-		if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
866
+		if ($nbpts <= 2) {
867
+			return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
868
+		}
801 869
 		$sx = deg2rad($begin_lon);
802 870
 		$sy = deg2rad($begin_lat);
803 871
 		$ex = deg2rad($end_lon);
@@ -806,7 +874,9 @@  discard block
 block discarded – undo
806 874
 		$h = $sy - $ey;
807 875
 		$z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2);
808 876
 		$g = 2.0*asin(sqrt($z));
809
-		if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
877
+		if ($g == M_PI || is_nan($g)) {
878
+			return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat));
879
+		}
810 880
 		$first_pass = array();
811 881
 		$delta = 1.0/($nbpts-1);
812 882
 		for ($i =0; $i < $nbpts; ++$i) {
Please login to merge, or discard this patch.