Completed
Push — master ( 637022...8149d9 )
by Yannick
55:10 queued 27:13
created
sitemap.php 1 patch
Braces   +9 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>';
Please login to merge, or discard this patch.
statistics-country.php 1 patch
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 '];';
Please login to merge, or discard this patch.
require/class.Tracker.php 1 patch
Braces   +172 added lines, -61 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
manufacturer-statistics-airline-country.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
25
+	if (empty($all_manufacturers)) {
26
+		$all_manufacturers = $Spotter->getAllManufacturers();
27
+	}
26 28
 	foreach($all_manufacturers as $all_manufacturer)
27 29
 	{
28 30
 		if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer']))
Please login to merge, or discard this patch.
manufacturer-statistics-aircraft.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
25
+	if (empty($all_manufacturers)) {
26
+		$all_manufacturers = $Spotter->getAllManufacturers();
27
+	}
26 28
 	foreach($all_manufacturers as $all_manufacturer)
27 29
 	{
28 30
 		if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer']))
Please login to merge, or discard this patch.
ident.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,20 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/require/settings.php');
3 3
 $ident = '';
4
-if (isset($_POST['ident'])) $ident = filter_input(INPUT_POST,'ident',FILTER_SANITIZE_STRING);
5
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
4
+if (isset($_POST['ident'])) {
5
+	$ident = filter_input(INPUT_POST,'ident',FILTER_SANITIZE_STRING);
6
+}
7
+if (isset($_GET['ident'])) {
8
+	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
9
+}
6 10
 if ($ident != '')
7 11
 {
8
-	if (isset($_GET['marine'])) header('Location: '.$globalURL.'/marine/ident/'.$ident);
9
-	else header('Location: '.$globalURL.'/ident/'.$ident);
10
-} else {
12
+	if (isset($_GET['marine'])) {
13
+		header('Location: '.$globalURL.'/marine/ident/'.$ident);
14
+	} else {
15
+		header('Location: '.$globalURL.'/ident/'.$ident);
16
+	}
17
+	} else {
11 18
 	if ($globalURL == '') {
12 19
 		header('Location: /');
13 20
 	} else {
Please login to merge, or discard this patch.
footer.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,10 @@  discard block
 block discarded – undo
1 1
 </section>
2 2
 <div class="pub onmap">
3 3
 <?php
4
-	if (isset($globalPub)) print $globalPub;
5
-?>
4
+	if (isset($globalPub)) {
5
+		print $globalPub;
6
+	}
7
+	?>
6 8
 </div>
7 9
 <footer class="container">
8 10
 	<?php
@@ -13,7 +15,10 @@  discard block
 block discarded – undo
13 15
 	<?php
14 16
 	    }
15 17
 	?>
16
-	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.com/" target="_blank">Get source code</a></span>
18
+	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) {
19
+	print $globalURL;
20
+}
21
+?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.com/" target="_blank">Get source code</a></span>
17 22
 </footer>
18 23
 
19 24
 <div class="notifications bottom-left"></div>
Please login to merge, or discard this patch.
country-detailed.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		if (isset($limit_explode[1])) {
19 19
 			$limit_start = $limit_explode[0];
Please login to merge, or discard this patch.
search-kml.php 1 patch
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -48,7 +56,7 @@  discard block
 block discarded – undo
48 56
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 	}
51
-}  else {
59
+} else {
52 60
 	$limit_explode = explode(",", $_GET['limit']);
53 61
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
54 62
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -66,8 +74,11 @@  discard block
 block discarded – undo
66 74
 
67 75
 header('Content-Type: text/xml');
68 76
 
69
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
70
-else $sort = '';
77
+if (isset($_GET['sort'])) {
78
+	$sort = $_GET['sort'];
79
+} else {
80
+	$sort = '';
81
+}
71 82
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72 83
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73 84
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
@@ -123,7 +134,9 @@  discard block
 block discarded – undo
123 134
 			$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
124 135
 			$waypoint_pieces = array_chunk($waypoint_pieces, 2);
125 136
 			foreach ($waypoint_pieces as $waypoint_coordinate) {
126
-				if (isset($waypoint_coordinate[1])) $output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
137
+				if (isset($waypoint_coordinate[1])) {
138
+					$output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
139
+				}
127 140
 			}
128 141
 			$output .= '</coordinates>';
129 142
 			$output .= '<altitudeMode>absolute</altitudeMode>';
Please login to merge, or discard this patch.