@@ -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']; |
@@ -12,7 +12,9 @@ discard block |
||
| 12 | 12 | public function __construct($dbc = null) { |
| 13 | 13 | $Connection = new Connection($dbc); |
| 14 | 14 | $this->db = $Connection->db(); |
| 15 | - if ($this->db === null) die('Error: No DB connection.'); |
|
| 15 | + if ($this->db === null) { |
|
| 16 | + die('Error: No DB connection.'); |
|
| 17 | + } |
|
| 16 | 18 | } |
| 17 | 19 | |
| 18 | 20 | public function get_tle($name) { |
@@ -24,8 +26,11 @@ discard block |
||
| 24 | 26 | echo $e->getMessage(); |
| 25 | 27 | } |
| 26 | 28 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 27 | - if (isset($result[0])) return $result[0]; |
|
| 28 | - else return array(); |
|
| 29 | + if (isset($result[0])) { |
|
| 30 | + return $result[0]; |
|
| 31 | + } else { |
|
| 32 | + return array(); |
|
| 33 | + } |
|
| 29 | 34 | } |
| 30 | 35 | public function get_tle_types() { |
| 31 | 36 | $query = 'SELECT DISTINCT tle_type FROM tle ORDER BY tle_type'; |
@@ -36,8 +41,11 @@ discard block |
||
| 36 | 41 | echo $e->getMessage(); |
| 37 | 42 | } |
| 38 | 43 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 39 | - if (isset($result[0])) return $result; |
|
| 40 | - else return array(); |
|
| 44 | + if (isset($result[0])) { |
|
| 45 | + return $result; |
|
| 46 | + } else { |
|
| 47 | + return array(); |
|
| 48 | + } |
|
| 41 | 49 | } |
| 42 | 50 | public function get_tle_names() { |
| 43 | 51 | $query = 'SELECT DISTINCT tle_name, tle_type FROM tle'; |
@@ -48,8 +56,11 @@ discard block |
||
| 48 | 56 | echo $e->getMessage(); |
| 49 | 57 | } |
| 50 | 58 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 51 | - if (isset($result[0])) return $result; |
|
| 52 | - else return array(); |
|
| 59 | + if (isset($result[0])) { |
|
| 60 | + return $result; |
|
| 61 | + } else { |
|
| 62 | + return array(); |
|
| 63 | + } |
|
| 53 | 64 | } |
| 54 | 65 | public function get_tle_names_type($type) { |
| 55 | 66 | $query = 'SELECT tle_name, tle_type FROM tle WHERE tle_type = :type ORDER BY tle_name'; |
@@ -60,8 +71,11 @@ discard block |
||
| 60 | 71 | echo $e->getMessage(); |
| 61 | 72 | } |
| 62 | 73 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 63 | - if (isset($result[0])) return $result; |
|
| 64 | - else return array(); |
|
| 74 | + if (isset($result[0])) { |
|
| 75 | + return $result; |
|
| 76 | + } else { |
|
| 77 | + return array(); |
|
| 78 | + } |
|
| 65 | 79 | } |
| 66 | 80 | |
| 67 | 81 | public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) { |
@@ -79,8 +93,11 @@ discard block |
||
| 79 | 93 | $result = array(); |
| 80 | 94 | foreach ($all_sat as $sat) { |
| 81 | 95 | $position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second); |
| 82 | - if (isset($position[0])) $result = array_merge($position,$result); |
|
| 83 | - else $result[] = $position; |
|
| 96 | + if (isset($position[0])) { |
|
| 97 | + $result = array_merge($position,$result); |
|
| 98 | + } else { |
|
| 99 | + $result[] = $position; |
|
| 100 | + } |
|
| 84 | 101 | } |
| 85 | 102 | return $result; |
| 86 | 103 | } |
@@ -96,7 +113,9 @@ discard block |
||
| 96 | 113 | $sat = new Predict_Sat($tle); |
| 97 | 114 | $predict = new Predict(); |
| 98 | 115 | //if ($timestamp == '') $now = Predict_Time::get_current_daynum(); |
| 99 | - if ($timestamp_begin == '') $timestamp_begin = time(); |
|
| 116 | + if ($timestamp_begin == '') { |
|
| 117 | + $timestamp_begin = time(); |
|
| 118 | + } |
|
| 100 | 119 | if ($timestamp_end == '') { |
| 101 | 120 | $now = Predict_Time::unix2daynum($timestamp_begin); |
| 102 | 121 | $predict->predict_calc($sat,$qth,$now); |
@@ -121,8 +140,11 @@ discard block |
||
| 121 | 140 | echo $e->getMessage(); |
| 122 | 141 | } |
| 123 | 142 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 124 | - if (isset($result[0])) return $result[0]; |
|
| 125 | - else return array(); |
|
| 143 | + if (isset($result[0])) { |
|
| 144 | + return $result[0]; |
|
| 145 | + } else { |
|
| 146 | + return array(); |
|
| 147 | + } |
|
| 126 | 148 | } |
| 127 | 149 | |
| 128 | 150 | /** |
@@ -140,7 +162,9 @@ discard block |
||
| 140 | 162 | FROM satellite".$filter_query." satellite.launch_site <> '' AND satellite.launch_site IS NOT NULL"; |
| 141 | 163 | $query_values = array(); |
| 142 | 164 | $query .= " GROUP BY satellite.launch_site ORDER BY launch_site_count DESC"; |
| 143 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 165 | + if ($limit) { |
|
| 166 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 167 | + } |
|
| 144 | 168 | $sth = $this->db->prepare($query); |
| 145 | 169 | $sth->execute($query_values); |
| 146 | 170 | $launch_site_array = array(); |
@@ -169,7 +193,9 @@ discard block |
||
| 169 | 193 | FROM satellite".$filter_query." satellite.owner <> '' AND satellite.owner IS NOT NULL"; |
| 170 | 194 | $query_values = array(); |
| 171 | 195 | $query .= " GROUP BY satellite.owner ORDER BY owner_count DESC"; |
| 172 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 196 | + if ($limit) { |
|
| 197 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 198 | + } |
|
| 173 | 199 | $sth = $this->db->prepare($query); |
| 174 | 200 | $sth->execute($query_values); |
| 175 | 201 | $owner_array = array(); |
@@ -198,7 +224,9 @@ discard block |
||
| 198 | 224 | FROM satellite".$filter_query." satellite.country_owner <> '' AND satellite.country_owner IS NOT NULL"; |
| 199 | 225 | $query_values = array(); |
| 200 | 226 | $query .= " GROUP BY satellite.country_owner ORDER BY country_count DESC"; |
| 201 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 227 | + if ($limit) { |
|
| 228 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 229 | + } |
|
| 202 | 230 | $sth = $this->db->prepare($query); |
| 203 | 231 | $sth->execute($query_values); |
| 204 | 232 | $owner_array = array(); |
@@ -225,20 +253,26 @@ discard block |
||
| 225 | 253 | date_default_timezone_set($globalTimezone); |
| 226 | 254 | $datetime = new DateTime(); |
| 227 | 255 | $offset = $datetime->format('P'); |
| 228 | - } else $offset = '+00:00'; |
|
| 256 | + } else { |
|
| 257 | + $offset = '+00:00'; |
|
| 258 | + } |
|
| 229 | 259 | //$filter_query = $this->getFilter($filters,true,true); |
| 230 | 260 | $filter_query = ' WHERE'; |
| 231 | 261 | if ($globalDBdriver == 'mysql') { |
| 232 | 262 | $query = "SELECT MONTH(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 233 | 263 | FROM satellite".$filter_query." satellite.launch_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
| 234 | - if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
| 264 | + if ($sincedate != '') { |
|
| 265 | + $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
| 266 | + } |
|
| 235 | 267 | $query .= " GROUP BY year_name, month_name |
| 236 | 268 | ORDER BY year_name, month_name ASC"; |
| 237 | 269 | $query_data = array(':offset' => $offset); |
| 238 | 270 | } else { |
| 239 | 271 | $query = "SELECT EXTRACT(MONTH FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS month_name, EXTRACT(YEAR FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS year_name, count(*) as date_count |
| 240 | 272 | FROM satellite".$filter_query." satellite.launch_date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 YEARS'"; |
| 241 | - if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
| 273 | + if ($sincedate != '') { |
|
| 274 | + $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
| 275 | + } |
|
| 242 | 276 | $query .= " GROUP BY year_name, month_name |
| 243 | 277 | ORDER BY year_name, month_name ASC"; |
| 244 | 278 | $query_data = array(':offset' => $offset); |
@@ -270,20 +304,26 @@ discard block |
||
| 270 | 304 | date_default_timezone_set($globalTimezone); |
| 271 | 305 | $datetime = new DateTime(); |
| 272 | 306 | $offset = $datetime->format('P'); |
| 273 | - } else $offset = '+00:00'; |
|
| 307 | + } else { |
|
| 308 | + $offset = '+00:00'; |
|
| 309 | + } |
|
| 274 | 310 | //$filter_query = $this->getFilter($filters,true,true); |
| 275 | 311 | $filter_query = ' WHERE'; |
| 276 | 312 | if ($globalDBdriver == 'mysql') { |
| 277 | 313 | $query = "SELECT YEAR(CONVERT_TZ(satellite.launch_date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 278 | 314 | FROM satellite".$filter_query." satellite.launch_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 YEAR)"; |
| 279 | - if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
| 315 | + if ($sincedate != '') { |
|
| 316 | + $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
| 317 | + } |
|
| 280 | 318 | $query .= " GROUP BY year_name |
| 281 | 319 | ORDER BY year_name ASC"; |
| 282 | 320 | $query_data = array(':offset' => $offset); |
| 283 | 321 | } else { |
| 284 | 322 | $query = "SELECT EXTRACT(YEAR FROM satellite.launch_date AT TIME ZONE INTERVAL :offset) AS year_name, count(*) as date_count |
| 285 | 323 | FROM satellite".$filter_query." satellite.launch_date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '10 YEARS'"; |
| 286 | - if ($sincedate != '') $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
| 324 | + if ($sincedate != '') { |
|
| 325 | + $query .= " AND satellite.launch_date > '".$sincedate."'"; |
|
| 326 | + } |
|
| 287 | 327 | $query .= " GROUP BY year_name |
| 288 | 328 | ORDER BY year_name ASC"; |
| 289 | 329 | $query_data = array(':offset' => $offset); |
@@ -5,8 +5,11 @@ discard block |
||
| 5 | 5 | setcookie("MapFormat",'2d'); |
| 6 | 6 | |
| 7 | 7 | // Compressed GeoJson is used if true |
| 8 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 9 | -else $compress = $globalJsonCompress; |
|
| 8 | +if (!isset($globalJsonCompress)) { |
|
| 9 | + $compress = true; |
|
| 10 | +} else { |
|
| 11 | + $compress = $globalJsonCompress; |
|
| 12 | +} |
|
| 10 | 13 | $compress = false; |
| 11 | 14 | ?> |
| 12 | 15 | |
@@ -159,9 +162,13 @@ discard block |
||
| 159 | 162 | if (callsign != ""){ markerSatelliteLabel += callsign; } |
| 160 | 163 | if (type != ""){ markerSatelliteLabel += ' - '+type; } |
| 161 | 164 | <?php |
| 162 | - if (isset($_COOKIE['SatelliteIconColor'])) $IconColor = $_COOKIE['SatelliteIconColor']; |
|
| 163 | - elseif (isset($globalSatelliteIconColor)) $IconColor = $globalSatelliteIconColor; |
|
| 164 | - else $IconColor = '1a3151'; |
|
| 165 | + if (isset($_COOKIE['SatelliteIconColor'])) { |
|
| 166 | + $IconColor = $_COOKIE['SatelliteIconColor']; |
|
| 167 | + } elseif (isset($globalSatelliteIconColor)) { |
|
| 168 | + $IconColor = $globalSatelliteIconColor; |
|
| 169 | + } else { |
|
| 170 | + $IconColor = '1a3151'; |
|
| 171 | + } |
|
| 165 | 172 | if (!isset($ident) && !isset($famsatid)) { |
| 166 | 173 | ?> |
| 167 | 174 | info_satellite_update(feature.properties.fc); |
@@ -195,7 +202,12 @@ discard block |
||
| 195 | 202 | <?php |
| 196 | 203 | } else { |
| 197 | 204 | ?> |
| 198 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 205 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 206 | + print $archiveupdatetime*1000; |
|
| 207 | +} else { |
|
| 208 | + print $globalMapRefresh*1000+20000; |
|
| 209 | +} |
|
| 210 | +?>+feature.properties.sqt*1000); |
|
| 199 | 211 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 200 | 212 | <?php |
| 201 | 213 | } |
@@ -251,7 +263,12 @@ discard block |
||
| 251 | 263 | <?php |
| 252 | 264 | } else { |
| 253 | 265 | ?> |
| 254 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 266 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 267 | + print $archiveupdatetime*1000; |
|
| 268 | +} else { |
|
| 269 | + print $globalMapRefresh*1000+20000; |
|
| 270 | +} |
|
| 271 | +?>+feature.properties.sqt*1000); |
|
| 255 | 272 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 256 | 273 | <?php |
| 257 | 274 | } |
@@ -306,7 +323,12 @@ discard block |
||
| 306 | 323 | <?php |
| 307 | 324 | } else { |
| 308 | 325 | ?> |
| 309 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 326 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 327 | + print $archiveupdatetime*1000; |
|
| 328 | +} else { |
|
| 329 | + print $globalMapRefresh*1000+20000; |
|
| 330 | +} |
|
| 331 | +?>+feature.properties.sqt*1000); |
|
| 310 | 332 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 311 | 333 | <?php |
| 312 | 334 | } |
@@ -601,14 +623,24 @@ discard block |
||
| 601 | 623 | if (isset($archive) && $archive) { |
| 602 | 624 | ?> |
| 603 | 625 | //then load it again every 30 seconds |
| 604 | -// var reload = setInterval(function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); |
|
| 626 | +// var reload = setInterval(function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) { |
|
| 627 | + print ($globalMapRefresh*1000)/2; |
|
| 628 | +} else { |
|
| 629 | + print '15000'; |
|
| 630 | +} |
|
| 631 | +?>); |
|
| 605 | 632 | reloadSatellitePage = setInterval(function(){if (noTimeout) updateSat(0)},<?php print $archiveupdatetime*1000; ?>); |
| 606 | 633 | <?php |
| 607 | 634 | } else { |
| 608 | 635 | ?> |
| 609 | 636 | //then load it again every 30 seconds |
| 610 | 637 | reloadSatellitePage = setInterval( |
| 611 | - function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 638 | + function(){if (noTimeout) updateSat(0)},<?php if (isset($globalMapRefresh)) { |
|
| 639 | + print $globalMapRefresh*1000; |
|
| 640 | +} else { |
|
| 641 | + print '30000'; |
|
| 642 | +} |
|
| 643 | +?>); |
|
| 612 | 644 | <?php |
| 613 | 645 | } |
| 614 | 646 | ?> |
@@ -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 | ?> |
@@ -64,13 +64,19 @@ discard block |
||
| 64 | 64 | $nextlatlon = $Satellite->position($spotter_item['name'],time()+$globalMapRefresh+20); |
| 65 | 65 | $nextlat = $nextlatlon['latitude']; |
| 66 | 66 | if (abs($nextlat-$spotter_item['latitude']) > 90) { |
| 67 | - if ($spotter_item['latitude'] < 0) $nexlat = -90; |
|
| 68 | - else $nexlat = 90; |
|
| 67 | + if ($spotter_item['latitude'] < 0) { |
|
| 68 | + $nexlat = -90; |
|
| 69 | + } else { |
|
| 70 | + $nexlat = 90; |
|
| 71 | + } |
|
| 69 | 72 | } |
| 70 | 73 | $nextlon = $nextlatlon['longitude']; |
| 71 | 74 | if (abs($nextlon-$spotter_item['longitude']) > 180) { |
| 72 | - if ($spotter_item['longitude'] < 0) $nextlon = -180; |
|
| 73 | - else $nextlon = 180; |
|
| 75 | + if ($spotter_item['longitude'] < 0) { |
|
| 76 | + $nextlon = -180; |
|
| 77 | + } else { |
|
| 78 | + $nextlon = 180; |
|
| 79 | + } |
|
| 74 | 80 | } |
| 75 | 81 | $output_data .= '"nextlatlon":['.$nextlat.','.$nextlon.']},'; |
| 76 | 82 | //$output_data .= '"heading":"'.$Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$nextlatlon['latitude'],$nextlatlon['longitude']).'",'; |
@@ -99,7 +105,9 @@ discard block |
||
| 99 | 105 | } |
| 100 | 106 | } |
| 101 | 107 | } |
| 102 | -if (isset($output_data)) $output = substr($output,0,-1); |
|
| 108 | +if (isset($output_data)) { |
|
| 109 | + $output = substr($output,0,-1); |
|
| 110 | +} |
|
| 103 | 111 | $output .= ']}'; |
| 104 | 112 | print $output; |
| 105 | 113 | ?> |
@@ -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') { |
| 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; |