@@ -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) { |
@@ -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) { |
@@ -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) { |
@@ -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) { |
@@ -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) { |
@@ -6,7 +6,9 @@ discard block |
||
6 | 6 | public function __construct($dbc = null) { |
7 | 7 | $Connection = new Connection($dbc); |
8 | 8 | $this->db = $Connection->db; |
9 | - if ($this->db === null) die('Error: No DB connection. (SpotterArchive)'); |
|
9 | + if ($this->db === null) { |
|
10 | + die('Error: No DB connection. (SpotterArchive)'); |
|
11 | + } |
|
10 | 12 | } |
11 | 13 | |
12 | 14 | /** |
@@ -29,7 +31,9 @@ discard block |
||
29 | 31 | if (isset($filter[0]['source'])) { |
30 | 32 | $filters = array_merge($filters,$filter); |
31 | 33 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
34 | + if (is_array($globalFilter)) { |
|
35 | + $filter = array_merge($filter,$globalFilter); |
|
36 | + } |
|
33 | 37 | $filter_query_join = ''; |
34 | 38 | $filter_query_where = ''; |
35 | 39 | foreach($filters as $flt) { |
@@ -121,8 +125,11 @@ discard block |
||
121 | 125 | } |
122 | 126 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
123 | 127 | } |
124 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
125 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
128 | + if ($filter_query_where == '' && $where) { |
|
129 | + $filter_query_where = ' WHERE'; |
|
130 | + } elseif ($filter_query_where != '' && $and) { |
|
131 | + $filter_query_where .= ' AND'; |
|
132 | + } |
|
126 | 133 | if ($filter_query_where != '') { |
127 | 134 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
128 | 135 | } |
@@ -136,10 +143,17 @@ discard block |
||
136 | 143 | if ($over_country == '') { |
137 | 144 | $Spotter = new Spotter($this->db); |
138 | 145 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
139 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
140 | - else $country = ''; |
|
141 | - } else $country = $over_country; |
|
142 | - if ($airline_type === NULL) $airline_type =''; |
|
146 | + if (!empty($data_country)) { |
|
147 | + $country = $data_country['iso2']; |
|
148 | + } else { |
|
149 | + $country = ''; |
|
150 | + } |
|
151 | + } else { |
|
152 | + $country = $over_country; |
|
153 | + } |
|
154 | + if ($airline_type === NULL) { |
|
155 | + $airline_type =''; |
|
156 | + } |
|
143 | 157 | |
144 | 158 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
145 | 159 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -678,7 +692,9 @@ discard block |
||
678 | 692 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
679 | 693 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
680 | 694 | $translate = $Translation->ident2icao($q_item); |
681 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
695 | + if ($translate != $q_item) { |
|
696 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
697 | + } |
|
682 | 698 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
683 | 699 | $additional_query .= ")"; |
684 | 700 | } |
@@ -858,7 +874,9 @@ discard block |
||
858 | 874 | date_default_timezone_set($globalTimezone); |
859 | 875 | $datetime = new DateTime(); |
860 | 876 | $offset = $datetime->format('P'); |
861 | - } else $offset = '+00:00'; |
|
877 | + } else { |
|
878 | + $offset = '+00:00'; |
|
879 | + } |
|
862 | 880 | if ($date_array[1] != "") { |
863 | 881 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
864 | 882 | $date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1])); |
@@ -1112,9 +1130,13 @@ discard block |
||
1112 | 1130 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1113 | 1131 | } |
1114 | 1132 | } |
1115 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1133 | + if ($sincedate != '') { |
|
1134 | + $query .= "AND date > '".$sincedate."' "; |
|
1135 | + } |
|
1116 | 1136 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1117 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1137 | + if ($limit) { |
|
1138 | + $query .= " LIMIT 0,10"; |
|
1139 | + } |
|
1118 | 1140 | |
1119 | 1141 | |
1120 | 1142 | $sth = $this->db->prepare($query); |
@@ -1158,9 +1180,13 @@ discard block |
||
1158 | 1180 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1159 | 1181 | } |
1160 | 1182 | } |
1161 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1183 | + if ($sincedate != '') { |
|
1184 | + $query .= "AND s.date > '".$sincedate."' "; |
|
1185 | + } |
|
1162 | 1186 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1163 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1187 | + if ($limit) { |
|
1188 | + $query .= " LIMIT 0,10"; |
|
1189 | + } |
|
1164 | 1190 | |
1165 | 1191 | |
1166 | 1192 | $sth = $this->db->prepare($query); |
@@ -1382,8 +1408,11 @@ discard block |
||
1382 | 1408 | if($row['registration'] != "") |
1383 | 1409 | { |
1384 | 1410 | $image_array = $Image->getSpotterImage($row['registration']); |
1385 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
1386 | - else $temp_array['image_thumbnail'] = ''; |
|
1411 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
1412 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
1413 | + } else { |
|
1414 | + $temp_array['image_thumbnail'] = ''; |
|
1415 | + } |
|
1387 | 1416 | } |
1388 | 1417 | $temp_array['registration_count'] = $row['registration_count']; |
1389 | 1418 | $aircraft_array[] = $temp_array; |
@@ -1442,7 +1471,9 @@ discard block |
||
1442 | 1471 | date_default_timezone_set($globalTimezone); |
1443 | 1472 | $datetime = new DateTime(); |
1444 | 1473 | $offset = $datetime->format('P'); |
1445 | - } else $offset = '+00:00'; |
|
1474 | + } else { |
|
1475 | + $offset = '+00:00'; |
|
1476 | + } |
|
1446 | 1477 | if ($globalDBdriver == 'mysql') { |
1447 | 1478 | $query = "SELECT HOUR(CONVERT_TZ(spotter_archive_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
1448 | 1479 | FROM spotter_archive_output".$filter_query." spotter_archive_output.owner_name = :owner |
@@ -18,7 +18,9 @@ discard block |
||
18 | 18 | public function __construct($dbc = null) { |
19 | 19 | $Connection = new Connection($dbc); |
20 | 20 | $this->db = $Connection->db; |
21 | - if ($this->db === null) die('Error: No DB connection. (ATC)'); |
|
21 | + if ($this->db === null) { |
|
22 | + die('Error: No DB connection. (ATC)'); |
|
23 | + } |
|
22 | 24 | } |
23 | 25 | |
24 | 26 | /** |
@@ -33,20 +35,27 @@ discard block |
||
33 | 35 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
34 | 36 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
35 | 37 | foreach($globalStatsFilters[$globalFilterName] as $source) { |
36 | - if (isset($source['source'])) $filter['source'][] = $source['source']; |
|
38 | + if (isset($source['source'])) { |
|
39 | + $filter['source'][] = $source['source']; |
|
40 | + } |
|
37 | 41 | } |
38 | 42 | } else { |
39 | 43 | $filter = $globalStatsFilters[$globalFilterName]; |
40 | 44 | } |
41 | 45 | } |
42 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
46 | + if (is_array($globalFilter)) { |
|
47 | + $filter = array_merge($filter,$globalFilter); |
|
48 | + } |
|
43 | 49 | $filter_query_join = ''; |
44 | 50 | $filter_query_where = ''; |
45 | 51 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | 52 | $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
47 | 53 | } |
48 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
49 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
54 | + if ($filter_query_where == '' && $where) { |
|
55 | + $filter_query_where = ' WHERE'; |
|
56 | + } elseif ($filter_query_where != '' && $and) { |
|
57 | + $filter_query_where .= ' AND'; |
|
58 | + } |
|
50 | 59 | $filter_query = $filter_query_join.$filter_query_where; |
51 | 60 | return $filter_query; |
52 | 61 | } |
@@ -133,7 +142,9 @@ discard block |
||
133 | 142 | $info = str_replace('^','<br />',$info); |
134 | 143 | $info = str_replace('&sect;','',$info); |
135 | 144 | $info = str_replace('"','',$info); |
136 | - if ($type == '') $type = NULL; |
|
145 | + if ($type == '') { |
|
146 | + $type = NULL; |
|
147 | + } |
|
137 | 148 | $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)"; |
138 | 149 | $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
139 | 150 | try { |
@@ -164,7 +175,9 @@ discard block |
||
164 | 175 | $info = str_replace('^','<br />',$info); |
165 | 176 | $info = str_replace('&sect;','',$info); |
166 | 177 | $info = str_replace('"','',$info); |
167 | - if ($type == '') $type = NULL; |
|
178 | + if ($type == '') { |
|
179 | + $type = NULL; |
|
180 | + } |
|
168 | 181 | $query = "UPDATE atc SET frequency = :frequency,latitude = :latitude,longitude = :longitude,atc_range = :range,info = :info,atc_lastseen = :date,type = :type,ivao_id = :ivao_id,ivao_name = :ivao_name WHERE ident = :ident AND format_source = :format_source AND source_name = :source_name"; |
169 | 182 | $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
170 | 183 | try { |
@@ -13,7 +13,9 @@ discard block |
||
13 | 13 | public function __construct($dbc = null) { |
14 | 14 | $Connection = new Connection($dbc); |
15 | 15 | $this->db = $Connection->db; |
16 | - if ($this->db === null) die('Error: No DB connection. (MarineArchive)'); |
|
16 | + if ($this->db === null) { |
|
17 | + die('Error: No DB connection. (MarineArchive)'); |
|
18 | + } |
|
17 | 19 | } |
18 | 20 | |
19 | 21 | /** |
@@ -36,7 +38,9 @@ discard block |
||
36 | 38 | if (isset($filter[0]['source'])) { |
37 | 39 | $filters = array_merge($filters,$filter); |
38 | 40 | } |
39 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
41 | + if (is_array($globalFilter)) { |
|
42 | + $filter = array_merge($filter,$globalFilter); |
|
43 | + } |
|
40 | 44 | $filter_query_join = ''; |
41 | 45 | $filter_query_where = ''; |
42 | 46 | foreach($filters as $flt) { |
@@ -82,8 +86,11 @@ discard block |
||
82 | 86 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
83 | 87 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
84 | 88 | } |
85 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
86 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
89 | + if ($filter_query_where == '' && $where) { |
|
90 | + $filter_query_where = ' WHERE'; |
|
91 | + } elseif ($filter_query_where != '' && $and) { |
|
92 | + $filter_query_where .= ' AND'; |
|
93 | + } |
|
87 | 94 | if ($filter_query_where != '') { |
88 | 95 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
89 | 96 | } |
@@ -129,9 +136,14 @@ discard block |
||
129 | 136 | if ($over_country == '') { |
130 | 137 | $Marine = new Marine($this->db); |
131 | 138 | $data_country = $Marine->getCountryFromLatitudeLongitude($latitude,$longitude); |
132 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
133 | - else $country = ''; |
|
134 | - } else $country = $over_country; |
|
139 | + if (!empty($data_country)) { |
|
140 | + $country = $data_country['iso2']; |
|
141 | + } else { |
|
142 | + $country = ''; |
|
143 | + } |
|
144 | + } else { |
|
145 | + $country = $over_country; |
|
146 | + } |
|
135 | 147 | |
136 | 148 | //$country = $over_country; |
137 | 149 | // Route is not added in marine_archive |
@@ -661,7 +673,9 @@ discard block |
||
661 | 673 | $additional_query .= "(marine_archive_output.pilot_name like '%".$q_item."%') OR "; |
662 | 674 | $additional_query .= "(marine_archive_output.ident like '%".$q_item."%') OR "; |
663 | 675 | $translate = $Translation->ident2icao($q_item); |
664 | - if ($translate != $q_item) $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR "; |
|
676 | + if ($translate != $q_item) { |
|
677 | + $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR "; |
|
678 | + } |
|
665 | 679 | $additional_query .= "(marine_archive_output.highlight like '%".$q_item."%')"; |
666 | 680 | $additional_query .= ")"; |
667 | 681 | } |
@@ -879,7 +893,9 @@ discard block |
||
879 | 893 | date_default_timezone_set($globalTimezone); |
880 | 894 | $datetime = new DateTime(); |
881 | 895 | $offset = $datetime->format('P'); |
882 | - } else $offset = '+00:00'; |
|
896 | + } else { |
|
897 | + $offset = '+00:00'; |
|
898 | + } |
|
883 | 899 | |
884 | 900 | |
885 | 901 | if ($date_array[1] != "") |
@@ -1165,9 +1181,13 @@ discard block |
||
1165 | 1181 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1166 | 1182 | } |
1167 | 1183 | } |
1168 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1184 | + if ($sincedate != '') { |
|
1185 | + $query .= "AND date > '".$sincedate."' "; |
|
1186 | + } |
|
1169 | 1187 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1170 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1188 | + if ($limit) { |
|
1189 | + $query .= " LIMIT 0,10"; |
|
1190 | + } |
|
1171 | 1191 | |
1172 | 1192 | |
1173 | 1193 | $sth = $this->db->prepare($query); |
@@ -1213,9 +1233,13 @@ discard block |
||
1213 | 1233 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1214 | 1234 | } |
1215 | 1235 | } |
1216 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1236 | + if ($sincedate != '') { |
|
1237 | + $query .= "AND s.date > '".$sincedate."' "; |
|
1238 | + } |
|
1217 | 1239 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1218 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1240 | + if ($limit) { |
|
1241 | + $query .= " LIMIT 0,10"; |
|
1242 | + } |
|
1219 | 1243 | |
1220 | 1244 | |
1221 | 1245 | $sth = $this->db->prepare($query); |
@@ -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 | /** |