Completed
Push — master ( 465dcf...e879ed )
by Yannick
05:41
created
require/class.SpotterArchive.php 1 patch
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
     */
16 16
     public function getFilter($filter = array(),$where = false,$and = false) {
17 17
 	global $globalFilter, $globalStatsFilters, $globalFilterName;
18
-	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
19
-	if (is_array($globalFilter)) $filter = array_merge($globalFilter,$filter);
18
+	if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
19
+		$filter = array_merge($globalStatsFilters[$globalFilterName],$filter);
20
+	}
21
+	if (is_array($globalFilter)) {
22
+		$filter = array_merge($globalFilter,$filter);
23
+	}
20 24
 	$filter_query_join = '';
21 25
 	$filter_query_where = '';
22 26
 	if (isset($filter['airlines']) && !empty($filter['airlines'])) {
@@ -44,8 +48,11 @@  discard block
 block discarded – undo
44 48
 		$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
45 49
 	    }
46 50
 	}
47
-	if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
48
-	elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
51
+	if ($filter_query_where == '' && $where) {
52
+		$filter_query_where = ' WHERE';
53
+	} elseif ($filter_query_where != '' && $and) {
54
+		$filter_query_where .= ' AND';
55
+	}
49 56
 	$filter_query = $filter_query_join.$filter_query_where;
50 57
 	return $filter_query;
51 58
     }
@@ -56,10 +63,17 @@  discard block
 block discarded – undo
56 63
 		if ($over_country == '') {
57 64
 			$Spotter = new Spotter($this->db);
58 65
 			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
59
-			if (!empty($data_country)) $country = $data_country['iso2'];
60
-			else $country = '';
61
-		} else $country = $over_country;
62
-		if ($airline_type === NULL) $airline_type ='';
66
+			if (!empty($data_country)) {
67
+				$country = $data_country['iso2'];
68
+			} else {
69
+				$country = '';
70
+			}
71
+		} else {
72
+			$country = $over_country;
73
+		}
74
+		if ($airline_type === NULL) {
75
+			$airline_type ='';
76
+		}
63 77
 	
64 78
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
65 79
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -562,7 +576,9 @@  discard block
 block discarded – undo
562 576
 		    $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
563 577
 		    $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
564 578
 		    $translate = $Translation->ident2icao($q_item);
565
-		    if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
579
+		    if ($translate != $q_item) {
580
+		    	$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
581
+		    }
566 582
 		    $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
567 583
 		    $additional_query .= ")";
568 584
 		}
@@ -780,7 +796,9 @@  discard block
 block discarded – undo
780 796
 		date_default_timezone_set($globalTimezone);
781 797
 		$datetime = new DateTime();
782 798
 		$offset = $datetime->format('P');
783
-	    } else $offset = '+00:00';
799
+	    } else {
800
+	    	$offset = '+00:00';
801
+	    }
784 802
 
785 803
 
786 804
 	    if ($date_array[1] != "")
@@ -944,9 +962,13 @@  discard block
 block discarded – undo
944 962
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
945 963
 			}
946 964
 		}
947
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
965
+                if ($sincedate != '') {
966
+                	$query .= "AND date > '".$sincedate."' ";
967
+                }
948 968
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
949
-	if ($limit) $query .= " LIMIT 0,10";
969
+	if ($limit) {
970
+		$query .= " LIMIT 0,10";
971
+	}
950 972
       
951 973
 	
952 974
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.