@@ -8,7 +8,7 @@ |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | require_once('header.php'); |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | |
| 20 | 20 | if (!isset($filter_name)) $filter_name = ''; |
| 21 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 21 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 22 | 22 | if ($airline_icao == '' && isset($globalFilter)) { |
| 23 | 23 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 24 | 24 | } |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | </div> |
| 34 | 34 | <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>'; |
| 35 | 35 | |
| 36 | -if ($type == 'aircraft') $date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
| 36 | +if ($type == 'aircraft') $date_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
| 37 | 37 | elseif ($type == 'marine') $date_array = $Marine->countAllMonthsLastYear(true); |
| 38 | 38 | elseif ($type == 'tracker') $date_array = $Tracker->countAllMonthsLastYear(true); |
| 39 | 39 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 40 | 40 | $year_data = ''; |
| 41 | 41 | $year_cnt = ''; |
| 42 | -foreach($date_array as $year_item) |
|
| 42 | +foreach ($date_array as $year_item) |
|
| 43 | 43 | { |
| 44 | 44 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
| 45 | 45 | $year_cnt .= $year_item['date_count'].','; |
| 46 | 46 | } |
| 47 | 47 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 48 | -$year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
| 48 | +$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
| 49 | 49 | print 'c3.generate({ |
| 50 | 50 | bindto: "#chart", |
| 51 | 51 | data: { x: "x", |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | print '</thead>'; |
| 69 | 69 | print '<tbody>'; |
| 70 | 70 | $i = 1; |
| 71 | - foreach($date_array as $date_item) |
|
| 71 | + foreach ($date_array as $date_item) |
|
| 72 | 72 | { |
| 73 | 73 | print '<tr>'; |
| 74 | 74 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -17,11 +17,15 @@ discard block |
||
| 17 | 17 | $title = _("Statistics").' - '._("Busiest Month of Last Year"); |
| 18 | 18 | |
| 19 | 19 | |
| 20 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 20 | +if (!isset($filter_name)) { |
|
| 21 | + $filter_name = ''; |
|
| 22 | +} |
|
| 21 | 23 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 22 | 24 | if ($airline_icao == '' && isset($globalFilter)) { |
| 23 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 24 | -} |
|
| 25 | + if (isset($globalFilter['airline'])) { |
|
| 26 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 27 | + } |
|
| 28 | + } |
|
| 25 | 29 | |
| 26 | 30 | require_once('header.php'); |
| 27 | 31 | include('statistics-sub-menu.php'); |
@@ -33,9 +37,13 @@ discard block |
||
| 33 | 37 | </div> |
| 34 | 38 | <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>'; |
| 35 | 39 | |
| 36 | -if ($type == 'aircraft') $date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
| 37 | -elseif ($type == 'marine') $date_array = $Marine->countAllMonthsLastYear(true); |
|
| 38 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllMonthsLastYear(true); |
|
| 40 | +if ($type == 'aircraft') { |
|
| 41 | + $date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
| 42 | +} elseif ($type == 'marine') { |
|
| 43 | + $date_array = $Marine->countAllMonthsLastYear(true); |
|
| 44 | +} elseif ($type == 'tracker') { |
|
| 45 | + $date_array = $Tracker->countAllMonthsLastYear(true); |
|
| 46 | +} |
|
| 39 | 47 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 40 | 48 | $year_data = ''; |
| 41 | 49 | $year_cnt = ''; |
@@ -53,9 +61,13 @@ discard block |
||
| 53 | 61 | axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m"}}, y: { label: "#"}},legend: { show: false }});'; |
| 54 | 62 | print '</script>'; |
| 55 | 63 | |
| 56 | -if ($type == 'aircraft') $date_array = $Stats->countAllMonths($airline_icao); |
|
| 57 | -elseif ($type == 'marine') $date_array = $Marine->countAllMonths(); |
|
| 58 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllMonths(); |
|
| 64 | +if ($type == 'aircraft') { |
|
| 65 | + $date_array = $Stats->countAllMonths($airline_icao); |
|
| 66 | +} elseif ($type == 'marine') { |
|
| 67 | + $date_array = $Marine->countAllMonths(); |
|
| 68 | +} elseif ($type == 'tracker') { |
|
| 69 | + $date_array = $Tracker->countAllMonths(); |
|
| 70 | +} |
|
| 59 | 71 | |
| 60 | 72 | if (!empty($date_array)) |
| 61 | 73 | { |
@@ -10,10 +10,10 @@ discard block |
||
| 10 | 10 | { |
| 11 | 11 | $date = date('Y-m-d'); |
| 12 | 12 | } else { |
| 13 | - $date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
| 13 | + $date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -if(!isset($_GET['limit'])) |
|
| 16 | +if (!isset($_GET['limit'])) |
|
| 17 | 17 | { |
| 18 | 18 | $limit_start = 0; |
| 19 | 19 | $limit_end = 25; |
@@ -48,25 +48,25 @@ discard block |
||
| 48 | 48 | print '<br />'; |
| 49 | 49 | |
| 50 | 50 | print '<div class="info column">'; |
| 51 | -if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/',$date)) { |
|
| 52 | - print '<h1>'.sprintf(_("Accidents from %s"),date("l F j, Y",strtotime($date))).'</h1>'; |
|
| 53 | -} elseif (preg_match('/^[0-9]{4}-[0-9]{2}$/',$date)) { |
|
| 54 | - print '<h1>'.sprintf(_("Accidents from %s"),date("F, Y",strtotime($date))).'</h1>'; |
|
| 55 | -} elseif (preg_match('/^[0-9]{4}$/',$date)) { |
|
| 56 | - print '<h1>'.sprintf(_("Accidents from %s"),$date).'</h1>'; |
|
| 51 | +if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $date)) { |
|
| 52 | + print '<h1>'.sprintf(_("Accidents from %s"), date("l F j, Y", strtotime($date))).'</h1>'; |
|
| 53 | +} elseif (preg_match('/^[0-9]{4}-[0-9]{2}$/', $date)) { |
|
| 54 | + print '<h1>'.sprintf(_("Accidents from %s"), date("F, Y", strtotime($date))).'</h1>'; |
|
| 55 | +} elseif (preg_match('/^[0-9]{4}$/', $date)) { |
|
| 56 | + print '<h1>'.sprintf(_("Accidents from %s"), $date).'</h1>'; |
|
| 57 | 57 | } |
| 58 | 58 | print '</div>'; |
| 59 | 59 | |
| 60 | 60 | print '<div class="table column">'; |
| 61 | 61 | |
| 62 | -if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/',$date)) { |
|
| 63 | - print '<p>'.sprintf(_("The table below shows the Accidents on <strong>%s</strong>."),date("l M j, Y",strtotime($date))).'</p>'; |
|
| 64 | -} elseif (preg_match('/^[0-9]{4}-[0-9]{2}$/',$date)) { |
|
| 65 | - print '<p>'.sprintf(_("The table below shows the Accidents on <strong>%s</strong>."),date("M, Y",strtotime($date))).'</p>'; |
|
| 66 | -} elseif (preg_match('/^[0-9]{4}$/',$date)) { |
|
| 67 | - print '<p>'.sprintf(_("The table below shows the Accidents on <strong>%s</strong>."),$date).'</p>'; |
|
| 62 | +if (preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $date)) { |
|
| 63 | + print '<p>'.sprintf(_("The table below shows the Accidents on <strong>%s</strong>."), date("l M j, Y", strtotime($date))).'</p>'; |
|
| 64 | +} elseif (preg_match('/^[0-9]{4}-[0-9]{2}$/', $date)) { |
|
| 65 | + print '<p>'.sprintf(_("The table below shows the Accidents on <strong>%s</strong>."), date("M, Y", strtotime($date))).'</p>'; |
|
| 66 | +} elseif (preg_match('/^[0-9]{4}$/', $date)) { |
|
| 67 | + print '<p>'.sprintf(_("The table below shows the Accidents on <strong>%s</strong>."), $date).'</p>'; |
|
| 68 | 68 | } |
| 69 | -$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference,'accident',$date); |
|
| 69 | +$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference, 'accident', $date); |
|
| 70 | 70 | //print_r($spotter_array); |
| 71 | 71 | if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) { |
| 72 | 72 | include('table-output.php'); |
@@ -71,8 +71,12 @@ |
||
| 71 | 71 | if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) { |
| 72 | 72 | include('table-output.php'); |
| 73 | 73 | print '<div class="pagination">'; |
| 74 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$date.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
| 75 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$date.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
| 74 | + if ($limit_previous_1 >= 0) { |
|
| 75 | + print '<a href="'.$page_url.'/'.$date.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
| 76 | + } |
|
| 77 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
| 78 | + print '<a href="'.$page_url.'/'.$date.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
| 79 | + } |
|
| 76 | 80 | print '</div>'; |
| 77 | 81 | } |
| 78 | 82 | print '</div>'; |
@@ -12,8 +12,12 @@ |
||
| 12 | 12 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
| 13 | 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)); |
|
| 15 | +if ($year != '') { |
|
| 16 | + $filter = array_merge($filter,array('year' => $year)); |
|
| 17 | +} |
|
| 18 | +if ($month != '') { |
|
| 19 | + $filter = array_merge($filter,array('month' => $month)); |
|
| 20 | +} |
|
| 17 | 21 | $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
| 18 | 22 | |
| 19 | 23 | if (!empty($spotter_array)) |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | require_once('require/class.Spotter.php'); |
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | if (!isset($_GET['owner'])) { |
| 6 | - header('Location: '.$globalURL.'/owner'); |
|
| 7 | - die(); |
|
| 6 | + header('Location: '.$globalURL.'/owner'); |
|
| 7 | + die(); |
|
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | 10 | $owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
@@ -7,18 +7,18 @@ discard block |
||
| 7 | 7 | die(); |
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | -$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
| 11 | -$sort = filter_input(INPUT_GET,'sort',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 | +$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
| 11 | +$sort = filter_input(INPUT_GET, 'sort', 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 Aircraft by Registration of %s"),$spotter_array[0]['aircraft_owner']); |
|
| 21 | + $title = sprintf(_("Most Common Aircraft by Registration 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>'; |
@@ -29,9 +29,9 @@ discard block |
||
| 29 | 29 | include('owner-sub-menu.php'); |
| 30 | 30 | print '<div class="column">'; |
| 31 | 31 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
| 32 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
| 32 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
| 33 | 33 | |
| 34 | - $aircraft_array = $Spotter->countAllAircraftRegistrationByOwner($owner,$filter); |
|
| 34 | + $aircraft_array = $Spotter->countAllAircraftRegistrationByOwner($owner, $filter); |
|
| 35 | 35 | |
| 36 | 36 | if (!empty($aircraft_array)) |
| 37 | 37 | { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | print '</thead>'; |
| 48 | 48 | print '<tbody>'; |
| 49 | 49 | $i = 1; |
| 50 | - foreach($aircraft_array as $aircraft_item) |
|
| 50 | + foreach ($aircraft_array as $aircraft_item) |
|
| 51 | 51 | { |
| 52 | 52 | print '<tr>'; |
| 53 | 53 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * Get SQL query part for filter used |
| 16 | 16 | * @param Array $filter the filter |
| 17 | - * @return Array the SQL part |
|
| 17 | + * @return string the SQL part |
|
| 18 | 18 | */ |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | /** |
| 16 | - * Get SQL query part for filter used |
|
| 17 | - * @param Array $filter the filter |
|
| 18 | - * @return Array the SQL part |
|
| 19 | - */ |
|
| 16 | + * Get SQL query part for filter used |
|
| 17 | + * @param Array $filter the filter |
|
| 18 | + * @return Array the SQL part |
|
| 19 | + */ |
|
| 20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
| 142 | - * Gets all the spotter information based on the latest data entry |
|
| 143 | - * |
|
| 144 | - * @return Array the spotter information |
|
| 145 | - * |
|
| 146 | - */ |
|
| 142 | + * Gets all the spotter information based on the latest data entry |
|
| 143 | + * |
|
| 144 | + * @return Array the spotter information |
|
| 145 | + * |
|
| 146 | + */ |
|
| 147 | 147 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
| 148 | 148 | { |
| 149 | 149 | global $globalDBdriver, $globalLiveInterval; |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | - * Gets Minimal Live Spotter data |
|
| 190 | - * |
|
| 191 | - * @return Array the spotter information |
|
| 192 | - * |
|
| 193 | - */ |
|
| 189 | + * Gets Minimal Live Spotter data |
|
| 190 | + * |
|
| 191 | + * @return Array the spotter information |
|
| 192 | + * |
|
| 193 | + */ |
|
| 194 | 194 | public function getMinLiveSpotterData($limit = 0,$filter = array()) |
| 195 | 195 | { |
| 196 | 196 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit; |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | /** |
| 245 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 246 | - * |
|
| 247 | - * @return Array the spotter information |
|
| 248 | - * |
|
| 249 | - */ |
|
| 245 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 246 | + * |
|
| 247 | + * @return Array the spotter information |
|
| 248 | + * |
|
| 249 | + */ |
|
| 250 | 250 | public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = 0, $id = '') |
| 251 | 251 | { |
| 252 | 252 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
@@ -349,11 +349,11 @@ discard block |
||
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | /** |
| 352 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 353 | - * |
|
| 354 | - * @return Array the spotter information |
|
| 355 | - * |
|
| 356 | - */ |
|
| 352 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 353 | + * |
|
| 354 | + * @return Array the spotter information |
|
| 355 | + * |
|
| 356 | + */ |
|
| 357 | 357 | public function getMinLastLiveSpotterDataByID($id = '',$filter = array(), $limit = 0) |
| 358 | 358 | { |
| 359 | 359 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
@@ -419,11 +419,11 @@ discard block |
||
| 419 | 419 | } |
| 420 | 420 | |
| 421 | 421 | /** |
| 422 | - * Gets number of latest data entry |
|
| 423 | - * |
|
| 424 | - * @return String number of entry |
|
| 425 | - * |
|
| 426 | - */ |
|
| 422 | + * Gets number of latest data entry |
|
| 423 | + * |
|
| 424 | + * @return String number of entry |
|
| 425 | + * |
|
| 426 | + */ |
|
| 427 | 427 | public function getLiveSpotterCount($filter = array()) |
| 428 | 428 | { |
| 429 | 429 | global $globalDBdriver, $globalLiveInterval; |
@@ -450,11 +450,11 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | /** |
| 453 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 454 | - * |
|
| 455 | - * @return Array the spotter information |
|
| 456 | - * |
|
| 457 | - */ |
|
| 453 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 454 | + * |
|
| 455 | + * @return Array the spotter information |
|
| 456 | + * |
|
| 457 | + */ |
|
| 458 | 458 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
| 459 | 459 | { |
| 460 | 460 | global $globalDBdriver, $globalLiveInterval,$globalMap2DAircraftsLimit; |
@@ -482,11 +482,11 @@ discard block |
||
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | /** |
| 485 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 486 | - * |
|
| 487 | - * @return Array the spotter information |
|
| 488 | - * |
|
| 489 | - */ |
|
| 485 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 486 | + * |
|
| 487 | + * @return Array the spotter information |
|
| 488 | + * |
|
| 489 | + */ |
|
| 490 | 490 | public function getMinLiveSpotterDatabyCoord($coord,$limit = 0, $filter = array()) |
| 491 | 491 | { |
| 492 | 492 | global $globalDBdriver, $globalLiveInterval, $globalArchive,$globalMap2DAircraftsLimit; |
@@ -577,11 +577,11 @@ discard block |
||
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | /** |
| 580 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 581 | - * |
|
| 582 | - * @return Array the spotter information |
|
| 583 | - * |
|
| 584 | - */ |
|
| 580 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 581 | + * |
|
| 582 | + * @return Array the spotter information |
|
| 583 | + * |
|
| 584 | + */ |
|
| 585 | 585 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 586 | 586 | { |
| 587 | 587 | $Spotter = new Spotter($this->db); |
@@ -591,98 +591,98 @@ discard block |
||
| 591 | 591 | return false; |
| 592 | 592 | } |
| 593 | 593 | } |
| 594 | - if ($lng != '') |
|
| 595 | - { |
|
| 596 | - if (!is_numeric($lng)) |
|
| 597 | - { |
|
| 598 | - return false; |
|
| 599 | - } |
|
| 600 | - } |
|
| 601 | - |
|
| 602 | - if ($radius != '') |
|
| 603 | - { |
|
| 604 | - if (!is_numeric($radius)) |
|
| 605 | - { |
|
| 606 | - return false; |
|
| 607 | - } |
|
| 608 | - } |
|
| 594 | + if ($lng != '') |
|
| 595 | + { |
|
| 596 | + if (!is_numeric($lng)) |
|
| 597 | + { |
|
| 598 | + return false; |
|
| 599 | + } |
|
| 600 | + } |
|
| 601 | + |
|
| 602 | + if ($radius != '') |
|
| 603 | + { |
|
| 604 | + if (!is_numeric($radius)) |
|
| 605 | + { |
|
| 606 | + return false; |
|
| 607 | + } |
|
| 608 | + } |
|
| 609 | 609 | $additional_query = ''; |
| 610 | - if ($interval != '') |
|
| 611 | - { |
|
| 612 | - if (!is_string($interval)) |
|
| 613 | - { |
|
| 614 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 615 | - return false; |
|
| 616 | - } else { |
|
| 617 | - if ($interval == '1m') |
|
| 618 | - { |
|
| 619 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 620 | - } else if ($interval == '15m'){ |
|
| 621 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
| 622 | - } |
|
| 623 | - } |
|
| 624 | - } else { |
|
| 625 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 626 | - } |
|
| 627 | - |
|
| 628 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 610 | + if ($interval != '') |
|
| 611 | + { |
|
| 612 | + if (!is_string($interval)) |
|
| 613 | + { |
|
| 614 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 615 | + return false; |
|
| 616 | + } else { |
|
| 617 | + if ($interval == '1m') |
|
| 618 | + { |
|
| 619 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 620 | + } else if ($interval == '15m'){ |
|
| 621 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
| 622 | + } |
|
| 623 | + } |
|
| 624 | + } else { |
|
| 625 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 626 | + } |
|
| 627 | + |
|
| 628 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 629 | 629 | WHERE spotter_live.latitude <> '' |
| 630 | 630 | AND spotter_live.longitude <> '' |
| 631 | 631 | ".$additional_query." |
| 632 | 632 | HAVING distance < :radius |
| 633 | 633 | ORDER BY distance"; |
| 634 | 634 | |
| 635 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 635 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 636 | 636 | |
| 637 | - return $spotter_array; |
|
| 638 | - } |
|
| 637 | + return $spotter_array; |
|
| 638 | + } |
|
| 639 | 639 | |
| 640 | 640 | |
| 641 | - /** |
|
| 642 | - * Gets all the spotter information based on a particular callsign |
|
| 643 | - * |
|
| 644 | - * @return Array the spotter information |
|
| 645 | - * |
|
| 646 | - */ |
|
| 641 | + /** |
|
| 642 | + * Gets all the spotter information based on a particular callsign |
|
| 643 | + * |
|
| 644 | + * @return Array the spotter information |
|
| 645 | + * |
|
| 646 | + */ |
|
| 647 | 647 | public function getLastLiveSpotterDataByIdent($ident) |
| 648 | 648 | { |
| 649 | 649 | $Spotter = new Spotter($this->db); |
| 650 | 650 | date_default_timezone_set('UTC'); |
| 651 | 651 | |
| 652 | 652 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 653 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 653 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 654 | 654 | |
| 655 | 655 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
| 656 | 656 | |
| 657 | 657 | return $spotter_array; |
| 658 | 658 | } |
| 659 | 659 | |
| 660 | - /** |
|
| 661 | - * Gets all the spotter information based on a particular callsign |
|
| 662 | - * |
|
| 663 | - * @return Array the spotter information |
|
| 664 | - * |
|
| 665 | - */ |
|
| 660 | + /** |
|
| 661 | + * Gets all the spotter information based on a particular callsign |
|
| 662 | + * |
|
| 663 | + * @return Array the spotter information |
|
| 664 | + * |
|
| 665 | + */ |
|
| 666 | 666 | public function getDateLiveSpotterDataByIdent($ident,$date) |
| 667 | 667 | { |
| 668 | 668 | $Spotter = new Spotter($this->db); |
| 669 | 669 | date_default_timezone_set('UTC'); |
| 670 | 670 | |
| 671 | 671 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 672 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 672 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 673 | 673 | |
| 674 | - $date = date('c',$date); |
|
| 674 | + $date = date('c',$date); |
|
| 675 | 675 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
| 676 | 676 | |
| 677 | 677 | return $spotter_array; |
| 678 | 678 | } |
| 679 | 679 | |
| 680 | - /** |
|
| 681 | - * Gets last spotter information based on a particular callsign |
|
| 682 | - * |
|
| 683 | - * @return Array the spotter information |
|
| 684 | - * |
|
| 685 | - */ |
|
| 680 | + /** |
|
| 681 | + * Gets last spotter information based on a particular callsign |
|
| 682 | + * |
|
| 683 | + * @return Array the spotter information |
|
| 684 | + * |
|
| 685 | + */ |
|
| 686 | 686 | public function getLastLiveSpotterDataById($id) |
| 687 | 687 | { |
| 688 | 688 | $Spotter = new Spotter($this->db); |
@@ -693,12 +693,12 @@ discard block |
||
| 693 | 693 | return $spotter_array; |
| 694 | 694 | } |
| 695 | 695 | |
| 696 | - /** |
|
| 697 | - * Gets last spotter information based on a particular callsign |
|
| 698 | - * |
|
| 699 | - * @return Array the spotter information |
|
| 700 | - * |
|
| 701 | - */ |
|
| 696 | + /** |
|
| 697 | + * Gets last spotter information based on a particular callsign |
|
| 698 | + * |
|
| 699 | + * @return Array the spotter information |
|
| 700 | + * |
|
| 701 | + */ |
|
| 702 | 702 | public function getDateLiveSpotterDataById($id,$date) |
| 703 | 703 | { |
| 704 | 704 | $Spotter = new Spotter($this->db); |
@@ -711,21 +711,21 @@ discard block |
||
| 711 | 711 | return $spotter_array; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | - /** |
|
| 715 | - * Gets altitude information based on a particular callsign |
|
| 716 | - * |
|
| 717 | - * @return Array the spotter information |
|
| 718 | - * |
|
| 719 | - */ |
|
| 714 | + /** |
|
| 715 | + * Gets altitude information based on a particular callsign |
|
| 716 | + * |
|
| 717 | + * @return Array the spotter information |
|
| 718 | + * |
|
| 719 | + */ |
|
| 720 | 720 | public function getAltitudeLiveSpotterDataByIdent($ident) |
| 721 | 721 | { |
| 722 | 722 | |
| 723 | 723 | date_default_timezone_set('UTC'); |
| 724 | 724 | |
| 725 | 725 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 726 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 726 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 727 | 727 | |
| 728 | - try { |
|
| 728 | + try { |
|
| 729 | 729 | |
| 730 | 730 | $sth = $this->db->prepare($query); |
| 731 | 731 | $sth->execute(array(':ident' => $ident)); |
@@ -738,12 +738,12 @@ discard block |
||
| 738 | 738 | return $spotter_array; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - /** |
|
| 742 | - * Gets all the spotter information based on a particular id |
|
| 743 | - * |
|
| 744 | - * @return Array the spotter information |
|
| 745 | - * |
|
| 746 | - */ |
|
| 741 | + /** |
|
| 742 | + * Gets all the spotter information based on a particular id |
|
| 743 | + * |
|
| 744 | + * @return Array the spotter information |
|
| 745 | + * |
|
| 746 | + */ |
|
| 747 | 747 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
| 748 | 748 | { |
| 749 | 749 | global $globalDBdriver, $globalLiveInterval; |
@@ -771,18 +771,18 @@ discard block |
||
| 771 | 771 | return $spotter_array; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | - /** |
|
| 775 | - * Gets all the spotter information based on a particular ident |
|
| 776 | - * |
|
| 777 | - * @return Array the spotter information |
|
| 778 | - * |
|
| 779 | - */ |
|
| 774 | + /** |
|
| 775 | + * Gets all the spotter information based on a particular ident |
|
| 776 | + * |
|
| 777 | + * @return Array the spotter information |
|
| 778 | + * |
|
| 779 | + */ |
|
| 780 | 780 | public function getAllLiveSpotterDataByIdent($ident) |
| 781 | 781 | { |
| 782 | 782 | date_default_timezone_set('UTC'); |
| 783 | 783 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 784 | 784 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
| 785 | - try { |
|
| 785 | + try { |
|
| 786 | 786 | |
| 787 | 787 | $sth = $this->db->prepare($query); |
| 788 | 788 | $sth->execute(array(':ident' => $ident)); |
@@ -796,23 +796,23 @@ discard block |
||
| 796 | 796 | |
| 797 | 797 | |
| 798 | 798 | /** |
| 799 | - * Deletes all info in the table |
|
| 800 | - * |
|
| 801 | - * @return String success or false |
|
| 802 | - * |
|
| 803 | - */ |
|
| 799 | + * Deletes all info in the table |
|
| 800 | + * |
|
| 801 | + * @return String success or false |
|
| 802 | + * |
|
| 803 | + */ |
|
| 804 | 804 | public function deleteLiveSpotterData() |
| 805 | 805 | { |
| 806 | 806 | global $globalDBdriver; |
| 807 | 807 | if ($globalDBdriver == 'mysql') { |
| 808 | 808 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
| 809 | 809 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
| 810 | - //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
| 810 | + //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
| 811 | 811 | } else { |
| 812 | 812 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
| 813 | 813 | } |
| 814 | 814 | |
| 815 | - try { |
|
| 815 | + try { |
|
| 816 | 816 | |
| 817 | 817 | $sth = $this->db->prepare($query); |
| 818 | 818 | $sth->execute(); |
@@ -824,18 +824,18 @@ discard block |
||
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | /** |
| 827 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 828 | - * |
|
| 829 | - * @return String success or false |
|
| 830 | - * |
|
| 831 | - */ |
|
| 827 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 828 | + * |
|
| 829 | + * @return String success or false |
|
| 830 | + * |
|
| 831 | + */ |
|
| 832 | 832 | public function deleteLiveSpotterDataNotUpdated() |
| 833 | 833 | { |
| 834 | 834 | global $globalDBdriver, $globalDebug; |
| 835 | 835 | if ($globalDBdriver == 'mysql') { |
| 836 | 836 | //$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0'; |
| 837 | - $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0"; |
|
| 838 | - try { |
|
| 837 | + $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0"; |
|
| 838 | + try { |
|
| 839 | 839 | |
| 840 | 840 | $sth = $this->db->prepare($query); |
| 841 | 841 | $sth->execute(); |
@@ -843,8 +843,8 @@ discard block |
||
| 843 | 843 | return "error"; |
| 844 | 844 | } |
| 845 | 845 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 846 | - $i = 0; |
|
| 847 | - $j =0; |
|
| 846 | + $i = 0; |
|
| 847 | + $j =0; |
|
| 848 | 848 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 849 | 849 | foreach($all as $row) |
| 850 | 850 | { |
@@ -852,20 +852,20 @@ discard block |
||
| 852 | 852 | $j++; |
| 853 | 853 | if ($j == 30) { |
| 854 | 854 | if ($globalDebug) echo "."; |
| 855 | - try { |
|
| 855 | + try { |
|
| 856 | 856 | |
| 857 | 857 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 858 | 858 | $sth->execute(); |
| 859 | 859 | } catch(PDOException $e) { |
| 860 | 860 | return "error"; |
| 861 | 861 | } |
| 862 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
| 863 | - $j = 0; |
|
| 862 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
| 863 | + $j = 0; |
|
| 864 | 864 | } |
| 865 | 865 | $query_delete .= "'".$row['flightaware_id']."',"; |
| 866 | 866 | } |
| 867 | 867 | if ($i > 0) { |
| 868 | - try { |
|
| 868 | + try { |
|
| 869 | 869 | |
| 870 | 870 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 871 | 871 | $sth->execute(); |
@@ -876,9 +876,9 @@ discard block |
||
| 876 | 876 | return "success"; |
| 877 | 877 | } elseif ($globalDBdriver == 'pgsql') { |
| 878 | 878 | //$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0"; |
| 879 | - //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 880 | - $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)"; |
|
| 881 | - try { |
|
| 879 | + //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 880 | + $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)"; |
|
| 881 | + try { |
|
| 882 | 882 | |
| 883 | 883 | $sth = $this->db->prepare($query); |
| 884 | 884 | $sth->execute(); |
@@ -922,17 +922,17 @@ discard block |
||
| 922 | 922 | } |
| 923 | 923 | |
| 924 | 924 | /** |
| 925 | - * Deletes all info in the table for an ident |
|
| 926 | - * |
|
| 927 | - * @return String success or false |
|
| 928 | - * |
|
| 929 | - */ |
|
| 925 | + * Deletes all info in the table for an ident |
|
| 926 | + * |
|
| 927 | + * @return String success or false |
|
| 928 | + * |
|
| 929 | + */ |
|
| 930 | 930 | public function deleteLiveSpotterDataByIdent($ident) |
| 931 | 931 | { |
| 932 | 932 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 933 | 933 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
| 934 | 934 | |
| 935 | - try { |
|
| 935 | + try { |
|
| 936 | 936 | |
| 937 | 937 | $sth = $this->db->prepare($query); |
| 938 | 938 | $sth->execute(array(':ident' => $ident)); |
@@ -944,17 +944,17 @@ discard block |
||
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | /** |
| 947 | - * Deletes all info in the table for an id |
|
| 948 | - * |
|
| 949 | - * @return String success or false |
|
| 950 | - * |
|
| 951 | - */ |
|
| 947 | + * Deletes all info in the table for an id |
|
| 948 | + * |
|
| 949 | + * @return String success or false |
|
| 950 | + * |
|
| 951 | + */ |
|
| 952 | 952 | public function deleteLiveSpotterDataById($id) |
| 953 | 953 | { |
| 954 | 954 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 955 | 955 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
| 956 | 956 | |
| 957 | - try { |
|
| 957 | + try { |
|
| 958 | 958 | |
| 959 | 959 | $sth = $this->db->prepare($query); |
| 960 | 960 | $sth->execute(array(':id' => $id)); |
@@ -967,11 +967,11 @@ discard block |
||
| 967 | 967 | |
| 968 | 968 | |
| 969 | 969 | /** |
| 970 | - * Gets the aircraft ident within the last hour |
|
| 971 | - * |
|
| 972 | - * @return String the ident |
|
| 973 | - * |
|
| 974 | - */ |
|
| 970 | + * Gets the aircraft ident within the last hour |
|
| 971 | + * |
|
| 972 | + * @return String the ident |
|
| 973 | + * |
|
| 974 | + */ |
|
| 975 | 975 | public function getIdentFromLastHour($ident) |
| 976 | 976 | { |
| 977 | 977 | global $globalDBdriver, $globalTimezone; |
@@ -997,14 +997,14 @@ discard block |
||
| 997 | 997 | $ident_result = $row['ident']; |
| 998 | 998 | } |
| 999 | 999 | return $ident_result; |
| 1000 | - } |
|
| 1000 | + } |
|
| 1001 | 1001 | |
| 1002 | 1002 | /** |
| 1003 | - * Check recent aircraft |
|
| 1004 | - * |
|
| 1005 | - * @return String the ident |
|
| 1006 | - * |
|
| 1007 | - */ |
|
| 1003 | + * Check recent aircraft |
|
| 1004 | + * |
|
| 1005 | + * @return String the ident |
|
| 1006 | + * |
|
| 1007 | + */ |
|
| 1008 | 1008 | public function checkIdentRecent($ident) |
| 1009 | 1009 | { |
| 1010 | 1010 | global $globalDBdriver, $globalTimezone; |
@@ -1030,14 +1030,14 @@ discard block |
||
| 1030 | 1030 | $ident_result = $row['flightaware_id']; |
| 1031 | 1031 | } |
| 1032 | 1032 | return $ident_result; |
| 1033 | - } |
|
| 1033 | + } |
|
| 1034 | 1034 | |
| 1035 | 1035 | /** |
| 1036 | - * Check recent aircraft by id |
|
| 1037 | - * |
|
| 1038 | - * @return String the ident |
|
| 1039 | - * |
|
| 1040 | - */ |
|
| 1036 | + * Check recent aircraft by id |
|
| 1037 | + * |
|
| 1038 | + * @return String the ident |
|
| 1039 | + * |
|
| 1040 | + */ |
|
| 1041 | 1041 | public function checkIdRecent($id) |
| 1042 | 1042 | { |
| 1043 | 1043 | global $globalDBdriver, $globalTimezone; |
@@ -1063,14 +1063,14 @@ discard block |
||
| 1063 | 1063 | $ident_result = $row['flightaware_id']; |
| 1064 | 1064 | } |
| 1065 | 1065 | return $ident_result; |
| 1066 | - } |
|
| 1066 | + } |
|
| 1067 | 1067 | |
| 1068 | 1068 | /** |
| 1069 | - * Check recent aircraft by ModeS |
|
| 1070 | - * |
|
| 1071 | - * @return String the ModeS |
|
| 1072 | - * |
|
| 1073 | - */ |
|
| 1069 | + * Check recent aircraft by ModeS |
|
| 1070 | + * |
|
| 1071 | + * @return String the ModeS |
|
| 1072 | + * |
|
| 1073 | + */ |
|
| 1074 | 1074 | public function checkModeSRecent($modes) |
| 1075 | 1075 | { |
| 1076 | 1076 | global $globalDBdriver, $globalTimezone; |
@@ -1100,11 +1100,11 @@ discard block |
||
| 1100 | 1100 | } |
| 1101 | 1101 | |
| 1102 | 1102 | /** |
| 1103 | - * Gets the aircraft data from the last 20 seconds |
|
| 1104 | - * |
|
| 1105 | - * @return Array the spotter data |
|
| 1106 | - * |
|
| 1107 | - */ |
|
| 1103 | + * Gets the aircraft data from the last 20 seconds |
|
| 1104 | + * |
|
| 1105 | + * @return Array the spotter data |
|
| 1106 | + * |
|
| 1107 | + */ |
|
| 1108 | 1108 | public function getRealTimeData($q = '') |
| 1109 | 1109 | { |
| 1110 | 1110 | global $globalDBdriver; |
@@ -1146,16 +1146,16 @@ discard block |
||
| 1146 | 1146 | } |
| 1147 | 1147 | |
| 1148 | 1148 | /** |
| 1149 | - * Adds a new spotter data |
|
| 1150 | - * |
|
| 1151 | - * @param String $flightaware_id the ID from flightaware |
|
| 1152 | - * @param String $ident the flight ident |
|
| 1153 | - * @param String $aircraft_icao the aircraft type |
|
| 1154 | - * @param String $departure_airport_icao the departure airport |
|
| 1155 | - * @param String $arrival_airport_icao the arrival airport |
|
| 1156 | - * @return String success or false |
|
| 1157 | - * |
|
| 1158 | - */ |
|
| 1149 | + * Adds a new spotter data |
|
| 1150 | + * |
|
| 1151 | + * @param String $flightaware_id the ID from flightaware |
|
| 1152 | + * @param String $ident the flight ident |
|
| 1153 | + * @param String $aircraft_icao the aircraft type |
|
| 1154 | + * @param String $departure_airport_icao the departure airport |
|
| 1155 | + * @param String $arrival_airport_icao the arrival airport |
|
| 1156 | + * @return String success or false |
|
| 1157 | + * |
|
| 1158 | + */ |
|
| 1159 | 1159 | public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
| 1160 | 1160 | { |
| 1161 | 1161 | global $globalURL, $globalArchive, $globalDebug; |
@@ -1298,10 +1298,10 @@ discard block |
||
| 1298 | 1298 | $arrival_airport_country = ''; |
| 1299 | 1299 | |
| 1300 | 1300 | |
| 1301 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 1302 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 1303 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1304 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1301 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 1302 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 1303 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1304 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1305 | 1305 | |
| 1306 | 1306 | $query = ''; |
| 1307 | 1307 | if ($globalArchive) { |
@@ -1322,10 +1322,10 @@ discard block |
||
| 1322 | 1322 | return "error : ".$e->getMessage(); |
| 1323 | 1323 | } |
| 1324 | 1324 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1325 | - if ($globalDebug) echo '(Add to Spotter archive : '; |
|
| 1326 | - $SpotterArchive = new SpotterArchive($this->db); |
|
| 1327 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 1328 | - if ($globalDebug) echo $result.')'; |
|
| 1325 | + if ($globalDebug) echo '(Add to Spotter archive : '; |
|
| 1326 | + $SpotterArchive = new SpotterArchive($this->db); |
|
| 1327 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 1328 | + if ($globalDebug) echo $result.')'; |
|
| 1329 | 1329 | } elseif ($globalDebug && $putinarchive !== true) { |
| 1330 | 1330 | echo '(Not adding to archive)'; |
| 1331 | 1331 | } elseif ($globalDebug && $noarchive === true) { |
@@ -17,62 +17,62 @@ discard block |
||
| 17 | 17 | * @param Array $filter the filter |
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
| 23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
| 26 | 26 | } else { |
| 27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | if (isset($filter[0]['source'])) { |
| 31 | - $filters = array_merge($filters,$filter); |
|
| 31 | + $filters = array_merge($filters, $filter); |
|
| 32 | 32 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 34 | 34 | $filter_query_join = ''; |
| 35 | 35 | $filter_query_where = ''; |
| 36 | - foreach($filters as $flt) { |
|
| 36 | + foreach ($filters as $flt) { |
|
| 37 | 37 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 38 | 38 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
| 39 | 39 | if (isset($flt['source'])) { |
| 40 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 40 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 41 | 41 | } else { |
| 42 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 42 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 47 | 47 | if (isset($flt['source'])) { |
| 48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 49 | 49 | } else { |
| 50 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 50 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 54 | 54 | if (isset($flt['source'])) { |
| 55 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 55 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 56 | 56 | } else { |
| 57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
| 61 | 61 | if (isset($flt['source'])) { |
| 62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 63 | 63 | } else { |
| 64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
| 68 | 68 | if (isset($flt['source'])) { |
| 69 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
| 69 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 74 | 74 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
| 75 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
| 75 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
| 83 | 83 | } |
| 84 | 84 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 85 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
| 85 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
| 86 | 86 | } |
| 87 | 87 | if (isset($filter['blocked']) && $filter['blocked'] == true) { |
| 88 | 88 | $filter_query_join .= " INNER JOIN (SELECT callsign FROM aircraft_block) cblk ON cblk.callsign = spotter_live.ident"; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | if (count($filter['source']) == 1) { |
| 92 | 92 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
| 93 | 93 | } else { |
| 94 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 94 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -124,15 +124,15 @@ discard block |
||
| 124 | 124 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
| 127 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
| 128 | 128 | } |
| 129 | 129 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 130 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 130 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 131 | 131 | } |
| 132 | 132 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 133 | 133 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 134 | 134 | if ($filter_query_where != '') { |
| 135 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 135 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 136 | 136 | } |
| 137 | 137 | $filter_query = $filter_query_join.$filter_query_where; |
| 138 | 138 | return $filter_query; |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | if ($limit != '') |
| 156 | 156 | { |
| 157 | 157 | $limit_array = explode(',', $limit); |
| 158 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 159 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 158 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 159 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 160 | 160 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 161 | 161 | { |
| 162 | 162 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } else { |
| 181 | 181 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
| 182 | 182 | } |
| 183 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 183 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 184 | 184 | |
| 185 | 185 | return $spotter_array; |
| 186 | 186 | } |
@@ -191,34 +191,34 @@ discard block |
||
| 191 | 191 | * @return Array the spotter information |
| 192 | 192 | * |
| 193 | 193 | */ |
| 194 | - public function getMinLiveSpotterData($limit = 0,$filter = array()) |
|
| 194 | + public function getMinLiveSpotterData($limit = 0, $filter = array()) |
|
| 195 | 195 | { |
| 196 | 196 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit; |
| 197 | 197 | date_default_timezone_set('UTC'); |
| 198 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 198 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 199 | 199 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 200 | 200 | if ($globalDBdriver == 'mysql') { |
| 201 | 201 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 202 | 202 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 203 | 203 | // FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date AND'." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC"; |
| 204 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 204 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 205 | 205 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date AND'." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
| 206 | 206 | } else { |
| 207 | 207 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 208 | 208 | // FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC"; |
| 209 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 209 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 210 | 210 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
| 211 | 211 | } |
| 212 | 212 | } else { |
| 213 | 213 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 214 | 214 | // $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 215 | 215 | // FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
| 216 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 216 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 217 | 217 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
| 218 | 218 | } else { |
| 219 | 219 | // $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 220 | 220 | // FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
| 221 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 221 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 222 | 222 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | if ($limit == 0 && isset($globalMap2DAircraftsLimit) && $globalMap2DAircraftsLimit != '') { |
| 227 | 227 | $limit = $globalMap2DAircraftsLimit; |
| 228 | 228 | } |
| 229 | - if ($limit != 0 && filter_var($limit,FILTER_VALIDATE_INT)) { |
|
| 229 | + if ($limit != 0 && filter_var($limit, FILTER_VALIDATE_INT)) { |
|
| 230 | 230 | $query .= ' LIMIT '.$limit; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | try { |
| 234 | 234 | $sth = $this->db->prepare($query); |
| 235 | 235 | $sth->execute(); |
| 236 | - } catch(PDOException $e) { |
|
| 236 | + } catch (PDOException $e) { |
|
| 237 | 237 | echo $e->getMessage(); |
| 238 | 238 | die; |
| 239 | 239 | } |
@@ -247,20 +247,20 @@ discard block |
||
| 247 | 247 | * @return Array the spotter information |
| 248 | 248 | * |
| 249 | 249 | */ |
| 250 | - public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = 0, $id = '') |
|
| 250 | + public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = 0, $id = '') |
|
| 251 | 251 | { |
| 252 | 252 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
| 253 | 253 | date_default_timezone_set('UTC'); |
| 254 | 254 | $usecoord = false; |
| 255 | 255 | if (is_array($coord) && !empty($coord)) { |
| 256 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 257 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 258 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 259 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 256 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 257 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 258 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 259 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 260 | 260 | $usecoord = true; |
| 261 | 261 | } |
| 262 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
| 263 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 262 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 263 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 264 | 264 | |
| 265 | 265 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
| 266 | 266 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | ORDER BY flightaware_id, date"; |
| 291 | 291 | if ($limit > 0) $query .= " LIMIT ".$limit; |
| 292 | 292 | } else { |
| 293 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 293 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 294 | 294 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
| 295 | 295 | if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
| 296 | 296 | if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | try { |
| 341 | 341 | $sth = $this->db->prepare($query); |
| 342 | 342 | $sth->execute($query_values); |
| 343 | - } catch(PDOException $e) { |
|
| 343 | + } catch (PDOException $e) { |
|
| 344 | 344 | echo $e->getMessage(); |
| 345 | 345 | die; |
| 346 | 346 | } |
@@ -354,12 +354,12 @@ discard block |
||
| 354 | 354 | * @return Array the spotter information |
| 355 | 355 | * |
| 356 | 356 | */ |
| 357 | - public function getMinLastLiveSpotterDataByID($id = '',$filter = array(), $limit = 0) |
|
| 357 | + public function getMinLastLiveSpotterDataByID($id = '', $filter = array(), $limit = 0) |
|
| 358 | 358 | { |
| 359 | 359 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
| 360 | 360 | date_default_timezone_set('UTC'); |
| 361 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
| 362 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 361 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 362 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 363 | 363 | |
| 364 | 364 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
| 365 | 365 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -384,13 +384,13 @@ discard block |
||
| 384 | 384 | } |
| 385 | 385 | } else { |
| 386 | 386 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 387 | - $query = "SELECT * FROM ( |
|
| 387 | + $query = "SELECT * FROM ( |
|
| 388 | 388 | SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
| 389 | 389 | FROM spotter_archive |
| 390 | 390 | INNER JOIN ( |
| 391 | 391 | SELECT flightaware_id |
| 392 | 392 | FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id"; |
| 393 | - $query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
| 393 | + $query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
| 394 | 394 | $query .= "UNION |
| 395 | 395 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 396 | 396 | FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id"; |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | try { |
| 411 | 411 | $sth = $this->db->prepare($query); |
| 412 | 412 | $sth->execute($query_values); |
| 413 | - } catch(PDOException $e) { |
|
| 413 | + } catch (PDOException $e) { |
|
| 414 | 414 | echo $e->getMessage(); |
| 415 | 415 | die; |
| 416 | 416 | } |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | public function getLiveSpotterCount($filter = array()) |
| 428 | 428 | { |
| 429 | 429 | global $globalDBdriver, $globalLiveInterval; |
| 430 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 430 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 431 | 431 | |
| 432 | 432 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 433 | 433 | if ($globalDBdriver == 'mysql') { |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | try { |
| 441 | 441 | $sth = $this->db->prepare($query); |
| 442 | 442 | $sth->execute(); |
| 443 | - } catch(PDOException $e) { |
|
| 443 | + } catch (PDOException $e) { |
|
| 444 | 444 | echo $e->getMessage(); |
| 445 | 445 | die; |
| 446 | 446 | } |
@@ -457,16 +457,16 @@ discard block |
||
| 457 | 457 | */ |
| 458 | 458 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
| 459 | 459 | { |
| 460 | - global $globalDBdriver, $globalLiveInterval,$globalMap2DAircraftsLimit; |
|
| 460 | + global $globalDBdriver, $globalLiveInterval, $globalMap2DAircraftsLimit; |
|
| 461 | 461 | $Spotter = new Spotter($this->db); |
| 462 | 462 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 463 | 463 | $filter_query = $this->getFilter($filter); |
| 464 | 464 | |
| 465 | 465 | if (is_array($coord)) { |
| 466 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 467 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 468 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 469 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 466 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 467 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 468 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 469 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 470 | 470 | } else return array(); |
| 471 | 471 | if ($globalDBdriver == 'mysql') { |
| 472 | 472 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -487,28 +487,28 @@ discard block |
||
| 487 | 487 | * @return Array the spotter information |
| 488 | 488 | * |
| 489 | 489 | */ |
| 490 | - public function getMinLiveSpotterDatabyCoord($coord,$limit = 0, $filter = array()) |
|
| 490 | + public function getMinLiveSpotterDatabyCoord($coord, $limit = 0, $filter = array()) |
|
| 491 | 491 | { |
| 492 | - global $globalDBdriver, $globalLiveInterval, $globalArchive,$globalMap2DAircraftsLimit; |
|
| 492 | + global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit; |
|
| 493 | 493 | $Spotter = new Spotter($this->db); |
| 494 | 494 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 495 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 495 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 496 | 496 | |
| 497 | 497 | if (is_array($coord)) { |
| 498 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 499 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 500 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 501 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 498 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 499 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 500 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 501 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 502 | 502 | } else return array(); |
| 503 | 503 | if ($globalDBdriver == 'mysql') { |
| 504 | 504 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 505 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 505 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 506 | 506 | FROM spotter_live |
| 507 | 507 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
| 508 | 508 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
| 509 | 509 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC'; |
| 510 | 510 | } else { |
| 511 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 511 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 512 | 512 | FROM spotter_live |
| 513 | 513 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 514 | 514 | FROM spotter_live l |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 529 | 529 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
| 530 | 530 | */ |
| 531 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 531 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 532 | 532 | FROM spotter_live |
| 533 | 533 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
| 534 | 534 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | ) s on spotter_live.flightaware_id = s.flightaware_id |
| 548 | 548 | AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
| 549 | 549 | */ |
| 550 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 550 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 551 | 551 | FROM spotter_live |
| 552 | 552 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 553 | 553 | FROM spotter_live l |
@@ -562,13 +562,13 @@ discard block |
||
| 562 | 562 | if ($limit == 0 && isset($globalMap2DAircraftsLimit) && $globalMap2DAircraftsLimit != '') { |
| 563 | 563 | $limit = $globalMap2DAircraftsLimit; |
| 564 | 564 | } |
| 565 | - if ($limit != 0 && filter_var($limit,FILTER_VALIDATE_INT)) { |
|
| 565 | + if ($limit != 0 && filter_var($limit, FILTER_VALIDATE_INT)) { |
|
| 566 | 566 | $query .= ' LIMIT '.$limit; |
| 567 | 567 | } |
| 568 | 568 | try { |
| 569 | 569 | $sth = $this->db->prepare($query); |
| 570 | 570 | $sth->execute(); |
| 571 | - } catch(PDOException $e) { |
|
| 571 | + } catch (PDOException $e) { |
|
| 572 | 572 | echo $e->getMessage(); |
| 573 | 573 | die; |
| 574 | 574 | } |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | if ($interval == '1m') |
| 618 | 618 | { |
| 619 | 619 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 620 | - } else if ($interval == '15m'){ |
|
| 620 | + } else if ($interval == '15m') { |
|
| 621 | 621 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
| 622 | 622 | } |
| 623 | 623 | } |
@@ -625,14 +625,14 @@ discard block |
||
| 625 | 625 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 626 | 626 | } |
| 627 | 627 | |
| 628 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 628 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 629 | 629 | WHERE spotter_live.latitude <> '' |
| 630 | 630 | AND spotter_live.longitude <> '' |
| 631 | 631 | ".$additional_query." |
| 632 | 632 | HAVING distance < :radius |
| 633 | 633 | ORDER BY distance"; |
| 634 | 634 | |
| 635 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 635 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 636 | 636 | |
| 637 | 637 | return $spotter_array; |
| 638 | 638 | } |
@@ -650,9 +650,9 @@ discard block |
||
| 650 | 650 | date_default_timezone_set('UTC'); |
| 651 | 651 | |
| 652 | 652 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 653 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 653 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 654 | 654 | |
| 655 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 655 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 656 | 656 | |
| 657 | 657 | return $spotter_array; |
| 658 | 658 | } |
@@ -663,16 +663,16 @@ discard block |
||
| 663 | 663 | * @return Array the spotter information |
| 664 | 664 | * |
| 665 | 665 | */ |
| 666 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
| 666 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
| 667 | 667 | { |
| 668 | 668 | $Spotter = new Spotter($this->db); |
| 669 | 669 | date_default_timezone_set('UTC'); |
| 670 | 670 | |
| 671 | 671 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 672 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 672 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 673 | 673 | |
| 674 | - $date = date('c',$date); |
|
| 675 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 674 | + $date = date('c', $date); |
|
| 675 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 676 | 676 | |
| 677 | 677 | return $spotter_array; |
| 678 | 678 | } |
@@ -688,8 +688,8 @@ discard block |
||
| 688 | 688 | $Spotter = new Spotter($this->db); |
| 689 | 689 | date_default_timezone_set('UTC'); |
| 690 | 690 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 691 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 692 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 691 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 692 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 693 | 693 | return $spotter_array; |
| 694 | 694 | } |
| 695 | 695 | |
@@ -699,15 +699,15 @@ discard block |
||
| 699 | 699 | * @return Array the spotter information |
| 700 | 700 | * |
| 701 | 701 | */ |
| 702 | - public function getDateLiveSpotterDataById($id,$date) |
|
| 702 | + public function getDateLiveSpotterDataById($id, $date) |
|
| 703 | 703 | { |
| 704 | 704 | $Spotter = new Spotter($this->db); |
| 705 | 705 | date_default_timezone_set('UTC'); |
| 706 | 706 | |
| 707 | 707 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 708 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 709 | - $date = date('c',$date); |
|
| 710 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 708 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 709 | + $date = date('c', $date); |
|
| 710 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 711 | 711 | return $spotter_array; |
| 712 | 712 | } |
| 713 | 713 | |
@@ -723,13 +723,13 @@ discard block |
||
| 723 | 723 | date_default_timezone_set('UTC'); |
| 724 | 724 | |
| 725 | 725 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 726 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 726 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 727 | 727 | |
| 728 | 728 | try { |
| 729 | 729 | |
| 730 | 730 | $sth = $this->db->prepare($query); |
| 731 | 731 | $sth->execute(array(':ident' => $ident)); |
| 732 | - } catch(PDOException $e) { |
|
| 732 | + } catch (PDOException $e) { |
|
| 733 | 733 | echo $e->getMessage(); |
| 734 | 734 | die; |
| 735 | 735 | } |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | * @return Array the spotter information |
| 745 | 745 | * |
| 746 | 746 | */ |
| 747 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
| 747 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
| 748 | 748 | { |
| 749 | 749 | global $globalDBdriver, $globalLiveInterval; |
| 750 | 750 | date_default_timezone_set('UTC'); |
@@ -763,7 +763,7 @@ discard block |
||
| 763 | 763 | try { |
| 764 | 764 | $sth = $this->db->prepare($query); |
| 765 | 765 | $sth->execute(array(':id' => $id)); |
| 766 | - } catch(PDOException $e) { |
|
| 766 | + } catch (PDOException $e) { |
|
| 767 | 767 | echo $e->getMessage(); |
| 768 | 768 | die; |
| 769 | 769 | } |
@@ -781,12 +781,12 @@ discard block |
||
| 781 | 781 | { |
| 782 | 782 | date_default_timezone_set('UTC'); |
| 783 | 783 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 784 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 784 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 785 | 785 | try { |
| 786 | 786 | |
| 787 | 787 | $sth = $this->db->prepare($query); |
| 788 | 788 | $sth->execute(array(':ident' => $ident)); |
| 789 | - } catch(PDOException $e) { |
|
| 789 | + } catch (PDOException $e) { |
|
| 790 | 790 | echo $e->getMessage(); |
| 791 | 791 | die; |
| 792 | 792 | } |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | |
| 817 | 817 | $sth = $this->db->prepare($query); |
| 818 | 818 | $sth->execute(); |
| 819 | - } catch(PDOException $e) { |
|
| 819 | + } catch (PDOException $e) { |
|
| 820 | 820 | return "error"; |
| 821 | 821 | } |
| 822 | 822 | |
@@ -839,14 +839,14 @@ discard block |
||
| 839 | 839 | |
| 840 | 840 | $sth = $this->db->prepare($query); |
| 841 | 841 | $sth->execute(); |
| 842 | - } catch(PDOException $e) { |
|
| 842 | + } catch (PDOException $e) { |
|
| 843 | 843 | return "error"; |
| 844 | 844 | } |
| 845 | 845 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 846 | 846 | $i = 0; |
| 847 | - $j =0; |
|
| 847 | + $j = 0; |
|
| 848 | 848 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 849 | - foreach($all as $row) |
|
| 849 | + foreach ($all as $row) |
|
| 850 | 850 | { |
| 851 | 851 | $i++; |
| 852 | 852 | $j++; |
@@ -854,9 +854,9 @@ discard block |
||
| 854 | 854 | if ($globalDebug) echo "."; |
| 855 | 855 | try { |
| 856 | 856 | |
| 857 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 857 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 858 | 858 | $sth->execute(); |
| 859 | - } catch(PDOException $e) { |
|
| 859 | + } catch (PDOException $e) { |
|
| 860 | 860 | return "error"; |
| 861 | 861 | } |
| 862 | 862 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -867,9 +867,9 @@ discard block |
||
| 867 | 867 | if ($i > 0) { |
| 868 | 868 | try { |
| 869 | 869 | |
| 870 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 870 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 871 | 871 | $sth->execute(); |
| 872 | - } catch(PDOException $e) { |
|
| 872 | + } catch (PDOException $e) { |
|
| 873 | 873 | return "error"; |
| 874 | 874 | } |
| 875 | 875 | } |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | |
| 883 | 883 | $sth = $this->db->prepare($query); |
| 884 | 884 | $sth->execute(); |
| 885 | - } catch(PDOException $e) { |
|
| 885 | + } catch (PDOException $e) { |
|
| 886 | 886 | return "error"; |
| 887 | 887 | } |
| 888 | 888 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -930,13 +930,13 @@ discard block |
||
| 930 | 930 | public function deleteLiveSpotterDataByIdent($ident) |
| 931 | 931 | { |
| 932 | 932 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 933 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 933 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 934 | 934 | |
| 935 | 935 | try { |
| 936 | 936 | |
| 937 | 937 | $sth = $this->db->prepare($query); |
| 938 | 938 | $sth->execute(array(':ident' => $ident)); |
| 939 | - } catch(PDOException $e) { |
|
| 939 | + } catch (PDOException $e) { |
|
| 940 | 940 | return "error"; |
| 941 | 941 | } |
| 942 | 942 | |
@@ -952,13 +952,13 @@ discard block |
||
| 952 | 952 | public function deleteLiveSpotterDataById($id) |
| 953 | 953 | { |
| 954 | 954 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 955 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 955 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 956 | 956 | |
| 957 | 957 | try { |
| 958 | 958 | |
| 959 | 959 | $sth = $this->db->prepare($query); |
| 960 | 960 | $sth->execute(array(':id' => $id)); |
| 961 | - } catch(PDOException $e) { |
|
| 961 | + } catch (PDOException $e) { |
|
| 962 | 962 | return "error"; |
| 963 | 963 | } |
| 964 | 964 | |
@@ -976,13 +976,13 @@ discard block |
||
| 976 | 976 | { |
| 977 | 977 | global $globalDBdriver, $globalTimezone; |
| 978 | 978 | if ($globalDBdriver == 'mysql') { |
| 979 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 979 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 980 | 980 | WHERE spotter_live.ident = :ident |
| 981 | 981 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 982 | 982 | AND spotter_live.date < UTC_TIMESTAMP()'; |
| 983 | 983 | $query_data = array(':ident' => $ident); |
| 984 | 984 | } else { |
| 985 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 985 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 986 | 986 | WHERE spotter_live.ident = :ident |
| 987 | 987 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 988 | 988 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -991,8 +991,8 @@ discard block |
||
| 991 | 991 | |
| 992 | 992 | $sth = $this->db->prepare($query); |
| 993 | 993 | $sth->execute($query_data); |
| 994 | - $ident_result=''; |
|
| 995 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 994 | + $ident_result = ''; |
|
| 995 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 996 | 996 | { |
| 997 | 997 | $ident_result = $row['ident']; |
| 998 | 998 | } |
@@ -1009,13 +1009,13 @@ discard block |
||
| 1009 | 1009 | { |
| 1010 | 1010 | global $globalDBdriver, $globalTimezone; |
| 1011 | 1011 | if ($globalDBdriver == 'mysql') { |
| 1012 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1012 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1013 | 1013 | WHERE spotter_live.ident = :ident |
| 1014 | 1014 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
| 1015 | 1015 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1016 | 1016 | $query_data = array(':ident' => $ident); |
| 1017 | 1017 | } else { |
| 1018 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1018 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1019 | 1019 | WHERE spotter_live.ident = :ident |
| 1020 | 1020 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'"; |
| 1021 | 1021 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -1024,8 +1024,8 @@ discard block |
||
| 1024 | 1024 | |
| 1025 | 1025 | $sth = $this->db->prepare($query); |
| 1026 | 1026 | $sth->execute($query_data); |
| 1027 | - $ident_result=''; |
|
| 1028 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1027 | + $ident_result = ''; |
|
| 1028 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1029 | 1029 | { |
| 1030 | 1030 | $ident_result = $row['flightaware_id']; |
| 1031 | 1031 | } |
@@ -1042,13 +1042,13 @@ discard block |
||
| 1042 | 1042 | { |
| 1043 | 1043 | global $globalDBdriver, $globalTimezone; |
| 1044 | 1044 | if ($globalDBdriver == 'mysql') { |
| 1045 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1045 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1046 | 1046 | WHERE spotter_live.flightaware_id = :id |
| 1047 | 1047 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 1048 | 1048 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1049 | 1049 | $query_data = array(':id' => $id); |
| 1050 | 1050 | } else { |
| 1051 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1051 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1052 | 1052 | WHERE spotter_live.flightaware_id = :id |
| 1053 | 1053 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 1054 | 1054 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -1057,8 +1057,8 @@ discard block |
||
| 1057 | 1057 | |
| 1058 | 1058 | $sth = $this->db->prepare($query); |
| 1059 | 1059 | $sth->execute($query_data); |
| 1060 | - $ident_result=''; |
|
| 1061 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1060 | + $ident_result = ''; |
|
| 1061 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1062 | 1062 | { |
| 1063 | 1063 | $ident_result = $row['flightaware_id']; |
| 1064 | 1064 | } |
@@ -1075,13 +1075,13 @@ discard block |
||
| 1075 | 1075 | { |
| 1076 | 1076 | global $globalDBdriver, $globalTimezone; |
| 1077 | 1077 | if ($globalDBdriver == 'mysql') { |
| 1078 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1078 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1079 | 1079 | WHERE spotter_live.ModeS = :modes |
| 1080 | 1080 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
| 1081 | 1081 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1082 | 1082 | $query_data = array(':modes' => $modes); |
| 1083 | 1083 | } else { |
| 1084 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1084 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1085 | 1085 | WHERE spotter_live.ModeS = :modes |
| 1086 | 1086 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'"; |
| 1087 | 1087 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -1090,8 +1090,8 @@ discard block |
||
| 1090 | 1090 | |
| 1091 | 1091 | $sth = $this->db->prepare($query); |
| 1092 | 1092 | $sth->execute($query_data); |
| 1093 | - $ident_result=''; |
|
| 1094 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1093 | + $ident_result = ''; |
|
| 1094 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1095 | 1095 | { |
| 1096 | 1096 | //$ident_result = $row['spotter_live_id']; |
| 1097 | 1097 | $ident_result = $row['flightaware_id']; |
@@ -1116,8 +1116,8 @@ discard block |
||
| 1116 | 1116 | return array(); |
| 1117 | 1117 | } else { |
| 1118 | 1118 | $q_array = explode(" ", $q); |
| 1119 | - foreach ($q_array as $q_item){ |
|
| 1120 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 1119 | + foreach ($q_array as $q_item) { |
|
| 1120 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 1121 | 1121 | $additional_query .= " AND ("; |
| 1122 | 1122 | $additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR "; |
| 1123 | 1123 | $additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR "; |
@@ -1132,11 +1132,11 @@ discard block |
||
| 1132 | 1132 | } |
| 1133 | 1133 | } |
| 1134 | 1134 | if ($globalDBdriver == 'mysql') { |
| 1135 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1135 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1136 | 1136 | WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 1137 | 1137 | AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1138 | 1138 | } else { |
| 1139 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1139 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1140 | 1140 | WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 1141 | 1141 | AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 1142 | 1142 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | * @return String success or false |
| 1157 | 1157 | * |
| 1158 | 1158 | */ |
| 1159 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 1159 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 1160 | 1160 | { |
| 1161 | 1161 | global $globalURL, $globalArchive, $globalDebug; |
| 1162 | 1162 | $Common = new Common(); |
@@ -1256,27 +1256,27 @@ discard block |
||
| 1256 | 1256 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 1257 | 1257 | |
| 1258 | 1258 | |
| 1259 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 1260 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1261 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 1262 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1263 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1264 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1265 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1266 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 1267 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1268 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1269 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 1270 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1271 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 1272 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 1273 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 1274 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 1275 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 1276 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 1277 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 1278 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 1279 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 1259 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 1260 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1261 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 1262 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1263 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1264 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1265 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1266 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 1267 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1268 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1269 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 1270 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1271 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 1272 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 1273 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 1274 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 1275 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 1276 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 1277 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 1278 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 1279 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 1280 | 1280 | |
| 1281 | 1281 | $airline_name = ''; |
| 1282 | 1282 | $airline_icao = ''; |
@@ -1298,10 +1298,10 @@ discard block |
||
| 1298 | 1298 | $arrival_airport_country = ''; |
| 1299 | 1299 | |
| 1300 | 1300 | |
| 1301 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 1302 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 1303 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1304 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1301 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 1302 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 1303 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 1304 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 1305 | 1305 | |
| 1306 | 1306 | $query = ''; |
| 1307 | 1307 | if ($globalArchive) { |
@@ -1312,19 +1312,19 @@ discard block |
||
| 1312 | 1312 | $query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) |
| 1313 | 1313 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)'; |
| 1314 | 1314 | |
| 1315 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real); |
|
| 1315 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real); |
|
| 1316 | 1316 | try { |
| 1317 | 1317 | |
| 1318 | 1318 | $sth = $this->db->prepare($query); |
| 1319 | 1319 | $sth->execute($query_values); |
| 1320 | 1320 | $sth->closeCursor(); |
| 1321 | - } catch(PDOException $e) { |
|
| 1321 | + } catch (PDOException $e) { |
|
| 1322 | 1322 | return "error : ".$e->getMessage(); |
| 1323 | 1323 | } |
| 1324 | 1324 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1325 | 1325 | if ($globalDebug) echo '(Add to Spotter archive : '; |
| 1326 | 1326 | $SpotterArchive = new SpotterArchive($this->db); |
| 1327 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 1327 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
| 1328 | 1328 | if ($globalDebug) echo $result.')'; |
| 1329 | 1329 | } elseif ($globalDebug && $putinarchive !== true) { |
| 1330 | 1330 | echo '(Not adding to archive)'; |
@@ -1337,7 +1337,7 @@ discard block |
||
| 1337 | 1337 | |
| 1338 | 1338 | public function getOrderBy() |
| 1339 | 1339 | { |
| 1340 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 1340 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 1341 | 1341 | return $orderby; |
| 1342 | 1342 | } |
| 1343 | 1343 | |
@@ -8,7 +8,9 @@ discard block |
||
| 8 | 8 | public function __construct($dbc = null) { |
| 9 | 9 | $Connection = new Connection($dbc); |
| 10 | 10 | $this->db = $Connection->db(); |
| 11 | - if ($this->db === null) die('Error: No DB connection. (SpotterLive)'); |
|
| 11 | + if ($this->db === null) { |
|
| 12 | + die('Error: No DB connection. (SpotterLive)'); |
|
| 13 | + } |
|
| 12 | 14 | } |
| 13 | 15 | |
| 14 | 16 | |
@@ -30,7 +32,9 @@ discard block |
||
| 30 | 32 | if (isset($filter[0]['source'])) { |
| 31 | 33 | $filters = array_merge($filters,$filter); |
| 32 | 34 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 35 | + if (is_array($globalFilter)) { |
|
| 36 | + $filter = array_merge($filter,$globalFilter); |
|
| 37 | + } |
|
| 34 | 38 | $filter_query_join = ''; |
| 35 | 39 | $filter_query_where = ''; |
| 36 | 40 | foreach($filters as $flt) { |
@@ -129,8 +133,11 @@ discard block |
||
| 129 | 133 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 130 | 134 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 131 | 135 | } |
| 132 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 133 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 136 | + if ($filter_query_where == '' && $where) { |
|
| 137 | + $filter_query_where = ' WHERE'; |
|
| 138 | + } elseif ($filter_query_where != '' && $and) { |
|
| 139 | + $filter_query_where .= ' AND'; |
|
| 140 | + } |
|
| 134 | 141 | if ($filter_query_where != '') { |
| 135 | 142 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 136 | 143 | } |
@@ -171,9 +178,13 @@ discard block |
||
| 171 | 178 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 172 | 179 | } |
| 173 | 180 | } |
| 174 | - if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
| 181 | + if ($orderby_query == '') { |
|
| 182 | + $orderby_query = ' ORDER BY date DESC'; |
|
| 183 | + } |
|
| 175 | 184 | |
| 176 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 185 | + if (!isset($globalLiveInterval)) { |
|
| 186 | + $globalLiveInterval = '200'; |
|
| 187 | + } |
|
| 177 | 188 | if ($globalDBdriver == 'mysql') { |
| 178 | 189 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
| 179 | 190 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -196,7 +207,9 @@ discard block |
||
| 196 | 207 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit; |
| 197 | 208 | date_default_timezone_set('UTC'); |
| 198 | 209 | $filter_query = $this->getFilter($filter,true,true); |
| 199 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 210 | + if (!isset($globalLiveInterval)) { |
|
| 211 | + $globalLiveInterval = '200'; |
|
| 212 | + } |
|
| 200 | 213 | if ($globalDBdriver == 'mysql') { |
| 201 | 214 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 202 | 215 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
@@ -262,9 +275,15 @@ discard block |
||
| 262 | 275 | $id = filter_var($id,FILTER_SANITIZE_STRING); |
| 263 | 276 | $filter_query = $this->getFilter($filter,true,true); |
| 264 | 277 | |
| 265 | - if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
|
| 266 | - if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
|
| 267 | - if ($limit == 0 || $limit == '') $limit = $globalMap3DAircraftsLimit; |
|
| 278 | + if (!isset($globalLiveInterval) || $globalLiveInterval == '') { |
|
| 279 | + $globalLiveInterval = '200'; |
|
| 280 | + } |
|
| 281 | + if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') { |
|
| 282 | + $globalMap3DAircraftsLimit = '300'; |
|
| 283 | + } |
|
| 284 | + if ($limit == 0 || $limit == '') { |
|
| 285 | + $limit = $globalMap3DAircraftsLimit; |
|
| 286 | + } |
|
| 268 | 287 | if ($globalDBdriver == 'mysql') { |
| 269 | 288 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 270 | 289 | /* |
@@ -277,26 +296,42 @@ discard block |
||
| 277 | 296 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date"; |
| 278 | 297 | //if ($limit > 0) $query .= " LIMIT ".$limit; |
| 279 | 298 | $query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
| 280 | - if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 281 | - if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
|
| 299 | + if ($usecoord) { |
|
| 300 | + $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 301 | + } |
|
| 302 | + if ($id != '') { |
|
| 303 | + $query .= "OR spotter_archive.flightaware_id = :id "; |
|
| 304 | + } |
|
| 282 | 305 | $query .= "UNION |
| 283 | 306 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 284 | 307 | FROM spotter_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date"; |
| 285 | - if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 286 | - if ($id != '') $query .= " OR spotter_live.flightaware_id = :id"; |
|
| 308 | + if ($usecoord) { |
|
| 309 | + $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 310 | + } |
|
| 311 | + if ($id != '') { |
|
| 312 | + $query .= " OR spotter_live.flightaware_id = :id"; |
|
| 313 | + } |
|
| 287 | 314 | //if ($limit > 0) $query .= " LIMIT ".$limit; |
| 288 | 315 | $query .= ") AS spotter |
| 289 | 316 | WHERE latitude <> '0' AND longitude <> '0' |
| 290 | 317 | ORDER BY flightaware_id, date"; |
| 291 | - if ($limit > 0) $query .= " LIMIT ".$limit; |
|
| 318 | + if ($limit > 0) { |
|
| 319 | + $query .= " LIMIT ".$limit; |
|
| 320 | + } |
|
| 292 | 321 | } else { |
| 293 | 322 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 294 | 323 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
| 295 | - if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 296 | - if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
|
| 324 | + if ($usecoord) { |
|
| 325 | + $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 326 | + } |
|
| 327 | + if ($id != '') { |
|
| 328 | + $query .= "OR spotter_live.flightaware_id = :id "; |
|
| 329 | + } |
|
| 297 | 330 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 298 | 331 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 299 | - if ($limit > 0) $query .= " LIMIT ".$limit; |
|
| 332 | + if ($limit > 0) { |
|
| 333 | + $query .= " LIMIT ".$limit; |
|
| 334 | + } |
|
| 300 | 335 | } |
| 301 | 336 | } else { |
| 302 | 337 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -314,29 +349,47 @@ discard block |
||
| 314 | 349 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date"; |
| 315 | 350 | //if ($limit > 0) $query .= " ORDER BY spotter_live.date ASC LIMIT ".$limit; |
| 316 | 351 | $query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
| 317 | - if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 318 | - if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
|
| 352 | + if ($usecoord) { |
|
| 353 | + $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 354 | + } |
|
| 355 | + if ($id != '') { |
|
| 356 | + $query .= "OR spotter_archive.flightaware_id = :id "; |
|
| 357 | + } |
|
| 319 | 358 | $query .= "UNION |
| 320 | 359 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 321 | 360 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date"; |
| 322 | - if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 323 | - if ($id != '') $query .= " OR spotter_live.flightaware_id = :id"; |
|
| 361 | + if ($usecoord) { |
|
| 362 | + $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 363 | + } |
|
| 364 | + if ($id != '') { |
|
| 365 | + $query .= " OR spotter_live.flightaware_id = :id"; |
|
| 366 | + } |
|
| 324 | 367 | //if ($limit > 0) $query .= " ORDER BY date ASC LIMIT ".$limit; |
| 325 | 368 | $query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' "; |
| 326 | 369 | $query .= "ORDER BY flightaware_id, date"; |
| 327 | - if ($limit > 0) $query .= " LIMIT ".$limit; |
|
| 370 | + if ($limit > 0) { |
|
| 371 | + $query .= " LIMIT ".$limit; |
|
| 372 | + } |
|
| 328 | 373 | } else { |
| 329 | 374 | $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 330 | 375 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date "; |
| 331 | - if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 332 | - if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
|
| 376 | + if ($usecoord) { |
|
| 377 | + $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 378 | + } |
|
| 379 | + if ($id != '') { |
|
| 380 | + $query .= "OR spotter_live.flightaware_id = :id "; |
|
| 381 | + } |
|
| 333 | 382 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 334 | 383 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 335 | - if ($limit > 0) $query .= " LIMIT ".$limit; |
|
| 384 | + if ($limit > 0) { |
|
| 385 | + $query .= " LIMIT ".$limit; |
|
| 386 | + } |
|
| 336 | 387 | } |
| 337 | 388 | } |
| 338 | 389 | $query_values = array(); |
| 339 | - if ($id != '') $query_values = array(':id' => $id); |
|
| 390 | + if ($id != '') { |
|
| 391 | + $query_values = array(':id' => $id); |
|
| 392 | + } |
|
| 340 | 393 | try { |
| 341 | 394 | $sth = $this->db->prepare($query); |
| 342 | 395 | $sth->execute($query_values); |
@@ -361,9 +414,15 @@ discard block |
||
| 361 | 414 | $id = filter_var($id,FILTER_SANITIZE_STRING); |
| 362 | 415 | $filter_query = $this->getFilter($filter,true,true); |
| 363 | 416 | |
| 364 | - if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
|
| 365 | - if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
|
| 366 | - if ($limit == 0 || $limit == '') $limit = $globalMap3DAircraftsLimit; |
|
| 417 | + if (!isset($globalLiveInterval) || $globalLiveInterval == '') { |
|
| 418 | + $globalLiveInterval = '200'; |
|
| 419 | + } |
|
| 420 | + if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') { |
|
| 421 | + $globalMap3DAircraftsLimit = '300'; |
|
| 422 | + } |
|
| 423 | + if ($limit == 0 || $limit == '') { |
|
| 424 | + $limit = $globalMap3DAircraftsLimit; |
|
| 425 | + } |
|
| 367 | 426 | if ($globalDBdriver == 'mysql') { |
| 368 | 427 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 369 | 428 | $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
@@ -374,13 +433,17 @@ discard block |
||
| 374 | 433 | $query .= ") AS spotter |
| 375 | 434 | WHERE latitude <> '0' AND longitude <> '0' |
| 376 | 435 | ORDER BY flightaware_id, date"; |
| 377 | - if ($limit > 0) $query .= " LIMIT ".$limit; |
|
| 436 | + if ($limit > 0) { |
|
| 437 | + $query .= " LIMIT ".$limit; |
|
| 438 | + } |
|
| 378 | 439 | } else { |
| 379 | 440 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 380 | 441 | FROM spotter_live'.$filter_query.' spotter_live.flightaware_id = :id '; |
| 381 | 442 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 382 | 443 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 383 | - if ($limit > 0) $query .= " LIMIT ".$limit; |
|
| 444 | + if ($limit > 0) { |
|
| 445 | + $query .= " LIMIT ".$limit; |
|
| 446 | + } |
|
| 384 | 447 | } |
| 385 | 448 | } else { |
| 386 | 449 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -396,13 +459,17 @@ discard block |
||
| 396 | 459 | FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id"; |
| 397 | 460 | $query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' "; |
| 398 | 461 | $query .= "ORDER BY flightaware_id, date"; |
| 399 | - if ($limit > 0) $query .= " LIMIT ".$limit; |
|
| 462 | + if ($limit > 0) { |
|
| 463 | + $query .= " LIMIT ".$limit; |
|
| 464 | + } |
|
| 400 | 465 | } else { |
| 401 | 466 | $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 402 | 467 | FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id "; |
| 403 | 468 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 404 | 469 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 405 | - if ($limit > 0) $query .= " LIMIT ".$limit; |
|
| 470 | + if ($limit > 0) { |
|
| 471 | + $query .= " LIMIT ".$limit; |
|
| 472 | + } |
|
| 406 | 473 | } |
| 407 | 474 | } |
| 408 | 475 | $query_values = array(); |
@@ -429,7 +496,9 @@ discard block |
||
| 429 | 496 | global $globalDBdriver, $globalLiveInterval; |
| 430 | 497 | $filter_query = $this->getFilter($filter,true,true); |
| 431 | 498 | |
| 432 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 499 | + if (!isset($globalLiveInterval)) { |
|
| 500 | + $globalLiveInterval = '200'; |
|
| 501 | + } |
|
| 433 | 502 | if ($globalDBdriver == 'mysql') { |
| 434 | 503 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
| 435 | 504 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -459,7 +528,9 @@ discard block |
||
| 459 | 528 | { |
| 460 | 529 | global $globalDBdriver, $globalLiveInterval,$globalMap2DAircraftsLimit; |
| 461 | 530 | $Spotter = new Spotter($this->db); |
| 462 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 531 | + if (!isset($globalLiveInterval)) { |
|
| 532 | + $globalLiveInterval = '200'; |
|
| 533 | + } |
|
| 463 | 534 | $filter_query = $this->getFilter($filter); |
| 464 | 535 | |
| 465 | 536 | if (is_array($coord)) { |
@@ -467,7 +538,9 @@ discard block |
||
| 467 | 538 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 468 | 539 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 469 | 540 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 470 | - } else return array(); |
|
| 541 | + } else { |
|
| 542 | + return array(); |
|
| 543 | + } |
|
| 471 | 544 | if ($globalDBdriver == 'mysql') { |
| 472 | 545 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
| 473 | 546 | } else { |
@@ -491,7 +564,9 @@ discard block |
||
| 491 | 564 | { |
| 492 | 565 | global $globalDBdriver, $globalLiveInterval, $globalArchive,$globalMap2DAircraftsLimit; |
| 493 | 566 | $Spotter = new Spotter($this->db); |
| 494 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 567 | + if (!isset($globalLiveInterval)) { |
|
| 568 | + $globalLiveInterval = '200'; |
|
| 569 | + } |
|
| 495 | 570 | $filter_query = $this->getFilter($filter,true,true); |
| 496 | 571 | |
| 497 | 572 | if (is_array($coord)) { |
@@ -499,7 +574,9 @@ discard block |
||
| 499 | 574 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 500 | 575 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 501 | 576 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 502 | - } else return array(); |
|
| 577 | + } else { |
|
| 578 | + return array(); |
|
| 579 | + } |
|
| 503 | 580 | if ($globalDBdriver == 'mysql') { |
| 504 | 581 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 505 | 582 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
@@ -752,11 +829,15 @@ discard block |
||
| 752 | 829 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
| 753 | 830 | if ($globalDBdriver == 'mysql') { |
| 754 | 831 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 755 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 832 | + if ($liveinterval) { |
|
| 833 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 834 | + } |
|
| 756 | 835 | $query .= ' ORDER BY date'; |
| 757 | 836 | } else { |
| 758 | 837 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 759 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 838 | + if ($liveinterval) { |
|
| 839 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 840 | + } |
|
| 760 | 841 | $query .= ' ORDER BY date'; |
| 761 | 842 | } |
| 762 | 843 | |
@@ -851,7 +932,9 @@ discard block |
||
| 851 | 932 | $i++; |
| 852 | 933 | $j++; |
| 853 | 934 | if ($j == 30) { |
| 854 | - if ($globalDebug) echo "."; |
|
| 935 | + if ($globalDebug) { |
|
| 936 | + echo "."; |
|
| 937 | + } |
|
| 855 | 938 | try { |
| 856 | 939 | |
| 857 | 940 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -1204,7 +1287,9 @@ discard block |
||
| 1204 | 1287 | { |
| 1205 | 1288 | return false; |
| 1206 | 1289 | } |
| 1207 | - } else return ''; |
|
| 1290 | + } else { |
|
| 1291 | + return ''; |
|
| 1292 | + } |
|
| 1208 | 1293 | |
| 1209 | 1294 | if ($longitude != '') |
| 1210 | 1295 | { |
@@ -1212,7 +1297,9 @@ discard block |
||
| 1212 | 1297 | { |
| 1213 | 1298 | return false; |
| 1214 | 1299 | } |
| 1215 | - } else return ''; |
|
| 1300 | + } else { |
|
| 1301 | + return ''; |
|
| 1302 | + } |
|
| 1216 | 1303 | |
| 1217 | 1304 | if ($waypoints != '') |
| 1218 | 1305 | { |
@@ -1228,14 +1315,18 @@ discard block |
||
| 1228 | 1315 | { |
| 1229 | 1316 | return false; |
| 1230 | 1317 | } |
| 1231 | - } else $altitude = 0; |
|
| 1318 | + } else { |
|
| 1319 | + $altitude = 0; |
|
| 1320 | + } |
|
| 1232 | 1321 | if ($altitude_real != '') |
| 1233 | 1322 | { |
| 1234 | 1323 | if (!is_numeric($altitude_real)) |
| 1235 | 1324 | { |
| 1236 | 1325 | return false; |
| 1237 | 1326 | } |
| 1238 | - } else $altitude_real = 0; |
|
| 1327 | + } else { |
|
| 1328 | + $altitude_real = 0; |
|
| 1329 | + } |
|
| 1239 | 1330 | |
| 1240 | 1331 | if ($heading != '') |
| 1241 | 1332 | { |
@@ -1243,7 +1334,9 @@ discard block |
||
| 1243 | 1334 | { |
| 1244 | 1335 | return false; |
| 1245 | 1336 | } |
| 1246 | - } else $heading = 0; |
|
| 1337 | + } else { |
|
| 1338 | + $heading = 0; |
|
| 1339 | + } |
|
| 1247 | 1340 | |
| 1248 | 1341 | if ($groundspeed != '') |
| 1249 | 1342 | { |
@@ -1251,9 +1344,13 @@ discard block |
||
| 1251 | 1344 | { |
| 1252 | 1345 | return false; |
| 1253 | 1346 | } |
| 1254 | - } else $groundspeed = 0; |
|
| 1347 | + } else { |
|
| 1348 | + $groundspeed = 0; |
|
| 1349 | + } |
|
| 1255 | 1350 | date_default_timezone_set('UTC'); |
| 1256 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 1351 | + if ($date == '') { |
|
| 1352 | + $date = date("Y-m-d H:i:s", time()); |
|
| 1353 | + } |
|
| 1257 | 1354 | |
| 1258 | 1355 | |
| 1259 | 1356 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -1298,14 +1395,24 @@ discard block |
||
| 1298 | 1395 | $arrival_airport_country = ''; |
| 1299 | 1396 | |
| 1300 | 1397 | |
| 1301 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 1302 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 1303 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1304 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1398 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
| 1399 | + $squawk = NULL; |
|
| 1400 | + } |
|
| 1401 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
| 1402 | + $verticalrate = NULL; |
|
| 1403 | + } |
|
| 1404 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 1405 | + $groundspeed = 0; |
|
| 1406 | + } |
|
| 1407 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1408 | + $heading = 0; |
|
| 1409 | + } |
|
| 1305 | 1410 | |
| 1306 | 1411 | $query = ''; |
| 1307 | 1412 | if ($globalArchive) { |
| 1308 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 1413 | + if ($globalDebug) { |
|
| 1414 | + echo '-- Delete previous data -- '; |
|
| 1415 | + } |
|
| 1309 | 1416 | $query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;'; |
| 1310 | 1417 | } |
| 1311 | 1418 | |
@@ -1322,10 +1429,14 @@ discard block |
||
| 1322 | 1429 | return "error : ".$e->getMessage(); |
| 1323 | 1430 | } |
| 1324 | 1431 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1325 | - if ($globalDebug) echo '(Add to Spotter archive : '; |
|
| 1432 | + if ($globalDebug) { |
|
| 1433 | + echo '(Add to Spotter archive : '; |
|
| 1434 | + } |
|
| 1326 | 1435 | $SpotterArchive = new SpotterArchive($this->db); |
| 1327 | 1436 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
| 1328 | - if ($globalDebug) echo $result.')'; |
|
| 1437 | + if ($globalDebug) { |
|
| 1438 | + echo $result.')'; |
|
| 1439 | + } |
|
| 1329 | 1440 | } elseif ($globalDebug && $putinarchive !== true) { |
| 1330 | 1441 | echo '(Not adding to archive)'; |
| 1331 | 1442 | } elseif ($globalDebug && $noarchive === true) { |
@@ -3,7 +3,7 @@ |
||
| 3 | 3 | </span> |
| 4 | 4 | <div class="sub-menu sub-menu-container"> |
| 5 | 5 | <ul class="nav nav-pills"> |
| 6 | - <li><a href="<?php print $globalURL; ?>/flightid/<?php print $id; ?>" <?php if (strtolower($current_page) == "flightid-overview"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 6 | + <li><a href="<?php print $globalURL; ?>/flightid/<?php print $id; ?>" <?php if (strtolower($current_page) == "flightid-overview") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 7 | 7 | <?php if ($globalFlightAware) { ?> |
| 8 | 8 | <li><a href="http://flightaware.com/live/flight/id/<?php print $spotter_array[0]['flightaware_id']; ?>" target="_blank"><?php echo _("Flight Status"); ?>»</a></li> |
| 9 | 9 | <li><a href="http://flightaware.com/live/flight/id/<?php print $spotter_array[0]['flightaware_id']; ?>/tracklog" target="_blank"><?php echo _("Flight Log"); ?>»</a></li> |
@@ -3,10 +3,10 @@ discard block |
||
| 3 | 3 | </span> |
| 4 | 4 | <div class="sub-menu sub-menu-container"> |
| 5 | 5 | <ul class="nav nav-pills"> |
| 6 | - <li><a href="<?php print $globalURL; ?>/aircraft/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 7 | - <li><a href="<?php print $globalURL; ?>/aircraft/statistics/registration/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-registration"){ print 'class="active"'; } ?>><?php echo _("Registration"); ?></a></li> |
|
| 6 | + <li><a href="<?php print $globalURL; ?>/aircraft/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 7 | + <li><a href="<?php print $globalURL; ?>/aircraft/statistics/registration/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-registration") { print 'class="active"'; } ?>><?php echo _("Registration"); ?></a></li> |
|
| 8 | 8 | <li class="dropdown"> |
| 9 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "aircraft-statistics-airline" || strtolower($current_page) == "aircraft-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 9 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "aircraft-statistics-airline" || strtolower($current_page) == "aircraft-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 10 | 10 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 11 | 11 | </a> |
| 12 | 12 | <ul class="dropdown-menu" role="menu"> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | </ul> |
| 16 | 16 | </li> |
| 17 | 17 | <li class="dropdown"> |
| 18 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "aircraft-statistics-departure-airport" || strtolower($current_page) == "aircraft-statistics-departure-airport-country" || strtolower($current_page) == "aircraft-statistics-arrival-airport" || strtolower($current_page) == "aircraft-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 18 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "aircraft-statistics-departure-airport" || strtolower($current_page) == "aircraft-statistics-departure-airport-country" || strtolower($current_page) == "aircraft-statistics-arrival-airport" || strtolower($current_page) == "aircraft-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 19 | 19 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 20 | 20 | </a> |
| 21 | 21 | <ul class="dropdown-menu" role="menu"> |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | <li><a href="<?php print $globalURL; ?>/aircraft/statistics/arrival-airport-country/<?php print $aircraft_type; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
| 26 | 26 | </ul> |
| 27 | 27 | </li> |
| 28 | - <li><a href="<?php print $globalURL; ?>/aircraft/statistics/route/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 29 | - <li><a href="<?php print $globalURL; ?>/aircraft/statistics/time/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-time"){ print 'class="active"'; } ?>><?php echo ("Time"); ?></a></li> |
|
| 28 | + <li><a href="<?php print $globalURL; ?>/aircraft/statistics/route/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 29 | + <li><a href="<?php print $globalURL; ?>/aircraft/statistics/time/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-time") { print 'class="active"'; } ?>><?php echo ("Time"); ?></a></li> |
|
| 30 | 30 | </ul> |
| 31 | 31 | </div> |
| 32 | 32 | \ No newline at end of file |
@@ -9,16 +9,16 @@ discard block |
||
| 9 | 9 | require_once('require/class.Language.php'); |
| 10 | 10 | |
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 13 | -$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
| 14 | -$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
| 12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 13 | +$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
| 14 | +$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
| 15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
| 16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
| 17 | 17 | } else $spotter_array = array(); |
| 18 | 18 | |
| 19 | 19 | if (!empty($spotter_array)) |
| 20 | 20 | { |
| 21 | - $title = sprintf(_("Most Common Aircraft Manufacturer between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
| 21 | + $title = sprintf(_("Most Common Aircraft Manufacturer between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
| 22 | 22 | require_once('header.php'); |
| 23 | 23 | print '<div class="info column">'; |
| 24 | 24 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | include('route-sub-menu.php'); |
| 30 | 30 | print '<div class="column">'; |
| 31 | 31 | print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>'; |
| 32 | - print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>'; |
|
| 32 | + print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>'; |
|
| 33 | 33 | |
| 34 | 34 | $manufacturers_array = $Spotter->countAllAircraftManufacturerByRoute($departure_airport, $arrival_airport); |
| 35 | 35 | if (!empty($manufacturers_array)) |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | print '</thead>'; |
| 45 | 45 | print '<tbody>'; |
| 46 | 46 | $i = 1; |
| 47 | - foreach($manufacturers_array as $manufacturer_item) |
|
| 47 | + foreach ($manufacturers_array as $manufacturer_item) |
|
| 48 | 48 | { |
| 49 | 49 | print '<tr>'; |
| 50 | 50 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -14,7 +14,9 @@ |
||
| 14 | 14 | $arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
| 15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
| 16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
| 17 | -} else $spotter_array = array(); |
|
| 17 | +} else { |
|
| 18 | + $spotter_array = array(); |
|
| 19 | +} |
|
| 18 | 20 | |
| 19 | 21 | if (!empty($spotter_array)) |
| 20 | 22 | { |
@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | </span> |
| 4 | 4 | <div class="sub-menu sub-menu-container"> |
| 5 | 5 | <ul class="nav nav-pills"> |
| 6 | - <li><a href="<?php print $globalURL; ?>/pilot/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 6 | + <li><a href="<?php print $globalURL; ?>/pilot/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 7 | 7 | <li class="dropdown"> |
| 8 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 8 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 9 | 9 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 10 | 10 | </a> |
| 11 | 11 | <ul class="dropdown-menu" role="menu"> |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | </ul> |
| 16 | 16 | </li> |
| 17 | 17 | <li class="dropdown"> |
| 18 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-departure-airport" || strtolower($current_page) == "pilot-statistics-departure-airport-country" || strtolower($current_page) == "pilot-statistics-arrival-airport" || strtolower($current_page) == "pilot-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 18 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "pilot-statistics-departure-airport" || strtolower($current_page) == "pilot-statistics-departure-airport-country" || strtolower($current_page) == "pilot-statistics-arrival-airport" || strtolower($current_page) == "pilot-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 19 | 19 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 20 | 20 | </a> |
| 21 | 21 | <ul class="dropdown-menu" role="menu"> |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
| 26 | 26 | </ul> |
| 27 | 27 | </li> |
| 28 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 29 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 28 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 29 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 30 | 30 | </ul> |
| 31 | 31 | </div> |
| 32 | 32 | \ No newline at end of file |
@@ -3,15 +3,39 @@ discard block |
||
| 3 | 3 | </span> |
| 4 | 4 | <div class="sub-menu sub-menu-container"> |
| 5 | 5 | <ul class="nav nav-pills"> |
| 6 | - <li><a href="<?php print $globalURL; ?>/pilot/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 6 | + <li><a href="<?php print $globalURL; ?>/pilot/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
| 7 | + echo '/'.$year; |
|
| 8 | +} |
|
| 9 | +?><?php if (isset($month) && $month != '') { |
|
| 10 | + echo '/'.$month; |
|
| 11 | +} |
|
| 12 | +?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
| 7 | 13 | <li class="dropdown"> |
| 8 | 14 | <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
| 9 | 15 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 10 | 16 | </a> |
| 11 | 17 | <ul class="dropdown-menu" role="menu"> |
| 12 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/aircraft/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Aircraft Type"); ?></a></li> |
|
| 13 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/registration/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Registration"); ?></a></li> |
|
| 14 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/manufacturer/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
| 18 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/aircraft/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
| 19 | + echo '/'.$year; |
|
| 20 | +} |
|
| 21 | +?><?php if (isset($month) && $month != '') { |
|
| 22 | + echo '/'.$month; |
|
| 23 | +} |
|
| 24 | +?>"><?php echo _("Aircraft Type"); ?></a></li> |
|
| 25 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/registration/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
| 26 | + echo '/'.$year; |
|
| 27 | +} |
|
| 28 | +?><?php if (isset($month) && $month != '') { |
|
| 29 | + echo '/'.$month; |
|
| 30 | +} |
|
| 31 | +?>"><?php echo _("Registration"); ?></a></li> |
|
| 32 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/manufacturer/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
| 33 | + echo '/'.$year; |
|
| 34 | +} |
|
| 35 | +?><?php if (isset($month) && $month != '') { |
|
| 36 | + echo '/'.$month; |
|
| 37 | +} |
|
| 38 | +?>"><?php echo _("Manufacturer"); ?></a></li> |
|
| 15 | 39 | </ul> |
| 16 | 40 | </li> |
| 17 | 41 | <li class="dropdown"> |
@@ -19,13 +43,49 @@ discard block |
||
| 19 | 43 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 20 | 44 | </a> |
| 21 | 45 | <ul class="dropdown-menu" role="menu"> |
| 22 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
| 23 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport-country/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
| 24 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
| 25 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
| 46 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
| 47 | + echo '/'.$year; |
|
| 48 | +} |
|
| 49 | +?><?php if (isset($month) && $month != '') { |
|
| 50 | + echo '/'.$month; |
|
| 51 | +} |
|
| 52 | +?>"><?php echo _("Departure Airport"); ?></a></li> |
|
| 53 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport-country/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
| 54 | + echo '/'.$year; |
|
| 55 | +} |
|
| 56 | +?><?php if (isset($month) && $month != '') { |
|
| 57 | + echo '/'.$month; |
|
| 58 | +} |
|
| 59 | +?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
| 60 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
| 61 | + echo '/'.$year; |
|
| 62 | +} |
|
| 63 | +?><?php if (isset($month) && $month != '') { |
|
| 64 | + echo '/'.$month; |
|
| 65 | +} |
|
| 66 | +?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
| 67 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
| 68 | + echo '/'.$year; |
|
| 69 | +} |
|
| 70 | +?><?php if (isset($month) && $month != '') { |
|
| 71 | + echo '/'.$month; |
|
| 72 | +} |
|
| 73 | +?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
| 26 | 74 | </ul> |
| 27 | 75 | </li> |
| 28 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 29 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 76 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
| 77 | + echo '/'.$year; |
|
| 78 | +} |
|
| 79 | +?><?php if (isset($month) && $month != '') { |
|
| 80 | + echo '/'.$month; |
|
| 81 | +} |
|
| 82 | +?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
| 83 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
| 84 | + echo '/'.$year; |
|
| 85 | +} |
|
| 86 | +?><?php if (isset($month) && $month != '') { |
|
| 87 | + echo '/'.$month; |
|
| 88 | +} |
|
| 89 | +?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
| 30 | 90 | </ul> |
| 31 | 91 | </div> |
| 32 | 92 | \ No newline at end of file |
@@ -9,16 +9,16 @@ discard block |
||
| 9 | 9 | require_once('require/class.Language.php'); |
| 10 | 10 | |
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 13 | -$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
| 14 | -$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
| 12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 13 | +$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
| 14 | +$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
| 15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
| 16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
| 17 | 17 | } else $spotter_array = array(); |
| 18 | 18 | |
| 19 | 19 | if (!empty($spotter_array)) |
| 20 | 20 | { |
| 21 | - $title = sprintf(_("Most Common Aircraft by Registration between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
| 21 | + $title = sprintf(_("Most Common Aircraft by Registration between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
| 22 | 22 | require_once('header.php'); |
| 23 | 23 | print '<div class="info column">'; |
| 24 | 24 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | include('route-sub-menu.php'); |
| 30 | 30 | print '<div class="column">'; |
| 31 | 31 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
| 32 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>'; |
|
| 32 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>'; |
|
| 33 | 33 | |
| 34 | 34 | $aircraft_array = $Spotter->countAllAircraftRegistrationByRoute($departure_airport, $arrival_airport); |
| 35 | 35 | if (!empty($aircraft_array)) |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | print '</thead>'; |
| 47 | 47 | print '<tbody>'; |
| 48 | 48 | $i = 1; |
| 49 | - foreach($aircraft_array as $aircraft_item) |
|
| 49 | + foreach ($aircraft_array as $aircraft_item) |
|
| 50 | 50 | { |
| 51 | 51 | print '<tr>'; |
| 52 | 52 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -14,7 +14,9 @@ |
||
| 14 | 14 | $arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
| 15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
| 16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
| 17 | -} else $spotter_array = array(); |
|
| 17 | +} else { |
|
| 18 | + $spotter_array = array(); |
|
| 19 | +} |
|
| 18 | 20 | |
| 19 | 21 | if (!empty($spotter_array)) |
| 20 | 22 | { |