Completed
Push — master ( baa1fe...14925d )
by Yannick
164:26 queued 132:19
created
statistics-sub-menu.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 					$Spotter = new Spotter();
24 24
 					$alliances = $Spotter->getAllAllianceNames();
25 25
 					if (!empty($alliances)) {
26
-						foreach($alliances as $alliance) {
27
-							if (isset($airline_icao) && str_replace('_',' ',str_replace('alliance_','',$airline_icao)) == $alliance['alliance']) {
28
-								print '<option value="alliance_'.str_replace(' ','_',$alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>';
26
+						foreach ($alliances as $alliance) {
27
+							if (isset($airline_icao) && str_replace('_', ' ', str_replace('alliance_', '', $airline_icao)) == $alliance['alliance']) {
28
+								print '<option value="alliance_'.str_replace(' ', '_', $alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>';
29 29
 							} else {
30
-								print '<option value="alliance_'.str_replace(' ','_',$alliance['alliance']).'">'.$alliance['alliance'].'</option>';
30
+								print '<option value="alliance_'.str_replace(' ', '_', $alliance['alliance']).'">'.$alliance['alliance'].'</option>';
31 31
 							}
32 32
 						}
33 33
 						print '<option disabled>──────────</option>';
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 					$Stats = new Stats();
36 36
 					if (!isset($filter_name)) $filter_name = '';
37 37
 					$airlines = $Stats->getAllAirlineNames($filter_name);
38
-					foreach($airlines as $airline) {
38
+					foreach ($airlines as $airline) {
39 39
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
40 40
 							print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>';
41 41
 						} else {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	if (!isset($type) || $type == 'aircraft') {
59 59
 ?>
60 60
 		<li class="dropdown">
61
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
61
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
62 62
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
63 63
 		    </a>
64 64
 		    <ul class="dropdown-menu">
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		    </ul>
70 70
 		</li>
71 71
 		<li class="dropdown">
72
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
72
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
73 73
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
74 74
 		    </a>
75 75
 		    <ul class="dropdown-menu" role="menu">
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		    </ul>
86 86
 		</li>
87 87
 		<li class="dropdown">
88
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
88
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
89 89
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
90 90
 		    </a>
91 91
 		    <ul class="dropdown-menu" role="menu">
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		    </ul>
97 97
 		</li>
98 98
 		<li class="dropdown">
99
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
99
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
100 100
 		      <?php echo _("Route"); ?> <span class="caret"></span>
101 101
 		    </a>
102 102
 		    <ul class="dropdown-menu" role="menu">
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		    </ul>
106 106
 		</li>
107 107
 		<li class="dropdown">
108
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
108
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
109 109
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
110 110
 		    </a>
111 111
 		    <ul class="dropdown-menu" role="menu">
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		    if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
118 118
 		?>
119 119
 		<li class="dropdown">
120
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
120
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#">
121 121
 		      <?php echo _("Fatalities"); ?> <span class="caret"></span>
122 122
 		    </a>
123 123
 		    <ul class="dropdown-menu" role="menu">
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	} elseif ($type == 'marine' || $type == 'tracker') {
133 133
 ?>
134 134
 		<li class="dropdown">
135
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
135
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
136 136
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
137 137
 		    </a>
138 138
 		    <ul class="dropdown-menu" role="menu">
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	if (!isset($type) || $type == 'aircraft') {
155 155
 ?>
156 156
 		<li class="dropdown">
157
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
157
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
158 158
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
159 159
 		    </a>
160 160
 		    <ul class="dropdown-menu">
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		    </ul>
166 166
 		</li>
167 167
 		<li class="dropdown">
168
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
168
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
169 169
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
170 170
 		    </a>
171 171
 		    <ul class="dropdown-menu" role="menu">
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		    </ul>
182 182
 		</li>
183 183
 		<li class="dropdown">
184
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
184
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
185 185
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
186 186
 		    </a>
187 187
 		    <ul class="dropdown-menu" role="menu">
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		</li>
194 194
 		<!--
195 195
 		<li class="dropdown">
196
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
196
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
197 197
 		      <?php echo _("Route"); ?> <span class="caret"></span>
198 198
 		    </a>
199 199
 		    <ul class="dropdown-menu" role="menu">
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		-->
205 205
 		<!--
206 206
 		<li class="dropdown">
207
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
207
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
208 208
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
209 209
 		    </a>
210 210
 		    <ul class="dropdown-menu" role="menu">
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		?>
219 219
 		<!--
220 220
 		<li class="dropdown">
221
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
221
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#">
222 222
 		      <?php echo _("Fatalities"); ?> <span class="caret"></span>
223 223
 		    </a>
224 224
 		    <ul class="dropdown-menu" role="menu">
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	} elseif ($type == 'marine' || $type == 'tracker') {
235 235
 ?>
236 236
 		<li class="dropdown">
237
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
237
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
238 238
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
239 239
 		    </a>
240 240
 		    <ul class="dropdown-menu" role="menu">
Please login to merge, or discard this patch.
search-ajax.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 $Spotter = new Spotter();
8 8
 $orderby = $Spotter->getOrderBy();
9 9
 
10
-$ask = filter_input(INPUT_GET,'ask',FILTER_SANITIZE_STRING);
10
+$ask = filter_input(INPUT_GET, 'ask', FILTER_SANITIZE_STRING);
11 11
 if ($ask == 'aircraftsdetected') {
12 12
 	require_once('require/class.SpotterLive.php');
13 13
 	$SpotterLive = new SpotterLive();
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
27 27
 	$manufacturers = $Stats->getAllManufacturers();
28 28
 	if (empty($manufacturers)) $manufacturers = $Spotter->getAllManufacturers();
29 29
 	$all_manufacturers = array();
30
-	foreach($manufacturers as $manufacturer)
30
+	foreach ($manufacturers as $manufacturer)
31 31
 	{
32
-		$all_manufacturers[] = array('value' => $manufacturer['aircraft_manufacturer'], 'id' => strtolower(str_replace(' ','-',$manufacturer['aircraft_manufacturer'])));
32
+		$all_manufacturers[] = array('value' => $manufacturer['aircraft_manufacturer'], 'id' => strtolower(str_replace(' ', '-', $manufacturer['aircraft_manufacturer'])));
33 33
 	}
34 34
 	echo json_encode($all_manufacturers);
35 35
 } elseif ($ask == 'aircrafttypes') {
36 36
 	$aircraft_types = $Stats->getAllAircraftTypes();
37 37
 	if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
38 38
 	$all_aircraft_types = array();
39
-	foreach($aircraft_types as $aircraft_type)
39
+	foreach ($aircraft_types as $aircraft_type)
40 40
 	{
41 41
 		$all_aircraft_types[] = array('id' => $aircraft_type['aircraft_icao'], 'value' => $aircraft_type['aircraft_name'].' ('.$aircraft_type['aircraft_icao'].')');
42 42
 	}
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 } elseif ($ask == 'airlinenames') {
45 45
 	$airline_names = $Stats->getAllAirlineNames();
46 46
 	$all_airline_names = array();
47
-	foreach($airline_names as $airline_name)
47
+	foreach ($airline_names as $airline_name)
48 48
 	{
49 49
 		$all_airline_names[] = array('id' => $airline_name['airline_icao'], 'value' => $airline_name['airline_name'].' ('.$airline_name['airline_icao'].')');
50 50
 	}
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 } elseif ($ask == 'airlinecountries') {
53 53
 	$airline_countries = $Spotter->getAllAirlineCountries();
54 54
 	$all_airline_countries = array();
55
-	foreach($airline_countries as $airline_country)
55
+	foreach ($airline_countries as $airline_country)
56 56
 	{
57 57
 		$all_airline_countries[] = array('id' => $airline_country['airline_country'], 'value' => $airline_country['airline_country']);
58 58
 	}
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
63 63
 	ksort($airport_names);
64 64
 	$all_airport_names = array();
65
-	foreach($airport_names as $airport_name)
65
+	foreach ($airport_names as $airport_name)
66 66
 	{
67 67
 		$all_airport_names[] = array('id' => $airport_name['airport_icao'], 'value' => $airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')');
68 68
 	}
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 } elseif ($ask == 'airportcountries') {
71 71
 	$airport_countries = $Spotter->getAllAirportCountries();
72 72
 	$all_airport_countries = array();
73
-	foreach($airport_countries as $airport_country)
73
+	foreach ($airport_countries as $airport_country)
74 74
 	{
75 75
 		$all_airport_countries[] = array('id' => $airport_country['airport_country'], 'value' => $airport_country['airport_country']);
76 76
 	}
Please login to merge, or discard this patch.
space-data.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 <button type="button" class="close">&times;</button>
10 10
 <?php
11 11
 
12
-$sat = filter_input(INPUT_GET,'sat',FILTER_SANITIZE_STRING);
12
+$sat = filter_input(INPUT_GET, 'sat', FILTER_SANITIZE_STRING);
13 13
 $sat = urldecode($sat);
14 14
 //$info = $Satellite->get_info(str_replace(' ','-',$sat));
15 15
 //print_r($info);
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	$aircraft_name = 'INTEGRAL';
49 49
 //	$ground_speed = 14970;
50 50
 	$launch_date = '17 October 2002';
51
-} elseif (strpos($sat,'IRIDIUM') !== false) {
51
+} elseif (strpos($sat, 'IRIDIUM') !== false) {
52 52
 	$image = 'https://upload.wikimedia.org/wikipedia/commons/b/b6/Iridium_Satellite.jpg';
53 53
 	$image_copyright = 'Cliff';
54 54
 	$ident = 'Iridium satellite constellation';
@@ -56,23 +56,23 @@  discard block
 block discarded – undo
56 56
 	$aircraft_name = $sat;
57 57
 //	$ground_speed = 14970;
58 58
 //	$launch_date = '29 september 2011';
59
-} elseif (strpos($sat,'ORBCOMM') !== false) {
59
+} elseif (strpos($sat, 'ORBCOMM') !== false) {
60 60
 	$ident = 'Orbcomm';
61 61
 	$aircraft_wiki = 'https://en.wikipedia.org/wiki/Orbcomm_(satellite)';
62 62
 	$aircraft_name = $sat;
63
-} elseif (strpos($sat,'GLOBALSTAR') !== false) {
63
+} elseif (strpos($sat, 'GLOBALSTAR') !== false) {
64 64
 	$ident = 'Globalstar';
65 65
 	$aircraft_wiki = 'https://en.wikipedia.org/wiki/Globalstar';
66 66
 	$aircraft_name = $sat;
67
-	$satname = str_replace(array('[+]','[-]'),'',$sat);
68
-} elseif (strpos($sat,'OSCAR 7') !== false) {
67
+	$satname = str_replace(array('[+]', '[-]'), '', $sat);
68
+} elseif (strpos($sat, 'OSCAR 7') !== false) {
69 69
 	$image = 'https://upload.wikimedia.org/wikipedia/en/a/ad/AMSAT-OSCAR_7.jpg';
70 70
 	$image_copyright = 'Amsat.org';
71 71
 	$ident = 'AMSAT-OSCAR 7';
72 72
 	$aircraft_wiki = 'https://en.wikipedia.org/wiki/AMSAT-OSCAR_7';
73 73
 	$aircraft_name = $sat;
74 74
 	$launch_date = '15 November 1974';
75
-} elseif (strpos($sat,'santaclaus') !== false) {
75
+} elseif (strpos($sat, 'santaclaus') !== false) {
76 76
 	$image = 'https://upload.wikimedia.org/wikipedia/commons/4/49/Jonathan_G_Meath_portrays_Santa_Claus.jpg';
77 77
 	$image_copyright = 'Jonathan G Meath';
78 78
 	$ident = 'Santa Claus';
@@ -81,8 +81,8 @@  discard block
 block discarded – undo
81 81
 //	$launch_date = '15 November 1974';
82 82
 } else {
83 83
 	$ident = $sat;
84
-	if (strpos($sat,'(')) $satname = $sat;
85
-	else $satname = str_replace(array(' '),'-',$sat);
84
+	if (strpos($sat, '(')) $satname = $sat;
85
+	else $satname = str_replace(array(' '), '-', $sat);
86 86
 }
87 87
 if (!isset($satname)) $satname = $sat;
88 88
 $info = $Satellite->get_info(strtolower(trim($satname)));
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		print '<div><span>'._("Orbit").'</span>'.$info['orbit'].'</div>';
146 146
 	}
147 147
 	if ($info['launch_date'] != '') {
148
-		print '<div><span>'._("Launch Date").'</span>'.date('Y-m-d',strtotime($info['launch_date'])).'</div>';
148
+		print '<div><span>'._("Launch Date").'</span>'.date('Y-m-d', strtotime($info['launch_date'])).'</div>';
149 149
 	}
150 150
 	if ($info['launch_site'] != '') {
151 151
 		print '<div><span>'._("Launch Site").'</span>'.$info['launch_site'].'</div>';
Please login to merge, or discard this patch.
scripts/update_db.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ")) $j++;
12
+	foreach ($output as $line) if (strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ")) $j++;
13 13
 	if ($j > 1) {
14 14
 		echo "Script is already runnning...";
15 15
 		die();
Please login to merge, or discard this patch.
scripts/daemon-acars.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 
18 18
 $debug = true;
19 19
 
20
-$ACARS=new ACARS(null,true);
20
+$ACARS = new ACARS(null, true);
21 21
 date_default_timezone_set('UTC');
22 22
 // signal handler - playing nice with sockets and dump1090
23
-pcntl_signal(SIGINT,  function($signo) {
23
+pcntl_signal(SIGINT, function($signo) {
24 24
     global $sock;
25 25
     echo "\n\nctrl-c or kill signal received. Tidying up ... ";
26 26
     socket_shutdown($sock, 0);
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 $sock = socket_create(AF_INET, SOCK_DGRAM, 0) or die("Unable to create socket\n");
37 37
 
38 38
 // Bind the source address
39
-if( !socket_bind($sock, $globalACARSHost , $globalACARSPort) )
39
+if (!socket_bind($sock, $globalACARSHost, $globalACARSPort))
40 40
 {
41 41
     $errorcode = socket_last_error();
42 42
     $errormsg = socket_strerror($errorcode);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 }
46 46
 
47 47
 echo "LISTEN UDP MODE \n\n";
48
-while(1) {
48
+while (1) {
49 49
     $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port);
50 50
 
51 51
     // lets play nice and handle signals such as ctrl-c/kill properly
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
     //  (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1
55 55
     echo $buffer."\n";
56 56
     $ACARS->add(trim($buffer));
57
-    socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
57
+    socket_sendto($sock, "OK ".$buffer, 100, 0, $remote_ip, $remote_port);
58 58
     $ACARS->deleteLiveAcarsData();
59 59
 }
60
-pcntl_exec($_,$argv);
60
+pcntl_exec($_, $argv);
61 61
 ?>
Please login to merge, or discard this patch.
getImages.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -4,9 +4,9 @@  discard block
 block discarded – undo
4 4
 	$hex = str_replace("#", "", $hex);
5 5
 	$color = array();
6 6
 	if (strlen($hex) == 3) {
7
-	    $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1));
8
-	    $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1));
9
-	    $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1));
7
+	    $color['r'] = hexdec(substr($hex, 0, 1).substr($hex, 0, 1));
8
+	    $color['g'] = hexdec(substr($hex, 1, 1).substr($hex, 1, 1));
9
+	    $color['b'] = hexdec(substr($hex, 2, 1).substr($hex, 2, 1));
10 10
 	} else if (strlen($hex) == 6) {
11 11
 	    $color['r'] = hexdec(substr($hex, 0, 2));
12 12
 	    $color['g'] = hexdec(substr($hex, 2, 2));
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 }
17 17
 
18 18
 
19
-if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { 
19
+if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/', $_GET['color'])) { 
20 20
     exit(0);
21 21
 }
22 22
 $color = $_GET['color'];
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 
48 48
 if (extension_loaded('gd') && function_exists('gd_info')) {
49 49
     $image = imagecreatefrompng($original);
50
-    $index = imagecolorexact($image,26,49,81);
50
+    $index = imagecolorexact($image, 26, 49, 81);
51 51
     if ($index < 0) {
52
-	$index = imagecolorexact($image,25,49,79);
52
+	$index = imagecolorexact($image, 25, 49, 79);
53 53
     }
54 54
     if ($index < 0) {
55
-	$index = imagecolorexact($image,0,0,0);
55
+	$index = imagecolorexact($image, 0, 0, 0);
56 56
     }
57 57
     $c = hexToRGB($color);
58
-    imagecolorset($image,$index,$c['r'],$c['g'],$c['b']);
58
+    imagecolorset($image, $index, $c['r'], $c['g'], $c['b']);
59 59
  /*
60 60
     $ig = imagecolorat($image, 0, 0);
61 61
     imagecolortransparent($image, $ig);
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
 
64 64
     header('Content-type: image/png');
65 65
     if (isset($_GET['resize']) && function_exists('imagecopyresampled')) {
66
-	$resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT);
67
-	$newimg = imagecreatetruecolor($resize,$resize);
66
+	$resize = filter_input(INPUT_GET, 'resize', FILTER_SANITIZE_NUMBER_INT);
67
+	$newimg = imagecreatetruecolor($resize, $resize);
68 68
         imagealphablending($newimg, false);
69 69
 	imagesavealpha($newimg, true);
70
-	imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image));
70
+	imagecopyresampled($newimg, $image, 0, 0, 0, 0, 15, 15, imagesx($image), imagesy($image));
71 71
 	if (isset($_GET['heading'])) {
72
-    	    $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT);
73
-    	    $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127));
72
+    	    $heading = filter_input(INPUT_GET, 'heading', FILTER_SANITIZE_NUMBER_INT);
73
+    	    $rotation = imagerotate($newimg, $heading, imageColorAllocateAlpha($newimg, 0, 0, 0, 127));
74 74
     	    imagealphablending($rotation, false);
75 75
 	    imagesavealpha($rotation, true);
76 76
     	    imagepng($rotation);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	imagepng($image);
90 90
 	imagepng($image);
91 91
 	if (is_writable(dirname(__FILE__).'/cache')) {
92
-    	    imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename);
92
+    	    imagepng($image, dirname(__FILE__).'/cache/'.$color.'-'.$filename);
93 93
 	}
94 94
         imagedestroy($image);
95 95
     }
Please login to merge, or discard this patch.
pilot.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
 
8 8
 if (isset($_POST['pilot']))
9 9
 {
10
-	header('Location: '.$globalURL.'/pilot/'.filter_input(INPUT_POST,'pilot',FILTER_SANITIZE_STRING));
10
+	header('Location: '.$globalURL.'/pilot/'.filter_input(INPUT_POST, 'pilot', FILTER_SANITIZE_STRING));
11 11
 //} else if (isset($_GET['airport'])){
12 12
 } else {
13
-	$Spotter= new Spotter();
13
+	$Spotter = new Spotter();
14 14
 	$Stats = new Stats();
15 15
 	$Common = new Common();
16 16
 	$title = _("Pilots");
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 	//ksort($pilot_names);
25 25
 	$previous = null;
26 26
 	print '<div class="alphabet-legend">';
27
-	foreach($pilot_names as $value) {
27
+	foreach ($pilot_names as $value) {
28 28
 		$firstLetter = strtoupper($Common->replace_mb_substr($value['pilot_name'], 0, 1));
29
-		if($previous !== $firstLetter && $firstLetter != "'")
29
+		if ($previous !== $firstLetter && $firstLetter != "'")
30 30
 		{
31
-			if ($previous !== null){
31
+			if ($previous !== null) {
32 32
 				print ' | ';
33 33
 			}
34 34
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 	print '</div>';
39 39
 	$previous = null;
40
-	foreach($pilot_names as $value) {
40
+	foreach ($pilot_names as $value) {
41 41
 		$firstLetter = strtoupper($Common->replace_mb_substr($value['pilot_name'], 0, 1));
42 42
 		if ($firstLetter != "")
43 43
 		{
44
-			if($previous !== $firstLetter && $firstLetter != "'")
44
+			if ($previous !== $firstLetter && $firstLetter != "'")
45 45
 			{
46
-				if ($previous !== null){
46
+				if ($previous !== null) {
47 47
 					print '</div>';
48 48
 				}
49 49
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.
owner.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
 
8 8
 if (isset($_POST['owner']))
9 9
 {
10
-	header('Location: '.$globalURL.'/owner/'.filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING));
10
+	header('Location: '.$globalURL.'/owner/'.filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING));
11 11
 //} else if (isset($_GET['airport'])){
12 12
 } else {
13
-	$Spotter= new Spotter();
13
+	$Spotter = new Spotter();
14 14
 	$Stats = new Stats();
15 15
 	$Common = new Common();
16 16
 	$title = _("Owners");
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
 	ksort($owner_names);
25 25
 	$previous = null;
26 26
 	print '<div class="alphabet-legend">';
27
-	foreach($owner_names as $value) {
27
+	foreach ($owner_names as $value) {
28 28
 		$firstLetter = $Common->remove_accents(strtoupper($Common->replace_mb_substr($value['owner_name'], 0, 1)));
29
-		if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
29
+		if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
30 30
 		{
31
-			if ($previous !== null){
31
+			if ($previous !== null) {
32 32
 				print ' | ';
33 33
 			}
34 34
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -37,13 +37,13 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 	print '</div>';
39 39
 	$previous = null;
40
-	foreach($owner_names as $value) {
40
+	foreach ($owner_names as $value) {
41 41
 		$firstLetter = $Common->remove_accents(strtoupper($Common->replace_mb_substr($value['owner_name'], 0, 1)));
42 42
 		if ($firstLetter != "")
43 43
 		{
44
-			if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
44
+			if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"')
45 45
 			{
46
-				if ($previous !== null){
46
+				if ($previous !== null) {
47 47
 					print '</div>';
48 48
 				}
49 49
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.
require/class.Accident.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -28,20 +28,20 @@  discard block
 block discarded – undo
28 28
 	* @param String $date get data for a date
29 29
 	* @return Array Return Accidents data in array
30 30
 	*/
31
-	public function getAccidentData($limit = '',$type = '',$date = '') {
31
+	public function getAccidentData($limit = '', $type = '', $date = '') {
32 32
 		global $globalURL, $globalDBdriver;
33 33
 		$Image = new Image($this->db);
34 34
 		$Spotter = new Spotter($this->db);
35 35
 		$Translation = new Translation($this->db);
36
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
36
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
37 37
 		date_default_timezone_set('UTC');
38 38
 		$result = array();
39 39
 		$limit_query = '';
40 40
 		if ($limit != "")
41 41
 		{
42 42
 			$limit_array = explode(",", $limit);
43
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
44
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
43
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
44
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
45 45
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
46 46
 			{
47 47
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
@@ -50,29 +50,29 @@  discard block
 block discarded – undo
50 50
 
51 51
 		if ($type != '') {
52 52
 			if ($date != '') {
53
-				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) {
53
+				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) {
54 54
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
55 55
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
56
-					$query_values = array(':type' => $type,':date' => $date);
57
-				} elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/",$date)) {
56
+					$query_values = array(':type' => $type, ':date' => $date);
57
+				} elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/", $date)) {
58 58
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date BETWEEN :dated AND :datef GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
59
-					$query_values = array(':type' => $type,':dated' => $date.'-01', ':datef' => $date.'-31');
60
-				} elseif (preg_match("/^[0-9]{4}$/",$date)) {
59
+					$query_values = array(':type' => $type, ':dated' => $date.'-01', ':datef' => $date.'-31');
60
+				} elseif (preg_match("/^[0-9]{4}$/", $date)) {
61 61
 					if ($globalDBdriver == 'mysql') {
62 62
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND YEAR(date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
63 63
 					} else {
64 64
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND EXTRACT(YEAR FROM date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
65 65
 					}
66
-					$query_values = array(':type' => $type,':date' => $date);
66
+					$query_values = array(':type' => $type, ':date' => $date);
67 67
 				} else {
68 68
 					$date = $date.'%';
69 69
 					if ($globalDBdriver == 'mysql') {
70 70
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND DATE_FORMAT(date,'%Y-%m-%d') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
71
-						$query_values = array(':type' => $type,':date' => $date);
71
+						$query_values = array(':type' => $type, ':date' => $date);
72 72
 					} else {
73 73
 						$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
74 74
 						//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
75
-						$query_values = array(':type' => $type,':date' => $date);
75
+						$query_values = array(':type' => $type, ':date' => $date);
76 76
 					}
77 77
 				}
78 78
 			} else {
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 			}
83 83
 		} else {
84 84
 			if ($date != '') {
85
-				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) {
85
+				if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) {
86 86
 					$query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
87 87
 					//$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query;
88 88
 				} else {
@@ -100,17 +100,17 @@  discard block
 block discarded – undo
100 100
 		try {
101 101
 			$sth = $this->db->prepare($query);
102 102
 			$sth->execute($query_values);
103
-		} catch(PDOException $e) {
103
+		} catch (PDOException $e) {
104 104
 			echo "error : ".$e->getMessage();
105 105
 		}
106 106
 		$i = 0;
107 107
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
108
-			if (preg_match('/^[\w\-]+$/',$row['registration'])) {
108
+			if (preg_match('/^[\w\-]+$/', $row['registration'])) {
109 109
 				$data = array();
110 110
 				if ($row['registration'] != '') {
111 111
 					$image_array = $Image->getSpotterImage($row['registration']);
112
-					if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
113
-					else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
112
+					if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website']));
113
+					else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
114 114
 					$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
115 115
 					$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
116 116
 					if (!empty($aircraft_info)) {
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 						$data['aircraft_name'] = $aircraft_info[0]['type'];
119 119
 						$data['aircraft_manufacturer'] = $aircraft_info[0]['manufacturer'];
120 120
 					} else {
121
-						$data = array_merge($data,array('aircraft_type' => 'NA'));
121
+						$data = array_merge($data, array('aircraft_type' => 'NA'));
122 122
 					}
123 123
 					$owner_data = $Spotter->getAircraftOwnerByRegistration($row['registration']);
124 124
 					if (!empty($owner_data)) {
@@ -126,18 +126,18 @@  discard block
 block discarded – undo
126 126
 						$data['aircraft_base'] = $owner_data['base'];
127 127
 						$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
128 128
 					}
129
-				} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
129
+				} else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => ''));
130 130
 				if ($row['registration'] == '') $row['registration'] = 'NA';
131 131
 				if ($row['ident'] == '') $row['ident'] = 'NA';
132
-				$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
132
+				$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 3));
133 133
 				if (isset($identicao[0])) {
134
-					if (substr($row['ident'],0,2) == 'AF') {
135
-						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
136
-						else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
137
-					} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
138
-					$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
134
+					if (substr($row['ident'], 0, 2) == 'AF') {
135
+						if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
136
+						else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0');
137
+					} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0');
138
+					$data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name']));
139 139
 				} else $icao = $row['ident'];
140
-				$icao = $Translation->checkTranslation($icao,false);
140
+				$icao = $Translation->checkTranslation($icao, false);
141 141
 				//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
142 142
 				if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
143 143
 					//echo 'Check airline info... for '.$row['airline_name'].' ';
@@ -146,16 +146,16 @@  discard block
 block discarded – undo
146 146
 					if (!empty($airline_info)) {
147 147
 						//echo 'data found !'."\n";
148 148
 						//print_r($airline_info);
149
-						$data = array_merge($data,$airline_info);
149
+						$data = array_merge($data, $airline_info);
150 150
 					} 
151 151
 					//else echo 'No data...'."\n";
152 152
 				}
153
-				$data = array_merge($row,$data);
153
+				$data = array_merge($row, $data);
154 154
 				if ($data['ident'] == null) $data['ident'] = $icao;
155 155
 				if ($data['title'] == null) {
156 156
 					$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
157 157
 				} else $data['message'] = strtolower($data['title']);
158
-				$ids = $Spotter->getAllIDByRegistration($data['registration'],true);
158
+				$ids = $Spotter->getAllIDByRegistration($data['registration'], true);
159 159
 				$date = $data['date'];
160 160
 				if (isset($ids[$date])) {
161 161
 					$data['spotted'] = TRUE;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		try {
188 188
 			$sth = $this->db->prepare($query);
189 189
 			$sth->execute();
190
-		} catch(PDOException $e) {
190
+		} catch (PDOException $e) {
191 191
 			echo "Error : ".$e->getMessage();
192 192
 		}
193 193
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 		try {
208 208
 			$sth = $this->db->prepare($query);
209 209
 			$sth->execute();
210
-		} catch(PDOException $e) {
210
+		} catch (PDOException $e) {
211 211
 			echo "Error : ".$e->getMessage();
212 212
 		}
213 213
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -222,15 +222,15 @@  discard block
 block discarded – undo
222 222
 		if ($globalDebug) echo 'Import '.$file."\n";
223 223
 		$result = array();
224 224
 		if (file_exists($file)) {
225
-			if (($handle = fopen($file,'r')) !== FALSE) {
226
-				while (($data = fgetcsv($handle,2000,",")) !== FALSE) {
225
+			if (($handle = fopen($file, 'r')) !== FALSE) {
226
+				while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) {
227 227
 					if (isset($data[1]) && $data[1] != '0000-00-00 00:00:00') {
228
-						$result[] = array('registration' => $data[0],'date' => strtotime($data[1]),'url' => $data[2],'country' => $data[3],'place' => $data[4],'title' => $data[5],'fatalities' => $data[6],'latitude' => $data[7],'longitude' => $data[8],'type' => $data[9],'ident' => $data[10],'aircraft_manufacturer' => $data[11],'aircraft_name' => $data[12],'operator' => $data[13],'source' => 'website_fam');
228
+						$result[] = array('registration' => $data[0], 'date' => strtotime($data[1]), 'url' => $data[2], 'country' => $data[3], 'place' => $data[4], 'title' => $data[5], 'fatalities' => $data[6], 'latitude' => $data[7], 'longitude' => $data[8], 'type' => $data[9], 'ident' => $data[10], 'aircraft_manufacturer' => $data[11], 'aircraft_name' => $data[12], 'operator' => $data[13], 'source' => 'website_fam');
229 229
 					}
230 230
 				}
231 231
 				fclose($handle);
232 232
 			}
233
-			if (!empty($result)) $this->add($result,true);
233
+			if (!empty($result)) $this->add($result, true);
234 234
 			elseif ($globalDebug) echo 'Nothing to import';
235 235
 		}
236 236
 	}
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 		$all_md5_new = array();
247 247
 		if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) {
248 248
 			if ($this->check_accidents_nb() > 0) {
249
-				if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) {
250
-					while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) {
249
+				if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) {
250
+					while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
251 251
 						if (isset($data[1])) {
252 252
 							$year = $data[0];
253 253
 							$all_md5[$year] = $data[1];
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 				}
258 258
 			}
259 259
 		}
260
-		$Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5',dirname(__FILE__).'/../install/tmp/cr-all.md5');
260
+		$Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5', dirname(__FILE__).'/../install/tmp/cr-all.md5');
261 261
 		if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) {
262
-			if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) {
263
-				while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) {
262
+			if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) {
263
+				while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) {
264 264
 					if (isset($data[1])) {
265 265
 						$year = $data[0];
266 266
 						$all_md5_new[$year] = $data[1];
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
 				fclose($handle);
270 270
 			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
271 271
 		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
272
-		$result = $Common->arr_diff($all_md5_new,$all_md5);
272
+		$result = $Common->arr_diff($all_md5_new, $all_md5);
273 273
 		if (empty($result) && $globalDebug) echo 'Nothing to update';
274 274
 		foreach ($result as $file => $md5) {
275
-			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
275
+			$Common->download('http://data.flightairmap.fr/data/cr/'.$file, dirname(__FILE__).'/../install/tmp/'.$file);
276 276
 			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
277 277
 			elseif ($globalDebug) echo 'Download '.$file.' failed';
278 278
 		}
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 	* Add data to DB
283 283
 	* @param Array $crash An array with accidents/incidents data
284 284
 	*/
285
-	public function add($crash,$new = false) {
285
+	public function add($crash, $new = false) {
286 286
 		global $globalTransaction, $globalDebug;
287 287
 		require_once('class.Connection.php');
288 288
 		require_once('class.Image.php');
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 			$sthd->execute(array(':source' => $crash[0]['source']));
299 299
 		}
300 300
 		if ($globalTransaction) $Connection->db->beginTransaction();
301
-		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
301
+		$initial_array = array('ident' => null, 'type' => 'accident', 'url' => null, 'registration' => null, 'date' => null, 'place' => null, 'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '', 'source' => '', 'aircraft_manufacturer' => null, 'aircraft_name' => null, 'operator' => null);
302 302
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
303 303
 		$sth_check = $Connection->db->prepare($query_check);
304 304
 		$query = 'INSERT INTO accidents (aircraft_manufacturer,aircraft_name,ident,registration,date,url,country,place,title,fatalities,latitude,longitude,type,airline_name,source) VALUES (:aircraft_manufacturer,:aircraft_name,:ident,:registration,:date,:url,:country,:place,:title,:fatalities,:latitude,:longitude,:type,:airline_name,:source)';
@@ -311,15 +311,15 @@  discard block
 block discarded – undo
311 311
 				$cr = array_map(function($value) {
312 312
 					return $value === "" ? NULL : $value;
313 313
 				}, $cr);
314
-				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
315
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
316
-					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
314
+				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/', $cr['registration'])) {
315
+					if (strpos($cr['registration'], '-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
316
+					$query_check_values = array(':registration' => $cr['registration'], ':date' => date('Y-m-d', $cr['date']), ':type' => $cr['type'], ':source' => $cr['source']);
317 317
 					$sth_check->execute($query_check_values);
318 318
 					$result_check = $sth_check->fetch(PDO::FETCH_ASSOC);
319 319
 					if ($result_check['nb'] == 0) {
320
-						$query_values = array(':registration' => trim($cr['registration']),':date' => date('Y-m-d',$cr['date']),':url' => $cr['url'],':country' => $cr['country'],':place' => $cr['place'],':title' => $cr['title'],':fatalities' => $cr['fatalities'],':latitude' => $cr['latitude'],':longitude' => $cr['longitude'],':type' => $cr['type'],':source' => $cr['source'],':ident' => $cr['ident'],':aircraft_manufacturer' => $cr['aircraft_manufacturer'],':aircraft_name' => $cr['aircraft_name'],':airline_name' => $cr['operator']);
320
+						$query_values = array(':registration' => trim($cr['registration']), ':date' => date('Y-m-d', $cr['date']), ':url' => $cr['url'], ':country' => $cr['country'], ':place' => $cr['place'], ':title' => $cr['title'], ':fatalities' => $cr['fatalities'], ':latitude' => $cr['latitude'], ':longitude' => $cr['longitude'], ':type' => $cr['type'], ':source' => $cr['source'], ':ident' => $cr['ident'], ':aircraft_manufacturer' => $cr['aircraft_manufacturer'], ':aircraft_name' => $cr['aircraft_name'], ':airline_name' => $cr['operator']);
321 321
 						$sth->execute($query_values);
322
-						if ($cr['date'] > time()-(30*86400)) {
322
+						if ($cr['date'] > time() - (30*86400)) {
323 323
 							if (empty($Image->getSpotterImage($cr['registration']))) {
324 324
 								if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...';
325 325
 								$Image->addSpotterImage($cr['registration']);
@@ -328,16 +328,16 @@  discard block
 block discarded – undo
328 328
 							// elseif ($globalDebug) echo 'Image already in DB'."\n";
329 329
 						}
330 330
 						if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type'];
331
-						$Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date']));
331
+						$Spotter->setHighlightFlightByRegistration($cr['registration'], $cr['title'], date('Y-m-d', $cr['date']));
332 332
 					}
333 333
 				}
334
-				if ($globalTransaction && $j % 1000 == 0) {
334
+				if ($globalTransaction && $j%1000 == 0) {
335 335
 					$Connection->db->commit();
336 336
 					$Connection->db->beginTransaction();
337 337
 				}
338 338
 			}
339 339
 			if ($globalTransaction) $Connection->db->commit();
340
-		} catch(PDOException $e) {
340
+		} catch (PDOException $e) {
341 341
 			if ($globalTransaction) $Connection->db->rollBack();
342 342
 			echo $e->getMessage();
343 343
 		}
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 			$Connection = new Connection();
356 356
 			$sth = $Connection->db->prepare($query);
357 357
 			$sth->execute();
358
-		} catch(PDOException $e) {
358
+		} catch (PDOException $e) {
359 359
 			return "error : ".$e->getMessage();
360 360
 		}
361 361
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
 			$Connection = new Connection();
374 374
 			$sth = $Connection->db->prepare($query);
375 375
 			$sth->execute();
376
-		} catch(PDOException $e) {
376
+		} catch (PDOException $e) {
377 377
 			return "error : ".$e->getMessage();
378 378
 		}
379 379
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 			$Connection = new Connection();
389 389
 			$sth = $Connection->db->prepare($query);
390 390
 			$sth->execute();
391
-		} catch(PDOException $e) {
391
+		} catch (PDOException $e) {
392 392
 			return "error : ".$e->getMessage();
393 393
 		}
394 394
 	}
Please login to merge, or discard this patch.