@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 19 | 19 | |
| 20 | 20 | $spotter_array = $Spotter->getAllFlightsforSitemap(); |
| 21 | - foreach($spotter_array as $spotter_item) |
|
| 21 | + foreach ($spotter_array as $spotter_item) |
|
| 22 | 22 | { |
| 23 | 23 | $output .= '<url>'; |
| 24 | 24 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>'; |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | $output .= '</urlset>'; |
| 30 | 30 | |
| 31 | 31 | |
| 32 | -} else if (isset($_GET['type']) && $_GET['type'] == "aircraft"){ |
|
| 32 | +} else if (isset($_GET['type']) && $_GET['type'] == "aircraft") { |
|
| 33 | 33 | |
| 34 | 34 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 35 | 35 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 36 | 36 | $aircraft_types = $Stats->getAllAircraftTypes(); |
| 37 | 37 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
| 38 | - foreach($aircraft_types as $aircraft_item) |
|
| 38 | + foreach ($aircraft_types as $aircraft_item) |
|
| 39 | 39 | { |
| 40 | 40 | $output .= '<url>'; |
| 41 | 41 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>'; |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | $output .= '</urlset>'; |
| 47 | 47 | |
| 48 | 48 | |
| 49 | -} else if (isset($_GET['type']) && $_GET['type'] == "registration"){ |
|
| 49 | +} else if (isset($_GET['type']) && $_GET['type'] == "registration") { |
|
| 50 | 50 | |
| 51 | 51 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 52 | 52 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 53 | 53 | |
| 54 | 54 | $aircraft_registrations = $Spotter->getAllAircraftRegistrations(); |
| 55 | - foreach($aircraft_registrations as $aircraft_item) |
|
| 55 | + foreach ($aircraft_registrations as $aircraft_item) |
|
| 56 | 56 | { |
| 57 | 57 | $output .= '<url>'; |
| 58 | 58 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>'; |
@@ -62,13 +62,13 @@ discard block |
||
| 62 | 62 | } |
| 63 | 63 | $output .= '</urlset>'; |
| 64 | 64 | |
| 65 | -} else if (isset($_GET['type']) && $_GET['type'] == "airline"){ |
|
| 65 | +} else if (isset($_GET['type']) && $_GET['type'] == "airline") { |
|
| 66 | 66 | |
| 67 | 67 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 68 | 68 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 69 | 69 | |
| 70 | 70 | $airline_names = $Stats->getAllAirlineNames(); |
| 71 | - foreach($airline_names as $airline_item) |
|
| 71 | + foreach ($airline_names as $airline_item) |
|
| 72 | 72 | { |
| 73 | 73 | $output .= '<url>'; |
| 74 | 74 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>'; |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | $output .= '</urlset>'; |
| 80 | 80 | |
| 81 | -} else if (isset($_GET['type']) && $_GET['type'] == "airport"){ |
|
| 81 | +} else if (isset($_GET['type']) && $_GET['type'] == "airport") { |
|
| 82 | 82 | |
| 83 | 83 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 84 | 84 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 85 | 85 | |
| 86 | 86 | $airport_names = $Stats->getAllAirportNames(); |
| 87 | 87 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
| 88 | - foreach($airport_names as $airport_item) |
|
| 88 | + foreach ($airport_names as $airport_item) |
|
| 89 | 89 | { |
| 90 | 90 | $output .= '<url>'; |
| 91 | 91 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>'; |
@@ -95,12 +95,12 @@ discard block |
||
| 95 | 95 | } |
| 96 | 96 | $output .= '</urlset>'; |
| 97 | 97 | |
| 98 | -} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer"){ |
|
| 98 | +} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer") { |
|
| 99 | 99 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 100 | 100 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 101 | 101 | $manufacturer_names = $Stats->getAllManufacturers(); |
| 102 | 102 | if (empty($manufacturer_names)) $manufacturer_names = $Spotter->getAllManufacturers(); |
| 103 | - foreach($manufacturer_names as $manufacturer_item) |
|
| 103 | + foreach ($manufacturer_names as $manufacturer_item) |
|
| 104 | 104 | { |
| 105 | 105 | $output .= '<url>'; |
| 106 | 106 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.urlencode(strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer']))).'</loc>'; |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | $output .= '</url>'; |
| 110 | 110 | } |
| 111 | 111 | $output .= '</urlset>'; |
| 112 | -} else if (isset($_GET['type']) && $_GET['type'] == "country"){ |
|
| 112 | +} else if (isset($_GET['type']) && $_GET['type'] == "country") { |
|
| 113 | 113 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 114 | 114 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 115 | 115 | $country_names = $Spotter->getAllCountries(); |
| 116 | - foreach($country_names as $country_item) |
|
| 116 | + foreach ($country_names as $country_item) |
|
| 117 | 117 | { |
| 118 | 118 | $output .= '<url>'; |
| 119 | 119 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.urlencode(strtolower(str_replace(" ", "-", $country_item['country']))).'</loc>'; |
@@ -122,11 +122,11 @@ discard block |
||
| 122 | 122 | $output .= '</url>'; |
| 123 | 123 | } |
| 124 | 124 | $output .= '</urlset>'; |
| 125 | -} else if (isset($_GET['type']) && $_GET['type'] == "ident"){ |
|
| 125 | +} else if (isset($_GET['type']) && $_GET['type'] == "ident") { |
|
| 126 | 126 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 127 | 127 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 128 | 128 | $ident_names = $Spotter->getAllIdents(); |
| 129 | - foreach($ident_names as $ident_item) |
|
| 129 | + foreach ($ident_names as $ident_item) |
|
| 130 | 130 | { |
| 131 | 131 | if (ctype_alnum($ident_item['ident'])) { |
| 132 | 132 | $output .= '<url>'; |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | $output .= '</urlset>'; |
| 140 | -} else if (isset($_GET['type']) && $_GET['type'] == "marine-ident"){ |
|
| 140 | +} else if (isset($_GET['type']) && $_GET['type'] == "marine-ident") { |
|
| 141 | 141 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 142 | 142 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 143 | 143 | $ident_names = $Marine->getAllIdents(); |
| 144 | - foreach($ident_names as $ident_item) |
|
| 144 | + foreach ($ident_names as $ident_item) |
|
| 145 | 145 | { |
| 146 | 146 | if (ctype_alnum($ident_item['ident'])) { |
| 147 | 147 | $output .= '<url>'; |
@@ -152,11 +152,11 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | $output .= '</urlset>'; |
| 155 | -} else if (isset($_GET['type']) && $_GET['type'] == "date"){ |
|
| 155 | +} else if (isset($_GET['type']) && $_GET['type'] == "date") { |
|
| 156 | 156 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 157 | 157 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 158 | 158 | $date_names = $Spotter->getAllDates(); |
| 159 | - foreach($date_names as $date_item) |
|
| 159 | + foreach ($date_names as $date_item) |
|
| 160 | 160 | { |
| 161 | 161 | $output .= '<url>'; |
| 162 | 162 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>'; |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | $output .= '</url>'; |
| 166 | 166 | } |
| 167 | 167 | $output .= '</urlset>'; |
| 168 | -} else if (isset($_GET['type']) && $_GET['type'] == "marine-date"){ |
|
| 168 | +} else if (isset($_GET['type']) && $_GET['type'] == "marine-date") { |
|
| 169 | 169 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 170 | 170 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 171 | 171 | $date_names = $Marine->getAllDates(); |
| 172 | - foreach($date_names as $date_item) |
|
| 172 | + foreach ($date_names as $date_item) |
|
| 173 | 173 | { |
| 174 | 174 | $output .= '<url>'; |
| 175 | 175 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/marine/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>'; |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | $output .= '</url>'; |
| 179 | 179 | } |
| 180 | 180 | $output .= '</urlset>'; |
| 181 | -} else if (isset($_GET['type']) && $_GET['type'] == "tracker-date"){ |
|
| 181 | +} else if (isset($_GET['type']) && $_GET['type'] == "tracker-date") { |
|
| 182 | 182 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 183 | 183 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 184 | 184 | $date_names = $Tracker->getAllDates(); |
| 185 | - foreach($date_names as $date_item) |
|
| 185 | + foreach ($date_names as $date_item) |
|
| 186 | 186 | { |
| 187 | 187 | $output .= '<url>'; |
| 188 | 188 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/tracker/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>'; |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | $output .= '</url>'; |
| 192 | 192 | } |
| 193 | 193 | $output .= '</urlset>'; |
| 194 | -} else if (isset($_GET['type']) && $_GET['type'] == "route"){ |
|
| 194 | +} else if (isset($_GET['type']) && $_GET['type'] == "route") { |
|
| 195 | 195 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 196 | 196 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 197 | 197 | $route_names = $Spotter->getAllRoutes(); |
| 198 | - foreach($route_names as $route_item) |
|
| 198 | + foreach ($route_names as $route_item) |
|
| 199 | 199 | { |
| 200 | 200 | $output .= '<url>'; |
| 201 | 201 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>'; |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | $output .= '</url>'; |
| 205 | 205 | } |
| 206 | 206 | $output .= '</urlset>'; |
| 207 | -} else if (isset($_GET['type']) && $_GET['type'] == "static"){ |
|
| 207 | +} else if (isset($_GET['type']) && $_GET['type'] == "static") { |
|
| 208 | 208 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 209 | 209 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 210 | 210 | /* STATIC PAGES */ |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | $output .= '<changefreq>daily</changefreq>'; |
| 323 | 323 | $output .= '</url>'; |
| 324 | 324 | $output .= '</urlset>'; |
| 325 | -} else if (isset($_GET['type']) && $_GET['type'] == "marine-static"){ |
|
| 325 | +} else if (isset($_GET['type']) && $_GET['type'] == "marine-static") { |
|
| 326 | 326 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 327 | 327 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 328 | 328 | /* STATIC PAGES */ |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $output .= '<changefreq>daily</changefreq>'; |
| 349 | 349 | $output .= '</url>'; |
| 350 | 350 | $output .= '</urlset>'; |
| 351 | -} else if (isset($_GET['type']) && $_GET['type'] == "tracker-static"){ |
|
| 351 | +} else if (isset($_GET['type']) && $_GET['type'] == "tracker-static") { |
|
| 352 | 352 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
| 353 | 353 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
| 354 | 354 | /* STATIC PAGES */ |
@@ -14,33 +14,33 @@ discard block |
||
| 14 | 14 | * @param Array $filter the filter |
| 15 | 15 | * @return Array the SQL part |
| 16 | 16 | */ |
| 17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 19 | 19 | $filters = array(); |
| 20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
| 23 | 23 | } else { |
| 24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | if (isset($filter[0]['source'])) { |
| 28 | - $filters = array_merge($filters,$filter); |
|
| 28 | + $filters = array_merge($filters, $filter); |
|
| 29 | 29 | } |
| 30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 31 | 31 | $filter_query_join = ''; |
| 32 | 32 | $filter_query_where = ''; |
| 33 | - foreach($filters as $flt) { |
|
| 33 | + foreach ($filters as $flt) { |
|
| 34 | 34 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 35 | 35 | if (isset($flt['source'])) { |
| 36 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
| 36 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
| 37 | 37 | } else { |
| 38 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
| 38 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 43 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 43 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 44 | 44 | } |
| 45 | 45 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 46 | 46 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -68,38 +68,38 @@ discard block |
||
| 68 | 68 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_archive_output.date) = '".$filter['day']."'"; |
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
| 71 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
| 72 | 72 | } |
| 73 | 73 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 74 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 74 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 75 | 75 | } |
| 76 | 76 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 77 | 77 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 78 | 78 | if ($filter_query_where != '') { |
| 79 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 79 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 80 | 80 | } |
| 81 | 81 | $filter_query = $filter_query_join.$filter_query_where; |
| 82 | 82 | return $filter_query; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // tracker_archive |
| 86 | - public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') { |
|
| 86 | + public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') { |
|
| 87 | 87 | require_once(dirname(__FILE__).'/class.Tracker.php'); |
| 88 | 88 | if ($over_country == '') { |
| 89 | 89 | $Tracker = new Tracker($this->db); |
| 90 | - $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
| 90 | + $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
| 91 | 91 | if (!empty($data_country)) $country = $data_country['iso2']; |
| 92 | 92 | else $country = ''; |
| 93 | 93 | } else $country = $over_country; |
| 94 | 94 | // Route is not added in tracker_archive |
| 95 | - $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
| 95 | + $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
| 96 | 96 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
| 97 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $country,':comment' => $comment,':type' => $type); |
|
| 97 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $country, ':comment' => $comment, ':type' => $type); |
|
| 98 | 98 | try { |
| 99 | 99 | $sth = $this->db->prepare($query); |
| 100 | 100 | $sth->execute($query_values); |
| 101 | 101 | $sth->closeCursor(); |
| 102 | - } catch(PDOException $e) { |
|
| 102 | + } catch (PDOException $e) { |
|
| 103 | 103 | return "error : ".$e->getMessage(); |
| 104 | 104 | } |
| 105 | 105 | return "success"; |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 121 | 121 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
| 122 | - $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 122 | + $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 123 | 123 | |
| 124 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
| 124 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident)); |
|
| 125 | 125 | |
| 126 | 126 | return $spotter_array; |
| 127 | 127 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 141 | 141 | //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
| 142 | 142 | //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
| 143 | - $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
| 143 | + $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
| 144 | 144 | |
| 145 | 145 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
| 146 | 146 | /* |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | } |
| 154 | 154 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
| 155 | 155 | */ |
| 156 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
| 156 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id)); |
|
| 157 | 157 | |
| 158 | 158 | return $spotter_array; |
| 159 | 159 | } |
@@ -168,14 +168,14 @@ discard block |
||
| 168 | 168 | { |
| 169 | 169 | date_default_timezone_set('UTC'); |
| 170 | 170 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 171 | - $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 171 | + $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 172 | 172 | |
| 173 | 173 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
| 174 | 174 | |
| 175 | 175 | try { |
| 176 | 176 | $sth = $this->db->prepare($query); |
| 177 | 177 | $sth->execute(array(':id' => $id)); |
| 178 | - } catch(PDOException $e) { |
|
| 178 | + } catch (PDOException $e) { |
|
| 179 | 179 | echo $e->getMessage(); |
| 180 | 180 | die; |
| 181 | 181 | } |
@@ -194,14 +194,14 @@ discard block |
||
| 194 | 194 | { |
| 195 | 195 | date_default_timezone_set('UTC'); |
| 196 | 196 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 197 | - $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
| 197 | + $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
| 198 | 198 | |
| 199 | 199 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
| 200 | 200 | |
| 201 | 201 | try { |
| 202 | 202 | $sth = $this->db->prepare($query); |
| 203 | 203 | $sth->execute(array(':id' => $id)); |
| 204 | - } catch(PDOException $e) { |
|
| 204 | + } catch (PDOException $e) { |
|
| 205 | 205 | echo $e->getMessage(); |
| 206 | 206 | die; |
| 207 | 207 | } |
@@ -223,12 +223,12 @@ discard block |
||
| 223 | 223 | date_default_timezone_set('UTC'); |
| 224 | 224 | |
| 225 | 225 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 226 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 226 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 227 | 227 | |
| 228 | 228 | try { |
| 229 | 229 | $sth = $this->db->prepare($query); |
| 230 | 230 | $sth->execute(array(':ident' => $ident)); |
| 231 | - } catch(PDOException $e) { |
|
| 231 | + } catch (PDOException $e) { |
|
| 232 | 232 | echo $e->getMessage(); |
| 233 | 233 | die; |
| 234 | 234 | } |
@@ -249,12 +249,12 @@ discard block |
||
| 249 | 249 | date_default_timezone_set('UTC'); |
| 250 | 250 | |
| 251 | 251 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 252 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 252 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
| 253 | 253 | |
| 254 | 254 | try { |
| 255 | 255 | $sth = $this->db->prepare($query); |
| 256 | 256 | $sth->execute(array(':id' => $id)); |
| 257 | - } catch(PDOException $e) { |
|
| 257 | + } catch (PDOException $e) { |
|
| 258 | 258 | echo $e->getMessage(); |
| 259 | 259 | die; |
| 260 | 260 | } |
@@ -275,12 +275,12 @@ discard block |
||
| 275 | 275 | date_default_timezone_set('UTC'); |
| 276 | 276 | |
| 277 | 277 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 278 | - $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 278 | + $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
| 279 | 279 | |
| 280 | 280 | try { |
| 281 | 281 | $sth = $this->db->prepare($query); |
| 282 | 282 | $sth->execute(array(':id' => $id)); |
| 283 | - } catch(PDOException $e) { |
|
| 283 | + } catch (PDOException $e) { |
|
| 284 | 284 | echo $e->getMessage(); |
| 285 | 285 | die; |
| 286 | 286 | } |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | date_default_timezone_set('UTC'); |
| 303 | 303 | |
| 304 | 304 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 305 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
| 305 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
| 306 | 306 | // $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
| 307 | 307 | |
| 308 | 308 | try { |
| 309 | 309 | $sth = $this->db->prepare($query); |
| 310 | 310 | $sth->execute(array(':ident' => $ident)); |
| 311 | - } catch(PDOException $e) { |
|
| 311 | + } catch (PDOException $e) { |
|
| 312 | 312 | echo $e->getMessage(); |
| 313 | 313 | die; |
| 314 | 314 | } |
@@ -325,13 +325,13 @@ discard block |
||
| 325 | 325 | * @return Array the spotter information |
| 326 | 326 | * |
| 327 | 327 | */ |
| 328 | - public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
| 328 | + public function getTrackerArchiveData($ident, $famtrackid, $date) |
|
| 329 | 329 | { |
| 330 | 330 | $Tracker = new Tracker($this->db); |
| 331 | 331 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 332 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
| 332 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
| 333 | 333 | |
| 334 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
| 334 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':famtrackid' => $famtrackid, ':date' => $date.'%')); |
|
| 335 | 335 | |
| 336 | 336 | return $spotter_array; |
| 337 | 337 | } |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | try { |
| 348 | 348 | $sth = $this->db->prepare($query); |
| 349 | 349 | $sth->execute(); |
| 350 | - } catch(PDOException $e) { |
|
| 350 | + } catch (PDOException $e) { |
|
| 351 | 351 | echo $e->getMessage(); |
| 352 | 352 | die; |
| 353 | 353 | } |
@@ -359,24 +359,24 @@ discard block |
||
| 359 | 359 | * @return Array the spotter information |
| 360 | 360 | * |
| 361 | 361 | */ |
| 362 | - public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
| 362 | + public function getMinLiveTrackerData($begindate, $enddate, $filter = array()) |
|
| 363 | 363 | { |
| 364 | 364 | global $globalDBdriver, $globalLiveInterval; |
| 365 | 365 | date_default_timezone_set('UTC'); |
| 366 | 366 | |
| 367 | 367 | $filter_query = ''; |
| 368 | 368 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 369 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 369 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
| 370 | 370 | } |
| 371 | 371 | // Use spotter_output also ? |
| 372 | 372 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 373 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 373 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 374 | 374 | } |
| 375 | 375 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 376 | 376 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
| 377 | 377 | } |
| 378 | 378 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 379 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 379 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -395,14 +395,14 @@ discard block |
||
| 395 | 395 | GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid |
| 396 | 396 | AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
| 397 | 397 | */ |
| 398 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 398 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 399 | 399 | FROM tracker_archive |
| 400 | 400 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
| 401 | 401 | WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
| 402 | 402 | '.$filter_query.' ORDER BY famtrackid'; |
| 403 | 403 | } else { |
| 404 | 404 | //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
| 405 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 405 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
| 406 | 406 | FROM tracker_archive |
| 407 | 407 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
| 408 | 408 | WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | try { |
| 413 | 413 | $sth = $this->db->prepare($query); |
| 414 | 414 | $sth->execute(); |
| 415 | - } catch(PDOException $e) { |
|
| 415 | + } catch (PDOException $e) { |
|
| 416 | 416 | echo $e->getMessage(); |
| 417 | 417 | die; |
| 418 | 418 | } |
@@ -427,24 +427,24 @@ discard block |
||
| 427 | 427 | * @return Array the spotter information |
| 428 | 428 | * |
| 429 | 429 | */ |
| 430 | - public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
| 430 | + public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array()) |
|
| 431 | 431 | { |
| 432 | 432 | global $globalDBdriver, $globalLiveInterval; |
| 433 | 433 | date_default_timezone_set('UTC'); |
| 434 | 434 | |
| 435 | 435 | $filter_query = ''; |
| 436 | 436 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 437 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 437 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
| 438 | 438 | } |
| 439 | 439 | // Should use spotter_output also ? |
| 440 | 440 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 441 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 441 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 442 | 442 | } |
| 443 | 443 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 444 | 444 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
| 445 | 445 | } |
| 446 | 446 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 447 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 447 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | FROM tracker_archive |
| 455 | 455 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
| 456 | 456 | */ |
| 457 | - $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
| 457 | + $query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk |
|
| 458 | 458 | FROM tracker_archive_output |
| 459 | 459 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao |
| 460 | 460 | WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
| 470 | 470 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
| 471 | 471 | */ |
| 472 | - $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
| 472 | + $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
| 473 | 473 | FROM tracker_archive_output |
| 474 | 474 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
| 475 | 475 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | try { |
| 482 | 482 | $sth = $this->db->prepare($query); |
| 483 | 483 | $sth->execute(); |
| 484 | - } catch(PDOException $e) { |
|
| 484 | + } catch (PDOException $e) { |
|
| 485 | 485 | echo $e->getMessage(); |
| 486 | 486 | die; |
| 487 | 487 | } |
@@ -496,23 +496,23 @@ discard block |
||
| 496 | 496 | * @return Array the spotter information |
| 497 | 497 | * |
| 498 | 498 | */ |
| 499 | - public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
| 499 | + public function getLiveTrackerCount($begindate, $enddate, $filter = array()) |
|
| 500 | 500 | { |
| 501 | 501 | global $globalDBdriver, $globalLiveInterval; |
| 502 | 502 | date_default_timezone_set('UTC'); |
| 503 | 503 | |
| 504 | 504 | $filter_query = ''; |
| 505 | 505 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 506 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 506 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
| 507 | 507 | } |
| 508 | 508 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 509 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 509 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
| 510 | 510 | } |
| 511 | 511 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 512 | 512 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
| 513 | 513 | } |
| 514 | 514 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 515 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 515 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | try { |
| 528 | 528 | $sth = $this->db->prepare($query); |
| 529 | 529 | $sth->execute(); |
| 530 | - } catch(PDOException $e) { |
|
| 530 | + } catch (PDOException $e) { |
|
| 531 | 531 | echo $e->getMessage(); |
| 532 | 532 | die; |
| 533 | 533 | } |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | * @return Array the spotter information |
| 548 | 548 | * |
| 549 | 549 | */ |
| 550 | - public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
| 550 | + public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
| 551 | 551 | { |
| 552 | 552 | global $globalTimezone, $globalDBdriver; |
| 553 | 553 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | |
| 570 | 570 | $q_array = explode(" ", $q); |
| 571 | 571 | |
| 572 | - foreach ($q_array as $q_item){ |
|
| 572 | + foreach ($q_array as $q_item) { |
|
| 573 | 573 | $additional_query .= " AND ("; |
| 574 | 574 | $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
| 575 | 575 | $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | |
| 602 | 602 | if ($registration != "") |
| 603 | 603 | { |
| 604 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 604 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 605 | 605 | if (!is_string($registration)) |
| 606 | 606 | { |
| 607 | 607 | return false; |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | |
| 613 | 613 | if ($aircraft_icao != "") |
| 614 | 614 | { |
| 615 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 615 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 616 | 616 | if (!is_string($aircraft_icao)) |
| 617 | 617 | { |
| 618 | 618 | return false; |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | |
| 624 | 624 | if ($aircraft_manufacturer != "") |
| 625 | 625 | { |
| 626 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 626 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 627 | 627 | if (!is_string($aircraft_manufacturer)) |
| 628 | 628 | { |
| 629 | 629 | return false; |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | |
| 645 | 645 | if ($airline_icao != "") |
| 646 | 646 | { |
| 647 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 647 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 648 | 648 | if (!is_string($airline_icao)) |
| 649 | 649 | { |
| 650 | 650 | return false; |
@@ -655,7 +655,7 @@ discard block |
||
| 655 | 655 | |
| 656 | 656 | if ($airline_country != "") |
| 657 | 657 | { |
| 658 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 658 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
| 659 | 659 | if (!is_string($airline_country)) |
| 660 | 660 | { |
| 661 | 661 | return false; |
@@ -666,7 +666,7 @@ discard block |
||
| 666 | 666 | |
| 667 | 667 | if ($airline_type != "") |
| 668 | 668 | { |
| 669 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 669 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
| 670 | 670 | if (!is_string($airline_type)) |
| 671 | 671 | { |
| 672 | 672 | return false; |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | |
| 689 | 689 | if ($airport != "") |
| 690 | 690 | { |
| 691 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 691 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 692 | 692 | if (!is_string($airport)) |
| 693 | 693 | { |
| 694 | 694 | return false; |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | |
| 700 | 700 | if ($airport_country != "") |
| 701 | 701 | { |
| 702 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 702 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
| 703 | 703 | if (!is_string($airport_country)) |
| 704 | 704 | { |
| 705 | 705 | return false; |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | |
| 711 | 711 | if ($callsign != "") |
| 712 | 712 | { |
| 713 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 713 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 714 | 714 | if (!is_string($callsign)) |
| 715 | 715 | { |
| 716 | 716 | return false; |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | $translate = $Translation->ident2icao($callsign); |
| 719 | 719 | if ($translate != $callsign) { |
| 720 | 720 | $additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
| 721 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
| 721 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
| 722 | 722 | } else { |
| 723 | 723 | $additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
| 724 | 724 | } |
@@ -727,7 +727,7 @@ discard block |
||
| 727 | 727 | |
| 728 | 728 | if ($owner != "") |
| 729 | 729 | { |
| 730 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 730 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 731 | 731 | if (!is_string($owner)) |
| 732 | 732 | { |
| 733 | 733 | return false; |
@@ -738,7 +738,7 @@ discard block |
||
| 738 | 738 | |
| 739 | 739 | if ($pilot_name != "") |
| 740 | 740 | { |
| 741 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 741 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 742 | 742 | if (!is_string($pilot_name)) |
| 743 | 743 | { |
| 744 | 744 | return false; |
@@ -749,7 +749,7 @@ discard block |
||
| 749 | 749 | |
| 750 | 750 | if ($pilot_id != "") |
| 751 | 751 | { |
| 752 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 752 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
| 753 | 753 | if (!is_string($pilot_id)) |
| 754 | 754 | { |
| 755 | 755 | return false; |
@@ -760,7 +760,7 @@ discard block |
||
| 760 | 760 | |
| 761 | 761 | if ($departure_airport_route != "") |
| 762 | 762 | { |
| 763 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 763 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
| 764 | 764 | if (!is_string($departure_airport_route)) |
| 765 | 765 | { |
| 766 | 766 | return false; |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | |
| 772 | 772 | if ($arrival_airport_route != "") |
| 773 | 773 | { |
| 774 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 774 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
| 775 | 775 | if (!is_string($arrival_airport_route)) |
| 776 | 776 | { |
| 777 | 777 | return false; |
@@ -784,8 +784,8 @@ discard block |
||
| 784 | 784 | { |
| 785 | 785 | $altitude_array = explode(",", $altitude); |
| 786 | 786 | |
| 787 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 788 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 787 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 788 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 789 | 789 | |
| 790 | 790 | |
| 791 | 791 | if ($altitude_array[1] != "") |
@@ -803,8 +803,8 @@ discard block |
||
| 803 | 803 | { |
| 804 | 804 | $date_array = explode(",", $date_posted); |
| 805 | 805 | |
| 806 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 807 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 806 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 807 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 808 | 808 | |
| 809 | 809 | if ($globalTimezone != '') { |
| 810 | 810 | date_default_timezone_set($globalTimezone); |
@@ -836,8 +836,8 @@ discard block |
||
| 836 | 836 | { |
| 837 | 837 | $limit_array = explode(",", $limit); |
| 838 | 838 | |
| 839 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 840 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 839 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 840 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 841 | 841 | |
| 842 | 842 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 843 | 843 | { |
@@ -848,8 +848,8 @@ discard block |
||
| 848 | 848 | |
| 849 | 849 | |
| 850 | 850 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 851 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
| 852 | - $query="SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 851 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
| 852 | + $query = "SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 853 | 853 | FROM tracker_archive_output, tracker_archive WHERE spotter_output_archive.famtrackid = tracker_archive.famtrackid AND spotter_output.ident <> '' ".$additional_query."AND CAST(tracker_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(tracker_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 854 | 854 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
| 855 | 855 | } else { |
@@ -866,12 +866,12 @@ discard block |
||
| 866 | 866 | $additional_query .= " AND (tracker_archive_output.waypoints <> '')"; |
| 867 | 867 | } |
| 868 | 868 | |
| 869 | - $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
| 869 | + $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
| 870 | 870 | WHERE tracker_archive_output.ident <> '' |
| 871 | 871 | ".$additional_query." |
| 872 | 872 | ".$filter_query.$orderby_query; |
| 873 | 873 | } |
| 874 | - $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
|
| 874 | + $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
|
| 875 | 875 | |
| 876 | 876 | return $spotter_array; |
| 877 | 877 | } |
@@ -888,7 +888,7 @@ discard block |
||
| 888 | 888 | try { |
| 889 | 889 | $sth = $this->db->prepare($query); |
| 890 | 890 | $sth->execute(); |
| 891 | - } catch(PDOException $e) { |
|
| 891 | + } catch (PDOException $e) { |
|
| 892 | 892 | return "error"; |
| 893 | 893 | } |
| 894 | 894 | } |
@@ -925,8 +925,8 @@ discard block |
||
| 925 | 925 | { |
| 926 | 926 | $limit_array = explode(",", $limit); |
| 927 | 927 | |
| 928 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 929 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 928 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 929 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 930 | 930 | |
| 931 | 931 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 932 | 932 | { |
@@ -967,7 +967,7 @@ discard block |
||
| 967 | 967 | $query_values = array(); |
| 968 | 968 | $limit_query = ''; |
| 969 | 969 | $additional_query = ''; |
| 970 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 970 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 971 | 971 | |
| 972 | 972 | if ($owner != "") |
| 973 | 973 | { |
@@ -984,8 +984,8 @@ discard block |
||
| 984 | 984 | { |
| 985 | 985 | $limit_array = explode(",", $limit); |
| 986 | 986 | |
| 987 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 988 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 987 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 988 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 989 | 989 | |
| 990 | 990 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 991 | 991 | { |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | $query_values = array(); |
| 1026 | 1026 | $limit_query = ''; |
| 1027 | 1027 | $additional_query = ''; |
| 1028 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1028 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1029 | 1029 | |
| 1030 | 1030 | if ($pilot != "") |
| 1031 | 1031 | { |
@@ -1037,8 +1037,8 @@ discard block |
||
| 1037 | 1037 | { |
| 1038 | 1038 | $limit_array = explode(",", $limit); |
| 1039 | 1039 | |
| 1040 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1041 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1040 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1041 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1042 | 1042 | |
| 1043 | 1043 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1044 | 1044 | { |
@@ -1068,7 +1068,7 @@ discard block |
||
| 1068 | 1068 | * @return Array the airline country list |
| 1069 | 1069 | * |
| 1070 | 1070 | */ |
| 1071 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 1071 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
| 1072 | 1072 | { |
| 1073 | 1073 | global $globalDBdriver; |
| 1074 | 1074 | /* |
@@ -1097,7 +1097,7 @@ discard block |
||
| 1097 | 1097 | $flight_array = array(); |
| 1098 | 1098 | $temp_array = array(); |
| 1099 | 1099 | |
| 1100 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1100 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1101 | 1101 | { |
| 1102 | 1102 | $temp_array['flight_count'] = $row['nb']; |
| 1103 | 1103 | $temp_array['flight_country'] = $row['name']; |
@@ -1114,7 +1114,7 @@ discard block |
||
| 1114 | 1114 | * @return Array the airline country list |
| 1115 | 1115 | * |
| 1116 | 1116 | */ |
| 1117 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
| 1117 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
| 1118 | 1118 | { |
| 1119 | 1119 | global $globalDBdriver; |
| 1120 | 1120 | /* |
@@ -1143,7 +1143,7 @@ discard block |
||
| 1143 | 1143 | $flight_array = array(); |
| 1144 | 1144 | $temp_array = array(); |
| 1145 | 1145 | |
| 1146 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1146 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1147 | 1147 | { |
| 1148 | 1148 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 1149 | 1149 | $temp_array['flight_count'] = $row['nb']; |
@@ -1161,14 +1161,14 @@ discard block |
||
| 1161 | 1161 | * @return Array the spotter information |
| 1162 | 1162 | * |
| 1163 | 1163 | */ |
| 1164 | - public function getDateArchiveTrackerDataById($id,$date) |
|
| 1164 | + public function getDateArchiveTrackerDataById($id, $date) |
|
| 1165 | 1165 | { |
| 1166 | 1166 | $Tracker = new Tracker($this->db); |
| 1167 | 1167 | date_default_timezone_set('UTC'); |
| 1168 | 1168 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 1169 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
| 1170 | - $date = date('c',$date); |
|
| 1171 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
| 1169 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
| 1170 | + $date = date('c', $date); |
|
| 1171 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
| 1172 | 1172 | return $spotter_array; |
| 1173 | 1173 | } |
| 1174 | 1174 | |
@@ -1178,14 +1178,14 @@ discard block |
||
| 1178 | 1178 | * @return Array the spotter information |
| 1179 | 1179 | * |
| 1180 | 1180 | */ |
| 1181 | - public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
| 1181 | + public function getDateArchiveTrackerDataByIdent($ident, $date) |
|
| 1182 | 1182 | { |
| 1183 | 1183 | $Tracker = new Tracker($this->db); |
| 1184 | 1184 | date_default_timezone_set('UTC'); |
| 1185 | 1185 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 1186 | - $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
| 1187 | - $date = date('c',$date); |
|
| 1188 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 1186 | + $query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC'; |
|
| 1187 | + $date = date('c', $date); |
|
| 1188 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 1189 | 1189 | return $spotter_array; |
| 1190 | 1190 | } |
| 1191 | 1191 | |
@@ -1195,7 +1195,7 @@ discard block |
||
| 1195 | 1195 | * @return Array the spotter information |
| 1196 | 1196 | * |
| 1197 | 1197 | */ |
| 1198 | - public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1198 | + public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
| 1199 | 1199 | { |
| 1200 | 1200 | global $global_query; |
| 1201 | 1201 | $Tracker = new Tracker($this->db); |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | $query_values = array(); |
| 1204 | 1204 | $limit_query = ''; |
| 1205 | 1205 | $additional_query = ''; |
| 1206 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1206 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1207 | 1207 | |
| 1208 | 1208 | if ($airport != "") |
| 1209 | 1209 | { |
@@ -1220,8 +1220,8 @@ discard block |
||
| 1220 | 1220 | { |
| 1221 | 1221 | $limit_array = explode(",", $limit); |
| 1222 | 1222 | |
| 1223 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1224 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1223 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1224 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1225 | 1225 | |
| 1226 | 1226 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1227 | 1227 | { |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | } else { |
| 20 | 20 | $title = _("Statistics").' - '._("Most common Country a flight was over"); |
| 21 | 21 | } |
| 22 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 22 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 23 | 23 | if ($airline_icao == '' && isset($globalFilter)) { |
| 24 | 24 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 25 | 25 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | if ($type == 'aircraft') { |
| 51 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name); |
|
| 51 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name); |
|
| 52 | 52 | } elseif ($type == 'marine') { |
| 53 | 53 | $flightover_array = $Marine->countAllMarineOverCountries(); |
| 54 | 54 | } elseif ($type == 'tracker') { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 63 | 63 | print 'var series = ['; |
| 64 | 64 | $flightover_data = ''; |
| 65 | -foreach($flightover_array as $flightover_item) |
|
| 65 | +foreach ($flightover_array as $flightover_item) |
|
| 66 | 66 | { |
| 67 | 67 | if ($type == 'aircraft') $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
| 68 | 68 | elseif ($type == 'marine') $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
@@ -113,8 +113,8 @@ discard block |
||
| 113 | 113 | print '</thead>'; |
| 114 | 114 | print '<tbody>'; |
| 115 | 115 | $i = 1; |
| 116 | - array_splice($flightover_array,10); |
|
| 117 | - foreach($flightover_array as $flightover_item) |
|
| 116 | + array_splice($flightover_array, 10); |
|
| 117 | + foreach ($flightover_array as $flightover_item) |
|
| 118 | 118 | { |
| 119 | 119 | print '<tr>'; |
| 120 | 120 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -26,24 +26,24 @@ discard block |
||
| 26 | 26 | $sql_date = ''; |
| 27 | 27 | if (isset($_GET['start_date'])) { |
| 28 | 28 | //for the date manipulation into the query |
| 29 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 29 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 30 | 30 | if (strtotime($_GET['start_date']) !== false && strtotime($_GET['end_date']) !== false) { |
| 31 | 31 | //$start_date = $_GET['start_date']." 00:00:00"; |
| 32 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
| 32 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
| 33 | 33 | //$end_date = $_GET['end_date']." 00:00:00"; |
| 34 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
| 34 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
| 35 | 35 | $sql_date = $start_date.",".$end_date; |
| 36 | 36 | } |
| 37 | - } else if($_GET['start_date'] != ""){ |
|
| 37 | + } else if ($_GET['start_date'] != "") { |
|
| 38 | 38 | if (strtotime($_GET['start_date']) !== false) { |
| 39 | 39 | //$start_date = $_GET['start_date']." 00:00:00"; |
| 40 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
| 40 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
| 41 | 41 | $sql_date = $start_date; |
| 42 | 42 | } |
| 43 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 43 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 44 | 44 | if (strtotime($_GET['end_date']) !== false) { |
| 45 | 45 | //$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00"; |
| 46 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
| 46 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
| 47 | 47 | $sql_date = $end_date; |
| 48 | 48 | } |
| 49 | 49 | } else $sql_date = ''; |
@@ -51,21 +51,21 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | if (isset($_GET['highest_altitude'])) { |
| 53 | 53 | //for altitude manipulation |
| 54 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 55 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 55 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 57 | 57 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 58 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 59 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 58 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 59 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 60 | 60 | $sql_altitude = $end_altitude; |
| 61 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 62 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 61 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 62 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 63 | 63 | $sql_altitude = $start_altitude; |
| 64 | 64 | } else $sql_altitude = ''; |
| 65 | 65 | } else $sql_altitude = ''; |
| 66 | 66 | |
| 67 | 67 | //calculuation for the pagination |
| 68 | -if(!isset($_GET['limit'])) |
|
| 68 | +if (!isset($_GET['limit'])) |
|
| 69 | 69 | { |
| 70 | 70 | if (!isset($_GET['number_results'])) |
| 71 | 71 | { |
@@ -73,17 +73,17 @@ discard block |
||
| 73 | 73 | $limit_end = 25; |
| 74 | 74 | $absolute_difference = 25; |
| 75 | 75 | } else { |
| 76 | - if ($_GET['number_results'] > 1000){ |
|
| 76 | + if ($_GET['number_results'] > 1000) { |
|
| 77 | 77 | $_GET['number_results'] = 1000; |
| 78 | 78 | } |
| 79 | 79 | $limit_start = 0; |
| 80 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 81 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 80 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 81 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 82 | 82 | } |
| 83 | -} else { |
|
| 83 | +} else { |
|
| 84 | 84 | $limit_explode = explode(",", $_GET['limit']); |
| 85 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 86 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 85 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 86 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 87 | 87 | } |
| 88 | 88 | $absolute_difference = abs($limit_start - $limit_end); |
| 89 | 89 | $limit_next = $limit_end + $absolute_difference; |
@@ -112,31 +112,31 @@ discard block |
||
| 112 | 112 | ((isset($_GET['origlat']) && $_GET['origlat'] != '') && |
| 113 | 113 | (isset($_GET['origlon']) && $_GET['origlon'] != '') && |
| 114 | 114 | (isset($_GET['dist']) && $_GET['dist'] != '')) |
| 115 | - ){ |
|
| 116 | - $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
|
| 117 | - $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
|
| 118 | - $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
|
| 119 | - $manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING); |
|
| 120 | - $highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING); |
|
| 121 | - $airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING); |
|
| 122 | - $airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING); |
|
| 123 | - $airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING); |
|
| 124 | - $airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING); |
|
| 125 | - $airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING); |
|
| 126 | - $callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING); |
|
| 127 | - $owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING); |
|
| 128 | - $pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING); |
|
| 129 | - $pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING); |
|
| 130 | - $mmsi = filter_input(INPUT_GET, 'mmsi',FILTER_SANITIZE_NUMBER_INT); |
|
| 131 | - $imo = filter_input(INPUT_GET, 'imo',FILTER_SANITIZE_NUMBER_INT); |
|
| 132 | - $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 133 | - $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 134 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 135 | - $archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT); |
|
| 136 | - $origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_NUMBER_FLOAT); |
|
| 137 | - $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_NUMBER_FLOAT); |
|
| 138 | - $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
|
| 139 | - $number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 115 | + ) { |
|
| 116 | + $q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 117 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
| 118 | + $aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 119 | + $manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 120 | + $highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 121 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 122 | + $airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 123 | + $airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 124 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 125 | + $airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 126 | + $callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 127 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 128 | + $pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 129 | + $pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 130 | + $mmsi = filter_input(INPUT_GET, 'mmsi', FILTER_SANITIZE_NUMBER_INT); |
|
| 131 | + $imo = filter_input(INPUT_GET, 'imo', FILTER_SANITIZE_NUMBER_INT); |
|
| 132 | + $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 133 | + $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 134 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 135 | + $archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT); |
|
| 136 | + $origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_NUMBER_FLOAT); |
|
| 137 | + $origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_NUMBER_FLOAT); |
|
| 138 | + $dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT); |
|
| 139 | + $number_results = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 140 | 140 | if ($dist != '') { |
| 141 | 141 | if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
| 142 | 142 | elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | if ($archive == 1) { |
| 146 | 146 | if ($type == 'aircraft') { |
| 147 | 147 | $SpotterArchive = new SpotterArchive(); |
| 148 | - $spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
| 148 | + $spotter_array = $SpotterArchive->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
| 149 | 149 | } |
| 150 | 150 | } else { |
| 151 | 151 | if ($type == 'aircraft') { |
| 152 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
| 152 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
| 153 | 153 | } elseif ($type == 'tracker') { |
| 154 | - $spotter_array = $Tracker->searchTrackerData($q,$callsign,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
| 154 | + $spotter_array = $Tracker->searchTrackerData($q, $callsign, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
| 155 | 155 | } elseif ($type == 'marine') { |
| 156 | - $spotter_array = $Marine->searchMarineData($q,$callsign,$mmsi,$imo,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
| 156 | + $spotter_array = $Marine->searchMarineData($q, $callsign, $mmsi, $imo, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
@@ -189,12 +189,12 @@ discard block |
||
| 189 | 189 | //remove 3D=true parameter |
| 190 | 190 | $no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']); |
| 191 | 191 | $kmlURL = str_replace("http://", "kml://", $globalURL); |
| 192 | - if (!isset($_GET['3D'])){ |
|
| 192 | + if (!isset($_GET['3D'])) { |
|
| 193 | 193 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>'; |
| 194 | 194 | } else { |
| 195 | 195 | print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>'; |
| 196 | 196 | } |
| 197 | - if (isset($_GET['3D'])){ |
|
| 197 | + if (isset($_GET['3D'])) { |
|
| 198 | 198 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>'; |
| 199 | 199 | } else { |
| 200 | 200 | print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>'; |
@@ -215,32 +215,32 @@ discard block |
||
| 215 | 215 | print '<div class="column">'; |
| 216 | 216 | print '<div class="info">'; |
| 217 | 217 | print '<h1>'._("Search Results for").' '; |
| 218 | - if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$q.'</span> '; } |
|
| 219 | - if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
| 220 | - if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
| 221 | - if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
|
| 222 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
| 223 | - if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
|
| 224 | - if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
| 225 | - if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
| 226 | - if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$airport.'</span> '; } |
|
| 227 | - if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
| 228 | - if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
| 229 | - if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$owner.'</span> '; } |
|
| 230 | - if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
| 231 | - if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
| 232 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
| 233 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
| 234 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
| 235 | - if (isset($_GET['mmsi']) && $_GET['mmsi'] != ""){ print _("MMSI:").' <span>'.$mmsi.'</span> '; } |
|
| 236 | - if (isset($_GET['imo']) && $_GET['imo'] != ""){ print _("IMO:").' <span>'.$imo.'</span> '; } |
|
| 237 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
| 238 | - if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
| 239 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
| 240 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
| 241 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
| 242 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
| 243 | - if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
| 218 | + if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$q.'</span> '; } |
|
| 219 | + if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
| 220 | + if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
| 221 | + if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$registration.'</span> '; } |
|
| 222 | + if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
| 223 | + if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$airline.'</span> '; } |
|
| 224 | + if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
| 225 | + if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
| 226 | + if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$airport.'</span> '; } |
|
| 227 | + if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
| 228 | + if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
| 229 | + if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$owner.'</span> '; } |
|
| 230 | + if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
| 231 | + if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
| 232 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
| 233 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
| 234 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
| 235 | + if (isset($_GET['mmsi']) && $_GET['mmsi'] != "") { print _("MMSI:").' <span>'.$mmsi.'</span> '; } |
|
| 236 | + if (isset($_GET['imo']) && $_GET['imo'] != "") { print _("IMO:").' <span>'.$imo.'</span> '; } |
|
| 237 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
| 238 | + if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
| 239 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
| 240 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
| 241 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
| 242 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
| 243 | + if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
| 244 | 244 | print '</h1>'; |
| 245 | 245 | print '</div>'; |
| 246 | 246 | |
@@ -374,7 +374,7 @@ discard block |
||
| 374 | 374 | </select> |
| 375 | 375 | </div> |
| 376 | 376 | </div> |
| 377 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
| 377 | + <script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
| 378 | 378 | <div class="form-group"> |
| 379 | 379 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
| 380 | 380 | <div class="col-sm-10"> |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | </select> |
| 384 | 384 | </div> |
| 385 | 385 | </div> |
| 386 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
| 386 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
| 387 | 387 | <div class="form-group"> |
| 388 | 388 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
| 389 | 389 | <div class="col-sm-10"> |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | </div> |
| 407 | 407 | </div> |
| 408 | 408 | <?php |
| 409 | - }else { |
|
| 409 | + } else { |
|
| 410 | 410 | ?> |
| 411 | 411 | <div class="form-group"> |
| 412 | 412 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | ?> |
| 420 | 420 | <div class="form-group"> |
| 421 | 421 | <div class="col-sm-offset-2 col-sm-10"> |
| 422 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
| 423 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
| 422 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
| 423 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
| 424 | 424 | </div> |
| 425 | 425 | </div> |
| 426 | 426 | </fieldset> |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | </select> |
| 435 | 435 | </div> |
| 436 | 436 | </div> |
| 437 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
| 437 | + <script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $airline; ?>');</script> |
|
| 438 | 438 | <div class="form-group"> |
| 439 | 439 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
| 440 | 440 | <div class="col-sm-10"> |
@@ -443,7 +443,7 @@ discard block |
||
| 443 | 443 | </select> |
| 444 | 444 | </div> |
| 445 | 445 | </div> |
| 446 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
| 446 | + <script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
| 447 | 447 | <div class="form-group"> |
| 448 | 448 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
| 449 | 449 | <div class="col-sm-10"> |
@@ -452,10 +452,10 @@ discard block |
||
| 452 | 452 | </div> |
| 453 | 453 | <div class="form-group"> |
| 454 | 454 | <div class="col-sm-offset-2 col-sm-10"> |
| 455 | - <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
| 456 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
| 457 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
| 458 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
| 455 | + <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
| 456 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
| 457 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
| 458 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
| 459 | 459 | </div> |
| 460 | 460 | </div> |
| 461 | 461 | </fieldset> |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | </select> |
| 470 | 470 | </div> |
| 471 | 471 | </div> |
| 472 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
| 472 | + <script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
| 473 | 473 | <div class="form-group"> |
| 474 | 474 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
| 475 | 475 | <div class="col-sm-10"> |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | </select> |
| 479 | 479 | </div> |
| 480 | 480 | </div> |
| 481 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
| 481 | + <script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
| 482 | 482 | </fieldset> |
| 483 | 483 | <fieldset> |
| 484 | 484 | <legend><?php echo _("Route"); ?></legend> |
@@ -490,7 +490,7 @@ discard block |
||
| 490 | 490 | </select> |
| 491 | 491 | </div> |
| 492 | 492 | </div> |
| 493 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
| 493 | + <script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
| 494 | 494 | <div class="form-group"> |
| 495 | 495 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
| 496 | 496 | <div class="col-sm-10"> |
@@ -499,7 +499,7 @@ discard block |
||
| 499 | 499 | </select> |
| 500 | 500 | </div> |
| 501 | 501 | </div> |
| 502 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
| 502 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
| 503 | 503 | </fieldset> |
| 504 | 504 | <fieldset> |
| 505 | 505 | <legend>Altitude</legend> |
@@ -510,9 +510,9 @@ discard block |
||
| 510 | 510 | <option></option> |
| 511 | 511 | <?php |
| 512 | 512 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
| 513 | -foreach($altitude_array as $altitude) |
|
| 513 | +foreach ($altitude_array as $altitude) |
|
| 514 | 514 | { |
| 515 | - if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
| 515 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
| 516 | 516 | { |
| 517 | 517 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
| 518 | 518 | } else { |
@@ -530,9 +530,9 @@ discard block |
||
| 530 | 530 | <option></option> |
| 531 | 531 | <?php |
| 532 | 532 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
| 533 | - foreach($altitude_array as $altitude) |
|
| 533 | + foreach ($altitude_array as $altitude) |
|
| 534 | 534 | { |
| 535 | - if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
| 535 | + if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
| 536 | 536 | { |
| 537 | 537 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
| 538 | 538 | } else { |
@@ -655,10 +655,10 @@ discard block |
||
| 655 | 655 | <div class="col-sm-10"> |
| 656 | 656 | <select class="form-control" name="number_results"> |
| 657 | 657 | <?php |
| 658 | -$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
| 659 | -foreach($number_results_array as $number) |
|
| 658 | +$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
| 659 | +foreach ($number_results_array as $number) |
|
| 660 | 660 | { |
| 661 | - if(isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
| 661 | + if (isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
| 662 | 662 | { |
| 663 | 663 | print '<option value="'.$number.'" selected="selected">'.$number.'</option>'; |
| 664 | 664 | } else { |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | <fieldset> |
| 678 | 678 | <div class="form-group"> |
| 679 | 679 | <div class="col-sm-offset-2 col-sm-10"> |
| 680 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
| 680 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
| 681 | 681 | <p class="help-block">Disabled in demo</p> |
| 682 | 682 | </div> |
| 683 | 683 | </div> |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | <fieldset> |
| 689 | 689 | <div class="form-group"> |
| 690 | 690 | <div class="col-sm-offset-2 col-sm-10"> |
| 691 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
| 691 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
| 692 | 692 | </div> |
| 693 | 693 | </div> |
| 694 | 694 | </fieldset> |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | default: |
| 42 | 42 | throw new \Exception("bad resolution can be only one of 1,3"); |
| 43 | 43 | } |
| 44 | - register_shutdown_function(function () { |
|
| 44 | + register_shutdown_function(function() { |
|
| 45 | 45 | $this->closeAllFiles(); |
| 46 | 46 | }); |
| 47 | 47 | } |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | private function getElevationAtPosition($fileName, $row, $column) { |
| 57 | 57 | if (!array_key_exists($fileName, $this->openedFiles)) { |
| 58 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
|
| 58 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) { |
|
| 59 | 59 | throw new \Exception("File '{$fileName}' not exists."); |
| 60 | 60 | } |
| 61 | - $file = fopen($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName, "r"); |
|
| 61 | + $file = fopen($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName, "r"); |
|
| 62 | 62 | if ($file === false) { |
| 63 | 63 | throw new \Exception("Cant open file '{$fileName}' for reading."); |
| 64 | 64 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | throw new \Exception("Not implemented yet"); |
| 73 | 73 | } |
| 74 | 74 | $aRow = $this->measPerDeg - $row; |
| 75 | - $position = ($this->measPerDeg * ($aRow - 1)) + $column; |
|
| 75 | + $position = ($this->measPerDeg*($aRow - 1)) + $column; |
|
| 76 | 76 | $position *= 2; |
| 77 | 77 | fseek($file, $position); |
| 78 | 78 | $short = fread($file, 2); |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | $latSec = $this->getSec($lat); |
| 101 | 101 | $lonSec = $this->getSec($lon); |
| 102 | 102 | |
| 103 | - $Xn = round($latSec / $this->resolution, 3); |
|
| 104 | - $Yn = round($lonSec / $this->resolution, 3); |
|
| 103 | + $Xn = round($latSec/$this->resolution, 3); |
|
| 104 | + $Yn = round($lonSec/$this->resolution, 3); |
|
| 105 | 105 | |
| 106 | 106 | $a1 = round($Xn); |
| 107 | 107 | $a2 = round($Yn); |
@@ -133,55 +133,55 @@ discard block |
||
| 133 | 133 | $b3 = $this->getElevationAtPosition($fName, $b1, $b2); |
| 134 | 134 | $c3 = $this->getElevationAtPosition($fName, $c1, $c2); |
| 135 | 135 | |
| 136 | - $n1 = ($c2 - $a2) * ($b3 - $a3) - ($c3 - $a3) * ($b2 - $a2); |
|
| 137 | - $n2 = ($c3 - $a3) * ($b1 - $a1) - ($c1 - $a1) * ($b3 - $a3); |
|
| 138 | - $n3 = ($c1 - $a1) * ($b2 - $a2) - ($c2 - $a2) * ($b1 - $a1); |
|
| 136 | + $n1 = ($c2 - $a2)*($b3 - $a3) - ($c3 - $a3)*($b2 - $a2); |
|
| 137 | + $n2 = ($c3 - $a3)*($b1 - $a1) - ($c1 - $a1)*($b3 - $a3); |
|
| 138 | + $n3 = ($c1 - $a1)*($b2 - $a2) - ($c2 - $a2)*($b1 - $a1); |
|
| 139 | 139 | |
| 140 | - $d = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3; |
|
| 141 | - $zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3; |
|
| 140 | + $d = -$n1*$a1 - $n2*$a2 - $n3*$a3; |
|
| 141 | + $zN = (-$n1*$Xn - $n2*$Yn - $d)/$n3; |
|
| 142 | 142 | |
| 143 | 143 | return $zN; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | private function getDeg($deg, $numPrefix) { |
| 147 | 147 | $deg = abs($deg); |
| 148 | - $d = floor($deg); // round degrees |
|
| 148 | + $d = floor($deg); // round degrees |
|
| 149 | 149 | if ($numPrefix >= 3) { |
| 150 | 150 | if ($d < 100) { |
| 151 | - $d = '0' . $d; |
|
| 151 | + $d = '0'.$d; |
|
| 152 | 152 | } |
| 153 | 153 | } // pad with leading zeros |
| 154 | 154 | if ($d < 10) { |
| 155 | - $d = '0' . $d; |
|
| 155 | + $d = '0'.$d; |
|
| 156 | 156 | } |
| 157 | 157 | return $d; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | private function getSec($deg) { |
| 161 | 161 | $deg = abs($deg); |
| 162 | - $sec = round($deg * 3600, 4); |
|
| 163 | - $m = fmod(floor($sec / 60), 60); |
|
| 162 | + $sec = round($deg*3600, 4); |
|
| 163 | + $m = fmod(floor($sec/60), 60); |
|
| 164 | 164 | $s = round(fmod($sec, 60), 4); |
| 165 | - return ($m * 60) + $s; |
|
| 165 | + return ($m*60) + $s; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | - public function download($lat,$lon, $debug = false) { |
|
| 168 | + public function download($lat, $lon, $debug = false) { |
|
| 169 | 169 | $N = $this->getDeg($lat, 2); |
| 170 | 170 | $E = $this->getDeg($lon, 3); |
| 171 | - $fileName = "N{$N}E{$E}.hgt"; |
|
| 172 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) { |
|
| 171 | + $fileName = "N{$N}E{$E}.hgt"; |
|
| 172 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) { |
|
| 173 | 173 | $Common = new Common(); |
| 174 | 174 | if ($debug) echo 'Downloading '.$fileName.'.gz ...'; |
| 175 | - $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
|
| 176 | - if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) { |
|
| 175 | + $Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz'); |
|
| 176 | + if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz')) { |
|
| 177 | 177 | if ($debug) echo "File '{$fileName}.gz' not exists."; |
| 178 | 178 | return false; |
| 179 | 179 | } |
| 180 | 180 | if ($debug) echo 'Done'."\n"; |
| 181 | 181 | if ($debug) echo 'Decompress '.$fileName.' ....'; |
| 182 | - $Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName); |
|
| 182 | + $Common->gunzip($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName); |
|
| 183 | 183 | if ($debug) echo 'Done'."\n"; |
| 184 | - unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz'); |
|
| 184 | + unlink($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz'); |
|
| 185 | 185 | } |
| 186 | 186 | return true; |
| 187 | 187 | } |
@@ -194,22 +194,22 @@ discard block |
||
| 194 | 194 | try { |
| 195 | 195 | $sth = $db->prepare($query); |
| 196 | 196 | $sth->execute($query_values); |
| 197 | - } catch(PDOException $e) { |
|
| 197 | + } catch (PDOException $e) { |
|
| 198 | 198 | return "error : ".$e->getMessage(); |
| 199 | 199 | } |
| 200 | 200 | while ($data = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 201 | - $this->download($data['latitude'],$data['longitude'],true); |
|
| 201 | + $this->download($data['latitude'], $data['longitude'], true); |
|
| 202 | 202 | } |
| 203 | 203 | $query = 'SELECT latitude, longitude FROM tracker_output WHERE latitude <> 0 AND longitude <> 0 ORDER BY date DESC LIMIT 10'; |
| 204 | 204 | $query_values = array(); |
| 205 | 205 | try { |
| 206 | 206 | $sth = $db->prepare($query); |
| 207 | 207 | $sth->execute($query_values); |
| 208 | - } catch(PDOException $e) { |
|
| 208 | + } catch (PDOException $e) { |
|
| 209 | 209 | return "error : ".$e->getMessage(); |
| 210 | 210 | } |
| 211 | 211 | while ($data = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 212 | - $this->download($data['latitude'],$data['longitude'],true); |
|
| 212 | + $this->download($data['latitude'], $data['longitude'], true); |
|
| 213 | 213 | } |
| 214 | 214 | } |
| 215 | 215 | } |
@@ -7,22 +7,22 @@ discard block |
||
| 7 | 7 | header('Location: '.$globalURL.'/airline'); |
| 8 | 8 | die(); |
| 9 | 9 | } |
| 10 | -$airline = urldecode(filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING)); |
|
| 10 | +$airline = urldecode(filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING)); |
|
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | 12 | $alliance = false; |
| 13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
| 13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
| 14 | 14 | // $spotter_array = $Spotter->getSpotterDataByAirline('',"0,1","",array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline)))); |
| 15 | 15 | $alliance = true; |
| 16 | 16 | } else { |
| 17 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
| 17 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | if (!empty($spotter_array) || $alliance === true) |
| 21 | 21 | { |
| 22 | 22 | if ($alliance) { |
| 23 | - $title = sprintf(_("Most Common Aircraft from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
| 23 | + $title = sprintf(_("Most Common Aircraft from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
| 24 | 24 | } else { |
| 25 | - $title = sprintf(_("Most Common Aircraft from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
| 25 | + $title = sprintf(_("Most Common Aircraft from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
| 26 | 26 | } |
| 27 | 27 | require_once('header.php'); |
| 28 | 28 | print '<div class="select-item">'; |
@@ -32,10 +32,10 @@ discard block |
||
| 32 | 32 | $alliances = $Spotter->getAllAllianceNames(); |
| 33 | 33 | if (!empty($alliances)) { |
| 34 | 34 | foreach ($alliances as $al) { |
| 35 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
| 36 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
| 35 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
| 36 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
| 37 | 37 | } else { |
| 38 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
| 38 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | print '<option disabled>────────────────</option>'; |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | $Stats = new Stats(); |
| 44 | 44 | $airline_names = $Stats->getAllAirlineNames(); |
| 45 | 45 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
| 46 | - foreach($airline_names as $airline_name) |
|
| 46 | + foreach ($airline_names as $airline_name) |
|
| 47 | 47 | { |
| 48 | - if($airline == $airline_name['airline_icao']) |
|
| 48 | + if ($airline == $airline_name['airline_icao']) |
|
| 49 | 49 | { |
| 50 | 50 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
| 51 | 51 | } else { |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | print '</div>'; |
| 80 | 80 | } else { |
| 81 | 81 | print '<div class="info column">'; |
| 82 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
| 83 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
| 82 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
| 83 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
| 84 | 84 | { |
| 85 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
| 85 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
| 86 | 86 | } |
| 87 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
| 87 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
| 88 | 88 | print '</div>'; |
| 89 | 89 | } |
| 90 | 90 | } else { |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | print '<div class="column">'; |
| 96 | 96 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
| 97 | 97 | if ($alliance === false) { |
| 98 | - print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
| 98 | + print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
| 99 | 99 | } else { |
| 100 | - print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
| 100 | + print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /* |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $aircraft_array = $Spotter->countAllAircraftTypesByAirline($airline); |
| 108 | 108 | } |
| 109 | 109 | */ |
| 110 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline); |
|
| 110 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline); |
|
| 111 | 111 | if (!empty($aircraft_array)) |
| 112 | 112 | { |
| 113 | 113 | print '<div class="table-responsive">'; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | print '</thead>'; |
| 121 | 121 | print '<tbody>'; |
| 122 | 122 | $i = 1; |
| 123 | - foreach($aircraft_array as $aircraft_item) |
|
| 123 | + foreach ($aircraft_array as $aircraft_item) |
|
| 124 | 124 | { |
| 125 | 125 | print '<tr>'; |
| 126 | 126 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,18 +7,18 @@ discard block |
||
| 7 | 7 | die(); |
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 11 | -$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
| 12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 11 | +$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
| 12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | 14 | $filter = array(); |
| 15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 17 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
| 15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
| 16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
| 17 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
| 18 | 18 | |
| 19 | 19 | if (!empty($spotter_array)) |
| 20 | 20 | { |
| 21 | - $title = sprintf(_("Most Common Departure Airports by Owner of %s"),$spotter_array[0]['aircraft_owner']); |
|
| 21 | + $title = sprintf(_("Most Common Departure Airports by Owner of %s"), $spotter_array[0]['aircraft_owner']); |
|
| 22 | 22 | require_once('header.php'); |
| 23 | 23 | print '<div class="info column">'; |
| 24 | 24 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -28,16 +28,16 @@ discard block |
||
| 28 | 28 | include('owner-sub-menu.php'); |
| 29 | 29 | print '<div class="column">'; |
| 30 | 30 | print '<h2>'._("Most Common Departure Airports by Country").'</h2>'; |
| 31 | - print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
| 31 | + print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
| 32 | 32 | |
| 33 | - $airport_country_array = $Spotter->countAllDepartureAirportCountriesByOwner($owner,$filter); |
|
| 33 | + $airport_country_array = $Spotter->countAllDepartureAirportCountriesByOwner($owner, $filter); |
|
| 34 | 34 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
| 35 | 35 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
| 36 | 36 | print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>'; |
| 37 | 37 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
| 38 | 38 | print 'var series = ['; |
| 39 | 39 | $country_data = ''; |
| 40 | - foreach($airport_country_array as $airport_item) |
|
| 40 | + foreach ($airport_country_array as $airport_item) |
|
| 41 | 41 | { |
| 42 | 42 | $country_data .= '[ "'.$airport_item['airport_departure_country_iso3'].'",'.$airport_item['airport_departure_country_count'].'],'; |
| 43 | 43 | } |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | print '</thead>'; |
| 85 | 85 | print '<tbody>'; |
| 86 | 86 | $i = 1; |
| 87 | - foreach($airport_country_array as $airport_item) |
|
| 87 | + foreach ($airport_country_array as $airport_item) |
|
| 88 | 88 | { |
| 89 | 89 | print '<tr>'; |
| 90 | 90 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,21 +7,21 @@ discard block |
||
| 7 | 7 | header('Location: '.$globalURL.'/airline'); |
| 8 | 8 | die(); |
| 9 | 9 | } |
| 10 | -$airline = urldecode(filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING)); |
|
| 10 | +$airline = urldecode(filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING)); |
|
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | 12 | $alliance = false; |
| 13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
| 13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
| 14 | 14 | $alliance = true; |
| 15 | 15 | } else { |
| 16 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
| 16 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | if (!empty($spotter_array) || $alliance === true) |
| 20 | 20 | { |
| 21 | 21 | if ($alliance) { |
| 22 | - $title = sprintf(_("Most Common Routes from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
| 22 | + $title = sprintf(_("Most Common Routes from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
| 23 | 23 | } else { |
| 24 | - $title = sprintf(_("Most Common Routes from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
| 24 | + $title = sprintf(_("Most Common Routes from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
| 25 | 25 | } |
| 26 | 26 | require_once('header.php'); |
| 27 | 27 | print '<div class="select-item">'; |
@@ -31,10 +31,10 @@ discard block |
||
| 31 | 31 | $alliances = $Spotter->getAllAllianceNames(); |
| 32 | 32 | if (!empty($alliances)) { |
| 33 | 33 | foreach ($alliances as $al) { |
| 34 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
| 35 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
| 34 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
| 35 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
| 36 | 36 | } else { |
| 37 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
| 37 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | print '<option disabled>───────────────────</option>'; |
@@ -42,9 +42,9 @@ discard block |
||
| 42 | 42 | $Stats = new Stats(); |
| 43 | 43 | $airline_names = $Stats->getAllAirlineNames(); |
| 44 | 44 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
| 45 | - foreach($airline_names as $airline_name) |
|
| 45 | + foreach ($airline_names as $airline_name) |
|
| 46 | 46 | { |
| 47 | - if($airline == $airline_name['airline_icao']) |
|
| 47 | + if ($airline == $airline_name['airline_icao']) |
|
| 48 | 48 | { |
| 49 | 49 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
| 50 | 50 | } else { |
@@ -78,12 +78,12 @@ discard block |
||
| 78 | 78 | print '</div>'; |
| 79 | 79 | } else { |
| 80 | 80 | print '<div class="info column">'; |
| 81 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
| 82 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
| 81 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
| 82 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
| 83 | 83 | { |
| 84 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
| 84 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
| 85 | 85 | } |
| 86 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
| 86 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
| 87 | 87 | print '</div>'; |
| 88 | 88 | } |
| 89 | 89 | } else { |
@@ -94,12 +94,12 @@ discard block |
||
| 94 | 94 | print '<div class="column">'; |
| 95 | 95 | print '<h2>'._("Most Common Routes").'</h2>'; |
| 96 | 96 | if ($alliance) { |
| 97 | - print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
| 97 | + print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
| 98 | 98 | } else { |
| 99 | - print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
| 99 | + print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
| 100 | 100 | } |
| 101 | 101 | if ($alliance) { |
| 102 | - $route_array = $Spotter->countAllRoutesByAirline('',array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline)))); |
|
| 102 | + $route_array = $Spotter->countAllRoutesByAirline('', array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $airline)))); |
|
| 103 | 103 | } else { |
| 104 | 104 | $route_array = $Spotter->countAllRoutesByAirline($airline); |
| 105 | 105 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | print '</thead>'; |
| 118 | 118 | print '<tbody>'; |
| 119 | 119 | $i = 1; |
| 120 | - foreach($route_array as $route_item) |
|
| 120 | + foreach ($route_array as $route_item) |
|
| 121 | 121 | { |
| 122 | 122 | print '<tr>'; |
| 123 | 123 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | die(); |
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | -$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
|
| 11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 10 | +$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)))); |
|
| 11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 12 | 12 | if (isset($_GET['sort'])) { |
| 13 | 13 | $spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort); |
| 14 | 14 | } else { |
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | if (!empty($spotter_array)) |
| 19 | 19 | { |
| 20 | - $title = sprintf(_("Most Common Aircraft by registration from %s"),$country); |
|
| 20 | + $title = sprintf(_("Most Common Aircraft by registration from %s"), $country); |
|
| 21 | 21 | require_once('header.php'); |
| 22 | 22 | print '<div class="select-item">'; |
| 23 | 23 | print '<form action="'.$globalURL.'/country" method="post">'; |
| 24 | 24 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
| 25 | 25 | print '<option></option>'; |
| 26 | 26 | $all_countries = $Spotter->getAllCountries(); |
| 27 | - foreach($all_countries as $all_country) |
|
| 27 | + foreach ($all_countries as $all_country) |
|
| 28 | 28 | { |
| 29 | - if($country == $all_country['country']) |
|
| 29 | + if ($country == $all_country['country']) |
|
| 30 | 30 | { |
| 31 | 31 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
| 32 | 32 | } else { |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | if ($_GET['country'] != "NA") |
| 42 | 42 | { |
| 43 | 43 | print '<div class="info column">'; |
| 44 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
| 44 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
| 45 | 45 | print '</div>'; |
| 46 | 46 | } else { |
| 47 | 47 | print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>'; |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | include('country-sub-menu.php'); |
| 51 | 51 | print '<div class="column">'; |
| 52 | 52 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
| 53 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of airlines or departure/arrival airports from <strong>%s</strong>."),$country).'</p>'; |
|
| 53 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of airlines or departure/arrival airports from <strong>%s</strong>."), $country).'</p>'; |
|
| 54 | 54 | $aircraft_array = $Spotter->countAllAircraftRegistrationByCountry($country); |
| 55 | 55 | if (!empty($aircraft_array)) |
| 56 | 56 | { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | print '</thead>'; |
| 66 | 66 | print '<tbody>'; |
| 67 | 67 | $i = 1; |
| 68 | - foreach($aircraft_array as $aircraft_item) |
|
| 68 | + foreach ($aircraft_array as $aircraft_item) |
|
| 69 | 69 | { |
| 70 | 70 | print '<tr>'; |
| 71 | 71 | print '<td><strong>'.$i.'</strong></td>'; |