@@ -7,7 +7,9 @@ discard block |
||
7 | 7 | public function __construct($dbc = null) { |
8 | 8 | $Connection = new Connection($dbc); |
9 | 9 | $this->db = $Connection->db; |
10 | - if ($this->db === null) die('Error: No DB connection. (Source)'); |
|
10 | + if ($this->db === null) { |
|
11 | + die('Error: No DB connection. (Source)'); |
|
12 | + } |
|
11 | 13 | } |
12 | 14 | |
13 | 15 | public function getAllLocationInfo() { |
@@ -72,7 +74,9 @@ discard block |
||
72 | 74 | $query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0"; |
73 | 75 | } |
74 | 76 | $query .= " ORDER BY last_seen DESC"; |
75 | - if ($limit) $query .= " LIMIT 400"; |
|
77 | + if ($limit) { |
|
78 | + $query .= " LIMIT 400"; |
|
79 | + } |
|
76 | 80 | $query_values = array(':type' => $type); |
77 | 81 | try { |
78 | 82 | $sth = $this->db->prepare($query); |
@@ -111,7 +115,9 @@ discard block |
||
111 | 115 | } |
112 | 116 | |
113 | 117 | public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') { |
114 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
118 | + if ($last_seen == '') { |
|
119 | + $last_seen = date('Y-m-d H:i:s'); |
|
120 | + } |
|
115 | 121 | $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
116 | 122 | $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
117 | 123 | try { |
@@ -123,7 +129,9 @@ discard block |
||
123 | 129 | } |
124 | 130 | |
125 | 131 | public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') { |
126 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
132 | + if ($last_seen == '') { |
|
133 | + $last_seen = date('Y-m-d H:i:s'); |
|
134 | + } |
|
127 | 135 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source"; |
128 | 136 | $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
129 | 137 | try { |
@@ -146,7 +154,9 @@ discard block |
||
146 | 154 | } |
147 | 155 | |
148 | 156 | public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') { |
149 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
157 | + if ($last_seen == '') { |
|
158 | + $last_seen = date('Y-m-d H:i:s'); |
|
159 | + } |
|
150 | 160 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id"; |
151 | 161 | $query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
152 | 162 | try { |
@@ -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 | /** |
@@ -27,7 +29,9 @@ discard block |
||
27 | 29 | if (isset($filter[0]['source'])) { |
28 | 30 | $filters = array_merge($filters,$filter); |
29 | 31 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) { |
|
33 | + $filter = array_merge($filter,$globalFilter); |
|
34 | + } |
|
31 | 35 | $filter_query_join = ''; |
32 | 36 | $filter_query_where = ''; |
33 | 37 | foreach($filters as $flt) { |
@@ -116,8 +120,11 @@ discard block |
||
116 | 120 | } |
117 | 121 | $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"; |
118 | 122 | } |
119 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
120 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
123 | + if ($filter_query_where == '' && $where) { |
|
124 | + $filter_query_where = ' WHERE'; |
|
125 | + } elseif ($filter_query_where != '' && $and) { |
|
126 | + $filter_query_where .= ' AND'; |
|
127 | + } |
|
121 | 128 | if ($filter_query_where != '') { |
122 | 129 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
123 | 130 | } |
@@ -131,10 +138,17 @@ discard block |
||
131 | 138 | if ($over_country == '') { |
132 | 139 | $Spotter = new Spotter($this->db); |
133 | 140 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
134 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
135 | - else $country = ''; |
|
136 | - } else $country = $over_country; |
|
137 | - if ($airline_type === NULL) $airline_type =''; |
|
141 | + if (!empty($data_country)) { |
|
142 | + $country = $data_country['iso2']; |
|
143 | + } else { |
|
144 | + $country = ''; |
|
145 | + } |
|
146 | + } else { |
|
147 | + $country = $over_country; |
|
148 | + } |
|
149 | + if ($airline_type === NULL) { |
|
150 | + $airline_type =''; |
|
151 | + } |
|
138 | 152 | |
139 | 153 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
140 | 154 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -630,7 +644,9 @@ discard block |
||
630 | 644 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
631 | 645 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
632 | 646 | $translate = $Translation->ident2icao($q_item); |
633 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
647 | + if ($translate != $q_item) { |
|
648 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
649 | + } |
|
634 | 650 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
635 | 651 | $additional_query .= ")"; |
636 | 652 | } |
@@ -846,7 +862,9 @@ discard block |
||
846 | 862 | date_default_timezone_set($globalTimezone); |
847 | 863 | $datetime = new DateTime(); |
848 | 864 | $offset = $datetime->format('P'); |
849 | - } else $offset = '+00:00'; |
|
865 | + } else { |
|
866 | + $offset = '+00:00'; |
|
867 | + } |
|
850 | 868 | if ($date_array[1] != "") |
851 | 869 | { |
852 | 870 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
@@ -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); |
@@ -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. (MarineArchive)'); |
|
9 | + if ($this->db === null) { |
|
10 | + die('Error: No DB connection. (MarineArchive)'); |
|
11 | + } |
|
10 | 12 | } |
11 | 13 | |
12 | 14 | /** |
@@ -27,7 +29,9 @@ discard block |
||
27 | 29 | if (isset($filter[0]['source'])) { |
28 | 30 | $filters = array_merge($filters,$filter); |
29 | 31 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) { |
|
33 | + $filter = array_merge($filter,$globalFilter); |
|
34 | + } |
|
31 | 35 | $filter_query_join = ''; |
32 | 36 | $filter_query_where = ''; |
33 | 37 | foreach($filters as $flt) { |
@@ -73,8 +77,11 @@ discard block |
||
73 | 77 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
74 | 78 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
75 | 79 | } |
76 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
77 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
80 | + if ($filter_query_where == '' && $where) { |
|
81 | + $filter_query_where = ' WHERE'; |
|
82 | + } elseif ($filter_query_where != '' && $and) { |
|
83 | + $filter_query_where .= ' AND'; |
|
84 | + } |
|
78 | 85 | if ($filter_query_where != '') { |
79 | 86 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
80 | 87 | } |
@@ -88,9 +95,14 @@ discard block |
||
88 | 95 | if ($over_country == '') { |
89 | 96 | $Marine = new Marine($this->db); |
90 | 97 | $data_country = $Marine->getCountryFromLatitudeLongitude($latitude,$longitude); |
91 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
92 | - else $country = ''; |
|
93 | - } else $country = $over_country; |
|
98 | + if (!empty($data_country)) { |
|
99 | + $country = $data_country['iso2']; |
|
100 | + } else { |
|
101 | + $country = ''; |
|
102 | + } |
|
103 | + } else { |
|
104 | + $country = $over_country; |
|
105 | + } |
|
94 | 106 | |
95 | 107 | //$country = $over_country; |
96 | 108 | // Route is not added in marine_archive |
@@ -598,7 +610,9 @@ discard block |
||
598 | 610 | $additional_query .= "(marine_archive_output.pilot_name like '%".$q_item."%') OR "; |
599 | 611 | $additional_query .= "(marine_archive_output.ident like '%".$q_item."%') OR "; |
600 | 612 | $translate = $Translation->ident2icao($q_item); |
601 | - if ($translate != $q_item) $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR "; |
|
613 | + if ($translate != $q_item) { |
|
614 | + $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR "; |
|
615 | + } |
|
602 | 616 | $additional_query .= "(marine_archive_output.highlight like '%".$q_item."%')"; |
603 | 617 | $additional_query .= ")"; |
604 | 618 | } |
@@ -816,7 +830,9 @@ discard block |
||
816 | 830 | date_default_timezone_set($globalTimezone); |
817 | 831 | $datetime = new DateTime(); |
818 | 832 | $offset = $datetime->format('P'); |
819 | - } else $offset = '+00:00'; |
|
833 | + } else { |
|
834 | + $offset = '+00:00'; |
|
835 | + } |
|
820 | 836 | |
821 | 837 | |
822 | 838 | if ($date_array[1] != "") |
@@ -1092,9 +1108,13 @@ discard block |
||
1092 | 1108 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1093 | 1109 | } |
1094 | 1110 | } |
1095 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1111 | + if ($sincedate != '') { |
|
1112 | + $query .= "AND date > '".$sincedate."' "; |
|
1113 | + } |
|
1096 | 1114 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1097 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1115 | + if ($limit) { |
|
1116 | + $query .= " LIMIT 0,10"; |
|
1117 | + } |
|
1098 | 1118 | |
1099 | 1119 | |
1100 | 1120 | $sth = $this->db->prepare($query); |
@@ -1138,9 +1158,13 @@ discard block |
||
1138 | 1158 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1139 | 1159 | } |
1140 | 1160 | } |
1141 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1161 | + if ($sincedate != '') { |
|
1162 | + $query .= "AND s.date > '".$sincedate."' "; |
|
1163 | + } |
|
1142 | 1164 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1143 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1165 | + if ($limit) { |
|
1166 | + $query .= " LIMIT 0,10"; |
|
1167 | + } |
|
1144 | 1168 | |
1145 | 1169 | |
1146 | 1170 | $sth = $this->db->prepare($query); |
@@ -7,7 +7,9 @@ discard block |
||
7 | 7 | public function __construct($dbc = null) { |
8 | 8 | $Connection = new Connection($dbc); |
9 | 9 | $this->db = $Connection->db; |
10 | - if ($this->db === null) die('Error: No DB connection. (ATC)'); |
|
10 | + if ($this->db === null) { |
|
11 | + die('Error: No DB connection. (ATC)'); |
|
12 | + } |
|
11 | 13 | } |
12 | 14 | |
13 | 15 | /** |
@@ -20,20 +22,27 @@ discard block |
||
20 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 24 | foreach($globalStatsFilters[$globalFilterName] as $source) { |
23 | - if (isset($source['source'])) $filter['source'][] = $source['source']; |
|
25 | + if (isset($source['source'])) { |
|
26 | + $filter['source'][] = $source['source']; |
|
27 | + } |
|
24 | 28 | } |
25 | 29 | } else { |
26 | 30 | $filter = $globalStatsFilters[$globalFilterName]; |
27 | 31 | } |
28 | 32 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) { |
|
34 | + $filter = array_merge($filter,$globalFilter); |
|
35 | + } |
|
30 | 36 | $filter_query_join = ''; |
31 | 37 | $filter_query_where = ''; |
32 | 38 | if (isset($filter['source']) && !empty($filter['source'])) { |
33 | 39 | $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
34 | 40 | } |
35 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
36 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
41 | + if ($filter_query_where == '' && $where) { |
|
42 | + $filter_query_where = ' WHERE'; |
|
43 | + } elseif ($filter_query_where != '' && $and) { |
|
44 | + $filter_query_where .= ' AND'; |
|
45 | + } |
|
37 | 46 | $filter_query = $filter_query_join.$filter_query_where; |
38 | 47 | return $filter_query; |
39 | 48 | } |
@@ -90,7 +99,9 @@ discard block |
||
90 | 99 | $info = str_replace('^','<br />',$info); |
91 | 100 | $info = str_replace('&sect;','',$info); |
92 | 101 | $info = str_replace('"','',$info); |
93 | - if ($type == '') $type = NULL; |
|
102 | + if ($type == '') { |
|
103 | + $type = NULL; |
|
104 | + } |
|
94 | 105 | $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)"; |
95 | 106 | $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); |
96 | 107 | try { |
@@ -106,7 +117,9 @@ discard block |
||
106 | 117 | $info = str_replace('^','<br />',$info); |
107 | 118 | $info = str_replace('&sect;','',$info); |
108 | 119 | $info = str_replace('"','',$info); |
109 | - if ($type == '') $type = NULL; |
|
120 | + if ($type == '') { |
|
121 | + $type = NULL; |
|
122 | + } |
|
110 | 123 | $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"; |
111 | 124 | $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); |
112 | 125 | try { |
@@ -8,7 +8,9 @@ discard block |
||
8 | 8 | public function __construct($dbc = null) { |
9 | 9 | $Connection = new Connection($dbc); |
10 | 10 | $this->db = $Connection->db(); |
11 | - if ($this->db === null) die('Error: No DB connection. (SpotterLive)'); |
|
11 | + if ($this->db === null) { |
|
12 | + die('Error: No DB connection. (SpotterLive)'); |
|
13 | + } |
|
12 | 14 | } |
13 | 15 | |
14 | 16 | |
@@ -30,7 +32,9 @@ discard block |
||
30 | 32 | if (isset($filter[0]['source'])) { |
31 | 33 | $filters = array_merge($filters,$filter); |
32 | 34 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
35 | + if (is_array($globalFilter)) { |
|
36 | + $filter = array_merge($filter,$globalFilter); |
|
37 | + } |
|
34 | 38 | $filter_query_join = ''; |
35 | 39 | $filter_query_where = ''; |
36 | 40 | foreach($filters as $flt) { |
@@ -123,8 +127,11 @@ discard block |
||
123 | 127 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
124 | 128 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
125 | 129 | } |
126 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
127 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
130 | + if ($filter_query_where == '' && $where) { |
|
131 | + $filter_query_where = ' WHERE'; |
|
132 | + } elseif ($filter_query_where != '' && $and) { |
|
133 | + $filter_query_where .= ' AND'; |
|
134 | + } |
|
128 | 135 | if ($filter_query_where != '') { |
129 | 136 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
130 | 137 | } |
@@ -165,9 +172,13 @@ discard block |
||
165 | 172 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
166 | 173 | } |
167 | 174 | } |
168 | - if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
175 | + if ($orderby_query == '') { |
|
176 | + $orderby_query = ' ORDER BY date DESC'; |
|
177 | + } |
|
169 | 178 | |
170 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
179 | + if (!isset($globalLiveInterval)) { |
|
180 | + $globalLiveInterval = '200'; |
|
181 | + } |
|
171 | 182 | if ($globalDBdriver == 'mysql') { |
172 | 183 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
173 | 184 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -190,7 +201,9 @@ discard block |
||
190 | 201 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
191 | 202 | date_default_timezone_set('UTC'); |
192 | 203 | $filter_query = $this->getFilter($filter,true,true); |
193 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
204 | + if (!isset($globalLiveInterval)) { |
|
205 | + $globalLiveInterval = '200'; |
|
206 | + } |
|
194 | 207 | if ($globalDBdriver == 'mysql') { |
195 | 208 | if (isset($globalArchive) && $globalArchive === TRUE) { |
196 | 209 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -240,8 +253,12 @@ discard block |
||
240 | 253 | } |
241 | 254 | $filter_query = $this->getFilter($filter,true,true); |
242 | 255 | |
243 | - if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
|
244 | - if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
|
256 | + if (!isset($globalLiveInterval) || $globalLiveInterval == '') { |
|
257 | + $globalLiveInterval = '200'; |
|
258 | + } |
|
259 | + if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') { |
|
260 | + $globalMap3DAircraftsLimit = '300'; |
|
261 | + } |
|
245 | 262 | if ($globalDBdriver == 'mysql') { |
246 | 263 | if (isset($globalArchive) && $globalArchive === TRUE) { |
247 | 264 | /* |
@@ -252,22 +269,32 @@ discard block |
||
252 | 269 | */ |
253 | 270 | $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
254 | 271 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
255 | - if ($usecoord) $query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
272 | + if ($usecoord) { |
|
273 | + $query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
274 | + } |
|
256 | 275 | $query .= "UNION |
257 | 276 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
258 | 277 | FROM spotter_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date"; |
259 | - if ($usecoord) $query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
278 | + if ($usecoord) { |
|
279 | + $query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
280 | + } |
|
260 | 281 | $query .= ") AS spotter |
261 | 282 | WHERE latitude <> '0' AND longitude <> '0' |
262 | 283 | ORDER BY flightaware_id, date"; |
263 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
284 | + if ($limit) { |
|
285 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
286 | + } |
|
264 | 287 | } else { |
265 | 288 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
266 | 289 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
267 | - if ($usecoord) $query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
290 | + if ($usecoord) { |
|
291 | + $query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
292 | + } |
|
268 | 293 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
269 | 294 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
270 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
295 | + if ($limit) { |
|
296 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
297 | + } |
|
271 | 298 | } |
272 | 299 | } else { |
273 | 300 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -279,21 +306,31 @@ discard block |
||
279 | 306 | */ |
280 | 307 | $query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
281 | 308 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
282 | - if ($usecoord) $query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
309 | + if ($usecoord) { |
|
310 | + $query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
311 | + } |
|
283 | 312 | $query .= "UNION |
284 | 313 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
285 | 314 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date"; |
286 | - if ($usecoord) $query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
315 | + if ($usecoord) { |
|
316 | + $query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
317 | + } |
|
287 | 318 | $query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' "; |
288 | 319 | $query .= "ORDER BY flightaware_id, date"; |
289 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
320 | + if ($limit) { |
|
321 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
322 | + } |
|
290 | 323 | } else { |
291 | 324 | $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
292 | 325 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date "; |
293 | - if ($usecoord) $query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
326 | + if ($usecoord) { |
|
327 | + $query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
328 | + } |
|
294 | 329 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
295 | 330 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
296 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
331 | + if ($limit) { |
|
332 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
333 | + } |
|
297 | 334 | } |
298 | 335 | } |
299 | 336 | try { |
@@ -318,7 +355,9 @@ discard block |
||
318 | 355 | global $globalDBdriver, $globalLiveInterval; |
319 | 356 | $filter_query = $this->getFilter($filter,true,true); |
320 | 357 | |
321 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
358 | + if (!isset($globalLiveInterval)) { |
|
359 | + $globalLiveInterval = '200'; |
|
360 | + } |
|
322 | 361 | if ($globalDBdriver == 'mysql') { |
323 | 362 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
324 | 363 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -348,7 +387,9 @@ discard block |
||
348 | 387 | { |
349 | 388 | global $globalDBdriver, $globalLiveInterval; |
350 | 389 | $Spotter = new Spotter($this->db); |
351 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
390 | + if (!isset($globalLiveInterval)) { |
|
391 | + $globalLiveInterval = '200'; |
|
392 | + } |
|
352 | 393 | $filter_query = $this->getFilter($filter); |
353 | 394 | |
354 | 395 | if (is_array($coord)) { |
@@ -356,7 +397,9 @@ discard block |
||
356 | 397 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
357 | 398 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
358 | 399 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
359 | - } else return array(); |
|
400 | + } else { |
|
401 | + return array(); |
|
402 | + } |
|
360 | 403 | if ($globalDBdriver == 'mysql') { |
361 | 404 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
362 | 405 | } else { |
@@ -377,7 +420,9 @@ discard block |
||
377 | 420 | { |
378 | 421 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
379 | 422 | $Spotter = new Spotter($this->db); |
380 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
423 | + if (!isset($globalLiveInterval)) { |
|
424 | + $globalLiveInterval = '200'; |
|
425 | + } |
|
381 | 426 | $filter_query = $this->getFilter($filter,true,true); |
382 | 427 | |
383 | 428 | if (is_array($coord)) { |
@@ -385,7 +430,9 @@ discard block |
||
385 | 430 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
386 | 431 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
387 | 432 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
388 | - } else return array(); |
|
433 | + } else { |
|
434 | + return array(); |
|
435 | + } |
|
389 | 436 | if ($globalDBdriver == 'mysql') { |
390 | 437 | if (isset($globalArchive) && $globalArchive === TRUE) { |
391 | 438 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -612,11 +659,15 @@ discard block |
||
612 | 659 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
613 | 660 | if ($globalDBdriver == 'mysql') { |
614 | 661 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
615 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
662 | + if ($liveinterval) { |
|
663 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
664 | + } |
|
616 | 665 | $query .= ' ORDER BY date'; |
617 | 666 | } else { |
618 | 667 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
619 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
668 | + if ($liveinterval) { |
|
669 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
670 | + } |
|
620 | 671 | $query .= ' ORDER BY date'; |
621 | 672 | } |
622 | 673 | |
@@ -711,7 +762,9 @@ discard block |
||
711 | 762 | $i++; |
712 | 763 | $j++; |
713 | 764 | if ($j == 30) { |
714 | - if ($globalDebug) echo "."; |
|
765 | + if ($globalDebug) { |
|
766 | + echo "."; |
|
767 | + } |
|
715 | 768 | try { |
716 | 769 | |
717 | 770 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -1018,7 +1071,9 @@ discard block |
||
1018 | 1071 | { |
1019 | 1072 | return false; |
1020 | 1073 | } |
1021 | - } else return ''; |
|
1074 | + } else { |
|
1075 | + return ''; |
|
1076 | + } |
|
1022 | 1077 | |
1023 | 1078 | if ($longitude != '') |
1024 | 1079 | { |
@@ -1026,7 +1081,9 @@ discard block |
||
1026 | 1081 | { |
1027 | 1082 | return false; |
1028 | 1083 | } |
1029 | - } else return ''; |
|
1084 | + } else { |
|
1085 | + return ''; |
|
1086 | + } |
|
1030 | 1087 | |
1031 | 1088 | if ($waypoints != '') |
1032 | 1089 | { |
@@ -1042,14 +1099,18 @@ discard block |
||
1042 | 1099 | { |
1043 | 1100 | return false; |
1044 | 1101 | } |
1045 | - } else $altitude = 0; |
|
1102 | + } else { |
|
1103 | + $altitude = 0; |
|
1104 | + } |
|
1046 | 1105 | if ($altitude_real != '') |
1047 | 1106 | { |
1048 | 1107 | if (!is_numeric($altitude_real)) |
1049 | 1108 | { |
1050 | 1109 | return false; |
1051 | 1110 | } |
1052 | - } else $altitude_real = 0; |
|
1111 | + } else { |
|
1112 | + $altitude_real = 0; |
|
1113 | + } |
|
1053 | 1114 | |
1054 | 1115 | if ($heading != '') |
1055 | 1116 | { |
@@ -1057,7 +1118,9 @@ discard block |
||
1057 | 1118 | { |
1058 | 1119 | return false; |
1059 | 1120 | } |
1060 | - } else $heading = 0; |
|
1121 | + } else { |
|
1122 | + $heading = 0; |
|
1123 | + } |
|
1061 | 1124 | |
1062 | 1125 | if ($groundspeed != '') |
1063 | 1126 | { |
@@ -1065,9 +1128,13 @@ discard block |
||
1065 | 1128 | { |
1066 | 1129 | return false; |
1067 | 1130 | } |
1068 | - } else $groundspeed = 0; |
|
1131 | + } else { |
|
1132 | + $groundspeed = 0; |
|
1133 | + } |
|
1069 | 1134 | date_default_timezone_set('UTC'); |
1070 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
1135 | + if ($date == '') { |
|
1136 | + $date = date("Y-m-d H:i:s", time()); |
|
1137 | + } |
|
1071 | 1138 | |
1072 | 1139 | |
1073 | 1140 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -1112,14 +1179,24 @@ discard block |
||
1112 | 1179 | $arrival_airport_country = ''; |
1113 | 1180 | |
1114 | 1181 | |
1115 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1116 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1117 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1118 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1182 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
1183 | + $squawk = NULL; |
|
1184 | + } |
|
1185 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
1186 | + $verticalrate = NULL; |
|
1187 | + } |
|
1188 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
1189 | + $groundspeed = 0; |
|
1190 | + } |
|
1191 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
1192 | + $heading = 0; |
|
1193 | + } |
|
1119 | 1194 | |
1120 | 1195 | $query = ''; |
1121 | 1196 | if ($globalArchive) { |
1122 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
1197 | + if ($globalDebug) { |
|
1198 | + echo '-- Delete previous data -- '; |
|
1199 | + } |
|
1123 | 1200 | $query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;'; |
1124 | 1201 | } |
1125 | 1202 | |
@@ -1136,10 +1213,14 @@ discard block |
||
1136 | 1213 | return "error : ".$e->getMessage(); |
1137 | 1214 | } |
1138 | 1215 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1139 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1216 | + if ($globalDebug) { |
|
1217 | + echo '(Add to SBS archive : '; |
|
1218 | + } |
|
1140 | 1219 | $SpotterArchive = new SpotterArchive($this->db); |
1141 | 1220 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
1142 | - if ($globalDebug) echo $result.')'; |
|
1221 | + if ($globalDebug) { |
|
1222 | + echo $result.')'; |
|
1223 | + } |
|
1143 | 1224 | } elseif ($globalDebug && $putinarchive !== true) { |
1144 | 1225 | echo '(Not adding to archive)'; |
1145 | 1226 | } elseif ($globalDebug && $noarchive === true) { |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
35 | 35 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
36 | 36 | $aircraft_types = $Stats->getAllAircraftTypes(); |
37 | - if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
37 | + if (empty($aircraft_types)) { |
|
38 | + $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
39 | + } |
|
38 | 40 | foreach($aircraft_types as $aircraft_item) |
39 | 41 | { |
40 | 42 | $output .= '<url>'; |
@@ -84,7 +86,9 @@ discard block |
||
84 | 86 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
85 | 87 | |
86 | 88 | $airport_names = $Stats->getAllAirportNames(); |
87 | - if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
|
89 | + if (empty($airport_names)) { |
|
90 | + $airport_names = $Spotter->getAllAirportNames(); |
|
91 | + } |
|
88 | 92 | foreach($airport_names as $airport_item) |
89 | 93 | { |
90 | 94 | $output .= '<url>'; |
@@ -99,7 +103,9 @@ discard block |
||
99 | 103 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
100 | 104 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
101 | 105 | $manufacturer_names = $Stats->getAllManufacturers(); |
102 | - if (empty($manufacturer_names)) $manufacturer_names = $Spotter->getAllManufacturers(); |
|
106 | + if (empty($manufacturer_names)) { |
|
107 | + $manufacturer_names = $Spotter->getAllManufacturers(); |
|
108 | + } |
|
103 | 109 | foreach($manufacturer_names as $manufacturer_item) |
104 | 110 | { |
105 | 111 | $output .= '<url>'; |
@@ -4,7 +4,9 @@ discard block |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Stats = new Stats(); |
6 | 6 | |
7 | -if (!isset($filter_name)) $filter_name = ''; |
|
7 | +if (!isset($filter_name)) { |
|
8 | + $filter_name = ''; |
|
9 | +} |
|
8 | 10 | $type = 'aircraft'; |
9 | 11 | if (isset($_GET['marine'])) { |
10 | 12 | $type = 'marine'; |
@@ -21,8 +23,10 @@ discard block |
||
21 | 23 | } |
22 | 24 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
23 | 25 | if ($airline_icao == '' && isset($globalFilter)) { |
24 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
25 | -} |
|
26 | + if (isset($globalFilter['airline'])) { |
|
27 | + $airline_icao = $globalFilter['airline'][0]; |
|
28 | + } |
|
29 | + } |
|
26 | 30 | |
27 | 31 | require_once('header.php'); |
28 | 32 | include('statistics-sub-menu.php'); |
@@ -64,10 +68,14 @@ discard block |
||
64 | 68 | $flightover_data = ''; |
65 | 69 | foreach($flightover_array as $flightover_item) |
66 | 70 | { |
67 | - if ($type == 'aircraft') $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
|
68 | - elseif ($type == 'marine') $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
|
69 | - elseif ($type == 'tracker') $flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],'; |
|
70 | -} |
|
71 | + if ($type == 'aircraft') { |
|
72 | + $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
|
73 | + } elseif ($type == 'marine') { |
|
74 | + $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
|
75 | + } elseif ($type == 'tracker') { |
|
76 | + $flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],'; |
|
77 | + } |
|
78 | + } |
|
71 | 79 | $flightover_data = substr($flightover_data, 0, -1); |
72 | 80 | print $flightover_data; |
73 | 81 | print '];'; |
@@ -46,8 +46,10 @@ discard block |
||
46 | 46 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
47 | 47 | $sql_date = $end_date; |
48 | 48 | } |
49 | - } else $sql_date = ''; |
|
50 | -} |
|
49 | + } else { |
|
50 | + $sql_date = ''; |
|
51 | + } |
|
52 | + } |
|
51 | 53 | |
52 | 54 | if (isset($_GET['highest_altitude'])) { |
53 | 55 | //for altitude manipulation |
@@ -61,8 +63,12 @@ discard block |
||
61 | 63 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
62 | 64 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
63 | 65 | $sql_altitude = $start_altitude; |
64 | - } else $sql_altitude = ''; |
|
65 | -} else $sql_altitude = ''; |
|
66 | + } else { |
|
67 | + $sql_altitude = ''; |
|
68 | + } |
|
69 | + } else { |
|
70 | + $sql_altitude = ''; |
|
71 | +} |
|
66 | 72 | |
67 | 73 | //calculuation for the pagination |
68 | 74 | if(!isset($_GET['limit'])) |
@@ -80,7 +86,7 @@ discard block |
||
80 | 86 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
81 | 87 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
82 | 88 | } |
83 | -} else { |
|
89 | +} else { |
|
84 | 90 | $limit_explode = explode(",", $_GET['limit']); |
85 | 91 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
86 | 92 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -138,10 +144,15 @@ discard block |
||
138 | 144 | $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
139 | 145 | $number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
140 | 146 | if ($dist != '') { |
141 | - if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
|
142 | - elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
|
147 | + if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') { |
|
148 | + $dist = $dist*1.60934; |
|
149 | + } elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') { |
|
150 | + $dist = $dist*1.852; |
|
151 | + } |
|
152 | + } |
|
153 | + if (!isset($sql_date)) { |
|
154 | + $sql_date = ''; |
|
143 | 155 | } |
144 | - if (!isset($sql_date)) $sql_date = ''; |
|
145 | 156 | if ($archive == 1) { |
146 | 157 | if ($type == 'aircraft') { |
147 | 158 | $SpotterArchive = new SpotterArchive(); |
@@ -219,7 +230,10 @@ discard block |
||
219 | 230 | if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
220 | 231 | if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
221 | 232 | if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
222 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
233 | + if (isset($_GET['highlights'])) { |
|
234 | + if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; |
|
235 | + } |
|
236 | + } |
|
223 | 237 | if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
224 | 238 | if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
225 | 239 | if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
@@ -355,7 +369,10 @@ discard block |
||
355 | 369 | <div class="form-group"> |
356 | 370 | <label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label> |
357 | 371 | <div class="col-sm-10"> |
358 | - <input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" /> |
|
372 | + <input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) { |
|
373 | + print $q; |
|
374 | +} |
|
375 | +?>" size="10" placeholder="<?php echo _("Keywords"); ?>" /> |
|
359 | 376 | </div> |
360 | 377 | </div> |
361 | 378 | </fieldset> |
@@ -374,7 +391,10 @@ discard block |
||
374 | 391 | </select> |
375 | 392 | </div> |
376 | 393 | </div> |
377 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
394 | + <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) { |
|
395 | + print $manufacturer; |
|
396 | +} |
|
397 | +?>')</script> |
|
378 | 398 | <div class="form-group"> |
379 | 399 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
380 | 400 | <div class="col-sm-10"> |
@@ -383,11 +403,17 @@ discard block |
||
383 | 403 | </select> |
384 | 404 | </div> |
385 | 405 | </div> |
386 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
406 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) { |
|
407 | + print $aircraft_icao; |
|
408 | +} |
|
409 | +?>');</script> |
|
387 | 410 | <div class="form-group"> |
388 | 411 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
389 | 412 | <div class="col-sm-10"> |
390 | - <input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" /> |
|
413 | + <input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) { |
|
414 | + print $registration; |
|
415 | +} |
|
416 | +?>" size="8" placeholder="<?php echo _("Registration"); ?>" /> |
|
391 | 417 | </div> |
392 | 418 | </div> |
393 | 419 | <?php |
@@ -396,22 +422,31 @@ discard block |
||
396 | 422 | <div class="form-group"> |
397 | 423 | <label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> |
398 | 424 | <div class="col-sm-10"> |
399 | - <input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" /> |
|
425 | + <input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) { |
|
426 | + print $pilot_id; |
|
427 | +} |
|
428 | +?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" /> |
|
400 | 429 | </div> |
401 | 430 | </div> |
402 | 431 | <div class="form-group"> |
403 | 432 | <label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> |
404 | 433 | <div class="col-sm-10"> |
405 | - <input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" /> |
|
434 | + <input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) { |
|
435 | + print $pilot_name; |
|
436 | +} |
|
437 | +?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" /> |
|
406 | 438 | </div> |
407 | 439 | </div> |
408 | 440 | <?php |
409 | - }else { |
|
441 | + } else { |
|
410 | 442 | ?> |
411 | 443 | <div class="form-group"> |
412 | 444 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
413 | 445 | <div class="col-sm-10"> |
414 | - <input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" /> |
|
446 | + <input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) { |
|
447 | + print $owner; |
|
448 | +} |
|
449 | +?>" size="15" placeholder="<?php echo _("Owner name"); ?>" /> |
|
415 | 450 | </div> |
416 | 451 | </div> |
417 | 452 | <?php |
@@ -419,8 +454,14 @@ discard block |
||
419 | 454 | ?> |
420 | 455 | <div class="form-group"> |
421 | 456 | <div class="col-sm-offset-2 col-sm-10"> |
422 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
423 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
457 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) { |
|
458 | + if ($_GET['highlights'] == "true"){ print 'checked="checked"'; |
|
459 | +} |
|
460 | +} ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
461 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) { |
|
462 | + if ($_GET['highlights'] == "true"){ print 'checked="checked"'; |
|
463 | +} |
|
464 | +} ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
424 | 465 | </div> |
425 | 466 | </div> |
426 | 467 | </fieldset> |
@@ -434,7 +475,10 @@ discard block |
||
434 | 475 | </select> |
435 | 476 | </div> |
436 | 477 | </div> |
437 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
478 | + <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) { |
|
479 | + print $airline; |
|
480 | +} |
|
481 | +?>');</script> |
|
438 | 482 | <div class="form-group"> |
439 | 483 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
440 | 484 | <div class="col-sm-10"> |
@@ -443,19 +487,34 @@ discard block |
||
443 | 487 | </select> |
444 | 488 | </div> |
445 | 489 | </div> |
446 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
490 | + <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) { |
|
491 | + print $airline_country; |
|
492 | +} |
|
493 | +?>');</script> |
|
447 | 494 | <div class="form-group"> |
448 | 495 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
449 | 496 | <div class="col-sm-10"> |
450 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
497 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
498 | + print $callsign; |
|
499 | +} |
|
500 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
451 | 501 | </div> |
452 | 502 | </div> |
453 | 503 | <div class="form-group"> |
454 | 504 | <div class="col-sm-offset-2 col-sm-10"> |
455 | 505 | <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
456 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
457 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
458 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
506 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) { |
|
507 | + if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; |
|
508 | +} |
|
509 | +} ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
510 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) { |
|
511 | + if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; |
|
512 | +} |
|
513 | +} ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
514 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) { |
|
515 | + if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; |
|
516 | +} |
|
517 | +} ?>> <?php echo _("Only Military airlines"); ?></label> |
|
459 | 518 | </div> |
460 | 519 | </div> |
461 | 520 | </fieldset> |
@@ -469,7 +528,10 @@ discard block |
||
469 | 528 | </select> |
470 | 529 | </div> |
471 | 530 | </div> |
472 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
531 | + <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) { |
|
532 | + print $airport_icao; |
|
533 | +} |
|
534 | +?>');</script> |
|
473 | 535 | <div class="form-group"> |
474 | 536 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
475 | 537 | <div class="col-sm-10"> |
@@ -478,7 +540,10 @@ discard block |
||
478 | 540 | </select> |
479 | 541 | </div> |
480 | 542 | </div> |
481 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
543 | + <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) { |
|
544 | + print $airport_country; |
|
545 | +} |
|
546 | +?>');</script> |
|
482 | 547 | </fieldset> |
483 | 548 | <fieldset> |
484 | 549 | <legend><?php echo _("Route"); ?></legend> |
@@ -490,7 +555,10 @@ discard block |
||
490 | 555 | </select> |
491 | 556 | </div> |
492 | 557 | </div> |
493 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
558 | + <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) { |
|
559 | + print $departure_airport_route; |
|
560 | +} |
|
561 | +?>');</script> |
|
494 | 562 | <div class="form-group"> |
495 | 563 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
496 | 564 | <div class="col-sm-10"> |
@@ -499,7 +567,10 @@ discard block |
||
499 | 567 | </select> |
500 | 568 | </div> |
501 | 569 | </div> |
502 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
570 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) { |
|
571 | + print $arrival_airport_route; |
|
572 | +} |
|
573 | +?>');</script> |
|
503 | 574 | </fieldset> |
504 | 575 | <fieldset> |
505 | 576 | <legend>Altitude</legend> |
@@ -549,19 +620,33 @@ discard block |
||
549 | 620 | <div class="form-group"> |
550 | 621 | <label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label> |
551 | 622 | <div class="col-sm-10"> |
552 | - <input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" /> |
|
623 | + <input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) { |
|
624 | + print $origlat; |
|
625 | +} |
|
626 | +?>" /> |
|
553 | 627 | </div> |
554 | 628 | </div> |
555 | 629 | <div class="form-group"> |
556 | 630 | <label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label> |
557 | 631 | <div class="col-sm-10"> |
558 | - <input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" /> |
|
632 | + <input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) { |
|
633 | + print $origlon; |
|
634 | +} |
|
635 | +?>" /> |
|
559 | 636 | </div> |
560 | 637 | </div> |
561 | 638 | <div class="form-group"> |
562 | - <label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label> |
|
639 | + <label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) { |
|
640 | + print $globalDistanceUnit; |
|
641 | +} else { |
|
642 | + print 'km'; |
|
643 | +} |
|
644 | +print ')'; ?></label> |
|
563 | 645 | <div class="col-sm-10"> |
564 | - <input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" /> |
|
646 | + <input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) { |
|
647 | + print $distance; |
|
648 | +} |
|
649 | +?>" /> |
|
565 | 650 | </div> |
566 | 651 | </div> |
567 | 652 | </fieldset> |
@@ -572,7 +657,10 @@ discard block |
||
572 | 657 | <div class="form-group"> |
573 | 658 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
574 | 659 | <div class="col-sm-10"> |
575 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
660 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
661 | + print $callsign; |
|
662 | +} |
|
663 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
576 | 664 | </div> |
577 | 665 | </div> |
578 | 666 | </fieldset> |
@@ -583,7 +671,10 @@ discard block |
||
583 | 671 | <div class="form-group"> |
584 | 672 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
585 | 673 | <div class="col-sm-10"> |
586 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
674 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
675 | + print $callsign; |
|
676 | +} |
|
677 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
587 | 678 | </div> |
588 | 679 | </div> |
589 | 680 | </fieldset> |
@@ -591,7 +682,10 @@ discard block |
||
591 | 682 | <div class="form-group"> |
592 | 683 | <label class="control-label col-sm-2"><?php echo _("MMSI"); ?></label> |
593 | 684 | <div class="col-sm-10"> |
594 | - <input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) print $mmsi; ?>" size="8" placeholder="<?php echo _("MMSI"); ?>" /> |
|
685 | + <input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) { |
|
686 | + print $mmsi; |
|
687 | +} |
|
688 | +?>" size="8" placeholder="<?php echo _("MMSI"); ?>" /> |
|
595 | 689 | </div> |
596 | 690 | </div> |
597 | 691 | </fieldset> |
@@ -599,7 +693,10 @@ discard block |
||
599 | 693 | <div class="form-group"> |
600 | 694 | <label class="control-label col-sm-2"><?php echo _("IMO"); ?></label> |
601 | 695 | <div class="col-sm-10"> |
602 | - <input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) print $imo; ?>" size="8" placeholder="<?php echo _("IMO"); ?>" /> |
|
696 | + <input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) { |
|
697 | + print $imo; |
|
698 | +} |
|
699 | +?>" size="8" placeholder="<?php echo _("IMO"); ?>" /> |
|
603 | 700 | </div> |
604 | 701 | </div> |
605 | 702 | </fieldset> |
@@ -612,7 +709,10 @@ discard block |
||
612 | 709 | <label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label> |
613 | 710 | <div class="col-sm-10"> |
614 | 711 | <div class='input-group date' id='datetimepicker1'> |
615 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" /> |
|
712 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') { |
|
713 | + print $start_date; |
|
714 | +} |
|
715 | +?>" placeholder="<?php echo _("Start Date/Time"); ?>" /> |
|
616 | 716 | <span class="input-group-addon"> |
617 | 717 | <span class="glyphicon glyphicon-calendar"></span> |
618 | 718 | </span> |
@@ -623,7 +723,10 @@ discard block |
||
623 | 723 | <label class="control-label col-sm-2"><?php echo _("End Date"); ?></label> |
624 | 724 | <div class="col-sm-10"> |
625 | 725 | <div class='input-group date' id='datetimepicker2'> |
626 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" /> |
|
726 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') { |
|
727 | + print $end_date; |
|
728 | +} |
|
729 | +?>" placeholder="<?php echo _("End Date/Time"); ?>" /> |
|
627 | 730 | <span class="input-group-addon"> |
628 | 731 | <span class="glyphicon glyphicon-calendar"></span> |
629 | 732 | </span> |
@@ -10,7 +10,9 @@ discard block |
||
10 | 10 | public function __construct($dbc = null) { |
11 | 11 | $Connection = new Connection($dbc); |
12 | 12 | $this->db = $Connection->db(); |
13 | - if ($this->db === null) die('Error: No DB connection. (Tracker)'); |
|
13 | + if ($this->db === null) { |
|
14 | + die('Error: No DB connection. (Tracker)'); |
|
15 | + } |
|
14 | 16 | } |
15 | 17 | |
16 | 18 | /** |
@@ -32,7 +34,9 @@ discard block |
||
32 | 34 | if (isset($filter[0]['source'])) { |
33 | 35 | $filters = array_merge($filters,$filter); |
34 | 36 | } |
35 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
37 | + if (is_array($globalFilter)) { |
|
38 | + $filter = array_merge($filter,$globalFilter); |
|
39 | + } |
|
36 | 40 | $filter_query_join = ''; |
37 | 41 | $filter_query_where = ''; |
38 | 42 | foreach($filters as $flt) { |
@@ -71,8 +75,11 @@ discard block |
||
71 | 75 | $filter_query_where .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
72 | 76 | } |
73 | 77 | } |
74 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
75 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
78 | + if ($filter_query_where == '' && $where) { |
|
79 | + $filter_query_where = ' WHERE'; |
|
80 | + } elseif ($filter_query_where != '' && $and) { |
|
81 | + $filter_query_where .= ' AND'; |
|
82 | + } |
|
76 | 83 | if ($filter_query_where != '') { |
77 | 84 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
78 | 85 | } |
@@ -126,26 +133,43 @@ discard block |
||
126 | 133 | $temp_array['tracker_id'] = $row['tracker_archive_id']; |
127 | 134 | } elseif (isset($row['tracker_archive_output_id'])) { |
128 | 135 | $temp_array['tracker_id'] = $row['tracker_archive_output_id']; |
129 | - */} |
|
130 | - elseif (isset($row['trackerid'])) { |
|
136 | + */} elseif (isset($row['trackerid'])) { |
|
131 | 137 | $temp_array['trackerid'] = $row['trackerid']; |
132 | 138 | } else { |
133 | 139 | $temp_array['trackerid'] = ''; |
134 | 140 | } |
135 | - if (isset($row['famtrackid'])) $temp_array['famtrackid'] = $row['famtrackid']; |
|
136 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
137 | - if (isset($row['comment'])) $temp_array['comment'] = $row['comment']; |
|
141 | + if (isset($row['famtrackid'])) { |
|
142 | + $temp_array['famtrackid'] = $row['famtrackid']; |
|
143 | + } |
|
144 | + if (isset($row['type'])) { |
|
145 | + $temp_array['type'] = $row['type']; |
|
146 | + } |
|
147 | + if (isset($row['comment'])) { |
|
148 | + $temp_array['comment'] = $row['comment']; |
|
149 | + } |
|
138 | 150 | $temp_array['ident'] = $row['ident']; |
139 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
140 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
141 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
142 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
151 | + if (isset($row['latitude'])) { |
|
152 | + $temp_array['latitude'] = $row['latitude']; |
|
153 | + } |
|
154 | + if (isset($row['longitude'])) { |
|
155 | + $temp_array['longitude'] = $row['longitude']; |
|
156 | + } |
|
157 | + if (isset($row['format_source'])) { |
|
158 | + $temp_array['format_source'] = $row['format_source']; |
|
159 | + } |
|
160 | + if (isset($row['altitude'])) { |
|
161 | + $temp_array['altitude'] = $row['altitude']; |
|
162 | + } |
|
143 | 163 | if (isset($row['heading'])) { |
144 | 164 | $temp_array['heading'] = $row['heading']; |
145 | 165 | $heading_direction = $this->parseDirection($row['heading']); |
146 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
166 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
167 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
168 | + } |
|
169 | + } |
|
170 | + if (isset($row['ground_speed'])) { |
|
171 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
147 | 172 | } |
148 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
149 | 173 | |
150 | 174 | if (isset($row['date'])) { |
151 | 175 | $dateArray = $this->parseDateString($row['date']); |
@@ -188,13 +212,21 @@ discard block |
||
188 | 212 | } |
189 | 213 | |
190 | 214 | $fromsource = NULL; |
191 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
192 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
193 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
215 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
216 | + $temp_array['source_name'] = $row['source_name']; |
|
217 | + } |
|
218 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
219 | + $temp_array['over_country'] = $row['over_country']; |
|
220 | + } |
|
221 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
222 | + $temp_array['distance'] = $row['distance']; |
|
223 | + } |
|
194 | 224 | $temp_array['query_number_rows'] = $num_rows; |
195 | 225 | $tracker_array[] = $temp_array; |
196 | 226 | } |
197 | - if ($num_rows == 0) return array(); |
|
227 | + if ($num_rows == 0) { |
|
228 | + return array(); |
|
229 | + } |
|
198 | 230 | $tracker_array[0]['query_number_rows'] = $num_rows; |
199 | 231 | return $tracker_array; |
200 | 232 | } |
@@ -225,8 +257,12 @@ discard block |
||
225 | 257 | { |
226 | 258 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
227 | 259 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
228 | - } else $limit_query = ""; |
|
229 | - } else $limit_query = ""; |
|
260 | + } else { |
|
261 | + $limit_query = ""; |
|
262 | + } |
|
263 | + } else { |
|
264 | + $limit_query = ""; |
|
265 | + } |
|
230 | 266 | |
231 | 267 | if ($sort != "") |
232 | 268 | { |
@@ -254,7 +290,9 @@ discard block |
||
254 | 290 | global $global_query; |
255 | 291 | |
256 | 292 | date_default_timezone_set('UTC'); |
257 | - if ($id == '') return array(); |
|
293 | + if ($id == '') { |
|
294 | + return array(); |
|
295 | + } |
|
258 | 296 | $additional_query = "tracker_output.famtrackid = :id"; |
259 | 297 | $query_values = array(':id' => $id); |
260 | 298 | $query = $global_query." WHERE ".$additional_query." "; |
@@ -397,8 +435,11 @@ discard block |
||
397 | 435 | $query .= " ORDER BY tracker_output.source_name ASC"; |
398 | 436 | |
399 | 437 | $sth = $this->db->prepare($query); |
400 | - if (!empty($query_values)) $sth->execute($query_values); |
|
401 | - else $sth->execute(); |
|
438 | + if (!empty($query_values)) { |
|
439 | + $sth->execute($query_values); |
|
440 | + } else { |
|
441 | + $sth->execute(); |
|
442 | + } |
|
402 | 443 | |
403 | 444 | $source_array = array(); |
404 | 445 | $temp_array = array(); |
@@ -453,7 +494,9 @@ discard block |
||
453 | 494 | date_default_timezone_set($globalTimezone); |
454 | 495 | $datetime = new DateTime(); |
455 | 496 | $offset = $datetime->format('P'); |
456 | - } else $offset = '+00:00'; |
|
497 | + } else { |
|
498 | + $offset = '+00:00'; |
|
499 | + } |
|
457 | 500 | |
458 | 501 | if ($globalDBdriver == 'mysql') { |
459 | 502 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
@@ -609,7 +652,9 @@ discard block |
||
609 | 652 | { |
610 | 653 | return false; |
611 | 654 | } |
612 | - } else $altitude = 0; |
|
655 | + } else { |
|
656 | + $altitude = 0; |
|
657 | + } |
|
613 | 658 | |
614 | 659 | if ($heading != "") |
615 | 660 | { |
@@ -648,8 +693,12 @@ discard block |
||
648 | 693 | $latitude = 0; |
649 | 694 | $longitude = 0; |
650 | 695 | } |
651 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
652 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
696 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
697 | + $heading = 0; |
|
698 | + } |
|
699 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
700 | + $groundspeed = 0; |
|
701 | + } |
|
653 | 702 | $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
654 | 703 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
655 | 704 | |
@@ -753,7 +802,9 @@ discard block |
||
753 | 802 | global $globalDBdriver, $globalArchive; |
754 | 803 | //$filter_query = $this->getFilter($filters,true,true); |
755 | 804 | $Connection= new Connection($this->db); |
756 | - if (!$Connection->tableExists('countries')) return array(); |
|
805 | + if (!$Connection->tableExists('countries')) { |
|
806 | + return array(); |
|
807 | + } |
|
757 | 808 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
758 | 809 | require_once('class.TrackerLive.php'); |
759 | 810 | $TrackerLive = new TrackerLive($this->db); |
@@ -796,7 +847,9 @@ discard block |
||
796 | 847 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT famtrackid,over_country FROM tracker_archive".$filter_query.") l ON c.iso2 = l.over_country "; |
797 | 848 | } |
798 | 849 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
799 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
850 | + if ($limit) { |
|
851 | + $query .= " LIMIT 10 OFFSET 0"; |
|
852 | + } |
|
800 | 853 | |
801 | 854 | |
802 | 855 | $sth = $this->db->prepare($query); |
@@ -829,12 +882,18 @@ discard block |
||
829 | 882 | $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
830 | 883 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
831 | 884 | if ($olderthanmonths > 0) { |
832 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
833 | - else $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
885 | + if ($globalDBdriver == 'mysql') { |
|
886 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
887 | + } else { |
|
888 | + $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
889 | + } |
|
834 | 890 | } |
835 | 891 | if ($sincedate != '') { |
836 | - if ($globalDBdriver == 'mysql') $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
837 | - else $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
892 | + if ($globalDBdriver == 'mysql') { |
|
893 | + $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
894 | + } else { |
|
895 | + $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
896 | + } |
|
838 | 897 | } |
839 | 898 | $query_values = array(); |
840 | 899 | if ($year != '') { |
@@ -865,7 +924,9 @@ discard block |
||
865 | 924 | } |
866 | 925 | } |
867 | 926 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
868 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
927 | + if ($limit) { |
|
928 | + $query .= " LIMIT 10 OFFSET 0"; |
|
929 | + } |
|
869 | 930 | |
870 | 931 | $sth = $this->db->prepare($query); |
871 | 932 | $sth->execute($query_values); |
@@ -900,7 +961,9 @@ discard block |
||
900 | 961 | date_default_timezone_set($globalTimezone); |
901 | 962 | $datetime = new DateTime(); |
902 | 963 | $offset = $datetime->format('P'); |
903 | - } else $offset = '+00:00'; |
|
964 | + } else { |
|
965 | + $offset = '+00:00'; |
|
966 | + } |
|
904 | 967 | |
905 | 968 | if ($globalDBdriver == 'mysql') { |
906 | 969 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -950,7 +1013,9 @@ discard block |
||
950 | 1013 | date_default_timezone_set($globalTimezone); |
951 | 1014 | $datetime = new DateTime(); |
952 | 1015 | $offset = $datetime->format('P'); |
953 | - } else $offset = '+00:00'; |
|
1016 | + } else { |
|
1017 | + $offset = '+00:00'; |
|
1018 | + } |
|
954 | 1019 | $filter_query = $this->getFilter($filters,true,true); |
955 | 1020 | if ($globalDBdriver == 'mysql') { |
956 | 1021 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -996,7 +1061,9 @@ discard block |
||
996 | 1061 | date_default_timezone_set($globalTimezone); |
997 | 1062 | $datetime = new DateTime(); |
998 | 1063 | $offset = $datetime->format('P'); |
999 | - } else $offset = '+00:00'; |
|
1064 | + } else { |
|
1065 | + $offset = '+00:00'; |
|
1066 | + } |
|
1000 | 1067 | $filter_query = $this->getFilter($filters,true,true); |
1001 | 1068 | if ($globalDBdriver == 'mysql') { |
1002 | 1069 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1044,7 +1111,9 @@ discard block |
||
1044 | 1111 | date_default_timezone_set($globalTimezone); |
1045 | 1112 | $datetime = new DateTime(); |
1046 | 1113 | $offset = $datetime->format('P'); |
1047 | - } else $offset = '+00:00'; |
|
1114 | + } else { |
|
1115 | + $offset = '+00:00'; |
|
1116 | + } |
|
1048 | 1117 | |
1049 | 1118 | if ($globalDBdriver == 'mysql') { |
1050 | 1119 | $query = "SELECT YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1093,7 +1162,9 @@ discard block |
||
1093 | 1162 | date_default_timezone_set($globalTimezone); |
1094 | 1163 | $datetime = new DateTime(); |
1095 | 1164 | $offset = $datetime->format('P'); |
1096 | - } else $offset = '+00:00'; |
|
1165 | + } else { |
|
1166 | + $offset = '+00:00'; |
|
1167 | + } |
|
1097 | 1168 | $filter_query = $this->getFilter($filters,true,true); |
1098 | 1169 | if ($globalDBdriver == 'mysql') { |
1099 | 1170 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -1142,7 +1213,9 @@ discard block |
||
1142 | 1213 | date_default_timezone_set($globalTimezone); |
1143 | 1214 | $datetime = new DateTime(); |
1144 | 1215 | $offset = $datetime->format('P'); |
1145 | - } else $offset = '+00:00'; |
|
1216 | + } else { |
|
1217 | + $offset = '+00:00'; |
|
1218 | + } |
|
1146 | 1219 | |
1147 | 1220 | $orderby_sql = ''; |
1148 | 1221 | if ($orderby == "hour") |
@@ -1211,7 +1284,9 @@ discard block |
||
1211 | 1284 | date_default_timezone_set($globalTimezone); |
1212 | 1285 | $datetime = new DateTime($date); |
1213 | 1286 | $offset = $datetime->format('P'); |
1214 | - } else $offset = '+00:00'; |
|
1287 | + } else { |
|
1288 | + $offset = '+00:00'; |
|
1289 | + } |
|
1215 | 1290 | |
1216 | 1291 | if ($globalDBdriver == 'mysql') { |
1217 | 1292 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1259,7 +1334,9 @@ discard block |
||
1259 | 1334 | date_default_timezone_set($globalTimezone); |
1260 | 1335 | $datetime = new DateTime(); |
1261 | 1336 | $offset = $datetime->format('P'); |
1262 | - } else $offset = '+00:00'; |
|
1337 | + } else { |
|
1338 | + $offset = '+00:00'; |
|
1339 | + } |
|
1263 | 1340 | |
1264 | 1341 | if ($globalDBdriver == 'mysql') { |
1265 | 1342 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1324,8 +1401,11 @@ discard block |
||
1324 | 1401 | $query_values = array_merge($query_values,array(':month' => $month)); |
1325 | 1402 | } |
1326 | 1403 | } |
1327 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1328 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1404 | + if (empty($query_values)) { |
|
1405 | + $queryi .= $this->getFilter($filters); |
|
1406 | + } else { |
|
1407 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1408 | + } |
|
1329 | 1409 | |
1330 | 1410 | $sth = $this->db->prepare($queryi); |
1331 | 1411 | $sth->execute($query_values); |
@@ -1362,8 +1442,11 @@ discard block |
||
1362 | 1442 | $query_values = array_merge($query_values,array(':month' => $month)); |
1363 | 1443 | } |
1364 | 1444 | } |
1365 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1366 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1445 | + if (empty($query_values)) { |
|
1446 | + $queryi .= $this->getFilter($filters); |
|
1447 | + } else { |
|
1448 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1449 | + } |
|
1367 | 1450 | |
1368 | 1451 | $sth = $this->db->prepare($queryi); |
1369 | 1452 | $sth->execute($query_values); |
@@ -1385,7 +1468,9 @@ discard block |
||
1385 | 1468 | date_default_timezone_set($globalTimezone); |
1386 | 1469 | $datetime = new DateTime(); |
1387 | 1470 | $offset = $datetime->format('P'); |
1388 | - } else $offset = '+00:00'; |
|
1471 | + } else { |
|
1472 | + $offset = '+00:00'; |
|
1473 | + } |
|
1389 | 1474 | |
1390 | 1475 | if ($globalDBdriver == 'mysql') { |
1391 | 1476 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1489,7 +1574,9 @@ discard block |
||
1489 | 1574 | */ |
1490 | 1575 | public function parseDirection($direction = 0) |
1491 | 1576 | { |
1492 | - if ($direction == '') $direction = 0; |
|
1577 | + if ($direction == '') { |
|
1578 | + $direction = 0; |
|
1579 | + } |
|
1493 | 1580 | $direction_array = array(); |
1494 | 1581 | $temp_array = array(); |
1495 | 1582 | |
@@ -1578,7 +1665,9 @@ discard block |
||
1578 | 1665 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1579 | 1666 | |
1580 | 1667 | $Connection = new Connection($this->db); |
1581 | - if (!$Connection->tableExists('countries')) return ''; |
|
1668 | + if (!$Connection->tableExists('countries')) { |
|
1669 | + return ''; |
|
1670 | + } |
|
1582 | 1671 | |
1583 | 1672 | try { |
1584 | 1673 | /* |
@@ -1598,9 +1687,13 @@ discard block |
||
1598 | 1687 | $sth->closeCursor(); |
1599 | 1688 | if (count($row) > 0) { |
1600 | 1689 | return $row; |
1601 | - } else return ''; |
|
1690 | + } else { |
|
1691 | + return ''; |
|
1692 | + } |
|
1602 | 1693 | } catch (PDOException $e) { |
1603 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1694 | + if (isset($globalDebug) && $globalDebug) { |
|
1695 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1696 | + } |
|
1604 | 1697 | return ''; |
1605 | 1698 | } |
1606 | 1699 | |
@@ -1618,7 +1711,9 @@ discard block |
||
1618 | 1711 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
1619 | 1712 | |
1620 | 1713 | $Connection = new Connection($this->db); |
1621 | - if (!$Connection->tableExists('countries')) return ''; |
|
1714 | + if (!$Connection->tableExists('countries')) { |
|
1715 | + return ''; |
|
1716 | + } |
|
1622 | 1717 | |
1623 | 1718 | try { |
1624 | 1719 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1630,9 +1725,13 @@ discard block |
||
1630 | 1725 | $sth->closeCursor(); |
1631 | 1726 | if (count($row) > 0) { |
1632 | 1727 | return $row; |
1633 | - } else return ''; |
|
1728 | + } else { |
|
1729 | + return ''; |
|
1730 | + } |
|
1634 | 1731 | } catch (PDOException $e) { |
1635 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1732 | + if (isset($globalDebug) && $globalDebug) { |
|
1733 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1734 | + } |
|
1636 | 1735 | return ''; |
1637 | 1736 | } |
1638 | 1737 | |
@@ -1693,7 +1792,9 @@ discard block |
||
1693 | 1792 | } |
1694 | 1793 | } |
1695 | 1794 | $query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC"; |
1696 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
1795 | + if ($limit) { |
|
1796 | + $query .= " LIMIT 10 OFFSET 0"; |
|
1797 | + } |
|
1697 | 1798 | $sth = $this->db->prepare($query); |
1698 | 1799 | $sth->execute($query_values); |
1699 | 1800 | $tracker_array = array(); |
@@ -1730,7 +1831,9 @@ discard block |
||
1730 | 1831 | foreach ($q_array as $q_item){ |
1731 | 1832 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
1732 | 1833 | $additional_query .= " AND ("; |
1733 | - if (is_int($q_item)) $additional_query .= "(tracker_output.tracker_id = '".$q_item."') OR "; |
|
1834 | + if (is_int($q_item)) { |
|
1835 | + $additional_query .= "(tracker_output.tracker_id = '".$q_item."') OR "; |
|
1836 | + } |
|
1734 | 1837 | $additional_query .= "(tracker_output.ident like '%".$q_item."%') OR "; |
1735 | 1838 | $additional_query .= ")"; |
1736 | 1839 | } |
@@ -1756,7 +1859,9 @@ discard block |
||
1756 | 1859 | date_default_timezone_set($globalTimezone); |
1757 | 1860 | $datetime = new DateTime(); |
1758 | 1861 | $offset = $datetime->format('P'); |
1759 | - } else $offset = '+00:00'; |
|
1862 | + } else { |
|
1863 | + $offset = '+00:00'; |
|
1864 | + } |
|
1760 | 1865 | if ($date_array[1] != "") |
1761 | 1866 | { |
1762 | 1867 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
@@ -1783,8 +1888,12 @@ discard block |
||
1783 | 1888 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1784 | 1889 | { |
1785 | 1890 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1786 | - } else $limit_query = ""; |
|
1787 | - } else $limit_query = ""; |
|
1891 | + } else { |
|
1892 | + $limit_query = ""; |
|
1893 | + } |
|
1894 | + } else { |
|
1895 | + $limit_query = ""; |
|
1896 | + } |
|
1788 | 1897 | if ($sort != "") |
1789 | 1898 | { |
1790 | 1899 | $search_orderby_array = $this->getOrderBy(); |
@@ -1827,7 +1936,9 @@ discard block |
||
1827 | 1936 | { |
1828 | 1937 | global $globalBitlyAccessToken; |
1829 | 1938 | |
1830 | - if ($globalBitlyAccessToken == '') return $url; |
|
1939 | + if ($globalBitlyAccessToken == '') { |
|
1940 | + return $url; |
|
1941 | + } |
|
1831 | 1942 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
1832 | 1943 | $ch = curl_init(); |
1833 | 1944 | curl_setopt($ch, CURLOPT_HEADER, 0); |