Completed
Push — master ( ca573a...749c97 )
by Yannick
07:32
created
require/class.Image.php 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
 	* @return Array the images list
18 18
 	*
19 19
 	*/
20
-	public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
20
+	public function getSpotterImage($registration, $aircraft_icao = '', $airline_icao = '')
21 21
 	{
22
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
23
-		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
24
-		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
22
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
23
+		$aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
24
+		$airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
25 25
 		if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
26 26
 		$registration = trim($registration);
27
-		$query  = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration 
27
+		$query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration 
28 28
 			FROM spotter_image 
29 29
 			WHERE spotter_image.registration = :registration";
30 30
 		$sth = $this->db->prepare($query);
@@ -63,9 +63,9 @@  discard block
 block discarded – undo
63 63
 		if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright'];
64 64
 		elseif (isset($exif['copyright'])) $copyright = $exif['copyright'];
65 65
 		if ($copyright != '') {
66
-			$copyright = str_replace('Copyright ','',$copyright);
67
-			$copyright = str_replace('© ','',$copyright);
68
-			$copyright = str_replace('(c) ','',$copyright);
66
+			$copyright = str_replace('Copyright ', '', $copyright);
67
+			$copyright = str_replace('© ', '', $copyright);
68
+			$copyright = str_replace('(c) ', '', $copyright);
69 69
 		}
70 70
 		return $copyright;
71 71
 	}
@@ -76,26 +76,26 @@  discard block
 block discarded – undo
76 76
 	* @return String either success or error
77 77
 	*
78 78
 	*/
79
-	public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
79
+	public function addSpotterImage($registration, $aircraft_icao = '', $airline_icao = '')
80 80
 	{
81
-		global $globalDebug,$globalAircraftImageFetch;
81
+		global $globalDebug, $globalAircraftImageFetch;
82 82
 		if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return '';
83
-		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
83
+		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
84 84
 		$registration = trim($registration);
85 85
 		//getting the aircraft image
86 86
 		if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...';
87 87
 		elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...';
88 88
 		elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...';
89 89
 		else return "success";
90
-		$image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao);
90
+		$image_url = $this->findAircraftImage($registration, $aircraft_icao, $airline_icao);
91 91
 		if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
92 92
 		if ($image_url['original'] != '') {
93 93
 			if ($globalDebug) echo 'Found !'."\n";
94
-			$query  = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)";
94
+			$query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)";
95 95
 			try {
96 96
 				$sth = $this->db->prepare($query);
97
-				$sth->execute(array(':registration' => $registration,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website']));
98
-			} catch(PDOException $e) {
97
+				$sth->execute(array(':registration' => $registration, ':image' => $image_url['original'], ':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'], ':source' => $image_url['source'], ':source_website' => $image_url['source_website']));
98
+			} catch (PDOException $e) {
99 99
 				echo $e->getMessage()."\n";
100 100
 				return "error";
101 101
 			}
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
 		global $globalAircraftImageSources, $globalIVAO;
116 116
 		$Spotter = new Spotter($this->db);
117 117
 		if (!isset($globalIVAO)) $globalIVAO = FALSE;
118
-		$aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING);
118
+		$aircraft_registration = filter_var($aircraft_registration, FILTER_SANITIZE_STRING);
119 119
 		if ($aircraft_registration != '') {
120
-			if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
120
+			if (strpos($aircraft_registration, '/') !== false) return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => '');
121 121
 			$aircraft_registration = urlencode(trim($aircraft_registration));
122 122
 			$aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration);
123 123
 			if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name'];
@@ -129,23 +129,23 @@  discard block
 block discarded – undo
129 129
 		} elseif ($aircraft_icao != '') {
130 130
 			$aircraft_registration = $aircraft_icao;
131 131
 			$aircraft_name = '';
132
-		} else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
133
-		if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
132
+		} else return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => '');
133
+		if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
134 134
 		foreach ($globalAircraftImageSources as $source) {
135 135
 			$source = strtolower($source);
136
-			if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl($aircraft_icao,$airline_icao);
137
-			if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters($aircraft_registration,$aircraft_name);
138
-			if ($source == 'flickr') $images_array = $this->fromFlickr($aircraft_registration,$aircraft_name);
139
-			if ($source == 'bing') $images_array = $this->fromBing($aircraft_registration,$aircraft_name);
140
-			if ($source == 'deviantart') $images_array = $this->fromDeviantart($aircraft_registration,$aircraft_name);
141
-			if ($source == 'wikimedia') $images_array = $this->fromWikimedia($aircraft_registration,$aircraft_name);
142
-			if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos($aircraft_registration,$aircraft_name);
143
-			if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures($aircraft_registration,$aircraft_name);
144
-			if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData($aircraft_registration,$aircraft_name);
145
-			if ($source == 'customsources') $images_array = $this->fromCustomSource($aircraft_registration,$aircraft_name);
136
+			if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl($aircraft_icao, $airline_icao);
137
+			if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters($aircraft_registration, $aircraft_name);
138
+			if ($source == 'flickr') $images_array = $this->fromFlickr($aircraft_registration, $aircraft_name);
139
+			if ($source == 'bing') $images_array = $this->fromBing($aircraft_registration, $aircraft_name);
140
+			if ($source == 'deviantart') $images_array = $this->fromDeviantart($aircraft_registration, $aircraft_name);
141
+			if ($source == 'wikimedia') $images_array = $this->fromWikimedia($aircraft_registration, $aircraft_name);
142
+			if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos($aircraft_registration, $aircraft_name);
143
+			if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures($aircraft_registration, $aircraft_name);
144
+			if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData($aircraft_registration, $aircraft_name);
145
+			if ($source == 'customsources') $images_array = $this->fromCustomSource($aircraft_registration, $aircraft_name);
146 146
 			if (isset($images_array) && $images_array['original'] != '') return $images_array;
147 147
 		}
148
-		return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
148
+		return array('thumbnail' => '', 'original' => '', 'copyright' => '', 'source' => '', 'source_website' => '');
149 149
 	}
150 150
 
151 151
 	/**
@@ -156,24 +156,24 @@  discard block
 block discarded – undo
156 156
 	* @return Array the aircraft thumbnail, orignal url and copyright
157 157
 	*
158 158
 	*/
159
-	public function fromPlanespotters($aircraft_registration, $aircraft_name='') {
159
+	public function fromPlanespotters($aircraft_registration, $aircraft_name = '') {
160 160
 		$Common = new Common();
161 161
 		// If aircraft registration is only number, also check with aircraft model
162
-		if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') {
163
-			$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss';
162
+		if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') {
163
+			$url = 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss';
164 164
 		} else {
165 165
 			//$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss';
166
-			$url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss';
166
+			$url = 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss';
167 167
 		}
168 168
 		$data = $Common->getData($url);
169 169
 		if ($xml = simplexml_load_string($data)) {
170 170
 			if (isset($xml->channel->item)) {
171 171
 				$image_url = array();
172
-				$thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url);
172
+				$thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url);
173 173
 				$image_url['thumbnail'] = $thumbnail_url;
174
-				$image_url['original'] = str_replace('thumbnail','original',$thumbnail_url);
175
-				$image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright);
176
-				$image_url['source_website'] = trim((string)$xml->channel->item->link);
174
+				$image_url['original'] = str_replace('thumbnail', 'original', $thumbnail_url);
175
+				$image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright);
176
+				$image_url['source_website'] = trim((string) $xml->channel->item->link);
177 177
 				$image_url['source'] = 'planespotters';
178 178
 				return $image_url;
179 179
 			}
@@ -189,25 +189,25 @@  discard block
 block discarded – undo
189 189
 	* @return Array the aircraft thumbnail, orignal url and copyright
190 190
 	*
191 191
 	*/
192
-	public function fromDeviantart($aircraft_registration, $aircraft_name='') {
192
+	public function fromDeviantart($aircraft_registration, $aircraft_name = '') {
193 193
 		$Common = new Common();
194 194
 		// If aircraft registration is only number, also check with aircraft model
195
-		if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') {
196
-			$url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$aircraft_registration.'%20'.urlencode($aircraft_name);
195
+		if (preg_match('/^[[:digit]]+$/', $aircraft_registration) && $aircraft_name != '') {
196
+			$url = 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$aircraft_registration.'%20'.urlencode($aircraft_name);
197 197
 		} else {
198
-			$url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$aircraft_registration;
198
+			$url = 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$aircraft_registration;
199 199
 		}
200 200
 
201 201
 		$data = $Common->getData($url);
202 202
 		if ($xml = simplexml_load_string($data)) {
203 203
 			if (isset($xml->channel->item->link)) {
204 204
 				$image_url = array();
205
-				$thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url);
205
+				$thumbnail_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url);
206 206
 				$image_url['thumbnail'] = $thumbnail_url;
207
-				$original_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url);
207
+				$original_url = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url);
208 208
 				$image_url['original'] = $original_url;
209
-				$image_url['copyright'] = str_replace('Copyright ','',trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright));
210
-				$image_url['source_website'] = trim((string)$xml->channel->item->link);
209
+				$image_url['copyright'] = str_replace('Copyright ', '', trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->copyright));
210
+				$image_url['source_website'] = trim((string) $xml->channel->item->link);
211 211
 				$image_url['source'] = 'deviantart';
212 212
 				return $image_url;
213 213
 			}
@@ -223,32 +223,32 @@  discard block
 block discarded – undo
223 223
 	* @return Array the aircraft thumbnail, orignal url and copyright
224 224
 	*
225 225
 	*/
226
-	public function fromJetPhotos($aircraft_registration, $aircraft_name='') {
226
+	public function fromJetPhotos($aircraft_registration, $aircraft_name = '') {
227 227
 		$Common = new Common();
228
-		$url= 'http://jetphotos.net/showphotos.php?displaymode=2&regsearch='.$aircraft_registration;
228
+		$url = 'http://jetphotos.net/showphotos.php?displaymode=2&regsearch='.$aircraft_registration;
229 229
 		$data = $Common->getData($url);
230 230
 		$dom = new DOMDocument();
231 231
 		@$dom->loadHTML($data);
232 232
 		$all_pics = array();
233
-		foreach($dom->getElementsByTagName('img') as $image) {
233
+		foreach ($dom->getElementsByTagName('img') as $image) {
234 234
 			if ($image->getAttribute('itemprop') == "http://schema.org/image") {
235 235
 				$all_pics[] = $image->getAttribute('src');
236 236
 			}
237 237
 		}
238 238
 		$all_authors = array();
239
-		foreach($dom->getElementsByTagName('meta') as $author) {
239
+		foreach ($dom->getElementsByTagName('meta') as $author) {
240 240
 			if ($author->getAttribute('itemprop') == "http://schema.org/author") {
241 241
 				$all_authors[] = $author->getAttribute('content');
242 242
 			}
243 243
 		}
244 244
 		$all_ref = array();
245
-		foreach($dom->getElementsByTagName('a') as $link) {
245
+		foreach ($dom->getElementsByTagName('a') as $link) {
246 246
 			$all_ref[] = $link->getAttribute('href');
247 247
 		}
248 248
 		if (isset($all_pics[0])) {
249 249
 			$image_url = array();
250 250
 			$image_url['thumbnail'] = $all_pics[0];
251
-			$image_url['original'] = str_replace('_tb','',$all_pics[0]);
251
+			$image_url['original'] = str_replace('_tb', '', $all_pics[0]);
252 252
 			$image_url['copyright'] = $all_authors[0];
253 253
 			$image_url['source_website'] = 'http://jetphotos.net'.$all_ref[8];
254 254
 			$image_url['source'] = 'JetPhotos';
@@ -265,24 +265,24 @@  discard block
 block discarded – undo
265 265
 	* @return Array the aircraft thumbnail, orignal url and copyright
266 266
 	*
267 267
 	*/
268
-	public function fromPlanePictures($aircraft_registration, $aircraft_name='') {
268
+	public function fromPlanePictures($aircraft_registration, $aircraft_name = '') {
269 269
 		$Common = new Common();
270
-		$url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2';
270
+		$url = 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2';
271 271
 		$data = $Common->getData($url);
272 272
 		$dom = new DOMDocument();
273 273
 		@$dom->loadHTML($data);
274 274
 		$all_pics = array();
275
-		foreach($dom->getElementsByTagName('img') as $image) {
275
+		foreach ($dom->getElementsByTagName('img') as $image) {
276 276
 			$all_pics[] = $image->getAttribute('src');
277 277
 		}
278 278
 		$all_links = array();
279
-		foreach($dom->getElementsByTagName('a') as $link) {
280
-			$all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href'));
279
+		foreach ($dom->getElementsByTagName('a') as $link) {
280
+			$all_links[] = array('text' => $link->textContent, 'href' => $link->getAttribute('href'));
281 281
 		}
282
-		if (isset($all_pics[1]) && !preg_match('/bit.ly/',$all_pics[1])) {
282
+		if (isset($all_pics[1]) && !preg_match('/bit.ly/', $all_pics[1])) {
283 283
 			$image_url = array();
284 284
 			$image_url['thumbnail'] = 'http://www.planepictures.net'.$all_pics[1];
285
-			$image_url['original'] = 'http://www.planepictures.net'.str_replace('_TN','',$all_pics[1]);
285
+			$image_url['original'] = 'http://www.planepictures.net'.str_replace('_TN', '', $all_pics[1]);
286 286
 			$image_url['copyright'] = $all_links[6]['text'];
287 287
 			$image_url['source_website'] = 'http://www.planepictures.net/'.$all_links[2]['href'];
288 288
 			$image_url['source'] = 'PlanePictures';
@@ -299,19 +299,19 @@  discard block
 block discarded – undo
299 299
 	* @return Array the aircraft thumbnail, orignal url and copyright
300 300
 	*
301 301
 	*/
302
-	public function fromFlickr($aircraft_registration,$aircraft_name='') {
302
+	public function fromFlickr($aircraft_registration, $aircraft_name = '') {
303 303
 		$Common = new Common();
304 304
 		if ($aircraft_name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.','.urlencode($aircraft_name);
305 305
 		else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.',aircraft';
306 306
 		$data = $Common->getData($url);
307 307
 		if ($xml = simplexml_load_string($data)) {
308 308
 			if (isset($xml->channel->item)) {
309
-				$original_url = trim((string)$xml->channel->item->enclosure->attributes()->url);
309
+				$original_url = trim((string) $xml->channel->item->enclosure->attributes()->url);
310 310
 				$image_url = array();
311 311
 				$image_url['thumbnail'] = $original_url;
312 312
 				$image_url['original'] = $original_url;
313
-				$image_url['copyright'] = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->credit);
314
-				$image_url['source_website'] = trim((string)$xml->channel->item->link);
313
+				$image_url['copyright'] = trim((string) $xml->channel->item->children('http://search.yahoo.com/mrss/')->credit);
314
+				$image_url['source_website'] = trim((string) $xml->channel->item->link);
315 315
 				$image_url['source'] = 'flickr';
316 316
 				return $image_url;
317 317
 			}
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 		return false;
320 320
 	}
321 321
 
322
-	public function fromIvaoMtl($aircraft_icao,$airline_icao) {
322
+	public function fromIvaoMtl($aircraft_icao, $airline_icao) {
323 323
 		$Common = new Common();
324 324
 		//echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg';
325 325
 		if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) {
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
 	* @return Array the aircraft thumbnail, orignal url and copyright
344 344
 	*
345 345
 	*/
346
-	public function fromBing($aircraft_registration,$aircraft_name='') {
346
+	public function fromBing($aircraft_registration, $aircraft_name = '') {
347 347
 		global $globalImageBingKey;
348 348
 		$Common = new Common();
349 349
 		if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false;
350 350
 		if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27';
351 351
 		else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27';
352
-		$headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey));
353
-		$data = $Common->getData($url,'get','',$headers);
352
+		$headers = array("Authorization: Basic ".base64_encode("ignored:".$globalImageBingKey));
353
+		$data = $Common->getData($url, 'get', '', $headers);
354 354
 		$result = json_decode($data);
355 355
 		if (isset($result->d->results[0]->MediaUrl)) {
356 356
 			$image_url = array();
@@ -375,14 +375,14 @@  discard block
 block discarded – undo
375 375
 	* @return Array the aircraft thumbnail, orignal url and copyright
376 376
 	*
377 377
 	*/
378
-	public function fromAirportData($aircraft_registration,$aircraft_name='') {
378
+	public function fromAirportData($aircraft_registration, $aircraft_name = '') {
379 379
 		$Common = new Common();
380 380
 		$url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration;
381 381
 		$data = $Common->getData($url);
382 382
 		$result = json_decode($data);
383 383
 		if (isset($result->count) && $result->count > 0) {
384 384
 			$image_url = array();
385
-			$image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image);
385
+			$image_url['original'] = str_replace('thumbnails', 'large', $result->data[0]->image);
386 386
 			$image_url['source_website'] = $result->data[0]->link;
387 387
 			$image_url['thumbnail'] = $result->data[0]->image;
388 388
 			$image_url['copyright'] = $result->data[0]->photographer;
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 	* @return Array the aircraft thumbnail, orignal url and copyright
401 401
 	*
402 402
 	*/
403
-	public function fromWikimedia($aircraft_registration,$aircraft_name='') {
403
+	public function fromWikimedia($aircraft_registration, $aircraft_name = '') {
404 404
 		$Common = new Common();
405 405
 		if ($aircraft_name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20'.urlencode($aircraft_name);
406 406
 		else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20aircraft';
@@ -408,7 +408,7 @@  discard block
 block discarded – undo
408 408
 		$result = json_decode($data);
409 409
 		if (isset($result->query->search[0]->title)) {
410 410
 			$fileo = $result->query->search[0]->title;
411
-			if (substr($fileo,-3) == 'pdf') return false;
411
+			if (substr($fileo, -3) == 'pdf') return false;
412 412
 			$file = urlencode($fileo);
413 413
 			$url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file;
414 414
 			$data2 = $Common->getData($url2);
@@ -433,11 +433,11 @@  discard block
 block discarded – undo
433 433
 				if (isset($result2->query->pages)) {
434 434
 					foreach ($result2->query->pages as $page) {
435 435
 						if (isset($page->imageinfo[0]->extmetadata->Artist)) {
436
-							$image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value));
436
+							$image_url['copyright'] = preg_replace('/ from(.*)/', '', strip_tags($page->imageinfo[0]->extmetadata->Artist->value));
437 437
 							if (isset($page->imageinfo[0]->extmetadata->License->value)) {
438 438
 								$image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')';
439 439
 							}
440
-							$image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright']));
440
+							$image_url['copyright'] = trim(str_replace('\n', '', $image_url['copyright']));
441 441
 							return $image_url;
442 442
 						}
443 443
 					}
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
 	* @return Array the aircraft thumbnail, orignal url and copyright
457 457
 	*
458 458
 	*/
459
-	public function fromCustomSource($aircraft_registration,$aircraft_name='') {
459
+	public function fromCustomSource($aircraft_registration, $aircraft_name = '') {
460 460
 		global $globalAircraftImageCustomSources, $globalDebug;
461 461
 		//$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true);
462 462
 		if (!empty($globalAircraftImageCustomSources)) {
@@ -473,15 +473,15 @@  discard block
 block discarded – undo
473 473
 					print_r($source);
474 474
 					print_r($customsources);
475 475
 				}
476
-				$url = str_replace('{registration}',$aircraft_registration,$source['original']);
477
-				$url_thumbnail = str_replace('{registration}',$aircraft_registration,$source['thumbnail']);
476
+				$url = str_replace('{registration}', $aircraft_registration, $source['original']);
477
+				$url_thumbnail = str_replace('{registration}', $aircraft_registration, $source['thumbnail']);
478 478
 				if ($Common->urlexist($url)) {
479 479
 					$image_url = array();
480 480
 					$image_url['thumbnail'] = $url_thumbnail;
481 481
 					$image_url['original'] = $url;
482 482
 					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url);
483 483
 					else $exifCopyright = '';
484
-					if ($exifCopyright  != '') $image_url['copyright'] = $exifCopyright;
484
+					if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright;
485 485
 					else $image_url['copyright'] = $source['copyright'];
486 486
 					$image_url['source_website'] = $source['source_website'];
487 487
 					$image_url['source'] = $source['source'];
Please login to merge, or discard this patch.
require/class.APRS.php 1 patch
Spacing   +54 added lines, -55 removed lines patch added patch discarded remove patch
@@ -1,8 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 class aprs {
3 3
     private function urshift($n, $s) {
4
-	return ($n >= 0) ? ($n >> $s) :
5
-    	    (($n & 0x7fffffff) >> $s) | 
4
+	return ($n >= 0) ? ($n >> $s) : (($n&0x7fffffff) >> $s)| 
6 5
         	(0x40000000 >> ($s - 1));
7 6
     }
8 7
 
@@ -14,7 +13,7 @@  discard block
 block discarded – undo
14 13
 	//$split_input = str_split($input);
15 14
 
16 15
 	/* Find the end of header checking for NULL bytes while doing it. */
17
-	$splitpos = strpos($input,':');
16
+	$splitpos = strpos($input, ':');
18 17
 	
19 18
 	/* Check that end was found and body has at least one byte. */
20 19
 	if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) {
@@ -23,28 +22,28 @@  discard block
 block discarded – undo
23 22
 	}
24 23
 	
25 24
 	/* Save header and body. */
26
-	$body = substr($input,$splitpos+1,$input_len);
25
+	$body = substr($input, $splitpos + 1, $input_len);
27 26
 	$body_len = strlen($body);
28
-	$header = substr($input,0,$splitpos);
27
+	$header = substr($input, 0, $splitpos);
29 28
 	//$header_len = strlen($header);
30 29
 	if ($debug) echo 'header : '.$header."\n";
31 30
 	
32 31
 	/* Parse source, target and path. */
33 32
 	//FLRDF0A52>APRS,qAS,LSTB
34
-	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) {
33
+	if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/', $header, $matches)) {
35 34
 	    $ident = $matches[1];
36 35
 	    $all_elements = $matches[2];
37 36
 	    if ($debug) echo 'ident : '.$ident."\n";
38 37
 	    $result['ident'] = $ident;
39 38
 	} else return false;
40
-	$elements = explode(',',$all_elements);
39
+	$elements = explode(',', $all_elements);
41 40
 	$source = end($elements);
42 41
 	$result['source'] = $source;
43 42
 	foreach ($elements as $element) {
44
-	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) {
43
+	    if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/', $element)) {
45 44
 	        //echo "ok";
46 45
 	        if ($element == 'TCPIP*') return false;
47
-	    } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) {
46
+	    } elseif (!preg_match('/^([0-9A-F]{32})$/', $element)) {
48 47
 		return false;
49 48
 	    }
50 49
 	    /*
@@ -56,8 +55,8 @@  discard block
 block discarded – undo
56 55
 	    */
57 56
 	}
58 57
 	// Check for Timestamp
59
-	$body_parse = substr($body,1);
60
-	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) {
58
+	$body_parse = substr($body, 1);
59
+	if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/', $body_parse, $matches)) {
61 60
 	    $timestamp = $matches[0];
62 61
 	    if ($matches[4] == 'h') {
63 62
 		$timestamp = strtotime($matches[1].':'.$matches[2].':'.$matches[3]);
@@ -70,11 +69,11 @@  discard block
 block discarded – undo
70 69
 		// This work or not ?
71 70
 		$timestamp = strtotime($matches[1].' '.$matches[2].':'.$matches[3]);
72 71
 	    }
73
-	    $body_parse = substr($body_parse,7);
72
+	    $body_parse = substr($body_parse, 7);
74 73
 	    $result['timestamp'] = $timestamp;
75 74
 	}
76 75
 	if (strlen($body_parse) > 19) {
77
-	    if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) {
76
+	    if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/', $body_parse, $matches)) {
78 77
 		// 4658.70N/00707.78Ez
79 78
 		//print_r(str_split($body_parse));
80 79
 		
@@ -99,8 +98,8 @@  discard block
 block discarded – undo
99 98
 	    */
100 99
 		$latitude = $lat + floatval($lat_min)/60;
101 100
 		$longitude = $lon + floatval($lon_min)/60;
102
-		if ($sind == 'S') $latitude = 0-$latitude;
103
-		if ($wind == 'W') $longitude = 0-$longitude;
101
+		if ($sind == 'S') $latitude = 0 - $latitude;
102
+		if ($wind == 'W') $longitude = 0 - $longitude;
104 103
 		$result['latitude'] = $latitude;
105 104
 		$result['longitude'] = $longitude;
106 105
 	    }
@@ -108,17 +107,17 @@  discard block
 block discarded – undo
108 107
 		$body_split = str_split($body_parse);
109 108
 		$symbol_code = $body_split[18];
110 109
 		if ($symbol_code != '_') {
111
-		    $body_parse = substr($body_parse,19);
110
+		    $body_parse = substr($body_parse, 19);
112 111
 		    $body_parse_len = strlen($body_parse);
113 112
 		    if ($body_parse_len >= 7) {
114 113
 			
115
-		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) {
116
-		    	    $course = substr($body_parse,0,3);
114
+		        if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/', $body_parse)) {
115
+		    	    $course = substr($body_parse, 0, 3);
117 116
 		    	    $tmp_s = intval($course);
118 117
 		    	    if ($tmp_s >= 1 && $tmp_s <= 360) $result['course'] = intval($course);
119
-		    	    $speed = substr($body_parse,4,3);
118
+		    	    $speed = substr($body_parse, 4, 3);
120 119
 		    	    $result['speed'] = round($speed*1.852);
121
-		    	    $body_parse = substr($body_parse,7);
120
+		    	    $body_parse = substr($body_parse, 7);
122 121
 		        }
123 122
 		        // Check PHGR, PHG, RNG
124 123
 		    } 
@@ -128,11 +127,11 @@  discard block
 block discarded – undo
128 127
 		    }
129 128
 		    */
130 129
 		    if (strlen($body_parse) > 0) {
131
-		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) {
130
+		        if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/', $body_parse, $matches)) {
132 131
 		            $altitude = intval($matches[1]);
133 132
 		            //$result['altitude'] = round($altitude*0.3048);
134 133
 		            $result['altitude'] = $altitude;
135
-		            $body_parse = substr($body_parse,strlen($matches[0])+1);
134
+		            $body_parse = substr($body_parse, strlen($matches[0]) + 1);
136 135
 		        }
137 136
 		    }
138 137
 		    
@@ -143,34 +142,34 @@  discard block
 block discarded – undo
143 142
 		    }
144 143
 		    */
145 144
 		    // DAO
146
-		    if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) {
145
+		    if (preg_match('/^!([0-9A-Z]{3})/', $body_parse, $matches)) {
147 146
 			    $dao = $matches[1];
148
-			    if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) {
147
+			    if (preg_match('/^([A-Z])([0-9]{2})/', $dao)) {
149 148
 				$dao_split = str_split($dao);
150
-			        $lat_off = (($dao_split[1])-48.0)*0.001/60.0;
151
-			        $lon_off = (($dao_split[2])-48.0)*0.001/60.0;
149
+			        $lat_off = (($dao_split[1]) - 48.0)*0.001/60.0;
150
+			        $lon_off = (($dao_split[2]) - 48.0)*0.001/60.0;
152 151
 			    
153 152
 				if ($result['latitude'] < 0) $result['latitude'] -= $lat_off;
154 153
 				else $result['latitude'] += $lat_off;
155 154
 				if ($result['longitude'] < 0) $result['longitude'] -= $lon_off;
156 155
 				else $result['longitude'] += $lon_off;
157 156
 			    }
158
-		            $body_parse = substr($body_parse,6);
157
+		            $body_parse = substr($body_parse, 6);
159 158
 		    }
160 159
 		    
161 160
 		    // OGN comment
162 161
 		   // echo "Before OGN : ".$body_parse."\n";
163
-		    if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) {
162
+		    if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/', $body_parse, $matches)) {
164 163
 			$id = $matches[1];
165 164
 			//$mode = substr($id,0,2);
166
-			$address = substr($id,2);
165
+			$address = substr($id, 2);
167 166
 			//print_r($matches);
168
-			$addressType = (intval(substr($id,0,2),16))&3;
167
+			$addressType = (intval(substr($id, 0, 2), 16))&3;
169 168
 			if ($addressType == 0) $result['addresstype'] = "RANDOM";
170 169
 			elseif ($addressType == 1) $result['addresstype'] = "ICAO";
171 170
 			elseif ($addressType == 2) $result['addresstype'] = "FLARM";
172 171
 			elseif ($addressType == 3) $result['addresstype'] = "OGN";
173
-			$aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2);
172
+			$aircraftType = $this->urshift(((intval(substr($id, 0, 2), 16))&0b1111100), 2);
174 173
 			$result['aircrafttype_code'] = $aircraftType;
175 174
 			if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN";
176 175
 			elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER";
@@ -187,7 +186,7 @@  discard block
 block discarded – undo
187 186
 			elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP";
188 187
 			elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV";
189 188
 			elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT";
190
-			$stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0;
189
+			$stealth = (intval(substr($id, 0, 2), 16)&0b10000000) != 0;
191 190
 			$result['stealth'] = $stealth;
192 191
 			$result['address'] = $address;
193 192
 		    }
@@ -196,40 +195,40 @@  discard block
 block discarded – undo
196 195
 		    $result['comment'] = $body_parse;
197 196
 		} else {
198 197
 		    // parse weather
199
-		    $body_parse = substr($body_parse,19);
198
+		    $body_parse = substr($body_parse, 19);
200 199
 		    //$body_parse_len = strlen($body_parse);
201 200
 
202
-		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
201
+		    if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) {
203 202
 			$result['wind_dir'] = $matches[1];
204
-			$result['wind_speed'] = round($matches[2]*1.60934,1);
205
-			$result['wind_gust'] = round($matches[3]*1.60934,1);
206
-			$result['temp'] = round(5/9*(($matches[4])-32),1);
207
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
208
-		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
203
+			$result['wind_speed'] = round($matches[2]*1.60934, 1);
204
+			$result['wind_gust'] = round($matches[3]*1.60934, 1);
205
+			$result['temp'] = round(5/9*(($matches[4]) - 32), 1);
206
+		        $body_parse = substr($body_parse, strlen($matches[0]) + 1);
207
+		    } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) {
209 208
 			$result['wind_dir'] = $matches[1];
210
-			$result['wind_speed'] = round($matches[2]*1.60934,1);
211
-			$result['wind_gust'] = round($matches[3]*1.60934,1);
212
-			$result['temp'] = round(5/9*(($matches[4])-32),1);
213
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
214
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) {
209
+			$result['wind_speed'] = round($matches[2]*1.60934, 1);
210
+			$result['wind_gust'] = round($matches[3]*1.60934, 1);
211
+			$result['temp'] = round(5/9*(($matches[4]) - 32), 1);
212
+		        $body_parse = substr($body_parse, strlen($matches[0]) + 1);
213
+		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) {
215 214
 			$result['wind_dir'] = $matches[1];
216
-			$result['wind_speed'] = round($matches[2]*1.60934,1);
217
-			$result['wind_gust'] = round($matches[3]*1.60934,1);
218
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
219
-		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) {
215
+			$result['wind_speed'] = round($matches[2]*1.60934, 1);
216
+			$result['wind_gust'] = round($matches[3]*1.60934, 1);
217
+		        $body_parse = substr($body_parse, strlen($matches[0]) + 1);
218
+		    } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/', $body_parse, $matches)) {
220 219
 			$result['wind_dir'] = $matches[1];
221
-			$result['wind_speed'] = round($matches[2]*1.60934,1);
222
-			$result['wind_gust'] = round($matches[3]*1.60934,1);
223
-		        $body_parse = substr($body_parse,strlen($matches[0])+1);
220
+			$result['wind_speed'] = round($matches[2]*1.60934, 1);
221
+			$result['wind_gust'] = round($matches[3]*1.60934, 1);
222
+		        $body_parse = substr($body_parse, strlen($matches[0]) + 1);
224 223
 		    }
225
-		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) {
226
-			$result['temp'] = round(5/9*(($matches[1])-32),1);
224
+		    if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/', $body_parse, $matches)) {
225
+			$result['temp'] = round(5/9*(($matches[1]) - 32), 1);
227 226
 		    }
228 227
 		}
229 228
 	    }
230 229
 	}
231
-	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4);
232
-	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4);
230
+	if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'], 4);
231
+	if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'], 4);
233 232
 	//print_r($result);
234 233
 	return $result;
235 234
     }
Please login to merge, or discard this patch.
airport.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
 if (isset($_POST['airport']))
8 8
 {
9 9
 	header('Location: '.$globalURL.'/airport/'.$_POST['airport']);
10
-} else if (isset($_GET['airport'])){
10
+} else if (isset($_GET['airport'])) {
11 11
 	$Spotter = new Spotter();
12 12
 	//calculuation for the pagination
13
-	if($_GET['limit'] == "")
13
+	if ($_GET['limit'] == "")
14 14
 	{
15 15
 	  $limit_start = 0;
16 16
 	  $limit_end = 25;
17 17
 	  $absolute_difference = 25;
18
-	}  else {
18
+	} else {
19 19
 		$limit_explode = explode(",", $_GET['limit']);
20 20
 		$limit_start = $limit_explode[0];
21 21
 		$limit_end = $limit_explode[1];
@@ -29,10 +29,10 @@  discard block
 block discarded – undo
29 29
 	$limit_previous_1 = $limit_start - $absolute_difference;
30 30
 	$limit_previous_2 = $limit_end - $absolute_difference;
31 31
 	
32
-	$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
33
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
32
+	$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
33
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
34 34
 	$page_url = $globalURL.'/airport/'.$airport;
35
-	$spotter_array = $Spotter->getSpotterDataByAirport($airport,$limit_start.",".$absolute_difference, $sort);
35
+	$spotter_array = $Spotter->getSpotterDataByAirport($airport, $limit_start.",".$absolute_difference, $sort);
36 36
 	$airport_array = $Spotter->getAllAirportInfo($airport);
37 37
 	
38 38
 	if (!empty($airport_array))
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 			$airport_names = $Spotter->getAllAirportNames();
52 52
 		}
53 53
 		ksort($airport_names);
54
-		foreach($airport_names as $airport_name)
54
+		foreach ($airport_names as $airport_name)
55 55
 		{
56
-			if($airport == $airport_name['airport_icao'])
56
+			if ($airport == $airport_name['airport_icao'])
57 57
 			{
58 58
 				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>';
59 59
 			} else {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		print '<div class="table column">';
87 87
 		if ($airport_array[0]['iata'] != "NA")
88 88
 		{
89
-			print '<p>'.sprintf(_("The table below shows the route(s) aircrafts have used to/from <strong>%s</strong>, sorted by the most recent one."),$airport_array[0]['name']).'</p>';
89
+			print '<p>'.sprintf(_("The table below shows the route(s) aircrafts have used to/from <strong>%s</strong>, sorted by the most recent one."), $airport_array[0]['name']).'</p>';
90 90
 		}
91 91
 
92 92
 		include('table-output.php');  
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 		print '<p>'._("Sorry, the airport does not exist in this database. :(").'</p>'; 
109 109
 	}
110 110
 } else {
111
-	$Spotter= new Spotter();
111
+	$Spotter = new Spotter();
112 112
 	$Stats = new Stats();
113 113
 	$title = _("Airports");
114 114
 	require_once('header.php');
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 	ksort($airport_names);
122 122
 	$previous = null;
123 123
 	print '<div class="alphabet-legend">';
124
-	foreach($airport_names as $value) {
124
+	foreach ($airport_names as $value) {
125 125
 		$firstLetter = mb_strtoupper(mb_substr($value['airport_city'], 0, 1));
126
-		if($previous !== $firstLetter)
126
+		if ($previous !== $firstLetter)
127 127
 		{
128
-			if ($previous !== null){
128
+			if ($previous !== null) {
129 129
 				print ' | ';
130 130
 			}
131 131
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -134,13 +134,13 @@  discard block
 block discarded – undo
134 134
 	}
135 135
 	print '</div>';
136 136
 	$previous = null;
137
-	foreach($airport_names as $value) {
137
+	foreach ($airport_names as $value) {
138 138
 		$firstLetter = mb_strtoupper(mb_substr($value['airport_city'], 0, 1));
139 139
 		if ($firstLetter != "")
140 140
 		{
141
-			if($previous !== $firstLetter)
141
+			if ($previous !== $firstLetter)
142 142
 			{
143
-				if ($previous !== null){
143
+				if ($previous !== null) {
144 144
 					print '</div>';
145 145
 				}
146 146
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.
airport-statistics-arrival-airport-country.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 by Country from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
17
+	$title = sprintf(_("Most Common Arrival Airports by Country 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 by Country").'</h2>';
60
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin 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 by Country of origin of flights from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>';
61 61
 	$airport_country_array = $Spotter->countAllArrivalAirportCountriesByAirport($airport);
62 62
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
63 63
 	print '<div id="chartCountry" class="chart" width="100%"></div>
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
             var data = google.visualization.arrayToDataTable([
69 69
             	["'._("Country").'", "'._("# of times").'"], ';
70 70
             	$country_data = '';
71
-	foreach($airport_country_array as $airport_item)
71
+	foreach ($airport_country_array as $airport_item)
72 72
 	{
73 73
 		$country_data .= '[ "'.$airport_item['arrival_airport_country'].'",'.$airport_item['airport_arrival_country_count'].'],';
74 74
 	}
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		print '</thead>';
103 103
 		print '<tbody>';
104 104
 		$i = 1;
105
-		foreach($airport_country_array as $airport_item)
105
+		foreach ($airport_country_array as $airport_item)
106 106
 		{
107 107
 			print '<tr>';
108 108
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
airline-statistics-time.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/airline');
8 8
         die();
9 9
 }
10
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", "");
13 13
 
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Time of Day from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
17
+	$title = sprintf(_("Most Common Time of Day from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']);
18 18
 	require_once('header.php');
19 19
 	print '<div class="select-item">';
20 20
 	print '<form action="'.$globalURL.'/airline" method="post">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$airline_names = $Stats->getAllAirlineNames();
25 25
 	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
26
-	foreach($airline_names as $airline_name)
26
+	foreach ($airline_names as $airline_name)
27 27
 	{
28
-		if($airline == $airline_name['airline_icao'])
28
+		if ($airline == $airline_name['airline_icao'])
29 29
 		{
30 30
 			print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
31 31
 		} else {
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 	include('airline-sub-menu.php');
64 64
 	print '<div class="column">';
65 65
 	print '<h2>'._("Most Common Time of Day").'</h2>';
66
-	print '<p>'.sprintf(_("The statistic below shows the most common time of day from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
66
+	print '<p>'.sprintf(_("The statistic below shows the most common time of day from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>';
67 67
 	$hour_array = $Spotter->countAllHoursByAirline($airline);
68 68
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
69 69
 	print '<div id="chartHour" class="chart" width="100%"></div>
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
             var data = google.visualization.arrayToDataTable([
75 75
             	["'._("Hour").'", "'._("# of Flights").'"], ';
76 76
         $hour_data = '';
77
-	foreach($hour_array as $hour_item)
77
+	foreach ($hour_array as $hour_item)
78 78
 	{
79 79
 		$hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],';
80 80
 	}
Please login to merge, or discard this patch.
manufacturer-statistics-aircraft.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
         die();
9 9
 }
10 10
 $Spotter = new Spotter();
11
-$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
11
+$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)));
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort);
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Aircraft from %s"),$manufacturer);
17
+	$title = sprintf(_("Most Common Aircraft from %s"), $manufacturer);
18 18
 
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25 25
 	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
-	foreach($all_manufacturers as $all_manufacturer)
26
+	foreach ($all_manufacturers as $all_manufacturer)
27 27
 	{
28
-		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
28
+		if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
29 29
 		{
30 30
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
31 31
 		} else {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	include('manufacturer-sub-menu.php');
45 45
 	print '<div class="column">';
46 46
 	print '<h2>'._("Most Common Aircraft").'</h2>';
47
-	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."),$manufacturer).'</p>';
47
+	print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."), $manufacturer).'</p>';
48 48
 
49 49
 	$aircraft_array = $Spotter->countAllAircraftTypesByManufacturer($manufacturer);
50 50
 	if (!empty($aircraft_array))
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 		print '</thead>';
60 60
 		print '<tbody>';
61 61
 		$i = 1;
62
-		foreach($aircraft_array as $aircraft_item)
62
+		foreach ($aircraft_array as $aircraft_item)
63 63
 		{
64 64
 			print '<tr>';
65 65
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
date-detailed.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,20 +1,20 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once('require/class.Connection.php');
3
-require_once('require/class.Spotter.php');;
3
+require_once('require/class.Spotter.php'); ;
4 4
 require_once('require/class.Language.php');
5 5
 
6
-if (!isset($_GET['date'])){
6
+if (!isset($_GET['date'])) {
7 7
 	header('Location: '.$globalURL.'');
8 8
 } else {
9 9
 	$Spotter = new Spotter();
10 10
 	
11 11
 	//calculuation for the pagination
12
-	if(!isset($_GET['limit']))
12
+	if (!isset($_GET['limit']))
13 13
 	{
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19 19
 		$limit_start = $limit_explode[0];
20 20
 		$limit_end = $limit_explode[1];
@@ -28,22 +28,22 @@  discard block
 block discarded – undo
28 28
 	$limit_previous_1 = $limit_start - $absolute_difference;
29 29
 	$limit_previous_2 = $limit_end - $absolute_difference;
30 30
 	
31
-	$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING);
31
+	$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING);
32 32
 	$page_url = $globalURL.'/date/'.$date;
33 33
 	
34
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
34
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
35 35
 	if ($sort != '') 
36 36
 	{
37
-		$spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort);
37
+		$spotter_array = $Spotter->getSpotterDataByDate($date, $limit_start.",".$absolute_difference, $sort);
38 38
 	} else {
39
-		$spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference);
39
+		$spotter_array = $Spotter->getSpotterDataByDate($date, $limit_start.",".$absolute_difference);
40 40
 	}
41 41
 	
42 42
 	
43 43
 	if (!empty($spotter_array))
44 44
 	{
45 45
 		date_default_timezone_set($globalTimezone);
46
-		$title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
46
+		$title = sprintf(_("Detailed View for flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
47 47
 
48 48
 		require_once('header.php');
49 49
 		print '<div class="select-item">';
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 		print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>';
62 62
 		print '<br />';
63 63
 		print '<div class="info column">';
64
-		print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
64
+		print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
65 65
 		print '</div>';
66 66
 
67 67
 		include('date-sub-menu.php');
68 68
 		print '<div class="table column">';
69
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
69
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."), date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
70 70
  
71 71
 		include('table-output.php');
72 72
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
manufacturer-statistics-departure-airport-country.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,13 +8,13 @@  discard block
 block discarded – undo
8 8
         die();
9 9
 }
10 10
 $Spotter = new Spotter();
11
-$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
11
+$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)));
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort);
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("'Most Common Departure Airports by Country from %s"),$manufacturer);
17
+	$title = sprintf(_("'Most Common Departure Airports by Country from %s"), $manufacturer);
18 18
 
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25 25
 	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
-	foreach($all_manufacturers as $all_manufacturer)
26
+	foreach ($all_manufacturers as $all_manufacturer)
27 27
 	{
28
-		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
28
+		if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
29 29
 		{
30 30
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
31 31
 		} else {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	 include('manufacturer-sub-menu.php');
45 45
 	print '<div class="column">';
46 46
 	print '<h2>'._("Most Common Departure Airports by Country").'</h2>';
47
-	print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights from <strong>%s</strong>."),$manufacturer).'</p>';
47
+	print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights from <strong>%s</strong>."), $manufacturer).'</p>';
48 48
 
49 49
 	$airport_country_array = $Spotter->countAllDepartureAirportCountriesByManufacturer($manufacturer);
50 50
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             	["'._("Country").'", "'._("# of times").'"], ';
58 58
 
59 59
 	$country_data = '';
60
-	foreach($airport_country_array as $airport_item)
60
+	foreach ($airport_country_array as $airport_item)
61 61
 	{
62 62
 		$country_data .= '[ "'.$airport_item['departure_airport_country'].'",'.$airport_item['airport_departure_country_count'].'],';
63 63
 	}
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 		print '</thead>';
92 92
 		print '<tbody>';
93 93
 		$i = 1;
94
-		foreach($airport_country_array as $airport_item)
94
+		foreach ($airport_country_array as $airport_item)
95 95
 		{
96 96
 			print '<tr>';
97 97
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
manufacturer-statistics-time.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,14 +8,14 @@  discard block
 block discarded – undo
8 8
         die();
9 9
 }
10 10
 $Spotter = new Spotter();
11
-$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
11
+$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)));
12 12
 
13
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
14
-$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort);
13
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
14
+$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort);
15 15
 
16 16
 if (!empty($spotter_array))
17 17
 {
18
-	$title = sprintf(_("Most Common Time of Day from %s"),$manufacturer);
18
+	$title = sprintf(_("Most Common Time of Day from %s"), $manufacturer);
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
21 21
 	print '<form action="'.$globalURL.'/manufacturer" method="post">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25 25
 	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
-	foreach($all_manufacturers as $all_manufacturer)
26
+	foreach ($all_manufacturers as $all_manufacturer)
27 27
 	{
28
-		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
28
+		if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
29 29
 		{
30 30
 			print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>';
31 31
 		} else {
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	include('manufacturer-sub-menu.php');
45 45
 	print '<div class="column">';
46 46
 	print '<h2>'._("Most Common Time of Day").'</h2>';
47
-	print '<p>'.sprintf(_("The statistic below shows the most common time of day from <strong>%s</strong>."),$manufacturer).'</p>';
47
+	print '<p>'.sprintf(_("The statistic below shows the most common time of day from <strong>%s</strong>."), $manufacturer).'</p>';
48 48
 
49 49
 	$hour_array = $Spotter->countAllHoursByManufacturer($manufacturer);
50 50
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
             var data = google.visualization.arrayToDataTable([
57 57
             	["'._("Hour").'", "'._("# of Flights").'"], ';
58 58
             	$hour_data = '';
59
-	foreach($hour_array as $hour_item)
59
+	foreach ($hour_array as $hour_item)
60 60
 	{
61 61
 		$hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],';
62 62
 	}
Please login to merge, or discard this patch.