Completed
Push — master ( e14a40...cfb98e )
by Yannick
54:46 queued 27:34
created
airport.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,16 +7,16 @@  discard block
 block discarded – undo
7 7
 
8 8
 if (isset($_POST['airport']))
9 9
 {
10
-	header('Location: '.$globalURL.'/airport/'.filter_input(INPUT_POST,'airport',FILTER_SANITIZE_STRING));
11
-} else if (isset($_GET['airport'])){
10
+	header('Location: '.$globalURL.'/airport/'.filter_input(INPUT_POST, 'airport', FILTER_SANITIZE_STRING));
11
+} else if (isset($_GET['airport'])) {
12 12
 	$Spotter = new Spotter();
13 13
 	//calculuation for the pagination
14
-	if($_GET['limit'] == "")
14
+	if ($_GET['limit'] == "")
15 15
 	{
16 16
 	  $limit_start = 0;
17 17
 	  $limit_end = 25;
18 18
 	  $absolute_difference = 25;
19
-	}  else {
19
+	} else {
20 20
 		$limit_explode = explode(",", $_GET['limit']);
21 21
 		$limit_start = $limit_explode[0];
22 22
 		$limit_end = $limit_explode[1];
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 	$limit_previous_1 = $limit_start - $absolute_difference;
31 31
 	$limit_previous_2 = $limit_end - $absolute_difference;
32 32
 	
33
-	$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
34
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
33
+	$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
34
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
35 35
 	$page_url = $globalURL.'/airport/'.$airport;
36
-	$spotter_array = $Spotter->getSpotterDataByAirport($airport,$limit_start.",".$absolute_difference, $sort);
36
+	$spotter_array = $Spotter->getSpotterDataByAirport($airport, $limit_start.",".$absolute_difference, $sort);
37 37
 	$airport_array = $Spotter->getAllAirportInfo($airport);
38 38
 	
39 39
 	if (!empty($airport_array))
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
 			$airport_names = $Spotter->getAllAirportNames();
53 53
 		}
54 54
 		ksort($airport_names);
55
-		foreach($airport_names as $airport_name)
55
+		foreach ($airport_names as $airport_name)
56 56
 		{
57
-			if($airport == $airport_name['airport_icao'])
57
+			if ($airport == $airport_name['airport_icao'])
58 58
 			{
59 59
 				print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>';
60 60
 			} else {
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 		print '<div class="table column">';
88 88
 		if ($airport_array[0]['iata'] != "NA")
89 89
 		{
90
-			print '<p>'.sprintf(_("The table below shows the route(s) aircrafts have used to/from <strong>%s</strong>, sorted by the most recent one."),$airport_array[0]['name']).'</p>';
90
+			print '<p>'.sprintf(_("The table below shows the route(s) aircrafts have used to/from <strong>%s</strong>, sorted by the most recent one."), $airport_array[0]['name']).'</p>';
91 91
 		}
92 92
 
93 93
 		include('table-output.php');  
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 		print '<p>'._("Sorry, the airport does not exist in this database. :(").'</p>'; 
110 110
 	}
111 111
 } else {
112
-	$Spotter= new Spotter();
112
+	$Spotter = new Spotter();
113 113
 	$Stats = new Stats();
114 114
 	$Common = new Common();
115 115
 	$title = _("Airports");
@@ -123,11 +123,11 @@  discard block
 block discarded – undo
123 123
 	ksort($airport_names);
124 124
 	$previous = null;
125 125
 	print '<div class="alphabet-legend">';
126
-	foreach($airport_names as $value) {
126
+	foreach ($airport_names as $value) {
127 127
 		$firstLetter = strtoupper($Common->replace_mb_substr($value['airport_city'], 0, 1));
128
-		if($previous !== $firstLetter)
128
+		if ($previous !== $firstLetter)
129 129
 		{
130
-			if ($previous !== null){
130
+			if ($previous !== null) {
131 131
 				print ' | ';
132 132
 			}
133 133
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
@@ -136,13 +136,13 @@  discard block
 block discarded – undo
136 136
 	}
137 137
 	print '</div>';
138 138
 	$previous = null;
139
-	foreach($airport_names as $value) {
139
+	foreach ($airport_names as $value) {
140 140
 		$firstLetter = strtoupper($Common->replace_mb_substr($value['airport_city'], 0, 1));
141 141
 		if ($firstLetter != "")
142 142
 		{
143
-			if($previous !== $firstLetter)
143
+			if ($previous !== $firstLetter)
144 144
 			{
145
-				if ($previous !== null){
145
+				if ($previous !== null) {
146 146
 					print '</div>';
147 147
 				}
148 148
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
Please login to merge, or discard this patch.
install/class.create_db.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -8,25 +8,25 @@  discard block
 block discarded – undo
8 8
 	 * @param string $filename
9 9
 	 */
10 10
 	public static function import_file($filename) {
11
-		$filename = filter_var($filename,FILTER_SANITIZE_STRING);
11
+		$filename = filter_var($filename, FILTER_SANITIZE_STRING);
12 12
 		$Connection = new Connection();
13 13
 		if (!$Connection->connectionExists()) return 'error: DB connection failed';
14 14
 		//Connection::$db->beginTransaction();
15 15
 		$templine = '';
16
-		$handle = @fopen($filename,"r");
16
+		$handle = @fopen($filename, "r");
17 17
 		if ($handle) {
18 18
 			//$lines = file($filename);
19 19
 			//foreach ($lines as $line)
20
-			while (($line = fgets($handle,4096)) !== false)
20
+			while (($line = fgets($handle, 4096)) !== false)
21 21
 			{
22
-				if (substr($line,0,2) == '--' || $line == '') continue;
22
+				if (substr($line, 0, 2) == '--' || $line == '') continue;
23 23
 				$templine .= $line;
24
-				if (substr(trim($line), -1,1) == ';')
24
+				if (substr(trim($line), -1, 1) == ';')
25 25
 				{
26 26
 					try {
27 27
 						$sth = $Connection->db->prepare($templine);
28 28
 						$sth->execute();
29
-					} catch(PDOException $e) {
29
+					} catch (PDOException $e) {
30 30
 						return "error (import ".$filename.") : ".$e->getMessage()."\n";
31 31
 					}
32 32
 					$templine = '';
@@ -43,21 +43,21 @@  discard block
 block discarded – undo
43 43
 		$error = '';
44 44
 		$dh = opendir($directory);
45 45
 		//foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename)
46
-		while(false !== ($filename = readdir($dh)))
46
+		while (false !== ($filename = readdir($dh)))
47 47
 		{
48
-			if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename);
48
+			if (preg_match('/\.sql$/', $filename)) $error .= create_db::import_file($directory.$filename);
49 49
 		}
50 50
 		return $error;
51 51
 	}
52 52
 
53
-	public static function create_database($root,$root_pass,$user,$pass,$db,$db_type,$host,$port = '') {
54
-		$root = filter_var($root,FILTER_SANITIZE_STRING);
55
-		$root_pass = filter_var($root_pass,FILTER_SANITIZE_STRING);
56
-		$user = filter_var($user,FILTER_SANITIZE_STRING);
57
-		$password = filter_var($pass,FILTER_SANITIZE_STRING);
58
-		$db = filter_var($db,FILTER_SANITIZE_STRING);
59
-		$db_type = filter_var($db_type,FILTER_SANITIZE_STRING);
60
-		$host = filter_var($host,FILTER_SANITIZE_STRING);
53
+	public static function create_database($root, $root_pass, $user, $pass, $db, $db_type, $host, $port = '') {
54
+		$root = filter_var($root, FILTER_SANITIZE_STRING);
55
+		$root_pass = filter_var($root_pass, FILTER_SANITIZE_STRING);
56
+		$user = filter_var($user, FILTER_SANITIZE_STRING);
57
+		$password = filter_var($pass, FILTER_SANITIZE_STRING);
58
+		$db = filter_var($db, FILTER_SANITIZE_STRING);
59
+		$db_type = filter_var($db_type, FILTER_SANITIZE_STRING);
60
+		$host = filter_var($host, FILTER_SANITIZE_STRING);
61 61
 		if ($db_type == 'mysql' && $port == '') $port = 3306;
62 62
 		elseif ($port == '') $port = 5432;
63 63
 		// Dirty hack
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 			$grantright = $_SERVER['SERVER_ADDR'];
66 66
 		} else $grantright = 'localhost';
67 67
 		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);
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);
70 70
 			$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
71 71
 			if ($db_type == 'mysql') {
72 72
 				$dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;");
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 				$dbh->exec("CREATE USER ".$user." WITH PASSWORD '".$password."';
77 77
 					GRANT ALL PRIVILEGES ON DATABASE ".$db." TO ".$user.";");
78 78
 			}
79
-		} catch(PDOException $e) {
79
+		} catch (PDOException $e) {
80 80
 			$dbh = null;
81 81
 			return "error : ".$e->getMessage();
82 82
 		}
Please login to merge, or discard this patch.
require/class.Satellite.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 		try {
21 21
 			$sth = $this->db->prepare($query);
22 22
 			$sth->execute(array(':name' => $name));
23
-		} catch(PDOException $e) {
23
+		} catch (PDOException $e) {
24 24
 			echo $e->getMessage();
25 25
 		}
26 26
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
 		try {
33 33
 			$sth = $this->db->prepare($query);
34 34
 			$sth->execute();
35
-		} catch(PDOException $e) {
35
+		} catch (PDOException $e) {
36 36
 			echo $e->getMessage();
37 37
 		}
38 38
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 		try {
45 45
 			$sth = $this->db->prepare($query);
46 46
 			$sth->execute();
47
-		} catch(PDOException $e) {
47
+		} catch (PDOException $e) {
48 48
 			echo $e->getMessage();
49 49
 		}
50 50
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		try {
57 57
 			$sth = $this->db->prepare($query);
58 58
 			$sth->execute(array(':type' => $type));
59
-		} catch(PDOException $e) {
59
+		} catch (PDOException $e) {
60 60
 			echo $e->getMessage();
61 61
 		}
62 62
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -64,49 +64,49 @@  discard block
 block discarded – undo
64 64
 		else return array();
65 65
 	}
66 66
 	
67
-	public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) {
67
+	public function position_all($timestamp_begin = '', $timestamp_end = '', $second = 10) {
68 68
 		$all_sat = $this->get_tle_names();
69 69
 		$result = array();
70 70
 		foreach ($all_sat as $sat) {
71
-			$position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second);
72
-			$result = array_merge($position,$result);
71
+			$position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second);
72
+			$result = array_merge($position, $result);
73 73
 		}
74 74
 		return $result;
75 75
 	}
76 76
 
77
-	public function position_all_type($type,$timestamp_begin = '',$timestamp_end = '',$second = 10) {
77
+	public function position_all_type($type, $timestamp_begin = '', $timestamp_end = '', $second = 10) {
78 78
 		$all_sat = $this->get_tle_names_type($type);
79 79
 		$result = array();
80 80
 		foreach ($all_sat as $sat) {
81
-			$position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second);
82
-			if (isset($position[0])) $result = array_merge($position,$result);
81
+			$position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second);
82
+			if (isset($position[0])) $result = array_merge($position, $result);
83 83
 			else $result[] = $position;
84 84
 		}
85 85
 		return $result;
86 86
 	}
87 87
 
88
-	public function position($name,$timestamp_begin = '',$timestamp_end = '',$second = 10) {
88
+	public function position($name, $timestamp_begin = '', $timestamp_end = '', $second = 10) {
89 89
 		$qth = new Predict_QTH();
90 90
 		$qth->lat = floatval(37.790252);
91 91
 		$qth->lon = floatval(-122.419968);
92 92
 	
93 93
 		$tle_file = $this->get_tle($name);
94 94
 		$type = $tle_file['tle_type'];
95
-		$tle = new Predict_TLE($tle_file['tle_name'],$tle_file['tle_tle1'],$tle_file['tle_tle2']);
95
+		$tle = new Predict_TLE($tle_file['tle_name'], $tle_file['tle_tle1'], $tle_file['tle_tle2']);
96 96
 		$sat = new Predict_Sat($tle);
97 97
 		$predict = new Predict();
98 98
 		//if ($timestamp == '') $now = Predict_Time::get_current_daynum();
99 99
 		if ($timestamp_begin == '') $timestamp_begin = time();
100 100
 		if ($timestamp_end == '') {
101 101
 			$now = Predict_Time::unix2daynum($timestamp_begin);
102
-			$predict->predict_calc($sat,$qth,$now);
103
-			return array('name' => $name, 'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp_begin,'type' => $type);
102
+			$predict->predict_calc($sat, $qth, $now);
103
+			return array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp_begin, 'type' => $type);
104 104
 		} else {
105 105
 			$result = array();
106
-			for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp=$timestamp+$second) {
106
+			for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp = $timestamp + $second) {
107 107
 				$now = Predict_Time::unix2daynum($timestamp);
108
-				$predict->predict_calc($sat,$qth,$now);
109
-				$result[] = array('name' => $name,'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp,'type' => $type);
108
+				$predict->predict_calc($sat, $qth, $now);
109
+				$result[] = array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp, 'type' => $type);
110 110
 			}
111 111
 			return $result;
112 112
 		}
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		try {
118 118
 			$sth = $this->db->prepare($query);
119 119
 			$sth->execute(array(':name' => $name.'%'));
120
-		} catch(PDOException $e) {
120
+		} catch (PDOException $e) {
121 121
 			echo $e->getMessage();
122 122
 		}
123 123
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 		$sth->execute($query_values);
146 146
 		$launch_site_array = array();
147 147
 		$temp_array = array();
148
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
148
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
149 149
 		{
150 150
 			$temp_array['launch_site'] = $row['launch_site'];
151 151
 			$temp_array['launch_site_count'] = $row['launch_site_count'];
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		$sth->execute($query_values);
175 175
 		$owner_array = array();
176 176
 		$temp_array = array();
177
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
177
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
178 178
 		{
179 179
 			$temp_array['owner_name'] = $row['owner_name'];
180 180
 			$temp_array['owner_count'] = $row['owner_count'];
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		$sth->execute($query_values);
204 204
 		$owner_array = array();
205 205
 		$temp_array = array();
206
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
206
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
207 207
 		{
208 208
 			$temp_array['country_name'] = $row['country_name'];
209 209
 			$temp_array['country_count'] = $row['country_count'];
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
 		$sth->execute($query_data);
248 248
 		$date_array = array();
249 249
 		$temp_array = array();
250
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
250
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
251 251
 		{
252 252
 			$temp_array['year_name'] = $row['year_name'];
253 253
 			$temp_array['month_name'] = $row['month_name'];
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 		$sth->execute($query_data);
293 293
 		$date_array = array();
294 294
 		$temp_array = array();
295
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
295
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
296 296
 		{
297 297
 			$temp_array['year_name'] = $row['year_name'];
298 298
 			$temp_array['date_count'] = $row['date_count'];
Please login to merge, or discard this patch.
live-sat-geojson.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 		header('Content-disposition: attachment; filename="flightairmap-sat.json"');
14 14
 	}
15 15
 }
16
-$history = urldecode(filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING));
16
+$history = urldecode(filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING));
17 17
 header('Content-Type: text/javascript');
18 18
 
19 19
 $begintime = microtime(true);
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 
22 22
 $spotter_array = array();
23 23
 if (isset($_COOKIE['sattypes']) && $_COOKIE['sattypes'] != '') {
24
-	$sattypes = explode(',',$_COOKIE['sattypes']);
24
+	$sattypes = explode(',', $_COOKIE['sattypes']);
25 25
 	foreach ($sattypes as $sattype) {
26 26
 		//$spotter_array = array_merge($Satellite->position_all_type($sattype,$timeb-$globalLiveInterval,$timeb),$spotter_array);
27
-		$spotter_array = array_merge($Satellite->position_all_type($sattype),$spotter_array);
27
+		$spotter_array = array_merge($Satellite->position_all_type($sattype), $spotter_array);
28 28
 	}
29 29
 }
30 30
 
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 //$spotter_array = array_unique($spotter_array,SORT_REGULAR);
38 38
 //print_r($spotter_array);
39
-$sqltime = round(microtime(true)-$begintime,2);
39
+$sqltime = round(microtime(true) - $begintime, 2);
40 40
 
41 41
 $output = '{"type":"FeatureCollection","features":[';
42 42
 if (!empty($spotter_array) && is_array($spotter_array))
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 	$last_name = '';
45 45
 	$coordinatearray = '';
46 46
 	$timearray = array();
47
-	foreach($spotter_array as $spotter_item)
47
+	foreach ($spotter_array as $spotter_item)
48 48
 	{
49 49
 		$output_data = '';
50 50
 		$output_data .= '{"type":"Feature","properties":{';
@@ -61,14 +61,14 @@  discard block
 block discarded – undo
61 61
 		}
62 62
 		$output_data .= '"altitude":0,';
63 63
 		$output_data .= '"sqt":'.$sqltime.',';
64
-		$nextlatlon = $Satellite->position($spotter_item['name'],time()+$globalMapRefresh+20);
64
+		$nextlatlon = $Satellite->position($spotter_item['name'], time() + $globalMapRefresh + 20);
65 65
 		$nextlat = $nextlatlon['latitude'];
66
-		if (abs($nextlat-$spotter_item['latitude']) > 90) {
66
+		if (abs($nextlat - $spotter_item['latitude']) > 90) {
67 67
 			if ($spotter_item['latitude'] < 0) $nexlat = -90;
68 68
 			else $nexlat = 90;
69 69
 		}
70 70
 		$nextlon = $nextlatlon['longitude'];
71
-		if (abs($nextlon-$spotter_item['longitude']) > 180) {
71
+		if (abs($nextlon - $spotter_item['longitude']) > 180) {
72 72
 			if ($spotter_item['longitude'] < 0) $nextlon = -180;
73 73
 			else $nextlon = 180;
74 74
 		}
@@ -79,27 +79,27 @@  discard block
 block discarded – undo
79 79
 		$output_data .= ']}},';
80 80
 		$output .= $output_data;
81 81
 		if ($history == $spotter_item['name']) {
82
-			$spotter_history_array = $Satellite->position($spotter_item['name'],time()-6000,time());
82
+			$spotter_history_array = $Satellite->position($spotter_item['name'], time() - 6000, time());
83 83
 			$spotter_history_array = array_reverse($spotter_history_array);
84 84
 			$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['name'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
85 85
 			foreach ($spotter_history_array as $key => $spotter_history) {
86
-				if ((isset($previous_lon) && abs($previous_lon-$spotter_history['longitude']) > 180) || (isset($previous_lat) && abs($previous_lat-$spotter_history['latitude']) > 90)) {
86
+				if ((isset($previous_lon) && abs($previous_lon - $spotter_history['longitude']) > 180) || (isset($previous_lat) && abs($previous_lat - $spotter_history['latitude']) > 90)) {
87 87
 					break;
88 88
 				}
89 89
 				$output_history .= '[';
90
-				$output_history .=  $spotter_history['longitude'].', ';
91
-				$output_history .=  $spotter_history['latitude'];
90
+				$output_history .= $spotter_history['longitude'].', ';
91
+				$output_history .= $spotter_history['latitude'];
92 92
 				$output_history .= '],';
93 93
 				$previous_lon = $spotter_history['longitude'];
94 94
 				$previous_lat = $spotter_history['latitude'];
95 95
 			}
96
-			$output_history = substr($output_history,0,-1);
96
+			$output_history = substr($output_history, 0, -1);
97 97
 			$output_history .= ']}},';
98 98
 			$output .= $output_history;
99 99
 		}
100 100
 	}
101 101
 }
102
-if (isset($output_data)) $output = substr($output,0,-1);
102
+if (isset($output_data)) $output = substr($output, 0, -1);
103 103
 $output .= ']}';
104 104
 print $output;
105 105
 ?>
Please login to merge, or discard this patch.
live-sat-czml.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -20,17 +20,17 @@  discard block
 block discarded – undo
20 20
 
21 21
 $spotter_array = array();
22 22
 if (isset($_COOKIE['sattypes']) && $_COOKIE['sattypes'] != '') {
23
-	$sattypes = explode(',',$_COOKIE['sattypes']);
23
+	$sattypes = explode(',', $_COOKIE['sattypes']);
24 24
 	foreach ($sattypes as $sattype) {
25
-		$spotter_array = array_merge($Satellite->position_all_type($sattype,$timeb-$globalLiveInterval,$timeb),$spotter_array);
25
+		$spotter_array = array_merge($Satellite->position_all_type($sattype, $timeb - $globalLiveInterval, $timeb), $spotter_array);
26 26
 	}
27 27
 }
28 28
 if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
29
-	$spotter_array = array_merge($Satellite->position('ISS (ZARYA)',time()-$globalLiveInterval,time()),$spotter_array);
30
-	$spotter_array = array_merge($Satellite->position('TIANGONG 1',time()-$globalLiveInterval,time()),$spotter_array);
31
-	$spotter_array = array_merge($Satellite->position('TIANGONG-2',time()-$globalLiveInterval,time()),$spotter_array);
29
+	$spotter_array = array_merge($Satellite->position('ISS (ZARYA)', time() - $globalLiveInterval, time()), $spotter_array);
30
+	$spotter_array = array_merge($Satellite->position('TIANGONG 1', time() - $globalLiveInterval, time()), $spotter_array);
31
+	$spotter_array = array_merge($Satellite->position('TIANGONG-2', time() - $globalLiveInterval, time()), $spotter_array);
32 32
 }
33
-$spotter_array = array_unique($spotter_array,SORT_REGULAR);
33
+$spotter_array = array_unique($spotter_array, SORT_REGULAR);
34 34
 /*
35 35
 $modelsdb = array();
36 36
 if (file_exists('models/space/space_modelsdb')) {
@@ -54,14 +54,14 @@  discard block
 block discarded – undo
54 54
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}';
55 55
 
56 56
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
57
-$output .= ',"clock": {"currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
57
+$output .= ',"clock": {"currentTime" : "'.date("c", time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
58 58
 //$output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}';
59 59
 
60 60
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"step": "SYSTEM_CLOCK_MULTIPLIER"}';
61 61
 $output .= '},';
62 62
 if (!empty($spotter_array) && is_array($spotter_array))
63 63
 {
64
-	foreach($spotter_array as $spotter_item)
64
+	foreach ($spotter_array as $spotter_item)
65 65
 	{
66 66
 		$j++;
67 67
 		date_default_timezone_set('UTC');
@@ -115,23 +115,23 @@  discard block
 block discarded – undo
115 115
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubiesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
116 116
 				} elseif ($spotter_item['name'] == 'TERRA') {
117 117
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/terra.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
118
-				} elseif (strpos($spotter_item['name'],'O3B') !== false) {
118
+				} elseif (strpos($spotter_item['name'], 'O3B') !== false) {
119 119
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/o3b.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
120
-				} elseif (strpos($spotter_item['name'],'GLOBALSTAR') !== false) {
120
+				} elseif (strpos($spotter_item['name'], 'GLOBALSTAR') !== false) {
121 121
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/globalstar.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
122
-				} elseif (strpos($spotter_item['name'],'GPS') !== false) {
122
+				} elseif (strpos($spotter_item['name'], 'GPS') !== false) {
123 123
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/gps.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
124
-				} elseif (strpos($spotter_item['name'],'GENESIS') !== false) {
124
+				} elseif (strpos($spotter_item['name'], 'GENESIS') !== false) {
125 125
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/genesis.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
126
-				} elseif (strpos($spotter_item['name'],'OSCAR 7') !== false) {
126
+				} elseif (strpos($spotter_item['name'], 'OSCAR 7') !== false) {
127 127
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/oscar7.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
128
-				} elseif (strpos($spotter_item['name'],'FLOCK') !== false) {
128
+				} elseif (strpos($spotter_item['name'], 'FLOCK') !== false) {
129 129
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
130
-				} elseif (strpos($spotter_item['name'],'PLEIADES') !== false) {
130
+				} elseif (strpos($spotter_item['name'], 'PLEIADES') !== false) {
131 131
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/pleiades.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
132
-				} elseif (strpos($spotter_item['name'],'DUCHIFAT') !== false) {
132
+				} elseif (strpos($spotter_item['name'], 'DUCHIFAT') !== false) {
133 133
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/duchifat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
134
-				} elseif (strpos($spotter_item['name'],'FORMOSAT-2') !== false) {
134
+				} elseif (strpos($spotter_item['name'], 'FORMOSAT-2') !== false) {
135 135
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/formosat2.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
136 136
 				} elseif ($spotter_item['type'] == 'iridium') {
137 137
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/space/iridium.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },';
@@ -153,14 +153,14 @@  discard block
 block discarded – undo
153 153
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
154 154
 			$output .= '"interpolationAlgorithm":"HERMITE","interpolationDegree":3,';
155 155
 			$output .= '"cartographicDegrees": [';
156
-			$output .= '"'.date("c",$spotter_item['timestamp']).'", ';
156
+			$output .= '"'.date("c", $spotter_item['timestamp']).'", ';
157 157
 			$output .= $spotter_item['longitude'].', ';
158 158
 			$output .= $spotter_item['latitude'].', ';
159 159
 			$output .= $spotter_item['altitude']*1000;
160 160
 			$orientation = '"orientation" : { ';
161 161
 			$orientation .= '"unitQuaternion": [';
162 162
 		} else {
163
-			$output .= ',"'.date("c",$spotter_item['timestamp']).'", ';
163
+			$output .= ',"'.date("c", $spotter_item['timestamp']).'", ';
164 164
 			$output .= $spotter_item['longitude'].', ';
165 165
 			$output .= $spotter_item['latitude'].', ';
166 166
 			$output .= $spotter_item['altitude']*1000;
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 } else {
20 20
 	unset($_COOKIE['MapTrack']);
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
 		        <div class="form-group">
195 195
 			    <label>From (UTC):</label>
196 196
 		            <div class='input-group date' id='datetimepicker1'>
197
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
197
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required />
198 198
 		                <span class="input-group-addon">
199 199
             			    <span class="glyphicon glyphicon-calendar"></span>
200 200
 		                </span>
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		        <div class="form-group">
204 204
 			    <label>To (UTC):</label>
205 205
 		            <div class='input-group date' id='datetimepicker2'>
206
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
206
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" />
207 207
             			<span class="input-group-addon">
208 208
 		                    <span class="glyphicon glyphicon-calendar"></span>
209 209
             			</span>
@@ -327,9 +327,9 @@  discard block
 block discarded – undo
327 327
 		    <li><?php echo _("Type of Terrain:"); ?>
328 328
 			<select  class="selectpicker" onchange="terrainType(this);">
329 329
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
330
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
331
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
332
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
330
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
331
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
332
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option>
333 333
 			</select>
334 334
 		    </li>
335 335
 <?php
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
366 366
 <?php
367 367
     }
368
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
368
+    if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) {
369 369
 ?>
370 370
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
371 371
 <?php
@@ -541,10 +541,10 @@  discard block
 block discarded – undo
541 541
 					$Spotter = new Spotter();
542 542
 					$allairlinenames = $Spotter->getAllAirlineNames();
543 543
 				}
544
-				foreach($allairlinenames as $airline) {
544
+				foreach ($allairlinenames as $airline) {
545 545
 					$airline_name = $airline['airline_name'];
546
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
547
-					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
546
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
547
+					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) {
548 548
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
549 549
 					} else {
550 550
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -563,7 +563,7 @@  discard block
 block discarded – undo
563 563
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
564 564
 			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
565 565
 			    <?php
566
-				foreach($allalliancenames as $alliance) {
566
+				foreach ($allalliancenames as $alliance) {
567 567
 					$alliance_name = $alliance['alliance'];
568 568
 					if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) {
569 569
 						echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>';
@@ -599,8 +599,8 @@  discard block
 block discarded – undo
599 599
 				*/
600 600
 				$Source = new Source();
601 601
 				$datasource = $Source->getLocationInfoByType('gs');
602
-				foreach($datasource as $src) {
603
-					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) {
602
+				foreach ($datasource as $src) {
603
+					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) {
604 604
 						echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>';
605 605
 					} else {
606 606
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
680 680
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
681 681
 					
682
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
682
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
683 683
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
684 684
 					} else {
685 685
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
location-data.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 $Source = new Source();
6 6
 
7 7
 if (isset($_GET['sourceid'])) {
8
-	$sourceid = filter_input(INPUT_GET,'sourceid',FILTER_SANITIZE_NUMBER_INT);
8
+	$sourceid = filter_input(INPUT_GET, 'sourceid', FILTER_SANITIZE_NUMBER_INT);
9 9
 	$source_data = $Source->getLocationInfoById($sourceid);
10 10
 	if (isset($source_data[0])) {
11 11
  ?>
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 print '</div>';
38 38
 
39 39
 if ($spotter_item['city'] != '') print '<div><span>'._("City").'</span>'.$spotter_item['city'].'</div>';
40
-if ($spotter_item['country'] !='') print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
41
-print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],4).', '.round($spotter_item['longitude'],4).'</div>';
40
+if ($spotter_item['country'] != '') print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
41
+print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'], 4).', '.round($spotter_item['longitude'], 4).'</div>';
42 42
 /*
43 43
 if ($spotter_item['atc_range'] > 0) {
44 44
     print '<div><span>'._("Range").'</span>';
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 }
48 48
 */
49 49
 if ($spotter_item['type'] == 'wx') {
50
-	$weather = json_decode($spotter_item['description'],true);
50
+	$weather = json_decode($spotter_item['description'], true);
51 51
 	//print_r($weather);
52 52
 	if (isset($weather['temp'])) print '<div><span>'._("Temperature").'</span>'.$weather['temp'].'°C</div>';
53 53
 	if (isset($weather['pressure'])) print '<div><span>'._("Pressure").'</span>'.$weather['pressure'].'hPa</div>';
Please login to merge, or discard this patch.
require/class.Source.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 		try {
17 17
 			$sth = $this->db->prepare($query);
18 18
 			$sth->execute($query_values);
19
-		} catch(PDOException $e) {
19
+		} catch (PDOException $e) {
20 20
 			return "error : ".$e->getMessage();
21 21
 		}
22 22
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -29,20 +29,20 @@  discard block
 block discarded – undo
29 29
 		try {
30 30
 			$sth = $this->db->prepare($query);
31 31
 			$sth->execute($query_values);
32
-		} catch(PDOException $e) {
32
+		} catch (PDOException $e) {
33 33
 			return "error : ".$e->getMessage();
34 34
 		}
35 35
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
36 36
 		return $all;
37 37
 	}
38 38
 
39
-	public function getLocationInfobyNameType($name,$type) {
39
+	public function getLocationInfobyNameType($name, $type) {
40 40
 		$query = "SELECT * FROM source_location WHERE name = :name AND type = :type";
41
-		$query_values = array(':name' => $name,':type' => $type);
41
+		$query_values = array(':name' => $name, ':type' => $type);
42 42
 		try {
43 43
 			$sth = $this->db->prepare($query);
44 44
 			$sth->execute($query_values);
45
-		} catch(PDOException $e) {
45
+		} catch (PDOException $e) {
46 46
 			return "error : ".$e->getMessage();
47 47
 		}
48 48
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		try {
56 56
 			$sth = $this->db->prepare($query);
57 57
 			$sth->execute($query_values);
58
-		} catch(PDOException $e) {
58
+		} catch (PDOException $e) {
59 59
 			return "error : ".$e->getMessage();
60 60
 		}
61 61
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 	public function getLocationInfoByType($type, $coord = array(), $limit = false) {
66 66
 		$query = "SELECT * FROM source_location WHERE type = :type";
67 67
 		if (is_array($coord) && !empty($coord)) {
68
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
69
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
70
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
71
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
68
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
69
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
70
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
71
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
72 72
 			$query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0";
73 73
 		}
74 74
 		$query .= " ORDER BY last_seen DESC";
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 		try {
78 78
 			$sth = $this->db->prepare($query);
79 79
 			$sth->execute($query_values);
80
-		} catch(PDOException $e) {
80
+		} catch (PDOException $e) {
81 81
 			return "error : ".$e->getMessage();
82 82
 		}
83 83
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		try {
91 91
 			$sth = $this->db->prepare($query);
92 92
 			$sth->execute($query_values);
93
-		} catch(PDOException $e) {
93
+		} catch (PDOException $e) {
94 94
 			return "error : ".$e->getMessage();
95 95
 		}
96 96
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -103,56 +103,56 @@  discard block
 block discarded – undo
103 103
 		try {
104 104
 			$sth = $this->db->prepare($query);
105 105
 			$sth->execute($query_values);
106
-		} catch(PDOException $e) {
106
+		} catch (PDOException $e) {
107 107
 			return "error : ".$e->getMessage();
108 108
 		}
109 109
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
110 110
 		return $all;
111 111
 	}
112 112
 
113
-	public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') {
113
+	public function addLocation($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id = 0, $last_seen = '', $description = '') {
114 114
 		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
115 115
 		$query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)";
116
-		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
116
+		$query_values = array(':name' => $name, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':source_id' => $source_id, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description);
117 117
 		try {
118 118
 			$sth = $this->db->prepare($query);
119 119
 			$sth->execute($query_values);
120
-		} catch(PDOException $e) {
120
+		} catch (PDOException $e) {
121 121
 			echo "error : ".$e->getMessage();
122 122
 		}
123 123
 	}
124 124
 
125
-	public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') {
125
+	public function updateLocation($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id = 0, $last_seen = '', $description = '') {
126 126
 		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
127 127
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source";
128
-		$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
128
+		$query_values = array(':name' => $name, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':source_id' => $source_id, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description);
129 129
 		try {
130 130
 			$sth = $this->db->prepare($query);
131 131
 			$sth->execute($query_values);
132
-		} catch(PDOException $e) {
132
+		} catch (PDOException $e) {
133 133
 			return "error : ".$e->getMessage();
134 134
 		}
135 135
 	}
136 136
 
137
-	public function updateLocationDescByName($name,$source,$source_id = 0,$description = '') {
137
+	public function updateLocationDescByName($name, $source, $source_id = 0, $description = '') {
138 138
 		$query = "UPDATE source_location SET description = :description WHERE source_id = :source_id AND name = :name AND source = :source";
139
-		$query_values = array(':name' => $name,':source' => $source,':source_id' => $source_id,':description' => $description);
139
+		$query_values = array(':name' => $name, ':source' => $source, ':source_id' => $source_id, ':description' => $description);
140 140
 		try {
141 141
 			$sth = $this->db->prepare($query);
142 142
 			$sth->execute($query_values);
143
-		} catch(PDOException $e) {
143
+		} catch (PDOException $e) {
144 144
 			return "error : ".$e->getMessage();
145 145
 		}
146 146
 	}
147 147
 
148
-	public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') {
148
+	public function updateLocationByLocationID($name, $latitude, $longitude, $altitude, $city, $country, $source, $logo = 'antenna.png', $type = '', $source_id = 0, $location_id, $last_seen = '', $description = '') {
149 149
 		if ($last_seen == '') $last_seen = date('Y-m-d H:i:s');
150 150
 		$query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id";
151
-		$query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description);
151
+		$query_values = array(':source_id' => $source_id, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':city' => $city, ':country' => $country, ':logo' => $logo, ':source' => $source, ':type' => $type, ':last_seen' => $last_seen, ':location_id' => $location_id, ':description' => $description);
152 152
 		try {
153 153
 			$sth = $this->db->prepare($query);
154 154
 			$sth->execute($query_values);
155
-		} catch(PDOException $e) {
155
+		} catch (PDOException $e) {
156 156
 			echo "error : ".$e->getMessage();
157 157
 		}
158 158
 	}
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 		try {
164 164
 			$sth = $this->db->prepare($query);
165 165
 			$sth->execute($query_values);
166
-		} catch(PDOException $e) {
166
+		} catch (PDOException $e) {
167 167
 			return "error : ".$e->getMessage();
168 168
 		}
169 169
 	}
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 		try {
175 175
 			$sth = $this->db->prepare($query);
176 176
 			$sth->execute($query_values);
177
-		} catch(PDOException $e) {
177
+		} catch (PDOException $e) {
178 178
 			return "error : ".$e->getMessage();
179 179
 		}
180 180
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 		try {
186 186
 			$sth = $this->db->prepare($query);
187 187
 			$sth->execute($query_values);
188
-		} catch(PDOException $e) {
188
+		} catch (PDOException $e) {
189 189
 			return "error : ".$e->getMessage();
190 190
 		}
191 191
 	}
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 		try {
196 196
 			$sth = $this->db->prepare($query);
197 197
 			$sth->execute();
198
-		} catch(PDOException $e) {
198
+		} catch (PDOException $e) {
199 199
 			return "error : ".$e->getMessage();
200 200
 		}
201 201
 	}
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		try {
225 225
 			$sth = $this->db->prepare($query);
226 226
 			$sth->execute(array(':type' => $type));
227
-		} catch(PDOException $e) {
227
+		} catch (PDOException $e) {
228 228
 			return "error";
229 229
 		}
230 230
 		return "success";
Please login to merge, or discard this patch.
ident-detailed.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Language.php');
4 4
 require_once('require/class.Translation.php');
5 5
 $type = '';
6
-$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
6
+$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
7 7
 if (isset($_GET['marine'])) {
8 8
 	require_once('require/class.Marine.php');
9 9
 	require_once('require/class.MarineLive.php');
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 	$page_url = $globalURL.'/ident/'.$_GET['ident'];
31 31
 }
32 32
 
33
-if (!isset($_GET['ident'])){
33
+if (!isset($_GET['ident'])) {
34 34
 	header('Location: '.$globalURL.'');
35 35
 } else {
36 36
 	$Translation = new Translation();
37 37
 	//calculuation for the pagination
38
-	if(!isset($_GET['limit']))
38
+	if (!isset($_GET['limit']))
39 39
 	{
40 40
 		$limit_start = 0;
41 41
 		$limit_end = 25;
@@ -54,18 +54,18 @@  discard block
 block discarded – undo
54 54
 	$limit_previous_1 = $limit_start - $absolute_difference;
55 55
 	$limit_previous_2 = $limit_end - $absolute_difference;
56 56
 	
57
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
57
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
58 58
 	if ($type == 'aircraft') {
59 59
 		if ($sort != '') 
60 60
 		{
61
-			$spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort);
61
+			$spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort);
62 62
 			if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
63
-				$spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort);
63
+				$spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort);
64 64
 			}
65 65
 		} else {
66
-			$spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference);
66
+			$spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference);
67 67
 			if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
68
-				$spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference);
68
+				$spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference);
69 69
 			}
70 70
 		}
71 71
 		if (empty($spotter_array)) {
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
 				$ident = $new_ident;
75 75
 				if ($sort != '') 
76 76
 				{
77
-					$spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort);
77
+					$spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort);
78 78
 					if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
79
-						$spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort);
79
+						$spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort);
80 80
 					}
81 81
 				} else {
82
-					$spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference);
82
+					$spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference);
83 83
 					if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
84
-						$spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference);
84
+						$spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference);
85 85
 					}
86 86
 				}
87 87
 			}
@@ -89,34 +89,34 @@  discard block
 block discarded – undo
89 89
 	} elseif ($type == 'marine') {
90 90
 		if ($sort != '') 
91 91
 		{
92
-			$spotter_array = $Marine->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference, $sort);
92
+			$spotter_array = $Marine->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference, $sort);
93 93
 			if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
94
-				$spotter_array = $MarineArchive->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference, $sort);
94
+				$spotter_array = $MarineArchive->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference, $sort);
95 95
 			}
96 96
 		} else {
97
-			$spotter_array = $Marine->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference);
97
+			$spotter_array = $Marine->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference);
98 98
 			if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
99
-				$spotter_array = $MarineArchive->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference);
99
+				$spotter_array = $MarineArchive->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference);
100 100
 			}
101 101
 		}
102 102
 	} elseif ($type == 'tracker') {
103 103
 		if ($sort != '') 
104 104
 		{
105
-			$spotter_array = $Tracker->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference, $sort);
105
+			$spotter_array = $Tracker->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference, $sort);
106 106
 			if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
107
-				$spotter_array = $TrackerArchive->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference, $sort);
107
+				$spotter_array = $TrackerArchive->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference, $sort);
108 108
 			}
109 109
 		} else {
110
-			$spotter_array = $Tracker->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference);
110
+			$spotter_array = $Tracker->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference);
111 111
 			if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
112
-				$spotter_array = $TrackerArchive->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference);
112
+				$spotter_array = $TrackerArchive->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference);
113 113
 			}
114 114
 		}
115 115
 	}
116 116
 
117 117
 	if (!empty($spotter_array))
118 118
 	{
119
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']);
119
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['ident']);
120 120
 		$ident = $spotter_array[0]['ident'];
121 121
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
122 122
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
 				$altitude_data = '';
136 136
 				$hour_data = '';
137 137
 				$speed_data = '';
138
-				foreach($all_data as $data)
138
+				foreach ($all_data as $data)
139 139
 				{
140 140
 					$hour_data .= '"'.$data['date'].'",';
141 141
 					if (isset($data['real_altitude']) && $data['real_altitude'] != '') {
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
 					$speed_data .= $speed.',';
164 164
 				}
165 165
 				$hour_data = "['x',".substr($hour_data, 0, -1)."]";
166
-				$altitude_data = "['altitude',".substr($altitude_data,0,-1)."]";
167
-				$speed_data = "['speed',".substr($speed_data,0,-1)."]";
166
+				$altitude_data = "['altitude',".substr($altitude_data, 0, -1)."]";
167
+				$speed_data = "['speed',".substr($speed_data, 0, -1)."]";
168 168
 				print 'c3.generate({
169 169
 				    bindto: "#chart",
170 170
 				    data: {
@@ -208,9 +208,9 @@  discard block
 block discarded – undo
208 208
 	
209 209
 		if ($type == 'aircraft') include('ident-sub-menu.php');
210 210
 		print '<div class="table column">';
211
-		if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
212
-		elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
213
-		elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
211
+		if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>';
212
+		elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>';
213
+		elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>';
214 214
 
215 215
 		include('table-output.php'); 
216 216
 		print '<div class="pagination">';
Please login to merge, or discard this patch.