@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | if (isset($_POST['airline'])) |
10 | 10 | { |
11 | - header('Location: '.$globalURL.'/airline/'.filter_input(INPUT_POST,'airline',FILTER_SANITIZE_STRING)); |
|
11 | + header('Location: '.$globalURL.'/airline/'.filter_input(INPUT_POST, 'airline', FILTER_SANITIZE_STRING)); |
|
12 | 12 | } else { |
13 | 13 | $title = "Airlines"; |
14 | 14 | require_once('header.php'); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | print '<div class="column">'; |
18 | 18 | print '<h1>'._("Airlines").'</h1>'; |
19 | 19 | if (isset($_POST['airline_type'])) { |
20 | - $airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING); |
|
20 | + $airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING); |
|
21 | 21 | //$airline_names = $Spotter->getAllAirlineNames($airline_type); |
22 | 22 | } else { |
23 | 23 | //$airline_names = $Spotter->getAllAirlineNames(); |
@@ -29,10 +29,10 @@ discard block |
||
29 | 29 | print '<div class="alphabet">'; |
30 | 30 | foreach ($alliances as $alliance) { |
31 | 31 | print '<div class="alphabet-airline alphabet-item">'; |
32 | - print '<a href="'.$globalURL.'/airline/alliance_'.str_replace(' ','_',$alliance['alliance']).'">'; |
|
33 | - if (file_exists('images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png')) |
|
32 | + print '<a href="'.$globalURL.'/airline/alliance_'.str_replace(' ', '_', $alliance['alliance']).'">'; |
|
33 | + if (file_exists('images/airlines/'.str_replace(' ', '_', $alliance['alliance']).'.png')) |
|
34 | 34 | { |
35 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace(' ','_',$alliance['alliance']).'.png" alt="'._("Click to see alliance activity").'" title="'._("Click to see alliance activity").'" /> '; |
|
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 | 36 | } else print $alliance['alliance']; |
37 | 37 | print '</a>'; |
38 | 38 | print '</div>'; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | $Stats = new Stats(); |
56 | 56 | if (isset($_POST['airline_type'])) |
57 | 57 | { |
58 | - $airline_type = filter_input(INPUT_POST,'airline_type',FILTER_SANITIZE_STRING); |
|
58 | + $airline_type = filter_input(INPUT_POST, 'airline_type', FILTER_SANITIZE_STRING); |
|
59 | 59 | //$airline_names = $Stats->getAllAirlineNames($airline_type); |
60 | 60 | $airline_names = $Spotter->getAllAirlineNames($airline_type); |
61 | 61 | } else { |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | } |
69 | 69 | $previous = null; |
70 | 70 | print '<div class="alphabet-legend">'; |
71 | - foreach($airline_names as $value) |
|
71 | + foreach ($airline_names as $value) |
|
72 | 72 | { |
73 | 73 | //echo $value['airline_name']."\n"; |
74 | 74 | //echo mb_substr($value['airline_name'],0,1).' - '.$value['airline_name']."\n"; |
75 | 75 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airline_name'], 0, 1)); |
76 | - if($previous !== $firstLetter) |
|
76 | + if ($previous !== $firstLetter) |
|
77 | 77 | { |
78 | 78 | if ($previous !== null) print ' | '; |
79 | 79 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | } |
83 | 83 | print '</div>'; |
84 | 84 | $previous = null; |
85 | - foreach($airline_names as $value) { |
|
85 | + foreach ($airline_names as $value) { |
|
86 | 86 | $firstLetter = strtoupper($Common->replace_mb_substr($value['airline_name'], 0, 1)); |
87 | 87 | if ($firstLetter != "") |
88 | 88 | { |
89 | - if($previous !== $firstLetter) |
|
89 | + if ($previous !== $firstLetter) |
|
90 | 90 | { |
91 | 91 | if ($previous !== null) print '</div>'; |
92 | 92 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -8,25 +8,25 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -20,7 +20,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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']; |
@@ -13,7 +13,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ?> |
@@ -20,17 +20,17 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -5,7 +5,7 @@ discard block |
||
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 |
||
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 |
||
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>'; |
@@ -16,7 +16,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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"; |
@@ -3,7 +3,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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">'; |
@@ -12,52 +12,52 @@ discard block |
||
12 | 12 | if (!isset($globalDemo)) { |
13 | 13 | if (isset($_GET['coord'])) |
14 | 14 | { |
15 | - $coords = explode(',',$_GET['coord']); |
|
15 | + $coords = explode(',', $_GET['coord']); |
|
16 | 16 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
17 | 17 | || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
18 | 18 | //$spotter_array = $Source->getAllLocationInfo(); |
19 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs',$coords)); |
|
19 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('gs', $coords)); |
|
20 | 20 | } |
21 | 21 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
22 | 22 | || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
23 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx',$coords)); |
|
23 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('wx', $coords)); |
|
24 | 24 | } |
25 | 25 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
26 | 26 | || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
27 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning',$coords)); |
|
27 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('lightning', $coords)); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
31 | 31 | || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
32 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',$coords,true)); |
|
32 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('fires', $coords, true)); |
|
33 | 33 | } |
34 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('')); |
|
34 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('')); |
|
35 | 35 | } else { |
36 | 36 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
37 | 37 | || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
38 | 38 | //$spotter_array = $Source->getAllLocationInfo(); |
39 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs')); |
|
39 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('gs')); |
|
40 | 40 | } |
41 | 41 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
42 | 42 | || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
43 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx')); |
|
43 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('wx')); |
|
44 | 44 | } |
45 | 45 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
46 | 46 | || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
47 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning')); |
|
47 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('lightning')); |
|
48 | 48 | } |
49 | 49 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
50 | 50 | || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
51 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',array(),true)); |
|
51 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('fires', array(), true)); |
|
52 | 52 | } |
53 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('')); |
|
53 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('')); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | 57 | $output = '{"type": "FeatureCollection","features": ['; |
58 | 58 | if (!empty($spotter_array) && count($spotter_array) > 0) |
59 | 59 | { |
60 | - foreach($spotter_array as $spotter_item) |
|
60 | + foreach ($spotter_array as $spotter_item) |
|
61 | 61 | { |
62 | 62 | date_default_timezone_set('UTC'); |
63 | 63 | $output .= '{"type": "Feature",'; |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | $output .= '"icon": "'.$globalURL.'/images/'.$spotter_item['logo'].'",'; |
77 | 77 | $output .= '"type": "'.$spotter_item['type'].'",'; |
78 | 78 | if ($spotter_item['type'] == 'wx') { |
79 | - $weather = json_decode($spotter_item['description'],true); |
|
80 | - if (isset($weather['temp'])) $output.= '"temp": "'.$weather['temp'].'",'; |
|
79 | + $weather = json_decode($spotter_item['description'], true); |
|
80 | + if (isset($weather['temp'])) $output .= '"temp": "'.$weather['temp'].'",'; |
|
81 | 81 | } |
82 | 82 | $output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"'; |
83 | 83 | $output .= '},'; |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $output .= '}'; |
88 | 88 | $output .= '},'; |
89 | 89 | } |
90 | - $output = substr($output, 0, -1); |
|
90 | + $output = substr($output, 0, -1); |
|
91 | 91 | } |
92 | 92 | $output .= ']}'; |
93 | 93 | print $output; |