Completed
Push — master ( 3d8cb5...5a808c )
by Yannick
07:32
created
pilot-statistics-registration.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
owner-statistics-manufacturer.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
pilot-statistics-manufacturer.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
pilot-statistics-departure-airport-country.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
pilot-statistics-arrival-airport-country.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
owner-statistics-airline.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,12 @@
 block discarded – undo
12 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
15
+if ($year != '') {
16
+	$filter = array_merge($filter,array('year' => $year));
17
+}
18
+if ($month != '') {
19
+	$filter = array_merge($filter,array('month' => $month));
20
+}
17 21
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
18 22
 
19 23
 if (!empty($spotter_array))
Please login to merge, or discard this patch.
pilot-detailed.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -39,8 +39,12 @@  discard block
 block discarded – undo
39 39
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
40 40
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
41 41
 	$filter = array();
42
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
43
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
42
+	if ($year != '') {
43
+		$filter = array_merge($filter,array('year' => $year));
44
+	}
45
+	if ($month != '') {
46
+		$filter = array_merge($filter,array('month' => $month));
47
+	}
44 48
 	if ($sort != '') 
45 49
 	{
46 50
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -58,8 +62,12 @@  discard block
 block discarded – undo
58 62
 	{
59 63
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
60 64
 		$ident = $spotter_array[0]['ident'];
61
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
62
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
65
+		if (isset($spotter_array[0]['latitude'])) {
66
+			$latitude = $spotter_array[0]['latitude'];
67
+		}
68
+		if (isset($spotter_array[0]['longitude'])) {
69
+			$longitude = $spotter_array[0]['longitude'];
70
+		}
63 71
 		require_once('header.php');
64 72
 		/*
65 73
 		if (isset($globalArchive) && $globalArchive) {
@@ -112,12 +120,18 @@  discard block
 block discarded – undo
112 120
 		*/
113 121
 		print '<div class="info column">';
114 122
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
115
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
123
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
124
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
125
+		}
116 126
 		if ($year == '' && $month == '') {
117 127
 			$Stats = new Stats();
118 128
 			$flights = $Stats->getStatsPilot($pilot);
119
-		} else $flights = 0;
120
-		if ($flight == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
129
+		} else {
130
+			$flights = 0;
131
+		}
132
+		if ($flight == 0) {
133
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
134
+		}
121 135
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
122 136
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
123 137
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
@@ -128,7 +142,9 @@  discard block
 block discarded – undo
128 142
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
129 143
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
130 144
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
131
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
145
+		if ($duration != '0') {
146
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
147
+		}
132 148
 		print '</div>';
133 149
 	
134 150
 		include('owner-sub-menu.php');
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
@@ -40,8 +40,12 @@  discard block
 block discarded – undo
40 40
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
41 41
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
42 42
 	$filter = array();
43
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
44
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
43
+	if ($year != '') {
44
+		$filter = array_merge($filter,array('year' => $year));
45
+	}
46
+	if ($month != '') {
47
+		$filter = array_merge($filter,array('month' => $month));
48
+	}
45 49
 	if ($sort != '') 
46 50
 	{
47 51
 		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -59,8 +63,12 @@  discard block
 block discarded – undo
59 63
 	{
60 64
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
61 65
 		//$ident = $spotter_array[0]['ident'];
62
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
63
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
66
+		if (isset($spotter_array[0]['latitude'])) {
67
+			$latitude = $spotter_array[0]['latitude'];
68
+		}
69
+		if (isset($spotter_array[0]['longitude'])) {
70
+			$longitude = $spotter_array[0]['longitude'];
71
+		}
64 72
 		require_once('header.php');
65 73
 		/*
66 74
 		if (isset($globalArchive) && $globalArchive) {
@@ -115,9 +123,14 @@  discard block
 block discarded – undo
115 123
 		print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
116 124
 		//print '<div><span class="label">'._("Owner").'</span>'.$spotter_array[0]['aircraft_owner'].'</div>';
117 125
 		$Stats = new Stats();
118
-		if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
119
-		else $flights = 0;
120
-		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
126
+		if ($year == '' && $month == '') {
127
+			$flights = $Stats->getStatsOwner($owner);
128
+		} else {
129
+			$flights = 0;
130
+		}
131
+		if ($flights == 0) {
132
+			$flights = $Spotter->countFlightsByOwner($owner,$filter);
133
+		}
121 134
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
122 135
 		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
123 136
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
@@ -128,7 +141,9 @@  discard block
 block discarded – undo
128 141
 		$airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
129 142
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
130 143
 		$duration = $Spotter->getFlightDurationByOwner($owner,$filter);
131
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
144
+		if ($duration != '0') {
145
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
146
+		}
132 147
 		print '</div>';
133 148
 	
134 149
 		include('owner-sub-menu.php');
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Braces   +37 added lines, -13 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 	if (isset($filter[0]['source'])) {
27 27
 		$filters = array_merge($filters,$filter);
28 28
 	}
29
-	if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+	if (is_array($globalFilter)) {
30
+		$filter = array_merge($filter,$globalFilter);
31
+	}
30 32
 	$filter_query_join = '';
31 33
 	$filter_query_where = '';
32 34
 	foreach($filters as $flt) {
@@ -99,8 +101,11 @@  discard block
 block discarded – undo
99 101
 	    }
100 102
 	    $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";
101 103
 	}
102
-	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
103
-	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
104
+	if ($filter_query_where == '' && $where) {
105
+		$filter_query_where = ' WHERE';
106
+	} elseif ($filter_query_where != '' && $and) {
107
+		$filter_query_where .= ' AND';
108
+	}
104 109
 	if ($filter_query_where != '') {
105 110
 		$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
106 111
 	}
@@ -114,10 +119,17 @@  discard block
 block discarded – undo
114 119
 		if ($over_country == '') {
115 120
 			$Spotter = new Spotter($this->db);
116 121
 			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
117
-			if (!empty($data_country)) $country = $data_country['iso2'];
118
-			else $country = '';
119
-		} else $country = $over_country;
120
-		if ($airline_type === NULL) $airline_type ='';
122
+			if (!empty($data_country)) {
123
+				$country = $data_country['iso2'];
124
+			} else {
125
+				$country = '';
126
+			}
127
+		} else {
128
+			$country = $over_country;
129
+		}
130
+		if ($airline_type === NULL) {
131
+			$airline_type ='';
132
+		}
121 133
 	
122 134
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
123 135
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -620,7 +632,9 @@  discard block
 block discarded – undo
620 632
 		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
621 633
 		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
622 634
 		    $translate = $Translation->ident2icao($q_item);
623
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
635
+		    if ($translate != $q_item) {
636
+		    	$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
637
+		    }
624 638
 		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
625 639
 		    $additional_query .= ")";
626 640
 		}
@@ -838,7 +852,9 @@  discard block
 block discarded – undo
838 852
 		date_default_timezone_set($globalTimezone);
839 853
 		$datetime = new DateTime();
840 854
 		$offset = $datetime->format('P');
841
-	    } else $offset = '+00:00';
855
+	    } else {
856
+	    	$offset = '+00:00';
857
+	    }
842 858
 
843 859
 
844 860
 	    if ($date_array[1] != "")
@@ -1114,9 +1130,13 @@  discard block
 block discarded – undo
1114 1130
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1115 1131
 			}
1116 1132
 		}
1117
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1133
+                if ($sincedate != '') {
1134
+                	$query .= "AND date > '".$sincedate."' ";
1135
+                }
1118 1136
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1119
-	if ($limit) $query .= " LIMIT 0,10";
1137
+	if ($limit) {
1138
+		$query .= " LIMIT 0,10";
1139
+	}
1120 1140
       
1121 1141
 	
1122 1142
 	$sth = $this->db->prepare($query);
@@ -1160,9 +1180,13 @@  discard block
 block discarded – undo
1160 1180
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1161 1181
 			}
1162 1182
 		}
1163
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1183
+                if ($sincedate != '') {
1184
+                	$query .= "AND s.date > '".$sincedate."' ";
1185
+                }
1164 1186
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1165
-	if ($limit) $query .= " LIMIT 0,10";
1187
+	if ($limit) {
1188
+		$query .= " LIMIT 0,10";
1189
+	}
1166 1190
       
1167 1191
 	
1168 1192
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.