Completed
Push — master ( 73f088...7f17b6 )
by Yannick
07:13
created
airline-statistics-arrival-airport-country.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['airline'])) {
6
-        header('Location: '.$globalURL.'/airline');
7
-        die();
6
+		header('Location: '.$globalURL.'/airline');
7
+		die();
8 8
 }
9 9
 $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 10
 $Spotter = new Spotter();
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
           function drawChart() {
70 70
             var data = google.visualization.arrayToDataTable([
71 71
             	["'._("Country").'", "'._("# of times").'"], ';
72
-        $country_data = '';
72
+		$country_data = '';
73 73
 	foreach($airport_country_array as $airport_item)
74 74
 	{
75 75
 		$country_data .= '[ "'.$airport_item['arrival_airport_country'].'",'.$airport_item['airport_arrival_country_count'].'],';
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -6,22 +6,22 @@  discard block
 block discarded – undo
6 6
         header('Location: '.$globalURL.'/airline');
7 7
         die();
8 8
 }
9
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
9
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
10 10
 $Spotter = new Spotter();
11
-$spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1","");
11
+$spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", "");
12 12
 
13 13
 if (!empty($spotter_array))
14 14
 {
15
-	$title = sprintf(_("Most Common Arrival Airports by Country from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
15
+	$title = sprintf(_("Most Common Arrival Airports by Country from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']);
16 16
 	require_once('header.php');
17 17
 	print '<div class="select-item">';
18 18
 	print '<form action="'.$globalURL.'/airline" method="post">';
19 19
 	print '<select name="airline" class="selectpicker" data-live-search="true">';
20 20
 	print '<option></option>';
21 21
 	$airline_names = $Spotter->getAllAirlineNames();
22
-	foreach($airline_names as $airline_name)
22
+	foreach ($airline_names as $airline_name)
23 23
 	{
24
-		if($_GET['airline'] == $airline_name['airline_icao'])
24
+		if ($_GET['airline'] == $airline_name['airline_icao'])
25 25
 		{
26 26
 			print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
27 27
 		} else {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	include('airline-sub-menu.php');
60 60
 	print '<div class="column">';
61 61
 	print '<h2>'._("Most Common Arrival Airports by Country").'</h2>';
62
-	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
62
+	print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>';
63 63
 	$airport_country_array = $Spotter->countAllArrivalAirportCountriesByAirline($airline);
64 64
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
65 65
 	print '<div id="chartCountry" class="chart" width="100%"></div>
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
             var data = google.visualization.arrayToDataTable([
71 71
             	["'._("Country").'", "'._("# of times").'"], ';
72 72
         $country_data = '';
73
-	foreach($airport_country_array as $airport_item)
73
+	foreach ($airport_country_array as $airport_item)
74 74
 	{
75 75
 		$country_data .= '[ "'.$airport_item['arrival_airport_country'].'",'.$airport_item['airport_arrival_country_count'].'],';
76 76
 	}
@@ -104,7 +104,7 @@  discard block
 block discarded – undo
104 104
 		print '</thead>';
105 105
 		print '<tbody>';
106 106
 		$i = 1;
107
-		foreach($airport_country_array as $airport_item)
107
+		foreach ($airport_country_array as $airport_item)
108 108
 		{
109 109
 			print '<tr>';
110 110
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -40,8 +40,7 @@
 block discarded – undo
40 40
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
41 41
 			{
42 42
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
43
-			}
44
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
43
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
45 44
 			{
46 45
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
47 46
 			}
Please login to merge, or discard this patch.
search-xml.php 3 patches
Indentation   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -4,55 +4,55 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7
-        //for the date manipulation into the query
8
-        if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
-                $start_date = $_GET['start_date'].":00";
10
-                $end_date = $_GET['end_date'].":00";
11
-                $sql_date = $start_date.",".$end_date;
12
-        } else if($_GET['start_date'] != ""){
13
-                $start_date = $_GET['start_date'].":00";
14
-                $sql_date = $start_date;
15
-        } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
-                $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
-                $sql_date = $end_date;
18
-        } else $sql_date = '';
7
+		//for the date manipulation into the query
8
+		if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
+				$start_date = $_GET['start_date'].":00";
10
+				$end_date = $_GET['end_date'].":00";
11
+				$sql_date = $start_date.",".$end_date;
12
+		} else if($_GET['start_date'] != ""){
13
+				$start_date = $_GET['start_date'].":00";
14
+				$sql_date = $start_date;
15
+		} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
+				$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
+				$sql_date = $end_date;
18
+		} else $sql_date = '';
19 19
 } else $sql_date = '';
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22
-        //for altitude manipulation
23
-        if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-                $end_altitude = $_GET['highest_altitude'];
25
-                $start_altitude = $_GET['lowest_altitude'];
26
-                $sql_altitude = $start_altitude.",".$end_altitude;
27
-        } else if($_GET['highest_altitude'] != ""){
28
-                $end_altitude = $_GET['highest_altitude'];
29
-                $sql_altitude = $end_altitude;
30
-        } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-                $start_altitude = $_GET['lowest_altitude'].",60000";
32
-                $sql_altitude = $start_altitude;
33
-        } else $sql_altitude = '';
22
+		//for altitude manipulation
23
+		if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
+				$end_altitude = $_GET['highest_altitude'];
25
+				$start_altitude = $_GET['lowest_altitude'];
26
+				$sql_altitude = $start_altitude.",".$end_altitude;
27
+		} else if($_GET['highest_altitude'] != ""){
28
+				$end_altitude = $_GET['highest_altitude'];
29
+				$sql_altitude = $end_altitude;
30
+		} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
+				$start_altitude = $_GET['lowest_altitude'].",60000";
32
+				$sql_altitude = $start_altitude;
33
+		} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37 37
 if(!isset($_GET['limit']))
38 38
 {
39
-        if (!isset($_GET['number_results']))
40
-        {
41
-                $limit_start = 0;
42
-                $limit_end = 25;
43
-                $absolute_difference = 25;
44
-        } else {
45
-                if ($_GET['number_results'] > 1000){
46
-                        $_GET['number_results'] = 1000;
47
-                }
48
-                $limit_start = 0;
49
-                $limit_end = $_GET['number_results'];
50
-                $absolute_difference = $_GET['number_results'];
51
-        }
39
+		if (!isset($_GET['number_results']))
40
+		{
41
+				$limit_start = 0;
42
+				$limit_end = 25;
43
+				$absolute_difference = 25;
44
+		} else {
45
+				if ($_GET['number_results'] > 1000){
46
+						$_GET['number_results'] = 1000;
47
+				}
48
+				$limit_start = 0;
49
+				$limit_end = $_GET['number_results'];
50
+				$absolute_difference = $_GET['number_results'];
51
+		}
52 52
 }  else {
53
-        $limit_explode = explode(",", $_GET['limit']);
54
-        $limit_start = $limit_explode[0];
55
-        $limit_end = $limit_explode[1];
53
+		$limit_explode = explode(",", $_GET['limit']);
54
+		$limit_start = $limit_explode[0];
55
+		$limit_end = $limit_explode[1];
56 56
 }
57 57
 
58 58
 $absolute_difference = abs($limit_start - $limit_end);
@@ -89,56 +89,56 @@  discard block
 block discarded – undo
89 89
        
90 90
 $output = '<?xml version="1.0" encoding="UTF-8" ?>';
91 91
   $output .= '<flightairmap>';
92
-    $output .= '<title>'.$globalName.' XML Feed</title>';
93
-    $output .= '<link>http://'.$_SERVER['HTTP_HOST'].$globalURL.'</link>';
94
-    $output .= '<aircrafts>';
92
+	$output .= '<title>'.$globalName.' XML Feed</title>';
93
+	$output .= '<link>http://'.$_SERVER['HTTP_HOST'].$globalURL.'</link>';
94
+	$output .= '<aircrafts>';
95 95
     
96
-    if (!empty($spotter_array))
96
+	if (!empty($spotter_array))
97 97
 	  {
98
-	    foreach($spotter_array as $spotter_item)
99
-	    {
98
+		foreach($spotter_array as $spotter_item)
99
+		{
100 100
 	    	
101
-            $output .= '<aircraft>';
102
-              $output .= '<id>'.$spotter_item['spotter_id'].'</id>';
103
-		      $output .= '<ident>'.$spotter_item['ident'].'</ident>';
104
-		      $output .= '<registration>'.$spotter_item['registration'].'</registration>';
105
-              $output .= '<aircraft_icao>'.$spotter_item['aircraft_type'].'</aircraft_icao>';
106
-		      $output .= '<aircraft_name>'.$spotter_item['aircraft_name'].'</aircraft_name>';
107
-              $output .= '<aircraft_manufacturer>'.$spotter_item['aircraft_manufacturer'].'</aircraft_manufacturer>';
108
-              $output .= '<airline_name>'.$spotter_item['airline_name'].'</airline_name>';
109
-		      $output .= '<airline_icao>'.$spotter_item['airline_icao'].'</airline_icao>';
101
+			$output .= '<aircraft>';
102
+			  $output .= '<id>'.$spotter_item['spotter_id'].'</id>';
103
+			  $output .= '<ident>'.$spotter_item['ident'].'</ident>';
104
+			  $output .= '<registration>'.$spotter_item['registration'].'</registration>';
105
+			  $output .= '<aircraft_icao>'.$spotter_item['aircraft_type'].'</aircraft_icao>';
106
+			  $output .= '<aircraft_name>'.$spotter_item['aircraft_name'].'</aircraft_name>';
107
+			  $output .= '<aircraft_manufacturer>'.$spotter_item['aircraft_manufacturer'].'</aircraft_manufacturer>';
108
+			  $output .= '<airline_name>'.$spotter_item['airline_name'].'</airline_name>';
109
+			  $output .= '<airline_icao>'.$spotter_item['airline_icao'].'</airline_icao>';
110 110
 		if (isset($spotter_item['airline_iata'])) {
111
-            	    $output .= '<airline_iata>'.$spotter_item['airline_iata'].'</airline_iata>';
112
-              }
113
-              $output .= '<airline_country>'.$spotter_item['airline_country'].'</airline_country>';
114
-              if (isset($spotter_item['airline_callsign'])) {
115
-            	$output .= '<airline_callsign>'.$spotter_item['airline_callsign'].'</airline_callsign>';
116
-              }
117
-              $output .= '<airline_type>'.$spotter_item['airline_type'].'</airline_type>';
118
-              $output .= '<departure_airport_city>'.$spotter_item['departure_airport_city'].'</departure_airport_city>';
119
-		      $output .= '<departure_airport_country>'.$spotter_item['departure_airport_country'].'</departure_airport_country>';  
120
-              $output .= '<departure_airport_iata>'.$spotter_item['departure_airport_iata'].'</departure_airport_iata>';
121
-              $output .= '<departure_airport_icao>'.$spotter_item['departure_airport_icao'].'</departure_airport_icao>';
122
-              $output .= '<departure_airport_latitude>'.$spotter_item['departure_airport_latitude'].'</departure_airport_latitude>';
123
-              $output .= '<departure_airport_longitude>'.$spotter_item['departure_airport_longitude'].'</departure_airport_longitude>';
124
-              $output .= '<departure_airport_altitude>'.$spotter_item['departure_airport_altitude'].'</departure_airport_altitude>';
125
-              $output .= '<arrival_airport_city>'.$spotter_item['arrival_airport_city'].'</arrival_airport_city>';
126
-		      $output .= '<arrival_airport_country>'.$spotter_item['arrival_airport_country'].'</arrival_airport_country>';  
127
-              $output .= '<arrival_airport_iata>'.$spotter_item['arrival_airport_iata'].'</arrival_airport_iata>';
128
-              $output .= '<arrival_airport_icao>'.$spotter_item['arrival_airport_icao'].'</arrival_airport_icao>';
129
-              $output .= '<arrival_airport_latitude>'.$spotter_item['arrival_airport_latitude'].'</arrival_airport_latitude>';
130
-              $output .= '<arrival_airport_longitude>'.$spotter_item['arrival_airport_longitude'].'</arrival_airport_longitude>';
131
-              $output .= '<arrival_airport_altitude>'.$spotter_item['arrival_airport_altitude'].'</arrival_airport_altitude>';
132
-              $output .= '<latitude>'.$spotter_item['latitude'].'</latitude>';
133
-              $output .= '<longitude>'.$spotter_item['longitude'].'</longitude>';
134
-              $output .= '<altitude>'.$spotter_item['altitude'].'</altitude>';
135
-              $output .= '<ground_speed>'.$spotter_item['ground_speed'].'</ground_speed>';
136
-              $output .= '<heading>'.$spotter_item['heading'].'</heading>';
137
-              $output .= '<heading_name>'.$spotter_item['heading_name'].'</heading_name>';
138
-              $output .= '<waypoints>'.$spotter_item['waypoints'].'</waypoints>';
139
-		      $output .= '<date>'.date("c", strtotime($spotter_item['date_iso_8601'])).'</date>';
140
-            $output .= '</aircraft>';
141
-	    }
111
+					$output .= '<airline_iata>'.$spotter_item['airline_iata'].'</airline_iata>';
112
+			  }
113
+			  $output .= '<airline_country>'.$spotter_item['airline_country'].'</airline_country>';
114
+			  if (isset($spotter_item['airline_callsign'])) {
115
+				$output .= '<airline_callsign>'.$spotter_item['airline_callsign'].'</airline_callsign>';
116
+			  }
117
+			  $output .= '<airline_type>'.$spotter_item['airline_type'].'</airline_type>';
118
+			  $output .= '<departure_airport_city>'.$spotter_item['departure_airport_city'].'</departure_airport_city>';
119
+			  $output .= '<departure_airport_country>'.$spotter_item['departure_airport_country'].'</departure_airport_country>';  
120
+			  $output .= '<departure_airport_iata>'.$spotter_item['departure_airport_iata'].'</departure_airport_iata>';
121
+			  $output .= '<departure_airport_icao>'.$spotter_item['departure_airport_icao'].'</departure_airport_icao>';
122
+			  $output .= '<departure_airport_latitude>'.$spotter_item['departure_airport_latitude'].'</departure_airport_latitude>';
123
+			  $output .= '<departure_airport_longitude>'.$spotter_item['departure_airport_longitude'].'</departure_airport_longitude>';
124
+			  $output .= '<departure_airport_altitude>'.$spotter_item['departure_airport_altitude'].'</departure_airport_altitude>';
125
+			  $output .= '<arrival_airport_city>'.$spotter_item['arrival_airport_city'].'</arrival_airport_city>';
126
+			  $output .= '<arrival_airport_country>'.$spotter_item['arrival_airport_country'].'</arrival_airport_country>';  
127
+			  $output .= '<arrival_airport_iata>'.$spotter_item['arrival_airport_iata'].'</arrival_airport_iata>';
128
+			  $output .= '<arrival_airport_icao>'.$spotter_item['arrival_airport_icao'].'</arrival_airport_icao>';
129
+			  $output .= '<arrival_airport_latitude>'.$spotter_item['arrival_airport_latitude'].'</arrival_airport_latitude>';
130
+			  $output .= '<arrival_airport_longitude>'.$spotter_item['arrival_airport_longitude'].'</arrival_airport_longitude>';
131
+			  $output .= '<arrival_airport_altitude>'.$spotter_item['arrival_airport_altitude'].'</arrival_airport_altitude>';
132
+			  $output .= '<latitude>'.$spotter_item['latitude'].'</latitude>';
133
+			  $output .= '<longitude>'.$spotter_item['longitude'].'</longitude>';
134
+			  $output .= '<altitude>'.$spotter_item['altitude'].'</altitude>';
135
+			  $output .= '<ground_speed>'.$spotter_item['ground_speed'].'</ground_speed>';
136
+			  $output .= '<heading>'.$spotter_item['heading'].'</heading>';
137
+			  $output .= '<heading_name>'.$spotter_item['heading_name'].'</heading_name>';
138
+			  $output .= '<waypoints>'.$spotter_item['waypoints'].'</waypoints>';
139
+			  $output .= '<date>'.date("c", strtotime($spotter_item['date_iso_8601'])).'</date>';
140
+			$output .= '</aircraft>';
141
+		}
142 142
 	   }
143 143
 		 $output .= '</aircrafts>';
144 144
 $output .= '</flightairmap>';
Please login to merge, or discard this patch.
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7 7
         //for the date manipulation into the query
8
-        if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
8
+        if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
9 9
                 $start_date = $_GET['start_date'].":00";
10 10
                 $end_date = $_GET['end_date'].":00";
11 11
                 $sql_date = $start_date.",".$end_date;
12
-        } else if($_GET['start_date'] != ""){
12
+        } else if ($_GET['start_date'] != "") {
13 13
                 $start_date = $_GET['start_date'].":00";
14 14
                 $sql_date = $start_date;
15
-        } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
15
+        } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
16 16
                 $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
                 $sql_date = $end_date;
18 18
         } else $sql_date = '';
@@ -20,21 +20,21 @@  discard block
 block discarded – undo
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22 22
         //for altitude manipulation
23
-        if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
23
+        if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") {
24 24
                 $end_altitude = $_GET['highest_altitude'];
25 25
                 $start_altitude = $_GET['lowest_altitude'];
26 26
                 $sql_altitude = $start_altitude.",".$end_altitude;
27
-        } else if($_GET['highest_altitude'] != ""){
27
+        } else if ($_GET['highest_altitude'] != "") {
28 28
                 $end_altitude = $_GET['highest_altitude'];
29 29
                 $sql_altitude = $end_altitude;
30
-        } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
30
+        } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") {
31 31
                 $start_altitude = $_GET['lowest_altitude'].",60000";
32 32
                 $sql_altitude = $start_altitude;
33 33
         } else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37
-if(!isset($_GET['limit']))
37
+if (!isset($_GET['limit']))
38 38
 {
39 39
         if (!isset($_GET['number_results']))
40 40
         {
@@ -42,14 +42,14 @@  discard block
 block discarded – undo
42 42
                 $limit_end = 25;
43 43
                 $absolute_difference = 25;
44 44
         } else {
45
-                if ($_GET['number_results'] > 1000){
45
+                if ($_GET['number_results'] > 1000) {
46 46
                         $_GET['number_results'] = 1000;
47 47
                 }
48 48
                 $limit_start = 0;
49 49
                 $limit_end = $_GET['number_results'];
50 50
                 $absolute_difference = $_GET['number_results'];
51 51
         }
52
-}  else {
52
+} else {
53 53
         $limit_explode = explode(",", $_GET['limit']);
54 54
         $limit_start = $limit_explode[0];
55 55
         $limit_end = $limit_explode[1];
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
 
70 70
 if (isset($_GET['sort'])) $sort = $_GET['sort'];
71 71
 else $sort = '';
72
-$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73
-$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
74
-$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
75
-$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING);
76
-$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING);
77
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
78
-$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING);
79
-$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING);
80
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
81
-$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING);
82
-$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING);
83
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
84
-$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING);
85
-$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING);
86
-$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING);
87
-$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING);
88
-$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'');
72
+$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
73
+$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING);
74
+$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING);
75
+$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING);
76
+$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING);
77
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
78
+$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING);
79
+$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING);
80
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
81
+$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING);
82
+$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING);
83
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
84
+$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING);
85
+$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING);
86
+$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING);
87
+$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING);
88
+$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '');
89 89
        
90 90
 $output = '{';
91 91
   $output .= '"flightairmap": {';
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     
96 96
     if (!empty($spotter_array))
97 97
 	  {
98
-	    foreach($spotter_array as $spotter_item)
98
+	    foreach ($spotter_array as $spotter_item)
99 99
 	    {
100 100
 				
101 101
 				$output .= '{';    	
Please login to merge, or discard this patch.
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
         } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
                 $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
                 $sql_date = $end_date;
18
-        } else $sql_date = '';
19
-} else $sql_date = '';
18
+        } else {
19
+        	$sql_date = '';
20
+        }
21
+        } else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
         //for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
         } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
                 $start_altitude = $_GET['lowest_altitude'].",60000";
32 36
                 $sql_altitude = $start_altitude;
33
-        } else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+        } else {
38
+        	$sql_altitude = '';
39
+        }
40
+        } else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -49,7 +57,7 @@  discard block
 block discarded – undo
49 57
                 $limit_end = $_GET['number_results'];
50 58
                 $absolute_difference = $_GET['number_results'];
51 59
         }
52
-}  else {
60
+} else {
53 61
         $limit_explode = explode(",", $_GET['limit']);
54 62
         $limit_start = $limit_explode[0];
55 63
         $limit_end = $limit_explode[1];
@@ -67,8 +75,11 @@  discard block
 block discarded – undo
67 75
 
68 76
 header("Content-type: text/yaml");
69 77
 
70
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
71
-else $sort = '';
78
+if (isset($_GET['sort'])) {
79
+	$sort = $_GET['sort'];
80
+} else {
81
+	$sort = '';
82
+}
72 83
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73 84
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
74 85
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
statistics-country.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
             var data = google.visualization.arrayToDataTable([
23 23
             	["'._("Country").'", "'._("# of times").'"], ';
24 24
 $flightover_data = '';
25
-foreach($flightover_array as $flightover_item)
25
+foreach ($flightover_array as $flightover_item)
26 26
 {
27 27
 	$flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
28 28
 }
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	print '</thead>';
58 58
 	print '<tbody>';
59 59
 	$i = 1;
60
-	foreach($flightover_array as $flightover_item)
60
+	foreach ($flightover_array as $flightover_item)
61 61
 	{
62 62
 		print '<tr>';
63 63
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
aircraft-sub-menu.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,10 +3,10 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/aircraft/<?php print $_GET['aircraft_type']; ?>" <?php if (strtolower($current_page) == "aircraft-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7
-		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/registration/<?php print $_GET['aircraft_type']; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-registration"){ print 'class="active"'; } ?>><?php echo _("Registration"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/aircraft/<?php print $_GET['aircraft_type']; ?>" <?php if (strtolower($current_page) == "aircraft-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7
+		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/registration/<?php print $_GET['aircraft_type']; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-registration") { print 'class="active"'; } ?>><?php echo _("Registration"); ?></a></li>
8 8
 		<li class="dropdown">
9
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "aircraft-statistics-airline" || strtolower($current_page) == "aircraft-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
9
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "aircraft-statistics-airline" || strtolower($current_page) == "aircraft-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
10 10
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
11 11
 		    </a>
12 12
 		    <ul class="dropdown-menu" role="menu">
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		    </ul>
16 16
 		</li>
17 17
 		<li class="dropdown">
18
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "aircraft-statistics-departure-airport" || strtolower($current_page) == "aircraft-statistics-departure-airport-country" || strtolower($current_page) == "aircraft-statistics-arrival-airport" || strtolower($current_page) == "aircraft-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
18
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "aircraft-statistics-departure-airport" || strtolower($current_page) == "aircraft-statistics-departure-airport-country" || strtolower($current_page) == "aircraft-statistics-arrival-airport" || strtolower($current_page) == "aircraft-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
19 19
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
20 20
 		    </a>
21 21
 		    <ul class="dropdown-menu" role="menu">
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 			  <li><a href="<?php print $globalURL; ?>/aircraft/statistics/arrival-airport-country/<?php print $_GET['aircraft_type']; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
26 26
 		    </ul>
27 27
 		</li>
28
-		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/route/<?php print $_GET['aircraft_type']; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
-		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/time/<?php print $_GET['aircraft_type']; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-time"){ print 'class="active"'; } ?>><?php echo ("Time"); ?></a></li>
28
+		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/route/<?php print $_GET['aircraft_type']; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
29
+		<li><a href="<?php print $globalURL; ?>/aircraft/statistics/time/<?php print $_GET['aircraft_type']; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-time") { print 'class="active"'; } ?>><?php echo ("Time"); ?></a></li>
30 30
 	</ul>
31 31
 </div>
32 32
\ No newline at end of file
Please login to merge, or discard this patch.
aircraft-data.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 $from_archive = false;
11 11
 if (isset($_GET['ident'])) {
12
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
13 13
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
14 14
 	if (empty($spotter_array)) {
15 15
 		$from_archive = true;
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 	}
18 18
 }
19 19
 if (isset($_GET['flightaware_id'])) {
20
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
20
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
21 21
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
22 22
 	if (empty($spotter_array)) {
23 23
 		$from_archive = true;
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
34 34
 {
35 35
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
36
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
36
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
37 37
 	} else $image = $spotter_item['image_thumbnail'];
38 38
 
39 39
 }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
52 52
 if (isset($spotter_item['departure_airport_time'])) {
53 53
 	if ($spotter_item['departure_airport_time'] > 2460) {
54
-		print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>';
54
+		print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>';
55 55
 	} else {
56 56
 		print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>';
57 57
 	}
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
61 61
 if (isset($spotter_item['arrival_airport_time'])) {
62 62
 	if ($spotter_item['arrival_airport_time'] > 2460) {
63
-		print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>';
63
+		print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>';
64 64
 	} else {
65 65
 		print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>';
66 66
 	}
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
 if (isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
125 125
 if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
126
-if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
126
+if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>';
127 127
 if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
128 128
 print '</div>';
129 129
 ?>
Please login to merge, or discard this patch.
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,7 +34,9 @@  discard block
 block discarded – undo
34 34
 {
35 35
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
36 36
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
37
-	} else $image = $spotter_item['image_thumbnail'];
37
+	} else {
38
+		$image = $spotter_item['image_thumbnail'];
39
+	}
38 40
 
39 41
 }
40 42
 /* else {
@@ -46,7 +48,9 @@  discard block
 block discarded – undo
46 48
 	print '<div class="left"><img src="'.$image.'" alt="'.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].'" title="'.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' Image &copy; '.$spotter_item['image_copyright'].'"/><br />Image &copy; '.$spotter_item['image_copyright'].'</div>';
47 49
 }
48 50
 print '<div class="right"><div class="callsign-details"><div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
49
-if (isset($spotter_item['airline_name'])) print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
51
+if (isset($spotter_item['airline_name'])) {
52
+	print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
53
+}
50 54
 print '</div>';
51 55
 print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
52 56
 if (isset($spotter_item['departure_airport_time'])) {
@@ -74,9 +78,14 @@  discard block
 block discarded – undo
74 78
 print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
75 79
 print '</div></div><div>';
76 80
 print '<span>'._("Aircraft").'</span>';
77
-if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
78
-if (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a>';
79
-else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
81
+if (isset($spotter_item['aircraft_wiki'])) {
82
+	print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
83
+}
84
+if (isset($spotter_item['aircraft_type'])) {
85
+	print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a>';
86
+} else {
87
+	print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
88
+}
80 89
 print '</div>';
81 90
 print '<div><span>'._("Altitude").'</span>';
82 91
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
@@ -85,7 +94,9 @@  discard block
 block discarded – undo
85 94
 	print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
86 95
 }
87 96
 print '</div>';
88
-if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
97
+if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') {
98
+	print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
99
+}
89 100
 print '<div><span>'._("Speed").'</span>';
90 101
 if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
91 102
 	print round($spotter_item['ground_speed']*1.15078).' mph';
@@ -99,8 +110,11 @@  discard block
 block discarded – undo
99 110
 print '<div><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>';
100 111
 if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') {
101 112
 	print '<div><span>'._("Pilot").'</span>';
102
-	if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
103
-	else print $spotter_item['pilot_name'];
113
+	if (isset($spotter_item['pilot_id'])) {
114
+		print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
115
+	} else {
116
+		print $spotter_item['pilot_name'];
117
+	}
104 118
 	print '</div>';
105 119
 }
106 120
 
@@ -121,10 +135,18 @@  discard block
 block discarded – undo
121 135
 }
122 136
 print '</div>';
123 137
 
124
-if (isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
125
-if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
126
-if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
127
-if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
138
+if (isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') {
139
+	print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
140
+}
141
+if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') {
142
+	print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
143
+}
144
+if (isset($spotter_item['acars']['message'])) {
145
+	print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
146
+}
147
+if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) {
148
+	print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
149
+}
128 150
 print '</div>';
129 151
 ?>
130 152
 </div>
Please login to merge, or discard this patch.
route-statistics-airline-country.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
           function drawChart() {
36 36
             var data = google.visualization.arrayToDataTable([
37 37
             	["'._("Country").'", "'._("# of times").'"], ';
38
-            	$country_data = '';
38
+				$country_data = '';
39 39
 	foreach($airline_array as $airline_item)
40 40
 	{
41 41
 		$country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],';
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
 require_once('require/class.Spotter.php');
9 9
 require_once('require/class.Language.php');
10 10
 $Spotter = new Spotter();
11
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
12 12
 $spotter_array = $Spotter->getSpotterDataByRoute($_GET['departure_airport'], $_GET['arrival_airport'], "0,1", $sort);
13 13
 
14 14
 if (!empty($spotter_array))
15 15
 {
16
-	$title = sprintf(_("Most Common Airlines by Country between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']);
16
+	$title = sprintf(_("Most Common Airlines by Country between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']);
17 17
 	require_once('header.php');
18 18
 	print '<div class="info column">';
19 19
 	print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>';
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	include('route-sub-menu.php');
25 25
 	print '<div class="column">';
26 26
 	print '<h2>'._("Most Common Airlines by Country").'</h2>';
27
-	print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>';
27
+	print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>';
28 28
 
29 29
 	$airline_array = $Spotter->countAllAirlineCountriesByRoute($_GET['departure_airport'], $_GET['arrival_airport']);
30 30
 	print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>';
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
             var data = google.visualization.arrayToDataTable([
37 37
             	["'._("Country").'", "'._("# of times").'"], ';
38 38
             	$country_data = '';
39
-	foreach($airline_array as $airline_item)
39
+	foreach ($airline_array as $airline_item)
40 40
 	{
41 41
 		$country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],';
42 42
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 		print '</thead>';
71 71
 		print '<tbody>';
72 72
 		$i = 1;
73
-		foreach($airline_array as $airline_item)
73
+		foreach ($airline_array as $airline_item)
74 74
 		{
75 75
 			print '<tr>';
76 76
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
install/class.update_schema.php 3 patches
Indentation   +545 added lines, -545 removed lines patch added patch discarded remove patch
@@ -8,18 +8,18 @@  discard block
 block discarded – undo
8 8
 class update_schema {
9 9
 
10 10
 	public static function update_schedule() {
11
-	    $Connection = new Connection();
12
-	    $Schedule = new Schedule();
13
-	    $query = "SELECT * FROM schedule";
14
-            try {
15
-            	$sth = $Connection->db->prepare($query);
11
+		$Connection = new Connection();
12
+		$Schedule = new Schedule();
13
+		$query = "SELECT * FROM schedule";
14
+			try {
15
+				$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+			} catch(PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19
-    	    }
20
-    	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
-    	    }
19
+			}
20
+			while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
+			$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
22
+			}
23 23
 	
24 24
 	}
25 25
 /*
@@ -43,198 +43,198 @@  discard block
 block discarded – undo
43 43
     	}
44 44
 */	
45 45
 	private static function update_from_1() {
46
-    		$Connection = new Connection();
47
-    		// Add new column to routes table
48
-    		//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
46
+			$Connection = new Connection();
47
+			// Add new column to routes table
48
+			//$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME";
49 49
 		$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL";
50
-        	try {
51
-            	    $sth = $Connection->db->prepare($query);
52
-		    $sth->execute();
53
-    		} catch(PDOException $e) {
54
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
-    		}
56
-    		// Copy schedules data to routes table
57
-    		self::update_schedule();
58
-    		// Delete schedule table
50
+			try {
51
+					$sth = $Connection->db->prepare($query);
52
+			$sth->execute();
53
+			} catch(PDOException $e) {
54
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55
+			}
56
+			// Copy schedules data to routes table
57
+			self::update_schedule();
58
+			// Delete schedule table
59 59
 		$query = "DROP TABLE `schedule`";
60
-        	try {
61
-            	    $sth = $Connection->db->prepare($query);
62
-		    $sth->execute();
63
-    		} catch(PDOException $e) {
64
-		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65
-    		}
66
-    		// Add source column
67
-    		$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
-    		try {
69
-            	    $sth = $Connection->db->prepare($query);
70
-		    $sth->execute();
71
-    		} catch(PDOException $e) {
72
-		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
-    		}
60
+			try {
61
+					$sth = $Connection->db->prepare($query);
62
+			$sth->execute();
63
+			} catch(PDOException $e) {
64
+			return "error (delete schedule table) : ".$e->getMessage()."\n";
65
+			}
66
+			// Add source column
67
+			$query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL";
68
+			try {
69
+					$sth = $Connection->db->prepare($query);
70
+			$sth->execute();
71
+			} catch(PDOException $e) {
72
+			return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73
+			}
74 74
 		// Delete unused column
75 75
 		$query = "ALTER TABLE `aircraft_modes`  DROP `SerialNo`,  DROP `OperatorFlagCode`,  DROP `Manufacturer`,  DROP `Type`,  DROP `FirstRegDate`,  DROP `CurrentRegDate`,  DROP `Country`,  DROP `PreviousID`,  DROP `DeRegDate`,  DROP `Status`,  DROP `PopularName`,  DROP `GenericName`,  DROP `AircraftClass`,  DROP `Engines`,  DROP `OwnershipStatus`,  DROP `RegisteredOwners`,  DROP `MTOW`,  DROP `TotalHours`,  DROP `YearBuilt`,  DROP `CofACategory`,  DROP `CofAExpiry`,  DROP `UserNotes`,  DROP `Interested`,  DROP `UserTag`,  DROP `InfoUrl`,  DROP `PictureUrl1`,  DROP `PictureUrl2`,  DROP `PictureUrl3`,  DROP `UserBool1`,  DROP `UserBool2`,  DROP `UserBool3`,  DROP `UserBool4`,  DROP `UserBool5`,  DROP `UserString1`,  DROP `UserString2`,  DROP `UserString3`,  DROP `UserString4`,  DROP `UserString5`,  DROP `UserInt1`,  DROP `UserInt2`,  DROP `UserInt3`,  DROP `UserInt4`,  DROP `UserInt5`";
76
-    		try {
77
-            	    $sth = $Connection->db->prepare($query);
78
-		    $sth->execute();
79
-    		} catch(PDOException $e) {
80
-		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
-    		}
76
+			try {
77
+					$sth = $Connection->db->prepare($query);
78
+			$sth->execute();
79
+			} catch(PDOException $e) {
80
+			return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81
+			}
82 82
 		// Add ModeS column
83 83
 		$query = "ALTER TABLE `spotter_output`  ADD `ModeS` VARCHAR(255) NULL";
84
-    		try {
85
-            	    $sth = $Connection->db->prepare($query);
86
-		    $sth->execute();
87
-    		} catch(PDOException $e) {
88
-		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
-    		}
84
+			try {
85
+					$sth = $Connection->db->prepare($query);
86
+			$sth->execute();
87
+			} catch(PDOException $e) {
88
+			return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89
+			}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91
-    		try {
92
-            	    $sth = $Connection->db->prepare($query);
93
-		    $sth->execute();
94
-    		} catch(PDOException $e) {
95
-		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
-    		}
97
-    		// Add auto_increment for aircraft_modes
98
-    		$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
-    		try {
100
-            	    $sth = $Connection->db->prepare($query);
101
-		    $sth->execute();
102
-    		} catch(PDOException $e) {
103
-		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
-    		}
105
-    		$error = '';
91
+			try {
92
+					$sth = $Connection->db->prepare($query);
93
+			$sth->execute();
94
+			} catch(PDOException $e) {
95
+			return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96
+			}
97
+			// Add auto_increment for aircraft_modes
98
+			$query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT";
99
+			try {
100
+					$sth = $Connection->db->prepare($query);
101
+			$sth->execute();
102
+			} catch(PDOException $e) {
103
+			return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104
+			}
105
+			$error = '';
106 106
 		$error .= create_db::import_file('../db/acars_live.sql');
107 107
 		$error .= create_db::import_file('../db/config.sql');
108 108
 		// Update schema_version to 2
109 109
 		$query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'";
110
-        	try {
111
-            	    $sth = $Connection->db->prepare($query);
112
-		    $sth->execute();
113
-    		} catch(PDOException $e) {
114
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
115
-    		}
110
+			try {
111
+					$sth = $Connection->db->prepare($query);
112
+			$sth->execute();
113
+			} catch(PDOException $e) {
114
+			return "error (update schema_version) : ".$e->getMessage()."\n";
115
+			}
116 116
 		return $error;
117
-        }
117
+		}
118 118
 
119 119
 	private static function update_from_2() {
120
-    		$Connection = new Connection();
121
-    		// Add new column decode to acars_live table
120
+			$Connection = new Connection();
121
+			// Add new column decode to acars_live table
122 122
 		$query = "ALTER TABLE `acars_live` ADD `decode` TEXT";
123
-        	try {
124
-            	    $sth = $Connection->db->prepare($query);
125
-		    $sth->execute();
126
-    		} catch(PDOException $e) {
127
-		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
-    		}
129
-    		$error = '';
130
-    		// Create table acars_archive
123
+			try {
124
+					$sth = $Connection->db->prepare($query);
125
+			$sth->execute();
126
+			} catch(PDOException $e) {
127
+			return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128
+			}
129
+			$error = '';
130
+			// Create table acars_archive
131 131
 		$error .= create_db::import_file('../db/acars_archive.sql');
132 132
 		// Update schema_version to 3
133 133
 		$query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'";
134
-        	try {
135
-            	    $sth = $Connection->db->prepare($query);
136
-		    $sth->execute();
137
-    		} catch(PDOException $e) {
138
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
139
-    		}
134
+			try {
135
+					$sth = $Connection->db->prepare($query);
136
+			$sth->execute();
137
+			} catch(PDOException $e) {
138
+			return "error (update schema_version) : ".$e->getMessage()."\n";
139
+			}
140 140
 		return $error;
141 141
 	}
142 142
 
143 143
 	private static function update_from_3() {
144
-    		$Connection = new Connection();
145
-    		// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
144
+			$Connection = new Connection();
145
+			// Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated
146 146
 		$query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP";
147
-        	try {
148
-            	    $sth = $Connection->db->prepare($query);
149
-		    $sth->execute();
150
-    		} catch(PDOException $e) {
151
-		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
-    		}
153
-    		// Add image_source_website column to spotter_image
147
+			try {
148
+					$sth = $Connection->db->prepare($query);
149
+			$sth->execute();
150
+			} catch(PDOException $e) {
151
+			return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152
+			}
153
+			// Add image_source_website column to spotter_image
154 154
 		$query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL";
155
-        	try {
156
-            	    $sth = $Connection->db->prepare($query);
157
-		    $sth->execute();
158
-    		} catch(PDOException $e) {
159
-		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
-    		}
161
-    		$error = '';
155
+			try {
156
+					$sth = $Connection->db->prepare($query);
157
+			$sth->execute();
158
+			} catch(PDOException $e) {
159
+			return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160
+			}
161
+			$error = '';
162 162
 		// Update schema_version to 4
163 163
 		$query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'";
164
-        	try {
165
-            	    $sth = $Connection->db->prepare($query);
166
-		    $sth->execute();
167
-    		} catch(PDOException $e) {
168
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
169
-    		}
164
+			try {
165
+					$sth = $Connection->db->prepare($query);
166
+			$sth->execute();
167
+			} catch(PDOException $e) {
168
+			return "error (update schema_version) : ".$e->getMessage()."\n";
169
+			}
170 170
 		return $error;
171 171
 	}
172 172
 	
173 173
 	private static function update_from_4() {
174
-    		$Connection = new Connection();
174
+			$Connection = new Connection();
175 175
 	
176
-    		$error = '';
177
-    		// Create table acars_label
176
+			$error = '';
177
+			// Create table acars_label
178 178
 		$error .= create_db::import_file('../db/acars_label.sql');
179 179
 		if ($error == '') {
180
-		    // Update schema_version to 5
181
-		    $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
-        	    try {
183
-            		$sth = $Connection->db->prepare($query);
180
+			// Update schema_version to 5
181
+			$query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
182
+				try {
183
+					$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+				} catch(PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187
-    		    }
188
-    		}
187
+				}
188
+			}
189 189
 		return $error;
190 190
 	}
191 191
 
192 192
 	private static function update_from_5() {
193
-    		$Connection = new Connection();
194
-    		// Add columns to translation
193
+			$Connection = new Connection();
194
+			// Add columns to translation
195 195
 		$query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;";
196
-        	try {
197
-            	    $sth = $Connection->db->prepare($query);
198
-		    $sth->execute();
199
-    		} catch(PDOException $e) {
200
-		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
-    		}
202
-    		// Add aircraft_shadow column to aircraft
203
-    		$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
-        	try {
205
-            	    $sth = $Connection->db->prepare($query);
206
-		    $sth->execute();
207
-    		} catch(PDOException $e) {
208
-		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
-    		}
210
-    		// Add aircraft_shadow column to spotter_live
211
-    		$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
-        	try {
213
-            	    $sth = $Connection->db->prepare($query);
214
-		    $sth->execute();
215
-    		} catch(PDOException $e) {
216
-		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
-    		}
218
-    		$error = '';
219
-    		// Update table aircraft
196
+			try {
197
+					$sth = $Connection->db->prepare($query);
198
+			$sth->execute();
199
+			} catch(PDOException $e) {
200
+			return "error (add new columns to translation) : ".$e->getMessage()."\n";
201
+			}
202
+			// Add aircraft_shadow column to aircraft
203
+			$query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL";
204
+			try {
205
+					$sth = $Connection->db->prepare($query);
206
+			$sth->execute();
207
+			} catch(PDOException $e) {
208
+			return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209
+			}
210
+			// Add aircraft_shadow column to spotter_live
211
+			$query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL";
212
+			try {
213
+					$sth = $Connection->db->prepare($query);
214
+			$sth->execute();
215
+			} catch(PDOException $e) {
216
+			return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217
+			}
218
+			$error = '';
219
+			// Update table aircraft
220 220
 		$error .= create_db::import_file('../db/aircraft.sql');
221 221
 		$error .= create_db::import_file('../db/spotter_archive.sql');
222 222
 
223 223
 		// Update schema_version to 6
224 224
 		$query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'";
225
-        	try {
226
-            	    $sth = $Connection->db->prepare($query);
227
-		    $sth->execute();
228
-    		} catch(PDOException $e) {
229
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
230
-    		}
225
+			try {
226
+					$sth = $Connection->db->prepare($query);
227
+			$sth->execute();
228
+			} catch(PDOException $e) {
229
+			return "error (update schema_version) : ".$e->getMessage()."\n";
230
+			}
231 231
 		return $error;
232 232
 	}
233 233
 
234 234
 	private static function update_from_6() {
235
-    		$Connection = new Connection();
236
-    		if (!$Connection−>indexExists('spotter_output','flightaware_id')) {
237
-    		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
235
+			$Connection = new Connection();
236
+			if (!$Connection−>indexExists('spotter_output','flightaware_id')) {
237
+				$query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
240 240
 			ALTER TABLE spotter_live ADD INDEX(flightaware_id);
@@ -247,147 +247,147 @@  discard block
 block discarded – undo
247 247
 			ALTER TABLE aircraft ADD INDEX(icao);
248 248
 			ALTER TABLE airport ADD INDEX(icao);
249 249
 			ALTER TABLE translation ADD INDEX(Operator);";
250
-        	    try {
251
-            		$sth = $Connection->db->prepare($query);
250
+				try {
251
+					$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+				} catch(PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255
-    		    }
256
-    		}
257
-    		$error = '';
258
-    		// Update table countries
259
-    		if ($Connection->tableExists('airspace')) {
260
-    		    $error .= update_db::update_countries();
261
-		    if ($error != '') return $error;
255
+				}
256
+			}
257
+			$error = '';
258
+			// Update table countries
259
+			if ($Connection->tableExists('airspace')) {
260
+				$error .= update_db::update_countries();
261
+			if ($error != '') return $error;
262 262
 		}
263 263
 		// Update schema_version to 7
264 264
 		$query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'";
265
-        	try {
266
-            	    $sth = $Connection->db->prepare($query);
267
-		    $sth->execute();
268
-    		} catch(PDOException $e) {
269
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
270
-    		}
265
+			try {
266
+					$sth = $Connection->db->prepare($query);
267
+			$sth->execute();
268
+			} catch(PDOException $e) {
269
+			return "error (update schema_version) : ".$e->getMessage()."\n";
270
+			}
271 271
 		return $error;
272
-    	}
272
+		}
273 273
 
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276
-    		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
276
+			$Connection = new Connection();
277
+			$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279
-        	try {
280
-            	    $sth = $Connection->db->prepare($query);
281
-		    $sth->execute();
282
-    		} catch(PDOException $e) {
283
-		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
-    		}
285
-    		if ($globalDBdriver == 'mysql') {
286
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
-		    try {
288
-            		$sth = $Connection->db->prepare($query);
289
-			$sth->execute();
290
-    		    } catch(PDOException $e) {
279
+			try {
280
+					$sth = $Connection->db->prepare($query);
281
+			$sth->execute();
282
+			} catch(PDOException $e) {
283
+			return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284
+			}
285
+			if ($globalDBdriver == 'mysql') {
286
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
287
+			try {
288
+					$sth = $Connection->db->prepare($query);
289
+			$sth->execute();
290
+				} catch(PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292
-    		    }
293
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
294
-    		    if ($row['engine'] == 'ARCHIVE') {
292
+				}
293
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
294
+				if ($row['engine'] == 'ARCHIVE') {
295 295
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
296 296
 				ALTER TABLE copy ENGINE=ARCHIVE;
297 297
 				ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
298 298
 				INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`;
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301
-            	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
-            	    }
304
-                } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
-                }
307
-        	try {
308
-            	    $sth = $Connection->db->prepare($query);
309
-		    $sth->execute();
310
-    		} catch(PDOException $e) {
311
-		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
-    		}
301
+					} else {
302
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303
+					}
304
+				} else {
305
+				$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306
+				}
307
+			try {
308
+					$sth = $Connection->db->prepare($query);
309
+			$sth->execute();
310
+			} catch(PDOException $e) {
311
+			return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312
+			}
313 313
 
314
-    		$error = '';
315
-    		// Update table aircraft
314
+			$error = '';
315
+			// Update table aircraft
316 316
 		$error .= create_db::import_file('../db/source_location.sql');
317 317
 		if ($error != '') return $error;
318 318
 		// Update schema_version to 6
319 319
 		$query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'";
320
-        	try {
321
-            	    $sth = $Connection->db->prepare($query);
322
-		    $sth->execute();
323
-    		} catch(PDOException $e) {
324
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
325
-    		}
320
+			try {
321
+					$sth = $Connection->db->prepare($query);
322
+			$sth->execute();
323
+			} catch(PDOException $e) {
324
+			return "error (update schema_version) : ".$e->getMessage()."\n";
325
+			}
326 326
 		return $error;
327 327
 	}
328 328
 
329 329
 	private static function update_from_8() {
330
-    		$Connection = new Connection();
331
-    		$error = '';
332
-    		// Update table aircraft
330
+			$Connection = new Connection();
331
+			$error = '';
332
+			// Update table aircraft
333 333
 		$error .= create_db::import_file('../db/notam.sql');
334 334
 		if ($error != '') return $error;
335 335
 		$query = "DELETE FROM config WHERE name = 'last_update_db';
336 336
                         INSERT INTO config (name,value) VALUES ('last_update_db',NOW());
337 337
                         DELETE FROM config WHERE name = 'last_update_notam_db';
338 338
                         INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());";
339
-        	try {
340
-            	    $sth = $Connection->db->prepare($query);
341
-		    $sth->execute();
342
-    		} catch(PDOException $e) {
343
-		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344
-    		}
339
+			try {
340
+					$sth = $Connection->db->prepare($query);
341
+			$sth->execute();
342
+			} catch(PDOException $e) {
343
+			return "error (insert last_update values) : ".$e->getMessage()."\n";
344
+			}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346
-        	try {
347
-            	    $sth = $Connection->db->prepare($query);
348
-		    $sth->execute();
349
-    		} catch(PDOException $e) {
350
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
351
-    		}
346
+			try {
347
+					$sth = $Connection->db->prepare($query);
348
+			$sth->execute();
349
+			} catch(PDOException $e) {
350
+			return "error (update schema_version) : ".$e->getMessage()."\n";
351
+			}
352 352
 		return $error;
353 353
 	}
354 354
 
355 355
 	private static function update_from_9() {
356
-    		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
356
+			$Connection = new Connection();
357
+			$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359
-        	try {
360
-            	    $sth = $Connection->db->prepare($query);
361
-		    $sth->execute();
362
-    		} catch(PDOException $e) {
363
-		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
-    		}
359
+			try {
360
+					$sth = $Connection->db->prepare($query);
361
+			$sth->execute();
362
+			} catch(PDOException $e) {
363
+			return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364
+			}
365 365
 		$error = '';
366
-    		// Update table atc
366
+			// Update table atc
367 367
 		$error .= create_db::import_file('../db/atc.sql');
368 368
 		if ($error != '') return $error;
369 369
 		
370 370
 		$query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'";
371
-        	try {
372
-            	    $sth = $Connection->db->prepare($query);
373
-		    $sth->execute();
374
-    		} catch(PDOException $e) {
375
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
376
-    		}
371
+			try {
372
+					$sth = $Connection->db->prepare($query);
373
+			$sth->execute();
374
+			} catch(PDOException $e) {
375
+			return "error (update schema_version) : ".$e->getMessage()."\n";
376
+			}
377 377
 		return $error;
378 378
 	}
379 379
 
380 380
 	private static function update_from_10() {
381
-    		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
-        	try {
384
-            	    $sth = $Connection->db->prepare($query);
385
-		    $sth->execute();
386
-    		} catch(PDOException $e) {
387
-		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
-    		}
381
+			$Connection = new Connection();
382
+			$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383
+			try {
384
+					$sth = $Connection->db->prepare($query);
385
+			$sth->execute();
386
+			} catch(PDOException $e) {
387
+			return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388
+			}
389 389
 		$error = '';
390
-    		// Add tables
390
+			// Add tables
391 391
 		$error .= create_db::import_file('../db/aircraft_owner.sql');
392 392
 		if ($error != '') return $error;
393 393
 		$error .= create_db::import_file('../db/metar.sql');
@@ -398,75 +398,75 @@  discard block
 block discarded – undo
398 398
 		if ($error != '') return $error;
399 399
 		
400 400
 		$query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'";
401
-        	try {
402
-            	    $sth = $Connection->db->prepare($query);
403
-		    $sth->execute();
404
-    		} catch(PDOException $e) {
405
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
406
-    		}
401
+			try {
402
+					$sth = $Connection->db->prepare($query);
403
+			$sth->execute();
404
+			} catch(PDOException $e) {
405
+			return "error (update schema_version) : ".$e->getMessage()."\n";
406
+			}
407 407
 		return $error;
408 408
 	}
409 409
 
410 410
 	private static function update_from_11() {
411
-    		$Connection = new Connection();
412
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
-        	try {
414
-            	    $sth = $Connection->db->prepare($query);
415
-		    $sth->execute();
416
-    		} catch(PDOException $e) {
417
-		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
418
-    		}
419
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
-        	try {
421
-            	    $sth = $Connection->db->prepare($query);
422
-		    $sth->execute();
423
-    		} catch(PDOException $e) {
424
-		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
425
-    		}
426
-    		if ($globalDBdriver == 'mysql') {
427
-    		    $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
428
-		    try {
429
-            		$sth = $Connection->db->prepare($query);
430
-			$sth->execute();
431
-    		    } catch(PDOException $e) {
411
+			$Connection = new Connection();
412
+			$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413
+			try {
414
+					$sth = $Connection->db->prepare($query);
415
+			$sth->execute();
416
+			} catch(PDOException $e) {
417
+			return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
418
+			}
419
+			$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420
+			try {
421
+					$sth = $Connection->db->prepare($query);
422
+			$sth->execute();
423
+			} catch(PDOException $e) {
424
+			return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
425
+			}
426
+			if ($globalDBdriver == 'mysql') {
427
+				$query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'";
428
+			try {
429
+					$sth = $Connection->db->prepare($query);
430
+			$sth->execute();
431
+				} catch(PDOException $e) {
432 432
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
433
-    		    }
434
-    		    $row = $sth->fetch(PDO::FETCH_ASSOC);
435
-    		    if ($row['engine'] == 'ARCHIVE') {
433
+				}
434
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
435
+				if ($row['engine'] == 'ARCHIVE') {
436 436
 			$query = "CREATE TABLE copy LIKE spotter_archive; 
437 437
 				ALTER TABLE copy ENGINE=ARCHIVE;
438 438
 				ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE;
439 439
 				INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`;
440 440
 				DROP TABLE spotter_archive;
441 441
 				RENAME TABLE copy TO spotter_archive;";
442
-            	    } else {
443
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
-            	    }
445
-                } else {
446
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
-                }
448
-        	try {
449
-            	    $sth = $Connection->db->prepare($query);
450
-		    $sth->execute();
451
-    		} catch(PDOException $e) {
452
-		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
453
-    		}
442
+					} else {
443
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444
+					}
445
+				} else {
446
+				$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447
+				}
448
+			try {
449
+					$sth = $Connection->db->prepare($query);
450
+			$sth->execute();
451
+			} catch(PDOException $e) {
452
+			return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
453
+			}
454 454
 
455 455
 		$error = '';
456 456
 		
457 457
 		$query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'";
458
-        	try {
459
-            	    $sth = $Connection->db->prepare($query);
460
-		    $sth->execute();
461
-    		} catch(PDOException $e) {
462
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
463
-    		}
458
+			try {
459
+					$sth = $Connection->db->prepare($query);
460
+			$sth->execute();
461
+			} catch(PDOException $e) {
462
+			return "error (update schema_version) : ".$e->getMessage()."\n";
463
+			}
464 464
 		return $error;
465 465
 	}
466 466
 	private static function update_from_12() {
467
-    		$Connection = new Connection();
467
+			$Connection = new Connection();
468 468
 		$error = '';
469
-    		// Add tables
469
+			// Add tables
470 470
 		$error .= create_db::import_file('../db/stats.sql');
471 471
 		if ($error != '') return $error;
472 472
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
@@ -483,188 +483,188 @@  discard block
 block discarded – undo
483 483
 		if ($error != '') return $error;
484 484
 		
485 485
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
486
-        	try {
487
-            	    $sth = $Connection->db->prepare($query);
488
-		    $sth->execute();
489
-    		} catch(PDOException $e) {
490
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
491
-    		}
486
+			try {
487
+					$sth = $Connection->db->prepare($query);
488
+			$sth->execute();
489
+			} catch(PDOException $e) {
490
+			return "error (update schema_version) : ".$e->getMessage()."\n";
491
+			}
492 492
 		return $error;
493 493
 	}
494 494
 
495 495
 	private static function update_from_13() {
496
-    		$Connection = new Connection();
497
-    		$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
-        	try {
499
-            	    $sth = $Connection->db->prepare($query);
500
-		    $sth->execute();
501
-    		} catch(PDOException $e) {
502
-		    return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
503
-    		}
496
+			$Connection = new Connection();
497
+			$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498
+			try {
499
+					$sth = $Connection->db->prepare($query);
500
+			$sth->execute();
501
+			} catch(PDOException $e) {
502
+			return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
503
+			}
504 504
 	
505
-    		$error = '';
505
+			$error = '';
506 506
 		$query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'";
507
-        	try {
508
-            	    $sth = $Connection->db->prepare($query);
509
-		    $sth->execute();
510
-    		} catch(PDOException $e) {
511
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
512
-    		}
507
+			try {
508
+					$sth = $Connection->db->prepare($query);
509
+			$sth->execute();
510
+			} catch(PDOException $e) {
511
+			return "error (update schema_version) : ".$e->getMessage()."\n";
512
+			}
513 513
 		return $error;
514 514
 	}
515 515
 
516 516
 	private static function update_from_14() {
517
-    		$Connection = new Connection();
517
+			$Connection = new Connection();
518 518
 		$error = '';
519
-    		// Add tables
519
+			// Add tables
520 520
 		$error .= create_db::import_file('../db/stats_flight.sql');
521 521
 		if ($error != '') return $error;
522 522
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
523
-        	try {
524
-            	    $sth = $Connection->db->prepare($query);
525
-		    $sth->execute();
526
-    		} catch(PDOException $e) {
527
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
528
-    		}
523
+			try {
524
+					$sth = $Connection->db->prepare($query);
525
+			$sth->execute();
526
+			} catch(PDOException $e) {
527
+			return "error (update schema_version) : ".$e->getMessage()."\n";
528
+			}
529 529
 		return $error;
530 530
 	}
531 531
 
532 532
 
533 533
 	private static function update_from_15() {
534
-    		$Connection = new Connection();
534
+			$Connection = new Connection();
535 535
 		$error = '';
536
-    		// Add tables
537
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
538
-        	try {
539
-            	    $sth = $Connection->db->prepare($query);
540
-		    $sth->execute();
541
-    		} catch(PDOException $e) {
542
-		    return "error (update stats) : ".$e->getMessage()."\n";
543
-    		}
536
+			// Add tables
537
+			$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
538
+			try {
539
+					$sth = $Connection->db->prepare($query);
540
+			$sth->execute();
541
+			} catch(PDOException $e) {
542
+			return "error (update stats) : ".$e->getMessage()."\n";
543
+			}
544 544
 		if ($error != '') return $error;
545 545
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
546
-        	try {
547
-            	    $sth = $Connection->db->prepare($query);
548
-		    $sth->execute();
549
-    		} catch(PDOException $e) {
550
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
551
-    		}
546
+			try {
547
+					$sth = $Connection->db->prepare($query);
548
+			$sth->execute();
549
+			} catch(PDOException $e) {
550
+			return "error (update schema_version) : ".$e->getMessage()."\n";
551
+			}
552 552
 		return $error;
553 553
 	}
554 554
 
555 555
 	private static function update_from_16() {
556
-    		$Connection = new Connection();
556
+			$Connection = new Connection();
557 557
 		$error = '';
558
-    		// Add tables
558
+			// Add tables
559 559
 		$error .= create_db::import_file('../db/stats_registration.sql');
560 560
 		$error .= create_db::import_file('../db/stats_callsign.sql');
561 561
 		if ($error != '') return $error;
562 562
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
563
-        	try {
564
-            	    $sth = $Connection->db->prepare($query);
565
-		    $sth->execute();
566
-    		} catch(PDOException $e) {
567
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
568
-    		}
563
+			try {
564
+					$sth = $Connection->db->prepare($query);
565
+			$sth->execute();
566
+			} catch(PDOException $e) {
567
+			return "error (update schema_version) : ".$e->getMessage()."\n";
568
+			}
569 569
 		return $error;
570 570
 	}
571 571
 
572 572
 	private static function update_from_17() {
573
-    		$Connection = new Connection();
573
+			$Connection = new Connection();
574 574
 		$error = '';
575
-    		// Add tables
575
+			// Add tables
576 576
 		$error .= create_db::import_file('../db/stats_country.sql');
577 577
 		if ($error != '') return $error;
578 578
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
579
-        	try {
580
-            	    $sth = $Connection->db->prepare($query);
581
-		    $sth->execute();
582
-    		} catch(PDOException $e) {
583
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
584
-    		}
579
+			try {
580
+					$sth = $Connection->db->prepare($query);
581
+			$sth->execute();
582
+			} catch(PDOException $e) {
583
+			return "error (update schema_version) : ".$e->getMessage()."\n";
584
+			}
585 585
 		return $error;
586 586
 	}
587 587
 	private static function update_from_18() {
588
-    		$Connection = new Connection();
588
+			$Connection = new Connection();
589 589
 		$error = '';
590
-    		// Modify stats_airport table
591
-    		$query = "ALTER TABLE `stats_airport` ADD `type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
592
-        	try {
593
-            	    $sth = $Connection->db->prepare($query);
594
-		    $sth->execute();
595
-    		} catch(PDOException $e) {
596
-		    return "error (update stats) : ".$e->getMessage()."\n";
597
-    		}
590
+			// Modify stats_airport table
591
+			$query = "ALTER TABLE `stats_airport` ADD `type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)";
592
+			try {
593
+					$sth = $Connection->db->prepare($query);
594
+			$sth->execute();
595
+			} catch(PDOException $e) {
596
+			return "error (update stats) : ".$e->getMessage()."\n";
597
+			}
598 598
 		if ($error != '') return $error;
599 599
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
600
-        	try {
601
-            	    $sth = $Connection->db->prepare($query);
602
-		    $sth->execute();
603
-    		} catch(PDOException $e) {
604
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
605
-    		}
600
+			try {
601
+					$sth = $Connection->db->prepare($query);
602
+			$sth->execute();
603
+			} catch(PDOException $e) {
604
+			return "error (update schema_version) : ".$e->getMessage()."\n";
605
+			}
606 606
 		return $error;
607 607
 	}
608 608
 
609 609
 	private static function update_from_19() {
610
-    		$Connection = new Connection();
610
+			$Connection = new Connection();
611 611
 		$error = '';
612
-    		// Update airport table
612
+			// Update airport table
613 613
 		$error .= create_db::import_file('../db/airport.sql');
614 614
 		if ($error != '') return 'Import airport.sql : '.$error;
615 615
 		// Remove primary key on Spotter_Archive
616 616
 		$query = "alter table spotter_archive drop column spotter_archive_id, add spotter_archive_id INT(11)";
617
-        	try {
618
-            	    $sth = $Connection->db->prepare($query);
619
-		    $sth->execute();
620
-    		} catch(PDOException $e) {
621
-		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
622
-    		}
617
+			try {
618
+					$sth = $Connection->db->prepare($query);
619
+			$sth->execute();
620
+			} catch(PDOException $e) {
621
+			return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
622
+			}
623 623
 
624
-    		// Add column over_country
625
-    		$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL;ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL;";
626
-        	try {
627
-            	    $sth = $Connection->db->prepare($query);
628
-		    $sth->execute();
629
-    		} catch(PDOException $e) {
630
-		    return "error (add over_country) : ".$e->getMessage()."\n";
631
-    		}
632
-    		// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
633
-    		$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
634
-        	try {
635
-            	    $sth = $Connection->db->prepare($query);
636
-		    $sth->execute();
637
-    		} catch(PDOException $e) {
638
-		    return "error (add source_name column) : ".$e->getMessage()."\n";
639
-    		}
624
+			// Add column over_country
625
+			$query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL;ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL;";
626
+			try {
627
+					$sth = $Connection->db->prepare($query);
628
+			$sth->execute();
629
+			} catch(PDOException $e) {
630
+			return "error (add over_country) : ".$e->getMessage()."\n";
631
+			}
632
+			// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
633
+			$query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;";
634
+			try {
635
+					$sth = $Connection->db->prepare($query);
636
+			$sth->execute();
637
+			} catch(PDOException $e) {
638
+			return "error (add source_name column) : ".$e->getMessage()."\n";
639
+			}
640 640
 		if ($error != '') return $error;
641 641
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
642
-        	try {
643
-            	    $sth = $Connection->db->prepare($query);
644
-		    $sth->execute();
645
-    		} catch(PDOException $e) {
646
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
647
-    		}
642
+			try {
643
+					$sth = $Connection->db->prepare($query);
644
+			$sth->execute();
645
+			} catch(PDOException $e) {
646
+			return "error (update schema_version) : ".$e->getMessage()."\n";
647
+			}
648 648
 		return $error;
649 649
 	}
650 650
 
651 651
 	private static function update_from_20() {
652 652
 		global $globalIVAO, $globalVATSIM, $globalphpVMS;
653
-    		$Connection = new Connection();
653
+			$Connection = new Connection();
654 654
 		$error = '';
655
-    		// Update airline table
656
-    		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
655
+			// Update airline table
656
+			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
657 657
 			$error .= create_db::import_file('../db/airlines.sql');
658 658
 			if ($error != '') return 'Import airlinesport.sql : '.$error;
659 659
 		}
660
-    		// Add column over_country
661
-    		$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
662
-        	try {
663
-            	    $sth = $Connection->db->prepare($query);
664
-		    $sth->execute();
665
-    		} catch(PDOException $e) {
666
-		    return "error (add over_country) : ".$e->getMessage()."\n";
667
-    		}
660
+			// Add column over_country
661
+			$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
662
+			try {
663
+					$sth = $Connection->db->prepare($query);
664
+			$sth->execute();
665
+			} catch(PDOException $e) {
666
+			return "error (add over_country) : ".$e->getMessage()."\n";
667
+			}
668 668
 		if ($error != '') return $error;
669 669
 		/*
670 670
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
@@ -674,40 +674,40 @@  discard block
 block discarded – undo
674 674
 		}
675 675
 		*/
676 676
 		$query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'";
677
-        	try {
678
-            	    $sth = $Connection->db->prepare($query);
679
-		    $sth->execute();
680
-    		} catch(PDOException $e) {
681
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
682
-    		}
677
+			try {
678
+					$sth = $Connection->db->prepare($query);
679
+			$sth->execute();
680
+			} catch(PDOException $e) {
681
+			return "error (update schema_version) : ".$e->getMessage()."\n";
682
+			}
683 683
 		return $error;
684 684
 	}
685 685
 
686 686
 	private static function update_from_21() {
687
-    		$Connection = new Connection();
687
+			$Connection = new Connection();
688 688
 		$error = '';
689 689
 		// Rename type to stats_type
690 690
 		$query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);";
691
-        	try {
692
-            	    $sth = $Connection->db->prepare($query);
693
-		    $sth->execute();
694
-    		} catch(PDOException $e) {
695
-		    return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
696
-    		}
691
+			try {
692
+					$sth = $Connection->db->prepare($query);
693
+			$sth->execute();
694
+			} catch(PDOException $e) {
695
+			return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
696
+			}
697 697
 		if ($error != '') return $error;
698 698
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
699
-        	try {
700
-            	    $sth = $Connection->db->prepare($query);
701
-		    $sth->execute();
702
-    		} catch(PDOException $e) {
703
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
704
-    		}
699
+			try {
700
+					$sth = $Connection->db->prepare($query);
701
+			$sth->execute();
702
+			} catch(PDOException $e) {
703
+			return "error (update schema_version) : ".$e->getMessage()."\n";
704
+			}
705 705
 		return $error;
706 706
 	}
707 707
 
708 708
 	private static function update_from_22() {
709 709
 		global $globalDBdriver;
710
-    		$Connection = new Connection();
710
+			$Connection = new Connection();
711 711
 		$error = '';
712 712
 		// Add table stats polar
713 713
 		if ($globalDBdriver == 'mysql') {
@@ -717,128 +717,128 @@  discard block
 block discarded – undo
717 717
 		}
718 718
 		if ($error != '') return $error;
719 719
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
720
-        	try {
721
-            	    $sth = $Connection->db->prepare($query);
722
-		    $sth->execute();
723
-    		} catch(PDOException $e) {
724
-		    return "error (update schema_version) : ".$e->getMessage()."\n";
725
-    		}
720
+			try {
721
+					$sth = $Connection->db->prepare($query);
722
+			$sth->execute();
723
+			} catch(PDOException $e) {
724
+			return "error (update schema_version) : ".$e->getMessage()."\n";
725
+			}
726 726
 		return $error;
727 727
 	}
728 728
 
729 729
 
730 730
 
731
-    	public static function check_version($update = false) {
732
-    	    global $globalDBname;
733
-    	    $version = 0;
734
-    	    $Connection = new Connection();
735
-    	    if ($Connection->tableExists('aircraft')) {
736
-    		if (!$Connection->tableExists('config')) {
737
-    		    $version = '1';
738
-    		    if ($update) return self::update_from_1();
739
-    		    else return $version;
731
+		public static function check_version($update = false) {
732
+			global $globalDBname;
733
+			$version = 0;
734
+			$Connection = new Connection();
735
+			if ($Connection->tableExists('aircraft')) {
736
+			if (!$Connection->tableExists('config')) {
737
+				$version = '1';
738
+				if ($update) return self::update_from_1();
739
+				else return $version;
740 740
 		} else {
741
-    		    $Connection = new Connection();
742
-		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
743
-		    try {
744
-            		$sth = $Connection->db->prepare($query);
745
-		        $sth->execute();
746
-		    } catch(PDOException $e) {
741
+				$Connection = new Connection();
742
+			$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
743
+			try {
744
+					$sth = $Connection->db->prepare($query);
745
+				$sth->execute();
746
+			} catch(PDOException $e) {
747 747
 			return "error : ".$e->getMessage()."\n";
748
-    		    }
749
-    		    $result = $sth->fetch(PDO::FETCH_ASSOC);
750
-    		    if ($update) {
751
-    			if ($result['value'] == '2') {
752
-    			    $error = self::update_from_2();
753
-    			    if ($error != '') return $error;
754
-    			    else return self::check_version(true);
755
-    			} elseif ($result['value'] == '3') {
756
-    			    $error = self::update_from_3();
757
-    			    if ($error != '') return $error;
758
-    			    else return self::check_version(true);
759
-    			} elseif ($result['value'] == '4') {
760
-    			    $error = self::update_from_4();
761
-    			    if ($error != '') return $error;
762
-    			    else return self::check_version(true);
763
-    			} elseif ($result['value'] == '5') {
764
-    			    $error = self::update_from_5();
765
-    			    if ($error != '') return $error;
766
-    			    else return self::check_version(true);
767
-    			} elseif ($result['value'] == '6') {
768
-    			    $error = self::update_from_6();
769
-    			    if ($error != '') return $error;
770
-    			    else return self::check_version(true);
771
-    			} elseif ($result['value'] == '7') {
772
-    			    $error = self::update_from_7();
773
-    			    if ($error != '') return $error;
774
-    			    else return self::check_version(true);
775
-    			} elseif ($result['value'] == '8') {
776
-    			    $error = self::update_from_8();
777
-    			    if ($error != '') return $error;
778
-    			    else return self::check_version(true);
779
-    			} elseif ($result['value'] == '9') {
780
-    			    $error = self::update_from_9();
781
-    			    if ($error != '') return $error;
782
-    			    else return self::check_version(true);
783
-    			} elseif ($result['value'] == '10') {
784
-    			    $error = self::update_from_10();
785
-    			    if ($error != '') return $error;
786
-    			    else return self::check_version(true);
787
-    			} elseif ($result['value'] == '11') {
788
-    			    $error = self::update_from_11();
789
-    			    if ($error != '') return $error;
790
-    			    else return self::check_version(true);
791
-    			} elseif ($result['value'] == '12') {
792
-    			    $error = self::update_from_12();
793
-    			    if ($error != '') return $error;
794
-    			    else return self::check_version(true);
795
-    			} elseif ($result['value'] == '13') {
796
-    			    $error = self::update_from_13();
797
-    			    if ($error != '') return $error;
798
-    			    else return self::check_version(true);
799
-    			} elseif ($result['value'] == '14') {
800
-    			    $error = self::update_from_14();
801
-    			    if ($error != '') return $error;
802
-    			    else return self::check_version(true);
803
-    			} elseif ($result['value'] == '15') {
804
-    			    $error = self::update_from_15();
805
-    			    if ($error != '') return $error;
806
-    			    else return self::check_version(true);
807
-    			} elseif ($result['value'] == '16') {
808
-    			    $error = self::update_from_16();
809
-    			    if ($error != '') return $error;
810
-    			    else return self::check_version(true);
811
-    			} elseif ($result['value'] == '17') {
812
-    			    $error = self::update_from_17();
813
-    			    if ($error != '') return $error;
814
-    			    else return self::check_version(true);
815
-    			} elseif ($result['value'] == '18') {
816
-    			    $error = self::update_from_18();
817
-    			    if ($error != '') return $error;
818
-    			    else return self::check_version(true);
819
-    			} elseif ($result['value'] == '19') {
820
-    			    $error = self::update_from_19();
821
-    			    if ($error != '') return $error;
822
-    			    else return self::check_version(true);
823
-    			} elseif ($result['value'] == '20') {
824
-    			    $error = self::update_from_20();
825
-    			    if ($error != '') return $error;
826
-    			    else return self::check_version(true);
827
-    			} elseif ($result['value'] == '21') {
828
-    			    $error = self::update_from_21();
829
-    			    if ($error != '') return $error;
830
-    			    else return self::check_version(true);
831
-    			} elseif ($result['value'] == '22') {
832
-    			    $error = self::update_from_22();
833
-    			    if ($error != '') return $error;
834
-    			    else return self::check_version(true);
835
-    			} else return '';
836
-    		    }
837
-    		    else return $result['value'];
748
+				}
749
+				$result = $sth->fetch(PDO::FETCH_ASSOC);
750
+				if ($update) {
751
+				if ($result['value'] == '2') {
752
+					$error = self::update_from_2();
753
+					if ($error != '') return $error;
754
+					else return self::check_version(true);
755
+				} elseif ($result['value'] == '3') {
756
+					$error = self::update_from_3();
757
+					if ($error != '') return $error;
758
+					else return self::check_version(true);
759
+				} elseif ($result['value'] == '4') {
760
+					$error = self::update_from_4();
761
+					if ($error != '') return $error;
762
+					else return self::check_version(true);
763
+				} elseif ($result['value'] == '5') {
764
+					$error = self::update_from_5();
765
+					if ($error != '') return $error;
766
+					else return self::check_version(true);
767
+				} elseif ($result['value'] == '6') {
768
+					$error = self::update_from_6();
769
+					if ($error != '') return $error;
770
+					else return self::check_version(true);
771
+				} elseif ($result['value'] == '7') {
772
+					$error = self::update_from_7();
773
+					if ($error != '') return $error;
774
+					else return self::check_version(true);
775
+				} elseif ($result['value'] == '8') {
776
+					$error = self::update_from_8();
777
+					if ($error != '') return $error;
778
+					else return self::check_version(true);
779
+				} elseif ($result['value'] == '9') {
780
+					$error = self::update_from_9();
781
+					if ($error != '') return $error;
782
+					else return self::check_version(true);
783
+				} elseif ($result['value'] == '10') {
784
+					$error = self::update_from_10();
785
+					if ($error != '') return $error;
786
+					else return self::check_version(true);
787
+				} elseif ($result['value'] == '11') {
788
+					$error = self::update_from_11();
789
+					if ($error != '') return $error;
790
+					else return self::check_version(true);
791
+				} elseif ($result['value'] == '12') {
792
+					$error = self::update_from_12();
793
+					if ($error != '') return $error;
794
+					else return self::check_version(true);
795
+				} elseif ($result['value'] == '13') {
796
+					$error = self::update_from_13();
797
+					if ($error != '') return $error;
798
+					else return self::check_version(true);
799
+				} elseif ($result['value'] == '14') {
800
+					$error = self::update_from_14();
801
+					if ($error != '') return $error;
802
+					else return self::check_version(true);
803
+				} elseif ($result['value'] == '15') {
804
+					$error = self::update_from_15();
805
+					if ($error != '') return $error;
806
+					else return self::check_version(true);
807
+				} elseif ($result['value'] == '16') {
808
+					$error = self::update_from_16();
809
+					if ($error != '') return $error;
810
+					else return self::check_version(true);
811
+				} elseif ($result['value'] == '17') {
812
+					$error = self::update_from_17();
813
+					if ($error != '') return $error;
814
+					else return self::check_version(true);
815
+				} elseif ($result['value'] == '18') {
816
+					$error = self::update_from_18();
817
+					if ($error != '') return $error;
818
+					else return self::check_version(true);
819
+				} elseif ($result['value'] == '19') {
820
+					$error = self::update_from_19();
821
+					if ($error != '') return $error;
822
+					else return self::check_version(true);
823
+				} elseif ($result['value'] == '20') {
824
+					$error = self::update_from_20();
825
+					if ($error != '') return $error;
826
+					else return self::check_version(true);
827
+				} elseif ($result['value'] == '21') {
828
+					$error = self::update_from_21();
829
+					if ($error != '') return $error;
830
+					else return self::check_version(true);
831
+				} elseif ($result['value'] == '22') {
832
+					$error = self::update_from_22();
833
+					if ($error != '') return $error;
834
+					else return self::check_version(true);
835
+				} else return '';
836
+				}
837
+				else return $result['value'];
838 838
 		}
839 839
 		
840
-	    } else return $version;
841
-    	}
840
+		} else return $version;
841
+		}
842 842
     	
843 843
 }
844 844
 //echo update_schema::check_version();
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -14,11 +14,11 @@  discard block
 block discarded – undo
14 14
             try {
15 15
             	$sth = $Connection->db->prepare($query);
16 16
 		$sth->execute();
17
-    	    } catch(PDOException $e) {
17
+    	    } catch (PDOException $e) {
18 18
 		return "error : ".$e->getMessage()."\n";
19 19
     	    }
20 20
     	    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
21
-    		$Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']);
21
+    		$Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']);
22 22
     	    }
23 23
 	
24 24
 	}
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
         	try {
51 51
             	    $sth = $Connection->db->prepare($query);
52 52
 		    $sth->execute();
53
-    		} catch(PDOException $e) {
53
+    		} catch (PDOException $e) {
54 54
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
55 55
     		}
56 56
     		// Copy schedules data to routes table
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
         	try {
61 61
             	    $sth = $Connection->db->prepare($query);
62 62
 		    $sth->execute();
63
-    		} catch(PDOException $e) {
63
+    		} catch (PDOException $e) {
64 64
 		    return "error (delete schedule table) : ".$e->getMessage()."\n";
65 65
     		}
66 66
     		// Add source column
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     		try {
69 69
             	    $sth = $Connection->db->prepare($query);
70 70
 		    $sth->execute();
71
-    		} catch(PDOException $e) {
71
+    		} catch (PDOException $e) {
72 72
 		    return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n";
73 73
     		}
74 74
 		// Delete unused column
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     		try {
77 77
             	    $sth = $Connection->db->prepare($query);
78 78
 		    $sth->execute();
79
-    		} catch(PDOException $e) {
79
+    		} catch (PDOException $e) {
80 80
 		    return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n";
81 81
     		}
82 82
 		// Add ModeS column
@@ -84,14 +84,14 @@  discard block
 block discarded – undo
84 84
     		try {
85 85
             	    $sth = $Connection->db->prepare($query);
86 86
 		    $sth->execute();
87
-    		} catch(PDOException $e) {
87
+    		} catch (PDOException $e) {
88 88
 		    return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n";
89 89
     		}
90 90
 		$query = "ALTER TABLE `spotter_live`  ADD `ModeS` VARCHAR(255)";
91 91
     		try {
92 92
             	    $sth = $Connection->db->prepare($query);
93 93
 		    $sth->execute();
94
-    		} catch(PDOException $e) {
94
+    		} catch (PDOException $e) {
95 95
 		    return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n";
96 96
     		}
97 97
     		// Add auto_increment for aircraft_modes
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
     		try {
100 100
             	    $sth = $Connection->db->prepare($query);
101 101
 		    $sth->execute();
102
-    		} catch(PDOException $e) {
102
+    		} catch (PDOException $e) {
103 103
 		    return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n";
104 104
     		}
105 105
     		$error = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         	try {
111 111
             	    $sth = $Connection->db->prepare($query);
112 112
 		    $sth->execute();
113
-    		} catch(PDOException $e) {
113
+    		} catch (PDOException $e) {
114 114
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
115 115
     		}
116 116
 		return $error;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
         	try {
124 124
             	    $sth = $Connection->db->prepare($query);
125 125
 		    $sth->execute();
126
-    		} catch(PDOException $e) {
126
+    		} catch (PDOException $e) {
127 127
 		    return "error (add new columns to routes table) : ".$e->getMessage()."\n";
128 128
     		}
129 129
     		$error = '';
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
         	try {
135 135
             	    $sth = $Connection->db->prepare($query);
136 136
 		    $sth->execute();
137
-    		} catch(PDOException $e) {
137
+    		} catch (PDOException $e) {
138 138
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
139 139
     		}
140 140
 		return $error;
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
         	try {
148 148
             	    $sth = $Connection->db->prepare($query);
149 149
 		    $sth->execute();
150
-    		} catch(PDOException $e) {
150
+    		} catch (PDOException $e) {
151 151
 		    return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n";
152 152
     		}
153 153
     		// Add image_source_website column to spotter_image
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
         	try {
156 156
             	    $sth = $Connection->db->prepare($query);
157 157
 		    $sth->execute();
158
-    		} catch(PDOException $e) {
158
+    		} catch (PDOException $e) {
159 159
 		    return "error (add new columns to spotter_image) : ".$e->getMessage()."\n";
160 160
     		}
161 161
     		$error = '';
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         	try {
165 165
             	    $sth = $Connection->db->prepare($query);
166 166
 		    $sth->execute();
167
-    		} catch(PDOException $e) {
167
+    		} catch (PDOException $e) {
168 168
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
169 169
     		}
170 170
 		return $error;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         	    try {
183 183
             		$sth = $Connection->db->prepare($query);
184 184
 			$sth->execute();
185
-    		    } catch(PDOException $e) {
185
+    		    } catch (PDOException $e) {
186 186
 			return "error (update schema_version) : ".$e->getMessage()."\n";
187 187
     		    }
188 188
     		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
         	try {
197 197
             	    $sth = $Connection->db->prepare($query);
198 198
 		    $sth->execute();
199
-    		} catch(PDOException $e) {
199
+    		} catch (PDOException $e) {
200 200
 		    return "error (add new columns to translation) : ".$e->getMessage()."\n";
201 201
     		}
202 202
     		// Add aircraft_shadow column to aircraft
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
         	try {
205 205
             	    $sth = $Connection->db->prepare($query);
206 206
 		    $sth->execute();
207
-    		} catch(PDOException $e) {
207
+    		} catch (PDOException $e) {
208 208
 		    return "error (add new column to aircraft) : ".$e->getMessage()."\n";
209 209
     		}
210 210
     		// Add aircraft_shadow column to spotter_live
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
         	try {
213 213
             	    $sth = $Connection->db->prepare($query);
214 214
 		    $sth->execute();
215
-    		} catch(PDOException $e) {
215
+    		} catch (PDOException $e) {
216 216
 		    return "error (add new column to spotter_live) : ".$e->getMessage()."\n";
217 217
     		}
218 218
     		$error = '';
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
         	try {
226 226
             	    $sth = $Connection->db->prepare($query);
227 227
 		    $sth->execute();
228
-    		} catch(PDOException $e) {
228
+    		} catch (PDOException $e) {
229 229
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
230 230
     		}
231 231
 		return $error;
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
 	private static function update_from_6() {
235 235
     		$Connection = new Connection();
236
-    		if (!$Connection−>indexExists('spotter_output','flightaware_id')) {
236
+    		if (!$Connection− > indexExists('spotter_output', 'flightaware_id')) {
237 237
     		    $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id);
238 238
 			ALTER TABLE spotter_output ADD INDEX(date);
239 239
 			ALTER TABLE spotter_output ADD INDEX(ident);
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
         	    try {
251 251
             		$sth = $Connection->db->prepare($query);
252 252
 			$sth->execute();
253
-    		    } catch(PDOException $e) {
253
+    		    } catch (PDOException $e) {
254 254
 			return "error (add some indexes) : ".$e->getMessage()."\n";
255 255
     		    }
256 256
     		}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
         	try {
266 266
             	    $sth = $Connection->db->prepare($query);
267 267
 		    $sth->execute();
268
-    		} catch(PDOException $e) {
268
+    		} catch (PDOException $e) {
269 269
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
270 270
     		}
271 271
 		return $error;
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
 	private static function update_from_7() {
275 275
 		global $globalDBname, $globalDBdriver;
276 276
     		$Connection = new Connection();
277
-    		$query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
277
+    		$query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;
278 278
     			ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;";
279 279
         	try {
280 280
             	    $sth = $Connection->db->prepare($query);
281 281
 		    $sth->execute();
282
-    		} catch(PDOException $e) {
282
+    		} catch (PDOException $e) {
283 283
 		    return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
284 284
     		}
285 285
     		if ($globalDBdriver == 'mysql') {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		    try {
288 288
             		$sth = $Connection->db->prepare($query);
289 289
 			$sth->execute();
290
-    		    } catch(PDOException $e) {
290
+    		    } catch (PDOException $e) {
291 291
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
292 292
     		    }
293 293
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -299,15 +299,15 @@  discard block
 block discarded – undo
299 299
 				DROP TABLE spotter_archive;
300 300
 				RENAME TABLE copy TO spotter_archive;";
301 301
             	    } else {
302
-    			$query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
302
+    			$query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
303 303
             	    }
304 304
                 } else {
305
-    		    $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
305
+    		    $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL";
306 306
                 }
307 307
         	try {
308 308
             	    $sth = $Connection->db->prepare($query);
309 309
 		    $sth->execute();
310
-    		} catch(PDOException $e) {
310
+    		} catch (PDOException $e) {
311 311
 		    return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n";
312 312
     		}
313 313
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
         	try {
321 321
             	    $sth = $Connection->db->prepare($query);
322 322
 		    $sth->execute();
323
-    		} catch(PDOException $e) {
323
+    		} catch (PDOException $e) {
324 324
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
325 325
     		}
326 326
 		return $error;
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
         	try {
340 340
             	    $sth = $Connection->db->prepare($query);
341 341
 		    $sth->execute();
342
-    		} catch(PDOException $e) {
342
+    		} catch (PDOException $e) {
343 343
 		    return "error (insert last_update values) : ".$e->getMessage()."\n";
344 344
     		}
345 345
 		$query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'";
346 346
         	try {
347 347
             	    $sth = $Connection->db->prepare($query);
348 348
 		    $sth->execute();
349
-    		} catch(PDOException $e) {
349
+    		} catch (PDOException $e) {
350 350
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
351 351
     		}
352 352
 		return $error;
@@ -354,12 +354,12 @@  discard block
 block discarded – undo
354 354
 
355 355
 	private static function update_from_9() {
356 356
     		$Connection = new Connection();
357
-    		$query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
357
+    		$query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL;
358 358
     			ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;";
359 359
         	try {
360 360
             	    $sth = $Connection->db->prepare($query);
361 361
 		    $sth->execute();
362
-    		} catch(PDOException $e) {
362
+    		} catch (PDOException $e) {
363 363
 		    return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n";
364 364
     		}
365 365
 		$error = '';
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
         	try {
372 372
             	    $sth = $Connection->db->prepare($query);
373 373
 		    $sth->execute();
374
-    		} catch(PDOException $e) {
374
+    		} catch (PDOException $e) {
375 375
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
376 376
     		}
377 377
 		return $error;
@@ -379,11 +379,11 @@  discard block
 block discarded – undo
379 379
 
380 380
 	private static function update_from_10() {
381 381
     		$Connection = new Connection();
382
-    		$query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
382
+    		$query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL";
383 383
         	try {
384 384
             	    $sth = $Connection->db->prepare($query);
385 385
 		    $sth->execute();
386
-    		} catch(PDOException $e) {
386
+    		} catch (PDOException $e) {
387 387
 		    return "error (add new enum to ATC table) : ".$e->getMessage()."\n";
388 388
     		}
389 389
 		$error = '';
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
         	try {
402 402
             	    $sth = $Connection->db->prepare($query);
403 403
 		    $sth->execute();
404
-    		} catch(PDOException $e) {
404
+    		} catch (PDOException $e) {
405 405
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
406 406
     		}
407 407
 		return $error;
@@ -409,18 +409,18 @@  discard block
 block discarded – undo
409 409
 
410 410
 	private static function update_from_11() {
411 411
     		$Connection = new Connection();
412
-    		$query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
412
+    		$query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)";
413 413
         	try {
414 414
             	    $sth = $Connection->db->prepare($query);
415 415
 		    $sth->execute();
416
-    		} catch(PDOException $e) {
416
+    		} catch (PDOException $e) {
417 417
 		    return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n";
418 418
     		}
419
-    		$query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
419
+    		$query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
420 420
         	try {
421 421
             	    $sth = $Connection->db->prepare($query);
422 422
 		    $sth->execute();
423
-    		} catch(PDOException $e) {
423
+    		} catch (PDOException $e) {
424 424
 		    return "error (format_source column to spotter_live) : ".$e->getMessage()."\n";
425 425
     		}
426 426
     		if ($globalDBdriver == 'mysql') {
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 		    try {
429 429
             		$sth = $Connection->db->prepare($query);
430 430
 			$sth->execute();
431
-    		    } catch(PDOException $e) {
431
+    		    } catch (PDOException $e) {
432 432
 			return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n";
433 433
     		    }
434 434
     		    $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -440,15 +440,15 @@  discard block
 block discarded – undo
440 440
 				DROP TABLE spotter_archive;
441 441
 				RENAME TABLE copy TO spotter_archive;";
442 442
             	    } else {
443
-    			$query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
443
+    			$query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
444 444
             	    }
445 445
                 } else {
446
-    		    $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
446
+    		    $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE";
447 447
                 }
448 448
         	try {
449 449
             	    $sth = $Connection->db->prepare($query);
450 450
 		    $sth->execute();
451
-    		} catch(PDOException $e) {
451
+    		} catch (PDOException $e) {
452 452
 		    return "error (add columns to spotter_archive) : ".$e->getMessage()."\n";
453 453
     		}
454 454
 
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
         	try {
459 459
             	    $sth = $Connection->db->prepare($query);
460 460
 		    $sth->execute();
461
-    		} catch(PDOException $e) {
461
+    		} catch (PDOException $e) {
462 462
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
463 463
     		}
464 464
 		return $error;
@@ -486,7 +486,7 @@  discard block
 block discarded – undo
486 486
         	try {
487 487
             	    $sth = $Connection->db->prepare($query);
488 488
 		    $sth->execute();
489
-    		} catch(PDOException $e) {
489
+    		} catch (PDOException $e) {
490 490
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
491 491
     		}
492 492
 		return $error;
@@ -494,11 +494,11 @@  discard block
 block discarded – undo
494 494
 
495 495
 	private static function update_from_13() {
496 496
     		$Connection = new Connection();
497
-    		$query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
497
+    		$query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)";
498 498
         	try {
499 499
             	    $sth = $Connection->db->prepare($query);
500 500
 		    $sth->execute();
501
-    		} catch(PDOException $e) {
501
+    		} catch (PDOException $e) {
502 502
 		    return "error (update spotter_archive_output) : ".$e->getMessage()."\n";
503 503
     		}
504 504
 	
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
         	try {
508 508
             	    $sth = $Connection->db->prepare($query);
509 509
 		    $sth->execute();
510
-    		} catch(PDOException $e) {
510
+    		} catch (PDOException $e) {
511 511
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
512 512
     		}
513 513
 		return $error;
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
         	try {
524 524
             	    $sth = $Connection->db->prepare($query);
525 525
 		    $sth->execute();
526
-    		} catch(PDOException $e) {
526
+    		} catch (PDOException $e) {
527 527
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
528 528
     		}
529 529
 		return $error;
@@ -534,11 +534,11 @@  discard block
 block discarded – undo
534 534
     		$Connection = new Connection();
535 535
 		$error = '';
536 536
     		// Add tables
537
-    		$query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
537
+    		$query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP";
538 538
         	try {
539 539
             	    $sth = $Connection->db->prepare($query);
540 540
 		    $sth->execute();
541
-    		} catch(PDOException $e) {
541
+    		} catch (PDOException $e) {
542 542
 		    return "error (update stats) : ".$e->getMessage()."\n";
543 543
     		}
544 544
 		if ($error != '') return $error;
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
         	try {
547 547
             	    $sth = $Connection->db->prepare($query);
548 548
 		    $sth->execute();
549
-    		} catch(PDOException $e) {
549
+    		} catch (PDOException $e) {
550 550
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
551 551
     		}
552 552
 		return $error;
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
         	try {
564 564
             	    $sth = $Connection->db->prepare($query);
565 565
 		    $sth->execute();
566
-    		} catch(PDOException $e) {
566
+    		} catch (PDOException $e) {
567 567
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
568 568
     		}
569 569
 		return $error;
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
         	try {
580 580
             	    $sth = $Connection->db->prepare($query);
581 581
 		    $sth->execute();
582
-    		} catch(PDOException $e) {
582
+    		} catch (PDOException $e) {
583 583
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
584 584
     		}
585 585
 		return $error;
@@ -592,7 +592,7 @@  discard block
 block discarded – undo
592 592
         	try {
593 593
             	    $sth = $Connection->db->prepare($query);
594 594
 		    $sth->execute();
595
-    		} catch(PDOException $e) {
595
+    		} catch (PDOException $e) {
596 596
 		    return "error (update stats) : ".$e->getMessage()."\n";
597 597
     		}
598 598
 		if ($error != '') return $error;
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         	try {
601 601
             	    $sth = $Connection->db->prepare($query);
602 602
 		    $sth->execute();
603
-    		} catch(PDOException $e) {
603
+    		} catch (PDOException $e) {
604 604
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
605 605
     		}
606 606
 		return $error;
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
         	try {
618 618
             	    $sth = $Connection->db->prepare($query);
619 619
 		    $sth->execute();
620
-    		} catch(PDOException $e) {
620
+    		} catch (PDOException $e) {
621 621
 		    return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n";
622 622
     		}
623 623
 
@@ -626,7 +626,7 @@  discard block
 block discarded – undo
626 626
         	try {
627 627
             	    $sth = $Connection->db->prepare($query);
628 628
 		    $sth->execute();
629
-    		} catch(PDOException $e) {
629
+    		} catch (PDOException $e) {
630 630
 		    return "error (add over_country) : ".$e->getMessage()."\n";
631 631
     		}
632 632
     		// Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
         	try {
635 635
             	    $sth = $Connection->db->prepare($query);
636 636
 		    $sth->execute();
637
-    		} catch(PDOException $e) {
637
+    		} catch (PDOException $e) {
638 638
 		    return "error (add source_name column) : ".$e->getMessage()."\n";
639 639
     		}
640 640
 		if ($error != '') return $error;
@@ -642,7 +642,7 @@  discard block
 block discarded – undo
642 642
         	try {
643 643
             	    $sth = $Connection->db->prepare($query);
644 644
 		    $sth->execute();
645
-    		} catch(PDOException $e) {
645
+    		} catch (PDOException $e) {
646 646
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
647 647
     		}
648 648
 		return $error;
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
         	try {
663 663
             	    $sth = $Connection->db->prepare($query);
664 664
 		    $sth->execute();
665
-    		} catch(PDOException $e) {
665
+    		} catch (PDOException $e) {
666 666
 		    return "error (add over_country) : ".$e->getMessage()."\n";
667 667
     		}
668 668
 		if ($error != '') return $error;
@@ -677,7 +677,7 @@  discard block
 block discarded – undo
677 677
         	try {
678 678
             	    $sth = $Connection->db->prepare($query);
679 679
 		    $sth->execute();
680
-    		} catch(PDOException $e) {
680
+    		} catch (PDOException $e) {
681 681
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
682 682
     		}
683 683
 		return $error;
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
         	try {
692 692
             	    $sth = $Connection->db->prepare($query);
693 693
 		    $sth->execute();
694
-    		} catch(PDOException $e) {
694
+    		} catch (PDOException $e) {
695 695
 		    return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
696 696
     		}
697 697
 		if ($error != '') return $error;
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
         	try {
700 700
             	    $sth = $Connection->db->prepare($query);
701 701
 		    $sth->execute();
702
-    		} catch(PDOException $e) {
702
+    		} catch (PDOException $e) {
703 703
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
704 704
     		}
705 705
 		return $error;
@@ -720,7 +720,7 @@  discard block
 block discarded – undo
720 720
         	try {
721 721
             	    $sth = $Connection->db->prepare($query);
722 722
 		    $sth->execute();
723
-    		} catch(PDOException $e) {
723
+    		} catch (PDOException $e) {
724 724
 		    return "error (update schema_version) : ".$e->getMessage()."\n";
725 725
     		}
726 726
 		return $error;
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 		    try {
744 744
             		$sth = $Connection->db->prepare($query);
745 745
 		        $sth->execute();
746
-		    } catch(PDOException $e) {
746
+		    } catch (PDOException $e) {
747 747
 			return "error : ".$e->getMessage()."\n";
748 748
     		    }
749 749
     		    $result = $sth->fetch(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
Braces   +196 added lines, -73 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 {
@@ -468,19 +484,33 @@  discard block
 block discarded – undo
468 484
 		$error = '';
469 485
     		// Add tables
470 486
 		$error .= create_db::import_file('../db/stats.sql');
471
-		if ($error != '') return $error;
487
+		if ($error != '') {
488
+			return $error;
489
+		}
472 490
 		$error .= create_db::import_file('../db/stats_aircraft.sql');
473
-		if ($error != '') return $error;
491
+		if ($error != '') {
492
+			return $error;
493
+		}
474 494
 		$error .= create_db::import_file('../db/stats_airline.sql');
475
-		if ($error != '') return $error;
495
+		if ($error != '') {
496
+			return $error;
497
+		}
476 498
 		$error .= create_db::import_file('../db/stats_airport.sql');
477
-		if ($error != '') return $error;
499
+		if ($error != '') {
500
+			return $error;
501
+		}
478 502
 		$error .= create_db::import_file('../db/stats_owner.sql');
479
-		if ($error != '') return $error;
503
+		if ($error != '') {
504
+			return $error;
505
+		}
480 506
 		$error .= create_db::import_file('../db/stats_pilot.sql');
481
-		if ($error != '') return $error;
507
+		if ($error != '') {
508
+			return $error;
509
+		}
482 510
 		$error .= create_db::import_file('../db/spotter_archive_output.sql');
483
-		if ($error != '') return $error;
511
+		if ($error != '') {
512
+			return $error;
513
+		}
484 514
 		
485 515
 		$query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'";
486 516
         	try {
@@ -518,7 +548,9 @@  discard block
 block discarded – undo
518 548
 		$error = '';
519 549
     		// Add tables
520 550
 		$error .= create_db::import_file('../db/stats_flight.sql');
521
-		if ($error != '') return $error;
551
+		if ($error != '') {
552
+			return $error;
553
+		}
522 554
 		$query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'";
523 555
         	try {
524 556
             	    $sth = $Connection->db->prepare($query);
@@ -541,7 +573,9 @@  discard block
 block discarded – undo
541 573
     		} catch(PDOException $e) {
542 574
 		    return "error (update stats) : ".$e->getMessage()."\n";
543 575
     		}
544
-		if ($error != '') return $error;
576
+		if ($error != '') {
577
+			return $error;
578
+		}
545 579
 		$query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'";
546 580
         	try {
547 581
             	    $sth = $Connection->db->prepare($query);
@@ -558,7 +592,9 @@  discard block
 block discarded – undo
558 592
     		// Add tables
559 593
 		$error .= create_db::import_file('../db/stats_registration.sql');
560 594
 		$error .= create_db::import_file('../db/stats_callsign.sql');
561
-		if ($error != '') return $error;
595
+		if ($error != '') {
596
+			return $error;
597
+		}
562 598
 		$query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'";
563 599
         	try {
564 600
             	    $sth = $Connection->db->prepare($query);
@@ -574,7 +610,9 @@  discard block
 block discarded – undo
574 610
 		$error = '';
575 611
     		// Add tables
576 612
 		$error .= create_db::import_file('../db/stats_country.sql');
577
-		if ($error != '') return $error;
613
+		if ($error != '') {
614
+			return $error;
615
+		}
578 616
 		$query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'";
579 617
         	try {
580 618
             	    $sth = $Connection->db->prepare($query);
@@ -595,7 +633,9 @@  discard block
 block discarded – undo
595 633
     		} catch(PDOException $e) {
596 634
 		    return "error (update stats) : ".$e->getMessage()."\n";
597 635
     		}
598
-		if ($error != '') return $error;
636
+		if ($error != '') {
637
+			return $error;
638
+		}
599 639
 		$query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'";
600 640
         	try {
601 641
             	    $sth = $Connection->db->prepare($query);
@@ -611,7 +651,9 @@  discard block
 block discarded – undo
611 651
 		$error = '';
612 652
     		// Update airport table
613 653
 		$error .= create_db::import_file('../db/airport.sql');
614
-		if ($error != '') return 'Import airport.sql : '.$error;
654
+		if ($error != '') {
655
+			return 'Import airport.sql : '.$error;
656
+		}
615 657
 		// Remove primary key on Spotter_Archive
616 658
 		$query = "alter table spotter_archive drop column spotter_archive_id, add spotter_archive_id INT(11)";
617 659
         	try {
@@ -637,7 +679,9 @@  discard block
 block discarded – undo
637 679
     		} catch(PDOException $e) {
638 680
 		    return "error (add source_name column) : ".$e->getMessage()."\n";
639 681
     		}
640
-		if ($error != '') return $error;
682
+		if ($error != '') {
683
+			return $error;
684
+		}
641 685
 		$query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'";
642 686
         	try {
643 687
             	    $sth = $Connection->db->prepare($query);
@@ -655,7 +699,9 @@  discard block
 block discarded – undo
655 699
     		// Update airline table
656 700
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
657 701
 			$error .= create_db::import_file('../db/airlines.sql');
658
-			if ($error != '') return 'Import airlinesport.sql : '.$error;
702
+			if ($error != '') {
703
+				return 'Import airlinesport.sql : '.$error;
704
+			}
659 705
 		}
660 706
     		// Add column over_country
661 707
     		$query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;";
@@ -665,7 +711,9 @@  discard block
 block discarded – undo
665 711
     		} catch(PDOException $e) {
666 712
 		    return "error (add over_country) : ".$e->getMessage()."\n";
667 713
     		}
668
-		if ($error != '') return $error;
714
+		if ($error != '') {
715
+			return $error;
716
+		}
669 717
 		/*
670 718
     		if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
671 719
 			// Force update ModeS (this will put type_flight data
@@ -694,7 +742,9 @@  discard block
 block discarded – undo
694 742
     		} catch(PDOException $e) {
695 743
 		    return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n";
696 744
     		}
697
-		if ($error != '') return $error;
745
+		if ($error != '') {
746
+			return $error;
747
+		}
698 748
 		$query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'";
699 749
         	try {
700 750
             	    $sth = $Connection->db->prepare($query);
@@ -715,7 +765,9 @@  discard block
 block discarded – undo
715 765
 		} else {
716 766
 			$error .= create_db::import_file('../db/pgsql/stats_source.sql');
717 767
 		}
718
-		if ($error != '') return $error;
768
+		if ($error != '') {
769
+			return $error;
770
+		}
719 771
 		$query = "UPDATE config SET value = '23' WHERE name = 'schema_version'";
720 772
         	try {
721 773
             	    $sth = $Connection->db->prepare($query);
@@ -735,8 +787,11 @@  discard block
 block discarded – undo
735 787
     	    if ($Connection->tableExists('aircraft')) {
736 788
     		if (!$Connection->tableExists('config')) {
737 789
     		    $version = '1';
738
-    		    if ($update) return self::update_from_1();
739
-    		    else return $version;
790
+    		    if ($update) {
791
+    		    	return self::update_from_1();
792
+    		    } else {
793
+    		    	return $version;
794
+    		    }
740 795
 		} else {
741 796
     		    $Connection = new Connection();
742 797
 		    $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
@@ -750,94 +805,162 @@  discard block
 block discarded – undo
750 805
     		    if ($update) {
751 806
     			if ($result['value'] == '2') {
752 807
     			    $error = self::update_from_2();
753
-    			    if ($error != '') return $error;
754
-    			    else return self::check_version(true);
808
+    			    if ($error != '') {
809
+    			    	return $error;
810
+    			    } else {
811
+    			    	return self::check_version(true);
812
+    			    }
755 813
     			} elseif ($result['value'] == '3') {
756 814
     			    $error = self::update_from_3();
757
-    			    if ($error != '') return $error;
758
-    			    else return self::check_version(true);
815
+    			    if ($error != '') {
816
+    			    	return $error;
817
+    			    } else {
818
+    			    	return self::check_version(true);
819
+    			    }
759 820
     			} elseif ($result['value'] == '4') {
760 821
     			    $error = self::update_from_4();
761
-    			    if ($error != '') return $error;
762
-    			    else return self::check_version(true);
822
+    			    if ($error != '') {
823
+    			    	return $error;
824
+    			    } else {
825
+    			    	return self::check_version(true);
826
+    			    }
763 827
     			} elseif ($result['value'] == '5') {
764 828
     			    $error = self::update_from_5();
765
-    			    if ($error != '') return $error;
766
-    			    else return self::check_version(true);
829
+    			    if ($error != '') {
830
+    			    	return $error;
831
+    			    } else {
832
+    			    	return self::check_version(true);
833
+    			    }
767 834
     			} elseif ($result['value'] == '6') {
768 835
     			    $error = self::update_from_6();
769
-    			    if ($error != '') return $error;
770
-    			    else return self::check_version(true);
836
+    			    if ($error != '') {
837
+    			    	return $error;
838
+    			    } else {
839
+    			    	return self::check_version(true);
840
+    			    }
771 841
     			} elseif ($result['value'] == '7') {
772 842
     			    $error = self::update_from_7();
773
-    			    if ($error != '') return $error;
774
-    			    else return self::check_version(true);
843
+    			    if ($error != '') {
844
+    			    	return $error;
845
+    			    } else {
846
+    			    	return self::check_version(true);
847
+    			    }
775 848
     			} elseif ($result['value'] == '8') {
776 849
     			    $error = self::update_from_8();
777
-    			    if ($error != '') return $error;
778
-    			    else return self::check_version(true);
850
+    			    if ($error != '') {
851
+    			    	return $error;
852
+    			    } else {
853
+    			    	return self::check_version(true);
854
+    			    }
779 855
     			} elseif ($result['value'] == '9') {
780 856
     			    $error = self::update_from_9();
781
-    			    if ($error != '') return $error;
782
-    			    else return self::check_version(true);
857
+    			    if ($error != '') {
858
+    			    	return $error;
859
+    			    } else {
860
+    			    	return self::check_version(true);
861
+    			    }
783 862
     			} elseif ($result['value'] == '10') {
784 863
     			    $error = self::update_from_10();
785
-    			    if ($error != '') return $error;
786
-    			    else return self::check_version(true);
864
+    			    if ($error != '') {
865
+    			    	return $error;
866
+    			    } else {
867
+    			    	return self::check_version(true);
868
+    			    }
787 869
     			} elseif ($result['value'] == '11') {
788 870
     			    $error = self::update_from_11();
789
-    			    if ($error != '') return $error;
790
-    			    else return self::check_version(true);
871
+    			    if ($error != '') {
872
+    			    	return $error;
873
+    			    } else {
874
+    			    	return self::check_version(true);
875
+    			    }
791 876
     			} elseif ($result['value'] == '12') {
792 877
     			    $error = self::update_from_12();
793
-    			    if ($error != '') return $error;
794
-    			    else return self::check_version(true);
878
+    			    if ($error != '') {
879
+    			    	return $error;
880
+    			    } else {
881
+    			    	return self::check_version(true);
882
+    			    }
795 883
     			} elseif ($result['value'] == '13') {
796 884
     			    $error = self::update_from_13();
797
-    			    if ($error != '') return $error;
798
-    			    else return self::check_version(true);
885
+    			    if ($error != '') {
886
+    			    	return $error;
887
+    			    } else {
888
+    			    	return self::check_version(true);
889
+    			    }
799 890
     			} elseif ($result['value'] == '14') {
800 891
     			    $error = self::update_from_14();
801
-    			    if ($error != '') return $error;
802
-    			    else return self::check_version(true);
892
+    			    if ($error != '') {
893
+    			    	return $error;
894
+    			    } else {
895
+    			    	return self::check_version(true);
896
+    			    }
803 897
     			} elseif ($result['value'] == '15') {
804 898
     			    $error = self::update_from_15();
805
-    			    if ($error != '') return $error;
806
-    			    else return self::check_version(true);
899
+    			    if ($error != '') {
900
+    			    	return $error;
901
+    			    } else {
902
+    			    	return self::check_version(true);
903
+    			    }
807 904
     			} elseif ($result['value'] == '16') {
808 905
     			    $error = self::update_from_16();
809
-    			    if ($error != '') return $error;
810
-    			    else return self::check_version(true);
906
+    			    if ($error != '') {
907
+    			    	return $error;
908
+    			    } else {
909
+    			    	return self::check_version(true);
910
+    			    }
811 911
     			} elseif ($result['value'] == '17') {
812 912
     			    $error = self::update_from_17();
813
-    			    if ($error != '') return $error;
814
-    			    else return self::check_version(true);
913
+    			    if ($error != '') {
914
+    			    	return $error;
915
+    			    } else {
916
+    			    	return self::check_version(true);
917
+    			    }
815 918
     			} elseif ($result['value'] == '18') {
816 919
     			    $error = self::update_from_18();
817
-    			    if ($error != '') return $error;
818
-    			    else return self::check_version(true);
920
+    			    if ($error != '') {
921
+    			    	return $error;
922
+    			    } else {
923
+    			    	return self::check_version(true);
924
+    			    }
819 925
     			} elseif ($result['value'] == '19') {
820 926
     			    $error = self::update_from_19();
821
-    			    if ($error != '') return $error;
822
-    			    else return self::check_version(true);
927
+    			    if ($error != '') {
928
+    			    	return $error;
929
+    			    } else {
930
+    			    	return self::check_version(true);
931
+    			    }
823 932
     			} elseif ($result['value'] == '20') {
824 933
     			    $error = self::update_from_20();
825
-    			    if ($error != '') return $error;
826
-    			    else return self::check_version(true);
934
+    			    if ($error != '') {
935
+    			    	return $error;
936
+    			    } else {
937
+    			    	return self::check_version(true);
938
+    			    }
827 939
     			} elseif ($result['value'] == '21') {
828 940
     			    $error = self::update_from_21();
829
-    			    if ($error != '') return $error;
830
-    			    else return self::check_version(true);
941
+    			    if ($error != '') {
942
+    			    	return $error;
943
+    			    } else {
944
+    			    	return self::check_version(true);
945
+    			    }
831 946
     			} elseif ($result['value'] == '22') {
832 947
     			    $error = self::update_from_22();
833
-    			    if ($error != '') return $error;
834
-    			    else return self::check_version(true);
835
-    			} else return '';
948
+    			    if ($error != '') {
949
+    			    	return $error;
950
+    			    } else {
951
+    			    	return self::check_version(true);
952
+    			    }
953
+    			} else {
954
+    				return '';
955
+    			}
956
+    		    } else {
957
+    		    	return $result['value'];
836 958
     		    }
837
-    		    else return $result['value'];
838 959
 		}
839 960
 		
840
-	    } else return $version;
961
+	    } else {
962
+	    	return $version;
963
+	    }
841 964
     	}
842 965
     	
843 966
 }
Please login to merge, or discard this patch.
install/install_db.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,30 +1,30 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3
-    require_once('../require/settings.php');
4
-    if ($globalInstalled) {
5
-        echo '$globalInstalled must be set to FALSE in require/settings.php';
6
-        exit;
7
-    }
8
-    require('class.create_db.php');
9
-    echo "Create and import all tables...";
10
-    create_db::import_all_db('../db/');
11
-    echo "Done !\n";
3
+	require_once('../require/settings.php');
4
+	if ($globalInstalled) {
5
+		echo '$globalInstalled must be set to FALSE in require/settings.php';
6
+		exit;
7
+	}
8
+	require('class.create_db.php');
9
+	echo "Create and import all tables...";
10
+	create_db::import_all_db('../db/');
11
+	echo "Done !\n";
12 12
 
13
-    require('class.update_db.php');
14
-    echo "Populate all tables...\n";
15
-    update_db::update_all();
16
-    echo "\nInstall waypoints...(VERY slow!)";
17
-    update_db::update_waypoints();
18
-    echo "Done !\n";
19
-    echo "Install airspace...";
20
-    update_db::update_airspace();
21
-    echo "Done !\n";
22
-    echo 'All is now installed ! Thanks'."\n";
23
-    if ($globalSBS1) {
24
-            echo 'You need to run cron-sbs.php as a daemon. You can use init script in the install/init directory.'."\n";
25
-    }
26
-    if ($globalACARS) {
27
-            echo 'You need to run cron-acars.php as a daemon. You can use init script in the install/init directory.'."\n";
28
-    }
13
+	require('class.update_db.php');
14
+	echo "Populate all tables...\n";
15
+	update_db::update_all();
16
+	echo "\nInstall waypoints...(VERY slow!)";
17
+	update_db::update_waypoints();
18
+	echo "Done !\n";
19
+	echo "Install airspace...";
20
+	update_db::update_airspace();
21
+	echo "Done !\n";
22
+	echo 'All is now installed ! Thanks'."\n";
23
+	if ($globalSBS1) {
24
+			echo 'You need to run cron-sbs.php as a daemon. You can use init script in the install/init directory.'."\n";
25
+	}
26
+	if ($globalACARS) {
27
+			echo 'You need to run cron-acars.php as a daemon. You can use init script in the install/init directory.'."\n";
28
+	}
29 29
     
30 30
 ?>
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
install/populate_all.php 1 patch
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -1,37 +1,37 @@
 block discarded – undo
1 1
 #!/usr/bin/php
2 2
 <?php
3
-    require_once('../require/settings.php');
4
-    if ($globalInstalled) {
5
-        echo '$globalInstalled must be set to FALSE in require/settings.php';
6
-        exit;
7
-    }
8
-    require('class.update_db.php');
9
-    echo "Populate all tables...\n";
10
-    update_db::update_all();
11
-    echo "\nInstall waypoints...(VERY slow!)";
12
-    update_db::update_waypoints();
13
-    echo "Done !\n";
14
-    echo "Install airspace...";
15
-    update_db::update_airspace();
16
-    echo "Done !\n";
17
-    echo "Install countries...";
18
-    update_db::update_countries();
19
-    echo "Done !\n";
20
-    if (isset($globalOwner) && $globalOwner) {
3
+	require_once('../require/settings.php');
4
+	if ($globalInstalled) {
5
+		echo '$globalInstalled must be set to FALSE in require/settings.php';
6
+		exit;
7
+	}
8
+	require('class.update_db.php');
9
+	echo "Populate all tables...\n";
10
+	update_db::update_all();
11
+	echo "\nInstall waypoints...(VERY slow!)";
12
+	update_db::update_waypoints();
13
+	echo "Done !\n";
14
+	echo "Install airspace...";
15
+	update_db::update_airspace();
16
+	echo "Done !\n";
17
+	echo "Install countries...";
18
+	update_db::update_countries();
19
+	echo "Done !\n";
20
+	if (isset($globalOwner) && $globalOwner) {
21 21
 	echo "Install private owners...";
22 22
 	update_db::update_owner();
23
-        echo "Done !\n";
24
-    }
25
-    /*
23
+		echo "Done !\n";
24
+	}
25
+	/*
26 26
     if (isset($globalIVAO) && $globalIVAO) {
27 27
         echo "Install IVAO airlines and logos...";
28 28
         update_db::update_IVAO();
29 29
 	echo "Done !\n";
30 30
     }
31 31
     */
32
-    if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
32
+	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
33 33
 	echo "Install NOTAM from notaminfo.com...";
34
-        update_db:update_notam();
35
-        echo "Done !\n";
36
-    }
34
+		update_db:update_notam();
35
+		echo "Done !\n";
36
+	}
37 37
 ?>
38 38
\ No newline at end of file
Please login to merge, or discard this patch.