@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | if (!isset($filter_name)) $filter_name = ''; |
| 20 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 20 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 21 | 21 | if ($airline_icao == '' && isset($globalFilter)) { |
| 22 | 22 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 23 | 23 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | </div> |
| 34 | 34 | <p>'._("Below is a chart that plots the busiest day during the <strong>last 7 days</strong>.").'</p>'; |
| 35 | 35 | |
| 36 | -if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
| 36 | +if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
| 37 | 37 | elseif ($type == 'marine') $date_array = $Marine->countAllDatesLast7Days(); |
| 38 | 38 | elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLast7Days(); |
| 39 | 39 | if (count($date_array) == 0) { |
@@ -42,13 +42,13 @@ discard block |
||
| 42 | 42 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 43 | 43 | $date_data = ''; |
| 44 | 44 | $date_cnt = ''; |
| 45 | -foreach($date_array as $date_item) |
|
| 45 | +foreach ($date_array as $date_item) |
|
| 46 | 46 | { |
| 47 | 47 | $date_data .= '"'.$date_item['date_name'].'",'; |
| 48 | 48 | $date_cnt .= $date_item['date_count'].','; |
| 49 | 49 | } |
| 50 | 50 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
| 51 | -$date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
| 51 | +$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
| 52 | 52 | print 'c3.generate({ |
| 53 | 53 | bindto: "#chart", |
| 54 | 54 | data: { x: "x", |
@@ -57,11 +57,11 @@ discard block |
||
| 57 | 57 | print '</script>'; |
| 58 | 58 | } |
| 59 | 59 | if (isset($globalDBArchiveMonths) && $globalDBArchiveMonths > 0) { |
| 60 | - print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."),$globalDBArchiveMonths).'</p>'; |
|
| 60 | + print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."), $globalDBArchiveMonths).'</p>'; |
|
| 61 | 61 | } else { |
| 62 | 62 | print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>'; |
| 63 | 63 | } |
| 64 | -if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao,$filter_name); |
|
| 64 | +if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao, $filter_name); |
|
| 65 | 65 | elseif ($type == 'marine') $date_array = $Marine->countAllDates(); |
| 66 | 66 | elseif ($type == 'tracker') $date_array = $Tracker->countAllDates(); |
| 67 | 67 | if (!empty($date_array)) |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | print '</thead>'; |
| 76 | 76 | print '<tbody>'; |
| 77 | 77 | $i = 1; |
| 78 | - foreach($date_array as $date_item) |
|
| 78 | + foreach ($date_array as $date_item) |
|
| 79 | 79 | { |
| 80 | 80 | print '<tr>'; |
| 81 | 81 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -16,11 +16,15 @@ discard block |
||
| 16 | 16 | $Tracker = new Tracker(); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 19 | +if (!isset($filter_name)) { |
|
| 20 | + $filter_name = ''; |
|
| 21 | +} |
|
| 20 | 22 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 21 | 23 | if ($airline_icao == '' && isset($globalFilter)) { |
| 22 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 23 | -} |
|
| 24 | + if (isset($globalFilter['airline'])) { |
|
| 25 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 26 | + } |
|
| 27 | + } |
|
| 24 | 28 | |
| 25 | 29 | require_once('header.php'); |
| 26 | 30 | 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 day during the <strong>last 7 days</strong>.").'</p>'; |
| 35 | 39 | |
| 36 | -if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
| 37 | -elseif ($type == 'marine') $date_array = $Marine->countAllDatesLast7Days(); |
|
| 38 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLast7Days(); |
|
| 40 | +if ($type == 'aircraft') { |
|
| 41 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
| 42 | +} elseif ($type == 'marine') { |
|
| 43 | + $date_array = $Marine->countAllDatesLast7Days(); |
|
| 44 | +} elseif ($type == 'tracker') { |
|
| 45 | + $date_array = $Tracker->countAllDatesLast7Days(); |
|
| 46 | +} |
|
| 39 | 47 | if (count($date_array) == 0) { |
| 40 | 48 | print _("No data available"); |
| 41 | 49 | } else { |
@@ -61,9 +69,13 @@ discard block |
||
| 61 | 69 | } else { |
| 62 | 70 | print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>'; |
| 63 | 71 | } |
| 64 | -if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao,$filter_name); |
|
| 65 | -elseif ($type == 'marine') $date_array = $Marine->countAllDates(); |
|
| 66 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllDates(); |
|
| 72 | +if ($type == 'aircraft') { |
|
| 73 | + $date_array = $Stats->countAllDates($airline_icao,$filter_name); |
|
| 74 | +} elseif ($type == 'marine') { |
|
| 75 | + $date_array = $Marine->countAllDates(); |
|
| 76 | +} elseif ($type == 'tracker') { |
|
| 77 | + $date_array = $Tracker->countAllDates(); |
|
| 78 | +} |
|
| 67 | 79 | if (!empty($date_array)) |
| 68 | 80 | { |
| 69 | 81 | print '<div class="table-responsive">'; |
@@ -15,11 +15,15 @@ discard block |
||
| 15 | 15 | require_once('require/class.Tracker.php'); |
| 16 | 16 | $Tracker = new Tracker(); |
| 17 | 17 | } |
| 18 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 18 | +if (!isset($filter_name)) { |
|
| 19 | + $filter_name = ''; |
|
| 20 | +} |
|
| 19 | 21 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 20 | 22 | if ($airline_icao == '' && isset($globalFilter)) { |
| 21 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 22 | -} |
|
| 23 | + if (isset($globalFilter['airline'])) { |
|
| 24 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 25 | + } |
|
| 26 | + } |
|
| 23 | 27 | |
| 24 | 28 | require_once('header.php'); |
| 25 | 29 | include('statistics-sub-menu.php'); |
@@ -32,9 +36,13 @@ discard block |
||
| 32 | 36 | </div> |
| 33 | 37 | <p>'._("Below is a chart that plots the busiest day during the <strong>last month</strong>.").'</p>'; |
| 34 | 38 | |
| 35 | -if ($type == 'aircraft') $date_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
| 36 | -elseif ($type == 'marine') $date_array = $Marine->countAllDatesLastMonth(); |
|
| 37 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLastMonth(); |
|
| 39 | +if ($type == 'aircraft') { |
|
| 40 | + $date_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
| 41 | +} elseif ($type == 'marine') { |
|
| 42 | + $date_array = $Marine->countAllDatesLastMonth(); |
|
| 43 | +} elseif ($type == 'tracker') { |
|
| 44 | + $date_array = $Tracker->countAllDatesLastMonth(); |
|
| 45 | +} |
|
| 38 | 46 | |
| 39 | 47 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 40 | 48 | $month_data = ''; |
@@ -75,8 +83,11 @@ discard block |
||
| 75 | 83 | print '<tr>'; |
| 76 | 84 | print '<td><strong>'.$i.'</strong></td>'; |
| 77 | 85 | print '<td>'; |
| 78 | - if ($type == 'aircraft') print '<a href="'.$globalURL.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
| 79 | - else print '<a href="'.$globalURL.'/'.$type.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
| 86 | + if ($type == 'aircraft') { |
|
| 87 | + print '<a href="'.$globalURL.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
| 88 | + } else { |
|
| 89 | + print '<a href="'.$globalURL.'/'.$type.'/date/'.date('Y-m-d',strtotime($date_item['date_name'])).'">'.date("l F j, Y", strtotime($date_item['date_name'])).'</a>'; |
|
| 90 | + } |
|
| 80 | 91 | print '</td>'; |
| 81 | 92 | print '<td>'; |
| 82 | 93 | print $date_item['date_count']; |
@@ -79,23 +79,23 @@ discard block |
||
| 79 | 79 | <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
| 80 | 80 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 81 | 81 | <?php |
| 82 | - if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
| 82 | + if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
| 83 | 83 | ?> |
| 84 | 84 | <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
| 85 | 85 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 86 | 86 | <?php |
| 87 | - } else { |
|
| 88 | - ?> |
|
| 87 | + } else { |
|
| 88 | + ?> |
|
| 89 | 89 | <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
| 90 | 90 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 91 | 91 | <?php |
| 92 | - } |
|
| 93 | - ?> |
|
| 92 | + } |
|
| 93 | + ?> |
|
| 94 | 94 | <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
| 95 | 95 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 96 | 96 | <?php |
| 97 | - if ($airline_icao == '') { |
|
| 98 | - ?> |
|
| 97 | + if ($airline_icao == '') { |
|
| 98 | + ?> |
|
| 99 | 99 | <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
| 100 | 100 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
| 101 | 101 | <?php |
@@ -138,38 +138,38 @@ discard block |
||
| 138 | 138 | <div class="col-md-6"> |
| 139 | 139 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
| 140 | 140 | <?php |
| 141 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
| 142 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
| 143 | - else { |
|
| 144 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
| 145 | - $aircraft_data = ''; |
|
| 146 | - foreach($aircraft_array as $aircraft_item) |
|
| 147 | - { |
|
| 148 | - $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 149 | - } |
|
| 150 | - $aircraft_data = substr($aircraft_data, 0, -1); |
|
| 151 | - print 'var series = ['.$aircraft_data.'];'; |
|
| 152 | - print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
| 153 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
| 154 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
| 155 | - print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
| 156 | - print 'dataset'; |
|
| 157 | - print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
| 158 | - print '</script>'; |
|
| 159 | - } |
|
| 160 | - ?> |
|
| 141 | + $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
| 142 | + if (count($aircraft_array) == 0) print _("No data available"); |
|
| 143 | + else { |
|
| 144 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
| 145 | + $aircraft_data = ''; |
|
| 146 | + foreach($aircraft_array as $aircraft_item) |
|
| 147 | + { |
|
| 148 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
| 149 | + } |
|
| 150 | + $aircraft_data = substr($aircraft_data, 0, -1); |
|
| 151 | + print 'var series = ['.$aircraft_data.'];'; |
|
| 152 | + print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
| 153 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
| 154 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
| 155 | + print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
| 156 | + print 'dataset'; |
|
| 157 | + print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
| 158 | + print '</script>'; |
|
| 159 | + } |
|
| 160 | + ?> |
|
| 161 | 161 | <div class="more"> |
| 162 | 162 | <?php |
| 163 | - if ($year != '' && $month != '') { |
|
| 164 | - ?> |
|
| 163 | + if ($year != '' && $month != '') { |
|
| 164 | + ?> |
|
| 165 | 165 | <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 166 | 166 | <?php |
| 167 | - } else { |
|
| 168 | - ?> |
|
| 167 | + } else { |
|
| 168 | + ?> |
|
| 169 | 169 | <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 170 | 170 | <?php |
| 171 | - } |
|
| 172 | - ?> |
|
| 171 | + } |
|
| 172 | + ?> |
|
| 173 | 173 | </div> |
| 174 | 174 | </div> |
| 175 | 175 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -222,29 +222,29 @@ discard block |
||
| 222 | 222 | <div class="col-md-6"> |
| 223 | 223 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
| 224 | 224 | <?php |
| 225 | - $marine_array = $Marine->countAllMarineTypes(); |
|
| 226 | - if (count($marine_array) == 0) print _("No data available"); |
|
| 227 | - else { |
|
| 228 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
| 229 | - $marine_data = ''; |
|
| 230 | - foreach($marine_array as $marine_item) |
|
| 231 | - { |
|
| 232 | - $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
|
| 233 | - } |
|
| 234 | - $marine_data = substr($marine_data, 0, -1); |
|
| 235 | - print 'var series = ['.$marine_data.'];'; |
|
| 236 | - print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
| 237 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
| 238 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
| 239 | - print 'var marinetype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
| 240 | - print 'dataset'; |
|
| 241 | - print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
| 242 | - print '</script>'; |
|
| 243 | - } |
|
| 244 | - ?> |
|
| 225 | + $marine_array = $Marine->countAllMarineTypes(); |
|
| 226 | + if (count($marine_array) == 0) print _("No data available"); |
|
| 227 | + else { |
|
| 228 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
| 229 | + $marine_data = ''; |
|
| 230 | + foreach($marine_array as $marine_item) |
|
| 231 | + { |
|
| 232 | + $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
|
| 233 | + } |
|
| 234 | + $marine_data = substr($marine_data, 0, -1); |
|
| 235 | + print 'var series = ['.$marine_data.'];'; |
|
| 236 | + print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
| 237 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
| 238 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
| 239 | + print 'var marinetype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
| 240 | + print 'dataset'; |
|
| 241 | + print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
| 242 | + print '</script>'; |
|
| 243 | + } |
|
| 244 | + ?> |
|
| 245 | 245 | <div class="more"> |
| 246 | 246 | <?php |
| 247 | - /* |
|
| 247 | + /* |
|
| 248 | 248 | if ($year != '' && $month != '') { |
| 249 | 249 | ?> |
| 250 | 250 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | <?php |
| 256 | 256 | } |
| 257 | 257 | */ |
| 258 | - ?> |
|
| 258 | + ?> |
|
| 259 | 259 | </div> |
| 260 | 260 | </div> |
| 261 | 261 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -270,29 +270,29 @@ discard block |
||
| 270 | 270 | <div class="col-md-6"> |
| 271 | 271 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
| 272 | 272 | <?php |
| 273 | - $tracker_array = $Tracker->countAllTrackerTypes(); |
|
| 274 | - if (count($tracker_array) == 0) print _("No data available"); |
|
| 275 | - else { |
|
| 276 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
| 277 | - $tracker_data = ''; |
|
| 278 | - foreach($tracker_array as $tracker_item) |
|
| 279 | - { |
|
| 280 | - $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
|
| 281 | - } |
|
| 282 | - $tracker_data = substr($tracker_data, 0, -1); |
|
| 283 | - print 'var series = ['.$tracker_data.'];'; |
|
| 284 | - print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
| 285 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
| 286 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
| 287 | - print 'var trackertype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
| 288 | - print 'dataset'; |
|
| 289 | - print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
| 290 | - print '</script>'; |
|
| 291 | - } |
|
| 292 | - ?> |
|
| 273 | + $tracker_array = $Tracker->countAllTrackerTypes(); |
|
| 274 | + if (count($tracker_array) == 0) print _("No data available"); |
|
| 275 | + else { |
|
| 276 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
| 277 | + $tracker_data = ''; |
|
| 278 | + foreach($tracker_array as $tracker_item) |
|
| 279 | + { |
|
| 280 | + $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
|
| 281 | + } |
|
| 282 | + $tracker_data = substr($tracker_data, 0, -1); |
|
| 283 | + print 'var series = ['.$tracker_data.'];'; |
|
| 284 | + print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
| 285 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
| 286 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
| 287 | + print 'var trackertype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
| 288 | + print 'dataset'; |
|
| 289 | + print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
| 290 | + print '</script>'; |
|
| 291 | + } |
|
| 292 | + ?> |
|
| 293 | 293 | <div class="more"> |
| 294 | 294 | <?php |
| 295 | - /* |
|
| 295 | + /* |
|
| 296 | 296 | if ($year != '' && $month != '') { |
| 297 | 297 | ?> |
| 298 | 298 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | <?php |
| 304 | 304 | } |
| 305 | 305 | */ |
| 306 | - ?> |
|
| 306 | + ?> |
|
| 307 | 307 | </div> |
| 308 | 308 | </div> |
| 309 | 309 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | if (!isset($filter_name)) $filter_name = ''; |
| 22 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 22 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 23 | 23 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
| 24 | 24 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
| 25 | 25 | } |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | $title = _("Statistics"); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 38 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 37 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 38 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 39 | 39 | |
| 40 | 40 | require_once('header.php'); |
| 41 | 41 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | date_default_timezone_set('UTC'); |
| 63 | 63 | $lastupdate = strtotime($last_update[0]['value']); |
| 64 | 64 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
| 65 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
| 65 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | ?> |
@@ -74,30 +74,30 @@ discard block |
||
| 74 | 74 | <?php |
| 75 | 75 | if ($type == 'aircraft') { |
| 76 | 76 | ?> |
| 77 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span> |
|
| 78 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 79 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
| 80 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 77 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span> |
|
| 78 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 79 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
| 80 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 81 | 81 | <?php |
| 82 | - if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
| 82 | + if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
| 83 | 83 | ?> |
| 84 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
| 85 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 84 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
| 85 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 86 | 86 | <?php |
| 87 | 87 | } else { |
| 88 | 88 | ?> |
| 89 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
| 90 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 89 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
| 90 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 91 | 91 | <?php |
| 92 | 92 | } |
| 93 | 93 | ?> |
| 94 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
| 95 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 94 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
| 95 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 96 | 96 | <?php |
| 97 | 97 | if ($airline_icao == '') { |
| 98 | 98 | ?> |
| 99 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
| 100 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 99 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
| 100 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 101 | 101 | <?php |
| 102 | 102 | } |
| 103 | 103 | ?> |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) { |
| 106 | 106 | if ($airline_icao == '' || $airline_icao == 'all') { |
| 107 | 107 | ?> |
| 108 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
| 109 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 108 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
| 109 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 110 | 110 | <?php |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -114,22 +114,22 @@ discard block |
||
| 114 | 114 | <?php |
| 115 | 115 | } elseif ($type == 'marine') { |
| 116 | 116 | ?> |
| 117 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarine($filter_name,$year,$month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
| 118 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 119 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes($filter_name,$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
| 120 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 117 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarine($filter_name, $year, $month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
| 118 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 119 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes($filter_name, $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
| 120 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 121 | 121 | <?php |
| 122 | 122 | } elseif ($type == 'tracker') { |
| 123 | 123 | ?> |
| 124 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTracker($filter_name,$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
| 125 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 126 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes($filter_name,$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
| 127 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 124 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTracker($filter_name, $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
| 125 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 126 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes($filter_name, $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
| 127 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 128 | 128 | <?php |
| 129 | 129 | } |
| 130 | 130 | ?> |
| 131 | 131 | </p> |
| 132 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 132 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 133 | 133 | <div class="specific-stats"> |
| 134 | 134 | <?php |
| 135 | 135 | if ($type == 'aircraft') { |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | <div class="col-md-6"> |
| 139 | 139 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
| 140 | 140 | <?php |
| 141 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
| 141 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
| 142 | 142 | if (count($aircraft_array) == 0) print _("No data available"); |
| 143 | 143 | else { |
| 144 | 144 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 145 | 145 | $aircraft_data = ''; |
| 146 | - foreach($aircraft_array as $aircraft_item) |
|
| 146 | + foreach ($aircraft_array as $aircraft_item) |
|
| 147 | 147 | { |
| 148 | 148 | $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
| 149 | 149 | } |
@@ -172,17 +172,17 @@ discard block |
||
| 172 | 172 | ?> |
| 173 | 173 | </div> |
| 174 | 174 | </div> |
| 175 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 175 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 176 | 176 | <?php |
| 177 | 177 | // echo $airline_icao; |
| 178 | 178 | if ($airline_icao == '' || $airline_icao == 'all') { |
| 179 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
| 179 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
| 180 | 180 | if (count($airline_array) > 0) { |
| 181 | 181 | print '<div class="col-md-6">'; |
| 182 | 182 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
| 183 | 183 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
| 184 | 184 | $airline_data = ''; |
| 185 | - foreach($airline_array as $airline_item) |
|
| 185 | + foreach ($airline_array as $airline_item) |
|
| 186 | 186 | { |
| 187 | 187 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
| 188 | 188 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | } |
| 209 | 209 | ?> |
| 210 | 210 | </div> |
| 211 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 211 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 212 | 212 | <?php |
| 213 | 213 | } |
| 214 | 214 | ?> |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | else { |
| 228 | 228 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 229 | 229 | $marine_data = ''; |
| 230 | - foreach($marine_array as $marine_item) |
|
| 230 | + foreach ($marine_array as $marine_item) |
|
| 231 | 231 | { |
| 232 | 232 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
| 233 | 233 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | ?> |
| 259 | 259 | </div> |
| 260 | 260 | </div> |
| 261 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 261 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 262 | 262 | <!-- </div>--> |
| 263 | 263 | <?php |
| 264 | 264 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | else { |
| 276 | 276 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 277 | 277 | $tracker_data = ''; |
| 278 | - foreach($tracker_array as $tracker_item) |
|
| 278 | + foreach ($tracker_array as $tracker_item) |
|
| 279 | 279 | { |
| 280 | 280 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
| 281 | 281 | } |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | ?> |
| 307 | 307 | </div> |
| 308 | 308 | </div> |
| 309 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 309 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 310 | 310 | <!-- </div>--> |
| 311 | 311 | <?php |
| 312 | 312 | } |
@@ -316,8 +316,8 @@ discard block |
||
| 316 | 316 | ?> |
| 317 | 317 | <div class="row column"> |
| 318 | 318 | <?php |
| 319 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
| 320 | - if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
| 319 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
| 320 | + if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
| 321 | 321 | if (empty($flightover_array)) { |
| 322 | 322 | print '<div class="col-md-12">'; |
| 323 | 323 | } else { |
@@ -326,12 +326,12 @@ discard block |
||
| 326 | 326 | ?> |
| 327 | 327 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
| 328 | 328 | <?php |
| 329 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
| 329 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
| 330 | 330 | if (count($pilot_array) == 0) print _("No data available"); |
| 331 | 331 | else { |
| 332 | 332 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 333 | 333 | $pilot_data = ''; |
| 334 | - foreach($pilot_array as $pilot_item) |
|
| 334 | + foreach ($pilot_array as $pilot_item) |
|
| 335 | 335 | { |
| 336 | 336 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
| 337 | 337 | } |
@@ -353,19 +353,19 @@ discard block |
||
| 353 | 353 | ?> |
| 354 | 354 | </div> |
| 355 | 355 | |
| 356 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 356 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 357 | 357 | <?php |
| 358 | 358 | } else { |
| 359 | 359 | ?> |
| 360 | 360 | <div class="col-md-6"> |
| 361 | 361 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 362 | 362 | <?php |
| 363 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
| 363 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
| 364 | 364 | if (count($owner_array) == 0) print _("No data available"); |
| 365 | 365 | else { |
| 366 | 366 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 367 | 367 | $owner_data = ''; |
| 368 | - foreach($owner_array as $owner_item) |
|
| 368 | + foreach ($owner_array as $owner_item) |
|
| 369 | 369 | { |
| 370 | 370 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
| 371 | 371 | } |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | </div> |
| 386 | 386 | </div> |
| 387 | 387 | |
| 388 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 388 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 389 | 389 | <?php |
| 390 | 390 | } |
| 391 | 391 | if (!empty($flightover_array)) { |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 400 | 400 | print 'var series = ['; |
| 401 | 401 | $flightover_data = ''; |
| 402 | - foreach($flightover_array as $flightover_item) |
|
| 402 | + foreach ($flightover_array as $flightover_item) |
|
| 403 | 403 | { |
| 404 | 404 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
| 405 | 405 | } |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | } |
| 446 | 446 | ?> |
| 447 | 447 | </div> |
| 448 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 448 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 449 | 449 | |
| 450 | 450 | |
| 451 | 451 | </div> |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 466 | 466 | print 'var series = ['; |
| 467 | 467 | $flightover_data = ''; |
| 468 | - foreach($flightover_array as $flightover_item) |
|
| 468 | + foreach ($flightover_array as $flightover_item) |
|
| 469 | 469 | { |
| 470 | 470 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
| 471 | 471 | } |
@@ -525,7 +525,7 @@ discard block |
||
| 525 | 525 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 526 | 526 | print 'var series = ['; |
| 527 | 527 | $flightover_data = ''; |
| 528 | - foreach($flightover_array as $flightover_item) |
|
| 528 | + foreach ($flightover_array as $flightover_item) |
|
| 529 | 529 | { |
| 530 | 530 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
| 531 | 531 | } |
@@ -578,14 +578,14 @@ discard block |
||
| 578 | 578 | <div class="row column"> |
| 579 | 579 | <div class="col-md-6"> |
| 580 | 580 | <?php |
| 581 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
| 581 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
| 582 | 582 | if (count($airport_airport_array) > 0) { |
| 583 | 583 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
| 584 | 584 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
| 585 | 585 | print "\n"; |
| 586 | 586 | print 'var series = ['; |
| 587 | 587 | $airport_data = ''; |
| 588 | - foreach($airport_airport_array as $airport_item) |
|
| 588 | + foreach ($airport_airport_array as $airport_item) |
|
| 589 | 589 | { |
| 590 | 590 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
| 591 | 591 | } |
@@ -636,18 +636,18 @@ discard block |
||
| 636 | 636 | } |
| 637 | 637 | ?> |
| 638 | 638 | </div> |
| 639 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 639 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 640 | 640 | |
| 641 | 641 | <div class="col-md-6"> |
| 642 | 642 | <?php |
| 643 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
| 643 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
| 644 | 644 | if (count($airport_airport_array2) > 0) { |
| 645 | 645 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
| 646 | 646 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
| 647 | 647 | print "\n"; |
| 648 | 648 | print 'var series = ['; |
| 649 | 649 | $airport_data = ''; |
| 650 | - foreach($airport_airport_array2 as $airport_item) |
|
| 650 | + foreach ($airport_airport_array2 as $airport_item) |
|
| 651 | 651 | { |
| 652 | 652 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
| 653 | 653 | } |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | ?> |
| 700 | 700 | </div> |
| 701 | 701 | </div> |
| 702 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 702 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 703 | 703 | <?php |
| 704 | 704 | } |
| 705 | 705 | ?> |
@@ -713,19 +713,19 @@ discard block |
||
| 713 | 713 | <div class="col-md-6"> |
| 714 | 714 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 715 | 715 | <?php |
| 716 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
| 716 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
| 717 | 717 | if (count($year_array) == 0) print _("No data available"); |
| 718 | 718 | else { |
| 719 | 719 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 720 | 720 | $year_data = ''; |
| 721 | 721 | $year_cnt = ''; |
| 722 | - foreach($year_array as $year_item) |
|
| 722 | + foreach ($year_array as $year_item) |
|
| 723 | 723 | { |
| 724 | 724 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
| 725 | 725 | $year_cnt .= $year_item['date_count'].','; |
| 726 | 726 | } |
| 727 | 727 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 728 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
| 728 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
| 729 | 729 | print 'c3.generate({ |
| 730 | 730 | bindto: "#chart8", |
| 731 | 731 | data: { x: "x", |
@@ -738,23 +738,23 @@ discard block |
||
| 738 | 738 | <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 739 | 739 | </div> |
| 740 | 740 | </div> |
| 741 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 741 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 742 | 742 | <div class="col-md-6"> |
| 743 | 743 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 744 | 744 | <?php |
| 745 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
| 745 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
| 746 | 746 | if (count($month_array) == 0) print _("No data available"); |
| 747 | 747 | else { |
| 748 | 748 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 749 | 749 | $month_data = ''; |
| 750 | 750 | $month_cnt = ''; |
| 751 | - foreach($month_array as $month_item) |
|
| 751 | + foreach ($month_array as $month_item) |
|
| 752 | 752 | { |
| 753 | 753 | $month_data .= '"'.$month_item['date_name'].'",'; |
| 754 | 754 | $month_cnt .= $month_item['date_count'].','; |
| 755 | 755 | } |
| 756 | 756 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
| 757 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
| 757 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
| 758 | 758 | print 'c3.generate({ |
| 759 | 759 | bindto: "#chart9", |
| 760 | 760 | data: { x: "x", |
@@ -767,24 +767,24 @@ discard block |
||
| 767 | 767 | <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 768 | 768 | </div> |
| 769 | 769 | </div> |
| 770 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 770 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 771 | 771 | |
| 772 | 772 | <div class="col-md-6"> |
| 773 | 773 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 774 | 774 | <?php |
| 775 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
| 775 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
| 776 | 776 | if (empty($date_array)) print _("No data available"); |
| 777 | 777 | else { |
| 778 | 778 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 779 | 779 | $date_data = ''; |
| 780 | 780 | $date_cnt = ''; |
| 781 | - foreach($date_array as $date_item) |
|
| 781 | + foreach ($date_array as $date_item) |
|
| 782 | 782 | { |
| 783 | 783 | $date_data .= '"'.$date_item['date_name'].'",'; |
| 784 | 784 | $date_cnt .= $date_item['date_count'].','; |
| 785 | 785 | } |
| 786 | 786 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
| 787 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
| 787 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
| 788 | 788 | print 'c3.generate({ |
| 789 | 789 | bindto: "#chart5", |
| 790 | 790 | data: { x: "x", |
@@ -797,23 +797,23 @@ discard block |
||
| 797 | 797 | <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 798 | 798 | </div> |
| 799 | 799 | </div> |
| 800 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 800 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 801 | 801 | <div class="col-md-6"> |
| 802 | 802 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 803 | 803 | <?php |
| 804 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
| 804 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
| 805 | 805 | if (empty($hour_array)) print _("No data available"); |
| 806 | 806 | else { |
| 807 | 807 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 808 | 808 | $hour_data = ''; |
| 809 | 809 | $hour_cnt = ''; |
| 810 | - foreach($hour_array as $hour_item) |
|
| 810 | + foreach ($hour_array as $hour_item) |
|
| 811 | 811 | { |
| 812 | 812 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
| 813 | 813 | $hour_cnt .= $hour_item['hour_count'].','; |
| 814 | 814 | } |
| 815 | 815 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
| 816 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
| 816 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
| 817 | 817 | print 'c3.generate({ |
| 818 | 818 | bindto: "#chart6", |
| 819 | 819 | data: { |
@@ -826,7 +826,7 @@ discard block |
||
| 826 | 826 | <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 827 | 827 | </div> |
| 828 | 828 | </div> |
| 829 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 829 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 830 | 830 | </div> |
| 831 | 831 | <?php |
| 832 | 832 | } |
@@ -844,19 +844,19 @@ discard block |
||
| 844 | 844 | <div class="col-md-6"> |
| 845 | 845 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 846 | 846 | <?php |
| 847 | - $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
| 847 | + $year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
| 848 | 848 | if (count($year_array) == 0) print _("No data available"); |
| 849 | 849 | else { |
| 850 | 850 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 851 | 851 | $year_data = ''; |
| 852 | 852 | $year_cnt = ''; |
| 853 | - foreach($year_array as $year_item) |
|
| 853 | + foreach ($year_array as $year_item) |
|
| 854 | 854 | { |
| 855 | 855 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
| 856 | 856 | $year_cnt .= $year_item['date_count'].','; |
| 857 | 857 | } |
| 858 | 858 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 859 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
| 859 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
| 860 | 860 | print 'c3.generate({ |
| 861 | 861 | bindto: "#chart8", |
| 862 | 862 | data: { x: "x", |
@@ -870,23 +870,23 @@ discard block |
||
| 870 | 870 | </div> |
| 871 | 871 | </div> |
| 872 | 872 | |
| 873 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 873 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 874 | 874 | <div class="col-md-6"> |
| 875 | 875 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 876 | 876 | <?php |
| 877 | - $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
|
| 877 | + $month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name); |
|
| 878 | 878 | if (count($month_array) == 0) print _("No data available"); |
| 879 | 879 | else { |
| 880 | 880 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 881 | 881 | $month_data = ''; |
| 882 | 882 | $month_cnt = ''; |
| 883 | - foreach($month_array as $month_item) |
|
| 883 | + foreach ($month_array as $month_item) |
|
| 884 | 884 | { |
| 885 | 885 | $month_data .= '"'.$month_item['date_name'].'",'; |
| 886 | 886 | $month_cnt .= $month_item['date_count'].','; |
| 887 | 887 | } |
| 888 | 888 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
| 889 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
| 889 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
| 890 | 890 | print 'c3.generate({ |
| 891 | 891 | bindto: "#chart9", |
| 892 | 892 | data: { x: "x", |
@@ -899,24 +899,24 @@ discard block |
||
| 899 | 899 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 900 | 900 | </div> |
| 901 | 901 | </div> |
| 902 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 902 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 903 | 903 | |
| 904 | 904 | <div class="col-md-6"> |
| 905 | 905 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 906 | 906 | <?php |
| 907 | - $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
|
| 907 | + $date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name); |
|
| 908 | 908 | if (empty($date_array)) print _("No data available"); |
| 909 | 909 | else { |
| 910 | 910 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 911 | 911 | $date_data = ''; |
| 912 | 912 | $date_cnt = ''; |
| 913 | - foreach($date_array as $date_item) |
|
| 913 | + foreach ($date_array as $date_item) |
|
| 914 | 914 | { |
| 915 | 915 | $date_data .= '"'.$date_item['date_name'].'",'; |
| 916 | 916 | $date_cnt .= $date_item['date_count'].','; |
| 917 | 917 | } |
| 918 | 918 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
| 919 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
| 919 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
| 920 | 920 | print 'c3.generate({ |
| 921 | 921 | bindto: "#chart5", |
| 922 | 922 | data: { x: "x", |
@@ -929,23 +929,23 @@ discard block |
||
| 929 | 929 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 930 | 930 | </div> |
| 931 | 931 | </div> |
| 932 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 932 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 933 | 933 | <div class="col-md-6"> |
| 934 | 934 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 935 | 935 | <?php |
| 936 | - $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
|
| 936 | + $hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name); |
|
| 937 | 937 | if (empty($hour_array)) print _("No data available"); |
| 938 | 938 | else { |
| 939 | 939 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 940 | 940 | $hour_data = ''; |
| 941 | 941 | $hour_cnt = ''; |
| 942 | - foreach($hour_array as $hour_item) |
|
| 942 | + foreach ($hour_array as $hour_item) |
|
| 943 | 943 | { |
| 944 | 944 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
| 945 | 945 | $hour_cnt .= $hour_item['hour_count'].','; |
| 946 | 946 | } |
| 947 | 947 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
| 948 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
| 948 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
| 949 | 949 | print 'c3.generate({ |
| 950 | 950 | bindto: "#chart6", |
| 951 | 951 | data: { |
@@ -958,7 +958,7 @@ discard block |
||
| 958 | 958 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 959 | 959 | </div> |
| 960 | 960 | </div> |
| 961 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 961 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 962 | 962 | </div> |
| 963 | 963 | <?php |
| 964 | 964 | } |
@@ -982,13 +982,13 @@ discard block |
||
| 982 | 982 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 983 | 983 | $year_data = ''; |
| 984 | 984 | $year_cnt = ''; |
| 985 | - foreach($year_array as $year_item) |
|
| 985 | + foreach ($year_array as $year_item) |
|
| 986 | 986 | { |
| 987 | 987 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
| 988 | 988 | $year_cnt .= $year_item['date_count'].','; |
| 989 | 989 | } |
| 990 | 990 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 991 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
| 991 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
| 992 | 992 | print 'c3.generate({ |
| 993 | 993 | bindto: "#chart8", |
| 994 | 994 | data: { x: "x", |
@@ -1002,7 +1002,7 @@ discard block |
||
| 1002 | 1002 | </div> |
| 1003 | 1003 | </div> |
| 1004 | 1004 | |
| 1005 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1005 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1006 | 1006 | <div class="col-md-6"> |
| 1007 | 1007 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 1008 | 1008 | <?php |
@@ -1012,13 +1012,13 @@ discard block |
||
| 1012 | 1012 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 1013 | 1013 | $month_data = ''; |
| 1014 | 1014 | $month_cnt = ''; |
| 1015 | - foreach($month_array as $month_item) |
|
| 1015 | + foreach ($month_array as $month_item) |
|
| 1016 | 1016 | { |
| 1017 | 1017 | $month_data .= '"'.$month_item['date_name'].'",'; |
| 1018 | 1018 | $month_cnt .= $month_item['date_count'].','; |
| 1019 | 1019 | } |
| 1020 | 1020 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
| 1021 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
| 1021 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
| 1022 | 1022 | print 'c3.generate({ |
| 1023 | 1023 | bindto: "#chart9", |
| 1024 | 1024 | data: { x: "x", |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1032 | 1032 | </div> |
| 1033 | 1033 | </div> |
| 1034 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1034 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1035 | 1035 | |
| 1036 | 1036 | <div class="col-md-6"> |
| 1037 | 1037 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1042,13 +1042,13 @@ discard block |
||
| 1042 | 1042 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 1043 | 1043 | $date_data = ''; |
| 1044 | 1044 | $date_cnt = ''; |
| 1045 | - foreach($date_array as $date_item) |
|
| 1045 | + foreach ($date_array as $date_item) |
|
| 1046 | 1046 | { |
| 1047 | 1047 | $date_data .= '"'.$date_item['date_name'].'",'; |
| 1048 | 1048 | $date_cnt .= $date_item['date_count'].','; |
| 1049 | 1049 | } |
| 1050 | 1050 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
| 1051 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
| 1051 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
| 1052 | 1052 | print 'c3.generate({ |
| 1053 | 1053 | bindto: "#chart5", |
| 1054 | 1054 | data: { x: "x", |
@@ -1061,23 +1061,23 @@ discard block |
||
| 1061 | 1061 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1062 | 1062 | </div> |
| 1063 | 1063 | </div> |
| 1064 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1064 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1065 | 1065 | <div class="col-md-6"> |
| 1066 | 1066 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 1067 | 1067 | <?php |
| 1068 | - $hour_array = $Tracker->countAllHours('hour',true); |
|
| 1068 | + $hour_array = $Tracker->countAllHours('hour', true); |
|
| 1069 | 1069 | if (empty($hour_array)) print _("No data available"); |
| 1070 | 1070 | else { |
| 1071 | 1071 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 1072 | 1072 | $hour_data = ''; |
| 1073 | 1073 | $hour_cnt = ''; |
| 1074 | - foreach($hour_array as $hour_item) |
|
| 1074 | + foreach ($hour_array as $hour_item) |
|
| 1075 | 1075 | { |
| 1076 | 1076 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
| 1077 | 1077 | $hour_cnt .= $hour_item['hour_count'].','; |
| 1078 | 1078 | } |
| 1079 | 1079 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
| 1080 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
| 1080 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
| 1081 | 1081 | print 'c3.generate({ |
| 1082 | 1082 | bindto: "#chart6", |
| 1083 | 1083 | data: { |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1091 | 1091 | </div> |
| 1092 | 1092 | </div> |
| 1093 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1093 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1094 | 1094 | </div> |
| 1095 | 1095 | <?php |
| 1096 | 1096 | } |
@@ -1114,13 +1114,13 @@ discard block |
||
| 1114 | 1114 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
| 1115 | 1115 | $year_data = ''; |
| 1116 | 1116 | $year_cnt = ''; |
| 1117 | - foreach($year_array as $year_item) |
|
| 1117 | + foreach ($year_array as $year_item) |
|
| 1118 | 1118 | { |
| 1119 | 1119 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
| 1120 | 1120 | $year_cnt .= $year_item['count'].','; |
| 1121 | 1121 | } |
| 1122 | 1122 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 1123 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
| 1123 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
| 1124 | 1124 | print 'c3.generate({ |
| 1125 | 1125 | bindto: "#chart32", |
| 1126 | 1126 | data: { x: "x", |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1134 | 1134 | </div> |
| 1135 | 1135 | </div> |
| 1136 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1136 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1137 | 1137 | |
| 1138 | 1138 | <div class="row column"> |
| 1139 | 1139 | <div class="col-md-6"> |
@@ -1145,13 +1145,13 @@ discard block |
||
| 1145 | 1145 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
| 1146 | 1146 | $year_data = ''; |
| 1147 | 1147 | $year_cnt = ''; |
| 1148 | - foreach($year_array as $year_item) |
|
| 1148 | + foreach ($year_array as $year_item) |
|
| 1149 | 1149 | { |
| 1150 | 1150 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
| 1151 | 1151 | $year_cnt .= $year_item['count'].','; |
| 1152 | 1152 | } |
| 1153 | 1153 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
| 1154 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
| 1154 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
| 1155 | 1155 | print 'c3.generate({ |
| 1156 | 1156 | bindto: "#chart33", |
| 1157 | 1157 | data: { x: "x", |
@@ -1164,7 +1164,7 @@ discard block |
||
| 1164 | 1164 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 1165 | 1165 | </div> |
| 1166 | 1166 | </div> |
| 1167 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1167 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1168 | 1168 | <br/> |
| 1169 | 1169 | <?php |
| 1170 | 1170 | } |
@@ -1182,9 +1182,9 @@ discard block |
||
| 1182 | 1182 | <?php |
| 1183 | 1183 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
| 1184 | 1184 | if ($year == '' && $month == '') { |
| 1185 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
| 1185 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
| 1186 | 1186 | } else { |
| 1187 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
| 1187 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
| 1188 | 1188 | } |
| 1189 | 1189 | if (!empty($polar)) { |
| 1190 | 1190 | print '<h2>'._("Coverage pattern").'</h2>'; |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | unset($polar_data); |
| 1193 | 1193 | $Spotter = new Spotter(); |
| 1194 | 1194 | $data = json_decode($eachpolar['source_data']); |
| 1195 | - foreach($data as $value => $key) { |
|
| 1195 | + foreach ($data as $value => $key) { |
|
| 1196 | 1196 | $direction = $Spotter->parseDirection(($value*22.5)); |
| 1197 | 1197 | $distance = $key; |
| 1198 | 1198 | $unit = 'km'; |
@@ -1212,7 +1212,7 @@ discard block |
||
| 1212 | 1212 | ?> |
| 1213 | 1213 | <div class="col-md-6"> |
| 1214 | 1214 | <h4><?php print $eachpolar['source_name']; ?></h4> |
| 1215 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
| 1215 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
| 1216 | 1216 | <script> |
| 1217 | 1217 | (function() { |
| 1218 | 1218 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1236,7 +1236,7 @@ discard block |
||
| 1236 | 1236 | color: color, |
| 1237 | 1237 | unit: '<?php echo $unit; ?>' |
| 1238 | 1238 | }; |
| 1239 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
| 1239 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
| 1240 | 1240 | })(); |
| 1241 | 1241 | </script> |
| 1242 | 1242 | </div> |
@@ -1250,22 +1250,22 @@ discard block |
||
| 1250 | 1250 | <?php |
| 1251 | 1251 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
| 1252 | 1252 | if ($year == '' && $month == '') { |
| 1253 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
| 1253 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
| 1254 | 1254 | } else { |
| 1255 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
| 1255 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
| 1256 | 1256 | } |
| 1257 | 1257 | if (!empty($msg)) { |
| 1258 | 1258 | print '<h2>'._("Messages received").'</h2>'; |
| 1259 | 1259 | foreach ($msg as $eachmsg) { |
| 1260 | 1260 | //$eachmsg = $msg[0]; |
| 1261 | 1261 | $data = $eachmsg['source_data']; |
| 1262 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
| 1262 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
| 1263 | 1263 | else $max = 500; |
| 1264 | 1264 | ?> |
| 1265 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
| 1265 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
| 1266 | 1266 | <script> |
| 1267 | 1267 | var g = new JustGage({ |
| 1268 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
| 1268 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
| 1269 | 1269 | value: <?php echo $data; ?>, |
| 1270 | 1270 | min: 0, |
| 1271 | 1271 | max: <?php print $max; ?>, |
@@ -1286,9 +1286,9 @@ discard block |
||
| 1286 | 1286 | <?php |
| 1287 | 1287 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
| 1288 | 1288 | if ($year == '' && $month == '') { |
| 1289 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
| 1289 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
| 1290 | 1290 | } else { |
| 1291 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
| 1291 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
| 1292 | 1292 | } |
| 1293 | 1293 | foreach ($hist as $hists) { |
| 1294 | 1294 | //$hist_data = ''; |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | $source = $hists['source_name']; |
| 1298 | 1298 | $hist_array = json_decode($hists['source_data']); |
| 1299 | 1299 | $unit = 'km'; |
| 1300 | - foreach($hist_array as $distance => $nb) |
|
| 1300 | + foreach ($hist_array as $distance => $nb) |
|
| 1301 | 1301 | { |
| 1302 | 1302 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 1303 | 1303 | $distance = round($distance*0.539957); |
@@ -1318,18 +1318,18 @@ discard block |
||
| 1318 | 1318 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
| 1319 | 1319 | ?> |
| 1320 | 1320 | <div class="col-md-6"> |
| 1321 | - <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
|
| 1321 | + <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2> |
|
| 1322 | 1322 | <?php |
| 1323 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
| 1323 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
| 1324 | 1324 | print 'c3.generate({ |
| 1325 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
| 1325 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
| 1326 | 1326 | data: { x: "x", |
| 1327 | 1327 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
| 1328 | 1328 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
| 1329 | 1329 | print '</script>'; |
| 1330 | 1330 | ?> |
| 1331 | 1331 | </div> |
| 1332 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
| 1332 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
| 1333 | 1333 | <?php |
| 1334 | 1334 | } |
| 1335 | 1335 | ?> |
@@ -18,11 +18,15 @@ discard block |
||
| 18 | 18 | require_once('require/class.Spotter.php'); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 21 | +if (!isset($filter_name)) { |
|
| 22 | + $filter_name = ''; |
|
| 23 | +} |
|
| 22 | 24 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 23 | 25 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
| 24 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 25 | -} |
|
| 26 | + if (isset($globalFilter['airline'])) { |
|
| 27 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 28 | + } |
|
| 29 | + } |
|
| 26 | 30 | if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') { |
| 27 | 31 | $Spotter = new Spotter(); |
| 28 | 32 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -53,7 +57,12 @@ discard block |
||
| 53 | 57 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script> |
| 54 | 58 | <div class="column"> |
| 55 | 59 | <div class="info"> |
| 56 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
| 60 | + <h1><?php if (isset($airline_name)) { |
|
| 61 | + echo _("Statistics for ").$airline_name; |
|
| 62 | +} else { |
|
| 63 | + echo _("Statistics"); |
|
| 64 | +} |
|
| 65 | +?></h1> |
|
| 57 | 66 | <?php |
| 58 | 67 | if ($type == 'aircraft') { |
| 59 | 68 | $last_update = $Stats->getLastStatsUpdate(); |
@@ -61,7 +70,9 @@ discard block |
||
| 61 | 70 | if (isset($last_update[0]['value'])) { |
| 62 | 71 | date_default_timezone_set('UTC'); |
| 63 | 72 | $lastupdate = strtotime($last_update[0]['value']); |
| 64 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
| 73 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
| 74 | + date_default_timezone_set($globalTimezone); |
|
| 75 | + } |
|
| 65 | 76 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
| 66 | 77 | } |
| 67 | 78 | } |
@@ -139,8 +150,9 @@ discard block |
||
| 139 | 150 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
| 140 | 151 | <?php |
| 141 | 152 | $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
| 142 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
| 143 | - else { |
|
| 153 | + if (count($aircraft_array) == 0) { |
|
| 154 | + print _("No data available"); |
|
| 155 | + } else { |
|
| 144 | 156 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 145 | 157 | $aircraft_data = ''; |
| 146 | 158 | foreach($aircraft_array as $aircraft_item) |
@@ -162,11 +174,17 @@ discard block |
||
| 162 | 174 | <?php |
| 163 | 175 | if ($year != '' && $month != '') { |
| 164 | 176 | ?> |
| 165 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 177 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 178 | + echo '/'.$airline_icao; |
|
| 179 | +} |
|
| 180 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 166 | 181 | <?php |
| 167 | 182 | } else { |
| 168 | 183 | ?> |
| 169 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 184 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 185 | + echo '/'.$airline_icao; |
|
| 186 | +} |
|
| 187 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 170 | 188 | <?php |
| 171 | 189 | } |
| 172 | 190 | ?> |
@@ -197,11 +215,15 @@ discard block |
||
| 197 | 215 | print '</script>'; |
| 198 | 216 | if ($year != '' && $month != '') { |
| 199 | 217 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
| 200 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 218 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 219 | + echo '/'.$airline_icao; |
|
| 220 | + } |
|
| 201 | 221 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 202 | 222 | } else { |
| 203 | 223 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
| 204 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 224 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 225 | + echo '/'.$airline_icao; |
|
| 226 | + } |
|
| 205 | 227 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 206 | 228 | } |
| 207 | 229 | print '</div>'; |
@@ -223,8 +245,9 @@ discard block |
||
| 223 | 245 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
| 224 | 246 | <?php |
| 225 | 247 | $marine_array = $Marine->countAllMarineTypes(); |
| 226 | - if (count($marine_array) == 0) print _("No data available"); |
|
| 227 | - else { |
|
| 248 | + if (count($marine_array) == 0) { |
|
| 249 | + print _("No data available"); |
|
| 250 | + } else { |
|
| 228 | 251 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 229 | 252 | $marine_data = ''; |
| 230 | 253 | foreach($marine_array as $marine_item) |
@@ -271,8 +294,9 @@ discard block |
||
| 271 | 294 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
| 272 | 295 | <?php |
| 273 | 296 | $tracker_array = $Tracker->countAllTrackerTypes(); |
| 274 | - if (count($tracker_array) == 0) print _("No data available"); |
|
| 275 | - else { |
|
| 297 | + if (count($tracker_array) == 0) { |
|
| 298 | + print _("No data available"); |
|
| 299 | + } else { |
|
| 276 | 300 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
| 277 | 301 | $tracker_data = ''; |
| 278 | 302 | foreach($tracker_array as $tracker_item) |
@@ -327,8 +351,9 @@ discard block |
||
| 327 | 351 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
| 328 | 352 | <?php |
| 329 | 353 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
| 330 | - if (count($pilot_array) == 0) print _("No data available"); |
|
| 331 | - else { |
|
| 354 | + if (count($pilot_array) == 0) { |
|
| 355 | + print _("No data available"); |
|
| 356 | + } else { |
|
| 332 | 357 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 333 | 358 | $pilot_data = ''; |
| 334 | 359 | foreach($pilot_array as $pilot_item) |
@@ -347,7 +372,9 @@ discard block |
||
| 347 | 372 | } |
| 348 | 373 | print '<div class="more">'; |
| 349 | 374 | print '<a href="'.$globalURL.'/statistics/pilot'; |
| 350 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 375 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 376 | + echo '/'.$airline_icao; |
|
| 377 | + } |
|
| 351 | 378 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
| 352 | 379 | print '</div>'; |
| 353 | 380 | ?> |
@@ -361,8 +388,9 @@ discard block |
||
| 361 | 388 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
| 362 | 389 | <?php |
| 363 | 390 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
| 364 | - if (count($owner_array) == 0) print _("No data available"); |
|
| 365 | - else { |
|
| 391 | + if (count($owner_array) == 0) { |
|
| 392 | + print _("No data available"); |
|
| 393 | + } else { |
|
| 366 | 394 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
| 367 | 395 | $owner_data = ''; |
| 368 | 396 | foreach($owner_array as $owner_item) |
@@ -381,7 +409,10 @@ discard block |
||
| 381 | 409 | } |
| 382 | 410 | ?> |
| 383 | 411 | <div class="more"> |
| 384 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 412 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 413 | + echo '/'.$airline_icao; |
|
| 414 | +} |
|
| 415 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 385 | 416 | </div> |
| 386 | 417 | </div> |
| 387 | 418 | |
@@ -394,8 +425,9 @@ discard block |
||
| 394 | 425 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
| 395 | 426 | <?php |
| 396 | 427 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
| 397 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 398 | - else { |
|
| 428 | + if (count($flightover_array) == 0) { |
|
| 429 | + print _("No data available"); |
|
| 430 | + } else { |
|
| 399 | 431 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 400 | 432 | print 'var series = ['; |
| 401 | 433 | $flightover_data = ''; |
@@ -438,7 +470,10 @@ discard block |
||
| 438 | 470 | } |
| 439 | 471 | ?> |
| 440 | 472 | <div class="more"> |
| 441 | - <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 473 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 474 | + echo '/'.$airline_icao; |
|
| 475 | +} |
|
| 476 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 442 | 477 | </div> |
| 443 | 478 | </div> |
| 444 | 479 | <?php |
@@ -460,8 +495,9 @@ discard block |
||
| 460 | 495 | <div class="col-md-6"> |
| 461 | 496 | <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2> |
| 462 | 497 | <?php |
| 463 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 464 | - else { |
|
| 498 | + if (count($flightover_array) == 0) { |
|
| 499 | + print _("No data available"); |
|
| 500 | + } else { |
|
| 465 | 501 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 466 | 502 | print 'var series = ['; |
| 467 | 503 | $flightover_data = ''; |
@@ -520,8 +556,9 @@ discard block |
||
| 520 | 556 | <div class="col-md-6"> |
| 521 | 557 | <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2> |
| 522 | 558 | <?php |
| 523 | - if (count($flightover_array) == 0) print _("No data available"); |
|
| 524 | - else { |
|
| 559 | + if (count($flightover_array) == 0) { |
|
| 560 | + print _("No data available"); |
|
| 561 | + } else { |
|
| 525 | 562 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
| 526 | 563 | print 'var series = ['; |
| 527 | 564 | $flightover_data = ''; |
@@ -631,7 +668,9 @@ discard block |
||
| 631 | 668 | });"; |
| 632 | 669 | print '</script>'; |
| 633 | 670 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
| 634 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 671 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 672 | + echo '/'.$airline_icao; |
|
| 673 | + } |
|
| 635 | 674 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 636 | 675 | } |
| 637 | 676 | ?> |
@@ -693,7 +732,9 @@ discard block |
||
| 693 | 732 | });"; |
| 694 | 733 | print '</script>'; |
| 695 | 734 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
| 696 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
| 735 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 736 | + echo '/'.$airline_icao; |
|
| 737 | + } |
|
| 697 | 738 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
| 698 | 739 | } |
| 699 | 740 | ?> |
@@ -714,8 +755,9 @@ discard block |
||
| 714 | 755 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 715 | 756 | <?php |
| 716 | 757 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
| 717 | - if (count($year_array) == 0) print _("No data available"); |
|
| 718 | - else { |
|
| 758 | + if (count($year_array) == 0) { |
|
| 759 | + print _("No data available"); |
|
| 760 | + } else { |
|
| 719 | 761 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 720 | 762 | $year_data = ''; |
| 721 | 763 | $year_cnt = ''; |
@@ -735,7 +777,10 @@ discard block |
||
| 735 | 777 | } |
| 736 | 778 | ?> |
| 737 | 779 | <div class="more"> |
| 738 | - <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 780 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 781 | + echo '/'.$airline_icao; |
|
| 782 | +} |
|
| 783 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 739 | 784 | </div> |
| 740 | 785 | </div> |
| 741 | 786 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -743,8 +788,9 @@ discard block |
||
| 743 | 788 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 744 | 789 | <?php |
| 745 | 790 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
| 746 | - if (count($month_array) == 0) print _("No data available"); |
|
| 747 | - else { |
|
| 791 | + if (count($month_array) == 0) { |
|
| 792 | + print _("No data available"); |
|
| 793 | + } else { |
|
| 748 | 794 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 749 | 795 | $month_data = ''; |
| 750 | 796 | $month_cnt = ''; |
@@ -764,7 +810,10 @@ discard block |
||
| 764 | 810 | } |
| 765 | 811 | ?> |
| 766 | 812 | <div class="more"> |
| 767 | - <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 813 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 814 | + echo '/'.$airline_icao; |
|
| 815 | +} |
|
| 816 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 768 | 817 | </div> |
| 769 | 818 | </div> |
| 770 | 819 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -773,8 +822,9 @@ discard block |
||
| 773 | 822 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 774 | 823 | <?php |
| 775 | 824 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
| 776 | - if (empty($date_array)) print _("No data available"); |
|
| 777 | - else { |
|
| 825 | + if (empty($date_array)) { |
|
| 826 | + print _("No data available"); |
|
| 827 | + } else { |
|
| 778 | 828 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 779 | 829 | $date_data = ''; |
| 780 | 830 | $date_cnt = ''; |
@@ -794,7 +844,10 @@ discard block |
||
| 794 | 844 | } |
| 795 | 845 | ?> |
| 796 | 846 | <div class="more"> |
| 797 | - <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 847 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 848 | + echo '/'.$airline_icao; |
|
| 849 | +} |
|
| 850 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 798 | 851 | </div> |
| 799 | 852 | </div> |
| 800 | 853 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -802,8 +855,9 @@ discard block |
||
| 802 | 855 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 803 | 856 | <?php |
| 804 | 857 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
| 805 | - if (empty($hour_array)) print _("No data available"); |
|
| 806 | - else { |
|
| 858 | + if (empty($hour_array)) { |
|
| 859 | + print _("No data available"); |
|
| 860 | + } else { |
|
| 807 | 861 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 808 | 862 | $hour_data = ''; |
| 809 | 863 | $hour_cnt = ''; |
@@ -823,7 +877,10 @@ discard block |
||
| 823 | 877 | } |
| 824 | 878 | ?> |
| 825 | 879 | <div class="more"> |
| 826 | - <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 880 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 881 | + echo '/'.$airline_icao; |
|
| 882 | +} |
|
| 883 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
| 827 | 884 | </div> |
| 828 | 885 | </div> |
| 829 | 886 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -845,8 +902,9 @@ discard block |
||
| 845 | 902 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 846 | 903 | <?php |
| 847 | 904 | $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
| 848 | - if (count($year_array) == 0) print _("No data available"); |
|
| 849 | - else { |
|
| 905 | + if (count($year_array) == 0) { |
|
| 906 | + print _("No data available"); |
|
| 907 | + } else { |
|
| 850 | 908 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 851 | 909 | $year_data = ''; |
| 852 | 910 | $year_cnt = ''; |
@@ -875,8 +933,9 @@ discard block |
||
| 875 | 933 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 876 | 934 | <?php |
| 877 | 935 | $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
| 878 | - if (count($month_array) == 0) print _("No data available"); |
|
| 879 | - else { |
|
| 936 | + if (count($month_array) == 0) { |
|
| 937 | + print _("No data available"); |
|
| 938 | + } else { |
|
| 880 | 939 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 881 | 940 | $month_data = ''; |
| 882 | 941 | $month_cnt = ''; |
@@ -905,8 +964,9 @@ discard block |
||
| 905 | 964 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 906 | 965 | <?php |
| 907 | 966 | $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
| 908 | - if (empty($date_array)) print _("No data available"); |
|
| 909 | - else { |
|
| 967 | + if (empty($date_array)) { |
|
| 968 | + print _("No data available"); |
|
| 969 | + } else { |
|
| 910 | 970 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 911 | 971 | $date_data = ''; |
| 912 | 972 | $date_cnt = ''; |
@@ -934,8 +994,9 @@ discard block |
||
| 934 | 994 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 935 | 995 | <?php |
| 936 | 996 | $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
| 937 | - if (empty($hour_array)) print _("No data available"); |
|
| 938 | - else { |
|
| 997 | + if (empty($hour_array)) { |
|
| 998 | + print _("No data available"); |
|
| 999 | + } else { |
|
| 939 | 1000 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 940 | 1001 | $hour_data = ''; |
| 941 | 1002 | $hour_cnt = ''; |
@@ -977,8 +1038,9 @@ discard block |
||
| 977 | 1038 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
| 978 | 1039 | <?php |
| 979 | 1040 | $year_array = $Tracker->countAllMonthsLastYear(true); |
| 980 | - if (count($year_array) == 0) print _("No data available"); |
|
| 981 | - else { |
|
| 1041 | + if (count($year_array) == 0) { |
|
| 1042 | + print _("No data available"); |
|
| 1043 | + } else { |
|
| 982 | 1044 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
| 983 | 1045 | $year_data = ''; |
| 984 | 1046 | $year_cnt = ''; |
@@ -1007,8 +1069,9 @@ discard block |
||
| 1007 | 1069 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
| 1008 | 1070 | <?php |
| 1009 | 1071 | $month_array = $Tracker->countAllDatesLastMonth(); |
| 1010 | - if (count($month_array) == 0) print _("No data available"); |
|
| 1011 | - else { |
|
| 1072 | + if (count($month_array) == 0) { |
|
| 1073 | + print _("No data available"); |
|
| 1074 | + } else { |
|
| 1012 | 1075 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
| 1013 | 1076 | $month_data = ''; |
| 1014 | 1077 | $month_cnt = ''; |
@@ -1037,8 +1100,9 @@ discard block |
||
| 1037 | 1100 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
| 1038 | 1101 | <?php |
| 1039 | 1102 | $date_array = $Tracker->countAllDatesLast7Days(); |
| 1040 | - if (empty($date_array)) print _("No data available"); |
|
| 1041 | - else { |
|
| 1103 | + if (empty($date_array)) { |
|
| 1104 | + print _("No data available"); |
|
| 1105 | + } else { |
|
| 1042 | 1106 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
| 1043 | 1107 | $date_data = ''; |
| 1044 | 1108 | $date_cnt = ''; |
@@ -1066,8 +1130,9 @@ discard block |
||
| 1066 | 1130 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
| 1067 | 1131 | <?php |
| 1068 | 1132 | $hour_array = $Tracker->countAllHours('hour',true); |
| 1069 | - if (empty($hour_array)) print _("No data available"); |
|
| 1070 | - else { |
|
| 1133 | + if (empty($hour_array)) { |
|
| 1134 | + print _("No data available"); |
|
| 1135 | + } else { |
|
| 1071 | 1136 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
| 1072 | 1137 | $hour_data = ''; |
| 1073 | 1138 | $hour_cnt = ''; |
@@ -1109,8 +1174,9 @@ discard block |
||
| 1109 | 1174 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
| 1110 | 1175 | <?php |
| 1111 | 1176 | $year_array = $Stats->countFatalitiesByYear(); |
| 1112 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1113 | - else { |
|
| 1177 | + if (count($year_array) == 0) { |
|
| 1178 | + print _("No data available"); |
|
| 1179 | + } else { |
|
| 1114 | 1180 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
| 1115 | 1181 | $year_data = ''; |
| 1116 | 1182 | $year_cnt = ''; |
@@ -1140,8 +1206,9 @@ discard block |
||
| 1140 | 1206 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
| 1141 | 1207 | <?php |
| 1142 | 1208 | $year_array = $Stats->countFatalitiesLast12Months(); |
| 1143 | - if (count($year_array) == 0) print _("No data available"); |
|
| 1144 | - else { |
|
| 1209 | + if (count($year_array) == 0) { |
|
| 1210 | + print _("No data available"); |
|
| 1211 | + } else { |
|
| 1145 | 1212 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
| 1146 | 1213 | $year_data = ''; |
| 1147 | 1214 | $year_cnt = ''; |
@@ -1206,8 +1273,11 @@ discard block |
||
| 1206 | 1273 | $distance = $distance; |
| 1207 | 1274 | $unit = 'km'; |
| 1208 | 1275 | } |
| 1209 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1210 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1276 | + if (!isset($polar_data)) { |
|
| 1277 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1278 | + } else { |
|
| 1279 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
| 1280 | + } |
|
| 1211 | 1281 | } |
| 1212 | 1282 | ?> |
| 1213 | 1283 | <div class="col-md-6"> |
@@ -1259,9 +1329,12 @@ discard block |
||
| 1259 | 1329 | foreach ($msg as $eachmsg) { |
| 1260 | 1330 | //$eachmsg = $msg[0]; |
| 1261 | 1331 | $data = $eachmsg['source_data']; |
| 1262 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
| 1263 | - else $max = 500; |
|
| 1264 | -?> |
|
| 1332 | + if ($data > 500) { |
|
| 1333 | + $max = (round(($data+100)/100))*100; |
|
| 1334 | + } else { |
|
| 1335 | + $max = 500; |
|
| 1336 | + } |
|
| 1337 | + ?> |
|
| 1265 | 1338 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
| 1266 | 1339 | <script> |
| 1267 | 1340 | var g = new JustGage({ |
@@ -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 | { |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | ?> |
| 38 | 38 | </div> |
| 39 | 39 | <?php |
| 40 | - if (!isset($year) || (isset($year) && $year == '') && !isset($month) || (isset($month) && $month == '')) { |
|
| 40 | + if (!isset($year) || (isset($year) && $year == '') && !isset($month) || (isset($month) && $month == '')) { |
|
| 41 | 41 | ?> |
| 42 | 42 | <div class="sub-menu sub-menu-container"> |
| 43 | 43 | <ul class="nav"> |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | </ul> |
| 96 | 96 | </li> |
| 97 | 97 | <?php |
| 98 | - if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
|
| 98 | + if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
|
| 99 | 99 | ?> |
| 100 | 100 | <li class="dropdown"> |
| 101 | 101 | <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | </ul> |
| 108 | 108 | </li> |
| 109 | 109 | <?php |
| 110 | - } |
|
| 110 | + } |
|
| 111 | 111 | ?> |
| 112 | 112 | <?php |
| 113 | 113 | } elseif ($type == 'marine' || $type == 'tracker') { |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | </ul> |
| 128 | 128 | </div> |
| 129 | 129 | <?php |
| 130 | - } else { |
|
| 130 | + } else { |
|
| 131 | 131 | ?> |
| 132 | 132 | <div class="sub-menu sub-menu-container"> |
| 133 | 133 | <ul class="nav"> |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | </li> |
| 190 | 190 | --> |
| 191 | 191 | <?php |
| 192 | - if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
|
| 192 | + if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
|
| 193 | 193 | ?> |
| 194 | 194 | <!-- |
| 195 | 195 | <li class="dropdown"> |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | </li> |
| 204 | 204 | --> |
| 205 | 205 | <?php |
| 206 | - } |
|
| 206 | + } |
|
| 207 | 207 | ?> |
| 208 | 208 | <?php |
| 209 | 209 | } elseif ($type == 'marine' || $type == 'tracker') { |
@@ -224,5 +224,5 @@ discard block |
||
| 224 | 224 | </ul> |
| 225 | 225 | </div> |
| 226 | 226 | <?php |
| 227 | - } |
|
| 227 | + } |
|
| 228 | 228 | ?> |
| 229 | 229 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | } else { |
| 23 | 23 | print '<option value="all">All</option>'; |
| 24 | 24 | } |
| 25 | - foreach($airlines as $airline) { |
|
| 25 | + foreach ($airlines as $airline) { |
|
| 26 | 26 | if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) { |
| 27 | 27 | print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>'; |
| 28 | 28 | } else { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | if (!isset($type) || $type == 'aircraft') { |
| 46 | 46 | ?> |
| 47 | 47 | <li class="dropdown"> |
| 48 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
| 48 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
| 49 | 49 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 50 | 50 | </a> |
| 51 | 51 | <ul class="dropdown-menu"> |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | </ul> |
| 57 | 57 | </li> |
| 58 | 58 | <li class="dropdown"> |
| 59 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 59 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 60 | 60 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 61 | 61 | </a> |
| 62 | 62 | <ul class="dropdown-menu" role="menu"> |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | </ul> |
| 67 | 67 | </li> |
| 68 | 68 | <li class="dropdown"> |
| 69 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 69 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 70 | 70 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 71 | 71 | </a> |
| 72 | 72 | <ul class="dropdown-menu" role="menu"> |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | </ul> |
| 78 | 78 | </li> |
| 79 | 79 | <li class="dropdown"> |
| 80 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 80 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 81 | 81 | <?php echo _("Route"); ?> <span class="caret"></span> |
| 82 | 82 | </a> |
| 83 | 83 | <ul class="dropdown-menu" role="menu"> |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | </ul> |
| 87 | 87 | </li> |
| 88 | 88 | <li class="dropdown"> |
| 89 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 89 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 90 | 90 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 91 | 91 | </a> |
| 92 | 92 | <ul class="dropdown-menu" role="menu"> |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
| 99 | 99 | ?> |
| 100 | 100 | <li class="dropdown"> |
| 101 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 101 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 102 | 102 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
| 103 | 103 | </a> |
| 104 | 104 | <ul class="dropdown-menu" role="menu"> |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | } elseif ($type == 'marine' || $type == 'tracker') { |
| 114 | 114 | ?> |
| 115 | 115 | <li class="dropdown"> |
| 116 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 116 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 117 | 117 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 118 | 118 | </a> |
| 119 | 119 | <ul class="dropdown-menu" role="menu"> |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | if (!isset($type) || $type == 'aircraft') { |
| 136 | 136 | ?> |
| 137 | 137 | <li class="dropdown"> |
| 138 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
| 138 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
| 139 | 139 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 140 | 140 | </a> |
| 141 | 141 | <ul class="dropdown-menu"> |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | </ul> |
| 147 | 147 | </li> |
| 148 | 148 | <li class="dropdown"> |
| 149 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 149 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 150 | 150 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 151 | 151 | </a> |
| 152 | 152 | <ul class="dropdown-menu" role="menu"> |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | </ul> |
| 157 | 157 | </li> |
| 158 | 158 | <li class="dropdown"> |
| 159 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 159 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 160 | 160 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 161 | 161 | </a> |
| 162 | 162 | <ul class="dropdown-menu" role="menu"> |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | </li> |
| 169 | 169 | <!-- |
| 170 | 170 | <li class="dropdown"> |
| 171 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 171 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 172 | 172 | <?php echo _("Route"); ?> <span class="caret"></span> |
| 173 | 173 | </a> |
| 174 | 174 | <ul class="dropdown-menu" role="menu"> |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | --> |
| 180 | 180 | <!-- |
| 181 | 181 | <li class="dropdown"> |
| 182 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 182 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 183 | 183 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 184 | 184 | </a> |
| 185 | 185 | <ul class="dropdown-menu" role="menu"> |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | ?> |
| 194 | 194 | <!-- |
| 195 | 195 | <li class="dropdown"> |
| 196 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 196 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 197 | 197 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
| 198 | 198 | </a> |
| 199 | 199 | <ul class="dropdown-menu" role="menu"> |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } elseif ($type == 'marine' || $type == 'tracker') { |
| 210 | 210 | ?> |
| 211 | 211 | <li class="dropdown"> |
| 212 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 212 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 213 | 213 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 214 | 214 | </a> |
| 215 | 215 | <ul class="dropdown-menu" role="menu"> |
@@ -4,7 +4,13 @@ discard block |
||
| 4 | 4 | <div class="stats_airline"> |
| 5 | 5 | |
| 6 | 6 | <form id="changedate" method="post"> |
| 7 | - <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" /> |
|
| 7 | + <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') { |
|
| 8 | + echo $year.'-'; |
|
| 9 | +} |
|
| 10 | +?><?php if (isset($month) && $month != '') { |
|
| 11 | + echo $month; |
|
| 12 | +} |
|
| 13 | +?>" /> |
|
| 8 | 14 | </form> |
| 9 | 15 | <?php |
| 10 | 16 | if (!isset($type) || $type == 'aircraft') { |
@@ -15,7 +21,9 @@ discard block |
||
| 15 | 21 | <?php |
| 16 | 22 | require_once('require/class.Stats.php'); |
| 17 | 23 | $Stats = new Stats(); |
| 18 | - if (!isset($filter_name)) $filter_name = ''; |
|
| 24 | + if (!isset($filter_name)) { |
|
| 25 | + $filter_name = ''; |
|
| 26 | + } |
|
| 19 | 27 | $airlines = $Stats->getAllAirlineNames($filter_name); |
| 20 | 28 | if (isset($airline_icao) && ($airline_icao == '' || $airline_icao == 'all')) { |
| 21 | 29 | print '<option value="all" selected>All</option>'; |
@@ -49,10 +57,22 @@ discard block |
||
| 49 | 57 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 50 | 58 | </a> |
| 51 | 59 | <ul class="dropdown-menu"> |
| 52 | - <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
| 53 | - <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li> |
|
| 54 | - <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
| 55 | - <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li> |
|
| 60 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 61 | + echo '/'.$airline_icao; |
|
| 62 | +} |
|
| 63 | +?>"><?php echo _("Aircraft"); ?></a></li> |
|
| 64 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 65 | + echo '/'.$airline_icao; |
|
| 66 | +} |
|
| 67 | +?>"><?php echo _("Registration"); ?></a></li> |
|
| 68 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 69 | + echo '/'.$airline_icao; |
|
| 70 | +} |
|
| 71 | +?>"><?php echo _("Manufacturer"); ?></a></li> |
|
| 72 | + <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 73 | + echo '/'.$airline_icao; |
|
| 74 | +} |
|
| 75 | +?>"><?php echo _("Country"); ?></a></li> |
|
| 56 | 76 | </ul> |
| 57 | 77 | </li> |
| 58 | 78 | <li class="dropdown"> |
@@ -60,9 +80,18 @@ discard block |
||
| 60 | 80 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 61 | 81 | </a> |
| 62 | 82 | <ul class="dropdown-menu" role="menu"> |
| 63 | - <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li> |
|
| 64 | - <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
| 65 | - <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li> |
|
| 83 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 84 | + echo '/'.$airline_icao; |
|
| 85 | +} |
|
| 86 | +?>"><?php echo _("Airline"); ?></a></li> |
|
| 87 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 88 | + echo '/'.$airline_icao; |
|
| 89 | +} |
|
| 90 | +?>"><?php echo _("Airline by Country"); ?></a></li> |
|
| 91 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 92 | + echo '/'.$airline_icao; |
|
| 93 | +} |
|
| 94 | +?>"><?php echo _("Callsign"); ?></a></li> |
|
| 66 | 95 | </ul> |
| 67 | 96 | </li> |
| 68 | 97 | <li class="dropdown"> |
@@ -70,10 +99,22 @@ discard block |
||
| 70 | 99 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 71 | 100 | </a> |
| 72 | 101 | <ul class="dropdown-menu" role="menu"> |
| 73 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
| 74 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
| 75 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
| 76 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
| 102 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 103 | + echo '/'.$airline_icao; |
|
| 104 | +} |
|
| 105 | +?>"><?php echo _("Departure Airport"); ?></a></li> |
|
| 106 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 107 | + echo '/'.$airline_icao; |
|
| 108 | +} |
|
| 109 | +?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
| 110 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 111 | + echo '/'.$airline_icao; |
|
| 112 | +} |
|
| 113 | +?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
| 114 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 115 | + echo '/'.$airline_icao; |
|
| 116 | +} |
|
| 117 | +?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
| 77 | 118 | </ul> |
| 78 | 119 | </li> |
| 79 | 120 | <li class="dropdown"> |
@@ -81,8 +122,14 @@ discard block |
||
| 81 | 122 | <?php echo _("Route"); ?> <span class="caret"></span> |
| 82 | 123 | </a> |
| 83 | 124 | <ul class="dropdown-menu" role="menu"> |
| 84 | - <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li> |
|
| 85 | - <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
| 125 | + <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 126 | + echo '/'.$airline_icao; |
|
| 127 | +} |
|
| 128 | +?>"><?php echo _("Route by Airport"); ?></a></li> |
|
| 129 | + <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 130 | + echo '/'.$airline_icao; |
|
| 131 | +} |
|
| 132 | +?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
| 86 | 133 | </ul> |
| 87 | 134 | </li> |
| 88 | 135 | <li class="dropdown"> |
@@ -90,8 +137,14 @@ discard block |
||
| 90 | 137 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 91 | 138 | </a> |
| 92 | 139 | <ul class="dropdown-menu" role="menu"> |
| 93 | - <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li> |
|
| 94 | - <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li> |
|
| 140 | + <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 141 | + echo '/'.$airline_icao; |
|
| 142 | +} |
|
| 143 | +?>"><?php echo _("Date"); ?></a></li> |
|
| 144 | + <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 145 | + echo '/'.$airline_icao; |
|
| 146 | +} |
|
| 147 | +?>"><?php echo _("Time"); ?></a></li> |
|
| 95 | 148 | </ul> |
| 96 | 149 | </li> |
| 97 | 150 | <?php |
@@ -139,9 +192,18 @@ discard block |
||
| 139 | 192 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 140 | 193 | </a> |
| 141 | 194 | <ul class="dropdown-menu"> |
| 142 | - <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
| 143 | - <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
| 144 | - <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
| 195 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 196 | + echo '/'.$airline_icao; |
|
| 197 | +} |
|
| 198 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
| 199 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 200 | + echo '/'.$airline_icao; |
|
| 201 | +} |
|
| 202 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
| 203 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 204 | + echo '/'.$airline_icao; |
|
| 205 | +} |
|
| 206 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
| 145 | 207 | <!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> --> |
| 146 | 208 | </ul> |
| 147 | 209 | </li> |
@@ -150,9 +212,18 @@ discard block |
||
| 150 | 212 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 151 | 213 | </a> |
| 152 | 214 | <ul class="dropdown-menu" role="menu"> |
| 153 | - <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
| 154 | - <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
| 155 | - <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
| 215 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 216 | + echo '/'.$airline_icao; |
|
| 217 | +} |
|
| 218 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
| 219 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 220 | + echo '/'.$airline_icao; |
|
| 221 | +} |
|
| 222 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
| 223 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 224 | + echo '/'.$airline_icao; |
|
| 225 | +} |
|
| 226 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
| 156 | 227 | </ul> |
| 157 | 228 | </li> |
| 158 | 229 | <li class="dropdown"> |
@@ -160,10 +231,22 @@ discard block |
||
| 160 | 231 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 161 | 232 | </a> |
| 162 | 233 | <ul class="dropdown-menu" role="menu"> |
| 163 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
| 164 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
| 165 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
| 166 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
| 234 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 235 | + echo '/'.$airline_icao; |
|
| 236 | +} |
|
| 237 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
| 238 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 239 | + echo '/'.$airline_icao; |
|
| 240 | +} |
|
| 241 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
| 242 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 243 | + echo '/'.$airline_icao; |
|
| 244 | +} |
|
| 245 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
| 246 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
| 247 | + echo '/'.$airline_icao; |
|
| 248 | +} |
|
| 249 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
| 167 | 250 | </ul> |
| 168 | 251 | </li> |
| 169 | 252 | <!-- |
@@ -4,7 +4,9 @@ discard block |
||
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | $Stats = new Stats(); |
| 6 | 6 | |
| 7 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 7 | +if (!isset($filter_name)) { |
|
| 8 | + $filter_name = ''; |
|
| 9 | +} |
|
| 8 | 10 | $type = 'aircraft'; |
| 9 | 11 | if (isset($_GET['marine'])) { |
| 10 | 12 | $type = 'marine'; |
@@ -21,8 +23,10 @@ discard block |
||
| 21 | 23 | } |
| 22 | 24 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 23 | 25 | if ($airline_icao == '' && isset($globalFilter)) { |
| 24 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 25 | -} |
|
| 26 | + if (isset($globalFilter['airline'])) { |
|
| 27 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 28 | + } |
|
| 29 | + } |
|
| 26 | 30 | |
| 27 | 31 | require_once('header.php'); |
| 28 | 32 | include('statistics-sub-menu.php'); |
@@ -16,11 +16,15 @@ discard block |
||
| 16 | 16 | $Tracker = new Tracker(); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if (!isset($filter_name)) $filter_name = ''; |
|
| 19 | +if (!isset($filter_name)) { |
|
| 20 | + $filter_name = ''; |
|
| 21 | +} |
|
| 20 | 22 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 21 | 23 | if ($airline_icao == '' && isset($globalFilter)) { |
| 22 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 23 | -} |
|
| 24 | + if (isset($globalFilter['airline'])) { |
|
| 25 | + $airline_icao = $globalFilter['airline'][0]; |
|
| 26 | + } |
|
| 27 | + } |
|
| 24 | 28 | |
| 25 | 29 | require_once('header.php'); |
| 26 | 30 | include('statistics-sub-menu.php'); |
@@ -33,9 +37,13 @@ discard block |
||
| 33 | 37 | </div> |
| 34 | 38 | <p>'._("Below is a list of the most common <strong>time of day</strong>.").'</p>'; |
| 35 | 39 | |
| 36 | -if ($type == 'aircraft') $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
| 37 | -elseif ($type == 'marine') $hour_array = $Marine->countAllHours('hour',true); |
|
| 38 | -elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('hour',true); |
|
| 40 | +if ($type == 'aircraft') { |
|
| 41 | + $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
| 42 | +} elseif ($type == 'marine') { |
|
| 43 | + $hour_array = $Marine->countAllHours('hour',true); |
|
| 44 | +} elseif ($type == 'tracker') { |
|
| 45 | + $hour_array = $Tracker->countAllHours('hour',true); |
|
| 46 | +} |
|
| 39 | 47 | print '<div id="chartHour" class="chart" width="100%"></div><script>'; |
| 40 | 48 | $hour_data = ''; |
| 41 | 49 | $hour_cnt = ''; |
@@ -53,9 +61,13 @@ discard block |
||
| 53 | 61 | axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});'; |
| 54 | 62 | print '</script>'; |
| 55 | 63 | |
| 56 | -if ($type == 'aircraft') $hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name); |
|
| 57 | -elseif ($type == 'marine') $hour_array = $Marine->countAllHours('count',true); |
|
| 58 | -elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('count',true); |
|
| 64 | +if ($type == 'aircraft') { |
|
| 65 | + $hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name); |
|
| 66 | +} elseif ($type == 'marine') { |
|
| 67 | + $hour_array = $Marine->countAllHours('count',true); |
|
| 68 | +} elseif ($type == 'tracker') { |
|
| 69 | + $hour_array = $Tracker->countAllHours('count',true); |
|
| 70 | +} |
|
| 59 | 71 | if (!empty($hour_array)) |
| 60 | 72 | { |
| 61 | 73 | print '<div class="table-responsive">'; |
@@ -11,10 +11,10 @@ discard block |
||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * Get SQL query part for filter used |
|
| 15 | - * @param Array $filter the filter |
|
| 16 | - * @return Array the SQL part |
|
| 17 | - */ |
|
| 14 | + * Get SQL query part for filter used |
|
| 15 | + * @param Array $filter the filter |
|
| 16 | + * @return Array the SQL part |
|
| 17 | + */ |
|
| 18 | 18 | |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * Executes the SQL statements to get the spotter information |
|
| 82 | - * |
|
| 83 | - * @param String $query the SQL query |
|
| 84 | - * @param Array $params parameter of the query |
|
| 85 | - * @param String $limitQuery the limit query |
|
| 86 | - * @return Array the spotter information |
|
| 87 | - * |
|
| 88 | - */ |
|
| 81 | + * Executes the SQL statements to get the spotter information |
|
| 82 | + * |
|
| 83 | + * @param String $query the SQL query |
|
| 84 | + * @param Array $params parameter of the query |
|
| 85 | + * @param String $limitQuery the limit query |
|
| 86 | + * @return Array the spotter information |
|
| 87 | + * |
|
| 88 | + */ |
|
| 89 | 89 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 90 | 90 | { |
| 91 | 91 | date_default_timezone_set('UTC'); |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | /** |
| 216 | - * Gets all the spotter information based on the latest data entry |
|
| 217 | - * |
|
| 218 | - * @return Array the spotter information |
|
| 219 | - * |
|
| 220 | - */ |
|
| 216 | + * Gets all the spotter information based on the latest data entry |
|
| 217 | + * |
|
| 218 | + * @return Array the spotter information |
|
| 219 | + * |
|
| 220 | + */ |
|
| 221 | 221 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
| 222 | 222 | { |
| 223 | 223 | global $global_query; |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
| 269 | - * Gets all the spotter information based on the callsign |
|
| 270 | - * |
|
| 271 | - * @return Array the spotter information |
|
| 272 | - * |
|
| 273 | - */ |
|
| 269 | + * Gets all the spotter information based on the callsign |
|
| 270 | + * |
|
| 271 | + * @return Array the spotter information |
|
| 272 | + * |
|
| 273 | + */ |
|
| 274 | 274 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 275 | 275 | { |
| 276 | 276 | global $global_query; |
@@ -381,12 +381,12 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | |
| 383 | 383 | /** |
| 384 | - * Gets all source name |
|
| 385 | - * |
|
| 386 | - * @param String type format of source |
|
| 387 | - * @return Array list of source name |
|
| 388 | - * |
|
| 389 | - */ |
|
| 384 | + * Gets all source name |
|
| 385 | + * |
|
| 386 | + * @param String type format of source |
|
| 387 | + * @return Array list of source name |
|
| 388 | + * |
|
| 389 | + */ |
|
| 390 | 390 | public function getAllSourceName($type = '',$filters = array()) |
| 391 | 391 | { |
| 392 | 392 | $filter_query = $this->getFilter($filters,true,true); |
@@ -416,11 +416,11 @@ discard block |
||
| 416 | 416 | |
| 417 | 417 | |
| 418 | 418 | /** |
| 419 | - * Gets a list of all idents/callsigns |
|
| 420 | - * |
|
| 421 | - * @return Array list of ident/callsign names |
|
| 422 | - * |
|
| 423 | - */ |
|
| 419 | + * Gets a list of all idents/callsigns |
|
| 420 | + * |
|
| 421 | + * @return Array list of ident/callsign names |
|
| 422 | + * |
|
| 423 | + */ |
|
| 424 | 424 | public function getAllIdents($filters = array()) |
| 425 | 425 | { |
| 426 | 426 | $filter_query = $this->getFilter($filters,true,true); |
@@ -444,11 +444,11 @@ discard block |
||
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | /** |
| 447 | - * Gets all info from a mmsi |
|
| 448 | - * |
|
| 449 | - * @return Array list of mmsi info |
|
| 450 | - * |
|
| 451 | - */ |
|
| 447 | + * Gets all info from a mmsi |
|
| 448 | + * |
|
| 449 | + * @return Array list of mmsi info |
|
| 450 | + * |
|
| 451 | + */ |
|
| 452 | 452 | public function getIdentity($mmsi) |
| 453 | 453 | { |
| 454 | 454 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -505,18 +505,18 @@ discard block |
||
| 505 | 505 | |
| 506 | 506 | |
| 507 | 507 | /** |
| 508 | - * Update ident tracker data |
|
| 509 | - * |
|
| 510 | - * @param String $fammarine_id the ID |
|
| 511 | - * @param String $ident the marine ident |
|
| 512 | - * @return String success or false |
|
| 513 | - * |
|
| 514 | - */ |
|
| 508 | + * Update ident tracker data |
|
| 509 | + * |
|
| 510 | + * @param String $fammarine_id the ID |
|
| 511 | + * @param String $ident the marine ident |
|
| 512 | + * @return String success or false |
|
| 513 | + * |
|
| 514 | + */ |
|
| 515 | 515 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
| 516 | 516 | { |
| 517 | 517 | |
| 518 | 518 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
| 519 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
| 519 | + $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
| 520 | 520 | |
| 521 | 521 | try { |
| 522 | 522 | $sth = $this->db->prepare($query); |
@@ -530,19 +530,19 @@ discard block |
||
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | /** |
| 533 | - * Update Status data |
|
| 534 | - * |
|
| 535 | - * @param String $fammarine_id the ID |
|
| 536 | - * @param String $status_id the marine status id |
|
| 537 | - * @param String $status the marine status |
|
| 538 | - * @return String success or false |
|
| 539 | - * |
|
| 540 | - */ |
|
| 533 | + * Update Status data |
|
| 534 | + * |
|
| 535 | + * @param String $fammarine_id the ID |
|
| 536 | + * @param String $status_id the marine status id |
|
| 537 | + * @param String $status the marine status |
|
| 538 | + * @return String success or false |
|
| 539 | + * |
|
| 540 | + */ |
|
| 541 | 541 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
| 542 | 542 | { |
| 543 | 543 | |
| 544 | 544 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
| 545 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 545 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 546 | 546 | |
| 547 | 547 | try { |
| 548 | 548 | $sth = $this->db->prepare($query); |
@@ -555,17 +555,17 @@ discard block |
||
| 555 | 555 | |
| 556 | 556 | } |
| 557 | 557 | /** |
| 558 | - * Update latest marine data |
|
| 559 | - * |
|
| 560 | - * @param String $fammarine_id the ID |
|
| 561 | - * @param String $ident the marine ident |
|
| 562 | - * @return String success or false |
|
| 563 | - * |
|
| 564 | - */ |
|
| 558 | + * Update latest marine data |
|
| 559 | + * |
|
| 560 | + * @param String $fammarine_id the ID |
|
| 561 | + * @param String $ident the marine ident |
|
| 562 | + * @return String success or false |
|
| 563 | + * |
|
| 564 | + */ |
|
| 565 | 565 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
| 566 | 566 | { |
| 567 | 567 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
| 568 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 568 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 569 | 569 | |
| 570 | 570 | try { |
| 571 | 571 | $sth = $this->db->prepare($query); |
@@ -579,30 +579,30 @@ discard block |
||
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | /** |
| 582 | - * Adds a new spotter data |
|
| 583 | - * |
|
| 584 | - * @param String $fammarine_id the ID |
|
| 585 | - * @param String $ident the marine ident |
|
| 586 | - * @param String $departure_airport_icao the departure airport |
|
| 587 | - * @param String $arrival_airport_icao the arrival airport |
|
| 588 | - * @param String $latitude latitude of flight |
|
| 589 | - * @param String $longitude latitude of flight |
|
| 590 | - * @param String $waypoints waypoints of flight |
|
| 591 | - * @param String $heading heading of flight |
|
| 592 | - * @param String $groundspeed speed of flight |
|
| 593 | - * @param String $date date of flight |
|
| 594 | - * @param String $departure_airport_time departure time of flight |
|
| 595 | - * @param String $arrival_airport_time arrival time of flight |
|
| 596 | - * @param String $squawk squawk code of flight |
|
| 597 | - * @param String $route_stop route stop of flight |
|
| 598 | - * @param String $highlight highlight or not |
|
| 599 | - * @param String $ModeS ModesS code of flight |
|
| 600 | - * @param String $registration registration code of flight |
|
| 601 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 602 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 603 | - * @param String $verticalrate vertival rate of flight |
|
| 604 | - * @return String success or false |
|
| 605 | - */ |
|
| 582 | + * Adds a new spotter data |
|
| 583 | + * |
|
| 584 | + * @param String $fammarine_id the ID |
|
| 585 | + * @param String $ident the marine ident |
|
| 586 | + * @param String $departure_airport_icao the departure airport |
|
| 587 | + * @param String $arrival_airport_icao the arrival airport |
|
| 588 | + * @param String $latitude latitude of flight |
|
| 589 | + * @param String $longitude latitude of flight |
|
| 590 | + * @param String $waypoints waypoints of flight |
|
| 591 | + * @param String $heading heading of flight |
|
| 592 | + * @param String $groundspeed speed of flight |
|
| 593 | + * @param String $date date of flight |
|
| 594 | + * @param String $departure_airport_time departure time of flight |
|
| 595 | + * @param String $arrival_airport_time arrival time of flight |
|
| 596 | + * @param String $squawk squawk code of flight |
|
| 597 | + * @param String $route_stop route stop of flight |
|
| 598 | + * @param String $highlight highlight or not |
|
| 599 | + * @param String $ModeS ModesS code of flight |
|
| 600 | + * @param String $registration registration code of flight |
|
| 601 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 602 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 603 | + * @param String $verticalrate vertival rate of flight |
|
| 604 | + * @return String success or false |
|
| 605 | + */ |
|
| 606 | 606 | public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '') |
| 607 | 607 | { |
| 608 | 608 | global $globalURL, $globalMarineImageFetch; |
@@ -699,13 +699,13 @@ discard block |
||
| 699 | 699 | unset($Image); |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | - if ($latitude == '' && $longitude == '') { |
|
| 703 | - $latitude = 0; |
|
| 704 | - $longitude = 0; |
|
| 705 | - } |
|
| 706 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 707 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 708 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 702 | + if ($latitude == '' && $longitude == '') { |
|
| 703 | + $latitude = 0; |
|
| 704 | + $longitude = 0; |
|
| 705 | + } |
|
| 706 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 707 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 708 | + if ($arrival_date == '') $arrival_date = NULL; |
|
| 709 | 709 | $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
| 710 | 710 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
| 711 | 711 | |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | $sth->execute($query_values); |
| 717 | 717 | $this->db = null; |
| 718 | 718 | } catch (PDOException $e) { |
| 719 | - return "error : ".$e->getMessage(); |
|
| 719 | + return "error : ".$e->getMessage(); |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | return "success"; |
@@ -725,11 +725,11 @@ discard block |
||
| 725 | 725 | |
| 726 | 726 | |
| 727 | 727 | /** |
| 728 | - * Gets the aircraft ident within the last hour |
|
| 729 | - * |
|
| 730 | - * @return String the ident |
|
| 731 | - * |
|
| 732 | - */ |
|
| 728 | + * Gets the aircraft ident within the last hour |
|
| 729 | + * |
|
| 730 | + * @return String the ident |
|
| 731 | + * |
|
| 732 | + */ |
|
| 733 | 733 | public function getIdentFromLastHour($ident) |
| 734 | 734 | { |
| 735 | 735 | global $globalDBdriver, $globalTimezone; |
@@ -745,11 +745,11 @@ discard block |
||
| 745 | 745 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 746 | 746 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
| 747 | 747 | $query_data = array(':ident' => $ident); |
| 748 | - } |
|
| 748 | + } |
|
| 749 | 749 | |
| 750 | 750 | $sth = $this->db->prepare($query); |
| 751 | 751 | $sth->execute($query_data); |
| 752 | - $ident_result=''; |
|
| 752 | + $ident_result=''; |
|
| 753 | 753 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 754 | 754 | { |
| 755 | 755 | $ident_result = $row['ident']; |
@@ -760,11 +760,11 @@ discard block |
||
| 760 | 760 | |
| 761 | 761 | |
| 762 | 762 | /** |
| 763 | - * Gets the aircraft data from the last 20 seconds |
|
| 764 | - * |
|
| 765 | - * @return Array the spotter data |
|
| 766 | - * |
|
| 767 | - */ |
|
| 763 | + * Gets the aircraft data from the last 20 seconds |
|
| 764 | + * |
|
| 765 | + * @return Array the spotter data |
|
| 766 | + * |
|
| 767 | + */ |
|
| 768 | 768 | public function getRealTimeData($q = '') |
| 769 | 769 | { |
| 770 | 770 | global $globalDBdriver; |
@@ -802,11 +802,11 @@ discard block |
||
| 802 | 802 | |
| 803 | 803 | |
| 804 | 804 | /** |
| 805 | - * Gets all number of flight over countries |
|
| 806 | - * |
|
| 807 | - * @return Array the airline country list |
|
| 808 | - * |
|
| 809 | - */ |
|
| 805 | + * Gets all number of flight over countries |
|
| 806 | + * |
|
| 807 | + * @return Array the airline country list |
|
| 808 | + * |
|
| 809 | + */ |
|
| 810 | 810 | |
| 811 | 811 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 812 | 812 | { |
@@ -879,11 +879,11 @@ discard block |
||
| 879 | 879 | |
| 880 | 880 | |
| 881 | 881 | /** |
| 882 | - * Gets all callsigns that have flown over |
|
| 883 | - * |
|
| 884 | - * @return Array the callsign list |
|
| 885 | - * |
|
| 886 | - */ |
|
| 882 | + * Gets all callsigns that have flown over |
|
| 883 | + * |
|
| 884 | + * @return Array the callsign list |
|
| 885 | + * |
|
| 886 | + */ |
|
| 887 | 887 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 888 | 888 | { |
| 889 | 889 | global $globalDBdriver; |
@@ -950,11 +950,11 @@ discard block |
||
| 950 | 950 | |
| 951 | 951 | |
| 952 | 952 | /** |
| 953 | - * Counts all dates |
|
| 954 | - * |
|
| 955 | - * @return Array the date list |
|
| 956 | - * |
|
| 957 | - */ |
|
| 953 | + * Counts all dates |
|
| 954 | + * |
|
| 955 | + * @return Array the date list |
|
| 956 | + * |
|
| 957 | + */ |
|
| 958 | 958 | public function countAllDates($filters = array()) |
| 959 | 959 | { |
| 960 | 960 | global $globalTimezone, $globalDBdriver; |
@@ -1000,11 +1000,11 @@ discard block |
||
| 1000 | 1000 | |
| 1001 | 1001 | |
| 1002 | 1002 | /** |
| 1003 | - * Counts all dates during the last 7 days |
|
| 1004 | - * |
|
| 1005 | - * @return Array the date list |
|
| 1006 | - * |
|
| 1007 | - */ |
|
| 1003 | + * Counts all dates during the last 7 days |
|
| 1004 | + * |
|
| 1005 | + * @return Array the date list |
|
| 1006 | + * |
|
| 1007 | + */ |
|
| 1008 | 1008 | public function countAllDatesLast7Days($filters = array()) |
| 1009 | 1009 | { |
| 1010 | 1010 | global $globalTimezone, $globalDBdriver; |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | $query .= " GROUP BY date_name |
| 1027 | 1027 | ORDER BY date_name ASC"; |
| 1028 | 1028 | $query_data = array(':offset' => $offset); |
| 1029 | - } |
|
| 1029 | + } |
|
| 1030 | 1030 | |
| 1031 | 1031 | $sth = $this->db->prepare($query); |
| 1032 | 1032 | $sth->execute($query_data); |
@@ -1046,11 +1046,11 @@ discard block |
||
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | /** |
| 1049 | - * Counts all dates during the last month |
|
| 1050 | - * |
|
| 1051 | - * @return Array the date list |
|
| 1052 | - * |
|
| 1053 | - */ |
|
| 1049 | + * Counts all dates during the last month |
|
| 1050 | + * |
|
| 1051 | + * @return Array the date list |
|
| 1052 | + * |
|
| 1053 | + */ |
|
| 1054 | 1054 | public function countAllDatesLastMonth($filters = array()) |
| 1055 | 1055 | { |
| 1056 | 1056 | global $globalTimezone, $globalDBdriver; |
@@ -1072,7 +1072,7 @@ discard block |
||
| 1072 | 1072 | $query .= " GROUP BY date_name |
| 1073 | 1073 | ORDER BY date_name ASC"; |
| 1074 | 1074 | $query_data = array(':offset' => $offset); |
| 1075 | - } |
|
| 1075 | + } |
|
| 1076 | 1076 | |
| 1077 | 1077 | $sth = $this->db->prepare($query); |
| 1078 | 1078 | $sth->execute($query_data); |
@@ -1094,11 +1094,11 @@ discard block |
||
| 1094 | 1094 | |
| 1095 | 1095 | |
| 1096 | 1096 | /** |
| 1097 | - * Counts all month |
|
| 1098 | - * |
|
| 1099 | - * @return Array the month list |
|
| 1100 | - * |
|
| 1101 | - */ |
|
| 1097 | + * Counts all month |
|
| 1098 | + * |
|
| 1099 | + * @return Array the month list |
|
| 1100 | + * |
|
| 1101 | + */ |
|
| 1102 | 1102 | public function countAllMonths($filters = array()) |
| 1103 | 1103 | { |
| 1104 | 1104 | global $globalTimezone, $globalDBdriver; |
@@ -1143,11 +1143,11 @@ discard block |
||
| 1143 | 1143 | |
| 1144 | 1144 | |
| 1145 | 1145 | /** |
| 1146 | - * Counts all dates during the last year |
|
| 1147 | - * |
|
| 1148 | - * @return Array the date list |
|
| 1149 | - * |
|
| 1150 | - */ |
|
| 1146 | + * Counts all dates during the last year |
|
| 1147 | + * |
|
| 1148 | + * @return Array the date list |
|
| 1149 | + * |
|
| 1150 | + */ |
|
| 1151 | 1151 | public function countAllMonthsLastYear($filters) |
| 1152 | 1152 | { |
| 1153 | 1153 | global $globalTimezone, $globalDBdriver; |
@@ -1169,7 +1169,7 @@ discard block |
||
| 1169 | 1169 | $query .= " GROUP BY year_name, month_name |
| 1170 | 1170 | ORDER BY year_name, month_name ASC"; |
| 1171 | 1171 | $query_data = array(':offset' => $offset); |
| 1172 | - } |
|
| 1172 | + } |
|
| 1173 | 1173 | |
| 1174 | 1174 | $sth = $this->db->prepare($query); |
| 1175 | 1175 | $sth->execute($query_data); |
@@ -1192,11 +1192,11 @@ discard block |
||
| 1192 | 1192 | |
| 1193 | 1193 | |
| 1194 | 1194 | /** |
| 1195 | - * Counts all hours |
|
| 1196 | - * |
|
| 1197 | - * @return Array the hour list |
|
| 1198 | - * |
|
| 1199 | - */ |
|
| 1195 | + * Counts all hours |
|
| 1196 | + * |
|
| 1197 | + * @return Array the hour list |
|
| 1198 | + * |
|
| 1199 | + */ |
|
| 1200 | 1200 | public function countAllHours($orderby,$filters = array()) |
| 1201 | 1201 | { |
| 1202 | 1202 | global $globalTimezone, $globalDBdriver; |
@@ -1259,11 +1259,11 @@ discard block |
||
| 1259 | 1259 | |
| 1260 | 1260 | |
| 1261 | 1261 | /** |
| 1262 | - * Counts all hours by date |
|
| 1263 | - * |
|
| 1264 | - * @return Array the hour list |
|
| 1265 | - * |
|
| 1266 | - */ |
|
| 1262 | + * Counts all hours by date |
|
| 1263 | + * |
|
| 1264 | + * @return Array the hour list |
|
| 1265 | + * |
|
| 1266 | + */ |
|
| 1267 | 1267 | public function countAllHoursByDate($date, $filters = array()) |
| 1268 | 1268 | { |
| 1269 | 1269 | global $globalTimezone, $globalDBdriver; |
@@ -1307,11 +1307,11 @@ discard block |
||
| 1307 | 1307 | |
| 1308 | 1308 | |
| 1309 | 1309 | /** |
| 1310 | - * Counts all hours by a ident/callsign |
|
| 1311 | - * |
|
| 1312 | - * @return Array the hour list |
|
| 1313 | - * |
|
| 1314 | - */ |
|
| 1310 | + * Counts all hours by a ident/callsign |
|
| 1311 | + * |
|
| 1312 | + * @return Array the hour list |
|
| 1313 | + * |
|
| 1314 | + */ |
|
| 1315 | 1315 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1316 | 1316 | { |
| 1317 | 1317 | global $globalTimezone, $globalDBdriver; |
@@ -1356,11 +1356,11 @@ discard block |
||
| 1356 | 1356 | |
| 1357 | 1357 | |
| 1358 | 1358 | /** |
| 1359 | - * Counts all vessels |
|
| 1360 | - * |
|
| 1361 | - * @return Integer the number of vessels |
|
| 1362 | - * |
|
| 1363 | - */ |
|
| 1359 | + * Counts all vessels |
|
| 1360 | + * |
|
| 1361 | + * @return Integer the number of vessels |
|
| 1362 | + * |
|
| 1363 | + */ |
|
| 1364 | 1364 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
| 1365 | 1365 | { |
| 1366 | 1366 | global $globalDBdriver; |
@@ -1395,11 +1395,11 @@ discard block |
||
| 1395 | 1395 | } |
| 1396 | 1396 | |
| 1397 | 1397 | /** |
| 1398 | - * Counts all vessel type |
|
| 1399 | - * |
|
| 1400 | - * @return Integer the number of vessels |
|
| 1401 | - * |
|
| 1402 | - */ |
|
| 1398 | + * Counts all vessel type |
|
| 1399 | + * |
|
| 1400 | + * @return Integer the number of vessels |
|
| 1401 | + * |
|
| 1402 | + */ |
|
| 1403 | 1403 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
| 1404 | 1404 | { |
| 1405 | 1405 | global $globalDBdriver; |
@@ -1434,11 +1434,11 @@ discard block |
||
| 1434 | 1434 | |
| 1435 | 1435 | |
| 1436 | 1436 | /** |
| 1437 | - * Counts all hours of today |
|
| 1438 | - * |
|
| 1439 | - * @return Array the hour list |
|
| 1440 | - * |
|
| 1441 | - */ |
|
| 1437 | + * Counts all hours of today |
|
| 1438 | + * |
|
| 1439 | + * @return Array the hour list |
|
| 1440 | + * |
|
| 1441 | + */ |
|
| 1442 | 1442 | public function countAllHoursFromToday($filters = array()) |
| 1443 | 1443 | { |
| 1444 | 1444 | global $globalTimezone, $globalDBdriver; |
@@ -1478,12 +1478,12 @@ discard block |
||
| 1478 | 1478 | } |
| 1479 | 1479 | |
| 1480 | 1480 | |
| 1481 | - /** |
|
| 1482 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1483 | - * |
|
| 1484 | - * @return Integer the Barrie Spotter ID |
|
| 1481 | + /** |
|
| 1482 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1483 | + * |
|
| 1484 | + * @return Integer the Barrie Spotter ID |
|
| 1485 | 1485 | q * |
| 1486 | - */ |
|
| 1486 | + */ |
|
| 1487 | 1487 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
| 1488 | 1488 | { |
| 1489 | 1489 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1504,13 +1504,13 @@ discard block |
||
| 1504 | 1504 | |
| 1505 | 1505 | |
| 1506 | 1506 | /** |
| 1507 | - * Parses a date string |
|
| 1508 | - * |
|
| 1509 | - * @param String $dateString the date string |
|
| 1510 | - * @param String $timezone the timezone of a user |
|
| 1511 | - * @return Array the time information |
|
| 1512 | - * |
|
| 1513 | - */ |
|
| 1507 | + * Parses a date string |
|
| 1508 | + * |
|
| 1509 | + * @param String $dateString the date string |
|
| 1510 | + * @param String $timezone the timezone of a user |
|
| 1511 | + * @return Array the time information |
|
| 1512 | + * |
|
| 1513 | + */ |
|
| 1514 | 1514 | public function parseDateString($dateString, $timezone = '') |
| 1515 | 1515 | { |
| 1516 | 1516 | $time_array = array(); |
@@ -1543,12 +1543,12 @@ discard block |
||
| 1543 | 1543 | } |
| 1544 | 1544 | |
| 1545 | 1545 | /** |
| 1546 | - * Parses the direction degrees to working |
|
| 1547 | - * |
|
| 1548 | - * @param Float $direction the direction in degrees |
|
| 1549 | - * @return Array the direction information |
|
| 1550 | - * |
|
| 1551 | - */ |
|
| 1546 | + * Parses the direction degrees to working |
|
| 1547 | + * |
|
| 1548 | + * @param Float $direction the direction in degrees |
|
| 1549 | + * @return Array the direction information |
|
| 1550 | + * |
|
| 1551 | + */ |
|
| 1552 | 1552 | public function parseDirection($direction = 0) |
| 1553 | 1553 | { |
| 1554 | 1554 | if ($direction == '') $direction = 0; |
@@ -1627,12 +1627,12 @@ discard block |
||
| 1627 | 1627 | |
| 1628 | 1628 | |
| 1629 | 1629 | /** |
| 1630 | - * Gets Country from latitude/longitude |
|
| 1631 | - * |
|
| 1632 | - * @param Float $latitude latitute of the flight |
|
| 1633 | - * @param Float $longitude longitute of the flight |
|
| 1634 | - * @return String the countrie |
|
| 1635 | - */ |
|
| 1630 | + * Gets Country from latitude/longitude |
|
| 1631 | + * |
|
| 1632 | + * @param Float $latitude latitute of the flight |
|
| 1633 | + * @param Float $longitude longitute of the flight |
|
| 1634 | + * @return String the countrie |
|
| 1635 | + */ |
|
| 1636 | 1636 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 1637 | 1637 | { |
| 1638 | 1638 | global $globalDBdriver, $globalDebug; |
@@ -1669,11 +1669,11 @@ discard block |
||
| 1669 | 1669 | } |
| 1670 | 1670 | |
| 1671 | 1671 | /** |
| 1672 | - * Gets Country from iso2 |
|
| 1673 | - * |
|
| 1674 | - * @param String $iso2 ISO2 country code |
|
| 1675 | - * @return String the countrie |
|
| 1676 | - */ |
|
| 1672 | + * Gets Country from iso2 |
|
| 1673 | + * |
|
| 1674 | + * @param String $iso2 ISO2 country code |
|
| 1675 | + * @return String the countrie |
|
| 1676 | + */ |
|
| 1677 | 1677 | public function getCountryFromISO2($iso2) |
| 1678 | 1678 | { |
| 1679 | 1679 | global $globalDBdriver, $globalDebug; |
@@ -1702,12 +1702,12 @@ discard block |
||
| 1702 | 1702 | |
| 1703 | 1703 | |
| 1704 | 1704 | /** |
| 1705 | - * Gets the short url from bit.ly |
|
| 1706 | - * |
|
| 1707 | - * @param String $url the full url |
|
| 1708 | - * @return String the bit.ly url |
|
| 1709 | - * |
|
| 1710 | - */ |
|
| 1705 | + * Gets the short url from bit.ly |
|
| 1706 | + * |
|
| 1707 | + * @param String $url the full url |
|
| 1708 | + * @return String the bit.ly url |
|
| 1709 | + * |
|
| 1710 | + */ |
|
| 1711 | 1711 | public function getBitlyURL($url) |
| 1712 | 1712 | { |
| 1713 | 1713 | global $globalBitlyAccessToken; |
@@ -1734,11 +1734,11 @@ discard block |
||
| 1734 | 1734 | |
| 1735 | 1735 | |
| 1736 | 1736 | /** |
| 1737 | - * Gets all vessels types that have flown over |
|
| 1738 | - * |
|
| 1739 | - * @return Array the vessel type list |
|
| 1740 | - * |
|
| 1741 | - */ |
|
| 1737 | + * Gets all vessels types that have flown over |
|
| 1738 | + * |
|
| 1739 | + * @return Array the vessel type list |
|
| 1740 | + * |
|
| 1741 | + */ |
|
| 1742 | 1742 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 1743 | 1743 | { |
| 1744 | 1744 | global $globalDBdriver; |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 3 | 3 | $global_query = "SELECT marine_output.* FROM marine_output"; |
| 4 | 4 | |
| 5 | -class Marine{ |
|
| 5 | +class Marine { |
|
| 6 | 6 | public $db; |
| 7 | 7 | |
| 8 | 8 | public function __construct($dbc = null) { |
@@ -16,33 +16,33 @@ discard block |
||
| 16 | 16 | * @return Array the SQL part |
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 21 | 21 | $filters = array(); |
| 22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
| 25 | 25 | } else { |
| 26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | if (isset($filter[0]['source'])) { |
| 30 | - $filters = array_merge($filters,$filter); |
|
| 30 | + $filters = array_merge($filters, $filter); |
|
| 31 | 31 | } |
| 32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 32 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 33 | 33 | $filter_query_join = ''; |
| 34 | 34 | $filter_query_where = ''; |
| 35 | - foreach($filters as $flt) { |
|
| 35 | + foreach ($filters as $flt) { |
|
| 36 | 36 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 37 | 37 | if (isset($flt['source'])) { |
| 38 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
| 38 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
| 39 | 39 | } else { |
| 40 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
| 40 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | 44 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 45 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 45 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 46 | 46 | } |
| 47 | 47 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 48 | 48 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 72 | 72 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 73 | 73 | if ($filter_query_where != '') { |
| 74 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 74 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 75 | 75 | } |
| 76 | 76 | $filter_query = $filter_query_join.$filter_query_where; |
| 77 | 77 | return $filter_query; |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | * @return Array the spotter information |
| 87 | 87 | * |
| 88 | 88 | */ |
| 89 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 89 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 90 | 90 | { |
| 91 | 91 | date_default_timezone_set('UTC'); |
| 92 | 92 | if (!is_string($query)) |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | $sth = $this->db->prepare($query.$limitQuery); |
| 107 | 107 | $sth->execute($params); |
| 108 | 108 | } catch (PDOException $e) { |
| 109 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 109 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 110 | 110 | exit(); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $num_rows = 0; |
| 114 | 114 | $spotter_array = array(); |
| 115 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 115 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 116 | 116 | { |
| 117 | 117 | $num_rows++; |
| 118 | 118 | $temp_array = array(); |
@@ -144,10 +144,10 @@ discard block |
||
| 144 | 144 | } |
| 145 | 145 | if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
| 146 | 146 | |
| 147 | - if($temp_array['mmsi'] != "") |
|
| 147 | + if ($temp_array['mmsi'] != "") |
|
| 148 | 148 | { |
| 149 | 149 | $Image = new Image($this->db); |
| 150 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
| 150 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']); |
|
| 151 | 151 | else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
| 152 | 152 | unset($Image); |
| 153 | 153 | if (count($image_array) > 0) { |
@@ -183,17 +183,17 @@ discard block |
||
| 183 | 183 | { |
| 184 | 184 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 185 | 185 | } else { |
| 186 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 186 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 187 | 187 | } |
| 188 | 188 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 189 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 190 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 189 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 190 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 191 | 191 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 192 | 192 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
| 193 | 193 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
| 194 | 194 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
| 195 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
| 196 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
| 195 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
| 196 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
| 197 | 197 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -226,8 +226,8 @@ discard block |
||
| 226 | 226 | if ($limit != "") |
| 227 | 227 | { |
| 228 | 228 | $limit_array = explode(",", $limit); |
| 229 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 230 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 229 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 230 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 231 | 231 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 232 | 232 | { |
| 233 | 233 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | } else { |
| 242 | 242 | $orderby_query = " ORDER BY marine_output.date DESC"; |
| 243 | 243 | } |
| 244 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 245 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 244 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 245 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 246 | 246 | return $spotter_array; |
| 247 | 247 | } |
| 248 | 248 | |
@@ -260,8 +260,8 @@ discard block |
||
| 260 | 260 | if ($id == '') return array(); |
| 261 | 261 | $additional_query = "marine_output.fammarine_id = :id"; |
| 262 | 262 | $query_values = array(':id' => $id); |
| 263 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 264 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 263 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 264 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 265 | 265 | return $spotter_array; |
| 266 | 266 | } |
| 267 | 267 | |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $query_values = array(); |
| 281 | 281 | $limit_query = ''; |
| 282 | 282 | $additional_query = ''; |
| 283 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 283 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 284 | 284 | if ($ident != "") |
| 285 | 285 | { |
| 286 | 286 | if (!is_string($ident)) |
@@ -296,8 +296,8 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | $limit_array = explode(",", $limit); |
| 298 | 298 | |
| 299 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 300 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 299 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 300 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 301 | 301 | |
| 302 | 302 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 303 | 303 | { |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | return $spotter_array; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - public function getMarineDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 324 | + public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 325 | 325 | { |
| 326 | 326 | global $global_query, $globalTimezone, $globalDBdriver; |
| 327 | 327 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $limit_query = ''; |
| 330 | 330 | $additional_query = ''; |
| 331 | 331 | |
| 332 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 332 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 333 | 333 | |
| 334 | 334 | if ($date != "") |
| 335 | 335 | { |
@@ -355,8 +355,8 @@ discard block |
||
| 355 | 355 | { |
| 356 | 356 | $limit_array = explode(",", $limit); |
| 357 | 357 | |
| 358 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 359 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 358 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 359 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 360 | 360 | |
| 361 | 361 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 362 | 362 | { |
@@ -387,11 +387,11 @@ discard block |
||
| 387 | 387 | * @return Array list of source name |
| 388 | 388 | * |
| 389 | 389 | */ |
| 390 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 390 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 391 | 391 | { |
| 392 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 392 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 393 | 393 | $query_values = array(); |
| 394 | - $query = "SELECT DISTINCT marine_output.source_name |
|
| 394 | + $query = "SELECT DISTINCT marine_output.source_name |
|
| 395 | 395 | FROM marine_output".$filter_query." marine_output.source_name <> ''"; |
| 396 | 396 | if ($type != '') { |
| 397 | 397 | $query_values = array(':type' => $type); |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | $source_array = array(); |
| 407 | 407 | $temp_array = array(); |
| 408 | 408 | |
| 409 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 409 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 410 | 410 | { |
| 411 | 411 | $temp_array['source_name'] = $row['source_name']; |
| 412 | 412 | $source_array[] = $temp_array; |
@@ -423,8 +423,8 @@ discard block |
||
| 423 | 423 | */ |
| 424 | 424 | public function getAllIdents($filters = array()) |
| 425 | 425 | { |
| 426 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 427 | - $query = "SELECT DISTINCT marine_output.ident |
|
| 426 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 427 | + $query = "SELECT DISTINCT marine_output.ident |
|
| 428 | 428 | FROM marine_output".$filter_query." marine_output.ident <> '' |
| 429 | 429 | ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0"; |
| 430 | 430 | |
@@ -434,7 +434,7 @@ discard block |
||
| 434 | 434 | $ident_array = array(); |
| 435 | 435 | $temp_array = array(); |
| 436 | 436 | |
| 437 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 437 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 438 | 438 | { |
| 439 | 439 | $temp_array['ident'] = $row['ident']; |
| 440 | 440 | $ident_array[] = $temp_array; |
@@ -451,7 +451,7 @@ discard block |
||
| 451 | 451 | */ |
| 452 | 452 | public function getIdentity($mmsi) |
| 453 | 453 | { |
| 454 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
| 454 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
| 455 | 455 | $query = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1"; |
| 456 | 456 | $sth = $this->db->prepare($query); |
| 457 | 457 | $sth->execute(array(':mmsi' => $mmsi)); |
@@ -476,12 +476,12 @@ discard block |
||
| 476 | 476 | } else $offset = '+00:00'; |
| 477 | 477 | |
| 478 | 478 | if ($globalDBdriver == 'mysql') { |
| 479 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
| 479 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
| 480 | 480 | FROM marine_output |
| 481 | 481 | WHERE marine_output.date <> '' |
| 482 | 482 | ORDER BY marine_output.date ASC LIMIT 0,200"; |
| 483 | 483 | } else { |
| 484 | - $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 484 | + $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 485 | 485 | FROM marine_output |
| 486 | 486 | WHERE marine_output.date <> '' |
| 487 | 487 | ORDER BY marine_output.date ASC LIMIT 0,200"; |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | $date_array = array(); |
| 494 | 494 | $temp_array = array(); |
| 495 | 495 | |
| 496 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 496 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 497 | 497 | { |
| 498 | 498 | $temp_array['date'] = $row['date']; |
| 499 | 499 | |
@@ -512,11 +512,11 @@ discard block |
||
| 512 | 512 | * @return String success or false |
| 513 | 513 | * |
| 514 | 514 | */ |
| 515 | - public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
|
| 515 | + public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL) |
|
| 516 | 516 | { |
| 517 | 517 | |
| 518 | 518 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
| 519 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
| 519 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident); |
|
| 520 | 520 | |
| 521 | 521 | try { |
| 522 | 522 | $sth = $this->db->prepare($query); |
@@ -538,11 +538,11 @@ discard block |
||
| 538 | 538 | * @return String success or false |
| 539 | 539 | * |
| 540 | 540 | */ |
| 541 | - public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
|
| 541 | + public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '') |
|
| 542 | 542 | { |
| 543 | 543 | |
| 544 | 544 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
| 545 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 545 | + $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id); |
|
| 546 | 546 | |
| 547 | 547 | try { |
| 548 | 548 | $sth = $this->db->prepare($query); |
@@ -565,7 +565,7 @@ discard block |
||
| 565 | 565 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
| 566 | 566 | { |
| 567 | 567 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
| 568 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 568 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
| 569 | 569 | |
| 570 | 570 | try { |
| 571 | 571 | $sth = $this->db->prepare($query); |
@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | * @param String $verticalrate vertival rate of flight |
| 604 | 604 | * @return String success or false |
| 605 | 605 | */ |
| 606 | - public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '') |
|
| 606 | + public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $format_source = '', $source_name = '') |
|
| 607 | 607 | { |
| 608 | 608 | global $globalURL, $globalMarineImageFetch; |
| 609 | 609 | |
@@ -670,31 +670,31 @@ discard block |
||
| 670 | 670 | } |
| 671 | 671 | |
| 672 | 672 | |
| 673 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
| 673 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
| 674 | 674 | { |
| 675 | 675 | $date = date("Y-m-d H:i:s", time()); |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
| 679 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 680 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 681 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 682 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 683 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 684 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 685 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
| 686 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 687 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
| 688 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
| 689 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 690 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
| 691 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
| 678 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
| 679 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 680 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 681 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 682 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 683 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 684 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 685 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
| 686 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 687 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
| 688 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
| 689 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 690 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
| 691 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
| 692 | 692 | |
| 693 | 693 | if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) { |
| 694 | 694 | $Image = new Image($this->db); |
| 695 | - $image_array = $Image->getMarineImage($mmsi,$imo,$ident); |
|
| 695 | + $image_array = $Image->getMarineImage($mmsi, $imo, $ident); |
|
| 696 | 696 | if (!isset($image_array[0]['mmsi'])) { |
| 697 | - $Image->addMarineImage($mmsi,$imo,$ident); |
|
| 697 | + $Image->addMarineImage($mmsi, $imo, $ident); |
|
| 698 | 698 | } |
| 699 | 699 | unset($Image); |
| 700 | 700 | } |
@@ -706,10 +706,10 @@ discard block |
||
| 706 | 706 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 707 | 707 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 708 | 708 | if ($arrival_date == '') $arrival_date = NULL; |
| 709 | - $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
|
| 709 | + $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
|
| 710 | 710 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
| 711 | 711 | |
| 712 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date); |
|
| 712 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date); |
|
| 713 | 713 | try { |
| 714 | 714 | |
| 715 | 715 | $sth = $this->db->prepare($query); |
@@ -734,13 +734,13 @@ discard block |
||
| 734 | 734 | { |
| 735 | 735 | global $globalDBdriver, $globalTimezone; |
| 736 | 736 | if ($globalDBdriver == 'mysql') { |
| 737 | - $query = "SELECT marine_output.ident FROM marine_output |
|
| 737 | + $query = "SELECT marine_output.ident FROM marine_output |
|
| 738 | 738 | WHERE marine_output.ident = :ident |
| 739 | 739 | AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 740 | 740 | AND marine_output.date < UTC_TIMESTAMP()"; |
| 741 | 741 | $query_data = array(':ident' => $ident); |
| 742 | 742 | } else { |
| 743 | - $query = "SELECT marine_output.ident FROM marine_output |
|
| 743 | + $query = "SELECT marine_output.ident FROM marine_output |
|
| 744 | 744 | WHERE marine_output.ident = :ident |
| 745 | 745 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 746 | 746 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -749,8 +749,8 @@ discard block |
||
| 749 | 749 | |
| 750 | 750 | $sth = $this->db->prepare($query); |
| 751 | 751 | $sth->execute($query_data); |
| 752 | - $ident_result=''; |
|
| 753 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 752 | + $ident_result = ''; |
|
| 753 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 754 | 754 | { |
| 755 | 755 | $ident_result = $row['ident']; |
| 756 | 756 | } |
@@ -776,8 +776,8 @@ discard block |
||
| 776 | 776 | return false; |
| 777 | 777 | } else { |
| 778 | 778 | $q_array = explode(" ", $q); |
| 779 | - foreach ($q_array as $q_item){ |
|
| 780 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 779 | + foreach ($q_array as $q_item) { |
|
| 780 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 781 | 781 | $additional_query .= " AND ("; |
| 782 | 782 | $additional_query .= "(marine_output.ident like '%".$q_item."%')"; |
| 783 | 783 | $additional_query .= ")"; |
@@ -785,11 +785,11 @@ discard block |
||
| 785 | 785 | } |
| 786 | 786 | } |
| 787 | 787 | if ($globalDBdriver == 'mysql') { |
| 788 | - $query = "SELECT marine_output.* FROM marine_output |
|
| 788 | + $query = "SELECT marine_output.* FROM marine_output |
|
| 789 | 789 | WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 790 | 790 | AND marine_output.date < UTC_TIMESTAMP()"; |
| 791 | 791 | } else { |
| 792 | - $query = "SELECT marine_output.* FROM marine_output |
|
| 792 | + $query = "SELECT marine_output.* FROM marine_output |
|
| 793 | 793 | WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 794 | 794 | AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 795 | 795 | } |
@@ -808,16 +808,16 @@ discard block |
||
| 808 | 808 | * |
| 809 | 809 | */ |
| 810 | 810 | |
| 811 | - public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 811 | + public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 812 | 812 | { |
| 813 | 813 | global $globalDBdriver, $globalArchive; |
| 814 | 814 | //$filter_query = $this->getFilter($filters,true,true); |
| 815 | - $Connection= new Connection($this->db); |
|
| 815 | + $Connection = new Connection($this->db); |
|
| 816 | 816 | if (!$Connection->tableExists('countries')) return array(); |
| 817 | 817 | require_once('class.SpotterLive.php'); |
| 818 | 818 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
| 819 | 819 | $MarineLive = new MarineLive(); |
| 820 | - $filter_query = $MarineLive->getFilter($filters,true,true); |
|
| 820 | + $filter_query = $MarineLive->getFilter($filters, true, true); |
|
| 821 | 821 | $filter_query .= ' over_country IS NOT NULL'; |
| 822 | 822 | if ($olderthanmonths > 0) { |
| 823 | 823 | if ($globalDBdriver == 'mysql') { |
@@ -837,7 +837,7 @@ discard block |
||
| 837 | 837 | } else { |
| 838 | 838 | require_once(dirname(__FILE__)."/class.MarineArchive.php"); |
| 839 | 839 | $MarineArchive = new MarineArchive(); |
| 840 | - $filter_query = $MarineArchive->getFilter($filters,true,true); |
|
| 840 | + $filter_query = $MarineArchive->getFilter($filters, true, true); |
|
| 841 | 841 | $filter_query .= ' over_country IS NOT NULL'; |
| 842 | 842 | if ($olderthanmonths > 0) { |
| 843 | 843 | if ($globalDBdriver == 'mysql') { |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | $flight_array = array(); |
| 866 | 866 | $temp_array = array(); |
| 867 | 867 | |
| 868 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 868 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 869 | 869 | { |
| 870 | 870 | $temp_array['flight_count'] = $row['nb']; |
| 871 | 871 | $temp_array['flight_country'] = $row['name']; |
@@ -884,11 +884,11 @@ discard block |
||
| 884 | 884 | * @return Array the callsign list |
| 885 | 885 | * |
| 886 | 886 | */ |
| 887 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 887 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 888 | 888 | { |
| 889 | 889 | global $globalDBdriver; |
| 890 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 891 | - $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
| 890 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 891 | + $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
| 892 | 892 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
| 893 | 893 | if ($olderthanmonths > 0) { |
| 894 | 894 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -902,28 +902,28 @@ discard block |
||
| 902 | 902 | if ($year != '') { |
| 903 | 903 | if ($globalDBdriver == 'mysql') { |
| 904 | 904 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 905 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 905 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 906 | 906 | } else { |
| 907 | 907 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 908 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 908 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 909 | 909 | } |
| 910 | 910 | } |
| 911 | 911 | if ($month != '') { |
| 912 | 912 | if ($globalDBdriver == 'mysql') { |
| 913 | 913 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 914 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 914 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 915 | 915 | } else { |
| 916 | 916 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 917 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 917 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 918 | 918 | } |
| 919 | 919 | } |
| 920 | 920 | if ($day != '') { |
| 921 | 921 | if ($globalDBdriver == 'mysql') { |
| 922 | 922 | $query .= " AND DAY(marine_output.date) = :day"; |
| 923 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 923 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 924 | 924 | } else { |
| 925 | 925 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
| 926 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 926 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 927 | 927 | } |
| 928 | 928 | } |
| 929 | 929 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -935,7 +935,7 @@ discard block |
||
| 935 | 935 | $callsign_array = array(); |
| 936 | 936 | $temp_array = array(); |
| 937 | 937 | |
| 938 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 938 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 939 | 939 | { |
| 940 | 940 | $temp_array['callsign_icao'] = $row['ident']; |
| 941 | 941 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | $date_array = array(); |
| 988 | 988 | $temp_array = array(); |
| 989 | 989 | |
| 990 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 990 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 991 | 991 | { |
| 992 | 992 | $temp_array['date_name'] = $row['date_name']; |
| 993 | 993 | $temp_array['date_count'] = $row['date_count']; |
@@ -1013,7 +1013,7 @@ discard block |
||
| 1013 | 1013 | $datetime = new DateTime(); |
| 1014 | 1014 | $offset = $datetime->format('P'); |
| 1015 | 1015 | } else $offset = '+00:00'; |
| 1016 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1016 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1017 | 1017 | if ($globalDBdriver == 'mysql') { |
| 1018 | 1018 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 1019 | 1019 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | $date_array = array(); |
| 1035 | 1035 | $temp_array = array(); |
| 1036 | 1036 | |
| 1037 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1037 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1038 | 1038 | { |
| 1039 | 1039 | $temp_array['date_name'] = $row['date_name']; |
| 1040 | 1040 | $temp_array['date_count'] = $row['date_count']; |
@@ -1059,7 +1059,7 @@ discard block |
||
| 1059 | 1059 | $datetime = new DateTime(); |
| 1060 | 1060 | $offset = $datetime->format('P'); |
| 1061 | 1061 | } else $offset = '+00:00'; |
| 1062 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1062 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1063 | 1063 | if ($globalDBdriver == 'mysql') { |
| 1064 | 1064 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 1065 | 1065 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | $date_array = array(); |
| 1081 | 1081 | $temp_array = array(); |
| 1082 | 1082 | |
| 1083 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1083 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1084 | 1084 | { |
| 1085 | 1085 | $temp_array['date_name'] = $row['date_name']; |
| 1086 | 1086 | $temp_array['date_count'] = $row['date_count']; |
@@ -1127,7 +1127,7 @@ discard block |
||
| 1127 | 1127 | $date_array = array(); |
| 1128 | 1128 | $temp_array = array(); |
| 1129 | 1129 | |
| 1130 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1130 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1131 | 1131 | { |
| 1132 | 1132 | $temp_array['month_name'] = $row['month_name']; |
| 1133 | 1133 | $temp_array['year_name'] = $row['year_name']; |
@@ -1156,7 +1156,7 @@ discard block |
||
| 1156 | 1156 | $datetime = new DateTime(); |
| 1157 | 1157 | $offset = $datetime->format('P'); |
| 1158 | 1158 | } else $offset = '+00:00'; |
| 1159 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1159 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1160 | 1160 | if ($globalDBdriver == 'mysql') { |
| 1161 | 1161 | $query = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 1162 | 1162 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1177,7 +1177,7 @@ discard block |
||
| 1177 | 1177 | $date_array = array(); |
| 1178 | 1178 | $temp_array = array(); |
| 1179 | 1179 | |
| 1180 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1180 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1181 | 1181 | { |
| 1182 | 1182 | $temp_array['year_name'] = $row['year_name']; |
| 1183 | 1183 | $temp_array['month_name'] = $row['month_name']; |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | * @return Array the hour list |
| 1198 | 1198 | * |
| 1199 | 1199 | */ |
| 1200 | - public function countAllHours($orderby,$filters = array()) |
|
| 1200 | + public function countAllHours($orderby, $filters = array()) |
|
| 1201 | 1201 | { |
| 1202 | 1202 | global $globalTimezone, $globalDBdriver; |
| 1203 | 1203 | if ($globalTimezone != '') { |
@@ -1245,7 +1245,7 @@ discard block |
||
| 1245 | 1245 | $hour_array = array(); |
| 1246 | 1246 | $temp_array = array(); |
| 1247 | 1247 | |
| 1248 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1248 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1249 | 1249 | { |
| 1250 | 1250 | $temp_array['hour_name'] = $row['hour_name']; |
| 1251 | 1251 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1267,8 +1267,8 @@ discard block |
||
| 1267 | 1267 | public function countAllHoursByDate($date, $filters = array()) |
| 1268 | 1268 | { |
| 1269 | 1269 | global $globalTimezone, $globalDBdriver; |
| 1270 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1271 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 1270 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1271 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 1272 | 1272 | if ($globalTimezone != '') { |
| 1273 | 1273 | date_default_timezone_set($globalTimezone); |
| 1274 | 1274 | $datetime = new DateTime($date); |
@@ -1276,12 +1276,12 @@ discard block |
||
| 1276 | 1276 | } else $offset = '+00:00'; |
| 1277 | 1277 | |
| 1278 | 1278 | if ($globalDBdriver == 'mysql') { |
| 1279 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1279 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1280 | 1280 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date |
| 1281 | 1281 | GROUP BY hour_name |
| 1282 | 1282 | ORDER BY hour_name ASC"; |
| 1283 | 1283 | } else { |
| 1284 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1284 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1285 | 1285 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 1286 | 1286 | GROUP BY hour_name |
| 1287 | 1287 | ORDER BY hour_name ASC"; |
@@ -1293,7 +1293,7 @@ discard block |
||
| 1293 | 1293 | $hour_array = array(); |
| 1294 | 1294 | $temp_array = array(); |
| 1295 | 1295 | |
| 1296 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1296 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1297 | 1297 | { |
| 1298 | 1298 | $temp_array['hour_name'] = $row['hour_name']; |
| 1299 | 1299 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1315,8 +1315,8 @@ discard block |
||
| 1315 | 1315 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1316 | 1316 | { |
| 1317 | 1317 | global $globalTimezone, $globalDBdriver; |
| 1318 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1319 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1318 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1319 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1320 | 1320 | if ($globalTimezone != '') { |
| 1321 | 1321 | date_default_timezone_set($globalTimezone); |
| 1322 | 1322 | $datetime = new DateTime(); |
@@ -1324,12 +1324,12 @@ discard block |
||
| 1324 | 1324 | } else $offset = '+00:00'; |
| 1325 | 1325 | |
| 1326 | 1326 | if ($globalDBdriver == 'mysql') { |
| 1327 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1327 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1328 | 1328 | FROM marine_output".$filter_query." marine_output.ident = :ident |
| 1329 | 1329 | GROUP BY hour_name |
| 1330 | 1330 | ORDER BY hour_name ASC"; |
| 1331 | 1331 | } else { |
| 1332 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1332 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1333 | 1333 | FROM marine_output".$filter_query." marine_output.ident = :ident |
| 1334 | 1334 | GROUP BY hour_name |
| 1335 | 1335 | ORDER BY hour_name ASC"; |
@@ -1337,12 +1337,12 @@ discard block |
||
| 1337 | 1337 | |
| 1338 | 1338 | |
| 1339 | 1339 | $sth = $this->db->prepare($query); |
| 1340 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 1340 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 1341 | 1341 | |
| 1342 | 1342 | $hour_array = array(); |
| 1343 | 1343 | $temp_array = array(); |
| 1344 | 1344 | |
| 1345 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1345 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1346 | 1346 | { |
| 1347 | 1347 | $temp_array['hour_name'] = $row['hour_name']; |
| 1348 | 1348 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1361,33 +1361,33 @@ discard block |
||
| 1361 | 1361 | * @return Integer the number of vessels |
| 1362 | 1362 | * |
| 1363 | 1363 | */ |
| 1364 | - public function countOverallMarine($filters = array(),$year = '',$month = '') |
|
| 1364 | + public function countOverallMarine($filters = array(), $year = '', $month = '') |
|
| 1365 | 1365 | { |
| 1366 | 1366 | global $globalDBdriver; |
| 1367 | 1367 | //$queryi = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output"; |
| 1368 | - $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
| 1368 | + $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
| 1369 | 1369 | $query_values = array(); |
| 1370 | 1370 | $query = ''; |
| 1371 | 1371 | if ($year != '') { |
| 1372 | 1372 | if ($globalDBdriver == 'mysql') { |
| 1373 | 1373 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 1374 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1374 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1375 | 1375 | } else { |
| 1376 | 1376 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 1377 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1377 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1378 | 1378 | } |
| 1379 | 1379 | } |
| 1380 | 1380 | if ($month != '') { |
| 1381 | 1381 | if ($globalDBdriver == 'mysql') { |
| 1382 | 1382 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 1383 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1383 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1384 | 1384 | } else { |
| 1385 | 1385 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 1386 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1386 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1387 | 1387 | } |
| 1388 | 1388 | } |
| 1389 | 1389 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 1390 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1390 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 1391 | 1391 | |
| 1392 | 1392 | $sth = $this->db->prepare($queryi); |
| 1393 | 1393 | $sth->execute($query_values); |
@@ -1400,32 +1400,32 @@ discard block |
||
| 1400 | 1400 | * @return Integer the number of vessels |
| 1401 | 1401 | * |
| 1402 | 1402 | */ |
| 1403 | - public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
|
| 1403 | + public function countOverallMarineTypes($filters = array(), $year = '', $month = '') |
|
| 1404 | 1404 | { |
| 1405 | 1405 | global $globalDBdriver; |
| 1406 | - $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
| 1406 | + $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
| 1407 | 1407 | $query_values = array(); |
| 1408 | 1408 | $query = ''; |
| 1409 | 1409 | if ($year != '') { |
| 1410 | 1410 | if ($globalDBdriver == 'mysql') { |
| 1411 | 1411 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 1412 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1412 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1413 | 1413 | } else { |
| 1414 | 1414 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 1415 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1415 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1416 | 1416 | } |
| 1417 | 1417 | } |
| 1418 | 1418 | if ($month != '') { |
| 1419 | 1419 | if ($globalDBdriver == 'mysql') { |
| 1420 | 1420 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 1421 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1421 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1422 | 1422 | } else { |
| 1423 | 1423 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 1424 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1424 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1425 | 1425 | } |
| 1426 | 1426 | } |
| 1427 | 1427 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 1428 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1428 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 1429 | 1429 | |
| 1430 | 1430 | $sth = $this->db->prepare($queryi); |
| 1431 | 1431 | $sth->execute($query_values); |
@@ -1442,7 +1442,7 @@ discard block |
||
| 1442 | 1442 | public function countAllHoursFromToday($filters = array()) |
| 1443 | 1443 | { |
| 1444 | 1444 | global $globalTimezone, $globalDBdriver; |
| 1445 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1445 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1446 | 1446 | if ($globalTimezone != '') { |
| 1447 | 1447 | date_default_timezone_set($globalTimezone); |
| 1448 | 1448 | $datetime = new DateTime(); |
@@ -1450,12 +1450,12 @@ discard block |
||
| 1450 | 1450 | } else $offset = '+00:00'; |
| 1451 | 1451 | |
| 1452 | 1452 | if ($globalDBdriver == 'mysql') { |
| 1453 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1453 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1454 | 1454 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE() |
| 1455 | 1455 | GROUP BY hour_name |
| 1456 | 1456 | ORDER BY hour_name ASC"; |
| 1457 | 1457 | } else { |
| 1458 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1458 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1459 | 1459 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 1460 | 1460 | GROUP BY hour_name |
| 1461 | 1461 | ORDER BY hour_name ASC"; |
@@ -1467,7 +1467,7 @@ discard block |
||
| 1467 | 1467 | $hour_array = array(); |
| 1468 | 1468 | $temp_array = array(); |
| 1469 | 1469 | |
| 1470 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1470 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1471 | 1471 | { |
| 1472 | 1472 | $temp_array['hour_name'] = $row['hour_name']; |
| 1473 | 1473 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1486,9 +1486,9 @@ discard block |
||
| 1486 | 1486 | */ |
| 1487 | 1487 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
| 1488 | 1488 | { |
| 1489 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
| 1489 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
| 1490 | 1490 | |
| 1491 | - $query = "SELECT marine_output.marine_id |
|
| 1491 | + $query = "SELECT marine_output.marine_id |
|
| 1492 | 1492 | FROM marine_output |
| 1493 | 1493 | WHERE marine_output.fammarine_id = '".$fammarine_id."'"; |
| 1494 | 1494 | |
@@ -1496,7 +1496,7 @@ discard block |
||
| 1496 | 1496 | $sth = $this->db->prepare($query); |
| 1497 | 1497 | $sth->execute(); |
| 1498 | 1498 | |
| 1499 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1499 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1500 | 1500 | { |
| 1501 | 1501 | return $row['marine_id']; |
| 1502 | 1502 | } |
@@ -1521,23 +1521,23 @@ discard block |
||
| 1521 | 1521 | } |
| 1522 | 1522 | |
| 1523 | 1523 | $current_date = date("Y-m-d H:i:s"); |
| 1524 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 1524 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 1525 | 1525 | |
| 1526 | 1526 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 1527 | 1527 | |
| 1528 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 1528 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 1529 | 1529 | $years = $time_array['years']; |
| 1530 | 1530 | |
| 1531 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 1531 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 1532 | 1532 | $months = $time_array['months']; |
| 1533 | 1533 | |
| 1534 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 1534 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 1535 | 1535 | $days = $time_array['days']; |
| 1536 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 1536 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 1537 | 1537 | $hours = $time_array['hours']; |
| 1538 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 1538 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 1539 | 1539 | $minutes = $time_array['minutes']; |
| 1540 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 1540 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 1541 | 1541 | |
| 1542 | 1542 | return $time_array; |
| 1543 | 1543 | } |
@@ -1560,63 +1560,63 @@ discard block |
||
| 1560 | 1560 | $temp_array['direction_degree'] = $direction; |
| 1561 | 1561 | $temp_array['direction_shortname'] = "N"; |
| 1562 | 1562 | $temp_array['direction_fullname'] = "North"; |
| 1563 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 1563 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 1564 | 1564 | $temp_array['direction_degree'] = $direction; |
| 1565 | 1565 | $temp_array['direction_shortname'] = "NNE"; |
| 1566 | 1566 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 1567 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 1567 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 1568 | 1568 | $temp_array['direction_degree'] = $direction; |
| 1569 | 1569 | $temp_array['direction_shortname'] = "NE"; |
| 1570 | 1570 | $temp_array['direction_fullname'] = "Northeast"; |
| 1571 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 1571 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 1572 | 1572 | $temp_array['direction_degree'] = $direction; |
| 1573 | 1573 | $temp_array['direction_shortname'] = "ENE"; |
| 1574 | 1574 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 1575 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 1575 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 1576 | 1576 | $temp_array['direction_degree'] = $direction; |
| 1577 | 1577 | $temp_array['direction_shortname'] = "E"; |
| 1578 | 1578 | $temp_array['direction_fullname'] = "East"; |
| 1579 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 1579 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 1580 | 1580 | $temp_array['direction_degree'] = $direction; |
| 1581 | 1581 | $temp_array['direction_shortname'] = "ESE"; |
| 1582 | 1582 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 1583 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 1583 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 1584 | 1584 | $temp_array['direction_degree'] = $direction; |
| 1585 | 1585 | $temp_array['direction_shortname'] = "SE"; |
| 1586 | 1586 | $temp_array['direction_fullname'] = "Southeast"; |
| 1587 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 1587 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 1588 | 1588 | $temp_array['direction_degree'] = $direction; |
| 1589 | 1589 | $temp_array['direction_shortname'] = "SSE"; |
| 1590 | 1590 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 1591 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 1591 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 1592 | 1592 | $temp_array['direction_degree'] = $direction; |
| 1593 | 1593 | $temp_array['direction_shortname'] = "S"; |
| 1594 | 1594 | $temp_array['direction_fullname'] = "South"; |
| 1595 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 1595 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 1596 | 1596 | $temp_array['direction_degree'] = $direction; |
| 1597 | 1597 | $temp_array['direction_shortname'] = "SSW"; |
| 1598 | 1598 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 1599 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 1599 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 1600 | 1600 | $temp_array['direction_degree'] = $direction; |
| 1601 | 1601 | $temp_array['direction_shortname'] = "SW"; |
| 1602 | 1602 | $temp_array['direction_fullname'] = "Southwest"; |
| 1603 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 1603 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 1604 | 1604 | $temp_array['direction_degree'] = $direction; |
| 1605 | 1605 | $temp_array['direction_shortname'] = "WSW"; |
| 1606 | 1606 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 1607 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 1607 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 1608 | 1608 | $temp_array['direction_degree'] = $direction; |
| 1609 | 1609 | $temp_array['direction_shortname'] = "W"; |
| 1610 | 1610 | $temp_array['direction_fullname'] = "West"; |
| 1611 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 1611 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 1612 | 1612 | $temp_array['direction_degree'] = $direction; |
| 1613 | 1613 | $temp_array['direction_shortname'] = "WNW"; |
| 1614 | 1614 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 1615 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 1615 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 1616 | 1616 | $temp_array['direction_degree'] = $direction; |
| 1617 | 1617 | $temp_array['direction_shortname'] = "NW"; |
| 1618 | 1618 | $temp_array['direction_fullname'] = "Northwest"; |
| 1619 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 1619 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 1620 | 1620 | $temp_array['direction_degree'] = $direction; |
| 1621 | 1621 | $temp_array['direction_shortname'] = "NNW"; |
| 1622 | 1622 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1633,11 +1633,11 @@ discard block |
||
| 1633 | 1633 | * @param Float $longitude longitute of the flight |
| 1634 | 1634 | * @return String the countrie |
| 1635 | 1635 | */ |
| 1636 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 1636 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 1637 | 1637 | { |
| 1638 | 1638 | global $globalDBdriver, $globalDebug; |
| 1639 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1640 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1639 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1640 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1641 | 1641 | |
| 1642 | 1642 | $Connection = new Connection($this->db); |
| 1643 | 1643 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1677,7 +1677,7 @@ discard block |
||
| 1677 | 1677 | public function getCountryFromISO2($iso2) |
| 1678 | 1678 | { |
| 1679 | 1679 | global $globalDBdriver, $globalDebug; |
| 1680 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
| 1680 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
| 1681 | 1681 | |
| 1682 | 1682 | $Connection = new Connection($this->db); |
| 1683 | 1683 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1725,7 +1725,7 @@ discard block |
||
| 1725 | 1725 | |
| 1726 | 1726 | $bitly_data = json_decode($bitly_data); |
| 1727 | 1727 | $bitly_url = ''; |
| 1728 | - if ($bitly_data->status_txt = "OK"){ |
|
| 1728 | + if ($bitly_data->status_txt = "OK") { |
|
| 1729 | 1729 | $bitly_url = $bitly_data->data->url; |
| 1730 | 1730 | } |
| 1731 | 1731 | |
@@ -1739,11 +1739,11 @@ discard block |
||
| 1739 | 1739 | * @return Array the vessel type list |
| 1740 | 1740 | * |
| 1741 | 1741 | */ |
| 1742 | - public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 1742 | + public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 1743 | 1743 | { |
| 1744 | 1744 | global $globalDBdriver; |
| 1745 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1746 | - $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count |
|
| 1745 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1746 | + $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count |
|
| 1747 | 1747 | FROM marine_output ".$filter_query." marine_output.type <> ''"; |
| 1748 | 1748 | if ($olderthanmonths > 0) { |
| 1749 | 1749 | if ($globalDBdriver == 'mysql') { |
@@ -1763,28 +1763,28 @@ discard block |
||
| 1763 | 1763 | if ($year != '') { |
| 1764 | 1764 | if ($globalDBdriver == 'mysql') { |
| 1765 | 1765 | $query .= " AND YEAR(marine_output.date) = :year"; |
| 1766 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1766 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1767 | 1767 | } else { |
| 1768 | 1768 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
| 1769 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1769 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1770 | 1770 | } |
| 1771 | 1771 | } |
| 1772 | 1772 | if ($month != '') { |
| 1773 | 1773 | if ($globalDBdriver == 'mysql') { |
| 1774 | 1774 | $query .= " AND MONTH(marine_output.date) = :month"; |
| 1775 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1775 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1776 | 1776 | } else { |
| 1777 | 1777 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
| 1778 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1778 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1779 | 1779 | } |
| 1780 | 1780 | } |
| 1781 | 1781 | if ($day != '') { |
| 1782 | 1782 | if ($globalDBdriver == 'mysql') { |
| 1783 | 1783 | $query .= " AND DAY(marine_output.date) = :day"; |
| 1784 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1784 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1785 | 1785 | } else { |
| 1786 | 1786 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
| 1787 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1787 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1788 | 1788 | } |
| 1789 | 1789 | } |
| 1790 | 1790 | $query .= " GROUP BY marine_output.type ORDER BY marine_type_count DESC"; |
@@ -1793,7 +1793,7 @@ discard block |
||
| 1793 | 1793 | $sth->execute($query_values); |
| 1794 | 1794 | $marine_array = array(); |
| 1795 | 1795 | $temp_array = array(); |
| 1796 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1796 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1797 | 1797 | { |
| 1798 | 1798 | $temp_array['marine_type'] = $row['marine_type']; |
| 1799 | 1799 | $temp_array['marine_type_count'] = $row['marine_type_count']; |
@@ -1804,7 +1804,7 @@ discard block |
||
| 1804 | 1804 | |
| 1805 | 1805 | public function getOrderBy() |
| 1806 | 1806 | { |
| 1807 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 1807 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 1808 | 1808 | |
| 1809 | 1809 | return $orderby; |
| 1810 | 1810 | |
@@ -29,7 +29,9 @@ discard block |
||
| 29 | 29 | if (isset($filter[0]['source'])) { |
| 30 | 30 | $filters = array_merge($filters,$filter); |
| 31 | 31 | } |
| 32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 32 | + if (is_array($globalFilter)) { |
|
| 33 | + $filter = array_merge($filter,$globalFilter); |
|
| 34 | + } |
|
| 33 | 35 | $filter_query_join = ''; |
| 34 | 36 | $filter_query_where = ''; |
| 35 | 37 | foreach($filters as $flt) { |
@@ -68,8 +70,11 @@ discard block |
||
| 68 | 70 | $filter_query_where .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
| 69 | 71 | } |
| 70 | 72 | } |
| 71 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 72 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 73 | + if ($filter_query_where == '' && $where) { |
|
| 74 | + $filter_query_where = ' WHERE'; |
|
| 75 | + } elseif ($filter_query_where != '' && $and) { |
|
| 76 | + $filter_query_where .= ' AND'; |
|
| 77 | + } |
|
| 73 | 78 | if ($filter_query_where != '') { |
| 74 | 79 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 75 | 80 | } |
@@ -123,32 +128,54 @@ discard block |
||
| 123 | 128 | $temp_array['spotter_id'] = $row['spotter_archive_id']; |
| 124 | 129 | } elseif (isset($row['spotter_archive_output_id'])) { |
| 125 | 130 | $temp_array['spotter_id'] = $row['spotter_archive_output_id']; |
| 126 | - */} |
|
| 127 | - elseif (isset($row['marineid'])) { |
|
| 131 | + */} elseif (isset($row['marineid'])) { |
|
| 128 | 132 | $temp_array['marine_id'] = $row['marineid']; |
| 129 | 133 | } else { |
| 130 | 134 | $temp_array['marine_id'] = ''; |
| 131 | 135 | } |
| 132 | - if (isset($row['fammarine_id'])) $temp_array['fammarine_id'] = $row['fammarine_id']; |
|
| 133 | - if (isset($row['mmsi'])) $temp_array['mmsi'] = $row['mmsi']; |
|
| 134 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
| 135 | - if (isset($row['type_id'])) $temp_array['type_id'] = $row['type_id']; |
|
| 136 | - if (isset($row['ident'])) $temp_array['ident'] = $row['ident']; |
|
| 137 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 138 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 139 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 136 | + if (isset($row['fammarine_id'])) { |
|
| 137 | + $temp_array['fammarine_id'] = $row['fammarine_id']; |
|
| 138 | + } |
|
| 139 | + if (isset($row['mmsi'])) { |
|
| 140 | + $temp_array['mmsi'] = $row['mmsi']; |
|
| 141 | + } |
|
| 142 | + if (isset($row['type'])) { |
|
| 143 | + $temp_array['type'] = $row['type']; |
|
| 144 | + } |
|
| 145 | + if (isset($row['type_id'])) { |
|
| 146 | + $temp_array['type_id'] = $row['type_id']; |
|
| 147 | + } |
|
| 148 | + if (isset($row['ident'])) { |
|
| 149 | + $temp_array['ident'] = $row['ident']; |
|
| 150 | + } |
|
| 151 | + if (isset($row['latitude'])) { |
|
| 152 | + $temp_array['latitude'] = $row['latitude']; |
|
| 153 | + } |
|
| 154 | + if (isset($row['longitude'])) { |
|
| 155 | + $temp_array['longitude'] = $row['longitude']; |
|
| 156 | + } |
|
| 157 | + if (isset($row['format_source'])) { |
|
| 158 | + $temp_array['format_source'] = $row['format_source']; |
|
| 159 | + } |
|
| 140 | 160 | if (isset($row['heading'])) { |
| 141 | 161 | $temp_array['heading'] = $row['heading']; |
| 142 | 162 | $heading_direction = $this->parseDirection($row['heading']); |
| 143 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 163 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 164 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + if (isset($row['ground_speed'])) { |
|
| 168 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 144 | 169 | } |
| 145 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 146 | 170 | |
| 147 | 171 | if($temp_array['mmsi'] != "") |
| 148 | 172 | { |
| 149 | 173 | $Image = new Image($this->db); |
| 150 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
| 151 | - else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
| 174 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') { |
|
| 175 | + $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
| 176 | + } else { |
|
| 177 | + $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
| 178 | + } |
|
| 152 | 179 | unset($Image); |
| 153 | 180 | if (count($image_array) > 0) { |
| 154 | 181 | $temp_array['image'] = $image_array[0]['image']; |
@@ -200,13 +227,21 @@ discard block |
||
| 200 | 227 | } |
| 201 | 228 | |
| 202 | 229 | $fromsource = NULL; |
| 203 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 204 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 205 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 230 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 231 | + $temp_array['source_name'] = $row['source_name']; |
|
| 232 | + } |
|
| 233 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 234 | + $temp_array['over_country'] = $row['over_country']; |
|
| 235 | + } |
|
| 236 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 237 | + $temp_array['distance'] = $row['distance']; |
|
| 238 | + } |
|
| 206 | 239 | $temp_array['query_number_rows'] = $num_rows; |
| 207 | 240 | $spotter_array[] = $temp_array; |
| 208 | 241 | } |
| 209 | - if ($num_rows == 0) return array(); |
|
| 242 | + if ($num_rows == 0) { |
|
| 243 | + return array(); |
|
| 244 | + } |
|
| 210 | 245 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 211 | 246 | return $spotter_array; |
| 212 | 247 | } |
@@ -232,8 +267,12 @@ discard block |
||
| 232 | 267 | { |
| 233 | 268 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 234 | 269 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 235 | - } else $limit_query = ""; |
|
| 236 | - } else $limit_query = ""; |
|
| 270 | + } else { |
|
| 271 | + $limit_query = ""; |
|
| 272 | + } |
|
| 273 | + } else { |
|
| 274 | + $limit_query = ""; |
|
| 275 | + } |
|
| 237 | 276 | if ($sort != "") |
| 238 | 277 | { |
| 239 | 278 | $search_orderby_array = $this->getOrderBy(); |
@@ -257,7 +296,9 @@ discard block |
||
| 257 | 296 | global $global_query; |
| 258 | 297 | |
| 259 | 298 | date_default_timezone_set('UTC'); |
| 260 | - if ($id == '') return array(); |
|
| 299 | + if ($id == '') { |
|
| 300 | + return array(); |
|
| 301 | + } |
|
| 261 | 302 | $additional_query = "marine_output.fammarine_id = :id"; |
| 262 | 303 | $query_values = array(':id' => $id); |
| 263 | 304 | $query = $global_query." WHERE ".$additional_query." "; |
@@ -400,8 +441,11 @@ discard block |
||
| 400 | 441 | $query .= " ORDER BY marine_output.source_name ASC"; |
| 401 | 442 | |
| 402 | 443 | $sth = $this->db->prepare($query); |
| 403 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 404 | - else $sth->execute(); |
|
| 444 | + if (!empty($query_values)) { |
|
| 445 | + $sth->execute($query_values); |
|
| 446 | + } else { |
|
| 447 | + $sth->execute(); |
|
| 448 | + } |
|
| 405 | 449 | |
| 406 | 450 | $source_array = array(); |
| 407 | 451 | $temp_array = array(); |
@@ -456,8 +500,11 @@ discard block |
||
| 456 | 500 | $sth = $this->db->prepare($query); |
| 457 | 501 | $sth->execute(array(':mmsi' => $mmsi)); |
| 458 | 502 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 459 | - if (isset($result[0])) return $result[0]; |
|
| 460 | - else return array(); |
|
| 503 | + if (isset($result[0])) { |
|
| 504 | + return $result[0]; |
|
| 505 | + } else { |
|
| 506 | + return array(); |
|
| 507 | + } |
|
| 461 | 508 | } |
| 462 | 509 | |
| 463 | 510 | /* |
@@ -473,7 +520,9 @@ discard block |
||
| 473 | 520 | date_default_timezone_set($globalTimezone); |
| 474 | 521 | $datetime = new DateTime(); |
| 475 | 522 | $offset = $datetime->format('P'); |
| 476 | - } else $offset = '+00:00'; |
|
| 523 | + } else { |
|
| 524 | + $offset = '+00:00'; |
|
| 525 | + } |
|
| 477 | 526 | |
| 478 | 527 | if ($globalDBdriver == 'mysql') { |
| 479 | 528 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
@@ -703,9 +752,15 @@ discard block |
||
| 703 | 752 | $latitude = 0; |
| 704 | 753 | $longitude = 0; |
| 705 | 754 | } |
| 706 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 707 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 708 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 755 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 756 | + $heading = 0; |
|
| 757 | + } |
|
| 758 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 759 | + $groundspeed = 0; |
|
| 760 | + } |
|
| 761 | + if ($arrival_date == '') { |
|
| 762 | + $arrival_date = NULL; |
|
| 763 | + } |
|
| 709 | 764 | $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
| 710 | 765 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
| 711 | 766 | |
@@ -813,7 +868,9 @@ discard block |
||
| 813 | 868 | global $globalDBdriver, $globalArchive; |
| 814 | 869 | //$filter_query = $this->getFilter($filters,true,true); |
| 815 | 870 | $Connection= new Connection($this->db); |
| 816 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 871 | + if (!$Connection->tableExists('countries')) { |
|
| 872 | + return array(); |
|
| 873 | + } |
|
| 817 | 874 | require_once('class.SpotterLive.php'); |
| 818 | 875 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
| 819 | 876 | $MarineLive = new MarineLive(); |
@@ -857,7 +914,9 @@ discard block |
||
| 857 | 914 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT fammarine_id,over_country FROM marine_archive".$filter_query.") l ON c.iso2 = l.over_country "; |
| 858 | 915 | } |
| 859 | 916 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 860 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 917 | + if ($limit) { |
|
| 918 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 919 | + } |
|
| 861 | 920 | |
| 862 | 921 | $sth = $this->db->prepare($query); |
| 863 | 922 | $sth->execute(); |
@@ -891,12 +950,18 @@ discard block |
||
| 891 | 950 | $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
| 892 | 951 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
| 893 | 952 | if ($olderthanmonths > 0) { |
| 894 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 895 | - else $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 953 | + if ($globalDBdriver == 'mysql') { |
|
| 954 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 955 | + } else { |
|
| 956 | + $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 957 | + } |
|
| 896 | 958 | } |
| 897 | 959 | if ($sincedate != '') { |
| 898 | - if ($globalDBdriver == 'mysql') $query .= " AND marine_output.date > '".$sincedate."'"; |
|
| 899 | - else $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 960 | + if ($globalDBdriver == 'mysql') { |
|
| 961 | + $query .= " AND marine_output.date > '".$sincedate."'"; |
|
| 962 | + } else { |
|
| 963 | + $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 964 | + } |
|
| 900 | 965 | } |
| 901 | 966 | $query_values = array(); |
| 902 | 967 | if ($year != '') { |
@@ -927,7 +992,9 @@ discard block |
||
| 927 | 992 | } |
| 928 | 993 | } |
| 929 | 994 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
| 930 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 995 | + if ($limit) { |
|
| 996 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 997 | + } |
|
| 931 | 998 | |
| 932 | 999 | $sth = $this->db->prepare($query); |
| 933 | 1000 | $sth->execute($query_values); |
@@ -962,7 +1029,9 @@ discard block |
||
| 962 | 1029 | date_default_timezone_set($globalTimezone); |
| 963 | 1030 | $datetime = new DateTime(); |
| 964 | 1031 | $offset = $datetime->format('P'); |
| 965 | - } else $offset = '+00:00'; |
|
| 1032 | + } else { |
|
| 1033 | + $offset = '+00:00'; |
|
| 1034 | + } |
|
| 966 | 1035 | |
| 967 | 1036 | if ($globalDBdriver == 'mysql') { |
| 968 | 1037 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1012,7 +1081,9 @@ discard block |
||
| 1012 | 1081 | date_default_timezone_set($globalTimezone); |
| 1013 | 1082 | $datetime = new DateTime(); |
| 1014 | 1083 | $offset = $datetime->format('P'); |
| 1015 | - } else $offset = '+00:00'; |
|
| 1084 | + } else { |
|
| 1085 | + $offset = '+00:00'; |
|
| 1086 | + } |
|
| 1016 | 1087 | $filter_query = $this->getFilter($filters,true,true); |
| 1017 | 1088 | if ($globalDBdriver == 'mysql') { |
| 1018 | 1089 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1058,7 +1129,9 @@ discard block |
||
| 1058 | 1129 | date_default_timezone_set($globalTimezone); |
| 1059 | 1130 | $datetime = new DateTime(); |
| 1060 | 1131 | $offset = $datetime->format('P'); |
| 1061 | - } else $offset = '+00:00'; |
|
| 1132 | + } else { |
|
| 1133 | + $offset = '+00:00'; |
|
| 1134 | + } |
|
| 1062 | 1135 | $filter_query = $this->getFilter($filters,true,true); |
| 1063 | 1136 | if ($globalDBdriver == 'mysql') { |
| 1064 | 1137 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1106,7 +1179,9 @@ discard block |
||
| 1106 | 1179 | date_default_timezone_set($globalTimezone); |
| 1107 | 1180 | $datetime = new DateTime(); |
| 1108 | 1181 | $offset = $datetime->format('P'); |
| 1109 | - } else $offset = '+00:00'; |
|
| 1182 | + } else { |
|
| 1183 | + $offset = '+00:00'; |
|
| 1184 | + } |
|
| 1110 | 1185 | |
| 1111 | 1186 | if ($globalDBdriver == 'mysql') { |
| 1112 | 1187 | $query = "SELECT YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1155,7 +1230,9 @@ discard block |
||
| 1155 | 1230 | date_default_timezone_set($globalTimezone); |
| 1156 | 1231 | $datetime = new DateTime(); |
| 1157 | 1232 | $offset = $datetime->format('P'); |
| 1158 | - } else $offset = '+00:00'; |
|
| 1233 | + } else { |
|
| 1234 | + $offset = '+00:00'; |
|
| 1235 | + } |
|
| 1159 | 1236 | $filter_query = $this->getFilter($filters,true,true); |
| 1160 | 1237 | if ($globalDBdriver == 'mysql') { |
| 1161 | 1238 | $query = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -1204,7 +1281,9 @@ discard block |
||
| 1204 | 1281 | date_default_timezone_set($globalTimezone); |
| 1205 | 1282 | $datetime = new DateTime(); |
| 1206 | 1283 | $offset = $datetime->format('P'); |
| 1207 | - } else $offset = '+00:00'; |
|
| 1284 | + } else { |
|
| 1285 | + $offset = '+00:00'; |
|
| 1286 | + } |
|
| 1208 | 1287 | |
| 1209 | 1288 | $orderby_sql = ''; |
| 1210 | 1289 | if ($orderby == "hour") |
@@ -1273,7 +1352,9 @@ discard block |
||
| 1273 | 1352 | date_default_timezone_set($globalTimezone); |
| 1274 | 1353 | $datetime = new DateTime($date); |
| 1275 | 1354 | $offset = $datetime->format('P'); |
| 1276 | - } else $offset = '+00:00'; |
|
| 1355 | + } else { |
|
| 1356 | + $offset = '+00:00'; |
|
| 1357 | + } |
|
| 1277 | 1358 | |
| 1278 | 1359 | if ($globalDBdriver == 'mysql') { |
| 1279 | 1360 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1321,7 +1402,9 @@ discard block |
||
| 1321 | 1402 | date_default_timezone_set($globalTimezone); |
| 1322 | 1403 | $datetime = new DateTime(); |
| 1323 | 1404 | $offset = $datetime->format('P'); |
| 1324 | - } else $offset = '+00:00'; |
|
| 1405 | + } else { |
|
| 1406 | + $offset = '+00:00'; |
|
| 1407 | + } |
|
| 1325 | 1408 | |
| 1326 | 1409 | if ($globalDBdriver == 'mysql') { |
| 1327 | 1410 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1386,8 +1469,11 @@ discard block |
||
| 1386 | 1469 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 1387 | 1470 | } |
| 1388 | 1471 | } |
| 1389 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 1390 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1472 | + if (empty($query_values)) { |
|
| 1473 | + $queryi .= $this->getFilter($filters); |
|
| 1474 | + } else { |
|
| 1475 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1476 | + } |
|
| 1391 | 1477 | |
| 1392 | 1478 | $sth = $this->db->prepare($queryi); |
| 1393 | 1479 | $sth->execute($query_values); |
@@ -1424,8 +1510,11 @@ discard block |
||
| 1424 | 1510 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 1425 | 1511 | } |
| 1426 | 1512 | } |
| 1427 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 1428 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1513 | + if (empty($query_values)) { |
|
| 1514 | + $queryi .= $this->getFilter($filters); |
|
| 1515 | + } else { |
|
| 1516 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1517 | + } |
|
| 1429 | 1518 | |
| 1430 | 1519 | $sth = $this->db->prepare($queryi); |
| 1431 | 1520 | $sth->execute($query_values); |
@@ -1447,7 +1536,9 @@ discard block |
||
| 1447 | 1536 | date_default_timezone_set($globalTimezone); |
| 1448 | 1537 | $datetime = new DateTime(); |
| 1449 | 1538 | $offset = $datetime->format('P'); |
| 1450 | - } else $offset = '+00:00'; |
|
| 1539 | + } else { |
|
| 1540 | + $offset = '+00:00'; |
|
| 1541 | + } |
|
| 1451 | 1542 | |
| 1452 | 1543 | if ($globalDBdriver == 'mysql') { |
| 1453 | 1544 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1551,7 +1642,9 @@ discard block |
||
| 1551 | 1642 | */ |
| 1552 | 1643 | public function parseDirection($direction = 0) |
| 1553 | 1644 | { |
| 1554 | - if ($direction == '') $direction = 0; |
|
| 1645 | + if ($direction == '') { |
|
| 1646 | + $direction = 0; |
|
| 1647 | + } |
|
| 1555 | 1648 | $direction_array = array(); |
| 1556 | 1649 | $temp_array = array(); |
| 1557 | 1650 | |
@@ -1640,7 +1733,9 @@ discard block |
||
| 1640 | 1733 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1641 | 1734 | |
| 1642 | 1735 | $Connection = new Connection($this->db); |
| 1643 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 1736 | + if (!$Connection->tableExists('countries')) { |
|
| 1737 | + return ''; |
|
| 1738 | + } |
|
| 1644 | 1739 | |
| 1645 | 1740 | try { |
| 1646 | 1741 | /* |
@@ -1660,9 +1755,13 @@ discard block |
||
| 1660 | 1755 | $sth->closeCursor(); |
| 1661 | 1756 | if (count($row) > 0) { |
| 1662 | 1757 | return $row; |
| 1663 | - } else return ''; |
|
| 1758 | + } else { |
|
| 1759 | + return ''; |
|
| 1760 | + } |
|
| 1664 | 1761 | } catch (PDOException $e) { |
| 1665 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 1762 | + if (isset($globalDebug) && $globalDebug) { |
|
| 1763 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 1764 | + } |
|
| 1666 | 1765 | return ''; |
| 1667 | 1766 | } |
| 1668 | 1767 | |
@@ -1680,7 +1779,9 @@ discard block |
||
| 1680 | 1779 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 1681 | 1780 | |
| 1682 | 1781 | $Connection = new Connection($this->db); |
| 1683 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 1782 | + if (!$Connection->tableExists('countries')) { |
|
| 1783 | + return ''; |
|
| 1784 | + } |
|
| 1684 | 1785 | |
| 1685 | 1786 | try { |
| 1686 | 1787 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1692,9 +1793,13 @@ discard block |
||
| 1692 | 1793 | $sth->closeCursor(); |
| 1693 | 1794 | if (count($row) > 0) { |
| 1694 | 1795 | return $row; |
| 1695 | - } else return ''; |
|
| 1796 | + } else { |
|
| 1797 | + return ''; |
|
| 1798 | + } |
|
| 1696 | 1799 | } catch (PDOException $e) { |
| 1697 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 1800 | + if (isset($globalDebug) && $globalDebug) { |
|
| 1801 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 1802 | + } |
|
| 1698 | 1803 | return ''; |
| 1699 | 1804 | } |
| 1700 | 1805 | |
@@ -1712,7 +1817,9 @@ discard block |
||
| 1712 | 1817 | { |
| 1713 | 1818 | global $globalBitlyAccessToken; |
| 1714 | 1819 | |
| 1715 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 1820 | + if ($globalBitlyAccessToken == '') { |
|
| 1821 | + return $url; |
|
| 1822 | + } |
|
| 1716 | 1823 | |
| 1717 | 1824 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 1718 | 1825 | |
@@ -1788,7 +1895,9 @@ discard block |
||
| 1788 | 1895 | } |
| 1789 | 1896 | } |
| 1790 | 1897 | $query .= " GROUP BY marine_output.type ORDER BY marine_type_count DESC"; |
| 1791 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 1898 | + if ($limit) { |
|
| 1899 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 1900 | + } |
|
| 1792 | 1901 | $sth = $this->db->prepare($query); |
| 1793 | 1902 | $sth->execute($query_values); |
| 1794 | 1903 | $marine_array = array(); |
@@ -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 | |
| 21 | 21 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 22 | 22 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -80,14 +80,14 @@ discard block |
||
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | - * Executes the SQL statements to get the spotter information |
|
| 84 | - * |
|
| 85 | - * @param String $query the SQL query |
|
| 86 | - * @param Array $params parameter of the query |
|
| 87 | - * @param String $limitQuery the limit query |
|
| 88 | - * @return Array the spotter information |
|
| 89 | - * |
|
| 90 | - */ |
|
| 83 | + * Executes the SQL statements to get the spotter information |
|
| 84 | + * |
|
| 85 | + * @param String $query the SQL query |
|
| 86 | + * @param Array $params parameter of the query |
|
| 87 | + * @param String $limitQuery the limit query |
|
| 88 | + * @return Array the spotter information |
|
| 89 | + * |
|
| 90 | + */ |
|
| 91 | 91 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 92 | 92 | { |
| 93 | 93 | date_default_timezone_set('UTC'); |
@@ -200,11 +200,11 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | |
| 202 | 202 | /** |
| 203 | - * Gets all the spotter information based on the latest data entry |
|
| 204 | - * |
|
| 205 | - * @return Array the spotter information |
|
| 206 | - * |
|
| 207 | - */ |
|
| 203 | + * Gets all the spotter information based on the latest data entry |
|
| 204 | + * |
|
| 205 | + * @return Array the spotter information |
|
| 206 | + * |
|
| 207 | + */ |
|
| 208 | 208 | public function getLatestTrackerData($limit = '', $sort = '', $filter = array()) |
| 209 | 209 | { |
| 210 | 210 | global $global_query; |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | /** |
| 265 | - * Gets all the spotter information based on the callsign |
|
| 266 | - * |
|
| 267 | - * @return Array the spotter information |
|
| 268 | - * |
|
| 269 | - */ |
|
| 265 | + * Gets all the spotter information based on the callsign |
|
| 266 | + * |
|
| 267 | + * @return Array the spotter information |
|
| 268 | + * |
|
| 269 | + */ |
|
| 270 | 270 | public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 271 | 271 | { |
| 272 | 272 | global $global_query; |
@@ -377,12 +377,12 @@ discard block |
||
| 377 | 377 | |
| 378 | 378 | |
| 379 | 379 | /** |
| 380 | - * Gets all source name |
|
| 381 | - * |
|
| 382 | - * @param String type format of source |
|
| 383 | - * @return Array list of source name |
|
| 384 | - * |
|
| 385 | - */ |
|
| 380 | + * Gets all source name |
|
| 381 | + * |
|
| 382 | + * @param String type format of source |
|
| 383 | + * @return Array list of source name |
|
| 384 | + * |
|
| 385 | + */ |
|
| 386 | 386 | public function getAllSourceName($type = '',$filters = array()) |
| 387 | 387 | { |
| 388 | 388 | $filter_query = $this->getFilter($filters,true,true); |
@@ -412,11 +412,11 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | |
| 414 | 414 | /** |
| 415 | - * Gets a list of all idents/callsigns |
|
| 416 | - * |
|
| 417 | - * @return Array list of ident/callsign names |
|
| 418 | - * |
|
| 419 | - */ |
|
| 415 | + * Gets a list of all idents/callsigns |
|
| 416 | + * |
|
| 417 | + * @return Array list of ident/callsign names |
|
| 418 | + * |
|
| 419 | + */ |
|
| 420 | 420 | public function getAllIdents($filters = array()) |
| 421 | 421 | { |
| 422 | 422 | $filter_query = $this->getFilter($filters,true,true); |
@@ -484,18 +484,18 @@ discard block |
||
| 484 | 484 | |
| 485 | 485 | |
| 486 | 486 | /** |
| 487 | - * Update ident spotter data |
|
| 488 | - * |
|
| 489 | - * @param String $flightaware_id the ID from flightaware |
|
| 490 | - * @param String $ident the flight ident |
|
| 491 | - * @return String success or false |
|
| 492 | - * |
|
| 493 | - */ |
|
| 487 | + * Update ident spotter data |
|
| 488 | + * |
|
| 489 | + * @param String $flightaware_id the ID from flightaware |
|
| 490 | + * @param String $ident the flight ident |
|
| 491 | + * @return String success or false |
|
| 492 | + * |
|
| 493 | + */ |
|
| 494 | 494 | public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
| 495 | 495 | { |
| 496 | 496 | |
| 497 | 497 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
| 498 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
| 498 | + $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
| 499 | 499 | |
| 500 | 500 | try { |
| 501 | 501 | $sth = $this->db->prepare($query); |
@@ -508,18 +508,18 @@ discard block |
||
| 508 | 508 | |
| 509 | 509 | } |
| 510 | 510 | /** |
| 511 | - * Update latest spotter data |
|
| 512 | - * |
|
| 513 | - * @param String $flightaware_id the ID from flightaware |
|
| 514 | - * @param String $ident the flight ident |
|
| 515 | - * @param String $arrival_airport_icao the arrival airport |
|
| 516 | - * @return String success or false |
|
| 517 | - * |
|
| 518 | - */ |
|
| 511 | + * Update latest spotter data |
|
| 512 | + * |
|
| 513 | + * @param String $flightaware_id the ID from flightaware |
|
| 514 | + * @param String $ident the flight ident |
|
| 515 | + * @param String $arrival_airport_icao the arrival airport |
|
| 516 | + * @return String success or false |
|
| 517 | + * |
|
| 518 | + */ |
|
| 519 | 519 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
| 520 | 520 | { |
| 521 | 521 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
| 522 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 522 | + $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 523 | 523 | |
| 524 | 524 | try { |
| 525 | 525 | $sth = $this->db->prepare($query); |
@@ -533,32 +533,32 @@ discard block |
||
| 533 | 533 | } |
| 534 | 534 | |
| 535 | 535 | /** |
| 536 | - * Adds a new spotter data |
|
| 537 | - * |
|
| 538 | - * @param String $flightaware_id the ID from flightaware |
|
| 539 | - * @param String $ident the flight ident |
|
| 540 | - * @param String $aircraft_icao the aircraft type |
|
| 541 | - * @param String $departure_airport_icao the departure airport |
|
| 542 | - * @param String $arrival_airport_icao the arrival airport |
|
| 543 | - * @param String $latitude latitude of flight |
|
| 544 | - * @param String $longitude latitude of flight |
|
| 545 | - * @param String $waypoints waypoints of flight |
|
| 546 | - * @param String $altitude altitude of flight |
|
| 547 | - * @param String $heading heading of flight |
|
| 548 | - * @param String $groundspeed speed of flight |
|
| 549 | - * @param String $date date of flight |
|
| 550 | - * @param String $departure_airport_time departure time of flight |
|
| 551 | - * @param String $arrival_airport_time arrival time of flight |
|
| 552 | - * @param String $squawk squawk code of flight |
|
| 553 | - * @param String $route_stop route stop of flight |
|
| 554 | - * @param String $highlight highlight or not |
|
| 555 | - * @param String $ModeS ModesS code of flight |
|
| 556 | - * @param String $registration registration code of flight |
|
| 557 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 558 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 559 | - * @param String $verticalrate vertival rate of flight |
|
| 560 | - * @return String success or false |
|
| 561 | - */ |
|
| 536 | + * Adds a new spotter data |
|
| 537 | + * |
|
| 538 | + * @param String $flightaware_id the ID from flightaware |
|
| 539 | + * @param String $ident the flight ident |
|
| 540 | + * @param String $aircraft_icao the aircraft type |
|
| 541 | + * @param String $departure_airport_icao the departure airport |
|
| 542 | + * @param String $arrival_airport_icao the arrival airport |
|
| 543 | + * @param String $latitude latitude of flight |
|
| 544 | + * @param String $longitude latitude of flight |
|
| 545 | + * @param String $waypoints waypoints of flight |
|
| 546 | + * @param String $altitude altitude of flight |
|
| 547 | + * @param String $heading heading of flight |
|
| 548 | + * @param String $groundspeed speed of flight |
|
| 549 | + * @param String $date date of flight |
|
| 550 | + * @param String $departure_airport_time departure time of flight |
|
| 551 | + * @param String $arrival_airport_time arrival time of flight |
|
| 552 | + * @param String $squawk squawk code of flight |
|
| 553 | + * @param String $route_stop route stop of flight |
|
| 554 | + * @param String $highlight highlight or not |
|
| 555 | + * @param String $ModeS ModesS code of flight |
|
| 556 | + * @param String $registration registration code of flight |
|
| 557 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 558 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 559 | + * @param String $verticalrate vertival rate of flight |
|
| 560 | + * @return String success or false |
|
| 561 | + */ |
|
| 562 | 562 | public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
| 563 | 563 | { |
| 564 | 564 | global $globalURL; |
@@ -643,16 +643,16 @@ discard block |
||
| 643 | 643 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
| 644 | 644 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
| 645 | 645 | |
| 646 | - if ($latitude == '' && $longitude == '') { |
|
| 647 | - $latitude = 0; |
|
| 648 | - $longitude = 0; |
|
| 649 | - } |
|
| 650 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 651 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 652 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 646 | + if ($latitude == '' && $longitude == '') { |
|
| 647 | + $latitude = 0; |
|
| 648 | + $longitude = 0; |
|
| 649 | + } |
|
| 650 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 651 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 652 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 653 | 653 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
| 654 | 654 | |
| 655 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
| 655 | + $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
| 656 | 656 | |
| 657 | 657 | try { |
| 658 | 658 | |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | $sth->execute($query_values); |
| 661 | 661 | $this->db = null; |
| 662 | 662 | } catch (PDOException $e) { |
| 663 | - return "error : ".$e->getMessage(); |
|
| 663 | + return "error : ".$e->getMessage(); |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | return "success"; |
@@ -669,11 +669,11 @@ discard block |
||
| 669 | 669 | |
| 670 | 670 | |
| 671 | 671 | /** |
| 672 | - * Gets the aircraft ident within the last hour |
|
| 673 | - * |
|
| 674 | - * @return String the ident |
|
| 675 | - * |
|
| 676 | - */ |
|
| 672 | + * Gets the aircraft ident within the last hour |
|
| 673 | + * |
|
| 674 | + * @return String the ident |
|
| 675 | + * |
|
| 676 | + */ |
|
| 677 | 677 | public function getIdentFromLastHour($ident) |
| 678 | 678 | { |
| 679 | 679 | global $globalDBdriver, $globalTimezone; |
@@ -689,11 +689,11 @@ discard block |
||
| 689 | 689 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 690 | 690 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
| 691 | 691 | $query_data = array(':ident' => $ident); |
| 692 | - } |
|
| 692 | + } |
|
| 693 | 693 | |
| 694 | 694 | $sth = $this->db->prepare($query); |
| 695 | 695 | $sth->execute($query_data); |
| 696 | - $ident_result=''; |
|
| 696 | + $ident_result=''; |
|
| 697 | 697 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 698 | 698 | { |
| 699 | 699 | $ident_result = $row['ident']; |
@@ -704,11 +704,11 @@ discard block |
||
| 704 | 704 | |
| 705 | 705 | |
| 706 | 706 | /** |
| 707 | - * Gets the aircraft data from the last 20 seconds |
|
| 708 | - * |
|
| 709 | - * @return Array the spotter data |
|
| 710 | - * |
|
| 711 | - */ |
|
| 707 | + * Gets the aircraft data from the last 20 seconds |
|
| 708 | + * |
|
| 709 | + * @return Array the spotter data |
|
| 710 | + * |
|
| 711 | + */ |
|
| 712 | 712 | public function getRealTimeData($q = '') |
| 713 | 713 | { |
| 714 | 714 | global $globalDBdriver; |
@@ -746,11 +746,11 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | |
| 748 | 748 | /** |
| 749 | - * Gets all number of flight over countries |
|
| 750 | - * |
|
| 751 | - * @return Array the airline country list |
|
| 752 | - * |
|
| 753 | - */ |
|
| 749 | + * Gets all number of flight over countries |
|
| 750 | + * |
|
| 751 | + * @return Array the airline country list |
|
| 752 | + * |
|
| 753 | + */ |
|
| 754 | 754 | |
| 755 | 755 | public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 756 | 756 | { |
@@ -821,11 +821,11 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | |
| 823 | 823 | /** |
| 824 | - * Gets all callsigns that have flown over |
|
| 825 | - * |
|
| 826 | - * @return Array the callsign list |
|
| 827 | - * |
|
| 828 | - */ |
|
| 824 | + * Gets all callsigns that have flown over |
|
| 825 | + * |
|
| 826 | + * @return Array the callsign list |
|
| 827 | + * |
|
| 828 | + */ |
|
| 829 | 829 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 830 | 830 | { |
| 831 | 831 | global $globalDBdriver; |
@@ -892,11 +892,11 @@ discard block |
||
| 892 | 892 | |
| 893 | 893 | |
| 894 | 894 | /** |
| 895 | - * Counts all dates |
|
| 896 | - * |
|
| 897 | - * @return Array the date list |
|
| 898 | - * |
|
| 899 | - */ |
|
| 895 | + * Counts all dates |
|
| 896 | + * |
|
| 897 | + * @return Array the date list |
|
| 898 | + * |
|
| 899 | + */ |
|
| 900 | 900 | public function countAllDates($filters = array()) |
| 901 | 901 | { |
| 902 | 902 | global $globalTimezone, $globalDBdriver; |
@@ -942,11 +942,11 @@ discard block |
||
| 942 | 942 | |
| 943 | 943 | |
| 944 | 944 | /** |
| 945 | - * Counts all dates during the last 7 days |
|
| 946 | - * |
|
| 947 | - * @return Array the date list |
|
| 948 | - * |
|
| 949 | - */ |
|
| 945 | + * Counts all dates during the last 7 days |
|
| 946 | + * |
|
| 947 | + * @return Array the date list |
|
| 948 | + * |
|
| 949 | + */ |
|
| 950 | 950 | public function countAllDatesLast7Days($filters = array()) |
| 951 | 951 | { |
| 952 | 952 | global $globalTimezone, $globalDBdriver; |
@@ -968,7 +968,7 @@ discard block |
||
| 968 | 968 | $query .= " GROUP BY date_name |
| 969 | 969 | ORDER BY date_name ASC"; |
| 970 | 970 | $query_data = array(':offset' => $offset); |
| 971 | - } |
|
| 971 | + } |
|
| 972 | 972 | |
| 973 | 973 | $sth = $this->db->prepare($query); |
| 974 | 974 | $sth->execute($query_data); |
@@ -988,11 +988,11 @@ discard block |
||
| 988 | 988 | } |
| 989 | 989 | |
| 990 | 990 | /** |
| 991 | - * Counts all dates during the last month |
|
| 992 | - * |
|
| 993 | - * @return Array the date list |
|
| 994 | - * |
|
| 995 | - */ |
|
| 991 | + * Counts all dates during the last month |
|
| 992 | + * |
|
| 993 | + * @return Array the date list |
|
| 994 | + * |
|
| 995 | + */ |
|
| 996 | 996 | public function countAllDatesLastMonth($filters = array()) |
| 997 | 997 | { |
| 998 | 998 | global $globalTimezone, $globalDBdriver; |
@@ -1014,7 +1014,7 @@ discard block |
||
| 1014 | 1014 | $query .= " GROUP BY date_name |
| 1015 | 1015 | ORDER BY date_name ASC"; |
| 1016 | 1016 | $query_data = array(':offset' => $offset); |
| 1017 | - } |
|
| 1017 | + } |
|
| 1018 | 1018 | |
| 1019 | 1019 | $sth = $this->db->prepare($query); |
| 1020 | 1020 | $sth->execute($query_data); |
@@ -1036,11 +1036,11 @@ discard block |
||
| 1036 | 1036 | |
| 1037 | 1037 | |
| 1038 | 1038 | /** |
| 1039 | - * Counts all month |
|
| 1040 | - * |
|
| 1041 | - * @return Array the month list |
|
| 1042 | - * |
|
| 1043 | - */ |
|
| 1039 | + * Counts all month |
|
| 1040 | + * |
|
| 1041 | + * @return Array the month list |
|
| 1042 | + * |
|
| 1043 | + */ |
|
| 1044 | 1044 | public function countAllMonths($filters = array()) |
| 1045 | 1045 | { |
| 1046 | 1046 | global $globalTimezone, $globalDBdriver; |
@@ -1085,11 +1085,11 @@ discard block |
||
| 1085 | 1085 | |
| 1086 | 1086 | |
| 1087 | 1087 | /** |
| 1088 | - * Counts all dates during the last year |
|
| 1089 | - * |
|
| 1090 | - * @return Array the date list |
|
| 1091 | - * |
|
| 1092 | - */ |
|
| 1088 | + * Counts all dates during the last year |
|
| 1089 | + * |
|
| 1090 | + * @return Array the date list |
|
| 1091 | + * |
|
| 1092 | + */ |
|
| 1093 | 1093 | public function countAllMonthsLastYear($filters) |
| 1094 | 1094 | { |
| 1095 | 1095 | global $globalTimezone, $globalDBdriver; |
@@ -1111,7 +1111,7 @@ discard block |
||
| 1111 | 1111 | $query .= " GROUP BY year_name, month_name |
| 1112 | 1112 | ORDER BY year_name, month_name ASC"; |
| 1113 | 1113 | $query_data = array(':offset' => $offset); |
| 1114 | - } |
|
| 1114 | + } |
|
| 1115 | 1115 | |
| 1116 | 1116 | $sth = $this->db->prepare($query); |
| 1117 | 1117 | $sth->execute($query_data); |
@@ -1134,11 +1134,11 @@ discard block |
||
| 1134 | 1134 | |
| 1135 | 1135 | |
| 1136 | 1136 | /** |
| 1137 | - * Counts all hours |
|
| 1138 | - * |
|
| 1139 | - * @return Array the hour list |
|
| 1140 | - * |
|
| 1141 | - */ |
|
| 1137 | + * Counts all hours |
|
| 1138 | + * |
|
| 1139 | + * @return Array the hour list |
|
| 1140 | + * |
|
| 1141 | + */ |
|
| 1142 | 1142 | public function countAllHours($orderby,$filters = array()) |
| 1143 | 1143 | { |
| 1144 | 1144 | global $globalTimezone, $globalDBdriver; |
@@ -1201,11 +1201,11 @@ discard block |
||
| 1201 | 1201 | |
| 1202 | 1202 | |
| 1203 | 1203 | /** |
| 1204 | - * Counts all hours by date |
|
| 1205 | - * |
|
| 1206 | - * @return Array the hour list |
|
| 1207 | - * |
|
| 1208 | - */ |
|
| 1204 | + * Counts all hours by date |
|
| 1205 | + * |
|
| 1206 | + * @return Array the hour list |
|
| 1207 | + * |
|
| 1208 | + */ |
|
| 1209 | 1209 | public function countAllHoursByDate($date, $filters = array()) |
| 1210 | 1210 | { |
| 1211 | 1211 | global $globalTimezone, $globalDBdriver; |
@@ -1249,11 +1249,11 @@ discard block |
||
| 1249 | 1249 | |
| 1250 | 1250 | |
| 1251 | 1251 | /** |
| 1252 | - * Counts all hours by a ident/callsign |
|
| 1253 | - * |
|
| 1254 | - * @return Array the hour list |
|
| 1255 | - * |
|
| 1256 | - */ |
|
| 1252 | + * Counts all hours by a ident/callsign |
|
| 1253 | + * |
|
| 1254 | + * @return Array the hour list |
|
| 1255 | + * |
|
| 1256 | + */ |
|
| 1257 | 1257 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1258 | 1258 | { |
| 1259 | 1259 | global $globalTimezone, $globalDBdriver; |
@@ -1298,11 +1298,11 @@ discard block |
||
| 1298 | 1298 | |
| 1299 | 1299 | |
| 1300 | 1300 | /** |
| 1301 | - * Counts all trackers that have flown over |
|
| 1302 | - * |
|
| 1303 | - * @return Integer the number of trackers |
|
| 1304 | - * |
|
| 1305 | - */ |
|
| 1301 | + * Counts all trackers that have flown over |
|
| 1302 | + * |
|
| 1303 | + * @return Integer the number of trackers |
|
| 1304 | + * |
|
| 1305 | + */ |
|
| 1306 | 1306 | public function countOverallTracker($filters = array(),$year = '',$month = '') |
| 1307 | 1307 | { |
| 1308 | 1308 | global $globalDBdriver; |
@@ -1337,11 +1337,11 @@ discard block |
||
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | 1339 | /** |
| 1340 | - * Counts all trackers type that have flown over |
|
| 1341 | - * |
|
| 1342 | - * @return Integer the number of flights |
|
| 1343 | - * |
|
| 1344 | - */ |
|
| 1340 | + * Counts all trackers type that have flown over |
|
| 1341 | + * |
|
| 1342 | + * @return Integer the number of flights |
|
| 1343 | + * |
|
| 1344 | + */ |
|
| 1345 | 1345 | public function countOverallTrackerTypes($filters = array(),$year = '',$month = '') |
| 1346 | 1346 | { |
| 1347 | 1347 | global $globalDBdriver; |
@@ -1376,11 +1376,11 @@ discard block |
||
| 1376 | 1376 | |
| 1377 | 1377 | |
| 1378 | 1378 | /** |
| 1379 | - * Counts all hours of today |
|
| 1380 | - * |
|
| 1381 | - * @return Array the hour list |
|
| 1382 | - * |
|
| 1383 | - */ |
|
| 1379 | + * Counts all hours of today |
|
| 1380 | + * |
|
| 1381 | + * @return Array the hour list |
|
| 1382 | + * |
|
| 1383 | + */ |
|
| 1384 | 1384 | public function countAllHoursFromToday($filters = array()) |
| 1385 | 1385 | { |
| 1386 | 1386 | global $globalTimezone, $globalDBdriver; |
@@ -1420,12 +1420,12 @@ discard block |
||
| 1420 | 1420 | } |
| 1421 | 1421 | |
| 1422 | 1422 | |
| 1423 | - /** |
|
| 1424 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1425 | - * |
|
| 1426 | - * @return Integer the Barrie Spotter ID |
|
| 1423 | + /** |
|
| 1424 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1425 | + * |
|
| 1426 | + * @return Integer the Barrie Spotter ID |
|
| 1427 | 1427 | q * |
| 1428 | - */ |
|
| 1428 | + */ |
|
| 1429 | 1429 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
| 1430 | 1430 | { |
| 1431 | 1431 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -1446,13 +1446,13 @@ discard block |
||
| 1446 | 1446 | |
| 1447 | 1447 | |
| 1448 | 1448 | /** |
| 1449 | - * Parses a date string |
|
| 1450 | - * |
|
| 1451 | - * @param String $dateString the date string |
|
| 1452 | - * @param String $timezone the timezone of a user |
|
| 1453 | - * @return Array the time information |
|
| 1454 | - * |
|
| 1455 | - */ |
|
| 1449 | + * Parses a date string |
|
| 1450 | + * |
|
| 1451 | + * @param String $dateString the date string |
|
| 1452 | + * @param String $timezone the timezone of a user |
|
| 1453 | + * @return Array the time information |
|
| 1454 | + * |
|
| 1455 | + */ |
|
| 1456 | 1456 | public function parseDateString($dateString, $timezone = '') |
| 1457 | 1457 | { |
| 1458 | 1458 | $time_array = array(); |
@@ -1485,12 +1485,12 @@ discard block |
||
| 1485 | 1485 | } |
| 1486 | 1486 | |
| 1487 | 1487 | /** |
| 1488 | - * Parses the direction degrees to working |
|
| 1489 | - * |
|
| 1490 | - * @param Float $direction the direction in degrees |
|
| 1491 | - * @return Array the direction information |
|
| 1492 | - * |
|
| 1493 | - */ |
|
| 1488 | + * Parses the direction degrees to working |
|
| 1489 | + * |
|
| 1490 | + * @param Float $direction the direction in degrees |
|
| 1491 | + * @return Array the direction information |
|
| 1492 | + * |
|
| 1493 | + */ |
|
| 1494 | 1494 | public function parseDirection($direction = 0) |
| 1495 | 1495 | { |
| 1496 | 1496 | if ($direction == '') $direction = 0; |
@@ -1569,12 +1569,12 @@ discard block |
||
| 1569 | 1569 | |
| 1570 | 1570 | |
| 1571 | 1571 | /** |
| 1572 | - * Gets Country from latitude/longitude |
|
| 1573 | - * |
|
| 1574 | - * @param Float $latitude latitute of the flight |
|
| 1575 | - * @param Float $longitude longitute of the flight |
|
| 1576 | - * @return String the countrie |
|
| 1577 | - */ |
|
| 1572 | + * Gets Country from latitude/longitude |
|
| 1573 | + * |
|
| 1574 | + * @param Float $latitude latitute of the flight |
|
| 1575 | + * @param Float $longitude longitute of the flight |
|
| 1576 | + * @return String the countrie |
|
| 1577 | + */ |
|
| 1578 | 1578 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 1579 | 1579 | { |
| 1580 | 1580 | global $globalDBdriver, $globalDebug; |
@@ -1611,11 +1611,11 @@ discard block |
||
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | /** |
| 1614 | - * Gets Country from iso2 |
|
| 1615 | - * |
|
| 1616 | - * @param String $iso2 ISO2 country code |
|
| 1617 | - * @return String the countrie |
|
| 1618 | - */ |
|
| 1614 | + * Gets Country from iso2 |
|
| 1615 | + * |
|
| 1616 | + * @param String $iso2 ISO2 country code |
|
| 1617 | + * @return String the countrie |
|
| 1618 | + */ |
|
| 1619 | 1619 | public function getCountryFromISO2($iso2) |
| 1620 | 1620 | { |
| 1621 | 1621 | global $globalDBdriver, $globalDebug; |
@@ -1643,11 +1643,11 @@ discard block |
||
| 1643 | 1643 | } |
| 1644 | 1644 | |
| 1645 | 1645 | /** |
| 1646 | - * Gets all vessels types that have flown over |
|
| 1647 | - * |
|
| 1648 | - * @return Array the vessel type list |
|
| 1649 | - * |
|
| 1650 | - */ |
|
| 1646 | + * Gets all vessels types that have flown over |
|
| 1647 | + * |
|
| 1648 | + * @return Array the vessel type list |
|
| 1649 | + * |
|
| 1650 | + */ |
|
| 1651 | 1651 | public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 1652 | 1652 | { |
| 1653 | 1653 | global $globalDBdriver; |
@@ -1714,12 +1714,12 @@ discard block |
||
| 1714 | 1714 | |
| 1715 | 1715 | |
| 1716 | 1716 | /** |
| 1717 | - * Gets the short url from bit.ly |
|
| 1718 | - * |
|
| 1719 | - * @param String $url the full url |
|
| 1720 | - * @return String the bit.ly url |
|
| 1721 | - * |
|
| 1722 | - */ |
|
| 1717 | + * Gets the short url from bit.ly |
|
| 1718 | + * |
|
| 1719 | + * @param String $url the full url |
|
| 1720 | + * @return String the bit.ly url |
|
| 1721 | + * |
|
| 1722 | + */ |
|
| 1723 | 1723 | public function getBitlyURL($url) |
| 1724 | 1724 | { |
| 1725 | 1725 | global $globalBitlyAccessToken; |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 5 | 5 | $global_query = "SELECT tracker_output.* FROM tracker_output"; |
| 6 | 6 | |
| 7 | -class Tracker{ |
|
| 7 | +class Tracker { |
|
| 8 | 8 | public $db; |
| 9 | 9 | |
| 10 | 10 | public function __construct($dbc = null) { |
@@ -18,33 +18,33 @@ discard block |
||
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 21 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 22 | 22 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 23 | 23 | $filters = array(); |
| 24 | 24 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 25 | 25 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 26 | 26 | $filters = $globalStatsFilters[$globalFilterName]; |
| 27 | 27 | } else { |
| 28 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 28 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | if (isset($filter[0]['source'])) { |
| 32 | - $filters = array_merge($filters,$filter); |
|
| 32 | + $filters = array_merge($filters, $filter); |
|
| 33 | 33 | } |
| 34 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 34 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 35 | 35 | $filter_query_join = ''; |
| 36 | 36 | $filter_query_where = ''; |
| 37 | - foreach($filters as $flt) { |
|
| 37 | + foreach ($filters as $flt) { |
|
| 38 | 38 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 39 | 39 | if (isset($flt['source'])) { |
| 40 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 40 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 41 | 41 | } else { |
| 42 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 42 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid"; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 47 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 47 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 48 | 48 | } |
| 49 | 49 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 50 | 50 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 74 | 74 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 75 | 75 | if ($filter_query_where != '') { |
| 76 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 76 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 77 | 77 | } |
| 78 | 78 | $filter_query = $filter_query_join.$filter_query_where; |
| 79 | 79 | return $filter_query; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | * @return Array the spotter information |
| 89 | 89 | * |
| 90 | 90 | */ |
| 91 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 91 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 92 | 92 | { |
| 93 | 93 | date_default_timezone_set('UTC'); |
| 94 | 94 | if (!is_string($query)) |
@@ -108,13 +108,13 @@ discard block |
||
| 108 | 108 | $sth = $this->db->prepare($query.$limitQuery); |
| 109 | 109 | $sth->execute($params); |
| 110 | 110 | } catch (PDOException $e) { |
| 111 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 111 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 112 | 112 | exit(); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | $num_rows = 0; |
| 116 | 116 | $spotter_array = array(); |
| 117 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 117 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 118 | 118 | { |
| 119 | 119 | $num_rows++; |
| 120 | 120 | $temp_array = array(); |
@@ -170,17 +170,17 @@ discard block |
||
| 170 | 170 | { |
| 171 | 171 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 172 | 172 | } else { |
| 173 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 173 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 174 | 174 | } |
| 175 | 175 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 176 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 177 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 176 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 177 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 178 | 178 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 179 | 179 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
| 180 | 180 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
| 181 | 181 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
| 182 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
| 183 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
| 182 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
| 183 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
| 184 | 184 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -217,8 +217,8 @@ discard block |
||
| 217 | 217 | { |
| 218 | 218 | $limit_array = explode(",", $limit); |
| 219 | 219 | |
| 220 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 221 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 220 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 221 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 222 | 222 | |
| 223 | 223 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 224 | 224 | { |
@@ -235,9 +235,9 @@ discard block |
||
| 235 | 235 | $orderby_query = " ORDER BY tracker_output.date DESC"; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 238 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 239 | 239 | |
| 240 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 240 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 241 | 241 | |
| 242 | 242 | return $spotter_array; |
| 243 | 243 | } |
@@ -256,8 +256,8 @@ discard block |
||
| 256 | 256 | if ($id == '') return array(); |
| 257 | 257 | $additional_query = "tracker_output.famtrackid = :id"; |
| 258 | 258 | $query_values = array(':id' => $id); |
| 259 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 260 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 259 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 260 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 261 | 261 | return $spotter_array; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | $query_values = array(); |
| 277 | 277 | $limit_query = ''; |
| 278 | 278 | $additional_query = ''; |
| 279 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 279 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 280 | 280 | if ($ident != "") |
| 281 | 281 | { |
| 282 | 282 | if (!is_string($ident)) |
@@ -292,8 +292,8 @@ discard block |
||
| 292 | 292 | { |
| 293 | 293 | $limit_array = explode(",", $limit); |
| 294 | 294 | |
| 295 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 296 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 295 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 296 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 297 | 297 | |
| 298 | 298 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 299 | 299 | { |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | return $spotter_array; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - public function getTrackerDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 320 | + public function getTrackerDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 321 | 321 | { |
| 322 | 322 | global $global_query, $globalTimezone, $globalDBdriver; |
| 323 | 323 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | $limit_query = ''; |
| 326 | 326 | $additional_query = ''; |
| 327 | 327 | |
| 328 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 328 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 329 | 329 | |
| 330 | 330 | if ($date != "") |
| 331 | 331 | { |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | { |
| 352 | 352 | $limit_array = explode(",", $limit); |
| 353 | 353 | |
| 354 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 355 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 354 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 355 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 356 | 356 | |
| 357 | 357 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 358 | 358 | { |
@@ -383,11 +383,11 @@ discard block |
||
| 383 | 383 | * @return Array list of source name |
| 384 | 384 | * |
| 385 | 385 | */ |
| 386 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 386 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 387 | 387 | { |
| 388 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 388 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 389 | 389 | $query_values = array(); |
| 390 | - $query = "SELECT DISTINCT tracker_output.source_name |
|
| 390 | + $query = "SELECT DISTINCT tracker_output.source_name |
|
| 391 | 391 | FROM tracker_output".$filter_query." tracker_output.source_name <> ''"; |
| 392 | 392 | if ($type != '') { |
| 393 | 393 | $query_values = array(':type' => $type); |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $source_array = array(); |
| 403 | 403 | $temp_array = array(); |
| 404 | 404 | |
| 405 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 405 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 406 | 406 | { |
| 407 | 407 | $temp_array['source_name'] = $row['source_name']; |
| 408 | 408 | $source_array[] = $temp_array; |
@@ -419,8 +419,8 @@ discard block |
||
| 419 | 419 | */ |
| 420 | 420 | public function getAllIdents($filters = array()) |
| 421 | 421 | { |
| 422 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 423 | - $query = "SELECT DISTINCT tracker_output.ident |
|
| 422 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 423 | + $query = "SELECT DISTINCT tracker_output.ident |
|
| 424 | 424 | FROM tracker_output".$filter_query." tracker_output.ident <> '' |
| 425 | 425 | ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0"; |
| 426 | 426 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | $ident_array = array(); |
| 431 | 431 | $temp_array = array(); |
| 432 | 432 | |
| 433 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 433 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 434 | 434 | { |
| 435 | 435 | $temp_array['ident'] = $row['ident']; |
| 436 | 436 | $ident_array[] = $temp_array; |
@@ -455,12 +455,12 @@ discard block |
||
| 455 | 455 | } else $offset = '+00:00'; |
| 456 | 456 | |
| 457 | 457 | if ($globalDBdriver == 'mysql') { |
| 458 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
| 458 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
|
| 459 | 459 | FROM tracker_output |
| 460 | 460 | WHERE tracker_output.date <> '' |
| 461 | 461 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
| 462 | 462 | } else { |
| 463 | - $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 463 | + $query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 464 | 464 | FROM tracker_output |
| 465 | 465 | WHERE tracker_output.date <> '' |
| 466 | 466 | ORDER BY tracker_output.date ASC LIMIT 0,200"; |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $date_array = array(); |
| 473 | 473 | $temp_array = array(); |
| 474 | 474 | |
| 475 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 475 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 476 | 476 | { |
| 477 | 477 | $temp_array['date'] = $row['date']; |
| 478 | 478 | |
@@ -491,11 +491,11 @@ discard block |
||
| 491 | 491 | * @return String success or false |
| 492 | 492 | * |
| 493 | 493 | */ |
| 494 | - public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
|
| 494 | + public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL) |
|
| 495 | 495 | { |
| 496 | 496 | |
| 497 | 497 | $query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid'; |
| 498 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident); |
|
| 498 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident); |
|
| 499 | 499 | |
| 500 | 500 | try { |
| 501 | 501 | $sth = $this->db->prepare($query); |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
| 520 | 520 | { |
| 521 | 521 | $query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid'; |
| 522 | - $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 522 | + $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
| 523 | 523 | |
| 524 | 524 | try { |
| 525 | 525 | $sth = $this->db->prepare($query); |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | * @param String $verticalrate vertival rate of flight |
| 560 | 560 | * @return String success or false |
| 561 | 561 | */ |
| 562 | - public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
|
| 562 | + public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '') |
|
| 563 | 563 | { |
| 564 | 564 | global $globalURL; |
| 565 | 565 | |
@@ -627,21 +627,21 @@ discard block |
||
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | |
| 630 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
| 630 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
| 631 | 631 | { |
| 632 | 632 | $date = date("Y-m-d H:i:s", time()); |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
| 636 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 637 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 638 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 639 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 640 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 641 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 642 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 643 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
| 644 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 635 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
| 636 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 637 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 638 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 639 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 640 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 641 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 642 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 643 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
| 644 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 645 | 645 | |
| 646 | 646 | if ($latitude == '' && $longitude == '') { |
| 647 | 647 | $latitude = 0; |
@@ -649,10 +649,10 @@ discard block |
||
| 649 | 649 | } |
| 650 | 650 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 651 | 651 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 652 | - $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 652 | + $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
|
| 653 | 653 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
| 654 | 654 | |
| 655 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type); |
|
| 655 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':comment' => $comment, ':type' => $type); |
|
| 656 | 656 | |
| 657 | 657 | try { |
| 658 | 658 | |
@@ -678,13 +678,13 @@ discard block |
||
| 678 | 678 | { |
| 679 | 679 | global $globalDBdriver, $globalTimezone; |
| 680 | 680 | if ($globalDBdriver == 'mysql') { |
| 681 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 681 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 682 | 682 | WHERE tracker_output.ident = :ident |
| 683 | 683 | AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 684 | 684 | AND tracker_output.date < UTC_TIMESTAMP()"; |
| 685 | 685 | $query_data = array(':ident' => $ident); |
| 686 | 686 | } else { |
| 687 | - $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 687 | + $query = "SELECT tracker_output.ident FROM tracker_output |
|
| 688 | 688 | WHERE tracker_output.ident = :ident |
| 689 | 689 | AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 690 | 690 | AND tracker_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -693,8 +693,8 @@ discard block |
||
| 693 | 693 | |
| 694 | 694 | $sth = $this->db->prepare($query); |
| 695 | 695 | $sth->execute($query_data); |
| 696 | - $ident_result=''; |
|
| 697 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 696 | + $ident_result = ''; |
|
| 697 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 698 | 698 | { |
| 699 | 699 | $ident_result = $row['ident']; |
| 700 | 700 | } |
@@ -720,8 +720,8 @@ discard block |
||
| 720 | 720 | return false; |
| 721 | 721 | } else { |
| 722 | 722 | $q_array = explode(" ", $q); |
| 723 | - foreach ($q_array as $q_item){ |
|
| 724 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 723 | + foreach ($q_array as $q_item) { |
|
| 724 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 725 | 725 | $additional_query .= " AND ("; |
| 726 | 726 | $additional_query .= "(tracker_output.ident like '%".$q_item."%')"; |
| 727 | 727 | $additional_query .= ")"; |
@@ -729,11 +729,11 @@ discard block |
||
| 729 | 729 | } |
| 730 | 730 | } |
| 731 | 731 | if ($globalDBdriver == 'mysql') { |
| 732 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
| 732 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
| 733 | 733 | WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 734 | 734 | AND tracker_output.date < UTC_TIMESTAMP()"; |
| 735 | 735 | } else { |
| 736 | - $query = "SELECT tracker_output.* FROM tracker_output |
|
| 736 | + $query = "SELECT tracker_output.* FROM tracker_output |
|
| 737 | 737 | WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 738 | 738 | AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 739 | 739 | } |
@@ -752,16 +752,16 @@ discard block |
||
| 752 | 752 | * |
| 753 | 753 | */ |
| 754 | 754 | |
| 755 | - public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 755 | + public function countAllTrackerOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 756 | 756 | { |
| 757 | 757 | global $globalDBdriver, $globalArchive; |
| 758 | 758 | //$filter_query = $this->getFilter($filters,true,true); |
| 759 | - $Connection= new Connection($this->db); |
|
| 759 | + $Connection = new Connection($this->db); |
|
| 760 | 760 | if (!$Connection->tableExists('countries')) return array(); |
| 761 | 761 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
| 762 | 762 | require_once('class.TrackerLive.php'); |
| 763 | 763 | $TrackerLive = new TrackerLive(); |
| 764 | - $filter_query = $TrackerLive->getFilter($filters,true,true); |
|
| 764 | + $filter_query = $TrackerLive->getFilter($filters, true, true); |
|
| 765 | 765 | $filter_query .= ' over_country IS NOT NULL'; |
| 766 | 766 | if ($olderthanmonths > 0) { |
| 767 | 767 | if ($globalDBdriver == 'mysql') { |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | } else { |
| 782 | 782 | require_once('class.TrackerArchive.php'); |
| 783 | 783 | $TrackerArchive = new TrackerArchive(); |
| 784 | - $filter_query = $TrackerArchive->getFilter($filters,true,true); |
|
| 784 | + $filter_query = $TrackerArchive->getFilter($filters, true, true); |
|
| 785 | 785 | $filter_query .= ' over_country IS NOT NULL'; |
| 786 | 786 | if ($olderthanmonths > 0) { |
| 787 | 787 | if ($globalDBdriver == 'mysql') { |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | $flight_array = array(); |
| 810 | 810 | $temp_array = array(); |
| 811 | 811 | |
| 812 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 812 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 813 | 813 | { |
| 814 | 814 | $temp_array['flight_count'] = $row['nb']; |
| 815 | 815 | $temp_array['flight_country'] = $row['name']; |
@@ -826,11 +826,11 @@ discard block |
||
| 826 | 826 | * @return Array the callsign list |
| 827 | 827 | * |
| 828 | 828 | */ |
| 829 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 829 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 830 | 830 | { |
| 831 | 831 | global $globalDBdriver; |
| 832 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 833 | - $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
| 832 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 833 | + $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
|
| 834 | 834 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
| 835 | 835 | if ($olderthanmonths > 0) { |
| 836 | 836 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -844,28 +844,28 @@ discard block |
||
| 844 | 844 | if ($year != '') { |
| 845 | 845 | if ($globalDBdriver == 'mysql') { |
| 846 | 846 | $query .= " AND YEAR(tracker_output.date) = :year"; |
| 847 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 847 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 848 | 848 | } else { |
| 849 | 849 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
| 850 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 850 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 851 | 851 | } |
| 852 | 852 | } |
| 853 | 853 | if ($month != '') { |
| 854 | 854 | if ($globalDBdriver == 'mysql') { |
| 855 | 855 | $query .= " AND MONTH(tracker_output.date) = :month"; |
| 856 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 856 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 857 | 857 | } else { |
| 858 | 858 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
| 859 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 859 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 860 | 860 | } |
| 861 | 861 | } |
| 862 | 862 | if ($day != '') { |
| 863 | 863 | if ($globalDBdriver == 'mysql') { |
| 864 | 864 | $query .= " AND DAY(tracker_output.date) = :day"; |
| 865 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 865 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 866 | 866 | } else { |
| 867 | 867 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
| 868 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 868 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 869 | 869 | } |
| 870 | 870 | } |
| 871 | 871 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | $callsign_array = array(); |
| 878 | 878 | $temp_array = array(); |
| 879 | 879 | |
| 880 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 880 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 881 | 881 | { |
| 882 | 882 | $temp_array['callsign_icao'] = $row['ident']; |
| 883 | 883 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | $date_array = array(); |
| 930 | 930 | $temp_array = array(); |
| 931 | 931 | |
| 932 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 932 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 933 | 933 | { |
| 934 | 934 | $temp_array['date_name'] = $row['date_name']; |
| 935 | 935 | $temp_array['date_count'] = $row['date_count']; |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | $datetime = new DateTime(); |
| 956 | 956 | $offset = $datetime->format('P'); |
| 957 | 957 | } else $offset = '+00:00'; |
| 958 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 958 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 959 | 959 | if ($globalDBdriver == 'mysql') { |
| 960 | 960 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 961 | 961 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -976,7 +976,7 @@ discard block |
||
| 976 | 976 | $date_array = array(); |
| 977 | 977 | $temp_array = array(); |
| 978 | 978 | |
| 979 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 979 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 980 | 980 | { |
| 981 | 981 | $temp_array['date_name'] = $row['date_name']; |
| 982 | 982 | $temp_array['date_count'] = $row['date_count']; |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | $datetime = new DateTime(); |
| 1002 | 1002 | $offset = $datetime->format('P'); |
| 1003 | 1003 | } else $offset = '+00:00'; |
| 1004 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1004 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1005 | 1005 | if ($globalDBdriver == 'mysql') { |
| 1006 | 1006 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 1007 | 1007 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1022,7 +1022,7 @@ discard block |
||
| 1022 | 1022 | $date_array = array(); |
| 1023 | 1023 | $temp_array = array(); |
| 1024 | 1024 | |
| 1025 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1025 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1026 | 1026 | { |
| 1027 | 1027 | $temp_array['date_name'] = $row['date_name']; |
| 1028 | 1028 | $temp_array['date_count'] = $row['date_count']; |
@@ -1069,7 +1069,7 @@ discard block |
||
| 1069 | 1069 | $date_array = array(); |
| 1070 | 1070 | $temp_array = array(); |
| 1071 | 1071 | |
| 1072 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1072 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1073 | 1073 | { |
| 1074 | 1074 | $temp_array['month_name'] = $row['month_name']; |
| 1075 | 1075 | $temp_array['year_name'] = $row['year_name']; |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | $datetime = new DateTime(); |
| 1099 | 1099 | $offset = $datetime->format('P'); |
| 1100 | 1100 | } else $offset = '+00:00'; |
| 1101 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1101 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1102 | 1102 | if ($globalDBdriver == 'mysql') { |
| 1103 | 1103 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 1104 | 1104 | FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1119,7 +1119,7 @@ discard block |
||
| 1119 | 1119 | $date_array = array(); |
| 1120 | 1120 | $temp_array = array(); |
| 1121 | 1121 | |
| 1122 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1122 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1123 | 1123 | { |
| 1124 | 1124 | $temp_array['year_name'] = $row['year_name']; |
| 1125 | 1125 | $temp_array['month_name'] = $row['month_name']; |
@@ -1139,7 +1139,7 @@ discard block |
||
| 1139 | 1139 | * @return Array the hour list |
| 1140 | 1140 | * |
| 1141 | 1141 | */ |
| 1142 | - public function countAllHours($orderby,$filters = array()) |
|
| 1142 | + public function countAllHours($orderby, $filters = array()) |
|
| 1143 | 1143 | { |
| 1144 | 1144 | global $globalTimezone, $globalDBdriver; |
| 1145 | 1145 | if ($globalTimezone != '') { |
@@ -1187,7 +1187,7 @@ discard block |
||
| 1187 | 1187 | $hour_array = array(); |
| 1188 | 1188 | $temp_array = array(); |
| 1189 | 1189 | |
| 1190 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1190 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1191 | 1191 | { |
| 1192 | 1192 | $temp_array['hour_name'] = $row['hour_name']; |
| 1193 | 1193 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1209,8 +1209,8 @@ discard block |
||
| 1209 | 1209 | public function countAllHoursByDate($date, $filters = array()) |
| 1210 | 1210 | { |
| 1211 | 1211 | global $globalTimezone, $globalDBdriver; |
| 1212 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1213 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 1212 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1213 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 1214 | 1214 | if ($globalTimezone != '') { |
| 1215 | 1215 | date_default_timezone_set($globalTimezone); |
| 1216 | 1216 | $datetime = new DateTime($date); |
@@ -1218,12 +1218,12 @@ discard block |
||
| 1218 | 1218 | } else $offset = '+00:00'; |
| 1219 | 1219 | |
| 1220 | 1220 | if ($globalDBdriver == 'mysql') { |
| 1221 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1221 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1222 | 1222 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date |
| 1223 | 1223 | GROUP BY hour_name |
| 1224 | 1224 | ORDER BY hour_name ASC"; |
| 1225 | 1225 | } else { |
| 1226 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1226 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1227 | 1227 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 1228 | 1228 | GROUP BY hour_name |
| 1229 | 1229 | ORDER BY hour_name ASC"; |
@@ -1235,7 +1235,7 @@ discard block |
||
| 1235 | 1235 | $hour_array = array(); |
| 1236 | 1236 | $temp_array = array(); |
| 1237 | 1237 | |
| 1238 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1238 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1239 | 1239 | { |
| 1240 | 1240 | $temp_array['hour_name'] = $row['hour_name']; |
| 1241 | 1241 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1257,8 +1257,8 @@ discard block |
||
| 1257 | 1257 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1258 | 1258 | { |
| 1259 | 1259 | global $globalTimezone, $globalDBdriver; |
| 1260 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1261 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1260 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1261 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1262 | 1262 | if ($globalTimezone != '') { |
| 1263 | 1263 | date_default_timezone_set($globalTimezone); |
| 1264 | 1264 | $datetime = new DateTime(); |
@@ -1266,12 +1266,12 @@ discard block |
||
| 1266 | 1266 | } else $offset = '+00:00'; |
| 1267 | 1267 | |
| 1268 | 1268 | if ($globalDBdriver == 'mysql') { |
| 1269 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1269 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1270 | 1270 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
| 1271 | 1271 | GROUP BY hour_name |
| 1272 | 1272 | ORDER BY hour_name ASC"; |
| 1273 | 1273 | } else { |
| 1274 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1274 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1275 | 1275 | FROM tracker_output".$filter_query." tracker_output.ident = :ident |
| 1276 | 1276 | GROUP BY hour_name |
| 1277 | 1277 | ORDER BY hour_name ASC"; |
@@ -1279,12 +1279,12 @@ discard block |
||
| 1279 | 1279 | |
| 1280 | 1280 | |
| 1281 | 1281 | $sth = $this->db->prepare($query); |
| 1282 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 1282 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 1283 | 1283 | |
| 1284 | 1284 | $hour_array = array(); |
| 1285 | 1285 | $temp_array = array(); |
| 1286 | 1286 | |
| 1287 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1287 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1288 | 1288 | { |
| 1289 | 1289 | $temp_array['hour_name'] = $row['hour_name']; |
| 1290 | 1290 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1303,33 +1303,33 @@ discard block |
||
| 1303 | 1303 | * @return Integer the number of trackers |
| 1304 | 1304 | * |
| 1305 | 1305 | */ |
| 1306 | - public function countOverallTracker($filters = array(),$year = '',$month = '') |
|
| 1306 | + public function countOverallTracker($filters = array(), $year = '', $month = '') |
|
| 1307 | 1307 | { |
| 1308 | 1308 | global $globalDBdriver; |
| 1309 | 1309 | //$queryi = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output"; |
| 1310 | - $queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output"; |
|
| 1310 | + $queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output"; |
|
| 1311 | 1311 | $query_values = array(); |
| 1312 | 1312 | $query = ''; |
| 1313 | 1313 | if ($year != '') { |
| 1314 | 1314 | if ($globalDBdriver == 'mysql') { |
| 1315 | 1315 | $query .= " AND YEAR(tracker_output.date) = :year"; |
| 1316 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1316 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1317 | 1317 | } else { |
| 1318 | 1318 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
| 1319 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1319 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1320 | 1320 | } |
| 1321 | 1321 | } |
| 1322 | 1322 | if ($month != '') { |
| 1323 | 1323 | if ($globalDBdriver == 'mysql') { |
| 1324 | 1324 | $query .= " AND MONTH(tracker_output.date) = :month"; |
| 1325 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1325 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1326 | 1326 | } else { |
| 1327 | 1327 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
| 1328 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1328 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1329 | 1329 | } |
| 1330 | 1330 | } |
| 1331 | 1331 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 1332 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1332 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 1333 | 1333 | |
| 1334 | 1334 | $sth = $this->db->prepare($queryi); |
| 1335 | 1335 | $sth->execute($query_values); |
@@ -1342,32 +1342,32 @@ discard block |
||
| 1342 | 1342 | * @return Integer the number of flights |
| 1343 | 1343 | * |
| 1344 | 1344 | */ |
| 1345 | - public function countOverallTrackerTypes($filters = array(),$year = '',$month = '') |
|
| 1345 | + public function countOverallTrackerTypes($filters = array(), $year = '', $month = '') |
|
| 1346 | 1346 | { |
| 1347 | 1347 | global $globalDBdriver; |
| 1348 | - $queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output"; |
|
| 1348 | + $queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output"; |
|
| 1349 | 1349 | $query_values = array(); |
| 1350 | 1350 | $query = ''; |
| 1351 | 1351 | if ($year != '') { |
| 1352 | 1352 | if ($globalDBdriver == 'mysql') { |
| 1353 | 1353 | $query .= " AND YEAR(tracker_output.date) = :year"; |
| 1354 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1354 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1355 | 1355 | } else { |
| 1356 | 1356 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
| 1357 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1357 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1358 | 1358 | } |
| 1359 | 1359 | } |
| 1360 | 1360 | if ($month != '') { |
| 1361 | 1361 | if ($globalDBdriver == 'mysql') { |
| 1362 | 1362 | $query .= " AND MONTH(tracker_output.date) = :month"; |
| 1363 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1363 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1364 | 1364 | } else { |
| 1365 | 1365 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
| 1366 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1366 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1367 | 1367 | } |
| 1368 | 1368 | } |
| 1369 | 1369 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 1370 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1370 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 1371 | 1371 | |
| 1372 | 1372 | $sth = $this->db->prepare($queryi); |
| 1373 | 1373 | $sth->execute($query_values); |
@@ -1384,7 +1384,7 @@ discard block |
||
| 1384 | 1384 | public function countAllHoursFromToday($filters = array()) |
| 1385 | 1385 | { |
| 1386 | 1386 | global $globalTimezone, $globalDBdriver; |
| 1387 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1387 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1388 | 1388 | if ($globalTimezone != '') { |
| 1389 | 1389 | date_default_timezone_set($globalTimezone); |
| 1390 | 1390 | $datetime = new DateTime(); |
@@ -1392,12 +1392,12 @@ discard block |
||
| 1392 | 1392 | } else $offset = '+00:00'; |
| 1393 | 1393 | |
| 1394 | 1394 | if ($globalDBdriver == 'mysql') { |
| 1395 | - $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1395 | + $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 1396 | 1396 | FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE() |
| 1397 | 1397 | GROUP BY hour_name |
| 1398 | 1398 | ORDER BY hour_name ASC"; |
| 1399 | 1399 | } else { |
| 1400 | - $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1400 | + $query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 1401 | 1401 | FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 1402 | 1402 | GROUP BY hour_name |
| 1403 | 1403 | ORDER BY hour_name ASC"; |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | $hour_array = array(); |
| 1410 | 1410 | $temp_array = array(); |
| 1411 | 1411 | |
| 1412 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1412 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1413 | 1413 | { |
| 1414 | 1414 | $temp_array['hour_name'] = $row['hour_name']; |
| 1415 | 1415 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1428,9 +1428,9 @@ discard block |
||
| 1428 | 1428 | */ |
| 1429 | 1429 | public function getTrackerIDBasedOnFamTrackID($famtrackid) |
| 1430 | 1430 | { |
| 1431 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
| 1431 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
| 1432 | 1432 | |
| 1433 | - $query = "SELECT tracker_output.tracker_id |
|
| 1433 | + $query = "SELECT tracker_output.tracker_id |
|
| 1434 | 1434 | FROM tracker_output |
| 1435 | 1435 | WHERE tracker_output.famtrackid = '".$famtrackid."'"; |
| 1436 | 1436 | |
@@ -1438,7 +1438,7 @@ discard block |
||
| 1438 | 1438 | $sth = $this->db->prepare($query); |
| 1439 | 1439 | $sth->execute(); |
| 1440 | 1440 | |
| 1441 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1441 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1442 | 1442 | { |
| 1443 | 1443 | return $row['tracker_id']; |
| 1444 | 1444 | } |
@@ -1463,23 +1463,23 @@ discard block |
||
| 1463 | 1463 | } |
| 1464 | 1464 | |
| 1465 | 1465 | $current_date = date("Y-m-d H:i:s"); |
| 1466 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 1466 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 1467 | 1467 | |
| 1468 | 1468 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 1469 | 1469 | |
| 1470 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 1470 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 1471 | 1471 | $years = $time_array['years']; |
| 1472 | 1472 | |
| 1473 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 1473 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 1474 | 1474 | $months = $time_array['months']; |
| 1475 | 1475 | |
| 1476 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 1476 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 1477 | 1477 | $days = $time_array['days']; |
| 1478 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 1478 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 1479 | 1479 | $hours = $time_array['hours']; |
| 1480 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 1480 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 1481 | 1481 | $minutes = $time_array['minutes']; |
| 1482 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 1482 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 1483 | 1483 | |
| 1484 | 1484 | return $time_array; |
| 1485 | 1485 | } |
@@ -1502,63 +1502,63 @@ discard block |
||
| 1502 | 1502 | $temp_array['direction_degree'] = $direction; |
| 1503 | 1503 | $temp_array['direction_shortname'] = "N"; |
| 1504 | 1504 | $temp_array['direction_fullname'] = "North"; |
| 1505 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 1505 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 1506 | 1506 | $temp_array['direction_degree'] = $direction; |
| 1507 | 1507 | $temp_array['direction_shortname'] = "NNE"; |
| 1508 | 1508 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 1509 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 1509 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 1510 | 1510 | $temp_array['direction_degree'] = $direction; |
| 1511 | 1511 | $temp_array['direction_shortname'] = "NE"; |
| 1512 | 1512 | $temp_array['direction_fullname'] = "Northeast"; |
| 1513 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 1513 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 1514 | 1514 | $temp_array['direction_degree'] = $direction; |
| 1515 | 1515 | $temp_array['direction_shortname'] = "ENE"; |
| 1516 | 1516 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 1517 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 1517 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 1518 | 1518 | $temp_array['direction_degree'] = $direction; |
| 1519 | 1519 | $temp_array['direction_shortname'] = "E"; |
| 1520 | 1520 | $temp_array['direction_fullname'] = "East"; |
| 1521 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 1521 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 1522 | 1522 | $temp_array['direction_degree'] = $direction; |
| 1523 | 1523 | $temp_array['direction_shortname'] = "ESE"; |
| 1524 | 1524 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 1525 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 1525 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 1526 | 1526 | $temp_array['direction_degree'] = $direction; |
| 1527 | 1527 | $temp_array['direction_shortname'] = "SE"; |
| 1528 | 1528 | $temp_array['direction_fullname'] = "Southeast"; |
| 1529 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 1529 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 1530 | 1530 | $temp_array['direction_degree'] = $direction; |
| 1531 | 1531 | $temp_array['direction_shortname'] = "SSE"; |
| 1532 | 1532 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 1533 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 1533 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 1534 | 1534 | $temp_array['direction_degree'] = $direction; |
| 1535 | 1535 | $temp_array['direction_shortname'] = "S"; |
| 1536 | 1536 | $temp_array['direction_fullname'] = "South"; |
| 1537 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 1537 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 1538 | 1538 | $temp_array['direction_degree'] = $direction; |
| 1539 | 1539 | $temp_array['direction_shortname'] = "SSW"; |
| 1540 | 1540 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 1541 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 1541 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 1542 | 1542 | $temp_array['direction_degree'] = $direction; |
| 1543 | 1543 | $temp_array['direction_shortname'] = "SW"; |
| 1544 | 1544 | $temp_array['direction_fullname'] = "Southwest"; |
| 1545 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 1545 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 1546 | 1546 | $temp_array['direction_degree'] = $direction; |
| 1547 | 1547 | $temp_array['direction_shortname'] = "WSW"; |
| 1548 | 1548 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 1549 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 1549 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 1550 | 1550 | $temp_array['direction_degree'] = $direction; |
| 1551 | 1551 | $temp_array['direction_shortname'] = "W"; |
| 1552 | 1552 | $temp_array['direction_fullname'] = "West"; |
| 1553 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 1553 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 1554 | 1554 | $temp_array['direction_degree'] = $direction; |
| 1555 | 1555 | $temp_array['direction_shortname'] = "WNW"; |
| 1556 | 1556 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 1557 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 1557 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 1558 | 1558 | $temp_array['direction_degree'] = $direction; |
| 1559 | 1559 | $temp_array['direction_shortname'] = "NW"; |
| 1560 | 1560 | $temp_array['direction_fullname'] = "Northwest"; |
| 1561 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 1561 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 1562 | 1562 | $temp_array['direction_degree'] = $direction; |
| 1563 | 1563 | $temp_array['direction_shortname'] = "NNW"; |
| 1564 | 1564 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1575,11 +1575,11 @@ discard block |
||
| 1575 | 1575 | * @param Float $longitude longitute of the flight |
| 1576 | 1576 | * @return String the countrie |
| 1577 | 1577 | */ |
| 1578 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 1578 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 1579 | 1579 | { |
| 1580 | 1580 | global $globalDBdriver, $globalDebug; |
| 1581 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1582 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1581 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1582 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1583 | 1583 | |
| 1584 | 1584 | $Connection = new Connection($this->db); |
| 1585 | 1585 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1619,7 +1619,7 @@ discard block |
||
| 1619 | 1619 | public function getCountryFromISO2($iso2) |
| 1620 | 1620 | { |
| 1621 | 1621 | global $globalDBdriver, $globalDebug; |
| 1622 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
| 1622 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
| 1623 | 1623 | |
| 1624 | 1624 | $Connection = new Connection($this->db); |
| 1625 | 1625 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1648,11 +1648,11 @@ discard block |
||
| 1648 | 1648 | * @return Array the vessel type list |
| 1649 | 1649 | * |
| 1650 | 1650 | */ |
| 1651 | - public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 1651 | + public function countAllTrackerTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 1652 | 1652 | { |
| 1653 | 1653 | global $globalDBdriver; |
| 1654 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1655 | - $query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count |
|
| 1654 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1655 | + $query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count |
|
| 1656 | 1656 | FROM tracker_output ".$filter_query." tracker_output.type <> ''"; |
| 1657 | 1657 | if ($olderthanmonths > 0) { |
| 1658 | 1658 | if ($globalDBdriver == 'mysql') { |
@@ -1672,28 +1672,28 @@ discard block |
||
| 1672 | 1672 | if ($year != '') { |
| 1673 | 1673 | if ($globalDBdriver == 'mysql') { |
| 1674 | 1674 | $query .= " AND YEAR(tracker_output.date) = :year"; |
| 1675 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1675 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1676 | 1676 | } else { |
| 1677 | 1677 | $query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year"; |
| 1678 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 1678 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 1679 | 1679 | } |
| 1680 | 1680 | } |
| 1681 | 1681 | if ($month != '') { |
| 1682 | 1682 | if ($globalDBdriver == 'mysql') { |
| 1683 | 1683 | $query .= " AND MONTH(tracker_output.date) = :month"; |
| 1684 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1684 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1685 | 1685 | } else { |
| 1686 | 1686 | $query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month"; |
| 1687 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 1687 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 1688 | 1688 | } |
| 1689 | 1689 | } |
| 1690 | 1690 | if ($day != '') { |
| 1691 | 1691 | if ($globalDBdriver == 'mysql') { |
| 1692 | 1692 | $query .= " AND DAY(tracker_output.date) = :day"; |
| 1693 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1693 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1694 | 1694 | } else { |
| 1695 | 1695 | $query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day"; |
| 1696 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 1696 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 1697 | 1697 | } |
| 1698 | 1698 | } |
| 1699 | 1699 | $query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC"; |
@@ -1702,7 +1702,7 @@ discard block |
||
| 1702 | 1702 | $sth->execute($query_values); |
| 1703 | 1703 | $tracker_array = array(); |
| 1704 | 1704 | $temp_array = array(); |
| 1705 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1705 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1706 | 1706 | { |
| 1707 | 1707 | $temp_array['tracker_type'] = $row['tracker_type']; |
| 1708 | 1708 | $temp_array['tracker_type_count'] = $row['tracker_type_count']; |
@@ -1737,7 +1737,7 @@ discard block |
||
| 1737 | 1737 | |
| 1738 | 1738 | $bitly_data = json_decode($bitly_data); |
| 1739 | 1739 | $bitly_url = ''; |
| 1740 | - if ($bitly_data->status_txt = "OK"){ |
|
| 1740 | + if ($bitly_data->status_txt = "OK") { |
|
| 1741 | 1741 | $bitly_url = $bitly_data->data->url; |
| 1742 | 1742 | } |
| 1743 | 1743 | |
@@ -1747,7 +1747,7 @@ discard block |
||
| 1747 | 1747 | |
| 1748 | 1748 | public function getOrderBy() |
| 1749 | 1749 | { |
| 1750 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 1750 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 1751 | 1751 | |
| 1752 | 1752 | return $orderby; |
| 1753 | 1753 | |
@@ -31,7 +31,9 @@ discard block |
||
| 31 | 31 | if (isset($filter[0]['source'])) { |
| 32 | 32 | $filters = array_merge($filters,$filter); |
| 33 | 33 | } |
| 34 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 34 | + if (is_array($globalFilter)) { |
|
| 35 | + $filter = array_merge($filter,$globalFilter); |
|
| 36 | + } |
|
| 35 | 37 | $filter_query_join = ''; |
| 36 | 38 | $filter_query_where = ''; |
| 37 | 39 | foreach($filters as $flt) { |
@@ -70,8 +72,11 @@ discard block |
||
| 70 | 72 | $filter_query_where .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
| 71 | 73 | } |
| 72 | 74 | } |
| 73 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 74 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 75 | + if ($filter_query_where == '' && $where) { |
|
| 76 | + $filter_query_where = ' WHERE'; |
|
| 77 | + } elseif ($filter_query_where != '' && $and) { |
|
| 78 | + $filter_query_where .= ' AND'; |
|
| 79 | + } |
|
| 75 | 80 | if ($filter_query_where != '') { |
| 76 | 81 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 77 | 82 | } |
@@ -125,26 +130,43 @@ discard block |
||
| 125 | 130 | $temp_array['spotter_id'] = $row['spotter_archive_id']; |
| 126 | 131 | } elseif (isset($row['spotter_archive_output_id'])) { |
| 127 | 132 | $temp_array['spotter_id'] = $row['spotter_archive_output_id']; |
| 128 | - */} |
|
| 129 | - elseif (isset($row['trackerid'])) { |
|
| 133 | + */} elseif (isset($row['trackerid'])) { |
|
| 130 | 134 | $temp_array['trackerid'] = $row['trackerid']; |
| 131 | 135 | } else { |
| 132 | 136 | $temp_array['trackerid'] = ''; |
| 133 | 137 | } |
| 134 | - if (isset($row['famtrackid'])) $temp_array['famtrackid'] = $row['famtrackid']; |
|
| 135 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
| 136 | - if (isset($row['comment'])) $temp_array['comment'] = $row['comment']; |
|
| 138 | + if (isset($row['famtrackid'])) { |
|
| 139 | + $temp_array['famtrackid'] = $row['famtrackid']; |
|
| 140 | + } |
|
| 141 | + if (isset($row['type'])) { |
|
| 142 | + $temp_array['type'] = $row['type']; |
|
| 143 | + } |
|
| 144 | + if (isset($row['comment'])) { |
|
| 145 | + $temp_array['comment'] = $row['comment']; |
|
| 146 | + } |
|
| 137 | 147 | $temp_array['ident'] = $row['ident']; |
| 138 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 139 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 140 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 141 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 148 | + if (isset($row['latitude'])) { |
|
| 149 | + $temp_array['latitude'] = $row['latitude']; |
|
| 150 | + } |
|
| 151 | + if (isset($row['longitude'])) { |
|
| 152 | + $temp_array['longitude'] = $row['longitude']; |
|
| 153 | + } |
|
| 154 | + if (isset($row['format_source'])) { |
|
| 155 | + $temp_array['format_source'] = $row['format_source']; |
|
| 156 | + } |
|
| 157 | + if (isset($row['altitude'])) { |
|
| 158 | + $temp_array['altitude'] = $row['altitude']; |
|
| 159 | + } |
|
| 142 | 160 | if (isset($row['heading'])) { |
| 143 | 161 | $temp_array['heading'] = $row['heading']; |
| 144 | 162 | $heading_direction = $this->parseDirection($row['heading']); |
| 145 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 163 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 164 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 165 | + } |
|
| 166 | + } |
|
| 167 | + if (isset($row['ground_speed'])) { |
|
| 168 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 146 | 169 | } |
| 147 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 148 | 170 | |
| 149 | 171 | if (isset($row['date'])) { |
| 150 | 172 | $dateArray = $this->parseDateString($row['date']); |
@@ -187,13 +209,21 @@ discard block |
||
| 187 | 209 | } |
| 188 | 210 | |
| 189 | 211 | $fromsource = NULL; |
| 190 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 191 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 192 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 212 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 213 | + $temp_array['source_name'] = $row['source_name']; |
|
| 214 | + } |
|
| 215 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 216 | + $temp_array['over_country'] = $row['over_country']; |
|
| 217 | + } |
|
| 218 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 219 | + $temp_array['distance'] = $row['distance']; |
|
| 220 | + } |
|
| 193 | 221 | $temp_array['query_number_rows'] = $num_rows; |
| 194 | 222 | $spotter_array[] = $temp_array; |
| 195 | 223 | } |
| 196 | - if ($num_rows == 0) return array(); |
|
| 224 | + if ($num_rows == 0) { |
|
| 225 | + return array(); |
|
| 226 | + } |
|
| 197 | 227 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 198 | 228 | return $spotter_array; |
| 199 | 229 | } |
@@ -224,8 +254,12 @@ discard block |
||
| 224 | 254 | { |
| 225 | 255 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 226 | 256 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 227 | - } else $limit_query = ""; |
|
| 228 | - } else $limit_query = ""; |
|
| 257 | + } else { |
|
| 258 | + $limit_query = ""; |
|
| 259 | + } |
|
| 260 | + } else { |
|
| 261 | + $limit_query = ""; |
|
| 262 | + } |
|
| 229 | 263 | |
| 230 | 264 | if ($sort != "") |
| 231 | 265 | { |
@@ -253,7 +287,9 @@ discard block |
||
| 253 | 287 | global $global_query; |
| 254 | 288 | |
| 255 | 289 | date_default_timezone_set('UTC'); |
| 256 | - if ($id == '') return array(); |
|
| 290 | + if ($id == '') { |
|
| 291 | + return array(); |
|
| 292 | + } |
|
| 257 | 293 | $additional_query = "tracker_output.famtrackid = :id"; |
| 258 | 294 | $query_values = array(':id' => $id); |
| 259 | 295 | $query = $global_query." WHERE ".$additional_query." "; |
@@ -396,8 +432,11 @@ discard block |
||
| 396 | 432 | $query .= " ORDER BY tracker_output.source_name ASC"; |
| 397 | 433 | |
| 398 | 434 | $sth = $this->db->prepare($query); |
| 399 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 400 | - else $sth->execute(); |
|
| 435 | + if (!empty($query_values)) { |
|
| 436 | + $sth->execute($query_values); |
|
| 437 | + } else { |
|
| 438 | + $sth->execute(); |
|
| 439 | + } |
|
| 401 | 440 | |
| 402 | 441 | $source_array = array(); |
| 403 | 442 | $temp_array = array(); |
@@ -452,7 +491,9 @@ discard block |
||
| 452 | 491 | date_default_timezone_set($globalTimezone); |
| 453 | 492 | $datetime = new DateTime(); |
| 454 | 493 | $offset = $datetime->format('P'); |
| 455 | - } else $offset = '+00:00'; |
|
| 494 | + } else { |
|
| 495 | + $offset = '+00:00'; |
|
| 496 | + } |
|
| 456 | 497 | |
| 457 | 498 | if ($globalDBdriver == 'mysql') { |
| 458 | 499 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
@@ -608,7 +649,9 @@ discard block |
||
| 608 | 649 | { |
| 609 | 650 | return false; |
| 610 | 651 | } |
| 611 | - } else $altitude = 0; |
|
| 652 | + } else { |
|
| 653 | + $altitude = 0; |
|
| 654 | + } |
|
| 612 | 655 | |
| 613 | 656 | if ($heading != "") |
| 614 | 657 | { |
@@ -647,8 +690,12 @@ discard block |
||
| 647 | 690 | $latitude = 0; |
| 648 | 691 | $longitude = 0; |
| 649 | 692 | } |
| 650 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 651 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 693 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 694 | + $heading = 0; |
|
| 695 | + } |
|
| 696 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 697 | + $groundspeed = 0; |
|
| 698 | + } |
|
| 652 | 699 | $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
| 653 | 700 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
| 654 | 701 | |
@@ -757,7 +804,9 @@ discard block |
||
| 757 | 804 | global $globalDBdriver, $globalArchive; |
| 758 | 805 | //$filter_query = $this->getFilter($filters,true,true); |
| 759 | 806 | $Connection= new Connection($this->db); |
| 760 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 807 | + if (!$Connection->tableExists('countries')) { |
|
| 808 | + return array(); |
|
| 809 | + } |
|
| 761 | 810 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
| 762 | 811 | require_once('class.TrackerLive.php'); |
| 763 | 812 | $TrackerLive = new TrackerLive(); |
@@ -800,7 +849,9 @@ discard block |
||
| 800 | 849 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT famtrackid,over_country FROM tracker_archive".$filter_query.") l ON c.iso2 = l.over_country "; |
| 801 | 850 | } |
| 802 | 851 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 803 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 852 | + if ($limit) { |
|
| 853 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 854 | + } |
|
| 804 | 855 | |
| 805 | 856 | |
| 806 | 857 | $sth = $this->db->prepare($query); |
@@ -833,12 +884,18 @@ discard block |
||
| 833 | 884 | $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
| 834 | 885 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
| 835 | 886 | if ($olderthanmonths > 0) { |
| 836 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 837 | - else $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 887 | + if ($globalDBdriver == 'mysql') { |
|
| 888 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 889 | + } else { |
|
| 890 | + $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 891 | + } |
|
| 838 | 892 | } |
| 839 | 893 | if ($sincedate != '') { |
| 840 | - if ($globalDBdriver == 'mysql') $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
| 841 | - else $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 894 | + if ($globalDBdriver == 'mysql') { |
|
| 895 | + $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
| 896 | + } else { |
|
| 897 | + $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 898 | + } |
|
| 842 | 899 | } |
| 843 | 900 | $query_values = array(); |
| 844 | 901 | if ($year != '') { |
@@ -869,7 +926,9 @@ discard block |
||
| 869 | 926 | } |
| 870 | 927 | } |
| 871 | 928 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
| 872 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 929 | + if ($limit) { |
|
| 930 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 931 | + } |
|
| 873 | 932 | |
| 874 | 933 | $sth = $this->db->prepare($query); |
| 875 | 934 | $sth->execute($query_values); |
@@ -904,7 +963,9 @@ discard block |
||
| 904 | 963 | date_default_timezone_set($globalTimezone); |
| 905 | 964 | $datetime = new DateTime(); |
| 906 | 965 | $offset = $datetime->format('P'); |
| 907 | - } else $offset = '+00:00'; |
|
| 966 | + } else { |
|
| 967 | + $offset = '+00:00'; |
|
| 968 | + } |
|
| 908 | 969 | |
| 909 | 970 | if ($globalDBdriver == 'mysql') { |
| 910 | 971 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -954,7 +1015,9 @@ discard block |
||
| 954 | 1015 | date_default_timezone_set($globalTimezone); |
| 955 | 1016 | $datetime = new DateTime(); |
| 956 | 1017 | $offset = $datetime->format('P'); |
| 957 | - } else $offset = '+00:00'; |
|
| 1018 | + } else { |
|
| 1019 | + $offset = '+00:00'; |
|
| 1020 | + } |
|
| 958 | 1021 | $filter_query = $this->getFilter($filters,true,true); |
| 959 | 1022 | if ($globalDBdriver == 'mysql') { |
| 960 | 1023 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1000,7 +1063,9 @@ discard block |
||
| 1000 | 1063 | date_default_timezone_set($globalTimezone); |
| 1001 | 1064 | $datetime = new DateTime(); |
| 1002 | 1065 | $offset = $datetime->format('P'); |
| 1003 | - } else $offset = '+00:00'; |
|
| 1066 | + } else { |
|
| 1067 | + $offset = '+00:00'; |
|
| 1068 | + } |
|
| 1004 | 1069 | $filter_query = $this->getFilter($filters,true,true); |
| 1005 | 1070 | if ($globalDBdriver == 'mysql') { |
| 1006 | 1071 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1048,7 +1113,9 @@ discard block |
||
| 1048 | 1113 | date_default_timezone_set($globalTimezone); |
| 1049 | 1114 | $datetime = new DateTime(); |
| 1050 | 1115 | $offset = $datetime->format('P'); |
| 1051 | - } else $offset = '+00:00'; |
|
| 1116 | + } else { |
|
| 1117 | + $offset = '+00:00'; |
|
| 1118 | + } |
|
| 1052 | 1119 | |
| 1053 | 1120 | if ($globalDBdriver == 'mysql') { |
| 1054 | 1121 | $query = "SELECT YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1097,7 +1164,9 @@ discard block |
||
| 1097 | 1164 | date_default_timezone_set($globalTimezone); |
| 1098 | 1165 | $datetime = new DateTime(); |
| 1099 | 1166 | $offset = $datetime->format('P'); |
| 1100 | - } else $offset = '+00:00'; |
|
| 1167 | + } else { |
|
| 1168 | + $offset = '+00:00'; |
|
| 1169 | + } |
|
| 1101 | 1170 | $filter_query = $this->getFilter($filters,true,true); |
| 1102 | 1171 | if ($globalDBdriver == 'mysql') { |
| 1103 | 1172 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -1146,7 +1215,9 @@ discard block |
||
| 1146 | 1215 | date_default_timezone_set($globalTimezone); |
| 1147 | 1216 | $datetime = new DateTime(); |
| 1148 | 1217 | $offset = $datetime->format('P'); |
| 1149 | - } else $offset = '+00:00'; |
|
| 1218 | + } else { |
|
| 1219 | + $offset = '+00:00'; |
|
| 1220 | + } |
|
| 1150 | 1221 | |
| 1151 | 1222 | $orderby_sql = ''; |
| 1152 | 1223 | if ($orderby == "hour") |
@@ -1215,7 +1286,9 @@ discard block |
||
| 1215 | 1286 | date_default_timezone_set($globalTimezone); |
| 1216 | 1287 | $datetime = new DateTime($date); |
| 1217 | 1288 | $offset = $datetime->format('P'); |
| 1218 | - } else $offset = '+00:00'; |
|
| 1289 | + } else { |
|
| 1290 | + $offset = '+00:00'; |
|
| 1291 | + } |
|
| 1219 | 1292 | |
| 1220 | 1293 | if ($globalDBdriver == 'mysql') { |
| 1221 | 1294 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1263,7 +1336,9 @@ discard block |
||
| 1263 | 1336 | date_default_timezone_set($globalTimezone); |
| 1264 | 1337 | $datetime = new DateTime(); |
| 1265 | 1338 | $offset = $datetime->format('P'); |
| 1266 | - } else $offset = '+00:00'; |
|
| 1339 | + } else { |
|
| 1340 | + $offset = '+00:00'; |
|
| 1341 | + } |
|
| 1267 | 1342 | |
| 1268 | 1343 | if ($globalDBdriver == 'mysql') { |
| 1269 | 1344 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1328,8 +1403,11 @@ discard block |
||
| 1328 | 1403 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 1329 | 1404 | } |
| 1330 | 1405 | } |
| 1331 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 1332 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1406 | + if (empty($query_values)) { |
|
| 1407 | + $queryi .= $this->getFilter($filters); |
|
| 1408 | + } else { |
|
| 1409 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1410 | + } |
|
| 1333 | 1411 | |
| 1334 | 1412 | $sth = $this->db->prepare($queryi); |
| 1335 | 1413 | $sth->execute($query_values); |
@@ -1366,8 +1444,11 @@ discard block |
||
| 1366 | 1444 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 1367 | 1445 | } |
| 1368 | 1446 | } |
| 1369 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 1370 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1447 | + if (empty($query_values)) { |
|
| 1448 | + $queryi .= $this->getFilter($filters); |
|
| 1449 | + } else { |
|
| 1450 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 1451 | + } |
|
| 1371 | 1452 | |
| 1372 | 1453 | $sth = $this->db->prepare($queryi); |
| 1373 | 1454 | $sth->execute($query_values); |
@@ -1389,7 +1470,9 @@ discard block |
||
| 1389 | 1470 | date_default_timezone_set($globalTimezone); |
| 1390 | 1471 | $datetime = new DateTime(); |
| 1391 | 1472 | $offset = $datetime->format('P'); |
| 1392 | - } else $offset = '+00:00'; |
|
| 1473 | + } else { |
|
| 1474 | + $offset = '+00:00'; |
|
| 1475 | + } |
|
| 1393 | 1476 | |
| 1394 | 1477 | if ($globalDBdriver == 'mysql') { |
| 1395 | 1478 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1493,7 +1576,9 @@ discard block |
||
| 1493 | 1576 | */ |
| 1494 | 1577 | public function parseDirection($direction = 0) |
| 1495 | 1578 | { |
| 1496 | - if ($direction == '') $direction = 0; |
|
| 1579 | + if ($direction == '') { |
|
| 1580 | + $direction = 0; |
|
| 1581 | + } |
|
| 1497 | 1582 | $direction_array = array(); |
| 1498 | 1583 | $temp_array = array(); |
| 1499 | 1584 | |
@@ -1582,7 +1667,9 @@ discard block |
||
| 1582 | 1667 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1583 | 1668 | |
| 1584 | 1669 | $Connection = new Connection($this->db); |
| 1585 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 1670 | + if (!$Connection->tableExists('countries')) { |
|
| 1671 | + return ''; |
|
| 1672 | + } |
|
| 1586 | 1673 | |
| 1587 | 1674 | try { |
| 1588 | 1675 | /* |
@@ -1602,9 +1689,13 @@ discard block |
||
| 1602 | 1689 | $sth->closeCursor(); |
| 1603 | 1690 | if (count($row) > 0) { |
| 1604 | 1691 | return $row; |
| 1605 | - } else return ''; |
|
| 1692 | + } else { |
|
| 1693 | + return ''; |
|
| 1694 | + } |
|
| 1606 | 1695 | } catch (PDOException $e) { |
| 1607 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 1696 | + if (isset($globalDebug) && $globalDebug) { |
|
| 1697 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 1698 | + } |
|
| 1608 | 1699 | return ''; |
| 1609 | 1700 | } |
| 1610 | 1701 | |
@@ -1622,7 +1713,9 @@ discard block |
||
| 1622 | 1713 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 1623 | 1714 | |
| 1624 | 1715 | $Connection = new Connection($this->db); |
| 1625 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 1716 | + if (!$Connection->tableExists('countries')) { |
|
| 1717 | + return ''; |
|
| 1718 | + } |
|
| 1626 | 1719 | |
| 1627 | 1720 | try { |
| 1628 | 1721 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1634,9 +1727,13 @@ discard block |
||
| 1634 | 1727 | $sth->closeCursor(); |
| 1635 | 1728 | if (count($row) > 0) { |
| 1636 | 1729 | return $row; |
| 1637 | - } else return ''; |
|
| 1730 | + } else { |
|
| 1731 | + return ''; |
|
| 1732 | + } |
|
| 1638 | 1733 | } catch (PDOException $e) { |
| 1639 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 1734 | + if (isset($globalDebug) && $globalDebug) { |
|
| 1735 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 1736 | + } |
|
| 1640 | 1737 | return ''; |
| 1641 | 1738 | } |
| 1642 | 1739 | |
@@ -1697,7 +1794,9 @@ discard block |
||
| 1697 | 1794 | } |
| 1698 | 1795 | } |
| 1699 | 1796 | $query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC"; |
| 1700 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 1797 | + if ($limit) { |
|
| 1798 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 1799 | + } |
|
| 1701 | 1800 | $sth = $this->db->prepare($query); |
| 1702 | 1801 | $sth->execute($query_values); |
| 1703 | 1802 | $tracker_array = array(); |
@@ -1724,7 +1823,9 @@ discard block |
||
| 1724 | 1823 | { |
| 1725 | 1824 | global $globalBitlyAccessToken; |
| 1726 | 1825 | |
| 1727 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 1826 | + if ($globalBitlyAccessToken == '') { |
|
| 1827 | + return $url; |
|
| 1828 | + } |
|
| 1728 | 1829 | |
| 1729 | 1830 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 1730 | 1831 | |