Completed
Push — master ( 699d2e...99c879 )
by Yannick
39:47
created
owner-statistics-time.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-statistics-registration.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-statistics-departure-airport.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Braces   +48 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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) {
@@ -119,8 +123,11 @@  discard block
 block discarded – undo
119 123
 			}
120 124
 			$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";
121 125
 		}
122
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
123
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
126
+		if ($filter_query_where == '' && $where) {
127
+			$filter_query_where = ' WHERE';
128
+		} elseif ($filter_query_where != '' && $and) {
129
+			$filter_query_where .= ' AND';
130
+		}
124 131
 		if ($filter_query_where != '') {
125 132
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
126 133
 		}
@@ -134,10 +141,17 @@  discard block
 block discarded – undo
134 141
 		if ($over_country == '') {
135 142
 			$Spotter = new Spotter($this->db);
136 143
 			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
137
-			if (!empty($data_country)) $country = $data_country['iso2'];
138
-			else $country = '';
139
-		} else $country = $over_country;
140
-		if ($airline_type === NULL) $airline_type ='';
144
+			if (!empty($data_country)) {
145
+				$country = $data_country['iso2'];
146
+			} else {
147
+				$country = '';
148
+			}
149
+		} else {
150
+			$country = $over_country;
151
+		}
152
+		if ($airline_type === NULL) {
153
+			$airline_type ='';
154
+		}
141 155
 
142 156
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
143 157
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -645,7 +659,9 @@  discard block
 block discarded – undo
645 659
 					$additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
646 660
 					$additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
647 661
 					$translate = $Translation->ident2icao($q_item);
648
-					if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
662
+					if ($translate != $q_item) {
663
+						$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
664
+					}
649 665
 					$additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
650 666
 					$additional_query .= ")";
651 667
 				}
@@ -825,7 +841,9 @@  discard block
 block discarded – undo
825 841
 				date_default_timezone_set($globalTimezone);
826 842
 				$datetime = new DateTime();
827 843
 				$offset = $datetime->format('P');
828
-			} else $offset = '+00:00';
844
+			} else {
845
+				$offset = '+00:00';
846
+			}
829 847
 			if ($date_array[1] != "") {
830 848
 				$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
831 849
 				$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
@@ -1068,9 +1086,13 @@  discard block
 block discarded – undo
1068 1086
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1069 1087
 			}
1070 1088
 		}
1071
-		if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1089
+		if ($sincedate != '') {
1090
+			$query .= "AND date > '".$sincedate."' ";
1091
+		}
1072 1092
 		$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1073
-		if ($limit) $query .= " LIMIT 0,10";
1093
+		if ($limit) {
1094
+			$query .= " LIMIT 0,10";
1095
+		}
1074 1096
 
1075 1097
 
1076 1098
 		$sth = $this->db->prepare($query);
@@ -1112,9 +1134,13 @@  discard block
 block discarded – undo
1112 1134
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1113 1135
 			}
1114 1136
 		}
1115
-		if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1137
+		if ($sincedate != '') {
1138
+			$query .= "AND s.date > '".$sincedate."' ";
1139
+		}
1116 1140
 		$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1117
-		if ($limit) $query .= " LIMIT 0,10";
1141
+		if ($limit) {
1142
+			$query .= " LIMIT 0,10";
1143
+		}
1118 1144
 
1119 1145
 
1120 1146
 		$sth = $this->db->prepare($query);
@@ -1331,8 +1357,11 @@  discard block
 block discarded – undo
1331 1357
 			if($row['registration'] != "")
1332 1358
 			{
1333 1359
 				$image_array = $Image->getSpotterImage($row['registration']);
1334
-				if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
1335
-				else $temp_array['image_thumbnail'] = '';
1360
+				if (isset($image_array[0]['image_thumbnail'])) {
1361
+					$temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
1362
+				} else {
1363
+					$temp_array['image_thumbnail'] = '';
1364
+				}
1336 1365
 			}
1337 1366
 			$temp_array['registration_count'] = $row['registration_count'];
1338 1367
 			$aircraft_array[] = $temp_array;
@@ -1389,7 +1418,9 @@  discard block
 block discarded – undo
1389 1418
 			date_default_timezone_set($globalTimezone);
1390 1419
 			$datetime = new DateTime();
1391 1420
 			$offset = $datetime->format('P');
1392
-		} else $offset = '+00:00';
1421
+		} else {
1422
+			$offset = '+00:00';
1423
+		}
1393 1424
 		if ($globalDBdriver == 'mysql') {
1394 1425
 			$query  = "SELECT HOUR(CONVERT_TZ(spotter_archive_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1395 1426
 			    FROM spotter_archive_output".$filter_query." spotter_archive_output.owner_name = :owner 
Please login to merge, or discard this patch.
owner-statistics-arrival-airport-country.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort, $filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-statistics-aircraft.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-detailed.php 1 patch
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,8 +45,12 @@  discard block
 block discarded – undo
45 45
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46 46
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
47 47
 	$filter = array();
48
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
49
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
48
+	if ($year != '') {
49
+		$filter = array_merge($filter,array('year' => $year));
50
+	}
51
+	if ($month != '') {
52
+		$filter = array_merge($filter,array('month' => $month));
53
+	}
50 54
 	$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
51 55
 	if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
52 56
 		$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -56,16 +60,25 @@  discard block
 block discarded – undo
56 60
 	{
57 61
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
58 62
 		//$ident = $spotter_array[0]['ident'];
59
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
63
+		if (isset($spotter_array[0]['latitude'])) {
64
+			$latitude = $spotter_array[0]['latitude'];
65
+		}
66
+		if (isset($spotter_array[0]['longitude'])) {
67
+			$longitude = $spotter_array[0]['longitude'];
68
+		}
61 69
 		require_once('header.php');
62 70
 		print '<div class="info column">';
63 71
 		print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
64 72
 		//print '<div><span class="label">'._("Owner").'</span>'.$spotter_array[0]['aircraft_owner'].'</div>';
65 73
 		$Stats = new Stats();
66
-		if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
67
-		else $flights = 0;
68
-		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
74
+		if ($year == '' && $month == '') {
75
+			$flights = $Stats->getStatsOwner($owner);
76
+		} else {
77
+			$flights = 0;
78
+		}
79
+		if ($flights == 0) {
80
+			$flights = $Spotter->countFlightsByOwner($owner,$filter);
81
+		}
69 82
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
70 83
 		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
71 84
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
@@ -76,7 +89,9 @@  discard block
 block discarded – undo
76 89
 		$airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
77 90
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
78 91
 		$duration = $Spotter->getFlightDurationByOwner($owner,$filter);
79
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
92
+		if ($duration != '0') {
93
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
94
+		}
80 95
 		print '</div>';
81 96
 	
82 97
 		include('owner-sub-menu.php');
Please login to merge, or discard this patch.
owner-statistics-arrival-airport.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-statistics-route.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.