Completed
Push — master ( 52a4df...30fb54 )
by Yannick
12:47 queued 06:49
created
statistics-manufacturer.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Aircraft Manufacturer");
7 7
 
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 12
 if ($airline_icao == 'all') {
11 13
     unset($_COOKIE['stats_airline_icao']);
@@ -14,8 +16,10 @@  discard block
 block discarded – undo
14 16
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15 17
     $airline_icao = $_COOKIE['stats_airline_icao'];
16 18
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18
-}
19
+    if (isset($globalFilter['airline'])) {
20
+    	$airline_icao = $globalFilter['airline'][0];
21
+    }
22
+    }
19 23
 setcookie('stats_airline_icao',$airline_icao);
20 24
 
21 25
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
statistics-sub-menu.php 1 patch
Braces   +10 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,7 +4,13 @@  discard block
 block discarded – undo
4 4
 	<div class="stats_airline">
5 5
 	
6 6
 		<form id="changedate" method="post">
7
-			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" />
7
+			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') {
8
+	echo $year.'-';
9
+}
10
+?><?php if (isset($month) && $month != '') {
11
+	echo $month;
12
+}
13
+?>" />
8 14
 		</form>
9 15
 	
10 16
 		<form>
@@ -12,7 +18,9 @@  discard block
 block discarded – undo
12 18
 				<?php
13 19
 					require_once('require/class.Stats.php');
14 20
 					$Stats = new Stats();
15
-					if (!isset($filter_name)) $filter_name = '';
21
+					if (!isset($filter_name)) {
22
+						$filter_name = '';
23
+					}
16 24
 					$airlines = $Stats->getAllAirlineNames($filter_name);
17 25
 					if (isset($airline_icao) && ($airline_icao == '' || $airline_icao == 'all')) {
18 26
 						print '<option value="all" selected>All</option>';
Please login to merge, or discard this patch.
statistics-airline.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Airline");
7 7
 require_once('header.php');
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
10 12
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
11 13
 include('statistics-sub-menu.php'); 
Please login to merge, or discard this patch.
statistics-airport-arrival-country.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Arrival Airport by Country");
7 7
 
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 12
 if ($airline_icao == 'all') {
11 13
     unset($_COOKIE['stats_airline_icao']);
@@ -14,8 +16,10 @@  discard block
 block discarded – undo
14 16
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15 17
     $airline_icao = $_COOKIE['stats_airline_icao'];
16 18
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18
-}
19
+    if (isset($globalFilter['airline'])) {
20
+    	$airline_icao = $globalFilter['airline'][0];
21
+    }
22
+    }
19 23
 setcookie('stats_airline_icao',$airline_icao);
20 24
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
21 25
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
statistics.php 1 patch
Braces   +50 added lines, -28 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 $Stats = new Stats();
7 7
 $title = _("Statistics");
8 8
 
9
-if (!isset($filter_name)) $filter_name = '';
9
+if (!isset($filter_name)) {
10
+	$filter_name = '';
11
+}
10 12
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
11 13
 if ($airline_icao == 'all') {
12 14
 	unset($_COOKIE['stats_airline_icao']);
@@ -15,8 +17,10 @@  discard block
 block discarded – undo
15 17
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
16 18
 	$airline_icao = $_COOKIE['stats_airline_icao'];
17 19
 } elseif ($airline_icao == '' && isset($globalFilter)) {
18
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
19
-}
20
+	if (isset($globalFilter['airline'])) {
21
+		$airline_icao = $globalFilter['airline'][0];
22
+	}
23
+	}
20 24
 setcookie('stats_airline_icao',$airline_icao);
21 25
 
22 26
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
@@ -40,7 +44,9 @@  discard block
 block discarded – undo
40 44
 	if (isset($last_update[0]['value'])) {
41 45
 		date_default_timezone_set('UTC');
42 46
 		$lastupdate = strtotime($last_update[0]['value']);
43
-		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
47
+		if (isset($globalTimezone) && $globalTimezone != '') {
48
+			date_default_timezone_set($globalTimezone);
49
+		}
44 50
 		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
45 51
 	}
46 52
     ?>
@@ -90,8 +96,9 @@  discard block
 block discarded – undo
90 96
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
91 97
                  <?php
92 98
                   $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
93
-		    if (count($aircraft_array) == 0) print _("No data available");
94
-		    else {
99
+		    if (count($aircraft_array) == 0) {
100
+		    	print _("No data available");
101
+		    } else {
95 102
 
96 103
                     print '<div id="chart1" class="chart" width="100%"></div>
97 104
                     <script> 
@@ -201,8 +208,9 @@  discard block
 block discarded – undo
201 208
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
202 209
 <?php
203 210
 	$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
204
-	if (count($pilot_array) == 0) print _("No data available");
205
-	else {
211
+	if (count($pilot_array) == 0) {
212
+		print _("No data available");
213
+	} else {
206 214
 	    print '<div id="chart7" class="chart" width="100%"></div>
207 215
                     <script> 
208 216
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -247,8 +255,9 @@  discard block
 block discarded – undo
247 255
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
248 256
 <?php
249 257
 	$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
250
-	if (count($owner_array) == 0) print _("No data available");
251
-	else {
258
+	if (count($owner_array) == 0) {
259
+		print _("No data available");
260
+	} else {
252 261
 	    print '<div id="chart7" class="chart" width="100%"></div>
253 262
                     <script> 
254 263
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -294,8 +303,9 @@  discard block
 block discarded – undo
294 303
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
295 304
 <?php
296 305
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
297
-	if (count($flightover_array) == 0) print _("No data available");
298
-	else {
306
+	if (count($flightover_array) == 0) {
307
+		print _("No data available");
308
+	} else {
299 309
 	    print '<div id="chart10" class="chart" width="100%"></div>
300 310
                     <script> 
301 311
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -441,8 +451,9 @@  discard block
 block discarded – undo
441 451
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
442 452
                 <?php
443 453
                   $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
444
-		    if (count($year_array) == 0) print _("No data available");
445
-		    else {
454
+		    if (count($year_array) == 0) {
455
+		    	print _("No data available");
456
+		    } else {
446 457
                   print '<div id="chart8" class="chart" width="100%"></div>
447 458
                     <script> 
448 459
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -486,8 +497,9 @@  discard block
 block discarded – undo
486 497
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
487 498
                 <?php
488 499
                   $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
489
-		    if (count($month_array) == 0) print _("No data available");
490
-		    else {
500
+		    if (count($month_array) == 0) {
501
+		    	print _("No data available");
502
+		    } else {
491 503
                   print '<div id="chart9" class="chart" width="100%"></div>
492 504
                     <script> 
493 505
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -532,8 +544,9 @@  discard block
 block discarded – undo
532 544
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
533 545
                 <?php
534 546
                     $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
535
-		    if (empty($date_array)) print _("No data available");
536
-		    else {
547
+		    if (empty($date_array)) {
548
+		    	print _("No data available");
549
+		    } else {
537 550
                   print '<div id="chart5" class="chart" width="100%"></div>
538 551
                     <script> 
539 552
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -578,8 +591,9 @@  discard block
 block discarded – undo
578 591
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
579 592
                 <?php
580 593
                   $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
581
-		    if (empty($hour_array)) print _("No data available");
582
-		    else {
594
+		    if (empty($hour_array)) {
595
+		    	print _("No data available");
596
+		    } else {
583 597
 
584 598
                   print '<div id="chart6" class="chart" width="100%"></div>
585 599
                     <script> 
@@ -635,8 +649,9 @@  discard block
 block discarded – undo
635 649
 		    require_once('require/class.Accident.php');
636 650
             	    $Accident = new Accident();
637 651
                   $year_array = $Accident->countFatalitiesByYear($filter_name);
638
-		    if (count($year_array) == 0) print _("No data available");
639
-		    else {
652
+		    if (count($year_array) == 0) {
653
+		    	print _("No data available");
654
+		    } else {
640 655
                   print '<div id="chart32" class="chart" width="100%"></div>
641 656
                     <script> 
642 657
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -684,8 +699,9 @@  discard block
 block discarded – undo
684 699
 		    require_once('require/class.Accident.php');
685 700
             	    $Accident = new Accident();
686 701
                   $year_array = $Accident->countFatalitiesLast12Months($filter_name);
687
-		    if (count($year_array) == 0) print _("No data available");
688
-		    else {
702
+		    if (count($year_array) == 0) {
703
+		    	print _("No data available");
704
+		    } else {
689 705
                   print '<div id="chart33" class="chart" width="100%"></div>
690 706
                     <script> 
691 707
                         google.load("visualization", "1", {packages:["corechart"]});
@@ -761,8 +777,11 @@  discard block
 block discarded – undo
761 777
 					$distance = $distance;
762 778
 					$unit = 'km';
763 779
 				}
764
-        			if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
765
-        	    		else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
780
+        			if (!isset($polar_data)) {
781
+        				$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
782
+        			} else {
783
+        	    			$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
784
+        	    		}
766 785
         		    }
767 786
         	?>
768 787
             <div class="col-md-6">
@@ -814,8 +833,11 @@  discard block
 block discarded – undo
814 833
         		foreach ($msg as $eachmsg) {
815 834
         		    //$eachmsg = $msg[0];
816 835
         		    $data = $eachmsg['source_data'];
817
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
818
-        		    else $max = 500;
836
+        		    if ($data > 500) {
837
+        		    	$max = (round(($data+100)/100))*100;
838
+        		    } else {
839
+        		    	$max = 500;
840
+        		    }
819 841
         	?>
820 842
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
821 843
         	<script>
Please login to merge, or discard this patch.
statistics-registration.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Aircraft Registrations");
7 7
 
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 12
 if ($airline_icao == 'all') {
11 13
     unset($_COOKIE['stats_airline_icao']);
@@ -14,8 +16,10 @@  discard block
 block discarded – undo
14 16
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15 17
     $airline_icao = $_COOKIE['stats_airline_icao'];
16 18
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18
-}
19
+    if (isset($globalFilter['airline'])) {
20
+    	$airline_icao = $globalFilter['airline'][0];
21
+    }
22
+    }
19 23
 setcookie('stats_airline_icao',$airline_icao);
20 24
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
21 25
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
Please login to merge, or discard this patch.
pilot-detailed.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,12 @@
 block discarded – undo
53 53
 	{
54 54
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
55 55
 		$ident = $spotter_array[0]['ident'];
56
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
57
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
56
+		if (isset($spotter_array[0]['latitude'])) {
57
+			$latitude = $spotter_array[0]['latitude'];
58
+		}
59
+		if (isset($spotter_array[0]['longitude'])) {
60
+			$longitude = $spotter_array[0]['longitude'];
61
+		}
58 62
 		require_once('header.php');
59 63
 		/*
60 64
 		if (isset($globalArchive) && $globalArchive) {
Please login to merge, or discard this patch.
owner-detailed.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,12 @@
 block discarded – undo
53 53
 	{
54 54
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
55 55
 		$ident = $spotter_array[0]['ident'];
56
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
57
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
56
+		if (isset($spotter_array[0]['latitude'])) {
57
+			$latitude = $spotter_array[0]['latitude'];
58
+		}
59
+		if (isset($spotter_array[0]['longitude'])) {
60
+			$longitude = $spotter_array[0]['longitude'];
61
+		}
58 62
 		require_once('header.php');
59 63
 		/*
60 64
 		if (isset($globalArchive) && $globalArchive) {
Please login to merge, or discard this patch.
install/class.update_schema.php 1 patch
Braces   +272 added lines, -102 removed lines patch added patch discarded remove patch
@@ -258,7 +258,9 @@  discard block
 block discarded – undo
258 258
     		// Update table countries
259 259
     		if ($Connection->tableExists('airspace')) {
260 260
     		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
261
+		    if ($error != '') {
262
+		    	return $error;
263
+		    }
262 264
 		}
263 265
 		// Update schema_version to 7
264 266
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
@@ -314,7 +316,9 @@  discard block
 block discarded – undo
314 316
     		$error = '';
315 317
     		// Update table aircraft
316 318
 		$error .= create_db::import_file('../db/source_location.sql');
317
-		if ($error != '') return $error;
319
+		if ($error != '') {
320
+			return $error;
321
+		}
318 322
 		// Update schema_version to 6
319 323
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320 324
         	try {
@@ -331,7 +335,9 @@  discard block
 block discarded – undo
331 335
     		$error = '';
332 336
     		// Update table aircraft
333 337
 		$error .= create_db::import_file('../db/notam.sql');
334
-		if ($error != '') return $error;
338
+		if ($error != '') {
339
+			return $error;
340
+		}
335 341
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 342
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 343
                         DELETE FROM config WHERE name = 'last_update_notam_db';
@@ -365,7 +371,9 @@  discard block
 block discarded – undo
365 371
 		$error = '';
366 372
     		// Update table atc
367 373
 		$error .= create_db::import_file('../db/atc.sql');
368
-		if ($error != '') return $error;
374
+		if ($error != '') {
375
+			return $error;
376
+		}
369 377
 		
370 378
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371 379
         	try {
@@ -389,13 +397,21 @@  discard block
 block discarded – undo
389 397
 		$error = '';
390 398
     		// Add tables
391 399
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392
-		if ($error != '') return $error;
400
+		if ($error != '') {
401
+			return $error;
402
+		}
393 403
 		$error .= create_db::import_file('../db/metar.sql');
394
-		if ($error != '') return $error;
404
+		if ($error != '') {
405
+			return $error;
406
+		}
395 407
 		$error .= create_db::import_file('../db/taf.sql');
396
-		if ($error != '') return $error;
408
+		if ($error != '') {
409
+			return $error;
410
+		}
397 411
 		$error .= create_db::import_file('../db/airport.sql');
398
-		if ($error != '') return $error;
412
+		if ($error != '') {
413
+			return $error;
414
+		}
399 415
 		
400 416
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401 417
         	try {
@@ -469,19 +485,33 @@  discard block
 block discarded – undo
469 485
 		$error = '';
470 486
     		// Add tables
471 487
 		$error .= create_db::import_file('../db/stats.sql');
472
-		if ($error != '') return $error;
488
+		if ($error != '') {
489
+			return $error;
490
+		}
473 491
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
474
-		if ($error != '') return $error;
492
+		if ($error != '') {
493
+			return $error;
494
+		}
475 495
 		$error .= create_db::import_file('../db/stats_airline.sql');
476
-		if ($error != '') return $error;
496
+		if ($error != '') {
497
+			return $error;
498
+		}
477 499
 		$error .= create_db::import_file('../db/stats_airport.sql');
478
-		if ($error != '') return $error;
500
+		if ($error != '') {
501
+			return $error;
502
+		}
479 503
 		$error .= create_db::import_file('../db/stats_owner.sql');
480
-		if ($error != '') return $error;
504
+		if ($error != '') {
505
+			return $error;
506
+		}
481 507
 		$error .= create_db::import_file('../db/stats_pilot.sql');
482
-		if ($error != '') return $error;
508
+		if ($error != '') {
509
+			return $error;
510
+		}
483 511
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
484
-		if ($error != '') return $error;
512
+		if ($error != '') {
513
+			return $error;
514
+		}
485 515
 		
486 516
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
487 517
         	try {
@@ -521,7 +551,9 @@  discard block
 block discarded – undo
521 551
     		// Add tables
522 552
     		if (!$Connection->tableExists('stats_flight')) {
523 553
 			$error .= create_db::import_file('../db/stats_flight.sql');
524
-			if ($error != '') return $error;
554
+			if ($error != '') {
555
+				return $error;
556
+			}
525 557
 		}
526 558
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
527 559
         	try {
@@ -545,7 +577,9 @@  discard block
 block discarded – undo
545 577
     		} catch(PDOException $e) {
546 578
 		    return "error (update stats) : ".$e->getMessage()."\n";
547 579
     		}
548
-		if ($error != '') return $error;
580
+		if ($error != '') {
581
+			return $error;
582
+		}
549 583
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
550 584
         	try {
551 585
             	    $sth = $Connection->db->prepare($query);
@@ -566,7 +600,9 @@  discard block
 block discarded – undo
566 600
     		if (!$Connection->tableExists('stats_callsign')) {
567 601
 			$error .= create_db::import_file('../db/stats_callsign.sql');
568 602
 		}
569
-		if ($error != '') return $error;
603
+		if ($error != '') {
604
+			return $error;
605
+		}
570 606
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
571 607
         	try {
572 608
             	    $sth = $Connection->db->prepare($query);
@@ -584,7 +620,9 @@  discard block
 block discarded – undo
584 620
     		if (!$Connection->tableExists('stats_country')) {
585 621
 			$error .= create_db::import_file('../db/stats_country.sql');
586 622
 		}
587
-		if ($error != '') return $error;
623
+		if ($error != '') {
624
+			return $error;
625
+		}
588 626
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
589 627
         	try {
590 628
             	    $sth = $Connection->db->prepare($query);
@@ -607,7 +645,9 @@  discard block
 block discarded – undo
607 645
 			    return "error (update stats) : ".$e->getMessage()."\n";
608 646
     			}
609 647
     		}
610
-		if ($error != '') return $error;
648
+		if ($error != '') {
649
+			return $error;
650
+		}
611 651
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
612 652
         	try {
613 653
             	    $sth = $Connection->db->prepare($query);
@@ -623,7 +663,9 @@  discard block
 block discarded – undo
623 663
 		$error = '';
624 664
     		// Update airport table
625 665
 		$error .= create_db::import_file('../db/airport.sql');
626
-		if ($error != '') return 'Import airport.sql : '.$error;
666
+		if ($error != '') {
667
+			return 'Import airport.sql : '.$error;
668
+		}
627 669
 		// Remove primary key on Spotter_Archive
628 670
 		$query = "alter table spotter_archive drop spotter_archive_id";
629 671
         	try {
@@ -699,7 +741,9 @@  discard block
 block discarded – undo
699 741
 				return "error (add source_name column) : ".$e->getMessage()."\n";
700 742
     			}
701 743
     		}
702
-		if ($error != '') return $error;
744
+		if ($error != '') {
745
+			return $error;
746
+		}
703 747
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
704 748
         	try {
705 749
             	    $sth = $Connection->db->prepare($query);
@@ -717,7 +761,9 @@  discard block
 block discarded – undo
717 761
     		// Update airline table
718 762
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
719 763
 			$error .= create_db::import_file('../db/airlines.sql');
720
-			if ($error != '') return 'Import airlines.sql : '.$error;
764
+			if ($error != '') {
765
+				return 'Import airlines.sql : '.$error;
766
+			}
721 767
 		}
722 768
 		if (!$Connection->checkColumnName('aircraft_modes','type_flight')) {
723 769
 			// Add column over_country
@@ -729,7 +775,9 @@  discard block
 block discarded – undo
729 775
 				return "error (add over_country) : ".$e->getMessage()."\n";
730 776
     			}
731 777
     		}
732
-		if ($error != '') return $error;
778
+		if ($error != '') {
779
+			return $error;
780
+		}
733 781
 		/*
734 782
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
735 783
 			// Force update ModeS (this will put type_flight data
@@ -759,7 +807,9 @@  discard block
 block discarded – undo
759 807
 			} catch(PDOException $e) {
760 808
 				return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
761 809
 			}
762
-			if ($error != '') return $error;
810
+			if ($error != '') {
811
+				return $error;
812
+			}
763 813
 		}
764 814
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
765 815
         	try {
@@ -782,7 +832,9 @@  discard block
 block discarded – undo
782 832
 			} else {
783 833
 				$error .= create_db::import_file('../db/pgsql/stats_source.sql');
784 834
 			}
785
-			if ($error != '') return $error;
835
+			if ($error != '') {
836
+				return $error;
837
+			}
786 838
 		}
787 839
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
788 840
         	try {
@@ -804,12 +856,16 @@  discard block
 block discarded – undo
804 856
 		if ($globalDBdriver == 'mysql') {
805 857
 			if (!$Connection->tableExists('tle')) {
806 858
 				$error .= create_db::import_file('../db/tle.sql');
807
-				if ($error != '') return $error;
859
+				if ($error != '') {
860
+					return $error;
861
+				}
808 862
 			}
809 863
 		} else {
810 864
 			if (!$Connection->tableExists('tle')) {
811 865
 				$error .= create_db::import_file('../db/pgsql/tle.sql');
812
-				if ($error != '') return $error;
866
+				if ($error != '') {
867
+					return $error;
868
+				}
813 869
 			}
814 870
 			$query = "create index flightaware_id_idx ON spotter_archive USING btree(flightaware_id)";
815 871
 			try {
@@ -849,7 +905,9 @@  discard block
 block discarded – undo
849 905
 		} else {
850 906
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
851 907
 		}
852
-		if ($error != '') return 'Import airlines.sql : '.$error;
908
+		if ($error != '') {
909
+			return 'Import airlines.sql : '.$error;
910
+		}
853 911
 		if (!$Connection->checkColumnName('airlines','forsource')) {
854 912
 			// Add forsource to airlines
855 913
 			$query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL";
@@ -1332,20 +1390,28 @@  discard block
 block discarded – undo
1332 1390
 		}
1333 1391
 		if ($globalDBdriver == 'mysql') {
1334 1392
 			$error .= create_db::import_file('../db/airlines.sql');
1335
-			if ($error != '') return $error;
1393
+			if ($error != '') {
1394
+				return $error;
1395
+			}
1336 1396
 		} else {
1337 1397
 			$error .= create_db::import_file('../db/pgsql/airlines.sql');
1338
-			if ($error != '') return $error;
1398
+			if ($error != '') {
1399
+				return $error;
1400
+			}
1339 1401
 		}
1340 1402
 		if ((isset($globalVATSIM) && $globalVATSIM) || (isset($globalIVAO) && $globalIVAO)) {
1341 1403
 			include_once(dirname(__FILE__).'/class.update_db.php');
1342 1404
 			if (isset($globalVATSIM) && $globalVATSIM) {
1343 1405
 				$error .= update_db::update_vatsim();
1344
-				if ($error != '') return $error;
1406
+				if ($error != '') {
1407
+					return $error;
1408
+				}
1345 1409
 			}
1346 1410
 			if (isset($globalIVAO) && $globalIVAO && file_exists('tmp/ivae_feb2013.zip')) {
1347 1411
 				$error .= update_db::update_IVAO();
1348
-				if ($error != '') return $error;
1412
+				if ($error != '') {
1413
+					return $error;
1414
+				}
1349 1415
 			}
1350 1416
 		}
1351 1417
 
@@ -1391,8 +1457,11 @@  discard block
 block discarded – undo
1391 1457
     	    if ($Connection->tableExists('aircraft')) {
1392 1458
     		if (!$Connection->tableExists('config')) {
1393 1459
     		    $version = '1';
1394
-    		    if ($update) return self::update_from_1();
1395
-    		    else return $version;
1460
+    		    if ($update) {
1461
+    		    	return self::update_from_1();
1462
+    		    } else {
1463
+    		    	return $version;
1464
+    		    }
1396 1465
 		} else {
1397 1466
     		    $Connection = new Connection();
1398 1467
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -1406,138 +1475,239 @@  discard block
 block discarded – undo
1406 1475
     		    if ($update) {
1407 1476
     			if ($result['value'] == '2') {
1408 1477
     			    $error = self::update_from_2();
1409
-    			    if ($error != '') return $error;
1410
-    			    else return self::check_version(true);
1478
+    			    if ($error != '') {
1479
+    			    	return $error;
1480
+    			    } else {
1481
+    			    	return self::check_version(true);
1482
+    			    }
1411 1483
     			} elseif ($result['value'] == '3') {
1412 1484
     			    $error = self::update_from_3();
1413
-    			    if ($error != '') return $error;
1414
-    			    else return self::check_version(true);
1485
+    			    if ($error != '') {
1486
+    			    	return $error;
1487
+    			    } else {
1488
+    			    	return self::check_version(true);
1489
+    			    }
1415 1490
     			} elseif ($result['value'] == '4') {
1416 1491
     			    $error = self::update_from_4();
1417
-    			    if ($error != '') return $error;
1418
-    			    else return self::check_version(true);
1492
+    			    if ($error != '') {
1493
+    			    	return $error;
1494
+    			    } else {
1495
+    			    	return self::check_version(true);
1496
+    			    }
1419 1497
     			} elseif ($result['value'] == '5') {
1420 1498
     			    $error = self::update_from_5();
1421
-    			    if ($error != '') return $error;
1422
-    			    else return self::check_version(true);
1499
+    			    if ($error != '') {
1500
+    			    	return $error;
1501
+    			    } else {
1502
+    			    	return self::check_version(true);
1503
+    			    }
1423 1504
     			} elseif ($result['value'] == '6') {
1424 1505
     			    $error = self::update_from_6();
1425
-    			    if ($error != '') return $error;
1426
-    			    else return self::check_version(true);
1506
+    			    if ($error != '') {
1507
+    			    	return $error;
1508
+    			    } else {
1509
+    			    	return self::check_version(true);
1510
+    			    }
1427 1511
     			} elseif ($result['value'] == '7') {
1428 1512
     			    $error = self::update_from_7();
1429
-    			    if ($error != '') return $error;
1430
-    			    else return self::check_version(true);
1513
+    			    if ($error != '') {
1514
+    			    	return $error;
1515
+    			    } else {
1516
+    			    	return self::check_version(true);
1517
+    			    }
1431 1518
     			} elseif ($result['value'] == '8') {
1432 1519
     			    $error = self::update_from_8();
1433
-    			    if ($error != '') return $error;
1434
-    			    else return self::check_version(true);
1520
+    			    if ($error != '') {
1521
+    			    	return $error;
1522
+    			    } else {
1523
+    			    	return self::check_version(true);
1524
+    			    }
1435 1525
     			} elseif ($result['value'] == '9') {
1436 1526
     			    $error = self::update_from_9();
1437
-    			    if ($error != '') return $error;
1438
-    			    else return self::check_version(true);
1527
+    			    if ($error != '') {
1528
+    			    	return $error;
1529
+    			    } else {
1530
+    			    	return self::check_version(true);
1531
+    			    }
1439 1532
     			} elseif ($result['value'] == '10') {
1440 1533
     			    $error = self::update_from_10();
1441
-    			    if ($error != '') return $error;
1442
-    			    else return self::check_version(true);
1534
+    			    if ($error != '') {
1535
+    			    	return $error;
1536
+    			    } else {
1537
+    			    	return self::check_version(true);
1538
+    			    }
1443 1539
     			} elseif ($result['value'] == '11') {
1444 1540
     			    $error = self::update_from_11();
1445
-    			    if ($error != '') return $error;
1446
-    			    else return self::check_version(true);
1541
+    			    if ($error != '') {
1542
+    			    	return $error;
1543
+    			    } else {
1544
+    			    	return self::check_version(true);
1545
+    			    }
1447 1546
     			} elseif ($result['value'] == '12') {
1448 1547
     			    $error = self::update_from_12();
1449
-    			    if ($error != '') return $error;
1450
-    			    else return self::check_version(true);
1548
+    			    if ($error != '') {
1549
+    			    	return $error;
1550
+    			    } else {
1551
+    			    	return self::check_version(true);
1552
+    			    }
1451 1553
     			} elseif ($result['value'] == '13') {
1452 1554
     			    $error = self::update_from_13();
1453
-    			    if ($error != '') return $error;
1454
-    			    else return self::check_version(true);
1555
+    			    if ($error != '') {
1556
+    			    	return $error;
1557
+    			    } else {
1558
+    			    	return self::check_version(true);
1559
+    			    }
1455 1560
     			} elseif ($result['value'] == '14') {
1456 1561
     			    $error = self::update_from_14();
1457
-    			    if ($error != '') return $error;
1458
-    			    else return self::check_version(true);
1562
+    			    if ($error != '') {
1563
+    			    	return $error;
1564
+    			    } else {
1565
+    			    	return self::check_version(true);
1566
+    			    }
1459 1567
     			} elseif ($result['value'] == '15') {
1460 1568
     			    $error = self::update_from_15();
1461
-    			    if ($error != '') return $error;
1462
-    			    else return self::check_version(true);
1569
+    			    if ($error != '') {
1570
+    			    	return $error;
1571
+    			    } else {
1572
+    			    	return self::check_version(true);
1573
+    			    }
1463 1574
     			} elseif ($result['value'] == '16') {
1464 1575
     			    $error = self::update_from_16();
1465
-    			    if ($error != '') return $error;
1466
-    			    else return self::check_version(true);
1576
+    			    if ($error != '') {
1577
+    			    	return $error;
1578
+    			    } else {
1579
+    			    	return self::check_version(true);
1580
+    			    }
1467 1581
     			} elseif ($result['value'] == '17') {
1468 1582
     			    $error = self::update_from_17();
1469
-    			    if ($error != '') return $error;
1470
-    			    else return self::check_version(true);
1583
+    			    if ($error != '') {
1584
+    			    	return $error;
1585
+    			    } else {
1586
+    			    	return self::check_version(true);
1587
+    			    }
1471 1588
     			} elseif ($result['value'] == '18') {
1472 1589
     			    $error = self::update_from_18();
1473
-    			    if ($error != '') return $error;
1474
-    			    else return self::check_version(true);
1590
+    			    if ($error != '') {
1591
+    			    	return $error;
1592
+    			    } else {
1593
+    			    	return self::check_version(true);
1594
+    			    }
1475 1595
     			} elseif ($result['value'] == '19') {
1476 1596
     			    $error = self::update_from_19();
1477
-    			    if ($error != '') return $error;
1478
-    			    else return self::check_version(true);
1597
+    			    if ($error != '') {
1598
+    			    	return $error;
1599
+    			    } else {
1600
+    			    	return self::check_version(true);
1601
+    			    }
1479 1602
     			} elseif ($result['value'] == '20') {
1480 1603
     			    $error = self::update_from_20();
1481
-    			    if ($error != '') return $error;
1482
-    			    else return self::check_version(true);
1604
+    			    if ($error != '') {
1605
+    			    	return $error;
1606
+    			    } else {
1607
+    			    	return self::check_version(true);
1608
+    			    }
1483 1609
     			} elseif ($result['value'] == '21') {
1484 1610
     			    $error = self::update_from_21();
1485
-    			    if ($error != '') return $error;
1486
-    			    else return self::check_version(true);
1611
+    			    if ($error != '') {
1612
+    			    	return $error;
1613
+    			    } else {
1614
+    			    	return self::check_version(true);
1615
+    			    }
1487 1616
     			} elseif ($result['value'] == '22') {
1488 1617
     			    $error = self::update_from_22();
1489
-    			    if ($error != '') return $error;
1490
-    			    else return self::check_version(true);
1618
+    			    if ($error != '') {
1619
+    			    	return $error;
1620
+    			    } else {
1621
+    			    	return self::check_version(true);
1622
+    			    }
1491 1623
     			} elseif ($result['value'] == '23') {
1492 1624
     			    $error = self::update_from_23();
1493
-    			    if ($error != '') return $error;
1494
-    			    else return self::check_version(true);
1625
+    			    if ($error != '') {
1626
+    			    	return $error;
1627
+    			    } else {
1628
+    			    	return self::check_version(true);
1629
+    			    }
1495 1630
     			} elseif ($result['value'] == '24') {
1496 1631
     			    $error = self::update_from_24();
1497
-    			    if ($error != '') return $error;
1498
-    			    else return self::check_version(true);
1632
+    			    if ($error != '') {
1633
+    			    	return $error;
1634
+    			    } else {
1635
+    			    	return self::check_version(true);
1636
+    			    }
1499 1637
     			} elseif ($result['value'] == '25') {
1500 1638
     			    $error = self::update_from_25();
1501
-    			    if ($error != '') return $error;
1502
-    			    else return self::check_version(true);
1639
+    			    if ($error != '') {
1640
+    			    	return $error;
1641
+    			    } else {
1642
+    			    	return self::check_version(true);
1643
+    			    }
1503 1644
     			} elseif ($result['value'] == '26') {
1504 1645
     			    $error = self::update_from_26();
1505
-    			    if ($error != '') return $error;
1506
-    			    else return self::check_version(true);
1646
+    			    if ($error != '') {
1647
+    			    	return $error;
1648
+    			    } else {
1649
+    			    	return self::check_version(true);
1650
+    			    }
1507 1651
     			} elseif ($result['value'] == '27') {
1508 1652
     			    $error = self::update_from_27();
1509
-    			    if ($error != '') return $error;
1510
-    			    else return self::check_version(true);
1653
+    			    if ($error != '') {
1654
+    			    	return $error;
1655
+    			    } else {
1656
+    			    	return self::check_version(true);
1657
+    			    }
1511 1658
     			} elseif ($result['value'] == '28') {
1512 1659
     			    $error = self::update_from_28();
1513
-    			    if ($error != '') return $error;
1514
-    			    else return self::check_version(true);
1660
+    			    if ($error != '') {
1661
+    			    	return $error;
1662
+    			    } else {
1663
+    			    	return self::check_version(true);
1664
+    			    }
1515 1665
     			} elseif ($result['value'] == '29') {
1516 1666
     			    $error = self::update_from_29();
1517
-    			    if ($error != '') return $error;
1518
-    			    else return self::check_version(true);
1667
+    			    if ($error != '') {
1668
+    			    	return $error;
1669
+    			    } else {
1670
+    			    	return self::check_version(true);
1671
+    			    }
1519 1672
     			} elseif ($result['value'] == '30') {
1520 1673
     			    $error = self::update_from_30();
1521
-    			    if ($error != '') return $error;
1522
-    			    else return self::check_version(true);
1674
+    			    if ($error != '') {
1675
+    			    	return $error;
1676
+    			    } else {
1677
+    			    	return self::check_version(true);
1678
+    			    }
1523 1679
     			} elseif ($result['value'] == '31') {
1524 1680
     			    $error = self::update_from_31();
1525
-    			    if ($error != '') return $error;
1526
-    			    else return self::check_version(true);
1681
+    			    if ($error != '') {
1682
+    			    	return $error;
1683
+    			    } else {
1684
+    			    	return self::check_version(true);
1685
+    			    }
1527 1686
     			} elseif ($result['value'] == '32') {
1528 1687
     			    $error = self::update_from_32();
1529
-    			    if ($error != '') return $error;
1530
-    			    else return self::check_version(true);
1688
+    			    if ($error != '') {
1689
+    			    	return $error;
1690
+    			    } else {
1691
+    			    	return self::check_version(true);
1692
+    			    }
1531 1693
     			} elseif ($result['value'] == '33') {
1532 1694
     			    $error = self::update_from_33();
1533
-    			    if ($error != '') return $error;
1534
-    			    else return self::check_version(true);
1535
-    			} else return '';
1695
+    			    if ($error != '') {
1696
+    			    	return $error;
1697
+    			    } else {
1698
+    			    	return self::check_version(true);
1699
+    			    }
1700
+    			} else {
1701
+    				return '';
1702
+    			}
1703
+    		    } else {
1704
+    		    	return $result['value'];
1536 1705
     		    }
1537
-    		    else return $result['value'];
1538 1706
 		}
1539 1707
 		
1540
-	    } else return $version;
1708
+	    } else {
1709
+	    	return $version;
1710
+	    }
1541 1711
     	}
1542 1712
     	
1543 1713
 }
Please login to merge, or discard this patch.