@@ -9,23 +9,23 @@ discard block |
||
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 |
||
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 |
||
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>'; |
@@ -4,8 +4,8 @@ |
||
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(); |
@@ -14,8 +14,12 @@ |
||
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) { |
@@ -7,14 +7,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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">'; |
@@ -45,8 +45,12 @@ discard block |
||
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 |
||
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 |
||
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'); |
@@ -9,22 +9,22 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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>'; |
@@ -4,8 +4,8 @@ |
||
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(); |
@@ -14,8 +14,12 @@ |
||
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) { |
@@ -9,22 +9,22 @@ discard block |
||
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 |
||
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 |
||
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>'; |
@@ -4,8 +4,8 @@ |
||
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(); |
@@ -14,8 +14,12 @@ |
||
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) { |
@@ -9,21 +9,21 @@ discard block |
||
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 |
||
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 |
||
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>'; |
@@ -4,8 +4,8 @@ |
||
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(); |
@@ -14,8 +14,12 @@ |
||
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) { |
@@ -9,22 +9,22 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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>'; |
@@ -4,8 +4,8 @@ |
||
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(); |
@@ -14,8 +14,12 @@ |
||
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) { |
@@ -9,22 +9,22 @@ discard block |
||
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 |
||
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 |
||
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>'; |
@@ -4,8 +4,8 @@ |
||
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(); |
@@ -14,8 +14,12 @@ |
||
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) { |
@@ -133,6 +133,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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!!! |
@@ -14,13 +14,13 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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++; |
@@ -21,12 +21,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -88,13 +88,13 @@ discard block |
||
88 | 88 | $info = curl_getinfo($ch); |
89 | 89 | //var_dump($info); |
90 | 90 | curl_close($ch); |
91 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
91 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
92 | 92 | echo "Cloudflare Detected\n"; |
93 | 93 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
94 | 94 | $useragent = UAgent::random(); |
95 | 95 | cloudflare::useUserAgent($useragent); |
96 | 96 | if ($clearanceCookie = cloudflare::bypass($url)) { |
97 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
97 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
98 | 98 | } |
99 | 99 | } else { |
100 | 100 | return $result; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | curl_setopt($ch, CURLOPT_COOKIEFILE, ''); |
121 | 121 | if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
122 | 122 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
123 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
123 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
124 | 124 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
125 | 125 | } |
126 | 126 | } |
@@ -138,20 +138,20 @@ discard block |
||
138 | 138 | fclose($fp); |
139 | 139 | } |
140 | 140 | |
141 | - public static function gunzip($in_file,$out_file_name = '') { |
|
141 | + public static function gunzip($in_file, $out_file_name = '') { |
|
142 | 142 | //echo $in_file.' -> '.$out_file_name."\n"; |
143 | 143 | $buffer_size = 4096; // read 4kb at a time |
144 | 144 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
145 | 145 | if ($in_file != '' && file_exists($in_file)) { |
146 | 146 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
147 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
148 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
147 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
148 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
149 | 149 | else { |
150 | 150 | echo 'gzopen not available'; |
151 | 151 | die; |
152 | 152 | } |
153 | 153 | $out_file = fopen($out_file_name, 'wb'); |
154 | - while(!gzeof($file)) { |
|
154 | + while (!gzeof($file)) { |
|
155 | 155 | fwrite($out_file, gzread($file, $buffer_size)); |
156 | 156 | } |
157 | 157 | fclose($out_file); |
@@ -159,19 +159,19 @@ discard block |
||
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
162 | - public static function bunzip2($in_file,$out_file_name = '') { |
|
162 | + public static function bunzip2($in_file, $out_file_name = '') { |
|
163 | 163 | //echo $in_file.' -> '.$out_file_name."\n"; |
164 | 164 | $buffer_size = 4096; // read 4kb at a time |
165 | 165 | if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
166 | 166 | if ($in_file != '' && file_exists($in_file)) { |
167 | 167 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
168 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
168 | + if (function_exists('bzopen')) $file = bzopen($in_file, 'rb'); |
|
169 | 169 | else { |
170 | 170 | echo 'bzopen not available'; |
171 | 171 | die; |
172 | 172 | } |
173 | 173 | $out_file = fopen($out_file_name, 'wb'); |
174 | - while(!feof($file)) { |
|
174 | + while (!feof($file)) { |
|
175 | 175 | fwrite($out_file, bzread($file, $buffer_size)); |
176 | 176 | } |
177 | 177 | fclose($out_file); |
@@ -189,27 +189,27 @@ discard block |
||
189 | 189 | if ($data == '') return array(); |
190 | 190 | $html = str_get_html($data); |
191 | 191 | if ($html === false) return array(); |
192 | - $tabledata=array(); |
|
193 | - foreach($html->find('tr') as $element) |
|
192 | + $tabledata = array(); |
|
193 | + foreach ($html->find('tr') as $element) |
|
194 | 194 | { |
195 | 195 | $td = array(); |
196 | - foreach( $element->find('th') as $row) |
|
196 | + foreach ($element->find('th') as $row) |
|
197 | 197 | { |
198 | 198 | $td [] = trim($row->plaintext); |
199 | 199 | } |
200 | - $td=array_filter($td); |
|
200 | + $td = array_filter($td); |
|
201 | 201 | $tabledata[] = $td; |
202 | 202 | |
203 | 203 | $td = array(); |
204 | 204 | $tdi = array(); |
205 | - foreach( $element->find('td') as $row) |
|
205 | + foreach ($element->find('td') as $row) |
|
206 | 206 | { |
207 | 207 | $td [] = trim($row->plaintext); |
208 | 208 | $tdi [] = trim($row->innertext); |
209 | 209 | } |
210 | - $td=array_filter($td); |
|
211 | - $tdi=array_filter($tdi); |
|
212 | - $tabledata[]=array_merge($td,$tdi); |
|
210 | + $td = array_filter($td); |
|
211 | + $tdi = array_filter($tdi); |
|
212 | + $tabledata[] = array_merge($td, $tdi); |
|
213 | 213 | } |
214 | 214 | $html->clear(); |
215 | 215 | unset($html); |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | public function text2array($data) { |
225 | 225 | $html = str_get_html($data); |
226 | 226 | if ($html === false) return array(); |
227 | - $tabledata=array(); |
|
228 | - foreach($html->find('p') as $element) |
|
227 | + $tabledata = array(); |
|
228 | + foreach ($html->find('p') as $element) |
|
229 | 229 | { |
230 | 230 | $tabledata [] = trim($element->plaintext); |
231 | 231 | } |
@@ -245,11 +245,11 @@ discard block |
||
245 | 245 | */ |
246 | 246 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
247 | 247 | if ($lat == $latc && $lon == $lonc) return 0; |
248 | - $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; |
|
248 | + $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; |
|
249 | 249 | if ($unit == "km") { |
250 | - return round($dist * 1.609344); |
|
250 | + return round($dist*1.609344); |
|
251 | 251 | } elseif ($unit == "m") { |
252 | - return round($dist * 1.609344 * 1000); |
|
252 | + return round($dist*1.609344*1000); |
|
253 | 253 | } elseif ($unit == "mile" || $unit == "mi") { |
254 | 254 | return round($dist); |
255 | 255 | } elseif ($unit == "nm") { |
@@ -266,8 +266,8 @@ discard block |
||
266 | 266 | * @param String $distance distance between two points in m |
267 | 267 | * @return Float plunge |
268 | 268 | */ |
269 | - public function plunge($initial_altitude,$final_altitude,$distance) { |
|
270 | - $plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance)); |
|
269 | + public function plunge($initial_altitude, $final_altitude, $distance) { |
|
270 | + $plunge = rad2deg(asin(($final_altitude - $initial_altitude)/$distance)); |
|
271 | 271 | /* |
272 | 272 | $siter = 6378137.0 + $initial_altitude; |
273 | 273 | $planer = 6378137.0 + $final_altitude; |
@@ -289,8 +289,8 @@ discard block |
||
289 | 289 | public function azimuth($lat, $lon, $latc, $lonc) { |
290 | 290 | $dX = $latc - $lat; |
291 | 291 | $dY = $lonc - $lon; |
292 | - $azimuth = rad2deg(atan2($dY,$dX)); |
|
293 | - if ($azimuth < 0) return $azimuth+360; |
|
292 | + $azimuth = rad2deg(atan2($dY, $dX)); |
|
293 | + if ($azimuth < 0) return $azimuth + 360; |
|
294 | 294 | return $azimuth; |
295 | 295 | } |
296 | 296 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | * @param float $distance distance covered |
302 | 302 | * @return bool whether distance is realistic |
303 | 303 | */ |
304 | - public function withinThreshold ($timeDifference, $distance) { |
|
304 | + public function withinThreshold($timeDifference, $distance) { |
|
305 | 305 | $x = abs($timeDifference); |
306 | 306 | $d = abs($distance); |
307 | 307 | if ($x == 0 || $d == 0) return true; |
@@ -317,13 +317,13 @@ discard block |
||
317 | 317 | return ($array !== array_values($array)); |
318 | 318 | } |
319 | 319 | |
320 | - public function isInteger($input){ |
|
320 | + public function isInteger($input) { |
|
321 | 321 | //return(ctype_digit(strval($input))); |
322 | - return preg_match('/^-?[0-9]+$/', (string)$input) ? true : false; |
|
322 | + return preg_match('/^-?[0-9]+$/', (string) $input) ? true : false; |
|
323 | 323 | } |
324 | 324 | |
325 | 325 | |
326 | - public function convertDec($dms,$latlong) { |
|
326 | + public function convertDec($dms, $latlong) { |
|
327 | 327 | if ($latlong == 'latitude') { |
328 | 328 | $deg = substr($dms, 0, 2); |
329 | 329 | $min = substr($dms, 2, 4); |
@@ -331,33 +331,33 @@ discard block |
||
331 | 331 | $deg = substr($dms, 0, 3); |
332 | 332 | $min = substr($dms, 3, 5); |
333 | 333 | } |
334 | - return $deg+(($min*60)/3600); |
|
334 | + return $deg + (($min*60)/3600); |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | public function convertDecLatLong($coord) { |
338 | 338 | //N43°36.763' W5°46.845' |
339 | - $coords = explode(' ',$coord); |
|
339 | + $coords = explode(' ', $coord); |
|
340 | 340 | $latitude = ''; |
341 | 341 | $longitude = ''; |
342 | 342 | foreach ($coords as $latlong) { |
343 | - $type = substr($latlong,0,1); |
|
344 | - $degmin = explode('°',substr($latlong,1,-1)); |
|
343 | + $type = substr($latlong, 0, 1); |
|
344 | + $degmin = explode('°', substr($latlong, 1, -1)); |
|
345 | 345 | $deg = $degmin[0]; |
346 | 346 | $min = $degmin[1]; |
347 | 347 | if ($type == 'N') { |
348 | - $latitude = $deg+(($min*60)/3600); |
|
348 | + $latitude = $deg + (($min*60)/3600); |
|
349 | 349 | } elseif ($type == 'S') { |
350 | - $latitude = -($deg+(($min*60)/3600)); |
|
350 | + $latitude = -($deg + (($min*60)/3600)); |
|
351 | 351 | } elseif ($type == 'E') { |
352 | - $longitude = ($deg+(($min*60)/3600)); |
|
352 | + $longitude = ($deg + (($min*60)/3600)); |
|
353 | 353 | } elseif ($type == 'W') { |
354 | - $longitude = -($deg+(($min*60)/3600)); |
|
354 | + $longitude = -($deg + (($min*60)/3600)); |
|
355 | 355 | } |
356 | 356 | } |
357 | - return array('latitude' => round($latitude,5),'longitude' => round($longitude,5)); |
|
357 | + return array('latitude' => round($latitude, 5), 'longitude' => round($longitude, 5)); |
|
358 | 358 | } |
359 | 359 | |
360 | - public function convertDM($coord,$latlong) { |
|
360 | + public function convertDM($coord, $latlong) { |
|
361 | 361 | if ($latlong == 'latitude') { |
362 | 362 | if ($coord < 0) $NSEW = 'S'; |
363 | 363 | else $NSEW = 'N'; |
@@ -367,11 +367,11 @@ discard block |
||
367 | 367 | } |
368 | 368 | $coord = abs($coord); |
369 | 369 | $deg = floor($coord); |
370 | - $coord = ($coord-$deg)*60; |
|
370 | + $coord = ($coord - $deg)*60; |
|
371 | 371 | $min = $coord; |
372 | - return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW); |
|
372 | + return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW); |
|
373 | 373 | } |
374 | - public function convertDMS($coord,$latlong) { |
|
374 | + public function convertDMS($coord, $latlong) { |
|
375 | 375 | if ($latlong == 'latitude') { |
376 | 376 | if ($coord < 0) $NSEW = 'S'; |
377 | 377 | else $NSEW = 'N'; |
@@ -381,10 +381,10 @@ discard block |
||
381 | 381 | } |
382 | 382 | $coord = abs($coord); |
383 | 383 | $deg = floor($coord); |
384 | - $coord = ($coord-$deg)*60; |
|
384 | + $coord = ($coord - $deg)*60; |
|
385 | 385 | $min = floor($coord); |
386 | - $sec = round(($coord-$min)*60); |
|
387 | - return array('deg' => $deg,'min' => $min,'sec' => $sec,'NSEW' => $NSEW); |
|
386 | + $sec = round(($coord - $min)*60); |
|
387 | + return array('deg' => $deg, 'min' => $min, 'sec' => $sec, 'NSEW' => $NSEW); |
|
388 | 388 | } |
389 | 389 | |
390 | 390 | /** |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | public function xcopy($source, $dest) |
397 | 397 | { |
398 | 398 | $files = glob($source.'*.*'); |
399 | - foreach($files as $file){ |
|
400 | - $file_to_go = str_replace($source,$dest,$file); |
|
399 | + foreach ($files as $file) { |
|
400 | + $file_to_go = str_replace($source, $dest, $file); |
|
401 | 401 | copy($file, $file_to_go); |
402 | 402 | } |
403 | 403 | return true; |
@@ -408,9 +408,9 @@ discard block |
||
408 | 408 | * @param String $url url to check |
409 | 409 | * @return bool Return true on succes false on failure |
410 | 410 | */ |
411 | - public function urlexist($url){ |
|
412 | - $headers=get_headers($url); |
|
413 | - return stripos($headers[0],"200 OK")?true:false; |
|
411 | + public function urlexist($url) { |
|
412 | + $headers = get_headers($url); |
|
413 | + return stripos($headers[0], "200 OK") ?true:false; |
|
414 | 414 | } |
415 | 415 | |
416 | 416 | /** |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | public function hex2str($hex) { |
422 | 422 | $str = ''; |
423 | 423 | $hexln = strlen($hex); |
424 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
424 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
425 | 425 | return $str; |
426 | 426 | } |
427 | 427 | |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @return String Return result |
432 | 432 | */ |
433 | 433 | public function hex2rgb($hex) { |
434 | - $hex = str_replace('#','',$hex); |
|
434 | + $hex = str_replace('#', '', $hex); |
|
435 | 435 | return sscanf($hex, "%02x%02x%02x"); |
436 | 436 | } |
437 | 437 | |
@@ -439,33 +439,33 @@ discard block |
||
439 | 439 | //difference in longitudinal coordinates |
440 | 440 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
441 | 441 | //difference in the phi of latitudinal coordinates |
442 | - $dPhi = log(tan(deg2rad($lat2) / 2 + M_PI / 4) / tan(deg2rad($lat1) / 2 + M_PI / 4)); |
|
442 | + $dPhi = log(tan(deg2rad($lat2)/2 + M_PI/4)/tan(deg2rad($lat1)/2 + M_PI/4)); |
|
443 | 443 | //we need to recalculate $dLon if it is greater than pi |
444 | - if(abs($dLon) > M_PI) { |
|
445 | - if($dLon > 0) { |
|
446 | - $dLon = (2 * M_PI - $dLon) * -1; |
|
444 | + if (abs($dLon) > M_PI) { |
|
445 | + if ($dLon > 0) { |
|
446 | + $dLon = (2*M_PI - $dLon)*-1; |
|
447 | 447 | } else { |
448 | - $dLon = 2 * M_PI + $dLon; |
|
448 | + $dLon = 2*M_PI + $dLon; |
|
449 | 449 | } |
450 | 450 | } |
451 | 451 | //return the angle, normalized |
452 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
452 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
453 | 453 | } |
454 | 454 | |
455 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.15) { |
|
455 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.15) { |
|
456 | 456 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
457 | - $a = -($lon2-$lon1); |
|
457 | + $a = -($lon2 - $lon1); |
|
458 | 458 | $b = $lat2 - $lat1; |
459 | - $c = -($a*$lat1+$b*$lon1); |
|
460 | - $d = $a*$lat3+$b*$lon3+$c; |
|
459 | + $c = -($a*$lat1 + $b*$lon1); |
|
460 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
461 | 461 | if ($d > -$approx && $d < $approx) return true; |
462 | 462 | else return false; |
463 | 463 | } |
464 | 464 | |
465 | 465 | public function array_merge_noappend() { |
466 | 466 | $output = array(); |
467 | - foreach(func_get_args() as $array) { |
|
468 | - foreach($array as $key => $value) { |
|
467 | + foreach (func_get_args() as $array) { |
|
468 | + foreach ($array as $key => $value) { |
|
469 | 469 | $output[$key] = isset($output[$key]) ? |
470 | 470 | array_merge($output[$key], $value) : $value; |
471 | 471 | } |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | return $result; |
530 | 530 | } |
531 | 531 | |
532 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = ''){ |
|
532 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = '') { |
|
533 | 533 | global $globalMapRefresh; |
534 | 534 | if ($seconds == '') { |
535 | 535 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
@@ -540,27 +540,27 @@ discard block |
||
540 | 540 | $latitude = deg2rad($latitude); |
541 | 541 | $longitude = deg2rad($longitude); |
542 | 542 | $bearing = deg2rad($heading); |
543 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
544 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
545 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
543 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
544 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
545 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
546 | 546 | } |
547 | 547 | |
548 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
548 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
549 | 549 | // distance in meter |
550 | 550 | $R = 6378.14; |
551 | - $latitude1 = $latitude * (M_PI/180); |
|
552 | - $longitude1 = $longitude * (M_PI/180); |
|
553 | - $brng = $bearing * (M_PI/180); |
|
551 | + $latitude1 = $latitude*(M_PI/180); |
|
552 | + $longitude1 = $longitude*(M_PI/180); |
|
553 | + $brng = $bearing*(M_PI/180); |
|
554 | 554 | $d = $distance; |
555 | 555 | |
556 | 556 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
557 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
557 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
558 | 558 | |
559 | - $latitude2 = $latitude2 * (180/M_PI); |
|
560 | - $longitude2 = $longitude2 * (180/M_PI); |
|
559 | + $latitude2 = $latitude2*(180/M_PI); |
|
560 | + $longitude2 = $longitude2*(180/M_PI); |
|
561 | 561 | |
562 | - $flat = round ($latitude2,6); |
|
563 | - $flong = round ($longitude2,6); |
|
562 | + $flat = round($latitude2, 6); |
|
563 | + $flong = round($longitude2, 6); |
|
564 | 564 | /* |
565 | 565 | $dx = $distance*cos($bearing); |
566 | 566 | $dy = $distance*sin($bearing); |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | $flong = $longitude + $dlong; |
570 | 570 | $flat = $latitude + $dlat; |
571 | 571 | */ |
572 | - return array('latitude' => $flat,'longitude' => $flong); |
|
572 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
573 | 573 | } |
574 | 574 | |
575 | 575 | /** |
@@ -583,14 +583,14 @@ discard block |
||
583 | 583 | * @param integer $level GZIP compression level (default: 9) |
584 | 584 | * @return string New filename (with .gz appended) if success, or false if operation fails |
585 | 585 | */ |
586 | - public function gzCompressFile($source, $level = 9){ |
|
587 | - $dest = $source . '.gz'; |
|
588 | - $mode = 'wb' . $level; |
|
586 | + public function gzCompressFile($source, $level = 9) { |
|
587 | + $dest = $source.'.gz'; |
|
588 | + $mode = 'wb'.$level; |
|
589 | 589 | $error = false; |
590 | 590 | if ($fp_out = gzopen($dest, $mode)) { |
591 | - if ($fp_in = fopen($source,'rb')) { |
|
591 | + if ($fp_in = fopen($source, 'rb')) { |
|
592 | 592 | while (!feof($fp_in)) |
593 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
593 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
594 | 594 | fclose($fp_in); |
595 | 595 | } else { |
596 | 596 | $error = true; |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | } |
607 | 607 | |
608 | 608 | public function remove_accents($string) { |
609 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
609 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
610 | 610 | $chars = array( |
611 | 611 | // Decompositions for Latin-1 Supplement |
612 | 612 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
664 | 664 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
665 | 665 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
666 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
666 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
667 | 667 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
668 | 668 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
669 | 669 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -679,13 +679,13 @@ discard block |
||
679 | 679 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
680 | 680 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
681 | 681 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
682 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
683 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
684 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
685 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
686 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
687 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
688 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
682 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
683 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
684 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
685 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
686 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
687 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
688 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
689 | 689 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
690 | 690 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
691 | 691 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
@@ -719,7 +719,7 @@ discard block |
||
719 | 719 | for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) { |
720 | 720 | if (is_numeric($string[$i]) && $concat_flag) { |
721 | 721 | $int .= $string[$i]; |
722 | - } elseif(!$concat && $concat_flag && strlen($int) > 0) { |
|
722 | + } elseif (!$concat && $concat_flag && strlen($int) > 0) { |
|
723 | 723 | $concat_flag = false; |
724 | 724 | } |
725 | 725 | } |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | $slice = array_slice($arr, $offset + 1, $length); |
766 | 766 | return implode("", $slice); |
767 | 767 | } else { |
768 | - return mb_substr($string,$offset,$length,'UTF-8'); |
|
768 | + return mb_substr($string, $offset, $length, 'UTF-8'); |
|
769 | 769 | } |
770 | 770 | } |
771 | 771 | |
@@ -775,14 +775,14 @@ discard block |
||
775 | 775 | //NOTE: use a trailing slash for folders!!! |
776 | 776 | //see http://bugs.php.net/bug.php?id=27609 |
777 | 777 | //see http://bugs.php.net/bug.php?id=30931 |
778 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
778 | + if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path |
|
779 | 779 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
780 | 780 | else if (is_dir($path)) |
781 | 781 | return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
782 | 782 | // check tmp file for read/write capabilities |
783 | 783 | $rm = file_exists($path); |
784 | 784 | $f = @fopen($path, 'a'); |
785 | - if ($f===false) |
|
785 | + if ($f === false) |
|
786 | 786 | return false; |
787 | 787 | fclose($f); |
788 | 788 | if (!$rm) |
@@ -801,29 +801,29 @@ discard block |
||
801 | 801 | * @param Integer $offset Controls the likelyhood that lines will be split which cross the dateline |
802 | 802 | * @return Array Coordinate of the route |
803 | 803 | */ |
804 | - public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) { |
|
805 | - if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
804 | + public function greatcircle($begin_lat, $begin_lon, $end_lat, $end_lon, $nbpts = 20, $offset = 10) { |
|
805 | + if ($nbpts <= 2) return array(array($begin_lon, $begin_lat), array($end_lon, $end_lat)); |
|
806 | 806 | $sx = deg2rad($begin_lon); |
807 | 807 | $sy = deg2rad($begin_lat); |
808 | 808 | $ex = deg2rad($end_lon); |
809 | 809 | $ey = deg2rad($end_lat); |
810 | 810 | $w = $sx - $ex; |
811 | 811 | $h = $sy - $ey; |
812 | - $z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2); |
|
812 | + $z = pow(sin($h/2.0), 2) + cos($sy)*cos($ey)*pow(sin($w/2.0), 2); |
|
813 | 813 | $g = 2.0*asin(sqrt($z)); |
814 | - if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
814 | + if ($g == M_PI || is_nan($g)) return array(array($begin_lon, $begin_lat), array($end_lon, $end_lat)); |
|
815 | 815 | $first_pass = array(); |
816 | - $delta = 1.0/($nbpts-1); |
|
817 | - for ($i =0; $i < $nbpts; ++$i) { |
|
816 | + $delta = 1.0/($nbpts - 1); |
|
817 | + for ($i = 0; $i < $nbpts; ++$i) { |
|
818 | 818 | $step = $delta*$i; |
819 | - $A = sin((1 - $step) * $g) / sin($g); |
|
820 | - $B = sin($step * $g) / sin($g); |
|
821 | - $x = $A * cos($sy) * cos($sx) + $B * cos($ey) * cos($ex); |
|
822 | - $y = $A * cos($sy) * sin($sx) + $B * cos($ey) * sin($ex); |
|
823 | - $z = $A * sin($sy) + $B * sin($ey); |
|
819 | + $A = sin((1 - $step)*$g)/sin($g); |
|
820 | + $B = sin($step*$g)/sin($g); |
|
821 | + $x = $A*cos($sy)*cos($sx) + $B*cos($ey)*cos($ex); |
|
822 | + $y = $A*cos($sy)*sin($sx) + $B*cos($ey)*sin($ex); |
|
823 | + $z = $A*sin($sy) + $B*sin($ey); |
|
824 | 824 | $lat = rad2deg(atan2($z, sqrt(pow($x, 2) + pow($y, 2)))); |
825 | 825 | $lon = rad2deg(atan2($y, $x)); |
826 | - $first_pass[] = array($lon,$lat); |
|
826 | + $first_pass[] = array($lon, $lat); |
|
827 | 827 | } |
828 | 828 | $bHasBigDiff = false; |
829 | 829 | $dfMaxSmallDiffLong = 0; |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | // https://github.com/OSGeo/gdal/blob/7bfb9c452a59aac958bff0c8386b891edf8154ca/gdal/ogr/ogrgeometryfactory.cpp#L2342 |
839 | 839 | $first_pass_ln = count($first_pass); |
840 | 840 | for ($j = 1; $j < $first_pass_ln; ++$j) { |
841 | - $dfPrevX = $first_pass[$j-1][0]; |
|
841 | + $dfPrevX = $first_pass[$j - 1][0]; |
|
842 | 842 | $dfX = $first_pass[$j][0]; |
843 | 843 | $dfDiffLong = abs($dfX - $dfPrevX); |
844 | 844 | if ($dfDiffLong > $dfDiffSpace && |
@@ -856,14 +856,14 @@ discard block |
||
856 | 856 | //$poMulti[] = $poNewLS; |
857 | 857 | for ($k = 0; $k < $first_pass_ln; ++$k) { |
858 | 858 | $dfX0 = floatval($first_pass[$k][0]); |
859 | - if ($k > 0 && abs($dfX0 - $first_pass[$k-1][0]) > $dfDiffSpace) { |
|
860 | - $dfX1 = floatval($first_pass[$k-1][0]); |
|
861 | - $dfY1 = floatval($first_pass[$k-1][1]); |
|
859 | + if ($k > 0 && abs($dfX0 - $first_pass[$k - 1][0]) > $dfDiffSpace) { |
|
860 | + $dfX1 = floatval($first_pass[$k - 1][0]); |
|
861 | + $dfY1 = floatval($first_pass[$k - 1][1]); |
|
862 | 862 | $dfX2 = floatval($first_pass[$k][0]); |
863 | 863 | $dfY2 = floatval($first_pass[$k][1]); |
864 | 864 | if ($dfX1 > -180 && $dfX1 < $dfRightBorderX && $dfX2 == 180 && |
865 | - $k+1 < count($first_pass) && |
|
866 | - $first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX) |
|
865 | + $k + 1 < count($first_pass) && |
|
866 | + $first_pass[$k - 1][0] > -180 && $first_pass[$k - 1][0] < $dfRightBorderX) |
|
867 | 867 | { |
868 | 868 | $poNewLS[] = array(-180, $first_pass[$k][1]); |
869 | 869 | $k++; |
@@ -871,8 +871,8 @@ discard block |
||
871 | 871 | $poNewLS[] = array($first_pass[$k][0], $first_pass[$k][1]); |
872 | 872 | continue; |
873 | 873 | } else if ($dfX1 > $dfLeftBorderX && $dfX1 < 180 && $dfX2 == -180 && |
874 | - $k+1 < $first_pass_ln && |
|
875 | - $first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180) |
|
874 | + $k + 1 < $first_pass_ln && |
|
875 | + $first_pass[$k - 1][0] > $dfLeftBorderX && $first_pass[$k - 1][0] < 180) |
|
876 | 876 | { |
877 | 877 | $poNewLS[] = array(180, $first_pass[$k][1]); |
878 | 878 | $k++; |
@@ -895,12 +895,12 @@ discard block |
||
895 | 895 | } |
896 | 896 | if ($dfX1 <= 180 && $dfX2 >= 180 && $dfX1 < $dfX2) |
897 | 897 | { |
898 | - $dfRatio = (180 - $dfX1) / ($dfX2 - $dfX1); |
|
899 | - $dfY = $dfRatio * $dfY2 + (1 - $dfRatio) * $dfY1; |
|
900 | - $poNewLS[] = array($first_pass[$k-1][0] > $dfLeftBorderX ? 180 : -180, $dfY); |
|
898 | + $dfRatio = (180 - $dfX1)/($dfX2 - $dfX1); |
|
899 | + $dfY = $dfRatio*$dfY2 + (1 - $dfRatio)*$dfY1; |
|
900 | + $poNewLS[] = array($first_pass[$k - 1][0] > $dfLeftBorderX ? 180 : -180, $dfY); |
|
901 | 901 | $poMulti[] = $poNewLS; |
902 | 902 | $poNewLS = array(); |
903 | - $poNewLS[] = array($first_pass[$k-1][0] > $dfLeftBorderX ? -180 : 180, $dfY); |
|
903 | + $poNewLS[] = array($first_pass[$k - 1][0] > $dfLeftBorderX ? -180 : 180, $dfY); |
|
904 | 904 | //$poMulti[] = $poNewLS; |
905 | 905 | } else { |
906 | 906 | //$poNewLS[] = array(); |
@@ -918,7 +918,7 @@ discard block |
||
918 | 918 | $poNewLS0 = array(); |
919 | 919 | //$poMulti[] = $poNewLS0; |
920 | 920 | for ($l = 0; $l < $first_pass_ln; ++$l) { |
921 | - $poNewLS0[] = array($first_pass[$l][0],$first_pass[$l][1]); |
|
921 | + $poNewLS0[] = array($first_pass[$l][0], $first_pass[$l][1]); |
|
922 | 922 | } |
923 | 923 | $poMulti[] = $poNewLS0; |
924 | 924 | } |
@@ -36,7 +36,9 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -104,8 +111,9 @@ discard block |
||
104 | 111 | private function curlResponseHeaderCallback($ch, $headerLine) { |
105 | 112 | global $curl_cookies; |
106 | 113 | $curl_cookies = array(); |
107 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
108 | - $curl_cookies[] = $cookie; |
|
114 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
115 | + $curl_cookies[] = $cookie; |
|
116 | + } |
|
109 | 117 | return strlen($headerLine); // Needed by curl |
110 | 118 | } |
111 | 119 | |
@@ -118,7 +126,9 @@ discard block |
||
118 | 126 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
119 | 127 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
120 | 128 | curl_setopt($ch, CURLOPT_COOKIEFILE, ''); |
121 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
129 | + if ($referer != '') { |
|
130 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
131 | + } |
|
122 | 132 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
123 | 133 | if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
124 | 134 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
@@ -133,7 +143,9 @@ discard block |
||
133 | 143 | 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'); |
134 | 144 | curl_setopt($ch, CURLOPT_FILE, $fp); |
135 | 145 | curl_exec($ch); |
136 | - if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch); |
|
146 | + if (curl_errno($ch) && $globalDebug) { |
|
147 | + echo 'Download error: '.curl_error($ch); |
|
148 | + } |
|
137 | 149 | curl_close($ch); |
138 | 150 | fclose($fp); |
139 | 151 | } |
@@ -141,12 +153,16 @@ discard block |
||
141 | 153 | public static function gunzip($in_file,$out_file_name = '') { |
142 | 154 | //echo $in_file.' -> '.$out_file_name."\n"; |
143 | 155 | $buffer_size = 4096; // read 4kb at a time |
144 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
156 | + if ($out_file_name == '') { |
|
157 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
158 | + } |
|
145 | 159 | if ($in_file != '' && file_exists($in_file)) { |
146 | 160 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
147 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
148 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
149 | - else { |
|
161 | + if (function_exists('gzopen')) { |
|
162 | + $file = gzopen($in_file,'rb'); |
|
163 | + } elseif (function_exists('gzopen64')) { |
|
164 | + $file = gzopen64($in_file,'rb'); |
|
165 | + } else { |
|
150 | 166 | echo 'gzopen not available'; |
151 | 167 | die; |
152 | 168 | } |
@@ -162,11 +178,14 @@ discard block |
||
162 | 178 | public static function bunzip2($in_file,$out_file_name = '') { |
163 | 179 | //echo $in_file.' -> '.$out_file_name."\n"; |
164 | 180 | $buffer_size = 4096; // read 4kb at a time |
165 | - if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
|
181 | + if ($out_file_name == '') { |
|
182 | + $out_file_name = str_replace('.bz2', '', $in_file); |
|
183 | + } |
|
166 | 184 | if ($in_file != '' && file_exists($in_file)) { |
167 | 185 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
168 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
169 | - else { |
|
186 | + if (function_exists('bzopen')) { |
|
187 | + $file = bzopen($in_file,'rb'); |
|
188 | + } else { |
|
170 | 189 | echo 'bzopen not available'; |
171 | 190 | die; |
172 | 191 | } |
@@ -185,10 +204,16 @@ discard block |
||
185 | 204 | * @return array array of the tables in HTML page |
186 | 205 | */ |
187 | 206 | public function table2array($data) { |
188 | - if (!is_string($data)) return array(); |
|
189 | - if ($data == '') return array(); |
|
207 | + if (!is_string($data)) { |
|
208 | + return array(); |
|
209 | + } |
|
210 | + if ($data == '') { |
|
211 | + return array(); |
|
212 | + } |
|
190 | 213 | $html = str_get_html($data); |
191 | - if ($html === false) return array(); |
|
214 | + if ($html === false) { |
|
215 | + return array(); |
|
216 | + } |
|
192 | 217 | $tabledata=array(); |
193 | 218 | foreach($html->find('tr') as $element) |
194 | 219 | { |
@@ -223,7 +248,9 @@ discard block |
||
223 | 248 | */ |
224 | 249 | public function text2array($data) { |
225 | 250 | $html = str_get_html($data); |
226 | - if ($html === false) return array(); |
|
251 | + if ($html === false) { |
|
252 | + return array(); |
|
253 | + } |
|
227 | 254 | $tabledata=array(); |
228 | 255 | foreach($html->find('p') as $element) |
229 | 256 | { |
@@ -244,7 +271,9 @@ discard block |
||
244 | 271 | * @return Float Distance in $unit |
245 | 272 | */ |
246 | 273 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
247 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
274 | + if ($lat == $latc && $lon == $lonc) { |
|
275 | + return 0; |
|
276 | + } |
|
248 | 277 | $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; |
249 | 278 | if ($unit == "km") { |
250 | 279 | return round($dist * 1.609344); |
@@ -290,7 +319,9 @@ discard block |
||
290 | 319 | $dX = $latc - $lat; |
291 | 320 | $dY = $lonc - $lon; |
292 | 321 | $azimuth = rad2deg(atan2($dY,$dX)); |
293 | - if ($azimuth < 0) return $azimuth+360; |
|
322 | + if ($azimuth < 0) { |
|
323 | + return $azimuth+360; |
|
324 | + } |
|
294 | 325 | return $azimuth; |
295 | 326 | } |
296 | 327 | |
@@ -304,10 +335,16 @@ discard block |
||
304 | 335 | public function withinThreshold ($timeDifference, $distance) { |
305 | 336 | $x = abs($timeDifference); |
306 | 337 | $d = abs($distance); |
307 | - if ($x == 0 || $d == 0) return true; |
|
338 | + if ($x == 0 || $d == 0) { |
|
339 | + return true; |
|
340 | + } |
|
308 | 341 | // may be due to Internet jitter; distance is realistic |
309 | - if ($x < 0.7 && $d < 2000) return true; |
|
310 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
342 | + if ($x < 0.7 && $d < 2000) { |
|
343 | + return true; |
|
344 | + } else { |
|
345 | + return $d/$x < 1500*0.27778; |
|
346 | + } |
|
347 | + // 1500 km/h max |
|
311 | 348 | } |
312 | 349 | |
313 | 350 | |
@@ -359,11 +396,17 @@ discard block |
||
359 | 396 | |
360 | 397 | public function convertDM($coord,$latlong) { |
361 | 398 | if ($latlong == 'latitude') { |
362 | - if ($coord < 0) $NSEW = 'S'; |
|
363 | - else $NSEW = 'N'; |
|
399 | + if ($coord < 0) { |
|
400 | + $NSEW = 'S'; |
|
401 | + } else { |
|
402 | + $NSEW = 'N'; |
|
403 | + } |
|
364 | 404 | } else { |
365 | - if ($coord < 0) $NSEW = 'W'; |
|
366 | - else $NSEW = 'E'; |
|
405 | + if ($coord < 0) { |
|
406 | + $NSEW = 'W'; |
|
407 | + } else { |
|
408 | + $NSEW = 'E'; |
|
409 | + } |
|
367 | 410 | } |
368 | 411 | $coord = abs($coord); |
369 | 412 | $deg = floor($coord); |
@@ -373,11 +416,17 @@ discard block |
||
373 | 416 | } |
374 | 417 | public function convertDMS($coord,$latlong) { |
375 | 418 | if ($latlong == 'latitude') { |
376 | - if ($coord < 0) $NSEW = 'S'; |
|
377 | - else $NSEW = 'N'; |
|
419 | + if ($coord < 0) { |
|
420 | + $NSEW = 'S'; |
|
421 | + } else { |
|
422 | + $NSEW = 'N'; |
|
423 | + } |
|
378 | 424 | } else { |
379 | - if ($coord < 0) $NSEW = 'W'; |
|
380 | - else $NSEW = 'E'; |
|
425 | + if ($coord < 0) { |
|
426 | + $NSEW = 'W'; |
|
427 | + } else { |
|
428 | + $NSEW = 'E'; |
|
429 | + } |
|
381 | 430 | } |
382 | 431 | $coord = abs($coord); |
383 | 432 | $deg = floor($coord); |
@@ -421,7 +470,9 @@ discard block |
||
421 | 470 | public function hex2str($hex) { |
422 | 471 | $str = ''; |
423 | 472 | $hexln = strlen($hex); |
424 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
473 | + for($i=0;$i<$hexln;$i+=2) { |
|
474 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
475 | + } |
|
425 | 476 | return $str; |
426 | 477 | } |
427 | 478 | |
@@ -458,8 +509,11 @@ discard block |
||
458 | 509 | $b = $lat2 - $lat1; |
459 | 510 | $c = -($a*$lat1+$b*$lon1); |
460 | 511 | $d = $a*$lat3+$b*$lon3+$c; |
461 | - if ($d > -$approx && $d < $approx) return true; |
|
462 | - else return false; |
|
512 | + if ($d > -$approx && $d < $approx) { |
|
513 | + return true; |
|
514 | + } else { |
|
515 | + return false; |
|
516 | + } |
|
463 | 517 | } |
464 | 518 | |
465 | 519 | public function array_merge_noappend() { |
@@ -518,7 +572,9 @@ discard block |
||
518 | 572 | return $result; |
519 | 573 | } |
520 | 574 | $handle = @opendir('./locale'); |
521 | - if ($handle === false) return $result; |
|
575 | + if ($handle === false) { |
|
576 | + return $result; |
|
577 | + } |
|
522 | 578 | while (false !== ($file = readdir($handle))) { |
523 | 579 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
524 | 580 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -589,8 +645,9 @@ discard block |
||
589 | 645 | $error = false; |
590 | 646 | if ($fp_out = gzopen($dest, $mode)) { |
591 | 647 | if ($fp_in = fopen($source,'rb')) { |
592 | - while (!feof($fp_in)) |
|
593 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
648 | + while (!feof($fp_in)) { |
|
649 | + gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
650 | + } |
|
594 | 651 | fclose($fp_in); |
595 | 652 | } else { |
596 | 653 | $error = true; |
@@ -599,14 +656,17 @@ discard block |
||
599 | 656 | } else { |
600 | 657 | $error = true; |
601 | 658 | } |
602 | - if ($error) |
|
603 | - return false; |
|
604 | - else |
|
605 | - return $dest; |
|
659 | + if ($error) { |
|
660 | + return false; |
|
661 | + } else { |
|
662 | + return $dest; |
|
663 | + } |
|
606 | 664 | } |
607 | 665 | |
608 | 666 | public function remove_accents($string) { |
609 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
667 | + if ( !preg_match('/[\x80-\xff]/', $string) ) { |
|
668 | + return $string; |
|
669 | + } |
|
610 | 670 | $chars = array( |
611 | 671 | // Decompositions for Latin-1 Supplement |
612 | 672 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -730,7 +790,9 @@ discard block |
||
730 | 790 | $ip = gethostbyname($host); |
731 | 791 | $s = socket_create(AF_INET, SOCK_STREAM, 0); |
732 | 792 | $r = @socket_connect($s, $ip, $port); |
733 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
793 | + if (!socket_set_nonblock($s)) { |
|
794 | + echo "Unable to set nonblock on socket\n"; |
|
795 | + } |
|
734 | 796 | if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
735 | 797 | return $s; |
736 | 798 | } |
@@ -775,18 +837,22 @@ discard block |
||
775 | 837 | //NOTE: use a trailing slash for folders!!! |
776 | 838 | //see http://bugs.php.net/bug.php?id=27609 |
777 | 839 | //see http://bugs.php.net/bug.php?id=30931 |
778 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
840 | + if ($path{strlen($path)-1}=='/') { |
|
841 | + // recursively return a temporary file path |
|
779 | 842 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
780 | - else if (is_dir($path)) |
|
781 | - return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
843 | + } else if (is_dir($path)) { |
|
844 | + return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
845 | + } |
|
782 | 846 | // check tmp file for read/write capabilities |
783 | 847 | $rm = file_exists($path); |
784 | 848 | $f = @fopen($path, 'a'); |
785 | - if ($f===false) |
|
786 | - return false; |
|
849 | + if ($f===false) { |
|
850 | + return false; |
|
851 | + } |
|
787 | 852 | fclose($f); |
788 | - if (!$rm) |
|
789 | - unlink($path); |
|
853 | + if (!$rm) { |
|
854 | + unlink($path); |
|
855 | + } |
|
790 | 856 | return true; |
791 | 857 | } |
792 | 858 | |
@@ -802,7 +868,9 @@ discard block |
||
802 | 868 | * @return Array Coordinate of the route |
803 | 869 | */ |
804 | 870 | public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) { |
805 | - if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
871 | + if ($nbpts <= 2) { |
|
872 | + return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
873 | + } |
|
806 | 874 | $sx = deg2rad($begin_lon); |
807 | 875 | $sy = deg2rad($begin_lat); |
808 | 876 | $ex = deg2rad($end_lon); |
@@ -811,7 +879,9 @@ discard block |
||
811 | 879 | $h = $sy - $ey; |
812 | 880 | $z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2); |
813 | 881 | $g = 2.0*asin(sqrt($z)); |
814 | - if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
882 | + if ($g == M_PI || is_nan($g)) { |
|
883 | + return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
884 | + } |
|
815 | 885 | $first_pass = array(); |
816 | 886 | $delta = 1.0/($nbpts-1); |
817 | 887 | for ($i =0; $i < $nbpts; ++$i) { |
@@ -1784,7 +1784,7 @@ discard block |
||
1784 | 1784 | /** |
1785 | 1785 | * Counts all hours |
1786 | 1786 | * |
1787 | - * @param $orderby |
|
1787 | + * @param string $orderby |
|
1788 | 1788 | * @param array $filters |
1789 | 1789 | * @return array the hour list |
1790 | 1790 | */ |
@@ -2263,7 +2263,7 @@ discard block |
||
2263 | 2263 | /** |
2264 | 2264 | * Parses the direction degrees to working |
2265 | 2265 | * |
2266 | - * @param Float $direction the direction in degrees |
|
2266 | + * @param integer $direction the direction in degrees |
|
2267 | 2267 | * @return array the direction information |
2268 | 2268 | * |
2269 | 2269 | */ |
@@ -15,7 +15,9 @@ discard block |
||
15 | 15 | public function __construct($dbc = null) { |
16 | 16 | $Connection = new Connection($dbc); |
17 | 17 | $this->db = $Connection->db(); |
18 | - if ($this->db === null) die('Error: No DB connection. (Marine)'); |
|
18 | + if ($this->db === null) { |
|
19 | + die('Error: No DB connection. (Marine)'); |
|
20 | + } |
|
19 | 21 | } |
20 | 22 | |
21 | 23 | /** |
@@ -38,7 +40,9 @@ discard block |
||
38 | 40 | if (isset($filter[0]['source'])) { |
39 | 41 | $filters = array_merge($filters,$filter); |
40 | 42 | } |
41 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
43 | + if (is_array($globalFilter)) { |
|
44 | + $filter = array_merge($filter,$globalFilter); |
|
45 | + } |
|
42 | 46 | $filter_query_join = ''; |
43 | 47 | $filter_query_where = ''; |
44 | 48 | foreach($filters as $flt) { |
@@ -86,8 +90,11 @@ discard block |
||
86 | 90 | $filter_query_where .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
87 | 91 | } |
88 | 92 | } |
89 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
90 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
93 | + if ($filter_query_where == '' && $where) { |
|
94 | + $filter_query_where = ' WHERE'; |
|
95 | + } elseif ($filter_query_where != '' && $and) { |
|
96 | + $filter_query_where .= ' AND'; |
|
97 | + } |
|
91 | 98 | if ($filter_query_where != '') { |
92 | 99 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
93 | 100 | } |
@@ -142,42 +149,84 @@ discard block |
||
142 | 149 | $temp_array['spotter_id'] = $row['spotter_archive_id']; |
143 | 150 | } elseif (isset($row['spotter_archive_output_id'])) { |
144 | 151 | $temp_array['spotter_id'] = $row['spotter_archive_output_id']; |
145 | - */} |
|
146 | - elseif (isset($row['marineid'])) { |
|
152 | + */} elseif (isset($row['marineid'])) { |
|
147 | 153 | $temp_array['marine_id'] = $row['marineid']; |
148 | 154 | } else { |
149 | 155 | $temp_array['marine_id'] = ''; |
150 | 156 | } |
151 | - if (isset($row['fammarine_id'])) $temp_array['fammarine_id'] = $row['fammarine_id']; |
|
152 | - if (isset($row['mmsi'])) $temp_array['mmsi'] = $row['mmsi']; |
|
153 | - if (isset($row['type'])) $temp_array['type'] = html_entity_decode($row['type'],ENT_QUOTES); |
|
154 | - if (isset($row['type_id'])) $temp_array['type_id'] = $row['type_id']; |
|
155 | - if (isset($row['status'])) $temp_array['status'] = $row['status']; |
|
156 | - if (isset($row['status_id'])) $temp_array['status_id'] = $row['status_id']; |
|
157 | - if (isset($row['captain_id'])) $temp_array['captain_id'] = $row['captain_id']; |
|
158 | - if (isset($row['captain_name'])) $temp_array['captain_name'] = $row['captain_name']; |
|
159 | - if (isset($row['race_id'])) $temp_array['race_id'] = $row['race_id']; |
|
160 | - if (isset($row['race_name'])) $temp_array['race_name'] = $row['race_name']; |
|
161 | - if (isset($row['race_time']) && isset($row['status']) && $row['status'] != 'Racing' && $row['race_time'] > 0) $temp_array['race_time'] = $row['race_time']; |
|
162 | - if (isset($row['race_rank'])) $temp_array['race_rank'] = $row['race_rank']; |
|
163 | - if (isset($row['ident'])) $temp_array['ident'] = $row['ident']; |
|
164 | - if (isset($row['arrival_port_name'])) $temp_array['arrival_port_name'] = $row['arrival_port_name']; |
|
165 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
166 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
167 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
168 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
157 | + if (isset($row['fammarine_id'])) { |
|
158 | + $temp_array['fammarine_id'] = $row['fammarine_id']; |
|
159 | + } |
|
160 | + if (isset($row['mmsi'])) { |
|
161 | + $temp_array['mmsi'] = $row['mmsi']; |
|
162 | + } |
|
163 | + if (isset($row['type'])) { |
|
164 | + $temp_array['type'] = html_entity_decode($row['type'],ENT_QUOTES); |
|
165 | + } |
|
166 | + if (isset($row['type_id'])) { |
|
167 | + $temp_array['type_id'] = $row['type_id']; |
|
168 | + } |
|
169 | + if (isset($row['status'])) { |
|
170 | + $temp_array['status'] = $row['status']; |
|
171 | + } |
|
172 | + if (isset($row['status_id'])) { |
|
173 | + $temp_array['status_id'] = $row['status_id']; |
|
174 | + } |
|
175 | + if (isset($row['captain_id'])) { |
|
176 | + $temp_array['captain_id'] = $row['captain_id']; |
|
177 | + } |
|
178 | + if (isset($row['captain_name'])) { |
|
179 | + $temp_array['captain_name'] = $row['captain_name']; |
|
180 | + } |
|
181 | + if (isset($row['race_id'])) { |
|
182 | + $temp_array['race_id'] = $row['race_id']; |
|
183 | + } |
|
184 | + if (isset($row['race_name'])) { |
|
185 | + $temp_array['race_name'] = $row['race_name']; |
|
186 | + } |
|
187 | + if (isset($row['race_time']) && isset($row['status']) && $row['status'] != 'Racing' && $row['race_time'] > 0) { |
|
188 | + $temp_array['race_time'] = $row['race_time']; |
|
189 | + } |
|
190 | + if (isset($row['race_rank'])) { |
|
191 | + $temp_array['race_rank'] = $row['race_rank']; |
|
192 | + } |
|
193 | + if (isset($row['ident'])) { |
|
194 | + $temp_array['ident'] = $row['ident']; |
|
195 | + } |
|
196 | + if (isset($row['arrival_port_name'])) { |
|
197 | + $temp_array['arrival_port_name'] = $row['arrival_port_name']; |
|
198 | + } |
|
199 | + if (isset($row['latitude'])) { |
|
200 | + $temp_array['latitude'] = $row['latitude']; |
|
201 | + } |
|
202 | + if (isset($row['longitude'])) { |
|
203 | + $temp_array['longitude'] = $row['longitude']; |
|
204 | + } |
|
205 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
206 | + $temp_array['distance'] = $row['distance']; |
|
207 | + } |
|
208 | + if (isset($row['format_source'])) { |
|
209 | + $temp_array['format_source'] = $row['format_source']; |
|
210 | + } |
|
169 | 211 | if (isset($row['heading'])) { |
170 | 212 | $temp_array['heading'] = $row['heading']; |
171 | 213 | $heading_direction = $this->parseDirection($row['heading']); |
172 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
214 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
215 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
216 | + } |
|
217 | + } |
|
218 | + if (isset($row['ground_speed'])) { |
|
219 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
173 | 220 | } |
174 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
175 | 221 | |
176 | 222 | if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
177 | 223 | { |
178 | 224 | $Image = new Image($this->db); |
179 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
180 | - else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
225 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') { |
|
226 | + $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
227 | + } else { |
|
228 | + $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
229 | + } |
|
181 | 230 | unset($Image); |
182 | 231 | if (count($image_array) > 0) { |
183 | 232 | $temp_array['image'] = $image_array[0]['image']; |
@@ -241,13 +290,21 @@ discard block |
||
241 | 290 | } |
242 | 291 | |
243 | 292 | $fromsource = NULL; |
244 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
245 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
246 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
293 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
294 | + $temp_array['source_name'] = $row['source_name']; |
|
295 | + } |
|
296 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
297 | + $temp_array['over_country'] = $row['over_country']; |
|
298 | + } |
|
299 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
300 | + $temp_array['distance'] = $row['distance']; |
|
301 | + } |
|
247 | 302 | $temp_array['query_number_rows'] = $num_rows; |
248 | 303 | $spotter_array[] = $temp_array; |
249 | 304 | } |
250 | - if ($num_rows == 0) return array(); |
|
305 | + if ($num_rows == 0) { |
|
306 | + return array(); |
|
307 | + } |
|
251 | 308 | $spotter_array[0]['query_number_rows'] = $num_rows; |
252 | 309 | return $spotter_array; |
253 | 310 | } |
@@ -275,8 +332,12 @@ discard block |
||
275 | 332 | { |
276 | 333 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
277 | 334 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
278 | - } else $limit_query = ""; |
|
279 | - } else $limit_query = ""; |
|
335 | + } else { |
|
336 | + $limit_query = ""; |
|
337 | + } |
|
338 | + } else { |
|
339 | + $limit_query = ""; |
|
340 | + } |
|
280 | 341 | if ($sort != "") |
281 | 342 | { |
282 | 343 | $search_orderby_array = $this->getOrderBy(); |
@@ -300,7 +361,9 @@ discard block |
||
300 | 361 | global $global_marine_query; |
301 | 362 | |
302 | 363 | date_default_timezone_set('UTC'); |
303 | - if ($id == '') return array(); |
|
364 | + if ($id == '') { |
|
365 | + return array(); |
|
366 | + } |
|
304 | 367 | $additional_query = "marine_output.fammarine_id = :id"; |
305 | 368 | $query_values = array(':id' => $id); |
306 | 369 | $query = $global_marine_query." WHERE ".$additional_query." "; |
@@ -781,8 +844,11 @@ discard block |
||
781 | 844 | $sth = $this->db->prepare($query); |
782 | 845 | $sth->execute($query_values); |
783 | 846 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
784 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
785 | - else return $result[0]['duration']; |
|
847 | + if (is_int($result[0]['duration'])) { |
|
848 | + return gmdate('H:i:s',$result[0]['duration']); |
|
849 | + } else { |
|
850 | + return $result[0]['duration']; |
|
851 | + } |
|
786 | 852 | } |
787 | 853 | |
788 | 854 | /** |
@@ -830,7 +896,9 @@ discard block |
||
830 | 896 | } |
831 | 897 | } |
832 | 898 | $query .= " GROUP BY marine_output.captain_id,marine_output.captain_name ORDER BY duration DESC"; |
833 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
899 | + if ($limit) { |
|
900 | + $query .= " LIMIT 10 OFFSET 0"; |
|
901 | + } |
|
834 | 902 | $sth = $this->db->prepare($query); |
835 | 903 | $sth->execute($query_values); |
836 | 904 | //if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
@@ -909,8 +977,11 @@ discard block |
||
909 | 977 | $query .= " ORDER BY marine_output.source_name ASC"; |
910 | 978 | |
911 | 979 | $sth = $this->db->prepare($query); |
912 | - if (!empty($query_values)) $sth->execute($query_values); |
|
913 | - else $sth->execute(); |
|
980 | + if (!empty($query_values)) { |
|
981 | + $sth->execute($query_values); |
|
982 | + } else { |
|
983 | + $sth->execute(); |
|
984 | + } |
|
914 | 985 | |
915 | 986 | $source_array = array(); |
916 | 987 | $temp_array = array(); |
@@ -965,8 +1036,11 @@ discard block |
||
965 | 1036 | $sth = $this->db->prepare($query); |
966 | 1037 | $sth->execute(array(':mmsi' => $mmsi)); |
967 | 1038 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
968 | - if (isset($result[0])) return $result[0]; |
|
969 | - else return array(); |
|
1039 | + if (isset($result[0])) { |
|
1040 | + return $result[0]; |
|
1041 | + } else { |
|
1042 | + return array(); |
|
1043 | + } |
|
970 | 1044 | } |
971 | 1045 | |
972 | 1046 | /** |
@@ -1011,7 +1085,9 @@ discard block |
||
1011 | 1085 | date_default_timezone_set($globalTimezone); |
1012 | 1086 | $datetime = new DateTime(); |
1013 | 1087 | $offset = $datetime->format('P'); |
1014 | - } else $offset = '+00:00'; |
|
1088 | + } else { |
|
1089 | + $offset = '+00:00'; |
|
1090 | + } |
|
1015 | 1091 | |
1016 | 1092 | if ($globalDBdriver == 'mysql') { |
1017 | 1093 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
@@ -1127,8 +1203,12 @@ discard block |
||
1127 | 1203 | */ |
1128 | 1204 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '',$distance = NULL,$race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
1129 | 1205 | { |
1130 | - if ($latitude == '') $latitude = NULL; |
|
1131 | - if ($longitude == '') $longitude = NULL; |
|
1206 | + if ($latitude == '') { |
|
1207 | + $latitude = NULL; |
|
1208 | + } |
|
1209 | + if ($longitude == '') { |
|
1210 | + $longitude = NULL; |
|
1211 | + } |
|
1132 | 1212 | $groundspeed = round($groundspeed); |
1133 | 1213 | if ($race_begin != '') { |
1134 | 1214 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed, distance = :distance, race_rank = :race_rank, race_time = :race_time, status = :status, date = :race_begin WHERE fammarine_id = :fammarine_id'; |
@@ -1286,14 +1366,28 @@ discard block |
||
1286 | 1366 | $latitude = 0; |
1287 | 1367 | $longitude = 0; |
1288 | 1368 | } |
1289 | - if ($type_id == '') $type_id = NULL; |
|
1290 | - if ($status_id == '') $status_id = NULL; |
|
1291 | - if ($distance == '') $distance = NULL; |
|
1292 | - if ($race_rank == '') $race_rank = NULL; |
|
1293 | - if ($race_time == '') $race_time = NULL; |
|
1294 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1369 | + if ($type_id == '') { |
|
1370 | + $type_id = NULL; |
|
1371 | + } |
|
1372 | + if ($status_id == '') { |
|
1373 | + $status_id = NULL; |
|
1374 | + } |
|
1375 | + if ($distance == '') { |
|
1376 | + $distance = NULL; |
|
1377 | + } |
|
1378 | + if ($race_rank == '') { |
|
1379 | + $race_rank = NULL; |
|
1380 | + } |
|
1381 | + if ($race_time == '') { |
|
1382 | + $race_time = NULL; |
|
1383 | + } |
|
1384 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
1385 | + $heading = 0; |
|
1386 | + } |
|
1295 | 1387 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
1296 | - if ($arrival_date == '') $arrival_date = NULL; |
|
1388 | + if ($arrival_date == '') { |
|
1389 | + $arrival_date = NULL; |
|
1390 | + } |
|
1297 | 1391 | $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name, distance, race_rank,race_time) |
1298 | 1392 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name, :distance, :race_rank,:race_time)"; |
1299 | 1393 | |
@@ -1401,7 +1495,9 @@ discard block |
||
1401 | 1495 | global $globalDBdriver, $globalArchive; |
1402 | 1496 | //$filter_query = $this->getFilter($filters,true,true); |
1403 | 1497 | $Connection= new Connection($this->db); |
1404 | - if (!$Connection->tableExists('countries')) return array(); |
|
1498 | + if (!$Connection->tableExists('countries')) { |
|
1499 | + return array(); |
|
1500 | + } |
|
1405 | 1501 | require_once('class.SpotterLive.php'); |
1406 | 1502 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
1407 | 1503 | $MarineLive = new MarineLive($this->db); |
@@ -1445,7 +1541,9 @@ discard block |
||
1445 | 1541 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT fammarine_id,over_country FROM marine_archive".$filter_query.") l ON c.iso2 = l.over_country "; |
1446 | 1542 | } |
1447 | 1543 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
1448 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
1544 | + if ($limit) { |
|
1545 | + $query .= " LIMIT 10 OFFSET 0"; |
|
1546 | + } |
|
1449 | 1547 | |
1450 | 1548 | $sth = $this->db->prepare($query); |
1451 | 1549 | $sth->execute(); |
@@ -1484,12 +1582,18 @@ discard block |
||
1484 | 1582 | $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
1485 | 1583 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
1486 | 1584 | if ($olderthanmonths > 0) { |
1487 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
1488 | - else $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
1585 | + if ($globalDBdriver == 'mysql') { |
|
1586 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
1587 | + } else { |
|
1588 | + $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
1589 | + } |
|
1489 | 1590 | } |
1490 | 1591 | if ($sincedate != '') { |
1491 | - if ($globalDBdriver == 'mysql') $query .= " AND marine_output.date > '".$sincedate."'"; |
|
1492 | - else $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
1592 | + if ($globalDBdriver == 'mysql') { |
|
1593 | + $query .= " AND marine_output.date > '".$sincedate."'"; |
|
1594 | + } else { |
|
1595 | + $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
1596 | + } |
|
1493 | 1597 | } |
1494 | 1598 | $query_values = array(); |
1495 | 1599 | if ($year != '') { |
@@ -1520,7 +1624,9 @@ discard block |
||
1520 | 1624 | } |
1521 | 1625 | } |
1522 | 1626 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
1523 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
1627 | + if ($limit) { |
|
1628 | + $query .= " LIMIT 10 OFFSET 0"; |
|
1629 | + } |
|
1524 | 1630 | |
1525 | 1631 | $sth = $this->db->prepare($query); |
1526 | 1632 | $sth->execute($query_values); |
@@ -1555,7 +1661,9 @@ discard block |
||
1555 | 1661 | date_default_timezone_set($globalTimezone); |
1556 | 1662 | $datetime = new DateTime(); |
1557 | 1663 | $offset = $datetime->format('P'); |
1558 | - } else $offset = '+00:00'; |
|
1664 | + } else { |
|
1665 | + $offset = '+00:00'; |
|
1666 | + } |
|
1559 | 1667 | |
1560 | 1668 | if ($globalDBdriver == 'mysql') { |
1561 | 1669 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1605,7 +1713,9 @@ discard block |
||
1605 | 1713 | date_default_timezone_set($globalTimezone); |
1606 | 1714 | $datetime = new DateTime(); |
1607 | 1715 | $offset = $datetime->format('P'); |
1608 | - } else $offset = '+00:00'; |
|
1716 | + } else { |
|
1717 | + $offset = '+00:00'; |
|
1718 | + } |
|
1609 | 1719 | $filter_query = $this->getFilter($filters,true,true); |
1610 | 1720 | if ($globalDBdriver == 'mysql') { |
1611 | 1721 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1651,7 +1761,9 @@ discard block |
||
1651 | 1761 | date_default_timezone_set($globalTimezone); |
1652 | 1762 | $datetime = new DateTime(); |
1653 | 1763 | $offset = $datetime->format('P'); |
1654 | - } else $offset = '+00:00'; |
|
1764 | + } else { |
|
1765 | + $offset = '+00:00'; |
|
1766 | + } |
|
1655 | 1767 | $filter_query = $this->getFilter($filters,true,true); |
1656 | 1768 | if ($globalDBdriver == 'mysql') { |
1657 | 1769 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1699,7 +1811,9 @@ discard block |
||
1699 | 1811 | date_default_timezone_set($globalTimezone); |
1700 | 1812 | $datetime = new DateTime(); |
1701 | 1813 | $offset = $datetime->format('P'); |
1702 | - } else $offset = '+00:00'; |
|
1814 | + } else { |
|
1815 | + $offset = '+00:00'; |
|
1816 | + } |
|
1703 | 1817 | |
1704 | 1818 | if ($globalDBdriver == 'mysql') { |
1705 | 1819 | $query = "SELECT YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1746,7 +1860,9 @@ discard block |
||
1746 | 1860 | date_default_timezone_set($globalTimezone); |
1747 | 1861 | $datetime = new DateTime(); |
1748 | 1862 | $offset = $datetime->format('P'); |
1749 | - } else $offset = '+00:00'; |
|
1863 | + } else { |
|
1864 | + $offset = '+00:00'; |
|
1865 | + } |
|
1750 | 1866 | $filter_query = $this->getFilter($filters,true,true); |
1751 | 1867 | if ($globalDBdriver == 'mysql') { |
1752 | 1868 | $query = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -1795,7 +1911,9 @@ discard block |
||
1795 | 1911 | date_default_timezone_set($globalTimezone); |
1796 | 1912 | $datetime = new DateTime(); |
1797 | 1913 | $offset = $datetime->format('P'); |
1798 | - } else $offset = '+00:00'; |
|
1914 | + } else { |
|
1915 | + $offset = '+00:00'; |
|
1916 | + } |
|
1799 | 1917 | |
1800 | 1918 | $orderby_sql = ''; |
1801 | 1919 | if ($orderby == "hour") |
@@ -1864,7 +1982,9 @@ discard block |
||
1864 | 1982 | date_default_timezone_set($globalTimezone); |
1865 | 1983 | $datetime = new DateTime($date); |
1866 | 1984 | $offset = $datetime->format('P'); |
1867 | - } else $offset = '+00:00'; |
|
1985 | + } else { |
|
1986 | + $offset = '+00:00'; |
|
1987 | + } |
|
1868 | 1988 | |
1869 | 1989 | if ($globalDBdriver == 'mysql') { |
1870 | 1990 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1912,7 +2032,9 @@ discard block |
||
1912 | 2032 | date_default_timezone_set($globalTimezone); |
1913 | 2033 | $datetime = new DateTime(); |
1914 | 2034 | $offset = $datetime->format('P'); |
1915 | - } else $offset = '+00:00'; |
|
2035 | + } else { |
|
2036 | + $offset = '+00:00'; |
|
2037 | + } |
|
1916 | 2038 | |
1917 | 2039 | if ($globalDBdriver == 'mysql') { |
1918 | 2040 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1974,7 +2096,9 @@ discard block |
||
1974 | 2096 | } |
1975 | 2097 | } |
1976 | 2098 | $query .= " GROUP BY marine_output.race_id,marine_output.race_name ORDER BY captain_count DESC"; |
1977 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
2099 | + if ($limit) { |
|
2100 | + $query .= " LIMIT 10 OFFSET 0"; |
|
2101 | + } |
|
1978 | 2102 | $sth = $this->db->prepare($query); |
1979 | 2103 | $sth->execute(); |
1980 | 2104 | $marine_array = array(); |
@@ -2023,8 +2147,11 @@ discard block |
||
2023 | 2147 | $query_values = array_merge($query_values,array(':month' => $month)); |
2024 | 2148 | } |
2025 | 2149 | } |
2026 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
2027 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2150 | + if (empty($query_values)) { |
|
2151 | + $queryi .= $this->getFilter($filters); |
|
2152 | + } else { |
|
2153 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2154 | + } |
|
2028 | 2155 | |
2029 | 2156 | $sth = $this->db->prepare($queryi); |
2030 | 2157 | $sth->execute($query_values); |
@@ -2063,8 +2190,11 @@ discard block |
||
2063 | 2190 | $query_values = array_merge($query_values,array(':month' => $month)); |
2064 | 2191 | } |
2065 | 2192 | } |
2066 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
2067 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2193 | + if (empty($query_values)) { |
|
2194 | + $queryi .= $this->getFilter($filters); |
|
2195 | + } else { |
|
2196 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2197 | + } |
|
2068 | 2198 | |
2069 | 2199 | $sth = $this->db->prepare($queryi); |
2070 | 2200 | $sth->execute($query_values); |
@@ -2103,8 +2233,11 @@ discard block |
||
2103 | 2233 | $query_values = array_merge($query_values,array(':month' => $month)); |
2104 | 2234 | } |
2105 | 2235 | } |
2106 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
2107 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2236 | + if (empty($query_values)) { |
|
2237 | + $queryi .= $this->getFilter($filters); |
|
2238 | + } else { |
|
2239 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2240 | + } |
|
2108 | 2241 | |
2109 | 2242 | $sth = $this->db->prepare($queryi); |
2110 | 2243 | $sth->execute($query_values); |
@@ -2143,8 +2276,11 @@ discard block |
||
2143 | 2276 | $query_values = array_merge($query_values,array(':month' => $month)); |
2144 | 2277 | } |
2145 | 2278 | } |
2146 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
2147 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2279 | + if (empty($query_values)) { |
|
2280 | + $queryi .= $this->getFilter($filters); |
|
2281 | + } else { |
|
2282 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2283 | + } |
|
2148 | 2284 | |
2149 | 2285 | $sth = $this->db->prepare($queryi); |
2150 | 2286 | $sth->execute($query_values); |
@@ -2165,7 +2301,9 @@ discard block |
||
2165 | 2301 | date_default_timezone_set($globalTimezone); |
2166 | 2302 | $datetime = new DateTime(); |
2167 | 2303 | $offset = $datetime->format('P'); |
2168 | - } else $offset = '+00:00'; |
|
2304 | + } else { |
|
2305 | + $offset = '+00:00'; |
|
2306 | + } |
|
2169 | 2307 | |
2170 | 2308 | if ($globalDBdriver == 'mysql') { |
2171 | 2309 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -2269,7 +2407,9 @@ discard block |
||
2269 | 2407 | */ |
2270 | 2408 | public function parseDirection($direction = 0) |
2271 | 2409 | { |
2272 | - if ($direction == '') $direction = 0; |
|
2410 | + if ($direction == '') { |
|
2411 | + $direction = 0; |
|
2412 | + } |
|
2273 | 2413 | $direction_array = array(); |
2274 | 2414 | $temp_array = array(); |
2275 | 2415 | |
@@ -2358,7 +2498,9 @@ discard block |
||
2358 | 2498 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2359 | 2499 | |
2360 | 2500 | $Connection = new Connection($this->db); |
2361 | - if (!$Connection->tableExists('countries')) return ''; |
|
2501 | + if (!$Connection->tableExists('countries')) { |
|
2502 | + return ''; |
|
2503 | + } |
|
2362 | 2504 | |
2363 | 2505 | try { |
2364 | 2506 | /* |
@@ -2378,9 +2520,13 @@ discard block |
||
2378 | 2520 | $sth->closeCursor(); |
2379 | 2521 | if (count($row) > 0) { |
2380 | 2522 | return $row; |
2381 | - } else return ''; |
|
2523 | + } else { |
|
2524 | + return ''; |
|
2525 | + } |
|
2382 | 2526 | } catch (PDOException $e) { |
2383 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
2527 | + if (isset($globalDebug) && $globalDebug) { |
|
2528 | + echo 'Error : '.$e->getMessage()."\n"; |
|
2529 | + } |
|
2384 | 2530 | return ''; |
2385 | 2531 | } |
2386 | 2532 | |
@@ -2398,7 +2544,9 @@ discard block |
||
2398 | 2544 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
2399 | 2545 | |
2400 | 2546 | $Connection = new Connection($this->db); |
2401 | - if (!$Connection->tableExists('countries')) return ''; |
|
2547 | + if (!$Connection->tableExists('countries')) { |
|
2548 | + return ''; |
|
2549 | + } |
|
2402 | 2550 | |
2403 | 2551 | try { |
2404 | 2552 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -2410,9 +2558,13 @@ discard block |
||
2410 | 2558 | $sth->closeCursor(); |
2411 | 2559 | if (count($row) > 0) { |
2412 | 2560 | return $row; |
2413 | - } else return ''; |
|
2561 | + } else { |
|
2562 | + return ''; |
|
2563 | + } |
|
2414 | 2564 | } catch (PDOException $e) { |
2415 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
2565 | + if (isset($globalDebug) && $globalDebug) { |
|
2566 | + echo 'Error : '.$e->getMessage()."\n"; |
|
2567 | + } |
|
2416 | 2568 | return ''; |
2417 | 2569 | } |
2418 | 2570 | |
@@ -2430,7 +2582,9 @@ discard block |
||
2430 | 2582 | { |
2431 | 2583 | global $globalBitlyAccessToken; |
2432 | 2584 | |
2433 | - if ($globalBitlyAccessToken == '') return $url; |
|
2585 | + if ($globalBitlyAccessToken == '') { |
|
2586 | + return $url; |
|
2587 | + } |
|
2434 | 2588 | |
2435 | 2589 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
2436 | 2590 | |
@@ -2512,7 +2666,9 @@ discard block |
||
2512 | 2666 | } |
2513 | 2667 | } |
2514 | 2668 | $query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC"; |
2515 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
2669 | + if ($limit) { |
|
2670 | + $query .= " LIMIT 10 OFFSET 0"; |
|
2671 | + } |
|
2516 | 2672 | $sth = $this->db->prepare($query); |
2517 | 2673 | $sth->execute($query_values); |
2518 | 2674 | $marine_array = array(); |
@@ -2565,13 +2721,27 @@ discard block |
||
2565 | 2721 | foreach ($q_array as $q_item){ |
2566 | 2722 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
2567 | 2723 | $additional_query .= " AND ("; |
2568 | - if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
|
2569 | - if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
|
2570 | - if (is_int($q_item)) $additional_query .= "(marine_output.imo = '".$q_item."') OR "; |
|
2571 | - if (is_int($q_item)) $additional_query .= "(marine_output.captain_id = '".$q_item."') OR "; |
|
2572 | - if (is_int($q_item)) $additional_query .= "(marine_output.race_id = '".$q_item."') OR "; |
|
2573 | - if (!is_int($q_item)) $additional_query .= "(marine_output.captain_name = '".$q_item."') OR "; |
|
2574 | - if (!is_int($q_item)) $additional_query .= "(marine_output.race_name = '".$q_item."') OR "; |
|
2724 | + if (is_int($q_item)) { |
|
2725 | + $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
|
2726 | + } |
|
2727 | + if (is_int($q_item)) { |
|
2728 | + $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
|
2729 | + } |
|
2730 | + if (is_int($q_item)) { |
|
2731 | + $additional_query .= "(marine_output.imo = '".$q_item."') OR "; |
|
2732 | + } |
|
2733 | + if (is_int($q_item)) { |
|
2734 | + $additional_query .= "(marine_output.captain_id = '".$q_item."') OR "; |
|
2735 | + } |
|
2736 | + if (is_int($q_item)) { |
|
2737 | + $additional_query .= "(marine_output.race_id = '".$q_item."') OR "; |
|
2738 | + } |
|
2739 | + if (!is_int($q_item)) { |
|
2740 | + $additional_query .= "(marine_output.captain_name = '".$q_item."') OR "; |
|
2741 | + } |
|
2742 | + if (!is_int($q_item)) { |
|
2743 | + $additional_query .= "(marine_output.race_name = '".$q_item."') OR "; |
|
2744 | + } |
|
2575 | 2745 | $additional_query .= "(marine_output.ident like '%".$q_item."%')"; |
2576 | 2746 | $additional_query .= ")"; |
2577 | 2747 | } |
@@ -2663,7 +2833,9 @@ discard block |
||
2663 | 2833 | date_default_timezone_set($globalTimezone); |
2664 | 2834 | $datetime = new DateTime(); |
2665 | 2835 | $offset = $datetime->format('P'); |
2666 | - } else $offset = '+00:00'; |
|
2836 | + } else { |
|
2837 | + $offset = '+00:00'; |
|
2838 | + } |
|
2667 | 2839 | if ($date_array[1] != "") |
2668 | 2840 | { |
2669 | 2841 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
@@ -2690,8 +2862,12 @@ discard block |
||
2690 | 2862 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
2691 | 2863 | { |
2692 | 2864 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
2693 | - } else $limit_query = ""; |
|
2694 | - } else $limit_query = ""; |
|
2865 | + } else { |
|
2866 | + $limit_query = ""; |
|
2867 | + } |
|
2868 | + } else { |
|
2869 | + $limit_query = ""; |
|
2870 | + } |
|
2695 | 2871 | if ($sort != "") |
2696 | 2872 | { |
2697 | 2873 | $search_orderby_array = $this->getOrderBy(); |
@@ -2757,8 +2933,11 @@ discard block |
||
2757 | 2933 | $sth = $this->db->prepare($query); |
2758 | 2934 | $sth->execute(array(':race_name' => $race_name)); |
2759 | 2935 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2760 | - if (isset($result[0])) return $result[0]; |
|
2761 | - else return array(); |
|
2936 | + if (isset($result[0])) { |
|
2937 | + return $result[0]; |
|
2938 | + } else { |
|
2939 | + return array(); |
|
2940 | + } |
|
2762 | 2941 | } |
2763 | 2942 | |
2764 | 2943 | /** |
@@ -2774,8 +2953,11 @@ discard block |
||
2774 | 2953 | $sth = $this->db->prepare($query); |
2775 | 2954 | $sth->execute(array(':race_id' => $race_id)); |
2776 | 2955 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2777 | - if (isset($result[0])) return $result[0]; |
|
2778 | - else return array(); |
|
2956 | + if (isset($result[0])) { |
|
2957 | + return $result[0]; |
|
2958 | + } else { |
|
2959 | + return array(); |
|
2960 | + } |
|
2779 | 2961 | } |
2780 | 2962 | |
2781 | 2963 | /** |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | if ($this->db === null) die('Error: No DB connection. (Marine)'); |
19 | 19 | } |
20 | 20 | |
21 | - /** |
|
22 | - * Get SQL query part for filter used |
|
23 | - * @param array $filter the filter |
|
24 | - * @param bool $where |
|
25 | - * @param bool $and |
|
26 | - * @return string the SQL part |
|
27 | - */ |
|
21 | + /** |
|
22 | + * Get SQL query part for filter used |
|
23 | + * @param array $filter the filter |
|
24 | + * @param bool $where |
|
25 | + * @param bool $and |
|
26 | + * @return string the SQL part |
|
27 | + */ |
|
28 | 28 | public function getFilter($filter = array(),$where = false,$and = false) { |
29 | 29 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
30 | 30 | $filters = array(); |
@@ -95,15 +95,15 @@ discard block |
||
95 | 95 | return $filter_query; |
96 | 96 | } |
97 | 97 | |
98 | - /** |
|
99 | - * Executes the SQL statements to get the spotter information |
|
100 | - * |
|
101 | - * @param String $query the SQL query |
|
102 | - * @param array $params parameter of the query |
|
103 | - * @param String $limitQuery the limit query |
|
104 | - * @param bool $schedules |
|
105 | - * @return array the spotter information |
|
106 | - */ |
|
98 | + /** |
|
99 | + * Executes the SQL statements to get the spotter information |
|
100 | + * |
|
101 | + * @param String $query the SQL query |
|
102 | + * @param array $params parameter of the query |
|
103 | + * @param String $limitQuery the limit query |
|
104 | + * @param bool $schedules |
|
105 | + * @return array the spotter information |
|
106 | + */ |
|
107 | 107 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
108 | 108 | { |
109 | 109 | global $globalVM; |
@@ -253,14 +253,14 @@ discard block |
||
253 | 253 | } |
254 | 254 | |
255 | 255 | |
256 | - /** |
|
257 | - * Gets all the spotter information based on the latest data entry |
|
258 | - * |
|
259 | - * @param string $limit |
|
260 | - * @param string $sort |
|
261 | - * @param array $filter |
|
262 | - * @return array the spotter information |
|
263 | - */ |
|
256 | + /** |
|
257 | + * Gets all the spotter information based on the latest data entry |
|
258 | + * |
|
259 | + * @param string $limit |
|
260 | + * @param string $sort |
|
261 | + * @param array $filter |
|
262 | + * @return array the spotter information |
|
263 | + */ |
|
264 | 264 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
265 | 265 | { |
266 | 266 | global $global_marine_query; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | * @param string $id |
296 | 296 | * @return array the spotter information |
297 | 297 | */ |
298 | - public function getMarineDataByID($id = '') |
|
298 | + public function getMarineDataByID($id = '') |
|
299 | 299 | { |
300 | 300 | global $global_marine_query; |
301 | 301 | |
@@ -308,15 +308,15 @@ discard block |
||
308 | 308 | return $spotter_array; |
309 | 309 | } |
310 | 310 | |
311 | - /** |
|
312 | - * Gets all the spotter information based on the callsign |
|
313 | - * |
|
314 | - * @param string $ident |
|
315 | - * @param string $limit |
|
316 | - * @param string $sort |
|
317 | - * @param array $filter |
|
318 | - * @return array the spotter information |
|
319 | - */ |
|
311 | + /** |
|
312 | + * Gets all the spotter information based on the callsign |
|
313 | + * |
|
314 | + * @param string $ident |
|
315 | + * @param string $limit |
|
316 | + * @param string $sort |
|
317 | + * @param array $filter |
|
318 | + * @return array the spotter information |
|
319 | + */ |
|
320 | 320 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
321 | 321 | { |
322 | 322 | global $global_marine_query; |
@@ -367,15 +367,15 @@ discard block |
||
367 | 367 | return $spotter_array; |
368 | 368 | } |
369 | 369 | |
370 | - /** |
|
371 | - * Gets all the marine information based on the type |
|
372 | - * |
|
373 | - * @param string $type |
|
374 | - * @param string $limit |
|
375 | - * @param string $sort |
|
376 | - * @param array $filter |
|
377 | - * @return array the marine information |
|
378 | - */ |
|
370 | + /** |
|
371 | + * Gets all the marine information based on the type |
|
372 | + * |
|
373 | + * @param string $type |
|
374 | + * @param string $limit |
|
375 | + * @param string $sort |
|
376 | + * @param array $filter |
|
377 | + * @return array the marine information |
|
378 | + */ |
|
379 | 379 | public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array()) |
380 | 380 | { |
381 | 381 | global $global_marine_query; |
@@ -421,14 +421,14 @@ discard block |
||
421 | 421 | return $spotter_array; |
422 | 422 | } |
423 | 423 | |
424 | - /** |
|
425 | - * @param string $date |
|
426 | - * @param string $limit |
|
427 | - * @param string $sort |
|
428 | - * @param array $filter |
|
429 | - * @return array |
|
430 | - */ |
|
431 | - public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
424 | + /** |
|
425 | + * @param string $date |
|
426 | + * @param string $limit |
|
427 | + * @param string $sort |
|
428 | + * @param array $filter |
|
429 | + * @return array |
|
430 | + */ |
|
431 | + public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
432 | 432 | { |
433 | 433 | global $global_marine_query, $globalTimezone, $globalDBdriver; |
434 | 434 | |
@@ -485,15 +485,15 @@ discard block |
||
485 | 485 | return $spotter_array; |
486 | 486 | } |
487 | 487 | |
488 | - /** |
|
489 | - * Gets all the marine information based on the captain |
|
490 | - * |
|
491 | - * @param string $captain |
|
492 | - * @param string $limit |
|
493 | - * @param string $sort |
|
494 | - * @param array $filter |
|
495 | - * @return array the marine information |
|
496 | - */ |
|
488 | + /** |
|
489 | + * Gets all the marine information based on the captain |
|
490 | + * |
|
491 | + * @param string $captain |
|
492 | + * @param string $limit |
|
493 | + * @param string $sort |
|
494 | + * @param array $filter |
|
495 | + * @return array the marine information |
|
496 | + */ |
|
497 | 497 | public function getMarineDataByCaptain($captain = '', $limit = '', $sort = '', $filter = array()) |
498 | 498 | { |
499 | 499 | global $global_marine_query; |
@@ -531,15 +531,15 @@ discard block |
||
531 | 531 | return $spotter_array; |
532 | 532 | } |
533 | 533 | |
534 | - /** |
|
535 | - * Gets all the marine information based on the race |
|
536 | - * |
|
537 | - * @param string $race |
|
538 | - * @param string $limit |
|
539 | - * @param string $sort |
|
540 | - * @param array $filter |
|
541 | - * @return array the marine information |
|
542 | - */ |
|
534 | + /** |
|
535 | + * Gets all the marine information based on the race |
|
536 | + * |
|
537 | + * @param string $race |
|
538 | + * @param string $limit |
|
539 | + * @param string $sort |
|
540 | + * @param array $filter |
|
541 | + * @return array the marine information |
|
542 | + */ |
|
543 | 543 | public function getMarineDataByRace($race = '', $limit = '', $sort = '', $filter = array()) |
544 | 544 | { |
545 | 545 | global $global_marine_query,$globalDBdriver; |
@@ -581,13 +581,13 @@ discard block |
||
581 | 581 | return $spotter_array; |
582 | 582 | } |
583 | 583 | |
584 | - /** |
|
585 | - * Count races by captain |
|
586 | - * |
|
587 | - * @param $captain |
|
588 | - * @param array $filters |
|
589 | - * @return Integer number of race for a captain |
|
590 | - */ |
|
584 | + /** |
|
585 | + * Count races by captain |
|
586 | + * |
|
587 | + * @param $captain |
|
588 | + * @param array $filters |
|
589 | + * @return Integer number of race for a captain |
|
590 | + */ |
|
591 | 591 | public function countRacesByCaptain($captain,$filters = array()) |
592 | 592 | { |
593 | 593 | $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
@@ -602,13 +602,13 @@ discard block |
||
602 | 602 | return $result[0]['nb']; |
603 | 603 | } |
604 | 604 | |
605 | - /** |
|
606 | - * Count captains by race |
|
607 | - * |
|
608 | - * @param $race |
|
609 | - * @param array $filters |
|
610 | - * @return String Duration of all races |
|
611 | - */ |
|
605 | + /** |
|
606 | + * Count captains by race |
|
607 | + * |
|
608 | + * @param $race |
|
609 | + * @param array $filters |
|
610 | + * @return String Duration of all races |
|
611 | + */ |
|
612 | 612 | public function countCaptainsByRace($race,$filters = array()) |
613 | 613 | { |
614 | 614 | $race = filter_var($race,FILTER_SANITIZE_STRING); |
@@ -623,16 +623,16 @@ discard block |
||
623 | 623 | return $result[0]['nb']; |
624 | 624 | } |
625 | 625 | |
626 | - /** |
|
627 | - * Gets all boat types that have been used by a captain |
|
628 | - * |
|
629 | - * @param $captain |
|
630 | - * @param array $filters |
|
631 | - * @param string $year |
|
632 | - * @param string $month |
|
633 | - * @param string $day |
|
634 | - * @return array the boat list |
|
635 | - */ |
|
626 | + /** |
|
627 | + * Gets all boat types that have been used by a captain |
|
628 | + * |
|
629 | + * @param $captain |
|
630 | + * @param array $filters |
|
631 | + * @param string $year |
|
632 | + * @param string $month |
|
633 | + * @param string $day |
|
634 | + * @return array the boat list |
|
635 | + */ |
|
636 | 636 | public function countAllBoatTypesByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
637 | 637 | { |
638 | 638 | global $globalDBdriver; |
@@ -676,16 +676,16 @@ discard block |
||
676 | 676 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
677 | 677 | } |
678 | 678 | |
679 | - /** |
|
680 | - * Gets all boat types that have been used on a race |
|
681 | - * |
|
682 | - * @param $race |
|
683 | - * @param array $filters |
|
684 | - * @param string $year |
|
685 | - * @param string $month |
|
686 | - * @param string $day |
|
687 | - * @return array the boat list |
|
688 | - */ |
|
679 | + /** |
|
680 | + * Gets all boat types that have been used on a race |
|
681 | + * |
|
682 | + * @param $race |
|
683 | + * @param array $filters |
|
684 | + * @param string $year |
|
685 | + * @param string $month |
|
686 | + * @param string $day |
|
687 | + * @return array the boat list |
|
688 | + */ |
|
689 | 689 | public function countAllBoatTypesByRace($race,$filters = array(),$year = '',$month = '',$day = '') |
690 | 690 | { |
691 | 691 | global $globalDBdriver; |
@@ -729,16 +729,16 @@ discard block |
||
729 | 729 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
730 | 730 | } |
731 | 731 | |
732 | - /** |
|
733 | - * Gets race duration by captain |
|
734 | - * |
|
735 | - * @param $captain |
|
736 | - * @param array $filters |
|
737 | - * @param string $year |
|
738 | - * @param string $month |
|
739 | - * @param string $day |
|
740 | - * @return String Duration of all race |
|
741 | - */ |
|
732 | + /** |
|
733 | + * Gets race duration by captain |
|
734 | + * |
|
735 | + * @param $captain |
|
736 | + * @param array $filters |
|
737 | + * @param string $year |
|
738 | + * @param string $month |
|
739 | + * @param string $day |
|
740 | + * @return String Duration of all race |
|
741 | + */ |
|
742 | 742 | public function getRaceDurationByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
743 | 743 | { |
744 | 744 | global $globalDBdriver; |
@@ -783,16 +783,16 @@ discard block |
||
783 | 783 | else return $result[0]['duration']; |
784 | 784 | } |
785 | 785 | |
786 | - /** |
|
787 | - * Gets race duration by captains |
|
788 | - * |
|
789 | - * @param bool $limit |
|
790 | - * @param array $filters |
|
791 | - * @param string $year |
|
792 | - * @param string $month |
|
793 | - * @param string $day |
|
794 | - * @return array Duration of all race |
|
795 | - */ |
|
786 | + /** |
|
787 | + * Gets race duration by captains |
|
788 | + * |
|
789 | + * @param bool $limit |
|
790 | + * @param array $filters |
|
791 | + * @param string $year |
|
792 | + * @param string $month |
|
793 | + * @param string $day |
|
794 | + * @return array Duration of all race |
|
795 | + */ |
|
796 | 796 | public function getRaceDurationByCaptains($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
797 | 797 | { |
798 | 798 | global $globalDBdriver; |
@@ -850,12 +850,12 @@ discard block |
||
850 | 850 | |
851 | 851 | } |
852 | 852 | |
853 | - /** |
|
854 | - * Gets a list of all captain names and captain ids |
|
855 | - * |
|
856 | - * @param array $filters |
|
857 | - * @return array list of captain names and captain ids |
|
858 | - */ |
|
853 | + /** |
|
854 | + * Gets a list of all captain names and captain ids |
|
855 | + * |
|
856 | + * @param array $filters |
|
857 | + * @return array list of captain names and captain ids |
|
858 | + */ |
|
859 | 859 | public function getAllCaptainNames($filters = array()) |
860 | 860 | { |
861 | 861 | $filter_query = $this->getFilter($filters,true,true); |
@@ -868,12 +868,12 @@ discard block |
||
868 | 868 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
869 | 869 | } |
870 | 870 | |
871 | - /** |
|
872 | - * Gets a list of all race names and race ids |
|
873 | - * |
|
874 | - * @param array $filters |
|
875 | - * @return array list of race names and race ids |
|
876 | - */ |
|
871 | + /** |
|
872 | + * Gets a list of all race names and race ids |
|
873 | + * |
|
874 | + * @param array $filters |
|
875 | + * @return array list of race names and race ids |
|
876 | + */ |
|
877 | 877 | public function getAllRaceNames($filters = array()) |
878 | 878 | { |
879 | 879 | $filter_query = $this->getFilter($filters,true,true); |
@@ -887,13 +887,13 @@ discard block |
||
887 | 887 | } |
888 | 888 | |
889 | 889 | |
890 | - /** |
|
891 | - * Gets all source name |
|
892 | - * |
|
893 | - * @param String type format of source |
|
894 | - * @param array $filters |
|
895 | - * @return array list of source name |
|
896 | - */ |
|
890 | + /** |
|
891 | + * Gets all source name |
|
892 | + * |
|
893 | + * @param String type format of source |
|
894 | + * @param array $filters |
|
895 | + * @return array list of source name |
|
896 | + */ |
|
897 | 897 | public function getAllSourceName($type = '',$filters = array()) |
898 | 898 | { |
899 | 899 | $filter_query = $this->getFilter($filters,true,true); |
@@ -922,12 +922,12 @@ discard block |
||
922 | 922 | } |
923 | 923 | |
924 | 924 | |
925 | - /** |
|
926 | - * Gets a list of all idents/callsigns |
|
927 | - * |
|
928 | - * @param array $filters |
|
929 | - * @return array list of ident/callsign names |
|
930 | - */ |
|
925 | + /** |
|
926 | + * Gets a list of all idents/callsigns |
|
927 | + * |
|
928 | + * @param array $filters |
|
929 | + * @return array list of ident/callsign names |
|
930 | + */ |
|
931 | 931 | public function getAllIdents($filters = array()) |
932 | 932 | { |
933 | 933 | $filter_query = $this->getFilter($filters,true,true); |
@@ -950,12 +950,12 @@ discard block |
||
950 | 950 | return $ident_array; |
951 | 951 | } |
952 | 952 | |
953 | - /** |
|
954 | - * Gets all info from a mmsi |
|
955 | - * |
|
956 | - * @param $mmsi |
|
957 | - * @return array ident |
|
958 | - */ |
|
953 | + /** |
|
954 | + * Gets all info from a mmsi |
|
955 | + * |
|
956 | + * @param $mmsi |
|
957 | + * @return array ident |
|
958 | + */ |
|
959 | 959 | public function getIdentity($mmsi) |
960 | 960 | { |
961 | 961 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -967,14 +967,14 @@ discard block |
||
967 | 967 | else return array(); |
968 | 968 | } |
969 | 969 | |
970 | - /** |
|
971 | - * Add identity |
|
972 | - * @param $mmsi |
|
973 | - * @param $imo |
|
974 | - * @param $ident |
|
975 | - * @param $callsign |
|
976 | - * @param $type |
|
977 | - */ |
|
970 | + /** |
|
971 | + * Add identity |
|
972 | + * @param $mmsi |
|
973 | + * @param $imo |
|
974 | + * @param $ident |
|
975 | + * @param $callsign |
|
976 | + * @param $type |
|
977 | + */ |
|
978 | 978 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
979 | 979 | { |
980 | 980 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -1040,13 +1040,13 @@ discard block |
||
1040 | 1040 | } |
1041 | 1041 | |
1042 | 1042 | /** |
1043 | - * Update ident tracker data |
|
1044 | - * |
|
1045 | - * @param String $fammarine_id the ID |
|
1046 | - * @param String $ident the marine ident |
|
1047 | - * @return String success or false |
|
1048 | - * |
|
1049 | - */ |
|
1043 | + * Update ident tracker data |
|
1044 | + * |
|
1045 | + * @param String $fammarine_id the ID |
|
1046 | + * @param String $ident the marine ident |
|
1047 | + * @return String success or false |
|
1048 | + * |
|
1049 | + */ |
|
1050 | 1050 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
1051 | 1051 | { |
1052 | 1052 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -1061,13 +1061,13 @@ discard block |
||
1061 | 1061 | } |
1062 | 1062 | |
1063 | 1063 | /** |
1064 | - * Update arrival marine data |
|
1065 | - * |
|
1066 | - * @param String $fammarine_id the ID |
|
1067 | - * @param String $arrival_code the marine ident |
|
1068 | - * @return String success or false |
|
1069 | - * |
|
1070 | - */ |
|
1064 | + * Update arrival marine data |
|
1065 | + * |
|
1066 | + * @param String $fammarine_id the ID |
|
1067 | + * @param String $arrival_code the marine ident |
|
1068 | + * @return String success or false |
|
1069 | + * |
|
1070 | + */ |
|
1071 | 1071 | public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
1072 | 1072 | { |
1073 | 1073 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
@@ -1082,19 +1082,19 @@ discard block |
||
1082 | 1082 | } |
1083 | 1083 | |
1084 | 1084 | /** |
1085 | - * Update Status data |
|
1086 | - * |
|
1087 | - * @param String $fammarine_id the ID |
|
1088 | - * @param String $status_id the marine status id |
|
1089 | - * @param String $status the marine status |
|
1090 | - * @return String success or false |
|
1091 | - * |
|
1092 | - */ |
|
1085 | + * Update Status data |
|
1086 | + * |
|
1087 | + * @param String $fammarine_id the ID |
|
1088 | + * @param String $status_id the marine status id |
|
1089 | + * @param String $status the marine status |
|
1090 | + * @return String success or false |
|
1091 | + * |
|
1092 | + */ |
|
1093 | 1093 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
1094 | 1094 | { |
1095 | 1095 | |
1096 | 1096 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
1097 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
1097 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
1098 | 1098 | |
1099 | 1099 | try { |
1100 | 1100 | $sth = $this->db->prepare($query); |
@@ -1107,22 +1107,22 @@ discard block |
||
1107 | 1107 | |
1108 | 1108 | } |
1109 | 1109 | |
1110 | - /** |
|
1111 | - * Update latest marine data |
|
1112 | - * |
|
1113 | - * @param String $fammarine_id the ID |
|
1114 | - * @param String $ident the marine ident |
|
1115 | - * @param string $latitude |
|
1116 | - * @param string $longitude |
|
1117 | - * @param float $groundspeed |
|
1118 | - * @param string $date |
|
1119 | - * @param float $distance |
|
1120 | - * @param integer $race_rank |
|
1121 | - * @param integer $race_time |
|
1122 | - * @param string $status |
|
1123 | - * @param string $race_begin |
|
1124 | - * @return String success or false |
|
1125 | - */ |
|
1110 | + /** |
|
1111 | + * Update latest marine data |
|
1112 | + * |
|
1113 | + * @param String $fammarine_id the ID |
|
1114 | + * @param String $ident the marine ident |
|
1115 | + * @param string $latitude |
|
1116 | + * @param string $longitude |
|
1117 | + * @param float $groundspeed |
|
1118 | + * @param string $date |
|
1119 | + * @param float $distance |
|
1120 | + * @param integer $race_rank |
|
1121 | + * @param integer $race_time |
|
1122 | + * @param string $status |
|
1123 | + * @param string $race_begin |
|
1124 | + * @return String success or false |
|
1125 | + */ |
|
1126 | 1126 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '',$distance = NULL,$race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
1127 | 1127 | { |
1128 | 1128 | if ($latitude == '') $latitude = NULL; |
@@ -1147,36 +1147,36 @@ discard block |
||
1147 | 1147 | |
1148 | 1148 | } |
1149 | 1149 | |
1150 | - /** |
|
1151 | - * Adds a new marine data |
|
1152 | - * |
|
1153 | - * @param String $fammarine_id the ID |
|
1154 | - * @param String $ident the marine ident |
|
1155 | - * @param String $latitude latitude of flight |
|
1156 | - * @param String $longitude latitude of flight |
|
1157 | - * @param String $heading heading of flight |
|
1158 | - * @param String $groundspeed speed of flight |
|
1159 | - * @param String $date date of flight |
|
1160 | - * @param string $mmsi |
|
1161 | - * @param string $type |
|
1162 | - * @param string $typeid |
|
1163 | - * @param string $imo |
|
1164 | - * @param string $callsign |
|
1165 | - * @param string $arrival_code |
|
1166 | - * @param string $arrival_date |
|
1167 | - * @param string $status |
|
1168 | - * @param string $statusid |
|
1169 | - * @param string $format_source |
|
1170 | - * @param string $source_name |
|
1171 | - * @param string $captain_id |
|
1172 | - * @param string $captain_name |
|
1173 | - * @param string $race_id |
|
1174 | - * @param string $race_name |
|
1175 | - * @param string $distance |
|
1176 | - * @param string $race_rank |
|
1177 | - * @param string $race_time |
|
1178 | - * @return String success or false |
|
1179 | - */ |
|
1150 | + /** |
|
1151 | + * Adds a new marine data |
|
1152 | + * |
|
1153 | + * @param String $fammarine_id the ID |
|
1154 | + * @param String $ident the marine ident |
|
1155 | + * @param String $latitude latitude of flight |
|
1156 | + * @param String $longitude latitude of flight |
|
1157 | + * @param String $heading heading of flight |
|
1158 | + * @param String $groundspeed speed of flight |
|
1159 | + * @param String $date date of flight |
|
1160 | + * @param string $mmsi |
|
1161 | + * @param string $type |
|
1162 | + * @param string $typeid |
|
1163 | + * @param string $imo |
|
1164 | + * @param string $callsign |
|
1165 | + * @param string $arrival_code |
|
1166 | + * @param string $arrival_date |
|
1167 | + * @param string $status |
|
1168 | + * @param string $statusid |
|
1169 | + * @param string $format_source |
|
1170 | + * @param string $source_name |
|
1171 | + * @param string $captain_id |
|
1172 | + * @param string $captain_name |
|
1173 | + * @param string $race_id |
|
1174 | + * @param string $race_name |
|
1175 | + * @param string $distance |
|
1176 | + * @param string $race_rank |
|
1177 | + * @param string $race_time |
|
1178 | + * @return String success or false |
|
1179 | + */ |
|
1180 | 1180 | public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '',$race_rank = '', $race_time = '') |
1181 | 1181 | { |
1182 | 1182 | global $globalMarineImageFetch; |
@@ -1309,12 +1309,12 @@ discard block |
||
1309 | 1309 | } |
1310 | 1310 | |
1311 | 1311 | |
1312 | - /** |
|
1313 | - * Gets the aircraft ident within the last hour |
|
1314 | - * |
|
1315 | - * @param $ident |
|
1316 | - * @return String the ident |
|
1317 | - */ |
|
1312 | + /** |
|
1313 | + * Gets the aircraft ident within the last hour |
|
1314 | + * |
|
1315 | + * @param $ident |
|
1316 | + * @return String the ident |
|
1317 | + */ |
|
1318 | 1318 | public function getIdentFromLastHour($ident) |
1319 | 1319 | { |
1320 | 1320 | global $globalDBdriver, $globalTimezone; |
@@ -1330,11 +1330,11 @@ discard block |
||
1330 | 1330 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
1331 | 1331 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
1332 | 1332 | $query_data = array(':ident' => $ident); |
1333 | - } |
|
1333 | + } |
|
1334 | 1334 | |
1335 | 1335 | $sth = $this->db->prepare($query); |
1336 | 1336 | $sth->execute($query_data); |
1337 | - $ident_result=''; |
|
1337 | + $ident_result=''; |
|
1338 | 1338 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
1339 | 1339 | { |
1340 | 1340 | $ident_result = $row['ident']; |
@@ -1344,12 +1344,12 @@ discard block |
||
1344 | 1344 | } |
1345 | 1345 | |
1346 | 1346 | |
1347 | - /** |
|
1348 | - * Gets the aircraft data from the last 20 seconds |
|
1349 | - * |
|
1350 | - * @param string $q |
|
1351 | - * @return array the marine data |
|
1352 | - */ |
|
1347 | + /** |
|
1348 | + * Gets the aircraft data from the last 20 seconds |
|
1349 | + * |
|
1350 | + * @param string $q |
|
1351 | + * @return array the marine data |
|
1352 | + */ |
|
1353 | 1353 | public function getRealTimeData($q = '') |
1354 | 1354 | { |
1355 | 1355 | global $globalDBdriver; |
@@ -1384,15 +1384,15 @@ discard block |
||
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | |
1387 | - /** |
|
1388 | - * Gets all number of flight over countries |
|
1389 | - * |
|
1390 | - * @param bool $limit |
|
1391 | - * @param int $olderthanmonths |
|
1392 | - * @param string $sincedate |
|
1393 | - * @param array $filters |
|
1394 | - * @return array the airline country list |
|
1395 | - */ |
|
1387 | + /** |
|
1388 | + * Gets all number of flight over countries |
|
1389 | + * |
|
1390 | + * @param bool $limit |
|
1391 | + * @param int $olderthanmonths |
|
1392 | + * @param string $sincedate |
|
1393 | + * @param array $filters |
|
1394 | + * @return array the airline country list |
|
1395 | + */ |
|
1396 | 1396 | |
1397 | 1397 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
1398 | 1398 | { |
@@ -1463,18 +1463,18 @@ discard block |
||
1463 | 1463 | } |
1464 | 1464 | |
1465 | 1465 | |
1466 | - /** |
|
1467 | - * Gets all callsigns that have flown over |
|
1468 | - * |
|
1469 | - * @param bool $limit |
|
1470 | - * @param int $olderthanmonths |
|
1471 | - * @param string $sincedate |
|
1472 | - * @param array $filters |
|
1473 | - * @param string $year |
|
1474 | - * @param string $month |
|
1475 | - * @param string $day |
|
1476 | - * @return array the callsign list |
|
1477 | - */ |
|
1466 | + /** |
|
1467 | + * Gets all callsigns that have flown over |
|
1468 | + * |
|
1469 | + * @param bool $limit |
|
1470 | + * @param int $olderthanmonths |
|
1471 | + * @param string $sincedate |
|
1472 | + * @param array $filters |
|
1473 | + * @param string $year |
|
1474 | + * @param string $month |
|
1475 | + * @param string $day |
|
1476 | + * @return array the callsign list |
|
1477 | + */ |
|
1478 | 1478 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
1479 | 1479 | { |
1480 | 1480 | global $globalDBdriver; |
@@ -1540,12 +1540,12 @@ discard block |
||
1540 | 1540 | } |
1541 | 1541 | |
1542 | 1542 | |
1543 | - /** |
|
1544 | - * Counts all dates |
|
1545 | - * |
|
1546 | - * @param array $filters |
|
1547 | - * @return array the date list |
|
1548 | - */ |
|
1543 | + /** |
|
1544 | + * Counts all dates |
|
1545 | + * |
|
1546 | + * @param array $filters |
|
1547 | + * @return array the date list |
|
1548 | + */ |
|
1549 | 1549 | public function countAllDates($filters = array()) |
1550 | 1550 | { |
1551 | 1551 | global $globalTimezone, $globalDBdriver; |
@@ -1590,12 +1590,12 @@ discard block |
||
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | |
1593 | - /** |
|
1594 | - * Counts all dates during the last 7 days |
|
1595 | - * |
|
1596 | - * @param array $filters |
|
1597 | - * @return array the date list |
|
1598 | - */ |
|
1593 | + /** |
|
1594 | + * Counts all dates during the last 7 days |
|
1595 | + * |
|
1596 | + * @param array $filters |
|
1597 | + * @return array the date list |
|
1598 | + */ |
|
1599 | 1599 | public function countAllDatesLast7Days($filters = array()) |
1600 | 1600 | { |
1601 | 1601 | global $globalTimezone, $globalDBdriver; |
@@ -1617,7 +1617,7 @@ discard block |
||
1617 | 1617 | $query .= " GROUP BY date_name |
1618 | 1618 | ORDER BY date_name ASC"; |
1619 | 1619 | $query_data = array(':offset' => $offset); |
1620 | - } |
|
1620 | + } |
|
1621 | 1621 | |
1622 | 1622 | $sth = $this->db->prepare($query); |
1623 | 1623 | $sth->execute($query_data); |
@@ -1636,12 +1636,12 @@ discard block |
||
1636 | 1636 | return $date_array; |
1637 | 1637 | } |
1638 | 1638 | |
1639 | - /** |
|
1640 | - * Counts all dates during the last month |
|
1641 | - * |
|
1642 | - * @param array $filters |
|
1643 | - * @return array the date list |
|
1644 | - */ |
|
1639 | + /** |
|
1640 | + * Counts all dates during the last month |
|
1641 | + * |
|
1642 | + * @param array $filters |
|
1643 | + * @return array the date list |
|
1644 | + */ |
|
1645 | 1645 | public function countAllDatesLastMonth($filters = array()) |
1646 | 1646 | { |
1647 | 1647 | global $globalTimezone, $globalDBdriver; |
@@ -1663,7 +1663,7 @@ discard block |
||
1663 | 1663 | $query .= " GROUP BY date_name |
1664 | 1664 | ORDER BY date_name ASC"; |
1665 | 1665 | $query_data = array(':offset' => $offset); |
1666 | - } |
|
1666 | + } |
|
1667 | 1667 | |
1668 | 1668 | $sth = $this->db->prepare($query); |
1669 | 1669 | $sth->execute($query_data); |
@@ -1683,12 +1683,12 @@ discard block |
||
1683 | 1683 | } |
1684 | 1684 | |
1685 | 1685 | |
1686 | - /** |
|
1687 | - * Counts all month |
|
1688 | - * |
|
1689 | - * @param array $filters |
|
1690 | - * @return array the month list |
|
1691 | - */ |
|
1686 | + /** |
|
1687 | + * Counts all month |
|
1688 | + * |
|
1689 | + * @param array $filters |
|
1690 | + * @return array the month list |
|
1691 | + */ |
|
1692 | 1692 | public function countAllMonths($filters = array()) |
1693 | 1693 | { |
1694 | 1694 | global $globalTimezone, $globalDBdriver; |
@@ -1730,12 +1730,12 @@ discard block |
||
1730 | 1730 | } |
1731 | 1731 | |
1732 | 1732 | |
1733 | - /** |
|
1734 | - * Counts all dates during the last year |
|
1735 | - * |
|
1736 | - * @param $filters |
|
1737 | - * @return array the date list |
|
1738 | - */ |
|
1733 | + /** |
|
1734 | + * Counts all dates during the last year |
|
1735 | + * |
|
1736 | + * @param $filters |
|
1737 | + * @return array the date list |
|
1738 | + */ |
|
1739 | 1739 | public function countAllMonthsLastYear($filters) |
1740 | 1740 | { |
1741 | 1741 | global $globalTimezone, $globalDBdriver; |
@@ -1757,7 +1757,7 @@ discard block |
||
1757 | 1757 | $query .= " GROUP BY year_name, month_name |
1758 | 1758 | ORDER BY year_name, month_name ASC"; |
1759 | 1759 | $query_data = array(':offset' => $offset); |
1760 | - } |
|
1760 | + } |
|
1761 | 1761 | |
1762 | 1762 | $sth = $this->db->prepare($query); |
1763 | 1763 | $sth->execute($query_data); |
@@ -1778,13 +1778,13 @@ discard block |
||
1778 | 1778 | } |
1779 | 1779 | |
1780 | 1780 | |
1781 | - /** |
|
1782 | - * Counts all hours |
|
1783 | - * |
|
1784 | - * @param $orderby |
|
1785 | - * @param array $filters |
|
1786 | - * @return array the hour list |
|
1787 | - */ |
|
1781 | + /** |
|
1782 | + * Counts all hours |
|
1783 | + * |
|
1784 | + * @param $orderby |
|
1785 | + * @param array $filters |
|
1786 | + * @return array the hour list |
|
1787 | + */ |
|
1788 | 1788 | public function countAllHours($orderby,$filters = array()) |
1789 | 1789 | { |
1790 | 1790 | global $globalTimezone, $globalDBdriver; |
@@ -1845,13 +1845,13 @@ discard block |
||
1845 | 1845 | } |
1846 | 1846 | |
1847 | 1847 | |
1848 | - /** |
|
1849 | - * Counts all hours by date |
|
1850 | - * |
|
1851 | - * @param $date |
|
1852 | - * @param array $filters |
|
1853 | - * @return array the hour list |
|
1854 | - */ |
|
1848 | + /** |
|
1849 | + * Counts all hours by date |
|
1850 | + * |
|
1851 | + * @param $date |
|
1852 | + * @param array $filters |
|
1853 | + * @return array the hour list |
|
1854 | + */ |
|
1855 | 1855 | public function countAllHoursByDate($date, $filters = array()) |
1856 | 1856 | { |
1857 | 1857 | global $globalTimezone, $globalDBdriver; |
@@ -1893,13 +1893,13 @@ discard block |
||
1893 | 1893 | } |
1894 | 1894 | |
1895 | 1895 | |
1896 | - /** |
|
1897 | - * Counts all hours by a ident/callsign |
|
1898 | - * |
|
1899 | - * @param $ident |
|
1900 | - * @param array $filters |
|
1901 | - * @return array the hour list |
|
1902 | - */ |
|
1896 | + /** |
|
1897 | + * Counts all hours by a ident/callsign |
|
1898 | + * |
|
1899 | + * @param $ident |
|
1900 | + * @param array $filters |
|
1901 | + * @return array the hour list |
|
1902 | + */ |
|
1903 | 1903 | public function countAllHoursByIdent($ident, $filters = array()) |
1904 | 1904 | { |
1905 | 1905 | global $globalTimezone, $globalDBdriver; |
@@ -1941,15 +1941,15 @@ discard block |
||
1941 | 1941 | return $hour_array; |
1942 | 1942 | } |
1943 | 1943 | |
1944 | - /** |
|
1945 | - * Gets all aircraft registrations that have flown over |
|
1946 | - * |
|
1947 | - * @param bool $limit |
|
1948 | - * @param int $olderthanmonths |
|
1949 | - * @param string $sincedate |
|
1950 | - * @param array $filters |
|
1951 | - * @return array the aircraft list |
|
1952 | - */ |
|
1944 | + /** |
|
1945 | + * Gets all aircraft registrations that have flown over |
|
1946 | + * |
|
1947 | + * @param bool $limit |
|
1948 | + * @param int $olderthanmonths |
|
1949 | + * @param string $sincedate |
|
1950 | + * @param array $filters |
|
1951 | + * @return array the aircraft list |
|
1952 | + */ |
|
1953 | 1953 | public function countAllCaptainsByRaces($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
1954 | 1954 | { |
1955 | 1955 | global $globalDBdriver; |
@@ -1987,14 +1987,14 @@ discard block |
||
1987 | 1987 | return $marine_array; |
1988 | 1988 | } |
1989 | 1989 | |
1990 | - /** |
|
1991 | - * Counts all vessels |
|
1992 | - * |
|
1993 | - * @param array $filters |
|
1994 | - * @param string $year |
|
1995 | - * @param string $month |
|
1996 | - * @return Integer the number of vessels |
|
1997 | - */ |
|
1990 | + /** |
|
1991 | + * Counts all vessels |
|
1992 | + * |
|
1993 | + * @param array $filters |
|
1994 | + * @param string $year |
|
1995 | + * @param string $month |
|
1996 | + * @return Integer the number of vessels |
|
1997 | + */ |
|
1998 | 1998 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
1999 | 1999 | { |
2000 | 2000 | global $globalDBdriver; |
@@ -2028,14 +2028,14 @@ discard block |
||
2028 | 2028 | return $sth->fetchColumn(); |
2029 | 2029 | } |
2030 | 2030 | |
2031 | - /** |
|
2032 | - * Counts all vessel type |
|
2033 | - * |
|
2034 | - * @param array $filters |
|
2035 | - * @param string $year |
|
2036 | - * @param string $month |
|
2037 | - * @return Integer the number of vessels |
|
2038 | - */ |
|
2031 | + /** |
|
2032 | + * Counts all vessel type |
|
2033 | + * |
|
2034 | + * @param array $filters |
|
2035 | + * @param string $year |
|
2036 | + * @param string $month |
|
2037 | + * @return Integer the number of vessels |
|
2038 | + */ |
|
2039 | 2039 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
2040 | 2040 | { |
2041 | 2041 | global $globalDBdriver; |
@@ -2068,14 +2068,14 @@ discard block |
||
2068 | 2068 | return $sth->fetchColumn(); |
2069 | 2069 | } |
2070 | 2070 | |
2071 | - /** |
|
2072 | - * Gets a number of all race |
|
2073 | - * |
|
2074 | - * @param array $filters |
|
2075 | - * @param string $year |
|
2076 | - * @param string $month |
|
2077 | - * @return Integer number of races |
|
2078 | - */ |
|
2071 | + /** |
|
2072 | + * Gets a number of all race |
|
2073 | + * |
|
2074 | + * @param array $filters |
|
2075 | + * @param string $year |
|
2076 | + * @param string $month |
|
2077 | + * @return Integer number of races |
|
2078 | + */ |
|
2079 | 2079 | public function countOverallMarineRaces($filters = array(),$year = '',$month = '') |
2080 | 2080 | { |
2081 | 2081 | global $globalDBdriver; |
@@ -2108,14 +2108,14 @@ discard block |
||
2108 | 2108 | return $sth->fetchColumn(); |
2109 | 2109 | } |
2110 | 2110 | |
2111 | - /** |
|
2112 | - * Gets a number of all captain |
|
2113 | - * |
|
2114 | - * @param array $filters |
|
2115 | - * @param string $year |
|
2116 | - * @param string $month |
|
2117 | - * @return Integer number of captain |
|
2118 | - */ |
|
2111 | + /** |
|
2112 | + * Gets a number of all captain |
|
2113 | + * |
|
2114 | + * @param array $filters |
|
2115 | + * @param string $year |
|
2116 | + * @param string $month |
|
2117 | + * @return Integer number of captain |
|
2118 | + */ |
|
2119 | 2119 | public function countOverallMarineCaptains($filters = array(),$year = '',$month = '') |
2120 | 2120 | { |
2121 | 2121 | global $globalDBdriver; |
@@ -2148,12 +2148,12 @@ discard block |
||
2148 | 2148 | return $sth->fetchColumn(); |
2149 | 2149 | } |
2150 | 2150 | |
2151 | - /** |
|
2152 | - * Counts all hours of today |
|
2153 | - * |
|
2154 | - * @param array $filters |
|
2155 | - * @return array the hour list |
|
2156 | - */ |
|
2151 | + /** |
|
2152 | + * Counts all hours of today |
|
2153 | + * |
|
2154 | + * @param array $filters |
|
2155 | + * @return array the hour list |
|
2156 | + */ |
|
2157 | 2157 | public function countAllHoursFromToday($filters = array()) |
2158 | 2158 | { |
2159 | 2159 | global $globalTimezone, $globalDBdriver; |
@@ -2193,12 +2193,12 @@ discard block |
||
2193 | 2193 | } |
2194 | 2194 | |
2195 | 2195 | |
2196 | - /** |
|
2197 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
2198 | - * |
|
2199 | - * @param $fammarine_id |
|
2200 | - * @return Integer the Barrie Spotter ID |
|
2201 | - */ |
|
2196 | + /** |
|
2197 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
2198 | + * |
|
2199 | + * @param $fammarine_id |
|
2200 | + * @return Integer the Barrie Spotter ID |
|
2201 | + */ |
|
2202 | 2202 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
2203 | 2203 | { |
2204 | 2204 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -2219,13 +2219,13 @@ discard block |
||
2219 | 2219 | |
2220 | 2220 | |
2221 | 2221 | /** |
2222 | - * Parses a date string |
|
2223 | - * |
|
2224 | - * @param String $dateString the date string |
|
2225 | - * @param String $timezone the timezone of a user |
|
2226 | - * @return array the time information |
|
2227 | - * |
|
2228 | - */ |
|
2222 | + * Parses a date string |
|
2223 | + * |
|
2224 | + * @param String $dateString the date string |
|
2225 | + * @param String $timezone the timezone of a user |
|
2226 | + * @return array the time information |
|
2227 | + * |
|
2228 | + */ |
|
2229 | 2229 | public function parseDateString($dateString, $timezone = '') |
2230 | 2230 | { |
2231 | 2231 | $time_array = array(); |
@@ -2258,12 +2258,12 @@ discard block |
||
2258 | 2258 | } |
2259 | 2259 | |
2260 | 2260 | /** |
2261 | - * Parses the direction degrees to working |
|
2262 | - * |
|
2263 | - * @param Float $direction the direction in degrees |
|
2264 | - * @return array the direction information |
|
2265 | - * |
|
2266 | - */ |
|
2261 | + * Parses the direction degrees to working |
|
2262 | + * |
|
2263 | + * @param Float $direction the direction in degrees |
|
2264 | + * @return array the direction information |
|
2265 | + * |
|
2266 | + */ |
|
2267 | 2267 | public function parseDirection($direction = 0) |
2268 | 2268 | { |
2269 | 2269 | if ($direction == '') $direction = 0; |
@@ -2342,12 +2342,12 @@ discard block |
||
2342 | 2342 | |
2343 | 2343 | |
2344 | 2344 | /** |
2345 | - * Gets Country from latitude/longitude |
|
2346 | - * |
|
2347 | - * @param Float $latitude latitute of the flight |
|
2348 | - * @param Float $longitude longitute of the flight |
|
2349 | - * @return String the countries |
|
2350 | - */ |
|
2345 | + * Gets Country from latitude/longitude |
|
2346 | + * |
|
2347 | + * @param Float $latitude latitute of the flight |
|
2348 | + * @param Float $longitude longitute of the flight |
|
2349 | + * @return String the countries |
|
2350 | + */ |
|
2351 | 2351 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
2352 | 2352 | { |
2353 | 2353 | global $globalDebug; |
@@ -2384,11 +2384,11 @@ discard block |
||
2384 | 2384 | } |
2385 | 2385 | |
2386 | 2386 | /** |
2387 | - * Gets Country from iso2 |
|
2388 | - * |
|
2389 | - * @param String $iso2 ISO2 country code |
|
2390 | - * @return String the countries |
|
2391 | - */ |
|
2387 | + * Gets Country from iso2 |
|
2388 | + * |
|
2389 | + * @param String $iso2 ISO2 country code |
|
2390 | + * @return String the countries |
|
2391 | + */ |
|
2392 | 2392 | public function getCountryFromISO2($iso2) |
2393 | 2393 | { |
2394 | 2394 | global $globalDebug; |
@@ -2417,12 +2417,12 @@ discard block |
||
2417 | 2417 | |
2418 | 2418 | |
2419 | 2419 | /** |
2420 | - * Gets the short url from bit.ly |
|
2421 | - * |
|
2422 | - * @param String $url the full url |
|
2423 | - * @return String the bit.ly url |
|
2424 | - * |
|
2425 | - */ |
|
2420 | + * Gets the short url from bit.ly |
|
2421 | + * |
|
2422 | + * @param String $url the full url |
|
2423 | + * @return String the bit.ly url |
|
2424 | + * |
|
2425 | + */ |
|
2426 | 2426 | public function getBitlyURL($url) |
2427 | 2427 | { |
2428 | 2428 | global $globalBitlyAccessToken; |
@@ -2448,18 +2448,18 @@ discard block |
||
2448 | 2448 | } |
2449 | 2449 | |
2450 | 2450 | |
2451 | - /** |
|
2452 | - * Gets all vessels types that have flown over |
|
2453 | - * |
|
2454 | - * @param bool $limit |
|
2455 | - * @param int $olderthanmonths |
|
2456 | - * @param string $sincedate |
|
2457 | - * @param array $filters |
|
2458 | - * @param string $year |
|
2459 | - * @param string $month |
|
2460 | - * @param string $day |
|
2461 | - * @return array the vessel type list |
|
2462 | - */ |
|
2451 | + /** |
|
2452 | + * Gets all vessels types that have flown over |
|
2453 | + * |
|
2454 | + * @param bool $limit |
|
2455 | + * @param int $olderthanmonths |
|
2456 | + * @param string $sincedate |
|
2457 | + * @param array $filters |
|
2458 | + * @param string $year |
|
2459 | + * @param string $month |
|
2460 | + * @param string $day |
|
2461 | + * @return array the vessel type list |
|
2462 | + */ |
|
2463 | 2463 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
2464 | 2464 | { |
2465 | 2465 | global $globalDBdriver; |
@@ -2524,27 +2524,27 @@ discard block |
||
2524 | 2524 | return $marine_array; |
2525 | 2525 | } |
2526 | 2526 | |
2527 | - /** |
|
2528 | - * Gets all the tracker information |
|
2529 | - * |
|
2530 | - * @param string $q |
|
2531 | - * @param string $callsign |
|
2532 | - * @param string $mmsi |
|
2533 | - * @param string $imo |
|
2534 | - * @param string $date_posted |
|
2535 | - * @param string $limit |
|
2536 | - * @param string $sort |
|
2537 | - * @param string $includegeodata |
|
2538 | - * @param string $origLat |
|
2539 | - * @param string $origLon |
|
2540 | - * @param string $dist |
|
2541 | - * @param string $captain_id |
|
2542 | - * @param string $captain_name |
|
2543 | - * @param string $race_id |
|
2544 | - * @param string $race_name |
|
2545 | - * @param array $filters |
|
2546 | - * @return array the tracker information |
|
2547 | - */ |
|
2527 | + /** |
|
2528 | + * Gets all the tracker information |
|
2529 | + * |
|
2530 | + * @param string $q |
|
2531 | + * @param string $callsign |
|
2532 | + * @param string $mmsi |
|
2533 | + * @param string $imo |
|
2534 | + * @param string $date_posted |
|
2535 | + * @param string $limit |
|
2536 | + * @param string $sort |
|
2537 | + * @param string $includegeodata |
|
2538 | + * @param string $origLat |
|
2539 | + * @param string $origLon |
|
2540 | + * @param string $dist |
|
2541 | + * @param string $captain_id |
|
2542 | + * @param string $captain_name |
|
2543 | + * @param string $race_id |
|
2544 | + * @param string $race_name |
|
2545 | + * @param array $filters |
|
2546 | + * @return array the tracker information |
|
2547 | + */ |
|
2548 | 2548 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$captain_id = '',$captain_name = '',$race_id = '',$race_name = '',$filters = array()) |
2549 | 2549 | { |
2550 | 2550 | global $globalTimezone, $globalDBdriver; |
@@ -2720,12 +2720,12 @@ discard block |
||
2720 | 2720 | return $marine_array; |
2721 | 2721 | } |
2722 | 2722 | |
2723 | - /** |
|
2724 | - * Check marine by id |
|
2725 | - * |
|
2726 | - * @param $id |
|
2727 | - * @return String the ident |
|
2728 | - */ |
|
2723 | + /** |
|
2724 | + * Check marine by id |
|
2725 | + * |
|
2726 | + * @param $id |
|
2727 | + * @return String the ident |
|
2728 | + */ |
|
2729 | 2729 | public function checkId($id) |
2730 | 2730 | { |
2731 | 2731 | $query = 'SELECT marine_output.ident, marine_output.fammarine_id FROM marine_output WHERE marine_output.fammarine_id = :id'; |
@@ -2740,12 +2740,12 @@ discard block |
||
2740 | 2740 | return $ident_result; |
2741 | 2741 | } |
2742 | 2742 | |
2743 | - /** |
|
2744 | - * Gets all info from a race |
|
2745 | - * |
|
2746 | - * @param $race_name |
|
2747 | - * @return array race |
|
2748 | - */ |
|
2743 | + /** |
|
2744 | + * Gets all info from a race |
|
2745 | + * |
|
2746 | + * @param $race_name |
|
2747 | + * @return array race |
|
2748 | + */ |
|
2749 | 2749 | public function getRaceByName($race_name) |
2750 | 2750 | { |
2751 | 2751 | $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
@@ -2757,12 +2757,12 @@ discard block |
||
2757 | 2757 | else return array(); |
2758 | 2758 | } |
2759 | 2759 | |
2760 | - /** |
|
2761 | - * Gets all info from a race |
|
2762 | - * |
|
2763 | - * @param $race_id |
|
2764 | - * @return array race |
|
2765 | - */ |
|
2760 | + /** |
|
2761 | + * Gets all info from a race |
|
2762 | + * |
|
2763 | + * @param $race_id |
|
2764 | + * @return array race |
|
2765 | + */ |
|
2766 | 2766 | public function getRace($race_id) |
2767 | 2767 | { |
2768 | 2768 | $race_id = filter_var($race_id,FILTER_SANITIZE_NUMBER_INT); |
@@ -2774,15 +2774,15 @@ discard block |
||
2774 | 2774 | else return array(); |
2775 | 2775 | } |
2776 | 2776 | |
2777 | - /** |
|
2778 | - * Add race |
|
2779 | - * @param $race_id |
|
2780 | - * @param $race_name |
|
2781 | - * @param $race_creator |
|
2782 | - * @param $race_desc |
|
2783 | - * @param $race_startdate |
|
2784 | - * @param $race_markers |
|
2785 | - */ |
|
2777 | + /** |
|
2778 | + * Add race |
|
2779 | + * @param $race_id |
|
2780 | + * @param $race_name |
|
2781 | + * @param $race_creator |
|
2782 | + * @param $race_desc |
|
2783 | + * @param $race_startdate |
|
2784 | + * @param $race_markers |
|
2785 | + */ |
|
2786 | 2786 | public function addRace($race_id,$race_name,$race_creator,$race_desc,$race_startdate,$race_markers) |
2787 | 2787 | { |
2788 | 2788 | $race_id = filter_var($race_id,FILTER_SANITIZE_NUMBER_INT); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | require_once(dirname(__FILE__).'/class.Image.php'); |
10 | 10 | $global_marine_query = "SELECT marine_output.* FROM marine_output"; |
11 | 11 | |
12 | -class Marine{ |
|
12 | +class Marine { |
|
13 | 13 | public $db; |
14 | 14 | |
15 | 15 | public function __construct($dbc = null) { |
@@ -25,33 +25,33 @@ discard block |
||
25 | 25 | * @param bool $and |
26 | 26 | * @return string the SQL part |
27 | 27 | */ |
28 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
28 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
29 | 29 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
30 | 30 | $filters = array(); |
31 | 31 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
32 | 32 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
33 | 33 | $filters = $globalStatsFilters[$globalFilterName]; |
34 | 34 | } else { |
35 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
35 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
36 | 36 | } |
37 | 37 | } |
38 | 38 | if (isset($filter[0]['source'])) { |
39 | - $filters = array_merge($filters,$filter); |
|
39 | + $filters = array_merge($filters, $filter); |
|
40 | 40 | } |
41 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
41 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
42 | 42 | $filter_query_join = ''; |
43 | 43 | $filter_query_where = ''; |
44 | - foreach($filters as $flt) { |
|
44 | + foreach ($filters as $flt) { |
|
45 | 45 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
46 | 46 | if (isset($flt['source'])) { |
47 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
48 | 48 | } else { |
49 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
49 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
53 | 53 | if (isset($filter['source']) && !empty($filter['source'])) { |
54 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
54 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
55 | 55 | } |
56 | 56 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
57 | 57 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
90 | 90 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
91 | 91 | if ($filter_query_where != '') { |
92 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
92 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
93 | 93 | } |
94 | 94 | $filter_query = $filter_query_join.$filter_query_where; |
95 | 95 | return $filter_query; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param bool $schedules |
105 | 105 | * @return array the spotter information |
106 | 106 | */ |
107 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
107 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
108 | 108 | { |
109 | 109 | global $globalVM; |
110 | 110 | date_default_timezone_set('UTC'); |
@@ -125,13 +125,13 @@ discard block |
||
125 | 125 | $sth = $this->db->prepare($query.$limitQuery); |
126 | 126 | $sth->execute($params); |
127 | 127 | } catch (PDOException $e) { |
128 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
128 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
129 | 129 | exit(); |
130 | 130 | } |
131 | 131 | |
132 | 132 | $num_rows = 0; |
133 | 133 | $spotter_array = array(); |
134 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
134 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
135 | 135 | { |
136 | 136 | $num_rows++; |
137 | 137 | $temp_array = array(); |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | } |
151 | 151 | if (isset($row['fammarine_id'])) $temp_array['fammarine_id'] = $row['fammarine_id']; |
152 | 152 | if (isset($row['mmsi'])) $temp_array['mmsi'] = $row['mmsi']; |
153 | - if (isset($row['type'])) $temp_array['type'] = html_entity_decode($row['type'],ENT_QUOTES); |
|
153 | + if (isset($row['type'])) $temp_array['type'] = html_entity_decode($row['type'], ENT_QUOTES); |
|
154 | 154 | if (isset($row['type_id'])) $temp_array['type_id'] = $row['type_id']; |
155 | 155 | if (isset($row['status'])) $temp_array['status'] = $row['status']; |
156 | 156 | if (isset($row['status_id'])) $temp_array['status_id'] = $row['status_id']; |
@@ -173,10 +173,10 @@ discard block |
||
173 | 173 | } |
174 | 174 | if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
175 | 175 | |
176 | - if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
176 | + if (isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
177 | 177 | { |
178 | 178 | $Image = new Image($this->db); |
179 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
179 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']); |
|
180 | 180 | else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
181 | 181 | unset($Image); |
182 | 182 | if (count($image_array) > 0) { |
@@ -186,10 +186,10 @@ discard block |
||
186 | 186 | $temp_array['image_source_website'] = $image_array[0]['image_source_website']; |
187 | 187 | $temp_array['image_copyright'] = $image_array[0]['image_copyright']; |
188 | 188 | } |
189 | - } elseif(isset($temp_array['type']) && $temp_array['type'] != "") |
|
189 | + } elseif (isset($temp_array['type']) && $temp_array['type'] != "") |
|
190 | 190 | { |
191 | 191 | $Image = new Image($this->db); |
192 | - $image_array = $Image->getMarineImage('','','',$temp_array['type']); |
|
192 | + $image_array = $Image->getMarineImage('', '', '', $temp_array['type']); |
|
193 | 193 | unset($Image); |
194 | 194 | if (count($image_array) > 0) { |
195 | 195 | $temp_array['image'] = $image_array[0]['image']; |
@@ -224,17 +224,17 @@ discard block |
||
224 | 224 | { |
225 | 225 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
226 | 226 | } else { |
227 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
227 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
228 | 228 | } |
229 | 229 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
230 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
231 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
230 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
231 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
232 | 232 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
233 | 233 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
234 | 234 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
235 | 235 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
236 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
237 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
236 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
237 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
238 | 238 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
239 | 239 | } |
240 | 240 | } |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | if ($limit != "") |
270 | 270 | { |
271 | 271 | $limit_array = explode(",", $limit); |
272 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
273 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
272 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
273 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
274 | 274 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
275 | 275 | { |
276 | 276 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -284,8 +284,8 @@ discard block |
||
284 | 284 | } else { |
285 | 285 | $orderby_query = " ORDER BY marine_output.date DESC"; |
286 | 286 | } |
287 | - $query = $global_marine_query.$filter_query." ".$orderby_query; |
|
288 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
287 | + $query = $global_marine_query.$filter_query." ".$orderby_query; |
|
288 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
289 | 289 | return $spotter_array; |
290 | 290 | } |
291 | 291 | |
@@ -303,8 +303,8 @@ discard block |
||
303 | 303 | if ($id == '') return array(); |
304 | 304 | $additional_query = "marine_output.fammarine_id = :id"; |
305 | 305 | $query_values = array(':id' => $id); |
306 | - $query = $global_marine_query." WHERE ".$additional_query." "; |
|
307 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
306 | + $query = $global_marine_query." WHERE ".$additional_query." "; |
|
307 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
308 | 308 | return $spotter_array; |
309 | 309 | } |
310 | 310 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $query_values = array(); |
327 | 327 | $limit_query = ''; |
328 | 328 | $additional_query = ''; |
329 | - $filter_query = $this->getFilter($filter,true,true); |
|
329 | + $filter_query = $this->getFilter($filter, true, true); |
|
330 | 330 | if ($ident != "") |
331 | 331 | { |
332 | 332 | if (!is_string($ident)) |
@@ -342,8 +342,8 @@ discard block |
||
342 | 342 | { |
343 | 343 | $limit_array = explode(",", $limit); |
344 | 344 | |
345 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
346 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
345 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
346 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
347 | 347 | |
348 | 348 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
349 | 349 | { |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | date_default_timezone_set('UTC'); |
384 | 384 | |
385 | 385 | $limit_query = ''; |
386 | - $filter_query = $this->getFilter($filter,true,true); |
|
386 | + $filter_query = $this->getFilter($filter, true, true); |
|
387 | 387 | if (!is_string($type)) |
388 | 388 | { |
389 | 389 | return array(); |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | { |
397 | 397 | $limit_array = explode(",", $limit); |
398 | 398 | |
399 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
400 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
399 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
400 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
401 | 401 | |
402 | 402 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
403 | 403 | { |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | $limit_query = ''; |
437 | 437 | $additional_query = ''; |
438 | 438 | |
439 | - $filter_query = $this->getFilter($filter,true,true); |
|
439 | + $filter_query = $this->getFilter($filter, true, true); |
|
440 | 440 | |
441 | 441 | if ($date != "") |
442 | 442 | { |
@@ -462,8 +462,8 @@ discard block |
||
462 | 462 | { |
463 | 463 | $limit_array = explode(",", $limit); |
464 | 464 | |
465 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
466 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
465 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
466 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
467 | 467 | |
468 | 468 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
469 | 469 | { |
@@ -501,8 +501,8 @@ discard block |
||
501 | 501 | $query_values = array(); |
502 | 502 | $limit_query = ''; |
503 | 503 | $additional_query = ''; |
504 | - $filter_query = $this->getFilter($filter,true,true); |
|
505 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
504 | + $filter_query = $this->getFilter($filter, true, true); |
|
505 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
506 | 506 | if ($captain != "") |
507 | 507 | { |
508 | 508 | $additional_query = " AND (marine_output.captain_name = :captain OR marine_output.captain_id = :captain)"; |
@@ -511,8 +511,8 @@ discard block |
||
511 | 511 | if ($limit != "") |
512 | 512 | { |
513 | 513 | $limit_array = explode(",", $limit); |
514 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
515 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
514 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
515 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
516 | 516 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
517 | 517 | { |
518 | 518 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -542,13 +542,13 @@ discard block |
||
542 | 542 | */ |
543 | 543 | public function getMarineDataByRace($race = '', $limit = '', $sort = '', $filter = array()) |
544 | 544 | { |
545 | - global $global_marine_query,$globalDBdriver; |
|
545 | + global $global_marine_query, $globalDBdriver; |
|
546 | 546 | date_default_timezone_set('UTC'); |
547 | 547 | $query_values = array(); |
548 | 548 | $limit_query = ''; |
549 | 549 | $additional_query = ''; |
550 | - $filter_query = $this->getFilter($filter,true,true); |
|
551 | - $race = filter_var($race,FILTER_SANITIZE_STRING); |
|
550 | + $filter_query = $this->getFilter($filter, true, true); |
|
551 | + $race = filter_var($race, FILTER_SANITIZE_STRING); |
|
552 | 552 | if ($race != "") |
553 | 553 | { |
554 | 554 | $additional_query = " AND (marine_output.race_name = :race OR marine_output.race_id = :race)"; |
@@ -557,8 +557,8 @@ discard block |
||
557 | 557 | if ($limit != "") |
558 | 558 | { |
559 | 559 | $limit_array = explode(",", $limit); |
560 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
561 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
560 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
561 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
562 | 562 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
563 | 563 | { |
564 | 564 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -588,14 +588,14 @@ discard block |
||
588 | 588 | * @param array $filters |
589 | 589 | * @return Integer number of race for a captain |
590 | 590 | */ |
591 | - public function countRacesByCaptain($captain,$filters = array()) |
|
591 | + public function countRacesByCaptain($captain, $filters = array()) |
|
592 | 592 | { |
593 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
594 | - $filter_query = $this->getFilter($filters,true,true); |
|
595 | - $query = "SELECT COUNT(*) AS nb |
|
593 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
594 | + $filter_query = $this->getFilter($filters, true, true); |
|
595 | + $query = "SELECT COUNT(*) AS nb |
|
596 | 596 | FROM marine_output".$filter_query." (marine_output.captain_name = :captain OR marine_output.captain_id = :captain)"; |
597 | 597 | $query_values = array(); |
598 | - $query_values = array_merge($query_values,array(':captain' => $captain)); |
|
598 | + $query_values = array_merge($query_values, array(':captain' => $captain)); |
|
599 | 599 | $sth = $this->db->prepare($query); |
600 | 600 | $sth->execute($query_values); |
601 | 601 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -609,14 +609,14 @@ discard block |
||
609 | 609 | * @param array $filters |
610 | 610 | * @return String Duration of all races |
611 | 611 | */ |
612 | - public function countCaptainsByRace($race,$filters = array()) |
|
612 | + public function countCaptainsByRace($race, $filters = array()) |
|
613 | 613 | { |
614 | - $race = filter_var($race,FILTER_SANITIZE_STRING); |
|
615 | - $filter_query = $this->getFilter($filters,true,true); |
|
616 | - $query = "SELECT COUNT(*) AS nb |
|
614 | + $race = filter_var($race, FILTER_SANITIZE_STRING); |
|
615 | + $filter_query = $this->getFilter($filters, true, true); |
|
616 | + $query = "SELECT COUNT(*) AS nb |
|
617 | 617 | FROM marine_output".$filter_query." (marine_output.race_name = :race OR marine_output.race_id = :race)"; |
618 | 618 | $query_values = array(); |
619 | - $query_values = array_merge($query_values,array(':race' => $race)); |
|
619 | + $query_values = array_merge($query_values, array(':race' => $race)); |
|
620 | 620 | $sth = $this->db->prepare($query); |
621 | 621 | $sth->execute($query_values); |
622 | 622 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -633,44 +633,44 @@ discard block |
||
633 | 633 | * @param string $day |
634 | 634 | * @return array the boat list |
635 | 635 | */ |
636 | - public function countAllBoatTypesByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
|
636 | + public function countAllBoatTypesByCaptain($captain, $filters = array(), $year = '', $month = '', $day = '') |
|
637 | 637 | { |
638 | 638 | global $globalDBdriver; |
639 | - $filter_query = $this->getFilter($filters,true,true); |
|
640 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
641 | - $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
639 | + $filter_query = $this->getFilter($filters, true, true); |
|
640 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
641 | + $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
642 | 642 | FROM marine_output".$filter_query." (marine_output.captain_id = :captain OR marine_output.captain_name = :captain)"; |
643 | 643 | $query_values = array(); |
644 | 644 | if ($year != '') { |
645 | 645 | if ($globalDBdriver == 'mysql') { |
646 | 646 | $query .= " AND YEAR(marine_output.date) = :year"; |
647 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
647 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
648 | 648 | } else { |
649 | 649 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
650 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
650 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
651 | 651 | } |
652 | 652 | } |
653 | 653 | if ($month != '') { |
654 | 654 | if ($globalDBdriver == 'mysql') { |
655 | 655 | $query .= " AND MONTH(marine_output.date) = :month"; |
656 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
656 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
657 | 657 | } else { |
658 | 658 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
659 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
659 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
660 | 660 | } |
661 | 661 | } |
662 | 662 | if ($day != '') { |
663 | 663 | if ($globalDBdriver == 'mysql') { |
664 | 664 | $query .= " AND DAY(marine_output.date) = :day"; |
665 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
665 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
666 | 666 | } else { |
667 | 667 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
668 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
668 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
669 | 669 | } |
670 | 670 | } |
671 | 671 | $query .= " GROUP BY marine_output.type |
672 | 672 | ORDER BY type_count DESC"; |
673 | - $query_values = array_merge($query_values,array(':captain' => $captain)); |
|
673 | + $query_values = array_merge($query_values, array(':captain' => $captain)); |
|
674 | 674 | $sth = $this->db->prepare($query); |
675 | 675 | $sth->execute($query_values); |
676 | 676 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -686,44 +686,44 @@ discard block |
||
686 | 686 | * @param string $day |
687 | 687 | * @return array the boat list |
688 | 688 | */ |
689 | - public function countAllBoatTypesByRace($race,$filters = array(),$year = '',$month = '',$day = '') |
|
689 | + public function countAllBoatTypesByRace($race, $filters = array(), $year = '', $month = '', $day = '') |
|
690 | 690 | { |
691 | 691 | global $globalDBdriver; |
692 | - $filter_query = $this->getFilter($filters,true,true); |
|
693 | - $race = filter_var($race,FILTER_SANITIZE_STRING); |
|
694 | - $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
692 | + $filter_query = $this->getFilter($filters, true, true); |
|
693 | + $race = filter_var($race, FILTER_SANITIZE_STRING); |
|
694 | + $query = "SELECT DISTINCT marine_output.type, COUNT(marine_output.type) AS type_count |
|
695 | 695 | FROM marine_output".$filter_query." (marine_output.race_id = :race OR marine_output.race_name = :race)"; |
696 | 696 | $query_values = array(); |
697 | 697 | if ($year != '') { |
698 | 698 | if ($globalDBdriver == 'mysql') { |
699 | 699 | $query .= " AND YEAR(marine_output.date) = :year"; |
700 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
700 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
701 | 701 | } else { |
702 | 702 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
703 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
703 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
704 | 704 | } |
705 | 705 | } |
706 | 706 | if ($month != '') { |
707 | 707 | if ($globalDBdriver == 'mysql') { |
708 | 708 | $query .= " AND MONTH(marine_output.date) = :month"; |
709 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
709 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
710 | 710 | } else { |
711 | 711 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
712 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
712 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
713 | 713 | } |
714 | 714 | } |
715 | 715 | if ($day != '') { |
716 | 716 | if ($globalDBdriver == 'mysql') { |
717 | 717 | $query .= " AND DAY(marine_output.date) = :day"; |
718 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
718 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
719 | 719 | } else { |
720 | 720 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
721 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
721 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
722 | 722 | } |
723 | 723 | } |
724 | 724 | $query .= " GROUP BY marine_output.type |
725 | 725 | ORDER BY type_count DESC"; |
726 | - $query_values = array_merge($query_values,array(':race' => $race)); |
|
726 | + $query_values = array_merge($query_values, array(':race' => $race)); |
|
727 | 727 | $sth = $this->db->prepare($query); |
728 | 728 | $sth->execute($query_values); |
729 | 729 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -739,47 +739,47 @@ discard block |
||
739 | 739 | * @param string $day |
740 | 740 | * @return String Duration of all race |
741 | 741 | */ |
742 | - public function getRaceDurationByCaptain($captain,$filters = array(),$year = '',$month = '',$day = '') |
|
742 | + public function getRaceDurationByCaptain($captain, $filters = array(), $year = '', $month = '', $day = '') |
|
743 | 743 | { |
744 | 744 | global $globalDBdriver; |
745 | - $captain = filter_var($captain,FILTER_SANITIZE_STRING); |
|
746 | - $filter_query = $this->getFilter($filters,true,true); |
|
747 | - $query = "SELECT SUM(last_seen - date) AS duration |
|
745 | + $captain = filter_var($captain, FILTER_SANITIZE_STRING); |
|
746 | + $filter_query = $this->getFilter($filters, true, true); |
|
747 | + $query = "SELECT SUM(last_seen - date) AS duration |
|
748 | 748 | FROM marine_output".$filter_query." (marine_output.captain_name = :captain OR marine_output.captain_id = :captain) |
749 | 749 | AND last_seen > date"; |
750 | 750 | $query_values = array(); |
751 | 751 | if ($year != '') { |
752 | 752 | if ($globalDBdriver == 'mysql') { |
753 | 753 | $query .= " AND YEAR(marine_output.date) = :year"; |
754 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
754 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
755 | 755 | } else { |
756 | 756 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
757 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
757 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
758 | 758 | } |
759 | 759 | } |
760 | 760 | if ($month != '') { |
761 | 761 | if ($globalDBdriver == 'mysql') { |
762 | 762 | $query .= " AND MONTH(marine_output.date) = :month"; |
763 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
763 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
764 | 764 | } else { |
765 | 765 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
766 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
766 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
767 | 767 | } |
768 | 768 | } |
769 | 769 | if ($day != '') { |
770 | 770 | if ($globalDBdriver == 'mysql') { |
771 | 771 | $query .= " AND DAY(marine_output.date) = :day"; |
772 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
772 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
773 | 773 | } else { |
774 | 774 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
775 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
775 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
776 | 776 | } |
777 | 777 | } |
778 | - $query_values = array_merge($query_values,array(':captain' => $captain)); |
|
778 | + $query_values = array_merge($query_values, array(':captain' => $captain)); |
|
779 | 779 | $sth = $this->db->prepare($query); |
780 | 780 | $sth->execute($query_values); |
781 | 781 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
782 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
782 | + if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']); |
|
783 | 783 | else return $result[0]['duration']; |
784 | 784 | } |
785 | 785 | |
@@ -793,38 +793,38 @@ discard block |
||
793 | 793 | * @param string $day |
794 | 794 | * @return array Duration of all race |
795 | 795 | */ |
796 | - public function getRaceDurationByCaptains($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
|
796 | + public function getRaceDurationByCaptains($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
|
797 | 797 | { |
798 | 798 | global $globalDBdriver; |
799 | - $filter_query = $this->getFilter($filters,true,true); |
|
800 | - $query = "SELECT SUM(last_seen - date) AS duration, captain_id, captain_name |
|
799 | + $filter_query = $this->getFilter($filters, true, true); |
|
800 | + $query = "SELECT SUM(last_seen - date) AS duration, captain_id, captain_name |
|
801 | 801 | FROM marine_output".$filter_query." last_seen > date"; |
802 | 802 | $query_values = array(); |
803 | 803 | if ($year != '') { |
804 | 804 | if ($globalDBdriver == 'mysql') { |
805 | 805 | $query .= " AND YEAR(marine_output.date) = :year"; |
806 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
806 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
807 | 807 | } else { |
808 | 808 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
809 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
809 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
810 | 810 | } |
811 | 811 | } |
812 | 812 | if ($month != '') { |
813 | 813 | if ($globalDBdriver == 'mysql') { |
814 | 814 | $query .= " AND MONTH(marine_output.date) = :month"; |
815 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
815 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
816 | 816 | } else { |
817 | 817 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
818 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
818 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
819 | 819 | } |
820 | 820 | } |
821 | 821 | if ($day != '') { |
822 | 822 | if ($globalDBdriver == 'mysql') { |
823 | 823 | $query .= " AND DAY(marine_output.date) = :day"; |
824 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
824 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
825 | 825 | } else { |
826 | 826 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
827 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
827 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
828 | 828 | } |
829 | 829 | } |
830 | 830 | $query .= " GROUP BY marine_output.captain_id,marine_output.captain_name ORDER BY duration DESC"; |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | $duration_array = array(); |
837 | 837 | $temp_array = array(); |
838 | 838 | |
839 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
839 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
840 | 840 | { |
841 | 841 | if ($row['duration'] != '') { |
842 | 842 | $temp_array['marine_duration_days'] = $row['duration']; |
@@ -858,8 +858,8 @@ discard block |
||
858 | 858 | */ |
859 | 859 | public function getAllCaptainNames($filters = array()) |
860 | 860 | { |
861 | - $filter_query = $this->getFilter($filters,true,true); |
|
862 | - $query = "SELECT DISTINCT marine_output.captain_name, marine_output.captain_id |
|
861 | + $filter_query = $this->getFilter($filters, true, true); |
|
862 | + $query = "SELECT DISTINCT marine_output.captain_name, marine_output.captain_id |
|
863 | 863 | FROM marine_output".$filter_query." marine_output.captain_name <> '' |
864 | 864 | ORDER BY marine_output.captain_name ASC"; |
865 | 865 | |
@@ -876,8 +876,8 @@ discard block |
||
876 | 876 | */ |
877 | 877 | public function getAllRaceNames($filters = array()) |
878 | 878 | { |
879 | - $filter_query = $this->getFilter($filters,true,true); |
|
880 | - $query = "SELECT DISTINCT marine_output.race_name, marine_output.race_id |
|
879 | + $filter_query = $this->getFilter($filters, true, true); |
|
880 | + $query = "SELECT DISTINCT marine_output.race_name, marine_output.race_id |
|
881 | 881 | FROM marine_output".$filter_query." marine_output.race_name <> '' |
882 | 882 | ORDER BY marine_output.race_name ASC"; |
883 | 883 | |
@@ -894,11 +894,11 @@ discard block |
||
894 | 894 | * @param array $filters |
895 | 895 | * @return array list of source name |
896 | 896 | */ |
897 | - public function getAllSourceName($type = '',$filters = array()) |
|
897 | + public function getAllSourceName($type = '', $filters = array()) |
|
898 | 898 | { |
899 | - $filter_query = $this->getFilter($filters,true,true); |
|
899 | + $filter_query = $this->getFilter($filters, true, true); |
|
900 | 900 | $query_values = array(); |
901 | - $query = "SELECT DISTINCT marine_output.source_name |
|
901 | + $query = "SELECT DISTINCT marine_output.source_name |
|
902 | 902 | FROM marine_output".$filter_query." marine_output.source_name <> ''"; |
903 | 903 | if ($type != '') { |
904 | 904 | $query_values = array(':type' => $type); |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | $source_array = array(); |
914 | 914 | $temp_array = array(); |
915 | 915 | |
916 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
916 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
917 | 917 | { |
918 | 918 | $temp_array['source_name'] = $row['source_name']; |
919 | 919 | $source_array[] = $temp_array; |
@@ -930,8 +930,8 @@ discard block |
||
930 | 930 | */ |
931 | 931 | public function getAllIdents($filters = array()) |
932 | 932 | { |
933 | - $filter_query = $this->getFilter($filters,true,true); |
|
934 | - $query = "SELECT DISTINCT marine_output.ident |
|
933 | + $filter_query = $this->getFilter($filters, true, true); |
|
934 | + $query = "SELECT DISTINCT marine_output.ident |
|
935 | 935 | FROM marine_output".$filter_query." marine_output.ident <> '' |
936 | 936 | ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0"; |
937 | 937 | |
@@ -941,7 +941,7 @@ discard block |
||
941 | 941 | $ident_array = array(); |
942 | 942 | $temp_array = array(); |
943 | 943 | |
944 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
944 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
945 | 945 | { |
946 | 946 | $temp_array['ident'] = $row['ident']; |
947 | 947 | $ident_array[] = $temp_array; |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | */ |
959 | 959 | public function getIdentity($mmsi) |
960 | 960 | { |
961 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
961 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
962 | 962 | $query = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1"; |
963 | 963 | $sth = $this->db->prepare($query); |
964 | 964 | $sth->execute(array(':mmsi' => $mmsi)); |
@@ -975,23 +975,23 @@ discard block |
||
975 | 975 | * @param $callsign |
976 | 976 | * @param $type |
977 | 977 | */ |
978 | - public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
|
978 | + public function addIdentity($mmsi, $imo, $ident, $callsign, $type) |
|
979 | 979 | { |
980 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
980 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
981 | 981 | if ($mmsi != '') { |
982 | - $imo = filter_var($imo,FILTER_SANITIZE_NUMBER_INT); |
|
983 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
984 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
985 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
982 | + $imo = filter_var($imo, FILTER_SANITIZE_NUMBER_INT); |
|
983 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
984 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
985 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
986 | 986 | $identinfo = $this->getIdentity($mmsi); |
987 | 987 | if (empty($identinfo)) { |
988 | - $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
988 | + $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
989 | 989 | $sth = $this->db->prepare($query); |
990 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':call_sign' => $callsign,':ship_name' => $ident,':type' => $type)); |
|
990 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':call_sign' => $callsign, ':ship_name' => $ident, ':type' => $type)); |
|
991 | 991 | } elseif ($ident != '' && $identinfo['ship_name'] != $ident) { |
992 | - $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
992 | + $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
993 | 993 | $sth = $this->db->prepare($query); |
994 | - $sth->execute(array(':mmsi' => $mmsi,':ship_name' => $ident,':type' => $type)); |
|
994 | + $sth->execute(array(':mmsi' => $mmsi, ':ship_name' => $ident, ':type' => $type)); |
|
995 | 995 | } |
996 | 996 | } |
997 | 997 | } |
@@ -1012,12 +1012,12 @@ discard block |
||
1012 | 1012 | } else $offset = '+00:00'; |
1013 | 1013 | |
1014 | 1014 | if ($globalDBdriver == 'mysql') { |
1015 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
1015 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
1016 | 1016 | FROM marine_output |
1017 | 1017 | WHERE marine_output.date <> '' |
1018 | 1018 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
1019 | 1019 | } else { |
1020 | - $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
1020 | + $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
1021 | 1021 | FROM marine_output |
1022 | 1022 | WHERE marine_output.date <> '' |
1023 | 1023 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
@@ -1029,7 +1029,7 @@ discard block |
||
1029 | 1029 | $date_array = array(); |
1030 | 1030 | $temp_array = array(); |
1031 | 1031 | |
1032 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1032 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1033 | 1033 | { |
1034 | 1034 | $temp_array['date'] = $row['date']; |
1035 | 1035 | |
@@ -1047,10 +1047,10 @@ discard block |
||
1047 | 1047 | * @return String success or false |
1048 | 1048 | * |
1049 | 1049 | */ |
1050 | - public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
|
1050 | + public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL) |
|
1051 | 1051 | { |
1052 | 1052 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
1053 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
1053 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident); |
|
1054 | 1054 | try { |
1055 | 1055 | $sth = $this->db->prepare($query); |
1056 | 1056 | $sth->execute($query_values); |
@@ -1068,10 +1068,10 @@ discard block |
||
1068 | 1068 | * @return String success or false |
1069 | 1069 | * |
1070 | 1070 | */ |
1071 | - public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
|
1071 | + public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '', $fromsource = NULL) |
|
1072 | 1072 | { |
1073 | 1073 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
1074 | - $query_values = array(':fammarine_id' => $fammarine_id,':arrival_code' => $arrival_code); |
|
1074 | + $query_values = array(':fammarine_id' => $fammarine_id, ':arrival_code' => $arrival_code); |
|
1075 | 1075 | try { |
1076 | 1076 | $sth = $this->db->prepare($query); |
1077 | 1077 | $sth->execute($query_values); |
@@ -1090,11 +1090,11 @@ discard block |
||
1090 | 1090 | * @return String success or false |
1091 | 1091 | * |
1092 | 1092 | */ |
1093 | - public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
|
1093 | + public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '') |
|
1094 | 1094 | { |
1095 | 1095 | |
1096 | 1096 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
1097 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
1097 | + $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id); |
|
1098 | 1098 | |
1099 | 1099 | try { |
1100 | 1100 | $sth = $this->db->prepare($query); |
@@ -1123,17 +1123,17 @@ discard block |
||
1123 | 1123 | * @param string $race_begin |
1124 | 1124 | * @return String success or false |
1125 | 1125 | */ |
1126 | - public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '',$distance = NULL,$race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
|
1126 | + public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '', $distance = NULL, $race_rank = NULL, $race_time = NULL, $status = '', $race_begin = '') |
|
1127 | 1127 | { |
1128 | 1128 | if ($latitude == '') $latitude = NULL; |
1129 | 1129 | if ($longitude == '') $longitude = NULL; |
1130 | 1130 | $groundspeed = round($groundspeed); |
1131 | 1131 | if ($race_begin != '') { |
1132 | 1132 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed, distance = :distance, race_rank = :race_rank, race_time = :race_time, status = :status, date = :race_begin WHERE fammarine_id = :fammarine_id'; |
1133 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time,':status' => $status,':race_begin' => $race_begin); |
|
1133 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident, ':distance' => $distance, ':race_rank' => $race_rank, ':race_time' => $race_time, ':status' => $status, ':race_begin' => $race_begin); |
|
1134 | 1134 | } else { |
1135 | 1135 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed, distance = :distance, race_rank = :race_rank, race_time = :race_time, status = :status WHERE fammarine_id = :fammarine_id'; |
1136 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time,':status' => $status); |
|
1136 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident, ':distance' => $distance, ':race_rank' => $race_rank, ':race_time' => $race_time, ':status' => $status); |
|
1137 | 1137 | } |
1138 | 1138 | try { |
1139 | 1139 | $sth = $this->db->prepare($query); |
@@ -1177,7 +1177,7 @@ discard block |
||
1177 | 1177 | * @param string $race_time |
1178 | 1178 | * @return String success or false |
1179 | 1179 | */ |
1180 | - public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '',$race_rank = '', $race_time = '') |
|
1180 | + public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $format_source = '', $source_name = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
1181 | 1181 | { |
1182 | 1182 | global $globalMarineImageFetch; |
1183 | 1183 | |
@@ -1249,34 +1249,34 @@ discard block |
||
1249 | 1249 | $date = date("Y-m-d H:i:s", time()); |
1250 | 1250 | } |
1251 | 1251 | |
1252 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
1253 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1254 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1255 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1256 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1257 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1258 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1259 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
1260 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
1261 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
1262 | - $type_id = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
1263 | - $status_id = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
1264 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
1265 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
1266 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
1267 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
1268 | - $captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING); |
|
1269 | - $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
|
1270 | - $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
|
1271 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
1272 | - $race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT); |
|
1273 | - $race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1274 | - $distance = filter_var($distance,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1252 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
1253 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1254 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1255 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1256 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1257 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1258 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1259 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
1260 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
1261 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
1262 | + $type_id = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
1263 | + $status_id = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
1264 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
1265 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
1266 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
1267 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
1268 | + $captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING); |
|
1269 | + $captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING); |
|
1270 | + $race_id = filter_var($race_id, FILTER_SANITIZE_STRING); |
|
1271 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
1272 | + $race_rank = filter_var($race_rank, FILTER_SANITIZE_NUMBER_INT); |
|
1273 | + $race_time = filter_var($race_time, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1274 | + $distance = filter_var($distance, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1275 | 1275 | if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) { |
1276 | 1276 | $Image = new Image($this->db); |
1277 | - $image_array = $Image->getMarineImage($mmsi,$imo,$ident); |
|
1277 | + $image_array = $Image->getMarineImage($mmsi, $imo, $ident); |
|
1278 | 1278 | if (!isset($image_array[0]['mmsi'])) { |
1279 | - $Image->addMarineImage($mmsi,$imo,$ident); |
|
1279 | + $Image->addMarineImage($mmsi, $imo, $ident); |
|
1280 | 1280 | } |
1281 | 1281 | unset($Image); |
1282 | 1282 | } |
@@ -1292,10 +1292,10 @@ discard block |
||
1292 | 1292 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
1293 | 1293 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
1294 | 1294 | if ($arrival_date == '') $arrival_date = NULL; |
1295 | - $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name, distance, race_rank,race_time) |
|
1295 | + $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name, distance, race_rank,race_time) |
|
1296 | 1296 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name, :distance, :race_rank,:race_time)"; |
1297 | 1297 | |
1298 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':type_id' => $type_id,':status' => $status,':status_id' => $status_id,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name,':distance' => $distance,':race_rank' => $race_rank,':race_time' => $race_time); |
|
1298 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':type_id' => $type_id, ':status' => $status, ':status_id' => $status_id, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name, ':distance' => $distance, ':race_rank' => $race_rank, ':race_time' => $race_time); |
|
1299 | 1299 | try { |
1300 | 1300 | $sth = $this->db->prepare($query); |
1301 | 1301 | $sth->execute($query_values); |
@@ -1319,13 +1319,13 @@ discard block |
||
1319 | 1319 | { |
1320 | 1320 | global $globalDBdriver, $globalTimezone; |
1321 | 1321 | if ($globalDBdriver == 'mysql') { |
1322 | - $query = "SELECT marine_output.ident FROM marine_output |
|
1322 | + $query = "SELECT marine_output.ident FROM marine_output |
|
1323 | 1323 | WHERE marine_output.ident = :ident |
1324 | 1324 | AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
1325 | 1325 | AND marine_output.date < UTC_TIMESTAMP()"; |
1326 | 1326 | $query_data = array(':ident' => $ident); |
1327 | 1327 | } else { |
1328 | - $query = "SELECT marine_output.ident FROM marine_output |
|
1328 | + $query = "SELECT marine_output.ident FROM marine_output |
|
1329 | 1329 | WHERE marine_output.ident = :ident |
1330 | 1330 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
1331 | 1331 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -1334,8 +1334,8 @@ discard block |
||
1334 | 1334 | |
1335 | 1335 | $sth = $this->db->prepare($query); |
1336 | 1336 | $sth->execute($query_data); |
1337 | - $ident_result=''; |
|
1338 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1337 | + $ident_result = ''; |
|
1338 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1339 | 1339 | { |
1340 | 1340 | $ident_result = $row['ident']; |
1341 | 1341 | } |
@@ -1361,8 +1361,8 @@ discard block |
||
1361 | 1361 | return false; |
1362 | 1362 | } else { |
1363 | 1363 | $q_array = explode(" ", $q); |
1364 | - foreach ($q_array as $q_item){ |
|
1365 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
1364 | + foreach ($q_array as $q_item) { |
|
1365 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
1366 | 1366 | $additional_query .= " AND ("; |
1367 | 1367 | $additional_query .= "(marine_output.ident like '%".$q_item."%')"; |
1368 | 1368 | $additional_query .= ")"; |
@@ -1370,11 +1370,11 @@ discard block |
||
1370 | 1370 | } |
1371 | 1371 | } |
1372 | 1372 | if ($globalDBdriver == 'mysql') { |
1373 | - $query = "SELECT marine_output.* FROM marine_output |
|
1373 | + $query = "SELECT marine_output.* FROM marine_output |
|
1374 | 1374 | WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
1375 | 1375 | AND marine_output.date < UTC_TIMESTAMP()"; |
1376 | 1376 | } else { |
1377 | - $query = "SELECT marine_output.* FROM marine_output |
|
1377 | + $query = "SELECT marine_output.* FROM marine_output |
|
1378 | 1378 | WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
1379 | 1379 | AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
1380 | 1380 | } |
@@ -1394,16 +1394,16 @@ discard block |
||
1394 | 1394 | * @return array the airline country list |
1395 | 1395 | */ |
1396 | 1396 | |
1397 | - public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
1397 | + public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
1398 | 1398 | { |
1399 | 1399 | global $globalDBdriver, $globalArchive; |
1400 | 1400 | //$filter_query = $this->getFilter($filters,true,true); |
1401 | - $Connection= new Connection($this->db); |
|
1401 | + $Connection = new Connection($this->db); |
|
1402 | 1402 | if (!$Connection->tableExists('countries')) return array(); |
1403 | 1403 | require_once('class.SpotterLive.php'); |
1404 | 1404 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
1405 | 1405 | $MarineLive = new MarineLive($this->db); |
1406 | - $filter_query = $MarineLive->getFilter($filters,true,true); |
|
1406 | + $filter_query = $MarineLive->getFilter($filters, true, true); |
|
1407 | 1407 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
1408 | 1408 | if ($olderthanmonths > 0) { |
1409 | 1409 | if ($globalDBdriver == 'mysql') { |
@@ -1423,7 +1423,7 @@ discard block |
||
1423 | 1423 | } else { |
1424 | 1424 | require_once(dirname(__FILE__)."/class.MarineArchive.php"); |
1425 | 1425 | $MarineArchive = new MarineArchive($this->db); |
1426 | - $filter_query = $MarineArchive->getFilter($filters,true,true); |
|
1426 | + $filter_query = $MarineArchive->getFilter($filters, true, true); |
|
1427 | 1427 | $filter_query .= " over_country <> ''"; |
1428 | 1428 | if ($olderthanmonths > 0) { |
1429 | 1429 | if ($globalDBdriver == 'mysql') { |
@@ -1451,7 +1451,7 @@ discard block |
||
1451 | 1451 | $flight_array = array(); |
1452 | 1452 | $temp_array = array(); |
1453 | 1453 | |
1454 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1454 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1455 | 1455 | { |
1456 | 1456 | $temp_array['marine_count'] = $row['nb']; |
1457 | 1457 | $temp_array['marine_country'] = $row['name']; |
@@ -1475,11 +1475,11 @@ discard block |
||
1475 | 1475 | * @param string $day |
1476 | 1476 | * @return array the callsign list |
1477 | 1477 | */ |
1478 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
1478 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1479 | 1479 | { |
1480 | 1480 | global $globalDBdriver; |
1481 | - $filter_query = $this->getFilter($filters,true,true); |
|
1482 | - $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
1481 | + $filter_query = $this->getFilter($filters, true, true); |
|
1482 | + $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
1483 | 1483 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
1484 | 1484 | if ($olderthanmonths > 0) { |
1485 | 1485 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -1493,28 +1493,28 @@ discard block |
||
1493 | 1493 | if ($year != '') { |
1494 | 1494 | if ($globalDBdriver == 'mysql') { |
1495 | 1495 | $query .= " AND YEAR(marine_output.date) = :year"; |
1496 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1496 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1497 | 1497 | } else { |
1498 | 1498 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1499 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1499 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1500 | 1500 | } |
1501 | 1501 | } |
1502 | 1502 | if ($month != '') { |
1503 | 1503 | if ($globalDBdriver == 'mysql') { |
1504 | 1504 | $query .= " AND MONTH(marine_output.date) = :month"; |
1505 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1505 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1506 | 1506 | } else { |
1507 | 1507 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1508 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1508 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1509 | 1509 | } |
1510 | 1510 | } |
1511 | 1511 | if ($day != '') { |
1512 | 1512 | if ($globalDBdriver == 'mysql') { |
1513 | 1513 | $query .= " AND DAY(marine_output.date) = :day"; |
1514 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1514 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1515 | 1515 | } else { |
1516 | 1516 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
1517 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1517 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1518 | 1518 | } |
1519 | 1519 | } |
1520 | 1520 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -1526,7 +1526,7 @@ discard block |
||
1526 | 1526 | $callsign_array = array(); |
1527 | 1527 | $temp_array = array(); |
1528 | 1528 | |
1529 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1529 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1530 | 1530 | { |
1531 | 1531 | $temp_array['callsign_icao'] = $row['ident']; |
1532 | 1532 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -1578,7 +1578,7 @@ discard block |
||
1578 | 1578 | $date_array = array(); |
1579 | 1579 | $temp_array = array(); |
1580 | 1580 | |
1581 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1581 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1582 | 1582 | { |
1583 | 1583 | $temp_array['date_name'] = $row['date_name']; |
1584 | 1584 | $temp_array['date_count'] = $row['date_count']; |
@@ -1604,7 +1604,7 @@ discard block |
||
1604 | 1604 | $datetime = new DateTime(); |
1605 | 1605 | $offset = $datetime->format('P'); |
1606 | 1606 | } else $offset = '+00:00'; |
1607 | - $filter_query = $this->getFilter($filters,true,true); |
|
1607 | + $filter_query = $this->getFilter($filters, true, true); |
|
1608 | 1608 | if ($globalDBdriver == 'mysql') { |
1609 | 1609 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1610 | 1610 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -1625,7 +1625,7 @@ discard block |
||
1625 | 1625 | $date_array = array(); |
1626 | 1626 | $temp_array = array(); |
1627 | 1627 | |
1628 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1628 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1629 | 1629 | { |
1630 | 1630 | $temp_array['date_name'] = $row['date_name']; |
1631 | 1631 | $temp_array['date_count'] = $row['date_count']; |
@@ -1650,7 +1650,7 @@ discard block |
||
1650 | 1650 | $datetime = new DateTime(); |
1651 | 1651 | $offset = $datetime->format('P'); |
1652 | 1652 | } else $offset = '+00:00'; |
1653 | - $filter_query = $this->getFilter($filters,true,true); |
|
1653 | + $filter_query = $this->getFilter($filters, true, true); |
|
1654 | 1654 | if ($globalDBdriver == 'mysql') { |
1655 | 1655 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1656 | 1656 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1671,7 +1671,7 @@ discard block |
||
1671 | 1671 | $date_array = array(); |
1672 | 1672 | $temp_array = array(); |
1673 | 1673 | |
1674 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1674 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1675 | 1675 | { |
1676 | 1676 | $temp_array['date_name'] = $row['date_name']; |
1677 | 1677 | $temp_array['date_count'] = $row['date_count']; |
@@ -1717,7 +1717,7 @@ discard block |
||
1717 | 1717 | $date_array = array(); |
1718 | 1718 | $temp_array = array(); |
1719 | 1719 | |
1720 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1720 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1721 | 1721 | { |
1722 | 1722 | $temp_array['month_name'] = $row['month_name']; |
1723 | 1723 | $temp_array['year_name'] = $row['year_name']; |
@@ -1744,7 +1744,7 @@ discard block |
||
1744 | 1744 | $datetime = new DateTime(); |
1745 | 1745 | $offset = $datetime->format('P'); |
1746 | 1746 | } else $offset = '+00:00'; |
1747 | - $filter_query = $this->getFilter($filters,true,true); |
|
1747 | + $filter_query = $this->getFilter($filters, true, true); |
|
1748 | 1748 | if ($globalDBdriver == 'mysql') { |
1749 | 1749 | $query = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
1750 | 1750 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1765,7 +1765,7 @@ discard block |
||
1765 | 1765 | $date_array = array(); |
1766 | 1766 | $temp_array = array(); |
1767 | 1767 | |
1768 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1768 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1769 | 1769 | { |
1770 | 1770 | $temp_array['year_name'] = $row['year_name']; |
1771 | 1771 | $temp_array['month_name'] = $row['month_name']; |
@@ -1785,7 +1785,7 @@ discard block |
||
1785 | 1785 | * @param array $filters |
1786 | 1786 | * @return array the hour list |
1787 | 1787 | */ |
1788 | - public function countAllHours($orderby,$filters = array()) |
|
1788 | + public function countAllHours($orderby, $filters = array()) |
|
1789 | 1789 | { |
1790 | 1790 | global $globalTimezone, $globalDBdriver; |
1791 | 1791 | if ($globalTimezone != '') { |
@@ -1833,7 +1833,7 @@ discard block |
||
1833 | 1833 | $hour_array = array(); |
1834 | 1834 | $temp_array = array(); |
1835 | 1835 | |
1836 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1836 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1837 | 1837 | { |
1838 | 1838 | $temp_array['hour_name'] = $row['hour_name']; |
1839 | 1839 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1855,8 +1855,8 @@ discard block |
||
1855 | 1855 | public function countAllHoursByDate($date, $filters = array()) |
1856 | 1856 | { |
1857 | 1857 | global $globalTimezone, $globalDBdriver; |
1858 | - $filter_query = $this->getFilter($filters,true,true); |
|
1859 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1858 | + $filter_query = $this->getFilter($filters, true, true); |
|
1859 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1860 | 1860 | if ($globalTimezone != '') { |
1861 | 1861 | date_default_timezone_set($globalTimezone); |
1862 | 1862 | $datetime = new DateTime($date); |
@@ -1864,12 +1864,12 @@ discard block |
||
1864 | 1864 | } else $offset = '+00:00'; |
1865 | 1865 | |
1866 | 1866 | if ($globalDBdriver == 'mysql') { |
1867 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1867 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1868 | 1868 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date |
1869 | 1869 | GROUP BY hour_name |
1870 | 1870 | ORDER BY hour_name ASC"; |
1871 | 1871 | } else { |
1872 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1872 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1873 | 1873 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1874 | 1874 | GROUP BY hour_name |
1875 | 1875 | ORDER BY hour_name ASC"; |
@@ -1881,7 +1881,7 @@ discard block |
||
1881 | 1881 | $hour_array = array(); |
1882 | 1882 | $temp_array = array(); |
1883 | 1883 | |
1884 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1884 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1885 | 1885 | { |
1886 | 1886 | $temp_array['hour_name'] = $row['hour_name']; |
1887 | 1887 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1903,8 +1903,8 @@ discard block |
||
1903 | 1903 | public function countAllHoursByIdent($ident, $filters = array()) |
1904 | 1904 | { |
1905 | 1905 | global $globalTimezone, $globalDBdriver; |
1906 | - $filter_query = $this->getFilter($filters,true,true); |
|
1907 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1906 | + $filter_query = $this->getFilter($filters, true, true); |
|
1907 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1908 | 1908 | if ($globalTimezone != '') { |
1909 | 1909 | date_default_timezone_set($globalTimezone); |
1910 | 1910 | $datetime = new DateTime(); |
@@ -1912,12 +1912,12 @@ discard block |
||
1912 | 1912 | } else $offset = '+00:00'; |
1913 | 1913 | |
1914 | 1914 | if ($globalDBdriver == 'mysql') { |
1915 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1915 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1916 | 1916 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1917 | 1917 | GROUP BY hour_name |
1918 | 1918 | ORDER BY hour_name ASC"; |
1919 | 1919 | } else { |
1920 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1920 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1921 | 1921 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1922 | 1922 | GROUP BY hour_name |
1923 | 1923 | ORDER BY hour_name ASC"; |
@@ -1925,12 +1925,12 @@ discard block |
||
1925 | 1925 | |
1926 | 1926 | |
1927 | 1927 | $sth = $this->db->prepare($query); |
1928 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1928 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1929 | 1929 | |
1930 | 1930 | $hour_array = array(); |
1931 | 1931 | $temp_array = array(); |
1932 | 1932 | |
1933 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1933 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1934 | 1934 | { |
1935 | 1935 | $temp_array['hour_name'] = $row['hour_name']; |
1936 | 1936 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1950,11 +1950,11 @@ discard block |
||
1950 | 1950 | * @param array $filters |
1951 | 1951 | * @return array the aircraft list |
1952 | 1952 | */ |
1953 | - public function countAllCaptainsByRaces($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
1953 | + public function countAllCaptainsByRaces($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
1954 | 1954 | { |
1955 | 1955 | global $globalDBdriver; |
1956 | - $filter_query = $this->getFilter($filters,true,true); |
|
1957 | - $query = "SELECT DISTINCT marine_output.race_id, marine_output.race_name, COUNT(marine_output.captain_id) AS captain_count |
|
1956 | + $filter_query = $this->getFilter($filters, true, true); |
|
1957 | + $query = "SELECT DISTINCT marine_output.race_id, marine_output.race_name, COUNT(marine_output.captain_id) AS captain_count |
|
1958 | 1958 | FROM marine_output".$filter_query." race_id IS NOT NULL"; |
1959 | 1959 | if ($olderthanmonths > 0) { |
1960 | 1960 | if ($globalDBdriver == 'mysql') { |
@@ -1977,7 +1977,7 @@ discard block |
||
1977 | 1977 | $marine_array = array(); |
1978 | 1978 | $temp_array = array(); |
1979 | 1979 | |
1980 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1980 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1981 | 1981 | { |
1982 | 1982 | $temp_array['marine_race_id'] = $row['race_id']; |
1983 | 1983 | $temp_array['marine_race_name'] = $row['race_name']; |
@@ -1995,33 +1995,33 @@ discard block |
||
1995 | 1995 | * @param string $month |
1996 | 1996 | * @return Integer the number of vessels |
1997 | 1997 | */ |
1998 | - public function countOverallMarine($filters = array(),$year = '',$month = '') |
|
1998 | + public function countOverallMarine($filters = array(), $year = '', $month = '') |
|
1999 | 1999 | { |
2000 | 2000 | global $globalDBdriver; |
2001 | 2001 | //$queryi = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output"; |
2002 | - $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
2002 | + $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
2003 | 2003 | $query_values = array(); |
2004 | 2004 | $query = ''; |
2005 | 2005 | if ($year != '') { |
2006 | 2006 | if ($globalDBdriver == 'mysql') { |
2007 | 2007 | $query .= " AND YEAR(marine_output.date) = :year"; |
2008 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2008 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2009 | 2009 | } else { |
2010 | 2010 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
2011 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2011 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2012 | 2012 | } |
2013 | 2013 | } |
2014 | 2014 | if ($month != '') { |
2015 | 2015 | if ($globalDBdriver == 'mysql') { |
2016 | 2016 | $query .= " AND MONTH(marine_output.date) = :month"; |
2017 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2017 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2018 | 2018 | } else { |
2019 | 2019 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
2020 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2020 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2021 | 2021 | } |
2022 | 2022 | } |
2023 | 2023 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
2024 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2024 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
2025 | 2025 | |
2026 | 2026 | $sth = $this->db->prepare($queryi); |
2027 | 2027 | $sth->execute($query_values); |
@@ -2036,32 +2036,32 @@ discard block |
||
2036 | 2036 | * @param string $month |
2037 | 2037 | * @return Integer the number of vessels |
2038 | 2038 | */ |
2039 | - public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
|
2039 | + public function countOverallMarineTypes($filters = array(), $year = '', $month = '') |
|
2040 | 2040 | { |
2041 | 2041 | global $globalDBdriver; |
2042 | - $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
2042 | + $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
2043 | 2043 | $query_values = array(); |
2044 | 2044 | $query = ''; |
2045 | 2045 | if ($year != '') { |
2046 | 2046 | if ($globalDBdriver == 'mysql') { |
2047 | 2047 | $query .= " AND YEAR(marine_output.date) = :year"; |
2048 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2048 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2049 | 2049 | } else { |
2050 | 2050 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
2051 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2051 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2052 | 2052 | } |
2053 | 2053 | } |
2054 | 2054 | if ($month != '') { |
2055 | 2055 | if ($globalDBdriver == 'mysql') { |
2056 | 2056 | $query .= " AND MONTH(marine_output.date) = :month"; |
2057 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2057 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2058 | 2058 | } else { |
2059 | 2059 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
2060 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2060 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2061 | 2061 | } |
2062 | 2062 | } |
2063 | 2063 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
2064 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2064 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
2065 | 2065 | |
2066 | 2066 | $sth = $this->db->prepare($queryi); |
2067 | 2067 | $sth->execute($query_values); |
@@ -2076,32 +2076,32 @@ discard block |
||
2076 | 2076 | * @param string $month |
2077 | 2077 | * @return Integer number of races |
2078 | 2078 | */ |
2079 | - public function countOverallMarineRaces($filters = array(),$year = '',$month = '') |
|
2079 | + public function countOverallMarineRaces($filters = array(), $year = '', $month = '') |
|
2080 | 2080 | { |
2081 | 2081 | global $globalDBdriver; |
2082 | - $queryi = "SELECT COUNT(DISTINCT marine_output.race_id) AS marine_count FROM marine_output"; |
|
2082 | + $queryi = "SELECT COUNT(DISTINCT marine_output.race_id) AS marine_count FROM marine_output"; |
|
2083 | 2083 | $query_values = array(); |
2084 | 2084 | $query = ''; |
2085 | 2085 | if ($year != '') { |
2086 | 2086 | if ($globalDBdriver == 'mysql') { |
2087 | 2087 | $query .= " AND YEAR(marine_output.date) = :year"; |
2088 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2088 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2089 | 2089 | } else { |
2090 | 2090 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
2091 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2091 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2092 | 2092 | } |
2093 | 2093 | } |
2094 | 2094 | if ($month != '') { |
2095 | 2095 | if ($globalDBdriver == 'mysql') { |
2096 | 2096 | $query .= " AND MONTH(marine_output.date) = :month"; |
2097 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2097 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2098 | 2098 | } else { |
2099 | 2099 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
2100 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2100 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2101 | 2101 | } |
2102 | 2102 | } |
2103 | 2103 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
2104 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2104 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
2105 | 2105 | |
2106 | 2106 | $sth = $this->db->prepare($queryi); |
2107 | 2107 | $sth->execute($query_values); |
@@ -2116,32 +2116,32 @@ discard block |
||
2116 | 2116 | * @param string $month |
2117 | 2117 | * @return Integer number of captain |
2118 | 2118 | */ |
2119 | - public function countOverallMarineCaptains($filters = array(),$year = '',$month = '') |
|
2119 | + public function countOverallMarineCaptains($filters = array(), $year = '', $month = '') |
|
2120 | 2120 | { |
2121 | 2121 | global $globalDBdriver; |
2122 | - $queryi = "SELECT COUNT(DISTINCT marine_output.captain_id) AS marine_count FROM marine_output"; |
|
2122 | + $queryi = "SELECT COUNT(DISTINCT marine_output.captain_id) AS marine_count FROM marine_output"; |
|
2123 | 2123 | $query_values = array(); |
2124 | 2124 | $query = ''; |
2125 | 2125 | if ($year != '') { |
2126 | 2126 | if ($globalDBdriver == 'mysql') { |
2127 | 2127 | $query .= " AND YEAR(marine_output.date) = :year"; |
2128 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2128 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2129 | 2129 | } else { |
2130 | 2130 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
2131 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2131 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2132 | 2132 | } |
2133 | 2133 | } |
2134 | 2134 | if ($month != '') { |
2135 | 2135 | if ($globalDBdriver == 'mysql') { |
2136 | 2136 | $query .= " AND MONTH(marine_output.date) = :month"; |
2137 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2137 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2138 | 2138 | } else { |
2139 | 2139 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
2140 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2140 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2141 | 2141 | } |
2142 | 2142 | } |
2143 | 2143 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
2144 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
2144 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
2145 | 2145 | |
2146 | 2146 | $sth = $this->db->prepare($queryi); |
2147 | 2147 | $sth->execute($query_values); |
@@ -2157,7 +2157,7 @@ discard block |
||
2157 | 2157 | public function countAllHoursFromToday($filters = array()) |
2158 | 2158 | { |
2159 | 2159 | global $globalTimezone, $globalDBdriver; |
2160 | - $filter_query = $this->getFilter($filters,true,true); |
|
2160 | + $filter_query = $this->getFilter($filters, true, true); |
|
2161 | 2161 | if ($globalTimezone != '') { |
2162 | 2162 | date_default_timezone_set($globalTimezone); |
2163 | 2163 | $datetime = new DateTime(); |
@@ -2165,12 +2165,12 @@ discard block |
||
2165 | 2165 | } else $offset = '+00:00'; |
2166 | 2166 | |
2167 | 2167 | if ($globalDBdriver == 'mysql') { |
2168 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
2168 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
2169 | 2169 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE() |
2170 | 2170 | GROUP BY hour_name |
2171 | 2171 | ORDER BY hour_name ASC"; |
2172 | 2172 | } else { |
2173 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
2173 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
2174 | 2174 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
2175 | 2175 | GROUP BY hour_name |
2176 | 2176 | ORDER BY hour_name ASC"; |
@@ -2182,7 +2182,7 @@ discard block |
||
2182 | 2182 | $hour_array = array(); |
2183 | 2183 | $temp_array = array(); |
2184 | 2184 | |
2185 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2185 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2186 | 2186 | { |
2187 | 2187 | $temp_array['hour_name'] = $row['hour_name']; |
2188 | 2188 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -2201,9 +2201,9 @@ discard block |
||
2201 | 2201 | */ |
2202 | 2202 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
2203 | 2203 | { |
2204 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
2204 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
2205 | 2205 | |
2206 | - $query = "SELECT marine_output.marine_id |
|
2206 | + $query = "SELECT marine_output.marine_id |
|
2207 | 2207 | FROM marine_output |
2208 | 2208 | WHERE marine_output.fammarine_id = '".$fammarine_id."'"; |
2209 | 2209 | |
@@ -2211,7 +2211,7 @@ discard block |
||
2211 | 2211 | $sth = $this->db->prepare($query); |
2212 | 2212 | $sth->execute(); |
2213 | 2213 | |
2214 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2214 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2215 | 2215 | { |
2216 | 2216 | return $row['marine_id']; |
2217 | 2217 | } |
@@ -2236,23 +2236,23 @@ discard block |
||
2236 | 2236 | } |
2237 | 2237 | |
2238 | 2238 | $current_date = date("Y-m-d H:i:s"); |
2239 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
2239 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
2240 | 2240 | |
2241 | 2241 | $diff = abs(strtotime($current_date) - strtotime($date)); |
2242 | 2242 | |
2243 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
2243 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
2244 | 2244 | $years = $time_array['years']; |
2245 | 2245 | |
2246 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
2246 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
2247 | 2247 | $months = $time_array['months']; |
2248 | 2248 | |
2249 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
2249 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
2250 | 2250 | $days = $time_array['days']; |
2251 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
2251 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
2252 | 2252 | $hours = $time_array['hours']; |
2253 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
2253 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
2254 | 2254 | $minutes = $time_array['minutes']; |
2255 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
2255 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
2256 | 2256 | |
2257 | 2257 | return $time_array; |
2258 | 2258 | } |
@@ -2275,63 +2275,63 @@ discard block |
||
2275 | 2275 | $temp_array['direction_degree'] = $direction; |
2276 | 2276 | $temp_array['direction_shortname'] = "N"; |
2277 | 2277 | $temp_array['direction_fullname'] = "North"; |
2278 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
2278 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
2279 | 2279 | $temp_array['direction_degree'] = $direction; |
2280 | 2280 | $temp_array['direction_shortname'] = "NNE"; |
2281 | 2281 | $temp_array['direction_fullname'] = "North-Northeast"; |
2282 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
2282 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
2283 | 2283 | $temp_array['direction_degree'] = $direction; |
2284 | 2284 | $temp_array['direction_shortname'] = "NE"; |
2285 | 2285 | $temp_array['direction_fullname'] = "Northeast"; |
2286 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
2286 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
2287 | 2287 | $temp_array['direction_degree'] = $direction; |
2288 | 2288 | $temp_array['direction_shortname'] = "ENE"; |
2289 | 2289 | $temp_array['direction_fullname'] = "East-Northeast"; |
2290 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
2290 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
2291 | 2291 | $temp_array['direction_degree'] = $direction; |
2292 | 2292 | $temp_array['direction_shortname'] = "E"; |
2293 | 2293 | $temp_array['direction_fullname'] = "East"; |
2294 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
2294 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
2295 | 2295 | $temp_array['direction_degree'] = $direction; |
2296 | 2296 | $temp_array['direction_shortname'] = "ESE"; |
2297 | 2297 | $temp_array['direction_fullname'] = "East-Southeast"; |
2298 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
2298 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
2299 | 2299 | $temp_array['direction_degree'] = $direction; |
2300 | 2300 | $temp_array['direction_shortname'] = "SE"; |
2301 | 2301 | $temp_array['direction_fullname'] = "Southeast"; |
2302 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
2302 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
2303 | 2303 | $temp_array['direction_degree'] = $direction; |
2304 | 2304 | $temp_array['direction_shortname'] = "SSE"; |
2305 | 2305 | $temp_array['direction_fullname'] = "South-Southeast"; |
2306 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
2306 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
2307 | 2307 | $temp_array['direction_degree'] = $direction; |
2308 | 2308 | $temp_array['direction_shortname'] = "S"; |
2309 | 2309 | $temp_array['direction_fullname'] = "South"; |
2310 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
2310 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
2311 | 2311 | $temp_array['direction_degree'] = $direction; |
2312 | 2312 | $temp_array['direction_shortname'] = "SSW"; |
2313 | 2313 | $temp_array['direction_fullname'] = "South-Southwest"; |
2314 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
2314 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
2315 | 2315 | $temp_array['direction_degree'] = $direction; |
2316 | 2316 | $temp_array['direction_shortname'] = "SW"; |
2317 | 2317 | $temp_array['direction_fullname'] = "Southwest"; |
2318 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
2318 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
2319 | 2319 | $temp_array['direction_degree'] = $direction; |
2320 | 2320 | $temp_array['direction_shortname'] = "WSW"; |
2321 | 2321 | $temp_array['direction_fullname'] = "West-Southwest"; |
2322 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
2322 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
2323 | 2323 | $temp_array['direction_degree'] = $direction; |
2324 | 2324 | $temp_array['direction_shortname'] = "W"; |
2325 | 2325 | $temp_array['direction_fullname'] = "West"; |
2326 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
2326 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
2327 | 2327 | $temp_array['direction_degree'] = $direction; |
2328 | 2328 | $temp_array['direction_shortname'] = "WNW"; |
2329 | 2329 | $temp_array['direction_fullname'] = "West-Northwest"; |
2330 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
2330 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
2331 | 2331 | $temp_array['direction_degree'] = $direction; |
2332 | 2332 | $temp_array['direction_shortname'] = "NW"; |
2333 | 2333 | $temp_array['direction_fullname'] = "Northwest"; |
2334 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
2334 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
2335 | 2335 | $temp_array['direction_degree'] = $direction; |
2336 | 2336 | $temp_array['direction_shortname'] = "NNW"; |
2337 | 2337 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -2348,11 +2348,11 @@ discard block |
||
2348 | 2348 | * @param Float $longitude longitute of the flight |
2349 | 2349 | * @return String the countries |
2350 | 2350 | */ |
2351 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
2351 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
2352 | 2352 | { |
2353 | 2353 | global $globalDebug; |
2354 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
2355 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
2354 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
2355 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
2356 | 2356 | |
2357 | 2357 | $Connection = new Connection($this->db); |
2358 | 2358 | if (!$Connection->tableExists('countries')) return ''; |
@@ -2392,7 +2392,7 @@ discard block |
||
2392 | 2392 | public function getCountryFromISO2($iso2) |
2393 | 2393 | { |
2394 | 2394 | global $globalDebug; |
2395 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
2395 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
2396 | 2396 | |
2397 | 2397 | $Connection = new Connection($this->db); |
2398 | 2398 | if (!$Connection->tableExists('countries')) return ''; |
@@ -2440,7 +2440,7 @@ discard block |
||
2440 | 2440 | |
2441 | 2441 | $bitly_data = json_decode($bitly_data); |
2442 | 2442 | $bitly_url = ''; |
2443 | - if ($bitly_data->status_txt = "OK"){ |
|
2443 | + if ($bitly_data->status_txt = "OK") { |
|
2444 | 2444 | $bitly_url = $bitly_data->data->url; |
2445 | 2445 | } |
2446 | 2446 | |
@@ -2460,11 +2460,11 @@ discard block |
||
2460 | 2460 | * @param string $day |
2461 | 2461 | * @return array the vessel type list |
2462 | 2462 | */ |
2463 | - public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
2463 | + public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
2464 | 2464 | { |
2465 | 2465 | global $globalDBdriver; |
2466 | - $filter_query = $this->getFilter($filters,true,true); |
|
2467 | - $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id |
|
2466 | + $filter_query = $this->getFilter($filters, true, true); |
|
2467 | + $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id |
|
2468 | 2468 | FROM marine_output ".$filter_query." marine_output.type <> '' AND marine_output.type_id IS NOT NULL"; |
2469 | 2469 | if ($olderthanmonths > 0) { |
2470 | 2470 | if ($globalDBdriver == 'mysql') { |
@@ -2484,28 +2484,28 @@ discard block |
||
2484 | 2484 | if ($year != '') { |
2485 | 2485 | if ($globalDBdriver == 'mysql') { |
2486 | 2486 | $query .= " AND YEAR(marine_output.date) = :year"; |
2487 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2487 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2488 | 2488 | } else { |
2489 | 2489 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
2490 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
2490 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
2491 | 2491 | } |
2492 | 2492 | } |
2493 | 2493 | if ($month != '') { |
2494 | 2494 | if ($globalDBdriver == 'mysql') { |
2495 | 2495 | $query .= " AND MONTH(marine_output.date) = :month"; |
2496 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2496 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2497 | 2497 | } else { |
2498 | 2498 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
2499 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
2499 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
2500 | 2500 | } |
2501 | 2501 | } |
2502 | 2502 | if ($day != '') { |
2503 | 2503 | if ($globalDBdriver == 'mysql') { |
2504 | 2504 | $query .= " AND DAY(marine_output.date) = :day"; |
2505 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
2505 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
2506 | 2506 | } else { |
2507 | 2507 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
2508 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
2508 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
2509 | 2509 | } |
2510 | 2510 | } |
2511 | 2511 | $query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC"; |
@@ -2514,9 +2514,9 @@ discard block |
||
2514 | 2514 | $sth->execute($query_values); |
2515 | 2515 | $marine_array = array(); |
2516 | 2516 | $temp_array = array(); |
2517 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2517 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2518 | 2518 | { |
2519 | - $temp_array['marine_type'] = html_entity_decode($row['marine_type'],ENT_QUOTES); |
|
2519 | + $temp_array['marine_type'] = html_entity_decode($row['marine_type'], ENT_QUOTES); |
|
2520 | 2520 | $temp_array['marine_type_id'] = $row['marine_type_id']; |
2521 | 2521 | $temp_array['marine_type_count'] = $row['marine_type_count']; |
2522 | 2522 | $marine_array[] = $temp_array; |
@@ -2545,13 +2545,13 @@ discard block |
||
2545 | 2545 | * @param array $filters |
2546 | 2546 | * @return array the tracker information |
2547 | 2547 | */ |
2548 | - public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$captain_id = '',$captain_name = '',$race_id = '',$race_name = '',$filters = array()) |
|
2548 | + public function searchMarineData($q = '', $callsign = '', $mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '', $filters = array()) |
|
2549 | 2549 | { |
2550 | 2550 | global $globalTimezone, $globalDBdriver; |
2551 | 2551 | date_default_timezone_set('UTC'); |
2552 | 2552 | $query_values = array(); |
2553 | 2553 | $additional_query = ''; |
2554 | - $filter_query = $this->getFilter($filters,true,true); |
|
2554 | + $filter_query = $this->getFilter($filters, true, true); |
|
2555 | 2555 | if ($q != "") |
2556 | 2556 | { |
2557 | 2557 | if (!is_string($q)) |
@@ -2559,8 +2559,8 @@ discard block |
||
2559 | 2559 | return array(); |
2560 | 2560 | } else { |
2561 | 2561 | $q_array = explode(" ", $q); |
2562 | - foreach ($q_array as $q_item){ |
|
2563 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
2562 | + foreach ($q_array as $q_item) { |
|
2563 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
2564 | 2564 | $additional_query .= " AND ("; |
2565 | 2565 | if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
2566 | 2566 | if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
@@ -2576,86 +2576,86 @@ discard block |
||
2576 | 2576 | } |
2577 | 2577 | if ($callsign != "") |
2578 | 2578 | { |
2579 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
2579 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
2580 | 2580 | if (!is_string($callsign)) |
2581 | 2581 | { |
2582 | 2582 | return array(); |
2583 | 2583 | } else { |
2584 | 2584 | $additional_query .= " AND marine_output.ident = :callsign"; |
2585 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
2585 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
2586 | 2586 | } |
2587 | 2587 | } |
2588 | 2588 | if ($mmsi != "") |
2589 | 2589 | { |
2590 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
2590 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
2591 | 2591 | if (!is_numeric($mmsi)) |
2592 | 2592 | { |
2593 | 2593 | return array(); |
2594 | 2594 | } else { |
2595 | 2595 | $additional_query .= " AND marine_output.mmsi = :mmsi"; |
2596 | - $query_values = array_merge($query_values,array(':mmsi' => $mmsi)); |
|
2596 | + $query_values = array_merge($query_values, array(':mmsi' => $mmsi)); |
|
2597 | 2597 | } |
2598 | 2598 | } |
2599 | 2599 | if ($imo != "") |
2600 | 2600 | { |
2601 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
2601 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
2602 | 2602 | if (!is_numeric($imo)) |
2603 | 2603 | { |
2604 | 2604 | return array(); |
2605 | 2605 | } else { |
2606 | 2606 | $additional_query .= " AND marine_output.imo = :imo"; |
2607 | - $query_values = array_merge($query_values,array(':imo' => $imo)); |
|
2607 | + $query_values = array_merge($query_values, array(':imo' => $imo)); |
|
2608 | 2608 | } |
2609 | 2609 | } |
2610 | 2610 | if ($captain_id != "") |
2611 | 2611 | { |
2612 | - $captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING); |
|
2612 | + $captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING); |
|
2613 | 2613 | if (!is_numeric($captain_id)) |
2614 | 2614 | { |
2615 | 2615 | return array(); |
2616 | 2616 | } else { |
2617 | 2617 | $additional_query .= " AND marine_output.captain_id = :captain_id"; |
2618 | - $query_values = array_merge($query_values,array(':captain_id' => $captain_id)); |
|
2618 | + $query_values = array_merge($query_values, array(':captain_id' => $captain_id)); |
|
2619 | 2619 | } |
2620 | 2620 | } |
2621 | 2621 | if ($race_id != "") |
2622 | 2622 | { |
2623 | - $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
|
2623 | + $race_id = filter_var($race_id, FILTER_SANITIZE_STRING); |
|
2624 | 2624 | if (!is_numeric($race_id)) |
2625 | 2625 | { |
2626 | 2626 | return array(); |
2627 | 2627 | } else { |
2628 | 2628 | $additional_query .= " AND marine_output.race_id = :race_id"; |
2629 | - $query_values = array_merge($query_values,array(':race_id' => $race_id)); |
|
2629 | + $query_values = array_merge($query_values, array(':race_id' => $race_id)); |
|
2630 | 2630 | } |
2631 | 2631 | } |
2632 | 2632 | if ($captain_name != "") |
2633 | 2633 | { |
2634 | - $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
|
2634 | + $captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING); |
|
2635 | 2635 | if (!is_string($captain_name)) |
2636 | 2636 | { |
2637 | 2637 | return array(); |
2638 | 2638 | } else { |
2639 | 2639 | $additional_query .= " AND marine_output.captain_name = :captain_name"; |
2640 | - $query_values = array_merge($query_values,array(':captain_name' => $captain_name)); |
|
2640 | + $query_values = array_merge($query_values, array(':captain_name' => $captain_name)); |
|
2641 | 2641 | } |
2642 | 2642 | } |
2643 | 2643 | if ($race_name != "") |
2644 | 2644 | { |
2645 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
2645 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
2646 | 2646 | if (!is_numeric($race_name)) |
2647 | 2647 | { |
2648 | 2648 | return array(); |
2649 | 2649 | } else { |
2650 | 2650 | $additional_query .= " AND marine_output.race_name = :race_name"; |
2651 | - $query_values = array_merge($query_values,array(':race_name' => $race_name)); |
|
2651 | + $query_values = array_merge($query_values, array(':race_name' => $race_name)); |
|
2652 | 2652 | } |
2653 | 2653 | } |
2654 | 2654 | if ($date_posted != "") |
2655 | 2655 | { |
2656 | 2656 | $date_array = explode(",", $date_posted); |
2657 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
2658 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
2657 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
2658 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
2659 | 2659 | if ($globalTimezone != '') { |
2660 | 2660 | date_default_timezone_set($globalTimezone); |
2661 | 2661 | $datetime = new DateTime(); |
@@ -2682,8 +2682,8 @@ discard block |
||
2682 | 2682 | if ($limit != "") |
2683 | 2683 | { |
2684 | 2684 | $limit_array = explode(",", $limit); |
2685 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
2686 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
2685 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
2686 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
2687 | 2687 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
2688 | 2688 | { |
2689 | 2689 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -2701,22 +2701,22 @@ discard block |
||
2701 | 2701 | } |
2702 | 2702 | } |
2703 | 2703 | if ($origLat != "" && $origLon != "" && $dist != "") { |
2704 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
2704 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
2705 | 2705 | if ($globalDBdriver == 'mysql') { |
2706 | - $query="SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
2706 | + $query = "SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
2707 | 2707 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND marine_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and marine_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
2708 | 2708 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
2709 | 2709 | } else { |
2710 | - $query="SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
2710 | + $query = "SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
2711 | 2711 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND CAST(marine_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(marine_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
2712 | 2712 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
2713 | 2713 | } |
2714 | 2714 | } else { |
2715 | - $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
2715 | + $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
2716 | 2716 | ".$additional_query." |
2717 | 2717 | ".$orderby_query; |
2718 | 2718 | } |
2719 | - $marine_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
2719 | + $marine_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
2720 | 2720 | return $marine_array; |
2721 | 2721 | } |
2722 | 2722 | |
@@ -2728,12 +2728,12 @@ discard block |
||
2728 | 2728 | */ |
2729 | 2729 | public function checkId($id) |
2730 | 2730 | { |
2731 | - $query = 'SELECT marine_output.ident, marine_output.fammarine_id FROM marine_output WHERE marine_output.fammarine_id = :id'; |
|
2731 | + $query = 'SELECT marine_output.ident, marine_output.fammarine_id FROM marine_output WHERE marine_output.fammarine_id = :id'; |
|
2732 | 2732 | $query_data = array(':id' => $id); |
2733 | 2733 | $sth = $this->db->prepare($query); |
2734 | 2734 | $sth->execute($query_data); |
2735 | - $ident_result=''; |
|
2736 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2735 | + $ident_result = ''; |
|
2736 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
2737 | 2737 | { |
2738 | 2738 | $ident_result = $row['fammarine_id']; |
2739 | 2739 | } |
@@ -2748,7 +2748,7 @@ discard block |
||
2748 | 2748 | */ |
2749 | 2749 | public function getRaceByName($race_name) |
2750 | 2750 | { |
2751 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
2751 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
2752 | 2752 | $query = "SELECT * FROM marine_race WHERE race_name = :race_name LIMIT 1"; |
2753 | 2753 | $sth = $this->db->prepare($query); |
2754 | 2754 | $sth->execute(array(':race_name' => $race_name)); |
@@ -2765,7 +2765,7 @@ discard block |
||
2765 | 2765 | */ |
2766 | 2766 | public function getRace($race_id) |
2767 | 2767 | { |
2768 | - $race_id = filter_var($race_id,FILTER_SANITIZE_NUMBER_INT); |
|
2768 | + $race_id = filter_var($race_id, FILTER_SANITIZE_NUMBER_INT); |
|
2769 | 2769 | $query = "SELECT * FROM marine_race WHERE race_id = :race_id LIMIT 1"; |
2770 | 2770 | $sth = $this->db->prepare($query); |
2771 | 2771 | $sth->execute(array(':race_id' => $race_id)); |
@@ -2783,24 +2783,24 @@ discard block |
||
2783 | 2783 | * @param $race_startdate |
2784 | 2784 | * @param $race_markers |
2785 | 2785 | */ |
2786 | - public function addRace($race_id,$race_name,$race_creator,$race_desc,$race_startdate,$race_markers) |
|
2786 | + public function addRace($race_id, $race_name, $race_creator, $race_desc, $race_startdate, $race_markers) |
|
2787 | 2787 | { |
2788 | - $race_id = filter_var($race_id,FILTER_SANITIZE_NUMBER_INT); |
|
2788 | + $race_id = filter_var($race_id, FILTER_SANITIZE_NUMBER_INT); |
|
2789 | 2789 | if ($race_id != '') { |
2790 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
2791 | - $race_creator = filter_var($race_creator,FILTER_SANITIZE_STRING); |
|
2792 | - $race_desc = filter_var($race_desc,FILTER_SANITIZE_STRING); |
|
2793 | - $race_startdate = filter_var($race_startdate,FILTER_SANITIZE_STRING); |
|
2790 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
2791 | + $race_creator = filter_var($race_creator, FILTER_SANITIZE_STRING); |
|
2792 | + $race_desc = filter_var($race_desc, FILTER_SANITIZE_STRING); |
|
2793 | + $race_startdate = filter_var($race_startdate, FILTER_SANITIZE_STRING); |
|
2794 | 2794 | //$race_markers = filter_var($race_markers,FILTER_SANITIZE_STRING); |
2795 | 2795 | $allrace = $this->getRace($race_id); |
2796 | 2796 | if (empty($allrace)) { |
2797 | 2797 | $query = "INSERT INTO marine_race (race_id,race_name,race_creator,race_desc,race_startdate,race_markers) VALUES (:race_id,:race_name,:race_creator,:race_desc,:race_startdate,:race_markers)"; |
2798 | 2798 | $sth = $this->db->prepare($query); |
2799 | - $sth->execute(array(':race_id' => $race_id,':race_name' => $race_name,':race_creator' => $race_creator,':race_desc' => $race_desc,':race_startdate' => $race_startdate,':race_markers' => $race_markers)); |
|
2799 | + $sth->execute(array(':race_id' => $race_id, ':race_name' => $race_name, ':race_creator' => $race_creator, ':race_desc' => $race_desc, ':race_startdate' => $race_startdate, ':race_markers' => $race_markers)); |
|
2800 | 2800 | } elseif ($race_id != '') { |
2801 | - $query = "UPDATE marine_race SET race_name = :race_name,race_desc = :race_desc,race_startdate = :race_startdate,race_markers = :race_markers WHERE race_id = :race_id"; |
|
2801 | + $query = "UPDATE marine_race SET race_name = :race_name,race_desc = :race_desc,race_startdate = :race_startdate,race_markers = :race_markers WHERE race_id = :race_id"; |
|
2802 | 2802 | $sth = $this->db->prepare($query); |
2803 | - $sth->execute(array(':race_id' => $race_id,':race_name' => $race_name,':race_desc' => $race_desc,':race_startdate' => $race_startdate,':race_markers' => $race_markers)); |
|
2803 | + $sth->execute(array(':race_id' => $race_id, ':race_name' => $race_name, ':race_desc' => $race_desc, ':race_startdate' => $race_startdate, ':race_markers' => $race_markers)); |
|
2804 | 2804 | } |
2805 | 2805 | } |
2806 | 2806 | } |
@@ -2809,7 +2809,7 @@ discard block |
||
2809 | 2809 | |
2810 | 2810 | public function getOrderBy() |
2811 | 2811 | { |
2812 | - $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure port - ASC", "sql" => "ORDER BY marine_output.departure_port_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
2812 | + $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure port - ASC", "sql" => "ORDER BY marine_output.departure_port_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
2813 | 2813 | return $orderby; |
2814 | 2814 | } |
2815 | 2815 |