Completed
Push — master ( 2c5525...528bd8 )
by Yannick
32:59
created
require/class.Accident.php 1 patch
Braces   +87 added lines, -31 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 	public function __construct($dbc = null) {
21 21
 		$Connection = new Connection($dbc);
22 22
 		$this->db = $Connection->db();
23
-		if ($this->db === null) die('Error: No DB connection. (Accident)');
23
+		if ($this->db === null) {
24
+			die('Error: No DB connection. (Accident)');
25
+		}
24 26
 	}
25 27
 
26 28
 	/*
@@ -125,8 +127,11 @@  discard block
 block discarded – undo
125 127
 				$data = array();
126 128
 				if ($row['registration'] != '') {
127 129
 					$image_array = $Image->getSpotterImage($row['registration']);
128
-					if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
129
-					else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
130
+					if (count($image_array) > 0) {
131
+						$data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
132
+					} else {
133
+						$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
134
+					}
130 135
 					$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
131 136
 					$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
132 137
 					if (!empty($aircraft_info)) {
@@ -142,17 +147,30 @@  discard block
 block discarded – undo
142 147
 						$data['aircraft_base'] = $owner_data['base'];
143 148
 						$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
144 149
 					}
145
-				} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
146
-				if ($row['registration'] == '') $row['registration'] = 'NA';
147
-				if ($row['ident'] == '') $row['ident'] = 'NA';
150
+				} else {
151
+					$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
152
+				}
153
+				if ($row['registration'] == '') {
154
+					$row['registration'] = 'NA';
155
+				}
156
+				if ($row['ident'] == '') {
157
+					$row['ident'] = 'NA';
158
+				}
148 159
 				$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
149 160
 				if (isset($identicao[0])) {
150 161
 					if (substr($row['ident'],0,2) == 'AF') {
151
-						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
152
-						else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
153
-					} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
162
+						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
163
+							$icao = $row['ident'];
164
+						} else {
165
+							$icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
166
+						}
167
+					} else {
168
+						$icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
169
+					}
154 170
 					$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
155
-				} else $icao = $row['ident'];
171
+				} else {
172
+					$icao = $row['ident'];
173
+				}
156 174
 				$icao = $Translation->checkTranslation($icao,false);
157 175
 				//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
158 176
 				if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
@@ -167,10 +185,14 @@  discard block
 block discarded – undo
167 185
 					//else echo 'No data...'."\n";
168 186
 				}
169 187
 				$data = array_merge($row,$data);
170
-				if ($data['ident'] == null) $data['ident'] = $icao;
188
+				if ($data['ident'] == null) {
189
+					$data['ident'] = $icao;
190
+				}
171 191
 				if ($data['title'] == null) {
172 192
 					$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
173
-				} else $data['message'] = strtolower($data['title']);
193
+				} else {
194
+					$data['message'] = strtolower($data['title']);
195
+				}
174 196
 				$ids = $Spotter->getAllIDByRegistration($data['registration'],true);
175 197
 				$date = $data['date'];
176 198
 				if (isset($ids[$date])) {
@@ -189,8 +211,9 @@  discard block
 block discarded – undo
189 211
 		if (isset($result)) {
190 212
 			$result[0]['query_number_rows'] = $i;
191 213
 			return $result;
214
+		} else {
215
+			return array();
192 216
 		}
193
-		else return array();
194 217
 	}
195 218
 
196 219
 	/*
@@ -235,7 +258,9 @@  discard block
 block discarded – undo
235 258
 	*/
236 259
 	public function import($file) {
237 260
 		global $globalTransaction, $globalDebug;
238
-		if ($globalDebug) echo 'Import '.$file."\n";
261
+		if ($globalDebug) {
262
+			echo 'Import '.$file."\n";
263
+		}
239 264
 		$result = array();
240 265
 		if (file_exists($file)) {
241 266
 			if (($handle = fopen($file,'r')) !== FALSE) {
@@ -246,8 +271,11 @@  discard block
 block discarded – undo
246 271
 				}
247 272
 				fclose($handle);
248 273
 			}
249
-			if (!empty($result)) $this->add($result,true);
250
-			elseif ($globalDebug) echo 'Nothing to import';
274
+			if (!empty($result)) {
275
+				$this->add($result,true);
276
+			} elseif ($globalDebug) {
277
+				echo 'Nothing to import';
278
+			}
251 279
 		}
252 280
 	}
253 281
 
@@ -283,14 +311,23 @@  discard block
 block discarded – undo
283 311
 					}
284 312
 				}
285 313
 				fclose($handle);
286
-			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
287
-		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
314
+			} elseif ($globalDebug) {
315
+				echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
316
+			}
317
+		} elseif ($globalDebug) {
318
+			echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
319
+		}
288 320
 		$result = $Common->arr_diff($all_md5_new,$all_md5);
289
-		if (empty($result) && $globalDebug) echo 'Nothing to update';
321
+		if (empty($result) && $globalDebug) {
322
+			echo 'Nothing to update';
323
+		}
290 324
 		foreach ($result as $file => $md5) {
291 325
 			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
292
-			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
293
-			elseif ($globalDebug) echo 'Download '.$file.' failed';
326
+			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) {
327
+				$this->import(dirname(__FILE__).'/../install/tmp/'.$file);
328
+			} elseif ($globalDebug) {
329
+				echo 'Download '.$file.' failed';
330
+			}
294 331
 		}
295 332
 	}
296 333
 
@@ -307,13 +344,17 @@  discard block
 block discarded – undo
307 344
 		$Image = new Image($this->db);
308 345
 		$Spotter = new Spotter($this->db);
309 346
 
310
-		if (empty($crash)) return false;
347
+		if (empty($crash)) {
348
+			return false;
349
+		}
311 350
 		if (!$new) {
312 351
 			$query_delete = 'DELETE FROM accidents WHERE source = :source';
313 352
 			$sthd = $Connection->db->prepare($query_delete);
314 353
 			$sthd->execute(array(':source' => $crash[0]['source']));
315 354
 		}
316
-		if ($globalTransaction) $Connection->db->beginTransaction();
355
+		if ($globalTransaction) {
356
+			$Connection->db->beginTransaction();
357
+		}
317 358
 		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
318 359
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
319 360
 		$sth_check = $Connection->db->prepare($query_check);
@@ -328,7 +369,9 @@  discard block
 block discarded – undo
328 369
 					return $value === "" ? NULL : $value;
329 370
 				}, $cr);
330 371
 				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
331
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
372
+					if (strpos($cr['registration'],'-') === FALSE) {
373
+						$cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
374
+					}
332 375
 					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
333 376
 					$sth_check->execute($query_check_values);
334 377
 					$result_check = $sth_check->fetchAll(PDO::FETCH_ASSOC);
@@ -338,13 +381,19 @@  discard block
 block discarded – undo
338 381
 						if ($globalAircraftImageFetch && $cr['date'] > time()-(30*86400)) {
339 382
 							$imgchk = $Image->getSpotterImage($cr['registration']);
340 383
 							if (empty($imgchk)) {
341
-								if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...';
384
+								if ($globalDebug) {
385
+									echo "\t".'Get image for '.$cr['registration'].'...';
386
+								}
342 387
 								$Image->addSpotterImage($cr['registration']);
343
-								if ($globalDebug) echo "\t".'Done'."\n";
388
+								if ($globalDebug) {
389
+									echo "\t".'Done'."\n";
390
+								}
344 391
 							}
345 392
 							// elseif ($globalDebug) echo 'Image already in DB'."\n";
346 393
 						}
347
-						if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type'];
394
+						if ($cr['title'] == '') {
395
+							$cr['title'] = $cr['registration'].' '.$cr['type'];
396
+						}
348 397
 						$Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date']));
349 398
 					}
350 399
 				}
@@ -353,9 +402,13 @@  discard block
 block discarded – undo
353 402
 					$Connection->db->beginTransaction();
354 403
 				}
355 404
 			}
356
-			if ($globalTransaction) $Connection->db->commit();
405
+			if ($globalTransaction) {
406
+				$Connection->db->commit();
407
+			}
357 408
 		} catch(PDOException $e) {
358
-			if ($globalTransaction) $Connection->db->rollBack();
409
+			if ($globalTransaction) {
410
+				$Connection->db->rollBack();
411
+			}
359 412
 			echo $e->getMessage();
360 413
 		}
361 414
 		$sth_check->closeCursor();
@@ -394,8 +447,11 @@  discard block
 block discarded – undo
394 447
 			return "error : ".$e->getMessage();
395 448
 		}
396 449
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
397
-		if ($row['nb'] > 0) return false;
398
-		else return true;
450
+		if ($row['nb'] > 0) {
451
+			return false;
452
+		} else {
453
+			return true;
454
+		}
399 455
 	}
400 456
 
401 457
 	public static function insert_last_accidents_update() {
Please login to merge, or discard this patch.
search.php 1 patch
Braces   +142 added lines, -39 removed lines patch added patch discarded remove patch
@@ -46,8 +46,10 @@  discard block
 block discarded – undo
46 46
 			$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
47 47
 			$sql_date = $end_date;
48 48
 		}
49
-	} else $sql_date = '';
50
-}
49
+	} else {
50
+		$sql_date = '';
51
+	}
52
+	}
51 53
 
52 54
 if (isset($_GET['highest_altitude'])) {
53 55
 	//for altitude manipulation
@@ -61,8 +63,12 @@  discard block
 block discarded – undo
61 63
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
62 64
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
63 65
 		$sql_altitude = $start_altitude;
64
-	} else $sql_altitude = '';
65
-} else $sql_altitude = '';
66
+	} else {
67
+		$sql_altitude = '';
68
+	}
69
+	} else {
70
+	$sql_altitude = '';
71
+}
66 72
 
67 73
 //calculuation for the pagination
68 74
 if(!isset($_GET['limit']))
@@ -80,7 +86,7 @@  discard block
 block discarded – undo
80 86
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
81 87
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
82 88
 	}
83
-}  else {
89
+} else {
84 90
 	$limit_explode = explode(",", $_GET['limit']);
85 91
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
86 92
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -138,10 +144,15 @@  discard block
 block discarded – undo
138 144
 	$dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT);
139 145
 	$number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
140 146
 	if ($dist != '') {
141
-		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934;
142
-		elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852;
147
+		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') {
148
+			$dist = $dist*1.60934;
149
+		} elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') {
150
+			$dist = $dist*1.852;
151
+		}
152
+	}
153
+	if (!isset($sql_date)) {
154
+		$sql_date = '';
143 155
 	}
144
-	if (!isset($sql_date)) $sql_date = '';
145 156
 	if ($archive == 1) {
146 157
 		if ($type == 'aircraft') {
147 158
 			$SpotterArchive = new SpotterArchive();
@@ -219,7 +230,10 @@  discard block
 block discarded – undo
219 230
 		if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
220 231
 		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
221 232
 		if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; }
222
-		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; }
233
+		if (isset($_GET['highlights'])) {
234
+			if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> ';
235
+		}
236
+		}
223 237
 		if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; }
224 238
 		if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; }
225 239
 		if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; }
@@ -355,7 +369,10 @@  discard block
 block discarded – undo
355 369
 			<div class="form-group">
356 370
 				<label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label>
357 371
 				<div class="col-sm-10">
358
-					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
372
+					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) {
373
+	print $q;
374
+}
375
+?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
359 376
 				</div>
360 377
 			</div>
361 378
 		</fieldset>
@@ -374,7 +391,10 @@  discard block
 block discarded – undo
374 391
 					    </select>
375 392
 					</div>
376 393
 				</div>
377
-				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
394
+				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) {
395
+	print $manufacturer;
396
+}
397
+?>')</script>
378 398
 				<div class="form-group">
379 399
 					<label class="control-label col-sm-2"><?php echo _("Type"); ?></label>
380 400
 						<div class="col-sm-10">
@@ -383,11 +403,17 @@  discard block
 block discarded – undo
383 403
 							</select>
384 404
 						</div>
385 405
 				</div>
386
-				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
406
+				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) {
407
+	print $aircraft_icao;
408
+}
409
+?>');</script>
387 410
 				<div class="form-group">
388 411
 					<label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> 
389 412
 					<div class="col-sm-10">
390
-						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
413
+						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) {
414
+	print $registration;
415
+}
416
+?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
391 417
 					</div>
392 418
 				</div>
393 419
 <?php
@@ -396,22 +422,31 @@  discard block
 block discarded – undo
396 422
 				<div class="form-group">
397 423
 					<label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> 
398 424
 					<div class="col-sm-10">
399
-						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
425
+						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) {
426
+	print $pilot_id;
427
+}
428
+?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
400 429
 					</div>
401 430
 				</div>
402 431
 				<div class="form-group">
403 432
 					<label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> 
404 433
 					<div class="col-sm-10">
405
-						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" />
434
+						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) {
435
+	print $pilot_name;
436
+}
437
+?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" />
406 438
 					</div>
407 439
 				</div>
408 440
 <?php
409
-	}else {
441
+	} else {
410 442
 ?>
411 443
 				<div class="form-group">
412 444
 					<label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> 
413 445
 					<div class="col-sm-10">
414
-						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
446
+						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) {
447
+	print $owner;
448
+}
449
+?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
415 450
 					</div>
416 451
 				</div>
417 452
 <?php
@@ -419,8 +454,14 @@  discard block
 block discarded – undo
419 454
 ?>
420 455
 				<div class="form-group">
421 456
 					<div class="col-sm-offset-2 col-sm-10">
422
-					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
423
-					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label>
457
+					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
458
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
459
+}
460
+} ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
461
+					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
462
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
463
+}
464
+} ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label>
424 465
 					</div>
425 466
 				</div>
426 467
 			</fieldset>
@@ -434,7 +475,10 @@  discard block
 block discarded – undo
434 475
 						</select>
435 476
 					</div>
436 477
 				</div>
437
-				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script>
478
+				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) {
479
+	print $airline;
480
+}
481
+?>');</script>
438 482
 				<div class="form-group">
439 483
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
440 484
 					<div class="col-sm-10">
@@ -443,19 +487,34 @@  discard block
 block discarded – undo
443 487
 						</select>
444 488
 					</div>
445 489
 				</div>
446
-				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script>
490
+				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) {
491
+	print $airline_country;
492
+}
493
+?>');</script>
447 494
 				<div class="form-group">
448 495
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
449 496
 					<div class="col-sm-10">
450
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
497
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
498
+	print $callsign;
499
+}
500
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
451 501
 					</div>
452 502
 				</div>
453 503
 				<div class="form-group">
454 504
 					<div class="col-sm-offset-2 col-sm-10">
455 505
 						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
456
-						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
457
-						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
458
-						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
506
+						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) {
507
+	if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"';
508
+}
509
+} ?>> <?php echo _("Only Passenger airlines"); ?></label>
510
+						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) {
511
+	if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"';
512
+}
513
+} ?>> <?php echo _("Only Cargo airlines"); ?></label>
514
+						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) {
515
+	if ( $_GET['airline_type'] == "military"){ print 'checked="checked"';
516
+}
517
+} ?>> <?php echo _("Only Military airlines"); ?></label>
459 518
 					</div>
460 519
 				</div>
461 520
 			</fieldset>
@@ -469,7 +528,10 @@  discard block
 block discarded – undo
469 528
 						</select>
470 529
 					</div>
471 530
 				</div>
472
-				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
531
+				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) {
532
+	print $airport_icao;
533
+}
534
+?>');</script>
473 535
 				<div class="form-group">
474 536
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
475 537
 					<div class="col-sm-10">
@@ -478,7 +540,10 @@  discard block
 block discarded – undo
478 540
 						</select>
479 541
 					</div>
480 542
 				</div>
481
-				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script>
543
+				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) {
544
+	print $airport_country;
545
+}
546
+?>');</script>
482 547
 			</fieldset>
483 548
 			<fieldset>
484 549
 				<legend><?php echo _("Route"); ?></legend>
@@ -490,7 +555,10 @@  discard block
 block discarded – undo
490 555
 						</select>
491 556
 					</div>
492 557
 				</div>
493
-				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
558
+				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) {
559
+	print $departure_airport_route;
560
+}
561
+?>');</script>
494 562
 				<div class="form-group">
495 563
 					<label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> 
496 564
 					<div class="col-sm-10">
@@ -499,7 +567,10 @@  discard block
 block discarded – undo
499 567
 						</select>
500 568
 					</div>
501 569
 				</div>
502
-				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
570
+				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) {
571
+	print $arrival_airport_route;
572
+}
573
+?>');</script>
503 574
 			</fieldset>
504 575
 			<fieldset>
505 576
 				<legend>Altitude</legend>
@@ -549,19 +620,33 @@  discard block
 block discarded – undo
549 620
 				<div class="form-group">
550 621
 					<label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label>
551 622
 					<div class="col-sm-10">
552
-						<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" />
623
+						<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) {
624
+	print $origlat;
625
+}
626
+?>" />
553 627
 					</div>
554 628
 				</div>
555 629
 				<div class="form-group">
556 630
 					<label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label>
557 631
 					<div class="col-sm-10">
558
-						<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" />
632
+						<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) {
633
+	print $origlon;
634
+}
635
+?>" />
559 636
 					</div>
560 637
 				</div>
561 638
 				<div class="form-group">
562
-					<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label>
639
+					<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) {
640
+	print $globalDistanceUnit;
641
+} else {
642
+	print 'km';
643
+}
644
+print ')'; ?></label>
563 645
 					<div class="col-sm-10">
564
-						<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" />
646
+						<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) {
647
+	print $distance;
648
+}
649
+?>" />
565 650
 					</div>
566 651
 				</div>
567 652
 			</fieldset>
@@ -572,7 +657,10 @@  discard block
 block discarded – undo
572 657
 				<div class="form-group">
573 658
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
574 659
 					<div class="col-sm-10">
575
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
660
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
661
+	print $callsign;
662
+}
663
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
576 664
 					</div>
577 665
 				</div>
578 666
 			</fieldset>
@@ -583,7 +671,10 @@  discard block
 block discarded – undo
583 671
 				<div class="form-group">
584 672
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
585 673
 					<div class="col-sm-10">
586
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
674
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
675
+	print $callsign;
676
+}
677
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
587 678
 					</div>
588 679
 				</div>
589 680
 			</fieldset>
@@ -591,7 +682,10 @@  discard block
 block discarded – undo
591 682
 				<div class="form-group">
592 683
 					<label class="control-label col-sm-2"><?php echo _("MMSI"); ?></label> 
593 684
 					<div class="col-sm-10">
594
-						<input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) print $mmsi; ?>" size="8" placeholder="<?php echo _("MMSI"); ?>" />
685
+						<input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) {
686
+	print $mmsi;
687
+}
688
+?>" size="8" placeholder="<?php echo _("MMSI"); ?>" />
595 689
 					</div>
596 690
 				</div>
597 691
 			</fieldset>
@@ -599,7 +693,10 @@  discard block
 block discarded – undo
599 693
 				<div class="form-group">
600 694
 					<label class="control-label col-sm-2"><?php echo _("IMO"); ?></label> 
601 695
 					<div class="col-sm-10">
602
-						<input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) print $imo; ?>" size="8" placeholder="<?php echo _("IMO"); ?>" />
696
+						<input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) {
697
+	print $imo;
698
+}
699
+?>" size="8" placeholder="<?php echo _("IMO"); ?>" />
603 700
 					</div>
604 701
 				</div>
605 702
 			</fieldset>
@@ -612,7 +709,10 @@  discard block
 block discarded – undo
612 709
 					<label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label>
613 710
 					<div class="col-sm-10">
614 711
 						<div class='input-group date' id='datetimepicker1'>
615
-							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
712
+							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') {
713
+	print $start_date;
714
+}
715
+?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
616 716
 							<span class="input-group-addon">
617 717
 								<span class="glyphicon glyphicon-calendar"></span>
618 718
 							</span>
@@ -623,7 +723,10 @@  discard block
 block discarded – undo
623 723
 					<label class="control-label col-sm-2"><?php echo _("End Date"); ?></label>
624 724
 					<div class="col-sm-10">
625 725
 						<div class='input-group date' id='datetimepicker2'>
626
-						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" />
726
+						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') {
727
+	print $end_date;
728
+}
729
+?>" placeholder="<?php echo _("End Date/Time"); ?>" />
627 730
 						<span class="input-group-addon">
628 731
 							<span class="glyphicon glyphicon-calendar"></span>
629 732
 						</span>
Please login to merge, or discard this patch.
pilot-detailed.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,8 +37,12 @@  discard block
 block discarded – undo
37 37
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38 38
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') {
41
+		$filter = array_merge($filter,array('year' => $year));
42
+	}
43
+	if ($month != '') {
44
+		$filter = array_merge($filter,array('month' => $month));
45
+	}
42 46
 	if ($sort != '') 
43 47
 	{
44 48
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -56,8 +60,12 @@  discard block
 block discarded – undo
56 60
 	{
57 61
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
58 62
 		$ident = $spotter_array[0]['ident'];
59
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
63
+		if (isset($spotter_array[0]['latitude'])) {
64
+			$latitude = $spotter_array[0]['latitude'];
65
+		}
66
+		if (isset($spotter_array[0]['longitude'])) {
67
+			$longitude = $spotter_array[0]['longitude'];
68
+		}
61 69
 		require_once('header.php');
62 70
 		/*
63 71
 		if (isset($globalArchive) && $globalArchive) {
@@ -110,12 +118,18 @@  discard block
 block discarded – undo
110 118
 		*/
111 119
 		print '<div class="info column">';
112 120
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
113
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
121
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
122
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
123
+		}
114 124
 		if ($year == '' && $month == '') {
115 125
 			$Stats = new Stats();
116 126
 			$flights = $Stats->getStatsPilot($pilot);
117
-		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
127
+		} else {
128
+			$flights = 0;
129
+		}
130
+		if ($flights == 0) {
131
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
132
+		}
119 133
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120 134
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
121 135
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
@@ -126,7 +140,9 @@  discard block
 block discarded – undo
126 140
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
127 141
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128 142
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
129
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
143
+		if ($duration != '0') {
144
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
145
+		}
130 146
 		print '</div>';
131 147
 	
132 148
 		include('pilot-sub-menu.php');
Please login to merge, or discard this patch.
aircraft.php 1 patch
Braces   +15 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 	print '<h1>'._("Aircraft Types").'</h1>';
17 17
 
18 18
 	$aircraft_types = $Stats->getAllAircraftTypes();
19
-	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes();
19
+	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') {
20
+		$aircraft_types = $Spotter->getAllAircraftTypes();
21
+	}
20 22
 	$previous = null;
21 23
 	print '<div class="alphabet-legend">';
22 24
 	foreach($aircraft_types as $value) {
@@ -24,10 +26,14 @@  discard block
 block discarded – undo
24 26
 		$firstLetter = substr($value['aircraft_manufacturer'], 0, 1);
25 27
 		if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
26 28
 		{
27
-			if ($previous !== null) print ' | ';
29
+			if ($previous !== null) {
30
+				print ' | ';
31
+			}
28 32
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
29 33
 		}
30
-		if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter;
34
+		if ($firstLetter != '(' && $firstLetter != ')') {
35
+			$previous = $firstLetter;
36
+		}
31 37
 	}
32 38
 	print '</div>';
33 39
 	$previous = null;
@@ -38,10 +44,14 @@  discard block
 block discarded – undo
38 44
 		{
39 45
 			if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')')
40 46
 			{
41
-				if ($previous !== null) print '</div>';
47
+				if ($previous !== null) {
48
+					print '</div>';
49
+				}
42 50
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
43 51
 			}
44
-			if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter;
52
+			if ($firstLetter != '(' && $firstLetter != ')') {
53
+				$previous = $firstLetter;
54
+			}
45 55
 			print '<div class="alphabet-item">';
46 56
 			print '<a href="'.$globalURL.'/aircraft/'.$value['aircraft_icao'].'">';
47 57
 			if ($value['aircraft_name'] == '') {
Please login to merge, or discard this patch.
owner-detailed.php 1 patch
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -45,8 +45,12 @@  discard block
 block discarded – undo
45 45
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46 46
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
47 47
 	$filter = array();
48
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
49
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
48
+	if ($year != '') {
49
+		$filter = array_merge($filter,array('year' => $year));
50
+	}
51
+	if ($month != '') {
52
+		$filter = array_merge($filter,array('month' => $month));
53
+	}
50 54
 	if ($sort != '') 
51 55
 	{
52 56
 		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -64,8 +68,12 @@  discard block
 block discarded – undo
64 68
 	{
65 69
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
66 70
 		//$ident = $spotter_array[0]['ident'];
67
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
68
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
71
+		if (isset($spotter_array[0]['latitude'])) {
72
+			$latitude = $spotter_array[0]['latitude'];
73
+		}
74
+		if (isset($spotter_array[0]['longitude'])) {
75
+			$longitude = $spotter_array[0]['longitude'];
76
+		}
69 77
 		require_once('header.php');
70 78
 		/*
71 79
 		if (isset($globalArchive) && $globalArchive) {
@@ -120,9 +128,14 @@  discard block
 block discarded – undo
120 128
 		print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
121 129
 		//print '<div><span class="label">'._("Owner").'</span>'.$spotter_array[0]['aircraft_owner'].'</div>';
122 130
 		$Stats = new Stats();
123
-		if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
124
-		else $flights = 0;
125
-		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
131
+		if ($year == '' && $month == '') {
132
+			$flights = $Stats->getStatsOwner($owner);
133
+		} else {
134
+			$flights = 0;
135
+		}
136
+		if ($flights == 0) {
137
+			$flights = $Spotter->countFlightsByOwner($owner,$filter);
138
+		}
126 139
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
127 140
 		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
128 141
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
@@ -133,7 +146,9 @@  discard block
 block discarded – undo
133 146
 		$airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
134 147
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
135 148
 		$duration = $Spotter->getFlightDurationByOwner($owner,$filter);
136
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
149
+		if ($duration != '0') {
150
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
151
+		}
137 152
 		print '</div>';
138 153
 	
139 154
 		include('owner-sub-menu.php');
Please login to merge, or discard this patch.
require/class.Scheduler.php 1 patch
Braces   +180 added lines, -62 removed lines patch added patch discarded remove patch
@@ -24,7 +24,9 @@  discard block
 block discarded – undo
24 24
 	public function __construct($dbc = null) {
25 25
 		$Connection = new Connection($dbc);
26 26
 		$this->db = $Connection->db();
27
-		if ($this->db === null) die('Error: No DB connection.');
27
+		if ($this->db === null) {
28
+			die('Error: No DB connection.');
29
+		}
28 30
 	}
29 31
 
30 32
 	/**
@@ -139,7 +141,9 @@  discard block
 block discarded – undo
139 141
 		$sth->closeCursor();
140 142
 		if (count($row) > 0) {
141 143
 			return $row;
142
-		} else return array();
144
+		} else {
145
+			return array();
146
+		}
143 147
 	}
144 148
 
145 149
 	/*
@@ -180,7 +184,9 @@  discard block
 block discarded – undo
180 184
 		$Common = new Common();
181 185
 		$check_date = new Datetime($date);
182 186
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
183
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
187
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
188
+			return array();
189
+		}
184 190
 		$url = "http://www.airfrance.fr/cgi-bin/AF/FR/fr/local/resainfovol/infovols/detailsVolJson.do?codeCompagnie[0]=".$carrier."&numeroVol[0]=".$numvol."&dayFlightDate=".$check_date->format('d')."&yearMonthFlightDate=".$check_date->format('Ym');
185 191
 		$json = $Common->getData($url);
186 192
 		var_dump($json);
@@ -207,7 +213,9 @@  discard block
 block discarded – undo
207 213
 			*/
208 214
 		
209 215
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airfrance');
210
-		} else return array();
216
+		} else {
217
+			return array();
218
+		}
211 219
 	}
212 220
 
213 221
 	/**
@@ -222,7 +230,9 @@  discard block
 block discarded – undo
222 230
 		date_default_timezone_set($globalTimezone);
223 231
 		$check_date = new Datetime($date);
224 232
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
225
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
233
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
234
+			return array();
235
+		}
226 236
 		$url = "http://www.easyjet.com/ft/api/flights?date=".$check_date->format('Y-m-d')."&fn=".$callsign;
227 237
 		$json = $Common->getData($url);
228 238
 		$parsed_json = json_decode($json);
@@ -235,7 +245,9 @@  discard block
 block discarded – undo
235 245
 			$arrivalTime = $parsed_json->{'flights'}[0]->{'dates'}->{'fsta'};
236 246
 
237 247
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_easyjet');
238
-		} else return array();
248
+		} else {
249
+			return array();
250
+		}
239 251
 	}
240 252
 
241 253
 	/**
@@ -246,7 +258,9 @@  discard block
 block discarded – undo
246 258
 	private function getRyanair($callsign) {
247 259
 		$Common = new Common();
248 260
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
249
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
261
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
262
+			return array();
263
+		}
250 264
 		$url = "http://www.ryanair.com/fr/api/2/flight-info/0/50/";
251 265
 		$post = '{"flight":"'.$numvol.'","minDepartureTime":"00:00","maxDepartureTime":"23:59"}';
252 266
 		$headers = array('Content-Type: application/json','Content-Length: ' . strlen($post));
@@ -260,8 +274,12 @@  discard block
 block discarded – undo
260 274
 				$departureTime = $parsed_json->{'flightInfo'}[0]->{'departureTime'};
261 275
 				$arrivalTime = $parsed_json->{'flightInfo'}[0]->{'arrivalTime'};
262 276
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime, 'Source' => 'website_ryanair');
263
-			} else return array();
264
-		} else return array();
277
+			} else {
278
+				return array();
279
+			}
280
+		} else {
281
+			return array();
282
+		}
265 283
 	}
266 284
 
267 285
 	/**
@@ -272,7 +290,9 @@  discard block
 block discarded – undo
272 290
 	private function getSwiss($callsign) {
273 291
 		$Common = new Common();
274 292
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
275
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
293
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
294
+			return array();
295
+		}
276 296
 		$url = "http://www.world-of-swiss.com/fr/routenetwork.json";
277 297
 		$json = $Common->getData($url);
278 298
 		$parsed_json = json_decode($json);
@@ -292,8 +312,12 @@  discard block
 block discarded – undo
292 312
 			}
293 313
 			if (isset($DepartureAirportIata) && isset($ArrivalAirportIata)) {
294 314
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_swiss');
295
-			} else return array();
296
-		} else return array();
315
+			} else {
316
+				return array();
317
+			}
318
+		} else {
319
+			return array();
320
+		}
297 321
 	}
298 322
 	
299 323
 	/**
@@ -307,12 +331,18 @@  discard block
 block discarded – undo
307 331
 		$Common = new Common();
308 332
 		$check_date = new Datetime($date);
309 333
 		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
310
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
311
-		if ($globalBritishAirwaysKey == '') return array();
334
+		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) {
335
+			return array();
336
+		}
337
+		if ($globalBritishAirwaysKey == '') {
338
+			return array();
339
+		}
312 340
 		$url = "https://api.ba.com/rest-v1/v1/flights;flightNumber=".$numvol.";scheduledDepartureDate=".$check_date->format('Y-m-d').".json";
313 341
 		$headers = array('Client-Key: '.$globalBritishAirwaysKey);
314 342
 		$json = $Common->getData($url,'get','',$headers);
315
-		if ($json == '') return array();
343
+		if ($json == '') {
344
+			return array();
345
+		}
316 346
 		$parsed_json = json_decode($json);
317 347
 		$flights = $parsed_json->{'FlightsResponse'};
318 348
 		if (count($flights) > 0) {
@@ -321,7 +351,9 @@  discard block
 block discarded – undo
321 351
 			$departureTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledDepartureDateTime'}));
322 352
 			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightsResponse'}->{'Flight'}->{'Sector'}->{'ScheduledArrivalDateTime'}));
323 353
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_britishairways');
324
-		} else return array();
354
+		} else {
355
+			return array();
356
+		}
325 357
 	}
326 358
 
327 359
 	/**
@@ -335,19 +367,27 @@  discard block
 block discarded – undo
335 367
 		$Common = new Common();
336 368
 		$check_date = new Datetime($date);
337 369
 		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
338
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
339
-		if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') return array();
370
+		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) {
371
+			return array();
372
+		}
373
+		if (!isset($globalLufthansaKey) || $globalLufthansaKey == '' || !isset($globalLufthansaKey['key']) || $globalLufthansaKey['key'] == '') {
374
+			return array();
375
+		}
340 376
 		$url = "https://api.lufthansa.com/v1/oauth/token";
341 377
 		$post = array('client_id' => $globalLufthansaKey['key'],'client_secret' => $globalLufthansaKey['secret'],'grant_type' => 'client_credentials');
342 378
 		$data = $Common->getData($url,'post',$post);
343 379
 		$parsed_data = json_decode($data);
344
-		if (!isset($parsed_data->{'access_token'})) return array();
380
+		if (!isset($parsed_data->{'access_token'})) {
381
+			return array();
382
+		}
345 383
 		$token = $parsed_data->{'access_token'};
346 384
 		
347 385
 		$url = "https://api.lufthansa.com/v1/operations/flightstatus/LH".$numvol."/".$check_date->format('Y-m-d');
348 386
 		$headers = array('Authorization: Bearer '.$token,'Accept: application/json');
349 387
 		$json = $Common->getData($url,'get','',$headers);
350
-		if ($json == '') return array();
388
+		if ($json == '') {
389
+			return array();
390
+		}
351 391
 		$parsed_json = json_decode($json);
352 392
 		if (isset($parsed_json->{'FlightStatusResource'}) && count($parsed_json->{'FlightStatusResource'}) > 0) {
353 393
 			$DepartureAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Departure'}->{'AirportCode'};
@@ -355,7 +395,9 @@  discard block
 block discarded – undo
355 395
 			$ArrivalAirportIata = $parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'AirportCode'};
356 396
 			$arrivalTime = date('H:i',strtotime($parsed_json->{'FlightStatusResource'}->{'Flights'}->{'Flight'}->{'Arrival'}->{'ScheduledTimeLocal'}->{'DateTime'}));
357 397
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_lufthansa');
358
-		} else return array();
398
+		} else {
399
+			return array();
400
+		}
359 401
 	}
360 402
 
361 403
 	/**
@@ -369,14 +411,20 @@  discard block
 block discarded – undo
369 411
 		$Common = new Common();
370 412
 		$check_date = new Datetime($date);
371 413
 		$numvol = sprintf('%04d',preg_replace('/^[A-Z]*/','',$callsign));
372
-		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) return array();
373
-		if ($globalTransaviaKey == '') return array();
414
+		if (!filter_var(preg_replace('/^[A-Z]*/','',$callsign),FILTER_VALIDATE_INT)) {
415
+			return array();
416
+		}
417
+		if ($globalTransaviaKey == '') {
418
+			return array();
419
+		}
374 420
 		$url = "https://tst.api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
375 421
 		//$url = "https://api.transavia.com/v1/flightstatus/departuredate/".$check_date->format('Ymd').'/flightnumber/HV'.$numvol;
376 422
 		$headers = array('apikey: '.$globalTransaviaKey);
377 423
 		$json = $Common->getData($url,'get','',$headers);
378 424
 		//echo 'result : '.$json;
379
-		if ($json == '') return array();
425
+		if ($json == '') {
426
+			return array();
427
+		}
380 428
 		$parsed_json = json_decode($json);
381 429
 		
382 430
 		if (isset($parsed_json->{'data'}[0])) {
@@ -385,7 +433,9 @@  discard block
 block discarded – undo
385 433
 			$ArrivalAirportIata = $parsed_json->{'data'}[0]->{'flight'}->{'arrivalAirport'}->{'locationCode'};
386 434
 			$arrivalTime = date('H:i',strtotime($parsed_json->{'data'}[0]->{'flight'}->{'arrivalDateTime'}));
387 435
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_transavia');
388
-		} else return array();
436
+		} else {
437
+			return array();
438
+		}
389 439
 	}
390 440
 
391 441
 	/**
@@ -396,7 +446,9 @@  discard block
 block discarded – undo
396 446
 	public function getTunisair($callsign) {
397 447
 		$Common = new Common();
398 448
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
399
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
449
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
450
+			return array();
451
+		}
400 452
 		$url = "http://www.tunisair.com/site/publish/module/Volj/fr/Flight_List.asp";
401 453
 		$data = $Common->getData($url);
402 454
 		$table = $Common->table2array($data);
@@ -417,7 +469,9 @@  discard block
 block discarded – undo
417 469
 		$Common = new Common();
418 470
 		$check_date = new Datetime($date);
419 471
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
420
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
472
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
473
+			return array();
474
+		}
421 475
 		$final_date = str_replace('/','%2F',$check_date->format('d/m/Y'));
422 476
 		$url = "http://www.vueling.com/Base/BaseProxy/RenderMacro/?macroalias=FlightStatusResult&searchBy=bycode&date=".$final_date."&flightNumber=".$numvol."&idioma=en-GB";
423 477
 		$data = $Common->getData($url);
@@ -427,8 +481,11 @@  discard block
 block discarded – undo
427 481
 			$DepartureAirportIata = str_replace('flightOri=','',$result[0]);
428 482
 			preg_match('/flightDest=[A-Z]{3}/',$data,$result);
429 483
 			$ArrivalAirportIata = str_replace('flightDest=','',$result[0]);
430
-			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling');
431
-			else return array();
484
+			if ($DepartureAirportIata != '' && $ArrivalAirportIata != '') {
485
+				return array('DepartureAirportIATA' => $DepartureAirportIata,'ArrivalAirportIATA' => $ArrivalAirportIata,'Source' => 'website_vueling');
486
+			} else {
487
+				return array();
488
+			}
432 489
 		}
433 490
 		return array();
434 491
 	}
@@ -443,7 +500,9 @@  discard block
 block discarded – undo
443 500
 		$Common = new Common();
444 501
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
445 502
 		$check_date = new Datetime($date);
446
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
503
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
504
+			return array();
505
+		}
447 506
 		$url = "https://www.iberia.com/web/flightDetail.do";
448 507
 		$post = array('numvuelo' => $numvol,'fecha' => $check_date->format('Ymd'),'airlineID' => 'IB');
449 508
 		$data = $Common->getData($url,'post',$post);
@@ -460,7 +519,9 @@  discard block
 block discarded – undo
460 519
 				$arrivalTime = trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][1])));
461 520
 				if ($arrivalTime == 'Hora estimada de llegada') {
462 521
 					$arrivalTime = substr(trim(str_replace(' lunes','',str_replace('&nbsp;','',$flight[5][2]))),0,5);
463
-				} else $arrivalTime = substr($arrivalTime,0,5);
522
+				} else {
523
+					$arrivalTime = substr($arrivalTime,0,5);
524
+				}
464 525
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_iberia');
465 526
 			}
466 527
 		}
@@ -478,7 +539,9 @@  discard block
 block discarded – undo
478 539
 		$Common = new Common();
479 540
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
480 541
 		$check_date = new Datetime($date);
481
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
542
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
543
+			return array();
544
+		}
482 545
 		$url = "http://www.staralliance.com/flifoQueryAction.do?myAirline=&airlineCode=".$carrier."&flightNo=".$numvol."&day=".$check_date->format('d')."&month=".$check_date->format('m')."&year=".$check_date->format('Y')."&departuredate=".$check_date->format('d-M-Y');
483 546
 		$data = $Common->getData($url);
484 547
 		if ($data != '') {
@@ -494,7 +557,9 @@  discard block
 block discarded – undo
494 557
 					$departureTime = substr(trim(str_replace('Scheduled: ','',$flight[29][0])),0,5);
495 558
 					$arrivalTime = substr(trim(str_replace('Scheduled: ','',$flight[29][1])),0,5);
496 559
 					return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_staralliance');
497
-				} else return array();
560
+				} else {
561
+					return array();
562
+				}
498 563
 			}
499 564
 			
500 565
 
@@ -514,7 +579,9 @@  discard block
 block discarded – undo
514 579
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
515 580
 		$check_date = new Datetime($date);
516 581
 		$url= "http://booking.alitalia.com/FlightStatus/fr_fr/FlightInfo?Brand=az&NumeroVolo=".$numvol."&DataCompleta=".$check_date->format('d/m/Y');
517
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
582
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
583
+			return array();
584
+		}
518 585
 		$data = $Common->getData($url);
519 586
 		if ($data != '') {
520 587
 			$table = $Common->text2array($data);
@@ -538,7 +605,9 @@  discard block
 block discarded – undo
538 605
 		$check_date = new Datetime($date);
539 606
 		$url= "http://www.brusselsairlines.com/api/flightstatus/getresults?from=NA&to=NA&date=".$check_date->format('d/m/Y')."&hour=NA&lookup=flightnumber&flightnumber=".$numvol."&publicationID=302";
540 607
 		//http://www.brusselsairlines.com/fr-fr/informations-pratiques/statut-de-votre-vol/resultat.aspx?flightnumber=".$numvol."&date=".$check_date->format('d/m/Y')."&lookup=flightnumber";
541
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
608
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
609
+			return array();
610
+		}
542 611
 		$data = $Common->getData($url);
543 612
 		if ($data != '') {
544 613
 		    //echo $data;
@@ -628,7 +697,9 @@  discard block
 block discarded – undo
628 697
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
629 698
 		$url= "http://www.flytap.com/France/fr/PlanifierEtReserver/Outils/DepartsEtArrivees";
630 699
 		//$check_date = new Datetime($date);
631
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
700
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
701
+			return array();
702
+		}
632 703
 		$post = array('arrivalsdepartures_content' => 'number','arrivalsdepartures_tp' => $numvol,'arrivalsdepartures_trk' => 'ARR','arrivalsdepartures_date_trk' => '1','aptCode' => '','arrivalsdepartures' => 'DEP','arrivalsdepartures_date' => '1','aptCodeFrom' => '','aptCodeTo' => '','arrivalsdepartures2' => 'DEP','arrivalsdepartures_date2' => '1');
633 704
 		$data = $Common->getData($url,'post',$post);
634 705
 		if ($data != '') {
@@ -660,11 +731,15 @@  discard block
 block discarded – undo
660 731
 				$airline_icao = substr($callsign, 0, 3);
661 732
 			} 
662 733
 		}
663
-		if ($airline_icao == '') return array();
734
+		if ($airline_icao == '') {
735
+			return array();
736
+		}
664 737
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
665 738
 		$url= "http://info.flightmapper.net/flight/".$airline_icao.'_'.$numvol;
666 739
 		//$check_date = new Datetime($date);
667
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
740
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
741
+			return array();
742
+		}
668 743
 		$data = $Common->getData($url);
669 744
 		if ($data != '') {
670 745
 			$table = $Common->table2array($data);
@@ -757,10 +832,16 @@  discard block
 block discarded – undo
757 832
 		if ($data != '') {
758 833
 			$table = $Common->table2array($data);
759 834
 			if (isset($table[11][1])) {
760
-				if (is_numeric(substr($table[11][1],0,1))) $departureTime = substr($table[11][1],0,5);
761
-				else $departureTime = '';
762
-				if (is_numeric(substr($table[17][1],0,1))) $arrivalTime = substr($table[17][1],0,5);
763
-				else $arrivalTime = '';
835
+				if (is_numeric(substr($table[11][1],0,1))) {
836
+					$departureTime = substr($table[11][1],0,5);
837
+				} else {
838
+					$departureTime = '';
839
+				}
840
+				if (is_numeric(substr($table[17][1],0,1))) {
841
+					$arrivalTime = substr($table[17][1],0,5);
842
+				} else {
843
+					$arrivalTime = '';
844
+				}
764 845
 				$DepartureAirportIata = substr($table[13][1],0,3);
765 846
 				$ArrivalAirportIata = substr($table[15][1],0,3);
766 847
 				return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_costtotravel');
@@ -777,16 +858,22 @@  discard block
 block discarded – undo
777 858
 	*/
778 859
 	private function getAirCanada($callsign,$date = 'NOW') {
779 860
 		$Common = new Common();
780
-		if (class_exists("DomDocument") === FALSE) return array();
861
+		if (class_exists("DomDocument") === FALSE) {
862
+			return array();
863
+		}
781 864
 		date_default_timezone_set('UTC');
782 865
 		$check_date = new Datetime($date);
783 866
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
784 867
 		$url= "http://services.aircanada.com/portal/rest/getFlightsByFlightNumber?forceTimetable=true&flightNumber=".$numvol."&carrierCode=AC&date=".$check_date->format('m-d-Y')."&app_key=AE919FDCC80311DF9BABC975DFD72085&cache=74249";
785
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
868
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
869
+			return array();
870
+		}
786 871
 		$data = $Common->getData($url);
787 872
 		$dom = new DomDocument();
788 873
 		$dom->loadXML($data);
789
-		if ($dom->getElementsByTagName('DepartureStationInfo')->length == 0) return array();
874
+		if ($dom->getElementsByTagName('DepartureStationInfo')->length == 0) {
875
+			return array();
876
+		}
790 877
 		$departure = $dom->getElementsByTagName('DepartureStationInfo')->item(0);
791 878
 		if (isset($departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue)) {
792 879
 			$DepartureAirportIata = $departure->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
@@ -795,7 +882,9 @@  discard block
 block discarded – undo
795 882
 			$ArrivalAirportIata = $arrival->getElementsByTagName('Airport')->item(0)->firstChild->nodeValue;
796 883
 			$arrivalTime = date('H:i',strtotime($arrival->getElementsByTagName('ScheduledTime')->item(0)->firstChild->nodeValue));
797 884
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_aircanada');
798
-		} else return array();
885
+		} else {
886
+			return array();
887
+		}
799 888
 	}
800 889
 
801 890
 	/**
@@ -809,7 +898,9 @@  discard block
 block discarded – undo
809 898
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
810 899
 		$check_date = new Datetime($date);
811 900
 		$url= "https://cat.sabresonicweb.com/SSWVN/meridia?posid=VNVN&page=flifoFlightInfoDetailsMessage_learn&action=flightInfoDetails&airline=VN&language=fr&depDay=".$check_date->format('j')."&depMonth=".strtoupper($check_date->format('M'))."&=&flight=".$numvol."&";
812
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
901
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
902
+			return array();
903
+		}
813 904
 		$data = $Common->getData($url);
814 905
 		if ($data != '') {
815 906
 			$table = $Common->table2array($data);
@@ -838,7 +929,9 @@  discard block
 block discarded – undo
838 929
 		$numvol = preg_replace('/^[A-Z]*/','',$callsign);
839 930
 		$check_date = new Datetime($date);
840 931
 		$url= "http://www.airberlin.com/en-US/site/aims.php";
841
-		if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array();
932
+		if (!filter_var($numvol,FILTER_VALIDATE_INT)) {
933
+			return array();
934
+		}
842 935
 		$post = array('type' => 'departure','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => $carrier);
843 936
 		$data = $Common->getData($url,'post',$post);
844 937
 		//echo $data;
@@ -848,11 +941,19 @@  discard block
 block discarded – undo
848 941
 		if ($data != '') {
849 942
 			$table = $Common->table2array($data);
850 943
 			$flight = $table;
851
-			if (isset($flight[5][4])) $departureTime = $flight[5][4];
852
-			else $departureTime = '';
853
-			if (isset($flight[5][2])) $departureAirport = $flight[5][2];
854
-			else $departureAirport = '';
855
-		} else return array();
944
+			if (isset($flight[5][4])) {
945
+				$departureTime = $flight[5][4];
946
+			} else {
947
+				$departureTime = '';
948
+			}
949
+			if (isset($flight[5][2])) {
950
+				$departureAirport = $flight[5][2];
951
+			} else {
952
+				$departureAirport = '';
953
+			}
954
+		} else {
955
+			return array();
956
+		}
856 957
 		$post = array('type' => 'arrival','searchFlightNo' => '1','requestsent' => 'true', 'flightno' => $numvol,'date' => $check_date->format('Y-m-d'),'carrier' => 'AB');
857 958
 		$data = $Common->getData($url,'post',$post);
858 959
 		if ($data != '') {
@@ -865,10 +966,14 @@  discard block
 block discarded – undo
865 966
 			    $arrivalTime = '';
866 967
 			    $arrivalAirport = '';
867 968
 			}
868
-		} else return array();
969
+		} else {
970
+			return array();
971
+		}
869 972
 		$url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner';
870 973
 		$json = $Common->getData($url);
871
-		if ($json == '') return array();
974
+		if ($json == '') {
975
+			return array();
976
+		}
872 977
 		$parsed_json = json_decode($json);
873 978
 		$airports = $parsed_json->{'suggestList'};
874 979
 		if (count($airports) > 0) {
@@ -883,7 +988,9 @@  discard block
 block discarded – undo
883 988
 		}
884 989
 		if (isset($DepartureAirportIata)) {
885 990
 			return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_airberlin');
886
-		} else return array();
991
+		} else {
992
+			return array();
993
+		}
887 994
 	}
888 995
 
889 996
 	/*
@@ -895,7 +1002,9 @@  discard block
 block discarded – undo
895 1002
 	public function fetchSchedule($ident,$date = 'NOW') {
896 1003
 		global $globalSchedulesSources, $globalSchedulesFetch, $globalOffline, $globalFlightAwareUsername;
897 1004
 		//$Common = new Common();
898
-		if ($globalSchedulesFetch === FALSE || (isset($globalOffline) && $globalOffline === TRUE)) return array();
1005
+		if ($globalSchedulesFetch === FALSE || (isset($globalOffline) && $globalOffline === TRUE)) {
1006
+			return array();
1007
+		}
899 1008
 		$airline_icao = '';
900 1009
 		if (!is_numeric(substr($ident, 0, 3)))
901 1010
 		{
@@ -1130,18 +1239,27 @@  discard block
 block discarded – undo
1130 1239
 					if (strlen($airline_icao) == 3) {
1131 1240
 						$Spotter = new Spotter($this->db);
1132 1241
 						$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
1133
-						if (isset($airline_info[0]['iata'])) $airline_icao = $airline_info[0]['iata'];
1242
+						if (isset($airline_info[0]['iata'])) {
1243
+							$airline_icao = $airline_info[0]['iata'];
1244
+						}
1134 1245
 					}
1135 1246
 					// Randomly use a generic function to get hours
1136 1247
 					if (strlen($airline_icao) == 2) {
1137
-						if (!isset($globalSchedulesSources)) $globalSchedulesSources = array('flightmapper','costtotravel','flightaware');
1248
+						if (!isset($globalSchedulesSources)) {
1249
+							$globalSchedulesSources = array('flightmapper','costtotravel','flightaware');
1250
+						}
1138 1251
 						if (count($globalSchedulesSources) > 0) {
1139 1252
 							$rand = mt_rand(0,count($globalSchedulesSources)-1);
1140 1253
 							$source = $globalSchedulesSources[$rand];
1141
-							if ($source == 'flightmapper') return $this->getFlightMapper($ident);
1142
-							elseif ($source == 'costtotravel') return $this->getCostToTravel($ident);
1254
+							if ($source == 'flightmapper') {
1255
+								return $this->getFlightMapper($ident);
1256
+							} elseif ($source == 'costtotravel') {
1257
+								return $this->getCostToTravel($ident);
1258
+							}
1143 1259
 							//elseif ($source == 'flightradar24') return $this->getFlightRadar24($ident,$date);
1144
-							elseif ($source == 'flightaware' && $globalFlightAwareUsername != '') return $this->getFlightAware($ident);
1260
+							elseif ($source == 'flightaware' && $globalFlightAwareUsername != '') {
1261
+								return $this->getFlightAware($ident);
1262
+							}
1145 1263
 						}
1146 1264
 					}
1147 1265
 			}
Please login to merge, or discard this patch.
scripts/update_db.php 1 patch
Braces   +30 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@  discard block
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
12
+	foreach ($output as $line) {
13
+		if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
14
+	}
13 15
 	if ($j > 1) {
14 16
 		echo "Script is already runnning...";
15 17
 		die();
@@ -29,14 +31,18 @@  discard block
 block discarded – undo
29 31
 			$update_db->update_notam();
30 32
 		}
31 33
 		$update_db->insert_last_notam_update();
32
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
34
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
35
+		echo "NOTAM are only updated once a day.\n";
36
+	}
33 37
 	if ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
34 38
 		$update_db->update_all();
35 39
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
36 40
 	//	$Spotter = new Spotter();
37 41
 	//	$Spotter->updateFieldsFromOtherTables();
38 42
 		$update_db->insert_last_update();
39
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
43
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
44
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
45
+	}
40 46
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
41 47
 		echo "Check if new airspace version exist...";
42 48
 		echo $update_db->update_airspace_fam();
@@ -45,8 +51,11 @@  discard block
 block discarded – undo
45 51
 	if (isset($globalGeoid) && $globalGeoid && $update_db->check_last_geoid_update()) {
46 52
 		echo "Check if new geoid version exist...";
47 53
 		$error = $update_db->update_geoid_fam();
48
-		if ($error == '') $update_db->insert_last_geoid_update();
49
-		else echo $error;
54
+		if ($error == '') {
55
+			$update_db->insert_last_geoid_update();
56
+		} else {
57
+			echo $error;
58
+		}
50 59
 	}
51 60
 	if (isset($globalMarine) && $globalMarine && $update_db->check_last_marine_identity_update()) {
52 61
 		echo "Check if new marine identity version exist...";
@@ -64,13 +73,17 @@  discard block
 block discarded – undo
64 73
 			//echo "Done";
65 74
 		}
66 75
 		$update_db->insert_last_owner_update();
67
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
76
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
77
+		echo "Owner are only updated every 15 days.\n";
78
+	}
68 79
 
69 80
 	if ($update_db->check_last_airlines_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
70 81
 		echo "Updating airlines...\n";
71 82
 		echo $update_db->update_airlines_fam();
72 83
 		$update_db->insert_last_airlines_update();
73
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Airlines are only updated every 15 days.\n";
84
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
85
+		echo "Airlines are only updated every 15 days.\n";
86
+	}
74 87
 
75 88
 	if (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
76 89
 		require_once(dirname(__FILE__).'/../require/class.Accident.php');
@@ -79,7 +92,9 @@  discard block
 block discarded – undo
79 92
 		if ($Accident->check_last_accidents_update()) {
80 93
 			$Accident->download_update();
81 94
 			$Accident->insert_last_accidents_update();
82
-		} else echo "Accidents are updated once a day.\n";
95
+		} else {
96
+			echo "Accidents are updated once a day.\n";
97
+		}
83 98
 	}
84 99
   
85 100
 }
@@ -92,7 +107,9 @@  discard block
 block discarded – undo
92 107
 		if ($METAR->check_last_update()) {
93 108
 			$METAR->addMETARCycle();
94 109
 			$METAR->insert_last_update();
95
-		} else echo "METAR are only updated every 30 minutes.\n";
110
+		} else {
111
+			echo "METAR are only updated every 30 minutes.\n";
112
+		}
96 113
 	}
97 114
 
98 115
 	if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
@@ -100,8 +117,10 @@  discard block
 block discarded – undo
100 117
 		//$update_db->update_oneworld();
101 118
 		$update_db->update_skyteam();
102 119
 		$update_db->insert_last_schedules_update();
103
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
104
-}
120
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
121
+		echo "Schedules are only updated every 15 days.\n";
122
+	}
123
+	}
105 124
 
106 125
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
107 126
 	echo "Updating statistics and archive old data...\n";
Please login to merge, or discard this patch.
require/class.GeoidHeight.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,8 +38,11 @@  discard block
 block discarded – undo
38 38
 		global $globalGeoidSource;
39 39
 		//if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm';
40 40
 		if ($name == '') {
41
-			if (isset($globalGeoidSource) && $globalGeoidSource != '') $name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm';
42
-			else $name = dirname(__FILE__).'/../data/egm96-15.pgm';
41
+			if (isset($globalGeoidSource) && $globalGeoidSource != '') {
42
+				$name = dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm';
43
+			} else {
44
+				$name = dirname(__FILE__).'/../data/egm96-15.pgm';
45
+			}
43 46
 		}
44 47
 
45 48
 		if (file_exists($name) === FALSE) {
@@ -159,7 +162,9 @@  discard block
 block discarded – undo
159 162
 				}
160 163
 			}
161 164
 			$this->t = $t;
162
-		} else $t = $this->t;
165
+		} else {
166
+			$t = $this->t;
167
+		}
163 168
 		if (!($cubic)) {
164 169
 			$a = (((1 - $fx) * $this->v00) + ($fx * $this->v01));
165 170
 			$b = (((1 - $fx) * $this->v10) + ($fx * $this->v11));
Please login to merge, or discard this patch.
tools-geoid.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
 	print '<h1>'._("Geoid Height Calculator").'</h1>';
12 12
 	print '</div>';
13 13
 	print '<p>Not available</p>';
14
-	if (isset($globalDebug) && $globalDebug) echo '<p>'.$e.'</p>';
14
+	if (isset($globalDebug) && $globalDebug) {
15
+		echo '<p>'.$e.'</p>';
16
+	}
15 17
 	require_once('footer.php');
16 18
 	exit();
17 19
 }
@@ -69,8 +71,11 @@  discard block
 block discarded – undo
69 71
 		print '<div class="col-sm-6">'.round($altitude-$geoid,3).'</div>';
70 72
 	}
71 73
 	print '<div class="col-sm-6"><b>Earth Gravity Model</b></div>';
72
-	if (isset($globalGeoidSource) && $globalGeoidSource != '') $geoidsource = $globalGeoidSource;
73
-	else $geoidsource = 'EGM96-15';
74
+	if (isset($globalGeoidSource) && $globalGeoidSource != '') {
75
+		$geoidsource = $globalGeoidSource;
76
+	} else {
77
+		$geoidsource = 'EGM96-15';
78
+	}
74 79
 	print '<div class="col-sm-6">'.$geoidsource.'</div>';
75 80
 	print '</div>';
76 81
 }
Please login to merge, or discard this patch.