Completed
Push — master ( 637022...8149d9 )
by Yannick
55:10 queued 27:13
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.
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/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.
js/map-satellite.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
 $compress = false;
11 14
 ?>
12 15
 
@@ -159,9 +162,13 @@  discard block
 block discarded – undo
159 162
 		    if (callsign != ""){ markerSatelliteLabel += callsign; }
160 163
 		    if (type != ""){ markerSatelliteLabel += ' - '+type; }
161 164
 <?php
162
-	if (isset($_COOKIE['SatelliteIconColor'])) $IconColor = $_COOKIE['SatelliteIconColor'];
163
-	elseif (isset($globalSatelliteIconColor)) $IconColor = $globalSatelliteIconColor;
164
-	else $IconColor = '1a3151';
165
+	if (isset($_COOKIE['SatelliteIconColor'])) {
166
+		$IconColor = $_COOKIE['SatelliteIconColor'];
167
+	} elseif (isset($globalSatelliteIconColor)) {
168
+		$IconColor = $globalSatelliteIconColor;
169
+	} else {
170
+		$IconColor = '1a3151';
171
+	}
165 172
 	if (!isset($ident) && !isset($famsatid)) {
166 173
 ?>
167 174
 		    info_satellite_update(feature.properties.fc);
@@ -195,7 +202,12 @@  discard block
 block discarded – undo
195 202
 <?php
196 203
 		} else {
197 204
 ?>
198
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
205
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
206
+	print $archiveupdatetime*1000;
207
+} else {
208
+	print $globalMapRefresh*1000+20000;
209
+}
210
+?>+feature.properties.sqt*1000);
199 211
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
200 212
 <?php
201 213
 		}
@@ -251,7 +263,12 @@  discard block
 block discarded – undo
251 263
 <?php
252 264
 		} else {
253 265
 ?>
254
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
266
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
267
+	print $archiveupdatetime*1000;
268
+} else {
269
+	print $globalMapRefresh*1000+20000;
270
+}
271
+?>+feature.properties.sqt*1000);
255 272
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
256 273
 <?php
257 274
 		}
@@ -306,7 +323,12 @@  discard block
 block discarded – undo
306 323
 <?php
307 324
 		} else {
308 325
 ?>
309
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
326
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
327
+	print $archiveupdatetime*1000;
328
+} else {
329
+	print $globalMapRefresh*1000+20000;
330
+}
331
+?>+feature.properties.sqt*1000);
310 332
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
311 333
 <?php
312 334
 		}
@@ -601,14 +623,24 @@  discard block
 block discarded – undo
601 623
 	if (isset($archive) && $archive) {
602 624
 ?>
603 625
 //then load it again every 30 seconds
604
-//  var reload = setInterval(function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
626
+//  var reload = setInterval(function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) {
627
+	print ($globalMapRefresh*1000)/2;
628
+} else {
629
+	print '15000';
630
+}
631
+?>);
605 632
 reloadSatellitePage = setInterval(function(){if (noTimeout) updateSat(0)},<?php print $archiveupdatetime*1000; ?>);
606 633
 <?php
607 634
 	} else {
608 635
 ?>
609 636
 //then load it again every 30 seconds
610 637
 reloadSatellitePage = setInterval(
611
-    function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
638
+    function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) {
639
+	print $globalMapRefresh*1000;
640
+} else {
641
+	print '30000';
642
+}
643
+?>);
612 644
 <?php
613 645
 	}
614 646
 ?>
Please login to merge, or discard this patch.
live-sat-geojson.php 1 patch
Braces   +13 added lines, -5 removed lines patch added patch discarded remove patch
@@ -64,13 +64,19 @@  discard block
 block discarded – undo
64 64
 		$nextlatlon = $Satellite->position($spotter_item['name'],time()+$globalMapRefresh+20);
65 65
 		$nextlat = $nextlatlon['latitude'];
66 66
 		if (abs($nextlat-$spotter_item['latitude']) > 90) {
67
-			if ($spotter_item['latitude'] < 0) $nexlat = -90;
68
-			else $nexlat = 90;
67
+			if ($spotter_item['latitude'] < 0) {
68
+				$nexlat = -90;
69
+			} else {
70
+				$nexlat = 90;
71
+			}
69 72
 		}
70 73
 		$nextlon = $nextlatlon['longitude'];
71 74
 		if (abs($nextlon-$spotter_item['longitude']) > 180) {
72
-			if ($spotter_item['longitude'] < 0) $nextlon = -180;
73
-			else $nextlon = 180;
75
+			if ($spotter_item['longitude'] < 0) {
76
+				$nextlon = -180;
77
+			} else {
78
+				$nextlon = 180;
79
+			}
74 80
 		}
75 81
 		$output_data .= '"nextlatlon":['.$nextlat.','.$nextlon.']},';
76 82
 		//$output_data .= '"heading":"'.$Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$nextlatlon['latitude'],$nextlatlon['longitude']).'",';
@@ -99,7 +105,9 @@  discard block
 block discarded – undo
99 105
 		}
100 106
 	}
101 107
 }
102
-if (isset($output_data)) $output = substr($output,0,-1);
108
+if (isset($output_data)) {
109
+	$output = substr($output,0,-1);
110
+}
103 111
 $output .= ']}';
104 112
 print $output;
105 113
 ?>
Please login to merge, or discard this patch.