@@ -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 | ?> |
@@ -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 | ?> |