Completed
Push — master ( baa1fe...14925d )
by Yannick
164:26 queued 132:19
created
import/callback.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/../require/class.Source.php');
10 10
 require_once(dirname(__FILE__).'/../require/class.Connection.php');
11 11
 require_once(dirname(__FILE__).'/../require/class.Common.php');
12
-$Common=new Common();
12
+$Common = new Common();
13 13
 $authorize = false;
14 14
 $params = array();
15 15
 $userip = $Common->getUserIP();
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 			$authorize = true;
21 21
 			break;
22 22
 		}
23
-		if ($userip != '' && isset($cb['host']) && in_array($userip,explode(',',$cb['host']))) {
23
+		if ($userip != '' && isset($cb['host']) && in_array($userip, explode(',', $cb['host']))) {
24 24
 			$params = $globalSources[$key];
25 25
 			$authorize = true;
26 26
 			break;
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
 
47 47
 if (isset($globalServer) && $globalServer) {
48 48
 	if ($globalDebug) echo "Using Server Mode\n";
49
-	$SI=new SpotterServer();
50
-} else $SI=new SpotterImport($Connection->db);
49
+	$SI = new SpotterServer();
50
+} else $SI = new SpotterImport($Connection->db);
51 51
 if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
52 52
 if (isset($globalMarine) && $globalMarine) {
53 53
 	$AIS = new AIS();
54 54
 	$MI = new MarineImport($Connection->db);
55 55
 }
56
-$Source=new Source($Connection->db);
56
+$Source = new Source($Connection->db);
57 57
 date_default_timezone_set('UTC');
58 58
 
59 59
 $buffer = '';
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	$data['altitude'] = round($buffer['altitude']*3.28084);
67 67
 	$data['speed'] = $buffer['speed'];
68 68
 	//$data['heading'] = $buffer['cap']; // Only N/S/E/W
69
-	$data['datetime'] = date('Y-m-d H:i:s',$buffer['timestamp']);
69
+	$data['datetime'] = date('Y-m-d H:i:s', $buffer['timestamp']);
70 70
 	$data['comment'] = '';
71 71
 	if (isset($buffer['battery']) && $buffer['battery'] != '') $data['comment'] .= 'Battery: '.$buffer['battery'].'% ';
72 72
 	//if (isset($buffer['snr']) && $buffer['snr'] != '') $data['comment'] .= 'SNR: '.$buffer['snr'].' ';
Please login to merge, or discard this patch.
tools-geoid.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
 $page_url = $globalURL.'/tools-geoid';
14 14
 
15
-$latitude = filter_input(INPUT_POST,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
16
-$longitude = filter_input(INPUT_POST,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
17
-$altitude = filter_input(INPUT_POST,'altitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
15
+$latitude = filter_input(INPUT_POST, 'latitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
16
+$longitude = filter_input(INPUT_POST, 'longitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
17
+$altitude = filter_input(INPUT_POST, 'altitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
18 18
 
19 19
 print '<div class="info column">';
20 20
 print '<h1>'._("Geoid Height Calculator").'</h1>';
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
 
52 52
 if ($latitude != '' && $longitude != '') {
53 53
 	$globalDebug = FALSE;
54
-	$geoid = $GeoidHeight->get($latitude,$longitude);
54
+	$geoid = $GeoidHeight->get($latitude, $longitude);
55 55
 	print '<div class="row">';
56 56
 	print '<div class="col-md-3 col-md-offset-5">';
57 57
 	print '<div class="col-sm-6"><b>Geoid</b></div>';
58 58
 	print '<div class="col-sm-6">'.$geoid.'</div>';
59 59
 	if ($altitude != '') {
60 60
 		print '<div class="col-sm-6"><b>AMSL Elevation</b></div>';
61
-		print '<div class="col-sm-6">'.round($altitude-$geoid,3).'</div>';
61
+		print '<div class="col-sm-6">'.round($altitude - $geoid, 3).'</div>';
62 62
 	}
63 63
 	print '<div class="col-sm-6"><b>Earth Gravity Model</b></div>';
64 64
 	if (isset($globalGeoidSource) && $globalGeoidSource != '') $geoidsource = $globalGeoidSource;
Please login to merge, or discard this patch.
require/class.ATC.php 1 patch
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -14,22 +14,22 @@  discard block
 block discarded – undo
14 14
 	* @param Array $filter the filter
15 15
 	* @return Array the SQL part
16 16
 	*/
17
-	public function getFilter($filter = array(),$where = false,$and = false) {
17
+	public function getFilter($filter = array(), $where = false, $and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
19 19
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
20 20
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21
-				foreach($globalStatsFilters[$globalFilterName] as $source) {
21
+				foreach ($globalStatsFilters[$globalFilterName] as $source) {
22 22
 					if (isset($source['source'])) $filter['source'][] = $source['source'];
23 23
 				}
24 24
 			} else {
25 25
 				$filter = $globalStatsFilters[$globalFilterName];
26 26
 			}
27 27
 		}
28
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
28
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
29 29
 		$filter_query_join = '';
30 30
 		$filter_query_where = '';
31 31
 		if (isset($filter['source']) && !empty($filter['source'])) {
32
-			$filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')";
32
+			$filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')";
33 33
 		}
34 34
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
35 35
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		try {
45 45
 			$sth = $this->db->prepare($query);
46 46
 			$sth->execute($query_values);
47
-		} catch(PDOException $e) {
47
+		} catch (PDOException $e) {
48 48
 			return "error : ".$e->getMessage();
49 49
 		}
50 50
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -52,66 +52,66 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	public function getById($id) {
55
-		$filter_query = $this->getFilter(array(),true);
55
+		$filter_query = $this->getFilter(array(), true);
56 56
 		$query = "SELECT * FROM atc".$filter_query." atc_id = :id";
57 57
 		$query_values = array(':id' => $id);
58 58
 		try {
59 59
 			$sth = $this->db->prepare($query);
60 60
 			$sth->execute($query_values);
61
-		} catch(PDOException $e) {
61
+		} catch (PDOException $e) {
62 62
 			return "error : ".$e->getMessage();
63 63
 		}
64 64
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
65 65
 		return $all;
66 66
 	}
67 67
 
68
-	public function getByIdent($ident,$format_source = '') {
69
-		$filter_query = $this->getFilter(array(),true);
68
+	public function getByIdent($ident, $format_source = '') {
69
+		$filter_query = $this->getFilter(array(), true);
70 70
 		if ($format_source == '') {
71 71
 			$query = "SELECT * FROM atc".$filter_query." ident = :ident";
72 72
 			$query_values = array(':ident' => $ident);
73 73
 		} else {
74 74
 			$query = "SELECT * FROM atc".$filter_query." ident = :ident AND format_source = :format_source";
75
-			$query_values = array(':ident' => $ident,':format_source' => $format_source);
75
+			$query_values = array(':ident' => $ident, ':format_source' => $format_source);
76 76
 		}
77 77
 		try {
78 78
 			$sth = $this->db->prepare($query);
79 79
 			$sth->execute($query_values);
80
-		} catch(PDOException $e) {
80
+		} catch (PDOException $e) {
81 81
 			return "error : ".$e->getMessage();
82 82
 		}
83 83
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
84 84
 		return $all;
85 85
 	}
86 86
 
87
-	public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
88
-		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
89
-		$info = str_replace('^','<br />',$info);
90
-		$info = str_replace('&amp;sect;','',$info);
91
-		$info = str_replace('"','',$info);
87
+	public function add($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') {
88
+		$info = preg_replace('/[^(\x20-\x7F)]*/', '', $info);
89
+		$info = str_replace('^', '<br />', $info);
90
+		$info = str_replace('&amp;sect;', '', $info);
91
+		$info = str_replace('"', '', $info);
92 92
 		if ($type == '') $type = NULL;
93 93
 		$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)";
94
-		$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);
94
+		$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);
95 95
 		try {
96 96
 			$sth = $this->db->prepare($query);
97 97
 			$sth->execute($query_values);
98
-		} catch(PDOException $e) {
98
+		} catch (PDOException $e) {
99 99
 			return "error : ".$e->getMessage();
100 100
 		}
101 101
 	}
102 102
 
103
-	public function update($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') {
104
-		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
105
-		$info = str_replace('^','<br />',$info);
106
-		$info = str_replace('&amp;sect;','',$info);
107
-		$info = str_replace('"','',$info);
103
+	public function update($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') {
104
+		$info = preg_replace('/[^(\x20-\x7F)]*/', '', $info);
105
+		$info = str_replace('^', '<br />', $info);
106
+		$info = str_replace('&amp;sect;', '', $info);
107
+		$info = str_replace('"', '', $info);
108 108
 		if ($type == '') $type = NULL;
109 109
 		$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";
110
-		$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);
110
+		$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);
111 111
 		try {
112 112
 			$sth = $this->db->prepare($query);
113 113
 			$sth->execute($query_values);
114
-		} catch(PDOException $e) {
114
+		} catch (PDOException $e) {
115 115
 			return "error : ".$e->getMessage();
116 116
 		}
117 117
 	}
@@ -122,18 +122,18 @@  discard block
 block discarded – undo
122 122
 		try {
123 123
 			$sth = $this->db->prepare($query);
124 124
 			$sth->execute($query_values);
125
-		} catch(PDOException $e) {
125
+		} catch (PDOException $e) {
126 126
 			return "error : ".$e->getMessage();
127 127
 		}
128 128
 	}
129 129
 
130
-	public function deleteByIdent($ident,$format_source) {
130
+	public function deleteByIdent($ident, $format_source) {
131 131
 		$query = "DELETE FROM atc WHERE ident = :ident AND format_source = :format_source";
132
-		$query_values = array(':ident' => $ident,':format_source' => $format_source);
132
+		$query_values = array(':ident' => $ident, ':format_source' => $format_source);
133 133
 		try {
134 134
 			$sth = $this->db->prepare($query);
135 135
 			$sth->execute($query_values);
136
-		} catch(PDOException $e) {
136
+		} catch (PDOException $e) {
137 137
 			return "error : ".$e->getMessage();
138 138
 		}
139 139
 	}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 		try {
145 145
 			$sth = $this->db->prepare($query);
146 146
 			$sth->execute($query_values);
147
-		} catch(PDOException $e) {
147
+		} catch (PDOException $e) {
148 148
 			return "error : ".$e->getMessage();
149 149
 		}
150 150
 	}
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 		try {
160 160
 			$sth = $this->db->prepare($query);
161 161
 			$sth->execute();
162
-		} catch(PDOException $e) {
162
+		} catch (PDOException $e) {
163 163
 			return "error";
164 164
 		}
165 165
 		return "success";
Please login to merge, or discard this patch.
require/class.METAR.php 1 patch
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			$Connection = new Connection();
55 55
 			$sth = $Connection->db->prepare($query);
56 56
 			$sth->execute();
57
-		} catch(PDOException $e) {
57
+		} catch (PDOException $e) {
58 58
 			return "error : ".$e->getMessage();
59 59
 		}
60 60
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 			$Connection = new Connection();
71 71
 			$sth = $Connection->db->prepare($query);
72 72
 			$sth->execute();
73
-		} catch(PDOException $e) {
73
+		} catch (PDOException $e) {
74 74
 			return "error : ".$e->getMessage();
75 75
 		}
76 76
 	}
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
 	public function parse($data) {
79 79
 		//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
80 80
 		$codes = implode('|', array_keys($this->texts));
81
-		$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
81
+		$regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#';
82 82
 		//$pieces = explode(' ',$data);
83
-		$pieces = preg_split('/\s/',$data);
83
+		$pieces = preg_split('/\s/', $data);
84 84
 		$pos = 0;
85 85
 		if ($pieces[0] == 'METAR') $pos++;
86 86
 		elseif ($pieces[0] == 'SPECI') $pos++;
@@ -88,25 +88,25 @@  discard block
 block discarded – undo
88 88
 		$result = array();
89 89
 		$result['location'] = $pieces[$pos];
90 90
 		$pos++;
91
-		$result['dayofmonth'] = substr($pieces[$pos],0,2);
92
-		$result['time'] = substr($pieces[$pos],2,4);
91
+		$result['dayofmonth'] = substr($pieces[$pos], 0, 2);
92
+		$result['time'] = substr($pieces[$pos], 2, 4);
93 93
 		$c = count($pieces);
94
-		for($pos++; $pos < $c; $pos++) {
94
+		for ($pos++; $pos < $c; $pos++) {
95 95
 			$piece = $pieces[$pos];
96 96
 			if ($piece == 'RMK') break;
97 97
 			if ($piece == 'AUTO') $result['auto'] = true;
98 98
 			if ($piece == 'COR') $result['correction'] = true;
99 99
 			// Wind Speed
100 100
 			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
101
-				$result['wind']['direction'] = (float)$matches[1];
101
+				$result['wind']['direction'] = (float) $matches[1];
102 102
 				$result['wind']['unit'] = $matches[4];
103
-				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
104
-				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
105
-				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
106
-				$result['wind']['gust'] = (float)$matches[3];
103
+				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2);
104
+				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2);
105
+				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2);
106
+				$result['wind']['gust'] = (float) $matches[3];
107 107
 				$result['wind']['unit'] = $matches[4];
108
-				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
109
-				$result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0;
108
+				$result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0;
109
+				$result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0;
110 110
 			}
111 111
 
112 112
 /*    			if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) {
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 
128 128
 			// Temperature
129 129
 			if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
130
-				$temp = (float)$matches[1];
130
+				$temp = (float) $matches[1];
131 131
 				if ($matches[1]{0} == 'M') {
132
-					$temp = ((float)substr($matches[1], 1)) * -1;
132
+					$temp = ((float) substr($matches[1], 1))*-1;
133 133
 				}
134 134
 				$result['temperature'] = $temp;
135
-				$dew = (float)$matches[2];
135
+				$dew = (float) $matches[2];
136 136
 				if ($matches[2]{0} == 'M') {
137
-					$dew = ((float)substr($matches[2], 1)) * -1;
137
+					$dew = ((float) substr($matches[2], 1))*-1;
138 138
 				}
139 139
 				$result['dew'] = $dew;
140 140
 			}
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 					$result['QNH'] = $matches[2];
147 147
 				} else {
148 148
 					// inHg
149
-					$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
149
+					$result['QNH'] = round(($matches[2]/100)*33.86389, 2);
150 150
 				}
151 151
 				/*
152 152
     				$result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100);
@@ -167,12 +167,12 @@  discard block
 block discarded – undo
167 167
     			// Visibility
168 168
 			if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
169 169
 				if (isset($matches[3]) && strlen($matches[3]) > 0) {
170
-					$result['visibility'] = (float)$matches[3] * 1609.34;
170
+					$result['visibility'] = (float) $matches[3]*1609.34;
171 171
 				} else {
172 172
 					if ($matches[1] == '9999') {
173 173
 						$result['visibility'] = '> 10000';
174 174
 					} else {
175
-						$result['visibility'] = (float)$matches[1];
175
+						$result['visibility'] = (float) $matches[1];
176 176
 					}
177 177
 				}
178 178
 				if (preg_match('#^CAVOK$#', $piece, $matches)) {
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
195 195
 				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
196 196
 				$cloud['type_code'] = $type;
197
-				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
197
+				$cloud['level'] = round(((float) $matches[2])*100*0.3048);
198 198
 				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
199 199
 				$result['cloud'][] = $cloud;
200 200
 			}
@@ -204,8 +204,8 @@  discard block
 block discarded – undo
204 204
 				$rvr['runway'] = $matches[1];
205 205
 				$rvr['assessment'] = $matches[2];
206 206
 				$rvr['rvr'] = $matches[3];
207
-				$rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0;
208
-				$rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : '';
207
+				$rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0;
208
+				$rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : '';
209 209
 				$result['RVR'] = $rvr;
210 210
 			}
211 211
 			//if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 				$result['RVR']['friction'] = $matches[5];
219 219
 			}
220 220
 			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
221
-				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
222
-				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
221
+				if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
222
+				else $range = array('exact' => (float) $matches[2], 'unit' => 'M');
223 223
 				if (isset($matches[3])) {
224 224
 					$range = Array(
225
-					    'from' => (float)$matches[2],
226
-					    'to'   => (float)$matches[4],
225
+					    'from' => (float) $matches[2],
226
+					    'to'   => (float) $matches[4],
227 227
 					    'unit' => $matches[5] ? 'FT' : 'M'
228 228
 					);
229 229
 				}
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		try {
272 272
 			$sth = $this->db->prepare($query);
273 273
 			$sth->execute($query_values);
274
-		} catch(PDOException $e) {
274
+		} catch (PDOException $e) {
275 275
 			return "error : ".$e->getMessage();
276 276
 		}
277 277
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -281,19 +281,19 @@  discard block
 block discarded – undo
281 281
 		return $all;
282 282
 	}
283 283
 
284
-	public function addMETAR($location,$metar,$date) {
284
+	public function addMETAR($location, $metar, $date) {
285 285
 		global $globalDBdriver;
286
-		$date = date('Y-m-d H:i:s',strtotime($date));
286
+		$date = date('Y-m-d H:i:s', strtotime($date));
287 287
 		if ($globalDBdriver == 'mysql') {
288 288
 			$query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar";
289 289
 		} else {
290 290
 			$query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);";
291 291
 		}
292
-		$query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
292
+		$query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar));
293 293
 		try {
294 294
 			$sth = $this->db->prepare($query);
295 295
 			$sth->execute($query_values);
296
-		} catch(PDOException $e) {
296
+		} catch (PDOException $e) {
297 297
 			return "error : ".$e->getMessage();
298 298
 		}
299 299
 	}
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 		try {
305 305
 			$sth = $this->db->prepare($query);
306 306
 			$sth->execute($query_values);
307
-		} catch(PDOException $e) {
307
+		} catch (PDOException $e) {
308 308
 			return "error : ".$e->getMessage();
309 309
 		}
310 310
 	}
@@ -314,7 +314,7 @@  discard block
 block discarded – undo
314 314
 		try {
315 315
 			$sth = $this->db->prepare($query);
316 316
 			$sth->execute();
317
-		} catch(PDOException $e) {
317
+		} catch (PDOException $e) {
318 318
 			return "error : ".$e->getMessage();
319 319
 		}
320 320
 	}
@@ -325,27 +325,27 @@  discard block
 block discarded – undo
325 325
 		date_default_timezone_set("UTC");
326 326
 		$Common = new Common();
327 327
 		if (isset($globalIVAO) && $globalIVAO) {
328
-			$Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt');
329
-			$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r");
328
+			$Common->download('http://wx.ivao.aero/metar.php', dirname(__FILE__).'/../install/tmp/ivaometar.txt');
329
+			$handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt', "r");
330 330
 		} else {
331
-			$Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT');
332
-			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
331
+			$Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT', dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT');
332
+			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT', "r");
333 333
 		}
334 334
 		if ($handle) {
335 335
 			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
336 336
 			$date = '';
337 337
 			if ($globalTransaction) $this->db->beginTransaction();
338
-			while(($line = fgets($handle,4096)) !== false) {
339
-				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
338
+			while (($line = fgets($handle, 4096)) !== false) {
339
+				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) {
340 340
 					$date = $line;
341 341
 				} elseif ($line != '') {
342 342
 					if ($date == '') $date = date('Y/m/d H:m');
343 343
 					$pos = 0;
344
-					$pieces = preg_split('/\s/',$line);
344
+					$pieces = preg_split('/\s/', $line);
345 345
 					if ($pieces[0] == 'METAR') $pos++;
346 346
 					if (strlen($pieces[$pos]) != 4) $pos++;
347 347
 					$location = $pieces[$pos];
348
-					echo $this->addMETAR($location,$line,$date);
348
+					echo $this->addMETAR($location, $line, $date);
349 349
 				}
350 350
 			}
351 351
 			fclose($handle);
@@ -359,22 +359,22 @@  discard block
 block discarded – undo
359 359
 		if ($globalMETARurl == '') return array();
360 360
 		date_default_timezone_set("UTC");
361 361
 		$Common = new Common();
362
-		$url = str_replace('{icao}',$icao,$globalMETARurl);
362
+		$url = str_replace('{icao}', $icao, $globalMETARurl);
363 363
 		$cycle = $Common->getData($url);
364 364
 		$date = '';
365
-		foreach(explode("\n",$cycle) as $line) {
366
-			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
365
+		foreach (explode("\n", $cycle) as $line) {
366
+			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) {
367 367
 				$date = $line;
368 368
 			} 
369 369
 			if ($line != '') {
370 370
 				if ($date == '') $date = date('Y/m/d H:m');
371 371
 				$pos = 0;
372
-				$pieces = preg_split('/\s/',$line);
372
+				$pieces = preg_split('/\s/', $line);
373 373
 				if ($pieces[0] == 'METAR') $pos++;
374 374
 				if (strlen($pieces[$pos]) != 4) $pos++;
375 375
 				$location = $pieces[$pos];
376 376
 				if (strlen($location == 4)) {
377
-					$this->addMETAR($location,$line,$date);
377
+					$this->addMETAR($location, $line, $date);
378 378
 					return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
379 379
 				} else return array();
380 380
 			}
Please login to merge, or discard this patch.
flightid-overview.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING);
2
+$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING);
3 3
 if ($id == "")
4 4
 {
5 5
 	header('Location: /');
@@ -16,30 +16,30 @@  discard block
 block discarded – undo
16 16
 
17 17
 if (!empty($spotter_array))
18 18
 {
19
-	if(isset($spotter_array[0]['flightaware_id'])) {
19
+	if (isset($spotter_array[0]['flightaware_id'])) {
20 20
 		$flightaware_id = $spotter_array[0]['flightaware_id'];
21 21
 	}
22
-	if(isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') {
22
+	if (isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') {
23 23
 		$latitude = $spotter_array[0]['last_latitude'];
24
-	} elseif(isset($spotter_array[0]['latitude'])) {
24
+	} elseif (isset($spotter_array[0]['latitude'])) {
25 25
 		$latitude = $spotter_array[0]['latitude'];
26 26
 	}
27
-	if(isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') {
27
+	if (isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') {
28 28
 		$longitude = $spotter_array[0]['last_longitude'];
29
-	} elseif(isset($spotter_array[0]['longitude'])) {
29
+	} elseif (isset($spotter_array[0]['longitude'])) {
30 30
 		$longitude = $spotter_array[0]['longitude'];
31 31
 	}
32 32
 	$title = '';
33
-	if(isset($spotter_array[0]['ident'])) {
33
+	if (isset($spotter_array[0]['ident'])) {
34 34
 		$title .= $spotter_array[0]['ident'];
35 35
 	}
36
-	if(isset($spotter_array[0]['airline_name'])) {
36
+	if (isset($spotter_array[0]['airline_name'])) {
37 37
 		$title .= ' - '.$spotter_array[0]['airline_name'];
38 38
 	}
39
-	if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') {
39
+	if (isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') {
40 40
 		$title .= ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')';
41 41
 	}
42
-	if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') {
42
+	if (isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') {
43 43
 		$title .= ' - '.$spotter_array[0]['registration'];
44 44
 	}
45 45
 	//$facebook_meta_image = $spotter_array[0]['image'];
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			$altitude_data = '';
60 60
 			$hour_data = '';
61 61
 			$speed_data = '';
62
-			foreach($all_data as $data)
62
+			foreach ($all_data as $data)
63 63
 			{
64 64
 				$hour_data .= '"'.$data['date'].'",';
65 65
 				if (isset($data['real_altitude']) && $data['real_altitude'] != '') {
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 				$speed_data .= $speed.',';
88 88
 			}
89 89
 			$hour_data = "['x',".substr($hour_data, 0, -1)."]";
90
-			$altitude_data = "['altitude',".substr($altitude_data,0,-1)."]";
91
-			$speed_data = "['speed',".substr($speed_data,0,-1)."]";
90
+			$altitude_data = "['altitude',".substr($altitude_data, 0, -1)."]";
91
+			$speed_data = "['speed',".substr($speed_data, 0, -1)."]";
92 92
 			print 'c3.generate({
93 93
 			    bindto: "#chart",
94 94
 			    data: {
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
 			print '<a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a> ';
135 135
 		}
136 136
 	}
137
-	if(isset($spotter_array[0]['ident'])) {
137
+	if (isset($spotter_array[0]['ident'])) {
138 138
 		print $spotter_array[0]['ident'];
139 139
 	}
140
-	if(isset($spotter_array[0]['airline_name'])) {
140
+	if (isset($spotter_array[0]['airline_name'])) {
141 141
 		print ' - '.$spotter_array[0]['airline_name'];
142 142
 	}
143
-	if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') {
143
+	if (isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') {
144 144
 		print ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')';
145 145
 	}
146
-	if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') {
146
+	if (isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') {
147 147
 		print ' - '.$spotter_array[0]['registration'];
148 148
 	}
149 149
 	print '</h1>';
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 print '</div>';
298 298
 */
299 299
 
300
-	foreach($spotter_array as $spotter_item)
300
+	foreach ($spotter_array as $spotter_item)
301 301
 	{
302 302
 		print '<div class="details">';
303 303
 		print '<h3>'._("Flight Information").'</h3>';
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != '') {
398 398
 				if ($spotter_item['departure_airport_time'] > 2460) {
399 399
 					print '<div class="time">';
400
-					print 'at '.date('H:m',$spotter_item['departure_airport_time']);
400
+					print 'at '.date('H:m', $spotter_item['departure_airport_time']);
401 401
 					print '</div>';
402 402
 				} else {
403 403
 					print '<div class="time">';
@@ -546,19 +546,19 @@  discard block
 block discarded – undo
546 546
 			$departure_airport_info = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
547 547
 			if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') {
548 548
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
549
-					print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm';
549
+					print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'nm').' nm';
550 550
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
551
-					print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi';
551
+					print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'mi').' mi';
552 552
 				} else {
553
-					print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km';
553
+					print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'km').' km';
554 554
 				}
555 555
 			} else {
556 556
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
557
-					print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm';
557
+					print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'nm').' nm';
558 558
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
559
-					print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi';
559
+					print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'mi').' mi';
560 560
 				} else {
561
-					print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km';
561
+					print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'km').' km';
562 562
 				}
563 563
 			}
564 564
 			print '</div>';
@@ -572,19 +572,19 @@  discard block
 block discarded – undo
572 572
 			$arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
573 573
 			if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') {
574 574
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
575
-					print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm';
575
+					print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'nm').' nm';
576 576
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
577
-					print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi';
577
+					print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'mi').' mi';
578 578
 				} else {
579
-					print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km';
579
+					print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'km').' km';
580 580
 				}
581 581
 			} else {
582 582
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
583
-					print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm';
583
+					print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'nm').' nm';
584 584
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
585
-					print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi';
585
+					print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'mi').' mi';
586 586
 				} else {
587
-					print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km';
587
+					print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'km').' km';
588 588
 				}
589 589
 			}
590 590
 			print '</div>';
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 		print '<div class="last-flights">';
604 604
 		print '<h3>'._("Last 5 Flights of this Aircraft").' ('.$spotter_array[0]['registration'].')</h3>';
605 605
 		$hide_th_links = true;
606
-		$spotter_array = $Spotter->getSpotterDataByRegistration($spotter_array[0]['registration'],"0,5", "");
606
+		$spotter_array = $Spotter->getSpotterDataByRegistration($spotter_array[0]['registration'], "0,5", "");
607 607
 		include('table-output.php'); 
608 608
 		print '<div class="more">';
609 609
 		print '<a href="'.$globalURL.'/registration/'.$spotter_array[0]['registration'].'" class="btn btn-default btn" role="button">See all Flights&raquo;</a>';
Please login to merge, or discard this patch.
aircraft-statistics-departure-airport.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/aircraft');
8 8
         die();
9 9
 }
10
-$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING);
10
+$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", "");
13 13
 
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Departure Airports for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']);
17
+	$title = sprintf(_("Most Common Departure Airports for %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']);
18 18
 	require_once('header.php');
19 19
 	print '<div class="select-item">';
20 20
 	print '<form action="'.$globalURL.'/aircraft" method="post">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$aircraft_types = $Stats->getAllAircraftTypes();
25 25
 	if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
26
-	foreach($aircraft_types as $aircrafttype)
26
+	foreach ($aircraft_types as $aircrafttype)
27 27
 	{
28
-		if($aircraft_type == $aircrafttype['aircraft_icao'])
28
+		if ($aircraft_type == $aircrafttype['aircraft_icao'])
29 29
 		{
30 30
 			print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
31 31
 		} else {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	include('aircraft-sub-menu.php');
53 53
 	print '<div class="column">';
54 54
 	print '<h2>'._("Most Common Departure Airports").'</h2>';
55
-	print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>';
55
+	print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>';
56 56
 	$airport_airport_array = $Spotter->countAllDepartureAirportsByAircraft($aircraft_type);
57 57
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
58 58
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	print '<script>';
62 62
 	print 'var series = [';
63 63
 	$airport_data = '';
64
-	foreach($airport_airport_array as $airport_item)
64
+	foreach ($airport_airport_array as $airport_item)
65 65
 	{
66 66
 		$airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_name'].' ('.$airport_item['airport_departure_icao'].')",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],';
67 67
 	}
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
 	print '</thead>';
117 117
 	print '<tbody>';
118 118
 	$i = 1;
119
-	foreach($airport_airport_array as $airport_item)
119
+	foreach ($airport_airport_array as $airport_item)
120 120
 	{
121 121
 		print '<tr>';
122 122
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
registration-statistics-arrival-airport.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6
-$sort=filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
7
-$registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING);
6
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
7
+$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING);
8 8
 if ($registration != '') {
9 9
 	$spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort);
10 10
 	$aircraft_array = $Spotter->getAircraftInfoByRegistration($registration);
11
-} else $spotter_array=array();
11
+} else $spotter_array = array();
12 12
 
13 13
 if (!empty($spotter_array))
14 14
 {
15
-	$title = sprintf(_("Most Common Arrival Airports of aircraft with registration %s"),$registration);
15
+	$title = sprintf(_("Most Common Arrival Airports of aircraft with registration %s"), $registration);
16 16
 
17 17
 	require_once('header.php');
18 18
 		print '<div class="info column">';
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 	include('registration-sub-menu.php');
26 26
 	print '<div class="column">';
27 27
 	print '<h2>'._("Most Common Arrival Airports").'</h2>';
28
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights with aircraft registration <strong>%s</strong>."),$registration).'</p>';
28
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights with aircraft registration <strong>%s</strong>."), $registration).'</p>';
29 29
 	$airport_airport_array = $Spotter->countAllArrivalAirportsByRegistration($registration);
30 30
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
31 31
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 	print '<script>';
35 35
 	print 'var series = [';
36 36
 	$airport_data = '';
37
-	foreach($airport_airport_array as $airport_item)
37
+	foreach ($airport_airport_array as $airport_item)
38 38
 	{
39 39
 		$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_name'].' ('.$airport_item['airport_arrival_icao'].')",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
40 40
 	}
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	print '</thead>';
89 89
 	print '<tbody>';
90 90
 	$i = 1;
91
-	foreach($airport_airport_array as $airport_item)
91
+	foreach ($airport_airport_array as $airport_item)
92 92
 	{
93 93
 		print '<tr>';
94 94
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
tracker-data.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
14
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident,$currenttime);
18
+		$spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident, $currenttime);
19 19
 		if (empty($spotter_array)) {
20 20
 			$from_archive = true;
21
-			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataByIdent($ident,$currenttime);
21
+			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataByIdent($ident, $currenttime);
22 22
 		}
23 23
 		
24 24
 	} else {
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	}
31 31
 }
32 32
 if (isset($_GET['famtrackid'])) {
33
-	$famtrackid = urldecode(filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING));
33
+	$famtrackid = urldecode(filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING));
34 34
 	if (isset($_GET['currenttime'])) {
35
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
35
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
36 36
 		$currenttime = round($currenttime/1000);
37
-		$spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid,$currenttime);
37
+		$spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid, $currenttime);
38 38
 		
39 39
 		if (empty($spotter_array)) {
40 40
 			$from_archive = true;
41 41
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
42
-			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataById($famtrackid,$currenttime);
42
+			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataById($famtrackid, $currenttime);
43 43
 		}
44 44
 		
45 45
 	} else {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
60 60
 {
61 61
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
62
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
62
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
63 63
 	} else $image = $spotter_item['image_thumbnail'];
64 64
 
65 65
 }
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 print '<div><span>'._("Altitude").'</span>';
80 80
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
81 81
     try {
82
-	$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
83
-    } catch(Exception $e) {
82
+	$groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']);
83
+    } catch (Exception $e) {
84 84
     }
85 85
 }
86 86
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
Please login to merge, or discard this patch.
airport-statistics-arrival-airport.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/airport');
8 8
         die();
9 9
 }
10
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
10
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAirport($airport, "0,1", "");
13 13
 $airport_array = $Spotter->getAllAirportInfo($airport);
14 14
 
15 15
 if (!empty($airport_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Arrival Airports from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
17
+	$title = sprintf(_("Most Common Arrival Airports from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']);
18 18
 	require_once('header.php');
19 19
 	print '<div class="select-item">';
20 20
 	print '<form action="'.$globalURL.'/airport" method="post">';
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
 	$airport_names = $Stats->getAllAirportNames();
25 25
 	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
26 26
 	ksort($airport_names);
27
-	foreach($airport_names as $airport_name)
27
+	foreach ($airport_names as $airport_name)
28 28
 	{
29
-		if($airport == $airport_name['airport_icao'])
29
+		if ($airport == $airport_name['airport_icao'])
30 30
 		{
31 31
 			print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>';
32 32
 		} else {
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	include('airport-sub-menu.php');
58 58
 	print '<div class="column">';
59 59
 	print '<h2>'._("Most Common Arrival Airports").'</h2>';
60
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>';
60
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>';
61 61
 	$airport_airport_array = $Spotter->countAllArrivalAirportsByAirport($airport);
62 62
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
63 63
 	print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>';
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 	print '<script>';
67 67
 	print 'var series = [';
68 68
 	$airport_data = '';
69
-	foreach($airport_airport_array as $airport_item)
69
+	foreach ($airport_airport_array as $airport_item)
70 70
 	{
71 71
 		$airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],';
72 72
 	}
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	print '</thead>';
122 122
 	print '<tbody>';
123 123
 	$i = 1;
124
-	foreach($airport_airport_array as $airport_item)
124
+	foreach ($airport_airport_array as $airport_item)
125 125
 	{
126 126
 		print '<tr>';
127 127
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.