Skip to content

Commit

Permalink
Move from static to non static, some bugs fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Oct 21, 2015
1 parent cb34f64 commit 4bbf6a6
Show file tree
Hide file tree
Showing 172 changed files with 2,400 additions and 2,065 deletions.
4 changes: 2 additions & 2 deletions acars-archive.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require('require/class.Connection.php');
require('require/class.ACARS.php');

$ACARS = new ACARS();
$title = "Latest ACARS messages";
require('header.php');

Expand All @@ -28,7 +28,7 @@

print '<div class="table column">';
print '<p>The table below shows the latest ACARS messages.</p>';
$spotter_array = ACARS::getArchiveAcarsData($limit_start.",".$absolute_difference);
$spotter_array = $ACARS->getArchiveAcarsData($limit_start.",".$absolute_difference);
if (!empty($spotter_array)) {
include('table-output.php');
print '<div class="pagination">';
Expand Down
4 changes: 2 additions & 2 deletions acars-latest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require('require/class.Connection.php');
require('require/class.ACARS.php');

$ACARS = new ACARS();
$title = "Latest ACARS messages";
require('header.php');

Expand Down Expand Up @@ -29,7 +29,7 @@

print '<div class="table column">';
print '<p>The table below shows the latest ACARS messages.</p>';
$spotter_array = ACARS::getLatestAcarsData($limit_start.",".$absolute_difference);
$spotter_array = $ACARS->getLatestAcarsData($limit_start.",".$absolute_difference);
if (!empty($spotter_array)) {
include('table-output.php');
print '<div class="pagination">';
Expand Down
38 changes: 7 additions & 31 deletions aircraft-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,50 +3,26 @@
require('require/class.Spotter.php');
require('require/class.SpotterLive.php');
require('require/class.SpotterArchive.php');
$SpotterLive = new SpotterLive();
$SpotterArchive = new SpotterArchive();

$from_archive = false;
if (isset($_GET['ident'])) {
$ident = $_GET['ident'];
$spotter_array = SpotterLive::getLastLiveSpotterDataByIdent($ident);
$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
if (empty($spotter_array)) {
$from_archive = true;
$spotter_array = SpotterArchive::getLastArchiveSpotterDataByIdent($ident);
$spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident);
}
}
if (isset($_GET['flightaware_id'])) {
$flightaware_id = $_GET['flightaware_id'];
$spotter_array = SpotterLive::getLastLiveSpotterDataById($flightaware_id);
$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
if (empty($spotter_array)) {
$from_archive = true;
$spotter_array = SpotterArchive::getLastArchiveSpotterDataById($flightaware_id);
$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
}
}
/*
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Spotter TV</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico">
<link rel="apple-touch-icon" href="<?php print $globalURL; ?>/images/touch-icon.png">
<link href='http://fonts.googleapis.com/css?family=Roboto:400,100,100italic,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link type="text/css" rel="stylesheet" href="<?php print $globalURL; ?>/css/style.css?<?php print time(); ?>" />
<link type="text/css" rel="stylesheet" href="<?php print $globalURL; ?>/css/style-map.css?<?php print time(); ?>" />
</head>
<body class="alldetails">
<button class="close">close</button>
<?php
*/
?>
<div class="alldetails">
<button type="button" class="close">&times;</button>
Expand Down Expand Up @@ -86,7 +62,7 @@
print '</div></div><div>';
print '<span>Aircraft</span>';
if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
print $spotter_item['aircraft_name'];
print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
print '</div>';
print '<div><span>Altitude</span>';
print $spotter_item['altitude'].'00 feet - '.round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
Expand Down
10 changes: 4 additions & 6 deletions aircraft-detailed.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
require('require/class.Connection.php');
require('require/class.Spotter.php');
$Spotter = new Spotter();

if (!isset($_GET['aircraft_type'])){
header('Location: '.$globalURL.'/aircraft');
Expand All @@ -23,11 +24,8 @@

$page_url = $globalURL.'/aircraft/'.$_GET['aircraft_type'];

if (isset($_GET['sort'])) {
$spotter_array = Spotter::getSpotterDataByAircraft($_GET['aircraft_type'],$limit_start.",".$absolute_difference, $_GET['sort']);
} else {
$spotter_array = Spotter::getSpotterDataByAircraft($_GET['aircraft_type'],$limit_start.",".$absolute_difference, '');
}
$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
$spotter_array = $Spotter->getSpotterDataByAircraft($_GET['aircraft_type'],$limit_start.",".$absolute_difference, $sort);

if (!empty($spotter_array))
{
Expand All @@ -38,7 +36,7 @@
print '<form action="'.$globalURL.'/aircraft" method="post">';
print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
print '<option></option>';
$aircraft_types = Spotter::getAllAircraftTypes();
$aircraft_types = $Spotter->getAllAircraftTypes();
foreach($aircraft_types as $aircraft_type)
{
if($_GET['aircraft_type'] == $aircraft_type['aircraft_icao'])
Expand Down
11 changes: 8 additions & 3 deletions aircraft-statistics-airline-country.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<?php
require('require/class.Connection.php');
require('require/class.Spotter.php');
$Spotter = new Spotter();

$spotter_array = Spotter::getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");
if (!isset($_GET['aircraft_type'])) {
header('Location: '.$globalURL.'/aircraft');
die();
}
$spotter_array = $Spotter->getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");


if (!empty($spotter_array))
Expand All @@ -14,7 +19,7 @@
print '<form action="'.$globalURL.'/aircraft" method="post">';
print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
print '<option></option>';
$aircraft_types = Spotter::getAllAircraftTypes();
$aircraft_types = $Spotter->getAllAircraftTypes();
foreach($aircraft_types as $aircraft_type)
{
if($_GET['aircraft_type'] == $aircraft_type['aircraft_icao'])
Expand Down Expand Up @@ -45,7 +50,7 @@
print '<h2>Most Common Airlines by Country</h2>';
print '<p>The statistic below shows the most common airlines by Country of origin of flights from <strong>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</strong>.</p>';

$airline_array = Spotter::countAllAirlineCountriesByAircraft($_GET['aircraft_type']);
$airline_array = $Spotter->countAllAirlineCountriesByAircraft($_GET['aircraft_type']);
print '<div id="chartCountry" class="chart" width="100%"></div>
<script>
google.load("visualization", "1", {packages:["geochart"]});
Expand Down
11 changes: 8 additions & 3 deletions aircraft-statistics-airline.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
require('require/class.Connection.php');
require('require/class.Spotter.php');

$spotter_array = Spotter::getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");
if (!isset($_GET['aircraft_type'])) {
header('Location: '.$globalURL.'/aircraft');
die();
}
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");


if (!empty($spotter_array))
Expand All @@ -13,7 +18,7 @@
print '<form action="'.$globalURL.'/aircraft" method="post">';
print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
print '<option></option>';
$aircraft_types = Spotter::getAllAircraftTypes();
$aircraft_types = $Spotter->getAllAircraftTypes();
foreach($aircraft_types as $aircraft_type)
{
if($_GET['aircraft_type'] == $aircraft_type['aircraft_icao'])
Expand Down Expand Up @@ -44,7 +49,7 @@
print '<h2>Most Common Airlines</h2>';
print '<p>The statistic below shows the most common airlines of flights from <strong>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</strong>.</p>';

$airline_array = Spotter::countAllAirlinesByAircraft($_GET['aircraft_type']);
$airline_array = $Spotter->countAllAirlinesByAircraft($_GET['aircraft_type']);

if (!empty($airline_array))
{
Expand Down
12 changes: 8 additions & 4 deletions aircraft-statistics-arrival-airport-country.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php
require('require/class.Connection.php');
require('require/class.Spotter.php');

$spotter_array = Spotter::getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");
if (!isset($_GET['aircraft_type'])) {
header('Location: '.$globalURL.'/aircraft');
die();
}
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");


if (!empty($spotter_array))
Expand All @@ -13,7 +17,7 @@
print '<form action="'.$globalURL.'/aircraft" method="post">';
print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
print '<option></option>';
$aircraft_types = Spotter::getAllAircraftTypes();
$aircraft_types = $Spotter->getAllAircraftTypes();
foreach($aircraft_types as $aircraft_type)
{
if($_GET['aircraft_type'] == $aircraft_type['aircraft_icao'])
Expand Down Expand Up @@ -48,7 +52,7 @@

<?php

$airport_country_array = Spotter::countAllArrivalAirportCountriesByAircraft($_GET['aircraft_type']);
$airport_country_array = $Spotter->countAllArrivalAirportCountriesByAircraft($_GET['aircraft_type']);
print '<div id="chartCountry" class="chart" width="100%"></div>
<script>
google.load("visualization", "1", {packages:["geochart"]});
Expand Down
11 changes: 8 additions & 3 deletions aircraft-statistics-arrival-airport.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
require('require/class.Connection.php');
require('require/class.Spotter.php');

$spotter_array = Spotter::getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");
if (!isset($_GET['aircraft_type'])) {
header('Location: '.$globalURL.'/aircraft');
die();
}
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");


if (!empty($spotter_array))
Expand All @@ -13,7 +18,7 @@
print '<form action="'.$globalURL.'/aircraft" method="post">';
print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
print '<option></option>';
$aircraft_types = Spotter::getAllAircraftTypes();
$aircraft_types = $Spotter->getAllAircraftTypes();
foreach($aircraft_types as $aircraft_type)
{
if($_GET['aircraft_type'] == $aircraft_type['aircraft_icao'])
Expand Down Expand Up @@ -46,7 +51,7 @@
?>
<p>The statistic below shows all arrival airports of flights from <strong><?php print $spotter_array[0]['aircraft_name']; ?> (<?php print $spotter_array[0]['aircraft_type']; ?>)</strong>.</p>
<?php
$airport_airport_array = Spotter::countAllArrivalAirportsByAircraft($_GET['aircraft_type']);
$airport_airport_array = $Spotter->countAllArrivalAirportsByAircraft($_GET['aircraft_type']);
?>
<script>
google.load("visualization", "1", {packages:["geochart"]});
Expand Down
12 changes: 8 additions & 4 deletions aircraft-statistics-departure-airport-country.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php
require('require/class.Connection.php');
require('require/class.Spotter.php');

$spotter_array = Spotter::getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");
if (!isset($_GET['aircraft_type'])) {
header('Location: '.$globalURL.'/aircraft');
die();
}
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");


if (!empty($spotter_array))
Expand All @@ -13,7 +17,7 @@
print '<form action="'.$globalURL.'/aircraft" method="post">';
print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
print '<option></option>';
$aircraft_types = Spotter::getAllAircraftTypes();
$aircraft_types = $Spotter->getAllAircraftTypes();
foreach($aircraft_types as $aircraft_type)
{
if($_GET['aircraft_type'] == $aircraft_type['aircraft_icao'])
Expand Down Expand Up @@ -47,7 +51,7 @@
<p>The statistic below shows all departure airports by Country of origin of flights from <strong><?php print $spotter_array[0]['aircraft_name']; ?> (<?php print $spotter_array[0]['aircraft_type']; ?>)</strong>.</p>

<?php
$airport_country_array = Spotter::countAllDepartureAirportCountriesByAircraft($_GET['aircraft_type']);
$airport_country_array = $Spotter->countAllDepartureAirportCountriesByAircraft($_GET['aircraft_type']);
print '<div id="chartCountry" class="chart" width="100%"></div>
<script>
google.load("visualization", "1", {packages:["geochart"]});
Expand Down
12 changes: 8 additions & 4 deletions aircraft-statistics-departure-airport.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php
require('require/class.Connection.php');
require('require/class.Spotter.php');

$spotter_array = Spotter::getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");
if (!isset($_GET['aircraft_type'])) {
header('Location: '.$globalURL.'/aircraft');
die();
}
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");


if (!empty($spotter_array))
Expand All @@ -13,7 +17,7 @@
print '<form action="'.$globalURL.'/aircraft" method="post">';
print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
print '<option></option>';
$aircraft_types = Spotter::getAllAircraftTypes();
$aircraft_types = $Spotter->getAllAircraftTypes();
foreach($aircraft_types as $aircraft_type)
{
if($_GET['aircraft_type'] == $aircraft_type['aircraft_icao'])
Expand Down Expand Up @@ -46,7 +50,7 @@
?>
<p>The statistic below shows all departure airports of flights from <strong><?php print $spotter_array[0]['aircraft_name']; ?> (<?php print $spotter_array[0]['aircraft_type']; ?>)</strong>.</p>
<?php
$airport_airport_array = Spotter::countAllDepartureAirportsByAircraft($_GET['aircraft_type']);
$airport_airport_array = $Spotter->countAllDepartureAirportsByAircraft($_GET['aircraft_type']);
?>
<script>
google.load("visualization", "1", {packages:["geochart"]});
Expand Down
12 changes: 8 additions & 4 deletions aircraft-statistics-registration.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php
require('require/class.Connection.php');
require('require/class.Spotter.php');

$spotter_array = Spotter::getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");
if (!isset($_GET['aircraft_type'])) {
header('Location: '.$globalURL.'/aircraft');
die();
}
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");


if (!empty($spotter_array))
Expand All @@ -13,7 +17,7 @@
print '<form action="'.$globalURL.'/aircraft" method="post">';
print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
print '<option></option>';
$aircraft_types = Spotter::getAllAircraftTypes();
$aircraft_types = $Spotter->getAllAircraftTypes();
foreach($aircraft_types as $aircraft_type)
{
if($_GET['aircraft_type'] == $aircraft_type['aircraft_icao'])
Expand Down Expand Up @@ -44,7 +48,7 @@
print '<h2>Most Common Aircraft by Registration</h2>';
print '<p>The statistic below shows the most common aircraft by registration of flights from aircraft type <strong>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</strong>.</p>';

$aircraft_array = Spotter::countAllAircraftRegistrationByAircraft($_GET['aircraft_type']);
$aircraft_array = $Spotter->countAllAircraftRegistrationByAircraft($_GET['aircraft_type']);
if (!empty($aircraft_array))
{
print '<div class="table-responsive">';
Expand Down
12 changes: 8 additions & 4 deletions aircraft-statistics-route.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php
require('require/class.Connection.php');
require('require/class.Spotter.php');

$spotter_array = Spotter::getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");
if (!isset($_GET['aircraft_type'])) {
header('Location: '.$globalURL.'/aircraft');
die();
}
$Spotter = new Spotter();
$spotter_array = $Spotter->getSpotterDataByAircraft($_GET['aircraft_type'],"0,1","");


if (!empty($spotter_array))
Expand All @@ -13,7 +17,7 @@
print '<form action="'.$globalURL.'/aircraft" method="post">';
print '<select name="aircraft_type" class="selectpicker" data-live-search="true">';
print '<option></option>';
$aircraft_types = Spotter::getAllAircraftTypes();
$aircraft_types = $Spotter->getAllAircraftTypes();
foreach($aircraft_types as $aircraft_type)
{
if($_GET['aircraft_type'] == $aircraft_type['aircraft_icao'])
Expand Down Expand Up @@ -44,7 +48,7 @@
print '<h2>Most Common Routes</h2>';
print '<p>The statistic below shows the most common routes from <strong>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</strong>.</p>';

$route_array = Spotter::countAllRoutesByAircraft($_GET['aircraft_type']);
$route_array = $Spotter->countAllRoutesByAircraft($_GET['aircraft_type']);
if (!empty($route_array))
{
print '<div class="table-responsive">';
Expand Down
Loading

0 comments on commit 4bbf6a6

Please sign in to comment.