Completed
Push — master ( baa1fe...14925d )
by Yannick
164:26 queued 132:19
created
require/class.Connection.php 1 patch
Braces   +86 added lines, -33 removed lines patch added patch discarded remove patch
@@ -73,8 +73,11 @@  discard block
 block discarded – undo
73 73
 				$globalDBSname = $globalDBname;
74 74
 				$globalDBSuser = $globalDBuser;
75 75
 				$globalDBSpass = $globalDBpass;
76
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
77
-				else $globalDBSport = $globalDBport;
76
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
77
+					$globalDBSport = 3306;
78
+				} else {
79
+					$globalDBSport = $globalDBport;
80
+				}
78 81
 			} else {
79 82
 				$DBname = 'default';
80 83
 				$globalDBSdriver = $globalDBdriver;
@@ -82,8 +85,11 @@  discard block
 block discarded – undo
82 85
 				$globalDBSname = $globalDBname;
83 86
 				$globalDBSuser = $user;
84 87
 				$globalDBSpass = $pass;
85
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
86
-				else $globalDBSport = $globalDBport;
88
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
89
+					$globalDBSport = 3306;
90
+				} else {
91
+					$globalDBSport = $globalDBport;
92
+				}
87 93
 			}
88 94
 		} else {
89 95
 			$globalDBSdriver = $globalDB[$DBname]['driver'];
@@ -91,12 +97,19 @@  discard block
 block discarded – undo
91 97
 			$globalDBSname = $globalDB[$DBname]['name'];
92 98
 			$globalDBSuser = $globalDB[$DBname]['user'];
93 99
 			$globalDBSpass = $globalDB[$DBname]['pass'];
94
-			if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port'];
95
-			else $globalDBSport = 3306;
100
+			if (isset($globalDB[$DBname]['port'])) {
101
+				$globalDBSport = $globalDB[$DBname]['port'];
102
+			} else {
103
+				$globalDBSport = 3306;
104
+			}
105
+		}
106
+		if ($globalDBSname == '' || $globalDBSuser == '') {
107
+			return false;
96 108
 		}
97
-		if ($globalDBSname == '' || $globalDBSuser == '') return false;
98 109
 		// Set number of try to connect to DB
99
-		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5;
110
+		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) {
111
+			$globalDBretry = 5;
112
+		}
100 113
 		$i = 0;
101 114
 		while (true) {
102 115
 			try {
@@ -105,10 +118,16 @@  discard block
 block discarded – undo
105 118
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
106 119
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
107 120
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
108
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
109
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
110
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
111
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
121
+					if (!isset($globalDBTimeOut)) {
122
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
123
+					} else {
124
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
125
+					}
126
+					if (!isset($globalDBPersistent)) {
127
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
128
+					} else {
129
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
130
+					}
112 131
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
113 132
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
114 133
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -122,24 +141,36 @@  discard block
 block discarded – undo
122 141
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
123 142
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
124 143
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
125
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
126
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
127
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
128
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
144
+					if (!isset($globalDBTimeOut)) {
145
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
146
+					} else {
147
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
148
+					}
149
+					if (!isset($globalDBPersistent)) {
150
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
151
+					} else {
152
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
153
+					}
129 154
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
130 155
 					$this->dbs[$DBname]->exec('SET timezone="UTC"');
131 156
 				}
132 157
 				break;
133 158
 			} catch(PDOException $e) {
134 159
 				$i++;
135
-				if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
160
+				if (isset($globalDebug) && $globalDebug) {
161
+					echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
162
+				}
136 163
 				//exit;
137
-				if ($i > $globalDBretry) return false;
164
+				if ($i > $globalDBretry) {
165
+					return false;
166
+				}
138 167
 				//return false;
139 168
 			}
140 169
 			sleep(2);
141 170
 		}
142
-		if ($DBname === 'default') $this->db = $this->dbs['default'];
171
+		if ($DBname === 'default') {
172
+			$this->db = $this->dbs['default'];
173
+		}
143 174
 		return true;
144 175
 	}
145 176
 
@@ -151,7 +182,9 @@  discard block
 block discarded – undo
151 182
 		} else {
152 183
 			$query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'";
153 184
 		}
154
-		if ($this->db == NULL) return false;
185
+		if ($this->db == NULL) {
186
+			return false;
187
+		}
155 188
 		try {
156 189
 			//$Connection = new Connection();
157 190
 			$results = $this->db->query($query);
@@ -160,22 +193,31 @@  discard block
 block discarded – undo
160 193
 		}
161 194
 		if($results->rowCount()>0) {
162 195
 		    return true; 
196
+		} else {
197
+			return false;
163 198
 		}
164
-		else return false;
165 199
 	}
166 200
 
167 201
 	public function connectionExists()
168 202
 	{
169 203
 		global $globalDBdriver, $globalDBCheckConnection, $globalNoDB;
170
-		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true;
171
-		if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
204
+		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) {
205
+			return true;
206
+		}
207
+		if (isset($globalNoDB) && $globalNoDB === TRUE) {
208
+			return true;
209
+		}
172 210
 		$query = "SELECT 1 + 1";
173
-		if ($this->db === null) return false;
211
+		if ($this->db === null) {
212
+			return false;
213
+		}
174 214
 		try {
175 215
 			$sum = @$this->db->query($query);
176 216
 			if ($sum instanceof \PDOStatement) {
177 217
 				$sum = $sum->fetchColumn(0);
178
-			} else $sum = 0;
218
+			} else {
219
+				$sum = 0;
220
+			}
179 221
 			if (intval($sum) !== 2) {
180 222
 			     return false;
181 223
 			}
@@ -210,8 +252,9 @@  discard block
 block discarded – undo
210 252
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
211 253
 		if($nb[0]['nb'] > 0) {
212 254
 			return true; 
255
+		} else {
256
+			return false;
213 257
 		}
214
-		else return false;
215 258
 	}
216 259
 
217 260
 	/*
@@ -261,9 +304,12 @@  discard block
 block discarded – undo
261 304
 			}
262 305
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
263 306
 			$sth->closeCursor();
264
-			if ($result['nb'] > 0) return true;
265
-			else return false;
266
-/*		} else {
307
+			if ($result['nb'] > 0) {
308
+				return true;
309
+			} else {
310
+				return false;
311
+			}
312
+			/*		} else {
267 313
 			$query = "SELECT * FROM ".$table." LIMIT 0";
268 314
 			try {
269 315
 				$results = $this->db->query($query);
@@ -302,7 +348,9 @@  discard block
 block discarded – undo
302 348
 				$sth->closeCursor();
303 349
 				return $result['value'];
304 350
 			}
305
-		} else return $version;
351
+		} else {
352
+			return $version;
353
+		}
306 354
 	}
307 355
 	
308 356
 	/*
@@ -311,9 +359,14 @@  discard block
 block discarded – undo
311 359
 	*/
312 360
 	public function latest() {
313 361
 	    global $globalNoDB;
314
-	    if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
315
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
316
-	    else return false;
362
+	    if (isset($globalNoDB) && $globalNoDB === TRUE) {
363
+	    	return true;
364
+	    }
365
+	    if ($this->check_schema_version() == $this->latest_schema) {
366
+	    	return true;
367
+	    } else {
368
+	    	return false;
369
+	    }
317 370
 	}
318 371
 
319 372
 }
Please login to merge, or discard this patch.
airline.php 1 patch
Braces   +27 added lines, -9 removed lines patch added patch discarded remove patch
@@ -33,7 +33,9 @@  discard block
 block discarded – undo
33 33
 			if (file_exists('images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png'))
34 34
 			{
35 35
 				print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> ';
36
-			} else print $alliance['alliance'];
36
+			} else {
37
+				print $alliance['alliance'];
38
+			}
37 39
 			print '</a>';
38 40
 			print '</div>';
39 41
 		}
@@ -42,13 +44,21 @@  discard block
 block discarded – undo
42 44
 	}
43 45
 	print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">';
44 46
 	print '<option value="all"';
45
-	if ($airline_type == 'all') print 'selected="selected" ';
47
+	if ($airline_type == 'all') {
48
+		print 'selected="selected" ';
49
+	}
46 50
 	print '>'._("All").'</option><option value="passenger"';
47
-	if ($airline_type == 'passenger') print 'selected="selected" ';
51
+	if ($airline_type == 'passenger') {
52
+		print 'selected="selected" ';
53
+	}
48 54
 	print '>'._("Passenger").'</option><option value="cargo"';
49
-	if ($airline_type == 'cargo') print 'selected="selected" ';
55
+	if ($airline_type == 'cargo') {
56
+		print 'selected="selected" ';
57
+	}
50 58
 	print '>'._("Cargo").'</option><option value="military"';
51
-	if ($airline_type == 'military') print 'selected="selected" ';
59
+	if ($airline_type == 'military') {
60
+		print 'selected="selected" ';
61
+	}
52 62
 	print '>'._("Military").'</option></select>';
53 63
 	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>';
54 64
 
@@ -75,7 +85,9 @@  discard block
 block discarded – undo
75 85
 		$firstLetter = strtoupper($Common->replace_mb_substr($value['airline_name'], 0, 1));
76 86
 		if($previous !== $firstLetter)
77 87
 		{
78
-			if ($previous !== null) print ' | ';
88
+			if ($previous !== null) {
89
+				print ' | ';
90
+			}
79 91
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
80 92
 		}
81 93
 		$previous = $firstLetter;
@@ -88,7 +100,9 @@  discard block
 block discarded – undo
88 100
 		{
89 101
 			if($previous !== $firstLetter)
90 102
 			{
91
-				if ($previous !== null) print '</div>';
103
+				if ($previous !== null) {
104
+					print '</div>';
105
+				}
92 106
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
93 107
 			}
94 108
 			$previous = $firstLetter;
@@ -102,10 +116,14 @@  discard block
 block discarded – undo
102 116
 			} elseif (file_exists('images/airlines/'.$value['airline_icao'].'.png'))
103 117
 			{
104 118
 				print '<img src="'.$globalURL.'/images/airlines/'.$value['airline_icao'].'.png" alt="'._("Click to see airline activity").'" title="'._("Click to see airline activity").'" /> ';
105
-				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
119
+				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) {
120
+					print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
121
+				}
106 122
 			} else {
107 123
 				print $value['airline_name'];
108
-				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
124
+				if (isset($value['ban_eu']) && $value['ban_eu'] == 1) {
125
+					print '<img src="'.$globalURL.'/images/baneu.png" alt="'._("Banned in Europe").'" title="'._("Banned in Europe").'" /> ';
126
+				}
109 127
 			}
110 128
 			print '</a>';
111 129
 			print '</div>';
Please login to merge, or discard this patch.
getImages.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -105,8 +105,11 @@
 block discarded – undo
105 105
     } elseif (isset($_GET['satellite'])) {
106 106
         readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/satellites/'.$filename);
107 107
     } else {
108
-        if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
109
-	else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
108
+        if ($color == 'FF0000') {
109
+        	readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename);
110
+        } else {
111
+		readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename);
112
+	}
110 113
     }
111 114
 }
112 115
 ?>
113 116
\ No newline at end of file
Please login to merge, or discard this patch.
js/map-aircraft.2d.js.php 1 patch
Braces   +66 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,11 +3,18 @@  discard block
 block discarded – undo
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5 5
 // Compressed GeoJson is used if true
6
-if (!isset($globalJsonCompress)) $compress = true;
7
-else $compress = $globalJsonCompress;
6
+if (!isset($globalJsonCompress)) {
7
+	$compress = true;
8
+} else {
9
+	$compress = $globalJsonCompress;
10
+}
8 11
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
12
+if (isset($_GET['ident'])) {
13
+	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+}
15
+if (isset($_GET['flightaware_id'])) {
16
+	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
17
+}
11 18
 ?>
12 19
 
13 20
 
@@ -72,9 +79,12 @@  discard block
 block discarded – undo
72 79
 
73 80
 function update_airportsLayer() {
74 81
 <?php
75
-	if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
76
-	else $getZoom = '7';
77
-?>
82
+	if (isset($_COOKIE['AirportZoom'])) {
83
+		$getZoom = $_COOKIE['AirportZoom'];
84
+	} else {
85
+		$getZoom = '7';
86
+	}
87
+	?>
78 88
 	if (typeof airportsLayer != 'undefined') {
79 89
 		if (map.hasLayer(airportsLayer) == true) {
80 90
 			map.removeLayer(airportsLayer);
@@ -320,9 +330,13 @@  discard block
 block discarded – undo
320 330
 					if (callsign != ""){ markerLabel += callsign; }
321 331
 					if (departure_airport_code != "" && arrival_airport_code != "" && departure_airport_code != "NA" && arrival_airport_code != "NA"){ markerLabel += ' ( '+departure_airport_code+' - '+arrival_airport_code+' )'; }
322 332
 <?php
323
-	if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
324
-	elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
325
-	else $IconColor = '1a3151';
333
+	if (isset($_COOKIE['IconColor'])) {
334
+		$IconColor = $_COOKIE['IconColor'];
335
+	} elseif (isset($globalAircraftIconColor)) {
336
+		$IconColor = $globalAircraftIconColor;
337
+	} else {
338
+		$IconColor = '1a3151';
339
+	}
326 340
 	if (!isset($ident) && !isset($flightaware_id)) {
327 341
 ?>
328 342
 					//info_update(feature.properties.fc);
@@ -370,7 +384,12 @@  discard block
 block discarded – undo
370 384
 <?php
371 385
 		} else {
372 386
 ?>
373
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
387
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
388
+	print $archiveupdatetime*1000;
389
+} else {
390
+	print $globalMapRefresh*1000+20000;
391
+}
392
+?>+feature.properties.sqt*1000);
374 393
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
375 394
 <?php
376 395
 		}
@@ -419,7 +438,12 @@  discard block
 block discarded – undo
419 438
 <?php
420 439
 		} else {
421 440
 ?>
422
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
441
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
442
+	print $archiveupdatetime*1000;
443
+} else {
444
+	print $globalMapRefresh*1000+20000;
445
+}
446
+?>+feature.properties.sqt*1000);
423 447
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
424 448
 <?php
425 449
 		}
@@ -466,7 +490,12 @@  discard block
 block discarded – undo
466 490
 <?php
467 491
 		} else {
468 492
 ?>
469
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
493
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
494
+	print $archiveupdatetime*1000;
495
+} else {
496
+	print $globalMapRefresh*1000+20000;
497
+}
498
+?>+feature.properties.sqt*1000);
470 499
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
471 500
 <?php
472 501
 		}
@@ -820,13 +849,23 @@  discard block
 block discarded – undo
820 849
 	if (isset($archive) && $archive) {
821 850
 ?>
822 851
 	//then load it again every 30 seconds
823
-	//  var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
852
+	//  var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
853
+	print ($globalMapRefresh*1000)/2;
854
+} else {
855
+	print '15000';
856
+}
857
+?>);
824 858
 	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php print $archiveupdatetime*1000; ?>);
825 859
 <?php
826 860
 	} else {
827 861
 ?>
828 862
 	//then load it again every 30 seconds
829
-	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
863
+	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
864
+	print $globalMapRefresh*1000;
865
+} else {
866
+	print '30000';
867
+}
868
+?>);
830 869
 	var currentdate = new Date();
831 870
 	var currentyear = new Date().getFullYear();
832 871
 	var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0));
@@ -838,7 +877,12 @@  discard block
 block discarded – undo
838 877
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
839 878
 ?>
840 879
 	update_polarLayer();
841
-	setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
880
+	setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
881
+	print $globalMapRefresh*1000*2;
882
+} else {
883
+	print '60000';
884
+}
885
+?>);
842 886
 <?php
843 887
 		}
844 888
 ?>
@@ -853,7 +897,12 @@  discard block
 block discarded – undo
853 897
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
854 898
 ?>
855 899
 	update_atcLayer();
856
-	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
900
+	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
901
+	print $globalMapRefresh*1000*2;
902
+} else {
903
+	print '60000';
904
+}
905
+?>);
857 906
 <?php
858 907
 	}
859 908
 ?>
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 1 patch
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 ?>
11 14
 
12 15
 
@@ -156,9 +159,13 @@  discard block
 block discarded – undo
156 159
 		    if (callsign != ""){ markerMarineLabel += callsign; }
157 160
 		    if (type != ""){ markerMarineLabel += ' - '+type; }
158 161
 <?php
159
-	if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor'];
160
-	elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor;
161
-	else $MarineIconColor = '1a3151';
162
+	if (isset($_COOKIE['MarineIconColor'])) {
163
+		$MarineIconColor = $_COOKIE['MarineIconColor'];
164
+	} elseif (isset($globalMarineIconColor)) {
165
+		$MarineIconColor = $globalMarineIconColor;
166
+	} else {
167
+		$MarineIconColor = '1a3151';
168
+	}
162 169
 	if (!isset($ident) && !isset($fammarine_id)) {
163 170
 ?>
164 171
 		    //info_marine_update(feature.properties.fc);
@@ -193,7 +200,12 @@  discard block
 block discarded – undo
193 200
 <?php
194 201
 		} else {
195 202
 ?>
196
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
203
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
204
+	print $archiveupdatetime*1000;
205
+} else {
206
+	print $globalMapRefresh*1000+20000;
207
+}
208
+?>+feature.properties.sqt*1000);
197 209
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
198 210
 <?php
199 211
 		}
@@ -249,7 +261,12 @@  discard block
 block discarded – undo
249 261
 <?php
250 262
 		} else {
251 263
 ?>
252
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
264
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
265
+	print $archiveupdatetime*1000;
266
+} else {
267
+	print $globalMapRefresh*1000+20000;
268
+}
269
+?>+feature.properties.sqt*1000);
253 270
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
254 271
 <?php
255 272
 		}
@@ -304,7 +321,12 @@  discard block
 block discarded – undo
304 321
 <?php
305 322
 		} else {
306 323
 ?>
307
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
324
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
325
+	print $archiveupdatetime*1000;
326
+} else {
327
+	print $globalMapRefresh*1000+20000;
328
+}
329
+?>+feature.properties.sqt*1000);
308 330
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
309 331
 <?php
310 332
 		}
@@ -594,14 +616,24 @@  discard block
 block discarded – undo
594 616
 	if (isset($archive) && $archive) {
595 617
 ?>
596 618
 //then load it again every 30 seconds
597
-//  var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
619
+//  var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
620
+	print ($globalMapRefresh*1000)/2;
621
+} else {
622
+	print '15000';
623
+}
624
+?>);
598 625
 reloadMarinePage = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php print $archiveupdatetime*1000; ?>);
599 626
 <?php
600 627
 	} else {
601 628
 ?>
602 629
 //then load it again every 30 seconds
603 630
 reloadMarinePage = setInterval(
604
-    function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
631
+    function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
632
+	print $globalMapRefresh*1000;
633
+} else {
634
+	print '30000';
635
+}
636
+?>);
605 637
 <?php
606 638
 	}
607 639
 ?>
Please login to merge, or discard this patch.
js/map-tracker.2d.js.php 1 patch
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 ?>
11 14
 
12 15
 
@@ -157,9 +160,13 @@  discard block
 block discarded – undo
157 160
 		    if (callsign != ""){ markerTrackerLabel += callsign; }
158 161
 		    if (type != ""){ markerTrackerLabel += ' - '+type; }
159 162
 <?php
160
-	if (isset($_COOKIE['TrackerIconColor'])) $IconColor = $_COOKIE['TrackerIconColor'];
161
-	elseif (isset($globalTrackerIconColor)) $IconColor = $globalTrackerIconColor;
162
-	else $IconColor = '1a3151';
163
+	if (isset($_COOKIE['TrackerIconColor'])) {
164
+		$IconColor = $_COOKIE['TrackerIconColor'];
165
+	} elseif (isset($globalTrackerIconColor)) {
166
+		$IconColor = $globalTrackerIconColor;
167
+	} else {
168
+		$IconColor = '1a3151';
169
+	}
163 170
 	if (!isset($ident) && !isset($famtrackid)) {
164 171
 ?>
165 172
 		    //info_tracker_update(feature.properties.fc);
@@ -193,7 +200,12 @@  discard block
 block discarded – undo
193 200
 <?php
194 201
 		} else {
195 202
 ?>
196
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
203
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
204
+	print $archiveupdatetime*1000;
205
+} else {
206
+	print $globalMapRefresh*1000+20000;
207
+}
208
+?>+feature.properties.sqt*1000);
197 209
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
198 210
 <?php
199 211
 		}
@@ -249,7 +261,12 @@  discard block
 block discarded – undo
249 261
 <?php
250 262
 		} else {
251 263
 ?>
252
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
264
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
265
+	print $archiveupdatetime*1000;
266
+} else {
267
+	print $globalMapRefresh*1000+20000;
268
+}
269
+?>+feature.properties.sqt*1000);
253 270
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
254 271
 <?php
255 272
 		}
@@ -304,7 +321,12 @@  discard block
 block discarded – undo
304 321
 <?php
305 322
 		} else {
306 323
 ?>
307
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
324
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
325
+	print $archiveupdatetime*1000;
326
+} else {
327
+	print $globalMapRefresh*1000+20000;
328
+}
329
+?>+feature.properties.sqt*1000);
308 330
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
309 331
 <?php
310 332
 		}
@@ -595,14 +617,24 @@  discard block
 block discarded – undo
595 617
 	if (isset($archive) && $archive) {
596 618
 ?>
597 619
 //then load it again every 30 seconds
598
-//  var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
620
+//  var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
621
+	print ($globalMapRefresh*1000)/2;
622
+} else {
623
+	print '15000';
624
+}
625
+?>);
599 626
 reloadTrackerPage = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php print $archiveupdatetime*1000; ?>);
600 627
 <?php
601 628
 	} else {
602 629
 ?>
603 630
 //then load it again every 30 seconds
604 631
 reloadTrackerPage = setInterval(
605
-    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
632
+    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
633
+	print $globalMapRefresh*1000;
634
+} else {
635
+	print '30000';
636
+}
637
+?>);
606 638
 <?php
607 639
 	}
608 640
 ?>
Please login to merge, or discard this patch.
install/install-action.php 1 patch
Braces   +77 added lines, -27 removed lines patch added patch discarded remove patch
@@ -74,7 +74,9 @@  discard block
 block discarded – undo
74 74
 	if ($error != '') {
75 75
 		$_SESSION['error'] = $error;
76 76
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database'));
77
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database'));
77
+	} else {
78
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Create database'));
79
+	}
78 80
 	$_SESSION['install'] = 'database_import';
79 81
 	$_SESSION['next'] = 'Create and import tables';
80 82
 	$result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -89,7 +91,9 @@  discard block
 block discarded – undo
89 91
 		if ($error != '') {
90 92
 			$_SESSION['error'] = $error;
91 93
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables'));
92
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables'));
94
+		} else {
95
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables'));
96
+		}
93 97
 		if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) {
94 98
 			$_SESSION['install'] = 'populate';
95 99
 			$_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B';
@@ -104,7 +108,9 @@  discard block
 block discarded – undo
104 108
 		if ($error != '') {
105 109
 			$_SESSION['error'] = $error;
106 110
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed'));
107
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed'));
111
+		} else {
112
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed'));
113
+		}
108 114
 		$_SESSION['install'] = 'sources';
109 115
 		$_SESSION['next'] = 'Insert data in source table';
110 116
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -117,7 +123,9 @@  discard block
 block discarded – undo
117 123
 	if ($error != '') {
118 124
 		$_SESSION['error'] = $error;
119 125
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database'));
120
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database'));
126
+	} else {
127
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database'));
128
+	}
121 129
 	$_SESSION['install'] = 'airspace';
122 130
 	$_SESSION['next'] = 'Populate airspace table';
123 131
 	$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -129,7 +137,9 @@  discard block
 block discarded – undo
129 137
 	if ($error != '') {
130 138
 		$_SESSION['error'] = $error;
131 139
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate airspace database'));
132
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate airspace database'));
140
+	} else {
141
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate airspace database'));
142
+	}
133 143
 	$_SESSION['install'] = 'countries';
134 144
 	$_SESSION['next'] = 'Populate countries table';
135 145
 	$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -141,7 +151,9 @@  discard block
 block discarded – undo
141 151
 	if ($error != '') {
142 152
 		$_SESSION['error'] = $error;
143 153
 		$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database'));
144
-	} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
154
+	} else {
155
+		$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database'));
156
+	}
145 157
 	if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') {
146 158
 	    $_SESSION['install'] = 'notam';
147 159
 	    $_SESSION['next'] = 'Populate NOTAM table with externals data';
@@ -173,7 +185,9 @@  discard block
 block discarded – undo
173 185
 		if ($error != '') {
174 186
 			$_SESSION['error'] = $error;
175 187
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B'));
176
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B'));
188
+		} else {
189
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B'));
190
+		}
177 191
 		$_SESSION['install'] = 'populate_flarm';
178 192
 		$_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM';
179 193
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -194,18 +208,26 @@  discard block
 block discarded – undo
194 208
 		if ($error != '') {
195 209
 			$_SESSION['error'] = $error;
196 210
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM'));
197
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM'));
211
+		} else {
212
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM'));
213
+		}
198 214
 		if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
199 215
 			$_SESSION['install'] = 'vatsim';
200
-			if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
201
-			else $_SESSION['next'] = 'Insert VATSIM data';
216
+			if (file_exists('tmp/ivae_feb2013.zip')) {
217
+				$_SESSION['next'] = 'Insert IVAO data';
218
+			} else {
219
+				$_SESSION['next'] = 'Insert VATSIM data';
220
+			}
202 221
 		} elseif (isset($globalVATSIM) && $globalVATSIM) {
203 222
 			$_SESSION['install'] = 'vatsim';
204 223
 			$_SESSION['next'] = 'Insert VATSIM data';
205 224
 		} elseif (isset($globalIVAO) && $globalIVAO) {
206 225
 			$_SESSION['install'] = 'vatsim';
207
-			if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
208
-			else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
226
+			if (file_exists('tmp/ivae_feb2013.zip')) {
227
+				$_SESSION['next'] = 'Insert IVAO data';
228
+			} else {
229
+				$_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
230
+			}
209 231
 		} elseif (isset($globalphpVMS) && $globalphpVMS) {
210 232
 			$_SESSION['install'] = 'vatsim';
211 233
 			$_SESSION['next'] = 'Insert phpVMS data';
@@ -230,7 +252,9 @@  discard block
 block discarded – undo
230 252
 		if ($error != '') {
231 253
 			$_SESSION['error'] = $error;
232 254
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data'));
233
-		} else 	$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data'));
255
+		} else {
256
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data'));
257
+		}
234 258
 		$_SESSION['install'] = 'translation';
235 259
 		$_SESSION['next'] = 'Populate translation table with externals data';
236 260
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -250,7 +274,9 @@  discard block
 block discarded – undo
250 274
 		if ($error != '') {
251 275
 			$_SESSION['error'] = $error;
252 276
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data'));
253
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data'));
277
+		} else {
278
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data'));
279
+		}
254 280
 		if ($_SESSION['waypoints'] == 1) {
255 281
 			$_SESSION['install'] = 'waypoints';
256 282
 			$_SESSION['next'] = 'Populate waypoints table';
@@ -283,7 +309,9 @@  discard block
 block discarded – undo
283 309
 		if ($error != '') {
284 310
 			$_SESSION['error'] = $error;
285 311
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data'));
286
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data'));
312
+		} else {
313
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data'));
314
+		}
287 315
 		$_SESSION['install'] = 'sources';
288 316
 		$_SESSION['next'] = 'Insert data in source table';
289 317
 		$result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']);
@@ -304,12 +332,16 @@  discard block
 block discarded – undo
304 332
 			if ($error != '') {
305 333
 				$_SESSION['error'] = $error;
306 334
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data'));
307
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data'));
335
+			} else {
336
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data'));
337
+			}
308 338
 		} else {
309 339
 			if ($error != '') {
310 340
 				$_SESSION['error'] = $error;
311 341
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)'));
312
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)'));
342
+			} else {
343
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)'));
344
+			}
313 345
 		}
314 346
 		if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) {
315 347
 			$_SESSION['install'] = 'owner';
@@ -357,7 +389,9 @@  discard block
 block discarded – undo
357 389
 		$Source = new Source();
358 390
 		$Source->deleteAllLocation();
359 391
 		foreach ($sources as $src) {
360
-			if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png');
392
+			if (isset($src['latitude']) && $src['latitude'] != '') {
393
+				$Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png');
394
+			}
361 395
 		}
362 396
 		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table'));
363 397
 		unset($_SESSION['sources']);
@@ -368,15 +402,21 @@  discard block
 block discarded – undo
368 402
 	*/
369 403
 	if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) {
370 404
 		$_SESSION['install'] = 'vatsim';
371
-		if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
372
-		else $_SESSION['next'] = 'Insert VATSIM data';
405
+		if (file_exists('tmp/ivae_feb2013.zip')) {
406
+			$_SESSION['next'] = 'Insert IVAO data';
407
+		} else {
408
+			$_SESSION['next'] = 'Insert VATSIM data';
409
+		}
373 410
 	} elseif (isset($globalVATSIM) && $globalVATSIM) {
374 411
 		$_SESSION['install'] = 'vatsim';
375 412
 		$_SESSION['next'] = 'Insert VATSIM data';
376 413
 	} elseif (isset($globalIVAO) && $globalIVAO) {
377 414
 		$_SESSION['install'] = 'vatsim';
378
-		if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data';
379
-		else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
415
+		if (file_exists('tmp/ivae_feb2013.zip')) {
416
+			$_SESSION['next'] = 'Insert IVAO data';
417
+		} else {
418
+			$_SESSION['next'] = 'Insert VATSIM data (IVAO not found)';
419
+		}
380 420
 	} elseif (isset($globalphpVMS) && $globalphpVMS) {
381 421
 		$_SESSION['install'] = 'vatsim';
382 422
 		$_SESSION['next'] = 'Insert phpVMS data';
@@ -397,33 +437,43 @@  discard block
 block discarded – undo
397 437
 			if ($error != '') {
398 438
 				$_SESSION['error'] = $error;
399 439
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data'));
400
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
440
+			} else {
441
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
442
+			}
401 443
 		} else {
402 444
 			$error .= update_db::update_vatsim();
403 445
 			if ($error != '') {
404 446
 				$_SESSION['error'] = $error;
405 447
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data'));
406
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
448
+			} else {
449
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
450
+			}
407 451
 		}
408 452
 	} elseif (isset($globalVATSIM) && $globalVATSIM) {
409 453
 		$error .= update_db::update_vatsim();
410 454
 		if ($error != '') {
411 455
 			$_SESSION['error'] = $error;
412 456
 			$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data'));
413
-		} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
457
+		} else {
458
+			$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data'));
459
+		}
414 460
 	} elseif (isset($globalIVAO) && $globalIVAO) {
415 461
 		if (file_exists('tmp/ivae_feb2013.zip')) {
416 462
 			$error .= update_db::update_IVAO();
417 463
 			if ($error != '') {
418 464
 				$_SESSION['error'] = $error;
419 465
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data'));
420
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
466
+			} else {
467
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data'));
468
+			}
421 469
 		} else {
422 470
 			$error .= update_db::update_vatsim();
423 471
 			if ($error != '') {
424 472
 				$_SESSION['error'] = $error;
425 473
 				$_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)'));
426
-			} else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)'));
474
+			} else {
475
+				$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)'));
476
+			}
427 477
 		}
428 478
 	} elseif (isset($globalphpVMS) && $globalphpVMS) {
429 479
 		$_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data'));
Please login to merge, or discard this patch.
install/class.create_db.php 1 patch
Braces   +25 added lines, -9 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
 	public static function import_file($filename) {
11 11
 		$filename = filter_var($filename,FILTER_SANITIZE_STRING);
12 12
 		$Connection = new Connection();
13
-		if (!$Connection->connectionExists()) return 'error: DB connection failed';
13
+		if (!$Connection->connectionExists()) {
14
+			return 'error: DB connection failed';
15
+		}
14 16
 		//Connection::$db->beginTransaction();
15 17
 		$templine = '';
16 18
 		$handle = @fopen($filename,"r");
@@ -19,7 +21,9 @@  discard block
 block discarded – undo
19 21
 			//foreach ($lines as $line)
20 22
 			while (($line = fgets($handle,4096)) !== false)
21 23
 			{
22
-				if (substr($line,0,2) == '--' || $line == '') continue;
24
+				if (substr($line,0,2) == '--' || $line == '') {
25
+					continue;
26
+				}
23 27
 				$templine .= $line;
24 28
 				if (substr(trim($line), -1,1) == ';')
25 29
 				{
@@ -45,7 +49,9 @@  discard block
 block discarded – undo
45 49
 		//foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename)
46 50
 		while(false !== ($filename = readdir($dh)))
47 51
 		{
48
-			if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename);
52
+			if (preg_match('/\.sql$/',$filename)) {
53
+				$error .= create_db::import_file($directory.$filename);
54
+			}
49 55
 		}
50 56
 		return $error;
51 57
 	}
@@ -58,19 +64,29 @@  discard block
 block discarded – undo
58 64
 		$db = filter_var($db,FILTER_SANITIZE_STRING);
59 65
 		$db_type = filter_var($db_type,FILTER_SANITIZE_STRING);
60 66
 		$host = filter_var($host,FILTER_SANITIZE_STRING);
61
-		if ($db_type == 'mysql' && $port == '') $port = 3306;
62
-		elseif ($port == '') $port = 5432;
67
+		if ($db_type == 'mysql' && $port == '') {
68
+			$port = 3306;
69
+		} elseif ($port == '') {
70
+			$port = 5432;
71
+		}
63 72
 		// Dirty hack
64 73
 		if ($host != 'localhost' && $host != '127.0.0.1') {
65 74
 			$grantright = $_SERVER['SERVER_ADDR'];
66
-		} else $grantright = 'localhost';
75
+		} else {
76
+			$grantright = 'localhost';
77
+		}
67 78
 		try {
68
-			if ($host == 'localhost') $dbh = new PDO($db_type.':host=127.0.0.1',$root,$root_pass);
69
-			else $dbh = new PDO($db_type.':host='.$host.';port='.$port,$root,$root_pass);
79
+			if ($host == 'localhost') {
80
+				$dbh = new PDO($db_type.':host=127.0.0.1',$root,$root_pass);
81
+			} else {
82
+				$dbh = new PDO($db_type.':host='.$host.';port='.$port,$root,$root_pass);
83
+			}
70 84
 			$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
71 85
 			if ($db_type == 'mysql') {
72 86
 				$dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
73
-				if ($grantright == 'localhost') $dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
87
+				if ($grantright == 'localhost') {
88
+					$dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
89
+				}
74 90
 			} else if ($db_type == 'pgsql') {
75 91
 				$dbh->exec("CREATE DATABASE ".$db.";");
76 92
 				$dbh->exec("CREATE USER ".$user." WITH PASSWORD '".$password."';
Please login to merge, or discard this patch.
require/class.Satellite.php 1 patch
Braces   +63 added lines, -23 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 	public function __construct($dbc = null) {
13 13
 		$Connection = new Connection($dbc);
14 14
 		$this->db = $Connection->db();
15
-		if ($this->db === null) die('Error: No DB connection.');
15
+		if ($this->db === null) {
16
+			die('Error: No DB connection.');
17
+		}
16 18
 	}
17 19
 
18 20
 	public function get_tle($name) {
@@ -24,8 +26,11 @@  discard block
 block discarded – undo
24 26
 			echo $e->getMessage();
25 27
 		}
26 28
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
27
-		if (isset($result[0])) return $result[0];
28
-		else return array();
29
+		if (isset($result[0])) {
30
+			return $result[0];
31
+		} else {
32
+			return array();
33
+		}
29 34
 	}
30 35
 	public function get_tle_types() {
31 36
 		$query = 'SELECT DISTINCT tle_type FROM tle ORDER BY tle_type';
@@ -36,8 +41,11 @@  discard block
 block discarded – undo
36 41
 			echo $e->getMessage();
37 42
 		}
38 43
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
39
-		if (isset($result[0])) return $result;
40
-		else return array();
44
+		if (isset($result[0])) {
45
+			return $result;
46
+		} else {
47
+			return array();
48
+		}
41 49
 	}
42 50
 	public function get_tle_names() {
43 51
 		$query = 'SELECT DISTINCT tle_name, tle_type FROM tle';
@@ -48,8 +56,11 @@  discard block
 block discarded – undo
48 56
 			echo $e->getMessage();
49 57
 		}
50 58
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
51
-		if (isset($result[0])) return $result;
52
-		else return array();
59
+		if (isset($result[0])) {
60
+			return $result;
61
+		} else {
62
+			return array();
63
+		}
53 64
 	}
54 65
 	public function get_tle_names_type($type) {
55 66
 		$query = 'SELECT tle_name, tle_type FROM tle WHERE tle_type = :type ORDER BY tle_name';
@@ -60,8 +71,11 @@  discard block
 block discarded – undo
60 71
 			echo $e->getMessage();
61 72
 		}
62 73
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
63
-		if (isset($result[0])) return $result;
64
-		else return array();
74
+		if (isset($result[0])) {
75
+			return $result;
76
+		} else {
77
+			return array();
78
+		}
65 79
 	}
66 80
 	
67 81
 	public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) {
@@ -79,8 +93,11 @@  discard block
 block discarded – undo
79 93
 		$result = array();
80 94
 		foreach ($all_sat as $sat) {
81 95
 			$position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second);
82
-			if (isset($position[0])) $result = array_merge($position,$result);
83
-			else $result[] = $position;
96
+			if (isset($position[0])) {
97
+				$result = array_merge($position,$result);
98
+			} else {
99
+				$result[] = $position;
100
+			}
84 101
 		}
85 102
 		return $result;
86 103
 	}
@@ -96,7 +113,9 @@  discard block
 block discarded – undo
96 113
 		$sat = new Predict_Sat($tle);
97 114
 		$predict = new Predict();
98 115
 		//if ($timestamp == '') $now = Predict_Time::get_current_daynum();
99
-		if ($timestamp_begin == '') $timestamp_begin = time();
116
+		if ($timestamp_begin == '') {
117
+			$timestamp_begin = time();
118
+		}
100 119
 		if ($timestamp_end == '') {
101 120
 			$now = Predict_Time::unix2daynum($timestamp_begin);
102 121
 			$predict->predict_calc($sat,$qth,$now);
@@ -121,8 +140,11 @@  discard block
 block discarded – undo
121 140
 			echo $e->getMessage();
122 141
 		}
123 142
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
124
-		if (isset($result[0])) return $result[0];
125
-		else return array();
143
+		if (isset($result[0])) {
144
+			return $result[0];
145
+		} else {
146
+			return array();
147
+		}
126 148
 	}
127 149
 
128 150
 	/**
@@ -140,7 +162,9 @@  discard block
 block discarded – undo
140 162
 		    FROM satellite".$filter_query." satellite.launch_site <> '' AND satellite.launch_site IS NOT NULL";
141 163
 		$query_values = array();
142 164
 		$query .= " GROUP BY satellite.launch_site ORDER BY launch_site_count DESC";
143
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
165
+		if ($limit) {
166
+			$query .= " LIMIT 10 OFFSET 0";
167
+		}
144 168
 		$sth = $this->db->prepare($query);
145 169
 		$sth->execute($query_values);
146 170
 		$launch_site_array = array();
@@ -169,7 +193,9 @@  discard block
 block discarded – undo
169 193
 		    FROM satellite".$filter_query." satellite.owner <> '' AND satellite.owner IS NOT NULL";
170 194
 		$query_values = array();
171 195
 		$query .= " GROUP BY satellite.owner ORDER BY owner_count DESC";
172
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
196
+		if ($limit) {
197
+			$query .= " LIMIT 10 OFFSET 0";
198
+		}
173 199
 		$sth = $this->db->prepare($query);
174 200
 		$sth->execute($query_values);
175 201
 		$owner_array = array();
@@ -198,7 +224,9 @@  discard block
 block discarded – undo
198 224
 		    FROM satellite".$filter_query." satellite.country_owner <> '' AND satellite.country_owner IS NOT NULL";
199 225
 		$query_values = array();
200 226
 		$query .= " GROUP BY satellite.country_owner ORDER BY country_count DESC";
201
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
227
+		if ($limit) {
228
+			$query .= " LIMIT 10 OFFSET 0";
229
+		}
202 230
 		$sth = $this->db->prepare($query);
203 231
 		$sth->execute($query_values);
204 232
 		$owner_array = array();
@@ -225,20 +253,26 @@  discard block
 block discarded – undo
225 253
 			date_default_timezone_set($globalTimezone);
226 254
 			$datetime = new DateTime();
227 255
 			$offset = $datetime->format('P');
228
-		} else $offset = '+00:00';
256
+		} else {
257
+			$offset = '+00:00';
258
+		}
229 259
 		//$filter_query = $this->getFilter($filters,true,true);
230 260
 		$filter_query = ' WHERE';
231 261
 		if ($globalDBdriver == 'mysql') {
232 262
 			$query  = "SELECT MONTH(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS year_name, count(*) as date_count
233 263
 				FROM satellite".$filter_query." satellite.launch_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
234
-			if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'";
264
+			if ($sincedate != '') {
265
+				$query .= " AND satellite.launch_date > '".$sincedate."'";
266
+			}
235 267
 			$query .= " GROUP BY year_name, month_name
236 268
 				ORDER BY year_name, month_name ASC";
237 269
 			$query_data = array(':offset' => $offset);
238 270
 		} else {
239 271
 			$query  = "SELECT EXTRACT(MONTH FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS month_name, EXTRACT(YEAR FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS year_name, count(*) as date_count
240 272
 				FROM satellite".$filter_query." satellite.launch_date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 YEARS'";
241
-			if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'";
273
+			if ($sincedate != '') {
274
+				$query .= " AND satellite.launch_date > '".$sincedate."'";
275
+			}
242 276
 			$query .= " GROUP BY year_name, month_name
243 277
 				ORDER BY year_name, month_name ASC";
244 278
 			$query_data = array(':offset' => $offset);
@@ -270,20 +304,26 @@  discard block
 block discarded – undo
270 304
 			date_default_timezone_set($globalTimezone);
271 305
 			$datetime = new DateTime();
272 306
 			$offset = $datetime->format('P');
273
-		} else $offset = '+00:00';
307
+		} else {
308
+			$offset = '+00:00';
309
+		}
274 310
 		//$filter_query = $this->getFilter($filters,true,true);
275 311
 		$filter_query = ' WHERE';
276 312
 		if ($globalDBdriver == 'mysql') {
277 313
 			$query  = "SELECT YEAR(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS year_name, count(*) as date_count
278 314
 				FROM satellite".$filter_query." satellite.launch_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 YEAR)";
279
-			if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'";
315
+			if ($sincedate != '') {
316
+				$query .= " AND satellite.launch_date > '".$sincedate."'";
317
+			}
280 318
 			$query .= " GROUP BY year_name
281 319
 				ORDER BY year_name ASC";
282 320
 			$query_data = array(':offset' => $offset);
283 321
 		} else {
284 322
 			$query  = "SELECT EXTRACT(YEAR FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS year_name, count(*) as date_count
285 323
 				FROM satellite".$filter_query." satellite.launch_date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '10 YEARS'";
286
-			if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'";
324
+			if ($sincedate != '') {
325
+				$query .= " AND satellite.launch_date > '".$sincedate."'";
326
+			}
287 327
 			$query .= " GROUP BY year_name
288 328
 				ORDER BY year_name ASC";
289 329
 			$query_data = array(':offset' => $offset);
Please login to merge, or discard this patch.