@@ -7,21 +7,21 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airline'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $alliance = false; |
13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
14 | 14 | $alliance = true; |
15 | 15 | } else { |
16 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
16 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | if (!empty($spotter_array) || $alliance === true) |
20 | 20 | { |
21 | 21 | if ($alliance) { |
22 | - $title = sprintf(_("Most Common Aircraft by Registration from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
22 | + $title = sprintf(_("Most Common Aircraft by Registration from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
23 | 23 | } else { |
24 | - $title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
24 | + $title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
25 | 25 | } |
26 | 26 | require_once('header.php'); |
27 | 27 | |
@@ -32,10 +32,10 @@ discard block |
||
32 | 32 | $alliances = $Spotter->getAllAllianceNames(); |
33 | 33 | if (!empty($alliances)) { |
34 | 34 | foreach ($alliances as $al) { |
35 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
36 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
35 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
36 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
37 | 37 | } else { |
38 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
38 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | print '<option disabled>──────────────────</option>'; |
@@ -43,9 +43,9 @@ discard block |
||
43 | 43 | $Stats = new Stats(); |
44 | 44 | $airline_names = $Stats->getAllAirlineNames(); |
45 | 45 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
46 | - foreach($airline_names as $airline_name) |
|
46 | + foreach ($airline_names as $airline_name) |
|
47 | 47 | { |
48 | - if($airline == $airline_name['airline_icao']) |
|
48 | + if ($airline == $airline_name['airline_icao']) |
|
49 | 49 | { |
50 | 50 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
51 | 51 | } else { |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | print '</div>'; |
80 | 80 | } else { |
81 | 81 | print '<div class="info column">'; |
82 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
83 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
82 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
83 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
84 | 84 | { |
85 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
85 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
86 | 86 | } |
87 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
87 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
88 | 88 | print '</div>'; |
89 | 89 | } |
90 | 90 | } else { |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | print '<div class="column">'; |
96 | 96 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
97 | 97 | if ($alliance) { |
98 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
98 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
99 | 99 | } else { |
100 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
100 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
101 | 101 | } |
102 | 102 | /* |
103 | 103 | if ($alliance) { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $aircraft_array = $Spotter->countAllAircraftRegistrationByAirline($airline); |
107 | 107 | } |
108 | 108 | */ |
109 | - $aircraft_array = $Stats->countAllAircraftRegistrations(true,$airline); |
|
109 | + $aircraft_array = $Stats->countAllAircraftRegistrations(true, $airline); |
|
110 | 110 | if (!empty($aircraft_array)) |
111 | 111 | { |
112 | 112 | print '<div class="table-responsive">'; |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | print '</thead>'; |
122 | 122 | print '<tbody>'; |
123 | 123 | $i = 1; |
124 | - foreach($aircraft_array as $aircraft_item) |
|
124 | + foreach ($aircraft_array as $aircraft_item) |
|
125 | 125 | { |
126 | 126 | print '<tr>'; |
127 | 127 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,21 +7,21 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airline'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
10 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $alliance = false; |
13 | -if (strpos($airline,'alliance_') !== FALSE) { |
|
13 | +if (strpos($airline, 'alliance_') !== FALSE) { |
|
14 | 14 | $alliance = true; |
15 | 15 | } else { |
16 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
16 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | if (!empty($spotter_array) || $alliance === true) |
20 | 20 | { |
21 | 21 | if ($alliance) { |
22 | - $title = sprintf(_("Most Common Departure Airports from %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
22 | + $title = sprintf(_("Most Common Departure Airports from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
23 | 23 | } else { |
24 | - $title = sprintf(_("Most Common Departure Airports from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
24 | + $title = sprintf(_("Most Common Departure Airports from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
25 | 25 | } |
26 | 26 | require_once('header.php'); |
27 | 27 | print '<div class="select-item">'; |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | $alliances = $Spotter->getAllAllianceNames(); |
32 | 32 | if (!empty($alliances)) { |
33 | 33 | foreach ($alliances as $al) { |
34 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
35 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
34 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
35 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
36 | 36 | } else { |
37 | - print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
37 | + print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | print '<option disabled>───────────────────</option>'; |
@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | $Stats = new Stats(); |
43 | 43 | $airline_names = $Stats->getAllAirlineNames(); |
44 | 44 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
45 | - foreach($airline_names as $airline_name) |
|
45 | + foreach ($airline_names as $airline_name) |
|
46 | 46 | { |
47 | - if($airline == $airline_name['airline_icao']) |
|
47 | + if ($airline == $airline_name['airline_icao']) |
|
48 | 48 | { |
49 | 49 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
50 | 50 | } else { |
@@ -78,12 +78,12 @@ discard block |
||
78 | 78 | print '</div>'; |
79 | 79 | } else { |
80 | 80 | print '<div class="info column">'; |
81 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
82 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
81 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
82 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
83 | 83 | { |
84 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
84 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
85 | 85 | } |
86 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
86 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
87 | 87 | print '</div>'; |
88 | 88 | } |
89 | 89 | } else { |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | print '<div class="column">'; |
95 | 95 | print '<h2>'._("Most Common Departure Airports").'</h2>'; |
96 | 96 | if ($alliance) { |
97 | - print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>'; |
|
97 | + print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>'; |
|
98 | 98 | } else { |
99 | - print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
99 | + print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
100 | 100 | } |
101 | 101 | /* |
102 | 102 | if ($alliance) { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | $airport_airport_array = $Spotter->countAllDepartureAirportsByAirline($airline); |
106 | 106 | } |
107 | 107 | */ |
108 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline); |
|
108 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline); |
|
109 | 109 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
110 | 110 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
111 | 111 | print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>'; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | print '<script>'; |
114 | 114 | print 'var series = ['; |
115 | 115 | $airport_data = ''; |
116 | - foreach($airport_airport_array as $airport_item) |
|
116 | + foreach ($airport_airport_array as $airport_item) |
|
117 | 117 | { |
118 | 118 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_name'].' ('.$airport_item['airport_departure_icao'].')",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
119 | 119 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | print '</thead>'; |
169 | 169 | print '<tbody>'; |
170 | 170 | $i = 1; |
171 | - foreach($airport_airport_array as $airport_item) |
|
171 | + foreach ($airport_airport_array as $airport_item) |
|
172 | 172 | { |
173 | 173 | print '<tr>'; |
174 | 174 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $Spotter = new Spotter(); |
8 | 8 | $orderby = $Spotter->getOrderBy(); |
9 | 9 | |
10 | -$ask = filter_input(INPUT_GET,'ask',FILTER_SANITIZE_STRING); |
|
10 | +$ask = filter_input(INPUT_GET, 'ask', FILTER_SANITIZE_STRING); |
|
11 | 11 | if ($ask == 'aircraftsdetected') { |
12 | 12 | require_once('require/class.SpotterLive.php'); |
13 | 13 | $SpotterLive = new SpotterLive(); |
@@ -27,16 +27,16 @@ discard block |
||
27 | 27 | $manufacturers = $Stats->getAllManufacturers(); |
28 | 28 | if (empty($manufacturers)) $manufacturers = $Spotter->getAllManufacturers(); |
29 | 29 | $all_manufacturers = array(); |
30 | - foreach($manufacturers as $manufacturer) |
|
30 | + foreach ($manufacturers as $manufacturer) |
|
31 | 31 | { |
32 | - $all_manufacturers[] = array('value' => $manufacturer['aircraft_manufacturer'], 'id' => strtolower(str_replace(' ','-',$manufacturer['aircraft_manufacturer']))); |
|
32 | + $all_manufacturers[] = array('value' => $manufacturer['aircraft_manufacturer'], 'id' => strtolower(str_replace(' ', '-', $manufacturer['aircraft_manufacturer']))); |
|
33 | 33 | } |
34 | 34 | echo json_encode($all_manufacturers); |
35 | 35 | } elseif ($ask == 'aircrafttypes') { |
36 | 36 | $aircraft_types = $Stats->getAllAircraftTypes(); |
37 | 37 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
38 | 38 | $all_aircraft_types = array(); |
39 | - foreach($aircraft_types as $aircraft_type) |
|
39 | + foreach ($aircraft_types as $aircraft_type) |
|
40 | 40 | { |
41 | 41 | $all_aircraft_types[] = array('id' => $aircraft_type['aircraft_icao'], 'value' => $aircraft_type['aircraft_name'].' ('.$aircraft_type['aircraft_icao'].')'); |
42 | 42 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } elseif ($ask == 'airlinenames') { |
45 | 45 | $airline_names = $Stats->getAllAirlineNames(); |
46 | 46 | $all_airline_names = array(); |
47 | - foreach($airline_names as $airline_name) |
|
47 | + foreach ($airline_names as $airline_name) |
|
48 | 48 | { |
49 | 49 | $all_airline_names[] = array('id' => $airline_name['airline_icao'], 'value' => $airline_name['airline_name'].' ('.$airline_name['airline_icao'].')'); |
50 | 50 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | } elseif ($ask == 'airlinecountries') { |
53 | 53 | $airline_countries = $Spotter->getAllAirlineCountries(); |
54 | 54 | $all_airline_countries = array(); |
55 | - foreach($airline_countries as $airline_country) |
|
55 | + foreach ($airline_countries as $airline_country) |
|
56 | 56 | { |
57 | 57 | $all_airline_countries[] = array('id' => $airline_country['airline_country'], 'value' => $airline_country['airline_country']); |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
63 | 63 | ksort($airport_names); |
64 | 64 | $all_airport_names = array(); |
65 | - foreach($airport_names as $airport_name) |
|
65 | + foreach ($airport_names as $airport_name) |
|
66 | 66 | { |
67 | 67 | $all_airport_names[] = array('id' => $airport_name['airport_icao'], 'value' => $airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')'); |
68 | 68 | } |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } elseif ($ask == 'airportcountries') { |
71 | 71 | $airport_countries = $Spotter->getAllAirportCountries(); |
72 | 72 | $all_airport_countries = array(); |
73 | - foreach($airport_countries as $airport_country) |
|
73 | + foreach ($airport_countries as $airport_country) |
|
74 | 74 | { |
75 | 75 | $all_airport_countries[] = array('id' => $airport_country['airport_country'], 'value' => $airport_country['airport_country']); |
76 | 76 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require_once(dirname(__FILE__).'/settings.php'); |
3 | 3 | |
4 | -class Connection{ |
|
4 | +class Connection { |
|
5 | 5 | public $db = null; |
6 | 6 | public $dbs = array(); |
7 | 7 | public $latest_schema = 46; |
8 | 8 | |
9 | - public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
|
9 | + public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) { |
|
10 | 10 | global $globalNoDB; |
11 | 11 | if (isset($globalNoDB) && $globalNoDB === TRUE) { |
12 | 12 | $this->db = null; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | if ($user === null && $pass === null) { |
17 | 17 | $this->createDBConnection(); |
18 | 18 | } else { |
19 | - $this->createDBConnection(null,$user,$pass); |
|
19 | + $this->createDBConnection(null, $user, $pass); |
|
20 | 20 | } |
21 | 21 | } else { |
22 | 22 | $this->createDBConnection($dbname); |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | while (true) { |
101 | 101 | try { |
102 | 102 | if ($globalDBSdriver == 'mysql') { |
103 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
103 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
104 | 104 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
105 | 105 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
106 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
107 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
108 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
109 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
110 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
106 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
107 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500); |
|
108 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
109 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
110 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
111 | 111 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
112 | 112 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
113 | 113 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -117,19 +117,19 @@ discard block |
||
117 | 117 | $this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"'); |
118 | 118 | //$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"'); |
119 | 119 | } else { |
120 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
120 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
121 | 121 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
122 | 122 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
123 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
124 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
125 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
126 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
127 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
123 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
124 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200); |
|
125 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
126 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
127 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
128 | 128 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
129 | 129 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
130 | 130 | } |
131 | 131 | break; |
132 | - } catch(PDOException $e) { |
|
132 | + } catch (PDOException $e) { |
|
133 | 133 | $i++; |
134 | 134 | if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
135 | 135 | //exit; |
@@ -154,10 +154,10 @@ discard block |
||
154 | 154 | try { |
155 | 155 | //$Connection = new Connection(); |
156 | 156 | $results = $this->db->query($query); |
157 | - } catch(PDOException $e) { |
|
157 | + } catch (PDOException $e) { |
|
158 | 158 | return false; |
159 | 159 | } |
160 | - if($results->rowCount()>0) { |
|
160 | + if ($results->rowCount() > 0) { |
|
161 | 161 | return true; |
162 | 162 | } |
163 | 163 | else return false; |
@@ -179,8 +179,8 @@ discard block |
||
179 | 179 | return false; |
180 | 180 | } |
181 | 181 | |
182 | - } catch(PDOException $e) { |
|
183 | - if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
182 | + } catch (PDOException $e) { |
|
183 | + if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
184 | 184 | throw $e; |
185 | 185 | } |
186 | 186 | //echo 'error ! '.$e->getMessage(); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | /* |
193 | 193 | * Check if index exist |
194 | 194 | */ |
195 | - public function indexExists($table,$index) |
|
195 | + public function indexExists($table, $index) |
|
196 | 196 | { |
197 | 197 | global $globalDBdriver, $globalDBname; |
198 | 198 | if ($globalDBdriver == 'mysql') { |
@@ -203,11 +203,11 @@ discard block |
||
203 | 203 | try { |
204 | 204 | //$Connection = new Connection(); |
205 | 205 | $results = $this->db->query($query); |
206 | - } catch(PDOException $e) { |
|
206 | + } catch (PDOException $e) { |
|
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
210 | - if($nb[0]['nb'] > 0) { |
|
210 | + if ($nb[0]['nb'] > 0) { |
|
211 | 211 | return true; |
212 | 212 | } |
213 | 213 | else return false; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
223 | 223 | try { |
224 | 224 | $results = $this->db->query($query); |
225 | - } catch(PDOException $e) { |
|
225 | + } catch (PDOException $e) { |
|
226 | 226 | return "error : ".$e->getMessage()."\n"; |
227 | 227 | } |
228 | 228 | $columns = array(); |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | return $columns; |
235 | 235 | } |
236 | 236 | |
237 | - public function getColumnType($table,$column) { |
|
237 | + public function getColumnType($table, $column) { |
|
238 | 238 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
239 | 239 | $tomet = $select->getColumnMeta(0); |
240 | 240 | return $tomet['native_type']; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * Check if a column name exist in a table |
245 | 245 | * @return Boolean column exist or not |
246 | 246 | */ |
247 | - public function checkColumnName($table,$name) |
|
247 | + public function checkColumnName($table, $name) |
|
248 | 248 | { |
249 | 249 | global $globalDBdriver, $globalDBname; |
250 | 250 | if ($globalDBdriver == 'mysql') { |
@@ -254,8 +254,8 @@ discard block |
||
254 | 254 | } |
255 | 255 | try { |
256 | 256 | $sth = $this->db()->prepare($query); |
257 | - $sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name)); |
|
258 | - } catch(PDOException $e) { |
|
257 | + $sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name)); |
|
258 | + } catch (PDOException $e) { |
|
259 | 259 | echo "error : ".$e->getMessage()."\n"; |
260 | 260 | } |
261 | 261 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | try { |
295 | 295 | $sth = $this->db->prepare($query); |
296 | 296 | $sth->execute(); |
297 | - } catch(PDOException $e) { |
|
297 | + } catch (PDOException $e) { |
|
298 | 298 | return "error : ".$e->getMessage()."\n"; |
299 | 299 | } |
300 | 300 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | <button type="button" class="close">×</button> |
10 | 10 | <?php |
11 | 11 | |
12 | -$sat = filter_input(INPUT_GET,'sat',FILTER_SANITIZE_STRING); |
|
12 | +$sat = filter_input(INPUT_GET, 'sat', FILTER_SANITIZE_STRING); |
|
13 | 13 | $sat = urldecode($sat); |
14 | 14 | //$info = $Satellite->get_info(str_replace(' ','-',$sat)); |
15 | 15 | //print_r($info); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $aircraft_name = 'INTEGRAL'; |
49 | 49 | // $ground_speed = 14970; |
50 | 50 | $launch_date = '17 October 2002'; |
51 | -} elseif (strpos($sat,'IRIDIUM') !== false) { |
|
51 | +} elseif (strpos($sat, 'IRIDIUM') !== false) { |
|
52 | 52 | $image = 'https://upload.wikimedia.org/wikipedia/commons/b/b6/Iridium_Satellite.jpg'; |
53 | 53 | $image_copyright = 'Cliff'; |
54 | 54 | $ident = 'Iridium satellite constellation'; |
@@ -56,23 +56,23 @@ discard block |
||
56 | 56 | $aircraft_name = $sat; |
57 | 57 | // $ground_speed = 14970; |
58 | 58 | // $launch_date = '29 september 2011'; |
59 | -} elseif (strpos($sat,'ORBCOMM') !== false) { |
|
59 | +} elseif (strpos($sat, 'ORBCOMM') !== false) { |
|
60 | 60 | $ident = 'Orbcomm'; |
61 | 61 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/Orbcomm_(satellite)'; |
62 | 62 | $aircraft_name = $sat; |
63 | -} elseif (strpos($sat,'GLOBALSTAR') !== false) { |
|
63 | +} elseif (strpos($sat, 'GLOBALSTAR') !== false) { |
|
64 | 64 | $ident = 'Globalstar'; |
65 | 65 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/Globalstar'; |
66 | 66 | $aircraft_name = $sat; |
67 | - $satname = str_replace(array('[+]','[-]'),'',$sat); |
|
68 | -} elseif (strpos($sat,'OSCAR 7') !== false) { |
|
67 | + $satname = str_replace(array('[+]', '[-]'), '', $sat); |
|
68 | +} elseif (strpos($sat, 'OSCAR 7') !== false) { |
|
69 | 69 | $image = 'https://upload.wikimedia.org/wikipedia/en/a/ad/AMSAT-OSCAR_7.jpg'; |
70 | 70 | $image_copyright = 'Amsat.org'; |
71 | 71 | $ident = 'AMSAT-OSCAR 7'; |
72 | 72 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/AMSAT-OSCAR_7'; |
73 | 73 | $aircraft_name = $sat; |
74 | 74 | $launch_date = '15 November 1974'; |
75 | -} elseif (strpos($sat,'santaclaus') !== false) { |
|
75 | +} elseif (strpos($sat, 'santaclaus') !== false) { |
|
76 | 76 | $image = 'https://upload.wikimedia.org/wikipedia/commons/4/49/Jonathan_G_Meath_portrays_Santa_Claus.jpg'; |
77 | 77 | $image_copyright = 'Jonathan G Meath'; |
78 | 78 | $ident = 'Santa Claus'; |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | // $launch_date = '15 November 1974'; |
82 | 82 | } else { |
83 | 83 | $ident = $sat; |
84 | - if (strpos($sat,'(')) $satname = $sat; |
|
85 | - else $satname = str_replace(array(' '),'-',$sat); |
|
84 | + if (strpos($sat, '(')) $satname = $sat; |
|
85 | + else $satname = str_replace(array(' '), '-', $sat); |
|
86 | 86 | } |
87 | 87 | if (!isset($satname)) $satname = $sat; |
88 | 88 | $info = $Satellite->get_info(strtolower(trim($satname))); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | print '<div><span>'._("Orbit").'</span>'.$info['orbit'].'</div>'; |
146 | 146 | } |
147 | 147 | if ($info['launch_date'] != '') { |
148 | - print '<div><span>'._("Launch Date").'</span>'.date('Y-m-d',strtotime($info['launch_date'])).'</div>'; |
|
148 | + print '<div><span>'._("Launch Date").'</span>'.date('Y-m-d', strtotime($info['launch_date'])).'</div>'; |
|
149 | 149 | } |
150 | 150 | if ($info['launch_site'] != '') { |
151 | 151 | print '<div><span>'._("Launch Site").'</span>'.$info['launch_site'].'</div>'; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | if (!isset($filter_name)) $filter_name = ''; |
26 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
26 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
27 | 27 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
28 | 28 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
29 | 29 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
33 | 33 | if (isset($airline_info[0]['name'])) { |
34 | 34 | $airline_name = $airline_info[0]['name']; |
35 | - } elseif (strpos($airline_icao,'alliance_') !== FALSE) { |
|
35 | + } elseif (strpos($airline_icao, 'alliance_') !== FALSE) { |
|
36 | 36 | $alliance_name = $airline_icao; |
37 | 37 | } |
38 | 38 | } |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | $title = _("Statistics"); |
43 | 43 | } |
44 | 44 | |
45 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
46 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
45 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
46 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | |
48 | 48 | require_once('header.php'); |
49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | date_default_timezone_set('UTC'); |
71 | 71 | $lastupdate = strtotime($last_update[0]['value']); |
72 | 72 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
73 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
73 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
74 | 74 | } |
75 | 75 | } |
76 | 76 | ?> |
@@ -82,31 +82,31 @@ discard block |
||
82 | 82 | <?php |
83 | 83 | if ($type == 'aircraft') { |
84 | 84 | ?> |
85 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span> |
|
86 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
87 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
88 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
85 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span> |
|
86 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
87 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
88 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
89 | 89 | <?php |
90 | 90 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
91 | 91 | ?> |
92 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
93 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
92 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
93 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
94 | 94 | <?php |
95 | 95 | } |
96 | 96 | if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
97 | 97 | ?> |
98 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
99 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
98 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
99 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
100 | 100 | <?php |
101 | 101 | } |
102 | 102 | ?> |
103 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
104 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
103 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
104 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
105 | 105 | <?php |
106 | 106 | if ($airline_icao == '') { |
107 | 107 | ?> |
108 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
109 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
108 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
109 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
110 | 110 | <?php |
111 | 111 | } |
112 | 112 | ?> |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) { |
115 | 115 | if ($airline_icao == '' || $airline_icao == 'all') { |
116 | 116 | ?> |
117 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
118 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
117 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
118 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
119 | 119 | <?php |
120 | 120 | } |
121 | 121 | } |
@@ -123,22 +123,22 @@ discard block |
||
123 | 123 | <?php |
124 | 124 | } elseif ($type == 'marine') { |
125 | 125 | ?> |
126 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
127 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
128 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
129 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
126 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
127 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
128 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
129 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
130 | 130 | <?php |
131 | 131 | } elseif ($type == 'tracker') { |
132 | 132 | ?> |
133 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
134 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
135 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
136 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
133 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
134 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
135 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
136 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
137 | 137 | <?php |
138 | 138 | } |
139 | 139 | ?> |
140 | 140 | </p> |
141 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
141 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
142 | 142 | <div class="specific-stats"> |
143 | 143 | <?php |
144 | 144 | if ($type == 'aircraft') { |
@@ -147,13 +147,13 @@ discard block |
||
147 | 147 | <div class="col-md-6"> |
148 | 148 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
149 | 149 | <?php |
150 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
150 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
151 | 151 | if (count($aircraft_array) == 0) { |
152 | 152 | print _("No data available"); |
153 | 153 | } else { |
154 | 154 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
155 | 155 | $aircraft_data = ''; |
156 | - foreach($aircraft_array as $aircraft_item) { |
|
156 | + foreach ($aircraft_array as $aircraft_item) { |
|
157 | 157 | if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
158 | 158 | else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
159 | 159 | } |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | ?> |
183 | 183 | </div> |
184 | 184 | </div> |
185 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
185 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
186 | 186 | <?php |
187 | 187 | if ($airline_icao == '' || $airline_icao == 'all') { |
188 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
188 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
189 | 189 | if (count($airline_array) > 0) { |
190 | 190 | print '<div class="col-md-6">'; |
191 | 191 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
192 | 192 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
193 | 193 | $airline_data = ''; |
194 | - foreach($airline_array as $airline_item) { |
|
194 | + foreach ($airline_array as $airline_item) { |
|
195 | 195 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
196 | 196 | } |
197 | 197 | $airline_data = substr($airline_data, 0, -1); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | } |
217 | 217 | ?> |
218 | 218 | </div> |
219 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
219 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
220 | 220 | <?php |
221 | 221 | } |
222 | 222 | } |
@@ -228,12 +228,12 @@ discard block |
||
228 | 228 | <div class="col-md-6"> |
229 | 229 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
230 | 230 | <?php |
231 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
231 | + $marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month); |
|
232 | 232 | if (count($marine_array) == 0) print _("No data available"); |
233 | 233 | else { |
234 | 234 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
235 | 235 | $marine_data = ''; |
236 | - foreach($marine_array as $marine_item) { |
|
236 | + foreach ($marine_array as $marine_item) { |
|
237 | 237 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
238 | 238 | } |
239 | 239 | $marine_data = substr($marine_data, 0, -1); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | ?> |
264 | 264 | </div> |
265 | 265 | </div> |
266 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
266 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
267 | 267 | <!-- </div>--> |
268 | 268 | <?php |
269 | 269 | } |
@@ -273,12 +273,12 @@ discard block |
||
273 | 273 | <div class="col-md-6"> |
274 | 274 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
275 | 275 | <?php |
276 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
276 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month); |
|
277 | 277 | if (count($tracker_array) == 0) print _("No data available"); |
278 | 278 | else { |
279 | 279 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
280 | 280 | $tracker_data = ''; |
281 | - foreach($tracker_array as $tracker_item) { |
|
281 | + foreach ($tracker_array as $tracker_item) { |
|
282 | 282 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
283 | 283 | } |
284 | 284 | $tracker_data = substr($tracker_data, 0, -1); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ?> |
309 | 309 | </div> |
310 | 310 | </div> |
311 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
311 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
312 | 312 | <!-- </div>--> |
313 | 313 | <?php |
314 | 314 | } |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | else { |
324 | 324 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
325 | 325 | $owner_data = ''; |
326 | - foreach($owner_array as $owner_item) { |
|
326 | + foreach ($owner_array as $owner_item) { |
|
327 | 327 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
328 | 328 | } |
329 | 329 | $owner_data = substr($owner_data, 0, -1); |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | </div> |
344 | 344 | --> |
345 | 345 | </div> |
346 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
346 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
347 | 347 | <div class="col-md-6"> |
348 | 348 | <h2><?php echo _("Top 10 Most Common Countries Owners"); ?></h2> |
349 | 349 | <?php |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | else { |
353 | 353 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
354 | 354 | $owner_data = ''; |
355 | - foreach($countries_array as $owner_item) { |
|
355 | + foreach ($countries_array as $owner_item) { |
|
356 | 356 | $owner_data .= '["'.$owner_item['country_name'].'",'.$owner_item['country_count'].'],'; |
357 | 357 | } |
358 | 358 | $owner_data = substr($owner_data, 0, -1); |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | --> |
374 | 374 | </div> |
375 | 375 | |
376 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
376 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
377 | 377 | ² </div> |
378 | 378 | <div class="row column"> |
379 | 379 | <div class="col-md-6"> |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | else { |
385 | 385 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
386 | 386 | $launch_site_data = ''; |
387 | - foreach($launch_site_array as $launch_site_item) { |
|
387 | + foreach ($launch_site_array as $launch_site_item) { |
|
388 | 388 | $launch_site_data .= '["'.$launch_site_item['launch_site'].'",'.$launch_site_item['launch_site_count'].'],'; |
389 | 389 | } |
390 | 390 | $launch_site_data = substr($launch_site_data, 0, -1); |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | ?> |
412 | 412 | <div class="row column"> |
413 | 413 | <?php |
414 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
414 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
415 | 415 | //if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
416 | 416 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
417 | 417 | if (empty($flightover_array)) { |
@@ -422,12 +422,12 @@ discard block |
||
422 | 422 | ?> |
423 | 423 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
424 | 424 | <?php |
425 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
425 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
426 | 426 | if (count($pilot_array) == 0) print _("No data available"); |
427 | 427 | else { |
428 | 428 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
429 | 429 | $pilot_data = ''; |
430 | - foreach($pilot_array as $pilot_item) { |
|
430 | + foreach ($pilot_array as $pilot_item) { |
|
431 | 431 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
432 | 432 | } |
433 | 433 | $pilot_data = substr($pilot_data, 0, -1); |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | ?> |
449 | 449 | </div> |
450 | 450 | |
451 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
451 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
452 | 452 | <?php |
453 | 453 | } |
454 | 454 | // else { |
@@ -457,12 +457,12 @@ discard block |
||
457 | 457 | <div class="col-md-6"> |
458 | 458 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
459 | 459 | <?php |
460 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
460 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
461 | 461 | if (count($owner_array) == 0) print _("No data available"); |
462 | 462 | else { |
463 | 463 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
464 | 464 | $owner_data = ''; |
465 | - foreach($owner_array as $owner_item) { |
|
465 | + foreach ($owner_array as $owner_item) { |
|
466 | 466 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
467 | 467 | } |
468 | 468 | $owner_data = substr($owner_data, 0, -1); |
@@ -481,7 +481,7 @@ discard block |
||
481 | 481 | </div> |
482 | 482 | </div> |
483 | 483 | |
484 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
484 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
485 | 485 | <?php |
486 | 486 | } |
487 | 487 | if (!empty($flightover_array)) { |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
496 | 496 | print 'var series = ['; |
497 | 497 | $flightover_data = ''; |
498 | - foreach($flightover_array as $flightover_item) { |
|
498 | + foreach ($flightover_array as $flightover_item) { |
|
499 | 499 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
500 | 500 | } |
501 | 501 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | } |
541 | 541 | ?> |
542 | 542 | </div> |
543 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
543 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
544 | 544 | </div> |
545 | 545 | <?php |
546 | 546 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
557 | 557 | print 'var series = ['; |
558 | 558 | $flightover_data = ''; |
559 | - foreach($flightover_array as $flightover_item) { |
|
559 | + foreach ($flightover_array as $flightover_item) { |
|
560 | 560 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
561 | 561 | } |
562 | 562 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
614 | 614 | print 'var series = ['; |
615 | 615 | $flightover_data = ''; |
616 | - foreach($flightover_array as $flightover_item) { |
|
616 | + foreach ($flightover_array as $flightover_item) { |
|
617 | 617 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
618 | 618 | } |
619 | 619 | $flightover_data = substr($flightover_data, 0, -1); |
@@ -663,14 +663,14 @@ discard block |
||
663 | 663 | <div class="row column"> |
664 | 664 | <div class="col-md-6"> |
665 | 665 | <?php |
666 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
666 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
667 | 667 | if (count($airport_airport_array) > 0) { |
668 | 668 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
669 | 669 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
670 | 670 | print "\n"; |
671 | 671 | print 'var series = ['; |
672 | 672 | $airport_data = ''; |
673 | - foreach($airport_airport_array as $airport_item) { |
|
673 | + foreach ($airport_airport_array as $airport_item) { |
|
674 | 674 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
675 | 675 | } |
676 | 676 | $airport_data = substr($airport_data, 0, -1); |
@@ -720,18 +720,18 @@ discard block |
||
720 | 720 | } |
721 | 721 | ?> |
722 | 722 | </div> |
723 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
723 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
724 | 724 | |
725 | 725 | <div class="col-md-6"> |
726 | 726 | <?php |
727 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
727 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
728 | 728 | if (count($airport_airport_array2) > 0) { |
729 | 729 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
730 | 730 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
731 | 731 | print "\n"; |
732 | 732 | print 'var series = ['; |
733 | 733 | $airport_data = ''; |
734 | - foreach($airport_airport_array2 as $airport_item) |
|
734 | + foreach ($airport_airport_array2 as $airport_item) |
|
735 | 735 | { |
736 | 736 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
737 | 737 | } |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | ?> |
784 | 784 | </div> |
785 | 785 | </div> |
786 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
786 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
787 | 787 | <?php |
788 | 788 | } |
789 | 789 | if ($type == 'aircraft') { |
@@ -795,18 +795,18 @@ discard block |
||
795 | 795 | <div class="col-md-6"> |
796 | 796 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
797 | 797 | <?php |
798 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
798 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
799 | 799 | if (count($year_array) == 0) print _("No data available"); |
800 | 800 | else { |
801 | 801 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
802 | 802 | $year_data = ''; |
803 | 803 | $year_cnt = ''; |
804 | - foreach($year_array as $year_item) { |
|
804 | + foreach ($year_array as $year_item) { |
|
805 | 805 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
806 | 806 | $year_cnt .= $year_item['date_count'].','; |
807 | 807 | } |
808 | 808 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
809 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
809 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
810 | 810 | print 'c3.generate({ |
811 | 811 | bindto: "#chart8", |
812 | 812 | data: { x: "x", |
@@ -819,22 +819,22 @@ discard block |
||
819 | 819 | <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> |
820 | 820 | </div> |
821 | 821 | </div> |
822 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
822 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
823 | 823 | <div class="col-md-6"> |
824 | 824 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
825 | 825 | <?php |
826 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
826 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
827 | 827 | if (count($month_array) == 0) print _("No data available"); |
828 | 828 | else { |
829 | 829 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
830 | 830 | $month_data = ''; |
831 | 831 | $month_cnt = ''; |
832 | - foreach($month_array as $month_item) { |
|
832 | + foreach ($month_array as $month_item) { |
|
833 | 833 | $month_data .= '"'.$month_item['date_name'].'",'; |
834 | 834 | $month_cnt .= $month_item['date_count'].','; |
835 | 835 | } |
836 | 836 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
837 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
837 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
838 | 838 | print 'c3.generate({ |
839 | 839 | bindto: "#chart9", |
840 | 840 | data: { x: "x", |
@@ -847,23 +847,23 @@ discard block |
||
847 | 847 | <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> |
848 | 848 | </div> |
849 | 849 | </div> |
850 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
850 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
851 | 851 | |
852 | 852 | <div class="col-md-6"> |
853 | 853 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
854 | 854 | <?php |
855 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
855 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
856 | 856 | if (empty($date_array)) print _("No data available"); |
857 | 857 | else { |
858 | 858 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
859 | 859 | $date_data = ''; |
860 | 860 | $date_cnt = ''; |
861 | - foreach($date_array as $date_item) { |
|
861 | + foreach ($date_array as $date_item) { |
|
862 | 862 | $date_data .= '"'.$date_item['date_name'].'",'; |
863 | 863 | $date_cnt .= $date_item['date_count'].','; |
864 | 864 | } |
865 | 865 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
866 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
866 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
867 | 867 | print 'c3.generate({ |
868 | 868 | bindto: "#chart5", |
869 | 869 | data: { x: "x", |
@@ -876,22 +876,22 @@ discard block |
||
876 | 876 | <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> |
877 | 877 | </div> |
878 | 878 | </div> |
879 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
879 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
880 | 880 | <div class="col-md-6"> |
881 | 881 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
882 | 882 | <?php |
883 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
883 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
884 | 884 | if (empty($hour_array)) print _("No data available"); |
885 | 885 | else { |
886 | 886 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
887 | 887 | $hour_data = ''; |
888 | 888 | $hour_cnt = ''; |
889 | - foreach($hour_array as $hour_item) { |
|
889 | + foreach ($hour_array as $hour_item) { |
|
890 | 890 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
891 | 891 | $hour_cnt .= $hour_item['hour_count'].','; |
892 | 892 | } |
893 | 893 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
894 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
894 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
895 | 895 | print 'c3.generate({ |
896 | 896 | bindto: "#chart6", |
897 | 897 | data: { |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | <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> |
905 | 905 | </div> |
906 | 906 | </div> |
907 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
907 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
908 | 908 | </div> |
909 | 909 | <?php |
910 | 910 | } |
@@ -920,18 +920,18 @@ discard block |
||
920 | 920 | <div class="col-md-6"> |
921 | 921 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
922 | 922 | <?php |
923 | - $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
923 | + $year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
924 | 924 | if (count($year_array) == 0) print _("No data available"); |
925 | 925 | else { |
926 | 926 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
927 | 927 | $year_data = ''; |
928 | 928 | $year_cnt = ''; |
929 | - foreach($year_array as $year_item) { |
|
929 | + foreach ($year_array as $year_item) { |
|
930 | 930 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
931 | 931 | $year_cnt .= $year_item['date_count'].','; |
932 | 932 | } |
933 | 933 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
934 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
934 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
935 | 935 | print 'c3.generate({ |
936 | 936 | bindto: "#chart8", |
937 | 937 | data: { x: "x", |
@@ -945,22 +945,22 @@ discard block |
||
945 | 945 | </div> |
946 | 946 | </div> |
947 | 947 | |
948 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
948 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
949 | 949 | <div class="col-md-6"> |
950 | 950 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
951 | 951 | <?php |
952 | - $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
|
952 | + $month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name); |
|
953 | 953 | if (count($month_array) == 0) print _("No data available"); |
954 | 954 | else { |
955 | 955 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
956 | 956 | $month_data = ''; |
957 | 957 | $month_cnt = ''; |
958 | - foreach($month_array as $month_item) { |
|
958 | + foreach ($month_array as $month_item) { |
|
959 | 959 | $month_data .= '"'.$month_item['date_name'].'",'; |
960 | 960 | $month_cnt .= $month_item['date_count'].','; |
961 | 961 | } |
962 | 962 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
963 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
963 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
964 | 964 | print 'c3.generate({ |
965 | 965 | bindto: "#chart9", |
966 | 966 | data: { x: "x", |
@@ -973,23 +973,23 @@ discard block |
||
973 | 973 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
974 | 974 | </div> |
975 | 975 | </div> |
976 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
976 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
977 | 977 | |
978 | 978 | <div class="col-md-6"> |
979 | 979 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
980 | 980 | <?php |
981 | - $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
|
981 | + $date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name); |
|
982 | 982 | if (empty($date_array)) print _("No data available"); |
983 | 983 | else { |
984 | 984 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
985 | 985 | $date_data = ''; |
986 | 986 | $date_cnt = ''; |
987 | - foreach($date_array as $date_item) { |
|
987 | + foreach ($date_array as $date_item) { |
|
988 | 988 | $date_data .= '"'.$date_item['date_name'].'",'; |
989 | 989 | $date_cnt .= $date_item['date_count'].','; |
990 | 990 | } |
991 | 991 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
992 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
992 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
993 | 993 | print 'c3.generate({ |
994 | 994 | bindto: "#chart5", |
995 | 995 | data: { x: "x", |
@@ -1002,22 +1002,22 @@ discard block |
||
1002 | 1002 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1003 | 1003 | </div> |
1004 | 1004 | </div> |
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 Time of the Day"); ?></h2> |
1008 | 1008 | <?php |
1009 | - $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
|
1009 | + $hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name); |
|
1010 | 1010 | if (empty($hour_array)) print _("No data available"); |
1011 | 1011 | else { |
1012 | 1012 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1013 | 1013 | $hour_data = ''; |
1014 | 1014 | $hour_cnt = ''; |
1015 | - foreach($hour_array as $hour_item) { |
|
1015 | + foreach ($hour_array as $hour_item) { |
|
1016 | 1016 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1017 | 1017 | $hour_cnt .= $hour_item['hour_count'].','; |
1018 | 1018 | } |
1019 | 1019 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1020 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
1020 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
1021 | 1021 | print 'c3.generate({ |
1022 | 1022 | bindto: "#chart6", |
1023 | 1023 | data: { |
@@ -1030,7 +1030,7 @@ discard block |
||
1030 | 1030 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1031 | 1031 | </div> |
1032 | 1032 | </div> |
1033 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1033 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1034 | 1034 | </div> |
1035 | 1035 | <?php |
1036 | 1036 | } |
@@ -1052,12 +1052,12 @@ discard block |
||
1052 | 1052 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
1053 | 1053 | $year_data = ''; |
1054 | 1054 | $year_cnt = ''; |
1055 | - foreach($year_array as $year_item) { |
|
1055 | + foreach ($year_array as $year_item) { |
|
1056 | 1056 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
1057 | 1057 | $year_cnt .= $year_item['date_count'].','; |
1058 | 1058 | } |
1059 | 1059 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1060 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
1060 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
1061 | 1061 | print 'c3.generate({ |
1062 | 1062 | bindto: "#chart8", |
1063 | 1063 | data: { x: "x", |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | </div> |
1072 | 1072 | </div> |
1073 | 1073 | |
1074 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1074 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1075 | 1075 | <div class="col-md-6"> |
1076 | 1076 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1077 | 1077 | <?php |
@@ -1081,12 +1081,12 @@ discard block |
||
1081 | 1081 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1082 | 1082 | $month_data = ''; |
1083 | 1083 | $month_cnt = ''; |
1084 | - foreach($month_array as $month_item) { |
|
1084 | + foreach ($month_array as $month_item) { |
|
1085 | 1085 | $month_data .= '"'.$month_item['date_name'].'",'; |
1086 | 1086 | $month_cnt .= $month_item['date_count'].','; |
1087 | 1087 | } |
1088 | 1088 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
1089 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
1089 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
1090 | 1090 | print 'c3.generate({ |
1091 | 1091 | bindto: "#chart9", |
1092 | 1092 | data: { x: "x", |
@@ -1099,7 +1099,7 @@ discard block |
||
1099 | 1099 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1100 | 1100 | </div> |
1101 | 1101 | </div> |
1102 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1102 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1103 | 1103 | |
1104 | 1104 | <div class="col-md-6"> |
1105 | 1105 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1110,12 +1110,12 @@ discard block |
||
1110 | 1110 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1111 | 1111 | $date_data = ''; |
1112 | 1112 | $date_cnt = ''; |
1113 | - foreach($date_array as $date_item) { |
|
1113 | + foreach ($date_array as $date_item) { |
|
1114 | 1114 | $date_data .= '"'.$date_item['date_name'].'",'; |
1115 | 1115 | $date_cnt .= $date_item['date_count'].','; |
1116 | 1116 | } |
1117 | 1117 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
1118 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
1118 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
1119 | 1119 | print 'c3.generate({ |
1120 | 1120 | bindto: "#chart5", |
1121 | 1121 | data: { x: "x", |
@@ -1128,22 +1128,22 @@ discard block |
||
1128 | 1128 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1129 | 1129 | </div> |
1130 | 1130 | </div> |
1131 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1131 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1132 | 1132 | <div class="col-md-6"> |
1133 | 1133 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1134 | 1134 | <?php |
1135 | - $hour_array = $Tracker->countAllHours('hour',true); |
|
1135 | + $hour_array = $Tracker->countAllHours('hour', true); |
|
1136 | 1136 | if (empty($hour_array)) print _("No data available"); |
1137 | 1137 | else { |
1138 | 1138 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1139 | 1139 | $hour_data = ''; |
1140 | 1140 | $hour_cnt = ''; |
1141 | - foreach($hour_array as $hour_item) { |
|
1141 | + foreach ($hour_array as $hour_item) { |
|
1142 | 1142 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1143 | 1143 | $hour_cnt .= $hour_item['hour_count'].','; |
1144 | 1144 | } |
1145 | 1145 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1146 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
1146 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
1147 | 1147 | print 'c3.generate({ |
1148 | 1148 | bindto: "#chart6", |
1149 | 1149 | data: { |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1157 | 1157 | </div> |
1158 | 1158 | </div> |
1159 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1159 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1160 | 1160 | </div> |
1161 | 1161 | <?php |
1162 | 1162 | } |
@@ -1178,12 +1178,12 @@ discard block |
||
1178 | 1178 | print '<div id="chart21" class="chart" width="100%"></div><script>'; |
1179 | 1179 | $year_data = ''; |
1180 | 1180 | $year_cnt = ''; |
1181 | - foreach($year_array as $year_item) { |
|
1181 | + foreach ($year_array as $year_item) { |
|
1182 | 1182 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
1183 | 1183 | $year_cnt .= $year_item['date_count'].','; |
1184 | 1184 | } |
1185 | 1185 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1186 | - $year_cnt = "['satellite',".substr($year_cnt,0,-1)."]"; |
|
1186 | + $year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]"; |
|
1187 | 1187 | print 'c3.generate({ |
1188 | 1188 | bindto: "#chart21", |
1189 | 1189 | data: { x: "x", |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | --> |
1200 | 1200 | </div> |
1201 | 1201 | |
1202 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1202 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1203 | 1203 | <div class="col-md-6"> |
1204 | 1204 | <h2><?php echo _("Busiest Launch Years of the last 10 Years"); ?></h2> |
1205 | 1205 | <?php |
@@ -1209,12 +1209,12 @@ discard block |
||
1209 | 1209 | print '<div id="chart22" class="chart" width="100%"></div><script>'; |
1210 | 1210 | $year_data = ''; |
1211 | 1211 | $year_cnt = ''; |
1212 | - foreach($year_array as $year_item) { |
|
1212 | + foreach ($year_array as $year_item) { |
|
1213 | 1213 | $year_data .= '"'.$year_item['year_name'].'-01-01'.'",'; |
1214 | 1214 | $year_cnt .= $year_item['date_count'].','; |
1215 | 1215 | } |
1216 | 1216 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1217 | - $year_cnt = "['satellite',".substr($year_cnt,0,-1)."]"; |
|
1217 | + $year_cnt = "['satellite',".substr($year_cnt, 0, -1)."]"; |
|
1218 | 1218 | print 'c3.generate({ |
1219 | 1219 | bindto: "#chart22", |
1220 | 1220 | data: { x: "x", |
@@ -1230,7 +1230,7 @@ discard block |
||
1230 | 1230 | --> |
1231 | 1231 | </div> |
1232 | 1232 | |
1233 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1233 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1234 | 1234 | </div> |
1235 | 1235 | <?php |
1236 | 1236 | } |
@@ -1252,12 +1252,12 @@ discard block |
||
1252 | 1252 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1253 | 1253 | $year_data = ''; |
1254 | 1254 | $year_cnt = ''; |
1255 | - foreach($year_array as $year_item) { |
|
1255 | + foreach ($year_array as $year_item) { |
|
1256 | 1256 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
1257 | 1257 | $year_cnt .= $year_item['count'].','; |
1258 | 1258 | } |
1259 | 1259 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1260 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1260 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1261 | 1261 | print 'c3.generate({ |
1262 | 1262 | bindto: "#chart32", |
1263 | 1263 | data: { x: "x", |
@@ -1270,7 +1270,7 @@ discard block |
||
1270 | 1270 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1271 | 1271 | </div> |
1272 | 1272 | </div> |
1273 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1273 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1274 | 1274 | |
1275 | 1275 | <div class="row column"> |
1276 | 1276 | <div class="col-md-6"> |
@@ -1282,12 +1282,12 @@ discard block |
||
1282 | 1282 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1283 | 1283 | $year_data = ''; |
1284 | 1284 | $year_cnt = ''; |
1285 | - foreach($year_array as $year_item) { |
|
1285 | + foreach ($year_array as $year_item) { |
|
1286 | 1286 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
1287 | 1287 | $year_cnt .= $year_item['count'].','; |
1288 | 1288 | } |
1289 | 1289 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1290 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1290 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1291 | 1291 | print 'c3.generate({ |
1292 | 1292 | bindto: "#chart33", |
1293 | 1293 | data: { x: "x", |
@@ -1300,7 +1300,7 @@ discard block |
||
1300 | 1300 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1301 | 1301 | </div> |
1302 | 1302 | </div> |
1303 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1303 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1304 | 1304 | <br/> |
1305 | 1305 | <?php |
1306 | 1306 | } |
@@ -1314,19 +1314,19 @@ discard block |
||
1314 | 1314 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
1315 | 1315 | if ($year == '' && $month == '') { |
1316 | 1316 | if ($type == 'aircraft') { |
1317 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
1317 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
1318 | 1318 | } elseif ($type == 'marine') { |
1319 | - $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d')); |
|
1319 | + $polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d')); |
|
1320 | 1320 | } elseif ($type == 'tracker') { |
1321 | - $polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d')); |
|
1321 | + $polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d')); |
|
1322 | 1322 | } |
1323 | 1323 | } else { |
1324 | 1324 | if ($type == 'aircraft') { |
1325 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
1325 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
1326 | 1326 | } elseif ($type == 'marine') { |
1327 | - $polar = $Stats->getStatsSource('polar_marine',$year,$month); |
|
1327 | + $polar = $Stats->getStatsSource('polar_marine', $year, $month); |
|
1328 | 1328 | } elseif ($type == 'tracker') { |
1329 | - $polar = $Stats->getStatsSource('polar_tracker',$year,$month); |
|
1329 | + $polar = $Stats->getStatsSource('polar_tracker', $year, $month); |
|
1330 | 1330 | } |
1331 | 1331 | } |
1332 | 1332 | if (!empty($polar)) { |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | unset($polar_data); |
1336 | 1336 | $Spotter = new Spotter(); |
1337 | 1337 | $data = json_decode($eachpolar['source_data']); |
1338 | - foreach($data as $value => $key) { |
|
1338 | + foreach ($data as $value => $key) { |
|
1339 | 1339 | $direction = $Spotter->parseDirection(($value*22.5)); |
1340 | 1340 | $distance = $key; |
1341 | 1341 | $unit = 'km'; |
@@ -1355,7 +1355,7 @@ discard block |
||
1355 | 1355 | ?> |
1356 | 1356 | <div class="col-md-6"> |
1357 | 1357 | <h4><?php print $eachpolar['source_name']; ?></h4> |
1358 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1358 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1359 | 1359 | <script> |
1360 | 1360 | (function() { |
1361 | 1361 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | color: color, |
1380 | 1380 | unit: '<?php echo $unit; ?>' |
1381 | 1381 | }; |
1382 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1382 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1383 | 1383 | })(); |
1384 | 1384 | </script> |
1385 | 1385 | </div> |
@@ -1394,19 +1394,19 @@ discard block |
||
1394 | 1394 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
1395 | 1395 | if ($year == '' && $month == '') { |
1396 | 1396 | if ($type == 'aircraft') { |
1397 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
1397 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
1398 | 1398 | } elseif ($type == 'marine') { |
1399 | - $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d')); |
|
1399 | + $msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d')); |
|
1400 | 1400 | } elseif ($type == 'tracker') { |
1401 | - $msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d')); |
|
1401 | + $msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d')); |
|
1402 | 1402 | } |
1403 | 1403 | } else { |
1404 | 1404 | if ($type == 'aircraft') { |
1405 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
1405 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
1406 | 1406 | } elseif ($type == 'marine') { |
1407 | - $msg = $Stats->getStatsSource('msg_marine',$year,$month); |
|
1407 | + $msg = $Stats->getStatsSource('msg_marine', $year, $month); |
|
1408 | 1408 | } elseif ($type == 'tracker') { |
1409 | - $msg = $Stats->getStatsSource('msg_tracker',$year,$month); |
|
1409 | + $msg = $Stats->getStatsSource('msg_tracker', $year, $month); |
|
1410 | 1410 | } |
1411 | 1411 | } |
1412 | 1412 | if (!empty($msg)) { |
@@ -1414,13 +1414,13 @@ discard block |
||
1414 | 1414 | foreach ($msg as $eachmsg) { |
1415 | 1415 | //$eachmsg = $msg[0]; |
1416 | 1416 | $data = $eachmsg['source_data']; |
1417 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1417 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
1418 | 1418 | else $max = 500; |
1419 | 1419 | ?> |
1420 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1420 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1421 | 1421 | <script> |
1422 | 1422 | var g = new JustGage({ |
1423 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
1423 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
1424 | 1424 | value: <?php echo $data; ?>, |
1425 | 1425 | min: 0, |
1426 | 1426 | max: <?php print $max; ?>, |
@@ -1442,19 +1442,19 @@ discard block |
||
1442 | 1442 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
1443 | 1443 | if ($year == '' && $month == '') { |
1444 | 1444 | if ($type == 'aircraft') { |
1445 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
1445 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
1446 | 1446 | } elseif ($type == 'marine') { |
1447 | - $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d')); |
|
1447 | + $hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d')); |
|
1448 | 1448 | } elseif ($type == 'tracker') { |
1449 | - $hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d')); |
|
1449 | + $hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d')); |
|
1450 | 1450 | } |
1451 | 1451 | } else { |
1452 | 1452 | if ($type == 'aircraft') { |
1453 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
1453 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
1454 | 1454 | } elseif ($type == 'marine') { |
1455 | - $hist = $Stats->getStatsSource('hist_marine',$year,$month); |
|
1455 | + $hist = $Stats->getStatsSource('hist_marine', $year, $month); |
|
1456 | 1456 | } elseif ($type == 'tracker') { |
1457 | - $hist = $Stats->getStatsSource('hist_tracker',$year,$month); |
|
1457 | + $hist = $Stats->getStatsSource('hist_tracker', $year, $month); |
|
1458 | 1458 | } |
1459 | 1459 | } |
1460 | 1460 | foreach ($hist as $hists) { |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | $source = $hists['source_name']; |
1465 | 1465 | $hist_array = json_decode($hists['source_data']); |
1466 | 1466 | $unit = 'km'; |
1467 | - foreach($hist_array as $distance => $nb) { |
|
1467 | + foreach ($hist_array as $distance => $nb) { |
|
1468 | 1468 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1469 | 1469 | $distance = round($distance*0.539957); |
1470 | 1470 | $unit = 'nm'; |
@@ -1484,18 +1484,18 @@ discard block |
||
1484 | 1484 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
1485 | 1485 | ?> |
1486 | 1486 | <div class="col-md-6"> |
1487 | - <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2> |
|
1487 | + <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2> |
|
1488 | 1488 | <?php |
1489 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1489 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1490 | 1490 | print 'c3.generate({ |
1491 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
1491 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
1492 | 1492 | data: { x: "x", |
1493 | 1493 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
1494 | 1494 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
1495 | 1495 | print '</script>'; |
1496 | 1496 | ?> |
1497 | 1497 | </div> |
1498 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1498 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1499 | 1499 | <?php |
1500 | 1500 | } |
1501 | 1501 | ?> |
@@ -9,7 +9,7 @@ |
||
9 | 9 | if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') { |
10 | 10 | exec("ps ux", $output, $result); |
11 | 11 | $j = 0; |
12 | - foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ")) $j++; |
|
12 | + foreach ($output as $line) if (strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ")) $j++; |
|
13 | 13 | if ($j > 1) { |
14 | 14 | echo "Script is already runnning..."; |
15 | 15 | die(); |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | |
18 | 18 | $debug = true; |
19 | 19 | |
20 | -$ACARS=new ACARS(null,true); |
|
20 | +$ACARS = new ACARS(null, true); |
|
21 | 21 | date_default_timezone_set('UTC'); |
22 | 22 | // signal handler - playing nice with sockets and dump1090 |
23 | -pcntl_signal(SIGINT, function($signo) { |
|
23 | +pcntl_signal(SIGINT, function($signo) { |
|
24 | 24 | global $sock; |
25 | 25 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
26 | 26 | socket_shutdown($sock, 0); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $sock = socket_create(AF_INET, SOCK_DGRAM, 0) or die("Unable to create socket\n"); |
37 | 37 | |
38 | 38 | // Bind the source address |
39 | -if( !socket_bind($sock, $globalACARSHost , $globalACARSPort) ) |
|
39 | +if (!socket_bind($sock, $globalACARSHost, $globalACARSPort)) |
|
40 | 40 | { |
41 | 41 | $errorcode = socket_last_error(); |
42 | 42 | $errormsg = socket_strerror($errorcode); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | echo "LISTEN UDP MODE \n\n"; |
48 | -while(1) { |
|
48 | +while (1) { |
|
49 | 49 | $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port); |
50 | 50 | |
51 | 51 | // lets play nice and handle signals such as ctrl-c/kill properly |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | // (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1 |
55 | 55 | echo $buffer."\n"; |
56 | 56 | $ACARS->add(trim($buffer)); |
57 | - socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
57 | + socket_sendto($sock, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
58 | 58 | $ACARS->deleteLiveAcarsData(); |
59 | 59 | } |
60 | -pcntl_exec($_,$argv); |
|
60 | +pcntl_exec($_, $argv); |
|
61 | 61 | ?> |
@@ -50,20 +50,20 @@ discard block |
||
50 | 50 | die; |
51 | 51 | } |
52 | 52 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
53 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
53 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | |
57 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::','aprsserverhost::','aprsserverport::','format::','noaprsserver')); |
|
57 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::', 'aprsserverhost::', 'aprsserverport::', 'format::', 'noaprsserver')); |
|
58 | 58 | //if (isset($options['s'])) $hosts = array($options['s']); |
59 | 59 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
60 | 60 | if (isset($options['s'])) { |
61 | 61 | $globalSources = array(); |
62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
62 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['s'], 'format' => $options['format']); |
|
63 | 63 | else $globalSources[] = array('host' => $options['s']); |
64 | 64 | } elseif (isset($options['source'])) { |
65 | 65 | $globalSources = array(); |
66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
66 | + if (isset($options['format'])) $globalSources[] = array('host' => $options['source'], 'format' => $options['format']); |
|
67 | 67 | else $globalSources[] = array('host' => $options['source']); |
68 | 68 | } |
69 | 69 | if (isset($options['aprsserverhost'])) { |
@@ -80,28 +80,28 @@ discard block |
||
80 | 80 | else $id_source = 1; |
81 | 81 | if (isset($globalServer) && $globalServer) { |
82 | 82 | if ($globalDebug) echo "Using Server Mode\n"; |
83 | - $SI=new SpotterServer(); |
|
83 | + $SI = new SpotterServer(); |
|
84 | 84 | /* |
85 | 85 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
86 | 86 | $SI = new adsb2aprs(); |
87 | 87 | $SI->connect(); |
88 | 88 | */ |
89 | -} else $SI=new SpotterImport($Connection->db); |
|
89 | +} else $SI = new SpotterImport($Connection->db); |
|
90 | 90 | if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
91 | 91 | if (isset($globalMarine) && $globalMarine) { |
92 | 92 | $AIS = new AIS(); |
93 | 93 | $MI = new MarineImport($Connection->db); |
94 | 94 | } |
95 | 95 | //$APRS=new APRS($Connection->db); |
96 | -$SBS=new SBS(); |
|
97 | -$ACARS=new ACARS($Connection->db,true); |
|
98 | -$Source=new Source($Connection->db); |
|
99 | -$Common=new Common(); |
|
96 | +$SBS = new SBS(); |
|
97 | +$ACARS = new ACARS($Connection->db, true); |
|
98 | +$Source = new Source($Connection->db); |
|
99 | +$Common = new Common(); |
|
100 | 100 | date_default_timezone_set('UTC'); |
101 | 101 | //$servertz = system('date +%Z'); |
102 | 102 | // signal handler - playing nice with sockets and dump1090 |
103 | 103 | if (function_exists('pcntl_fork')) { |
104 | - pcntl_signal(SIGINT, function() { |
|
104 | + pcntl_signal(SIGINT, function() { |
|
105 | 105 | global $sockets; |
106 | 106 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
107 | 107 | die("Bye!\n"); |
@@ -117,30 +117,30 @@ discard block |
||
117 | 117 | |
118 | 118 | function connect_all($hosts) { |
119 | 119 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
120 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
120 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; |
|
121 | 121 | $reset++; |
122 | 122 | if ($globalDebug) echo 'Connect to all...'."\n"; |
123 | 123 | foreach ($hosts as $id => $value) { |
124 | 124 | $host = $value['host']; |
125 | 125 | $globalSources[$id]['last_exec'] = 0; |
126 | 126 | // Here we check type of source(s) |
127 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
128 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
127 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
128 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
129 | 129 | //$formats[$id] = 'deltadbtxt'; |
130 | 130 | $globalSources[$id]['format'] = 'deltadbtxt'; |
131 | 131 | //$last_exec['deltadbtxt'] = 0; |
132 | 132 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
133 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
133 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
134 | 134 | //$formats[$id] = 'vatsimtxt'; |
135 | 135 | $globalSources[$id]['format'] = 'vatsimtxt'; |
136 | 136 | //$last_exec['vatsimtxt'] = 0; |
137 | 137 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
138 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
138 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
139 | 139 | //$formats[$id] = 'aircraftlistjson'; |
140 | 140 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
141 | 141 | //$last_exec['aircraftlistjson'] = 0; |
142 | 142 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
143 | - } else if (preg_match('/opensky/i',$host)) { |
|
143 | + } else if (preg_match('/opensky/i', $host)) { |
|
144 | 144 | //$formats[$id] = 'aircraftlistjson'; |
145 | 145 | $globalSources[$id]['format'] = 'opensky'; |
146 | 146 | //$last_exec['aircraftlistjson'] = 0; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | exit(0); |
158 | 158 | } |
159 | 159 | */ |
160 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
160 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
161 | 161 | //$formats[$id] = 'planeupdatefaa'; |
162 | 162 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
163 | 163 | //$last_exec['planeupdatefaa'] = 0; |
@@ -166,32 +166,32 @@ discard block |
||
166 | 166 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
167 | 167 | exit(0); |
168 | 168 | } |
169 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
169 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
170 | 170 | //$formats[$id] = 'phpvmacars'; |
171 | 171 | $globalSources[$id]['format'] = 'phpvmacars'; |
172 | 172 | //$last_exec['phpvmacars'] = 0; |
173 | 173 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
174 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
174 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
175 | 175 | //$formats[$id] = 'phpvmacars'; |
176 | 176 | $globalSources[$id]['format'] = 'vam'; |
177 | 177 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
178 | - } else if (preg_match('/whazzup/i',$host)) { |
|
178 | + } else if (preg_match('/whazzup/i', $host)) { |
|
179 | 179 | //$formats[$id] = 'whazzup'; |
180 | 180 | $globalSources[$id]['format'] = 'whazzup'; |
181 | 181 | //$last_exec['whazzup'] = 0; |
182 | 182 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
183 | - } else if (preg_match('/blitzortung/i',$host)) { |
|
183 | + } else if (preg_match('/blitzortung/i', $host)) { |
|
184 | 184 | $globalSources[$id]['format'] = 'blitzortung'; |
185 | 185 | if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
186 | - } else if (preg_match('/airwhere/i',$host)) { |
|
186 | + } else if (preg_match('/airwhere/i', $host)) { |
|
187 | 187 | $globalSources[$id]['format'] = 'airwhere'; |
188 | 188 | if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
189 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
189 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
190 | 190 | //$formats[$id] = 'pirepsjson'; |
191 | 191 | $globalSources[$id]['format'] = 'pirepsjson'; |
192 | 192 | //$last_exec['pirepsjson'] = 0; |
193 | 193 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
194 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
194 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
195 | 195 | //$formats[$id] = 'fr24json'; |
196 | 196 | $globalSources[$id]['format'] = 'fr24json'; |
197 | 197 | //$last_exec['fr24json'] = 0; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
201 | 201 | exit(0); |
202 | 202 | } |
203 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
203 | + } else if (preg_match(':myshiptracking.com/:i', $host)) { |
|
204 | 204 | //$formats[$id] = 'fr24json'; |
205 | 205 | $globalSources[$id]['format'] = 'myshiptracking'; |
206 | 206 | //$last_exec['fr24json'] = 0; |
@@ -210,22 +210,22 @@ discard block |
||
210 | 210 | exit(0); |
211 | 211 | } |
212 | 212 | //} else if (preg_match('/10001/',$host)) { |
213 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
213 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
214 | 214 | //$formats[$id] = 'tsv'; |
215 | 215 | $globalSources[$id]['format'] = 'tsv'; |
216 | 216 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
217 | 217 | } |
218 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
218 | + } elseif (filter_var($host, FILTER_VALIDATE_URL)) { |
|
219 | 219 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
220 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
220 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); |
|
221 | 221 | if ($idf !== false) { |
222 | 222 | $httpfeeds[$id] = $idf; |
223 | 223 | if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
224 | 224 | } |
225 | 225 | elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
226 | 226 | } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
227 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
228 | - $hostport = explode(':',$host); |
|
227 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
228 | + $hostport = explode(':', $host); |
|
229 | 229 | if (isset($hostport[1])) { |
230 | 230 | $port = $hostport[1]; |
231 | 231 | $hostn = $hostport[0]; |
@@ -235,19 +235,19 @@ discard block |
||
235 | 235 | } |
236 | 236 | $Common = new Common(); |
237 | 237 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
238 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
238 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); |
|
239 | 239 | } else { |
240 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
240 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); |
|
241 | 241 | } |
242 | 242 | if ($s) { |
243 | 243 | $sockets[$id] = $s; |
244 | 244 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
245 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
245 | + if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { |
|
246 | 246 | //$formats[$id] = 'aprs'; |
247 | 247 | $globalSources[$id]['format'] = 'aprs'; |
248 | 248 | //$aprs_connect = 0; |
249 | 249 | //$use_aprs = true; |
250 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
250 | + } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
251 | 251 | $globalSources[$id]['format'] = 'vrstcp'; |
252 | 252 | } elseif ($port == '10001') { |
253 | 253 | //$formats[$id] = 'tsv'; |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
287 | 287 | else $timeout = 20; |
288 | 288 | $errno = ''; |
289 | -$errstr=''; |
|
289 | +$errstr = ''; |
|
290 | 290 | |
291 | 291 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
292 | 292 | /* Initiate connections to all the hosts simultaneously */ |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | //connect_all($globalSources); |
295 | 295 | |
296 | 296 | if (isset($globalProxy) && $globalProxy) { |
297 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
297 | + $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); |
|
298 | 298 | } else { |
299 | 299 | $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
300 | 300 | } |
@@ -324,16 +324,16 @@ discard block |
||
324 | 324 | |
325 | 325 | if ($use_aprs) { |
326 | 326 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
327 | - $APRS=new APRS(); |
|
327 | + $APRS = new APRS(); |
|
328 | 328 | $aprs_connect = 0; |
329 | 329 | $aprs_keep = 120; |
330 | 330 | $aprs_last_tx = time(); |
331 | 331 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
332 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
332 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
333 | 333 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
334 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
334 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
335 | 335 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
336 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
336 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
337 | 337 | if ($aprs_full) $aprs_filter = ''; |
338 | 338 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
339 | 339 | else $aprs_pass = '-1'; |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | sleep(1); |
348 | 348 | if ($globalDebug) echo "SCAN MODE \n\n"; |
349 | 349 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
350 | -$endtime = time()+$globalCronEnd; |
|
350 | +$endtime = time() + $globalCronEnd; |
|
351 | 351 | $i = 1; |
352 | 352 | $tt = array(); |
353 | 353 | // Delete all ATC |
354 | 354 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
355 | - $ATC=new ATC($Connection->db); |
|
355 | + $ATC = new ATC($Connection->db); |
|
356 | 356 | } |
357 | 357 | if (!$globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
358 | 358 | $ATC->deleteAll(); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | |
361 | 361 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
362 | 362 | while ($i > 0) { |
363 | - if (!$globalDaemon) $i = $endtime-time(); |
|
363 | + if (!$globalDaemon) $i = $endtime - time(); |
|
364 | 364 | // Delete old ATC |
365 | 365 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
366 | 366 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | } |
375 | 375 | if ($max != $globalMinFetch) { |
376 | 376 | if ($globalDebug) echo 'Sleeping...'."\n"; |
377 | - sleep($globalMinFetch-$max+2); |
|
377 | + sleep($globalMinFetch - $max + 2); |
|
378 | 378 | } |
379 | 379 | } |
380 | 380 | |
@@ -393,8 +393,8 @@ discard block |
||
393 | 393 | //$buffer = $Common->getData($hosts[$id]); |
394 | 394 | $buffer = $Common->getData($value['host']); |
395 | 395 | if ($buffer != '') $reset = 0; |
396 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
397 | - $buffer = explode('\n',$buffer); |
|
396 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
397 | + $buffer = explode('\n', $buffer); |
|
398 | 398 | foreach ($buffer as $line) { |
399 | 399 | if ($line != '' && count($line) > 7) { |
400 | 400 | $line = explode(',', $line); |
@@ -427,11 +427,11 @@ discard block |
||
427 | 427 | ) |
428 | 428 | ) { |
429 | 429 | date_default_timezone_set('CET'); |
430 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
430 | + $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); |
|
431 | 431 | date_default_timezone_set('UTC'); |
432 | 432 | if ($buffer != '') $reset = 0; |
433 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
434 | - $buffer = explode('\n',$buffer); |
|
433 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
434 | + $buffer = explode('\n', $buffer); |
|
435 | 435 | foreach ($buffer as $line) { |
436 | 436 | if ($line != '') { |
437 | 437 | //echo "'".$line."'\n"; |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
450 | 450 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
451 | 451 | if (isset($ais_data['timestamp'])) { |
452 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
452 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
453 | 453 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
454 | 454 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
455 | 455 | $add = true; |
@@ -472,12 +472,12 @@ discard block |
||
472 | 472 | $w = $e = null; |
473 | 473 | |
474 | 474 | if (isset($arr[$id])) { |
475 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
475 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
476 | 476 | if ($nn > 0) { |
477 | 477 | foreach ($httpfeeds as $feed) { |
478 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
479 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
480 | - $buffer = explode('\n',$buffer); |
|
478 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
479 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
480 | + $buffer = explode('\n', $buffer); |
|
481 | 481 | foreach ($buffer as $line) { |
482 | 482 | if ($line != '') { |
483 | 483 | $ais_data = $AIS->parse_line(trim($line)); |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
496 | 496 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
497 | 497 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
498 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
498 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
499 | 499 | if (isset($ais_data['timestamp'])) { |
500 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
500 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
501 | 501 | } else { |
502 | 502 | $data['datetime'] = date('Y-m-d H:i:s'); |
503 | 503 | } |
@@ -528,10 +528,10 @@ discard block |
||
528 | 528 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
529 | 529 | ) |
530 | 530 | ) { |
531 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
531 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
532 | 532 | if ($buffer != '') { |
533 | 533 | //echo $buffer; |
534 | - $all_data = json_decode($buffer,true); |
|
534 | + $all_data = json_decode($buffer, true); |
|
535 | 535 | //print_r($all_data); |
536 | 536 | if (isset($all_data[0]['DATA'])) { |
537 | 537 | foreach ($all_data[0]['DATA'] as $line) { |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
547 | 547 | $data['imo'] = $line['IMO']; |
548 | 548 | //$data['arrival_code'] = $ais_data['destination']; |
549 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
549 | + $data['datetime'] = date('Y-m-d H:i:s', $line['T']); |
|
550 | 550 | $data['format_source'] = 'myshiptracking'; |
551 | 551 | $data['id_source'] = $id_source; |
552 | 552 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -563,9 +563,9 @@ discard block |
||
563 | 563 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
564 | 564 | ) |
565 | 565 | ) { |
566 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
566 | + $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); |
|
567 | 567 | if ($buffer != '') { |
568 | - $all_data = json_decode($buffer,true); |
|
568 | + $all_data = json_decode($buffer, true); |
|
569 | 569 | if (isset($all_data[0]['mmsi'])) { |
570 | 570 | foreach ($all_data as $line) { |
571 | 571 | if ($line != '') { |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | ) { |
600 | 600 | $buffer = $Common->getData($value['host']); |
601 | 601 | if ($buffer != '') { |
602 | - $all_data = json_decode($buffer,true); |
|
602 | + $all_data = json_decode($buffer, true); |
|
603 | 603 | if (isset($all_data['features'][0]['id'])) { |
604 | 604 | foreach ($all_data['features'] as $line) { |
605 | 605 | $data = array(); |
@@ -632,27 +632,27 @@ discard block |
||
632 | 632 | ) |
633 | 633 | ) { |
634 | 634 | echo 'download...'; |
635 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
635 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); |
|
636 | 636 | echo 'done !'."\n"; |
637 | 637 | if ($buffer != '') $reset = 0; |
638 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
639 | - $buffer = explode('\n',$buffer); |
|
638 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
639 | + $buffer = explode('\n', $buffer); |
|
640 | 640 | foreach ($buffer as $line) { |
641 | 641 | if ($line != '') { |
642 | 642 | $data = array(); |
643 | - $data['mmsi'] = (int)substr($line,0,9); |
|
644 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
643 | + $data['mmsi'] = (int) substr($line, 0, 9); |
|
644 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); |
|
645 | 645 | //$data['status'] = substr($line,21,2); |
646 | 646 | //$data['type'] = substr($line,24,3); |
647 | - $data['latitude'] = substr($line,29,9); |
|
648 | - $data['longitude'] = substr($line,41,9); |
|
649 | - $data['speed'] = round(substr($line,51,5)); |
|
647 | + $data['latitude'] = substr($line, 29, 9); |
|
648 | + $data['longitude'] = substr($line, 41, 9); |
|
649 | + $data['speed'] = round(substr($line, 51, 5)); |
|
650 | 650 | //$data['course'] = substr($line,57,5); |
651 | - $data['heading'] = round(substr($line,63,3)); |
|
651 | + $data['heading'] = round(substr($line, 63, 3)); |
|
652 | 652 | //$data['draft'] = substr($line,67,4); |
653 | 653 | //$data['length'] = substr($line,72,3); |
654 | 654 | //$data['beam'] = substr($line,76,2); |
655 | - $data['ident'] = trim(utf8_encode(substr($line,79,20))); |
|
655 | + $data['ident'] = trim(utf8_encode(substr($line, 79, 20))); |
|
656 | 656 | //$data['callsign'] = trim(substr($line,100,7); |
657 | 657 | //$data['dest'] = substr($line,108,20); |
658 | 658 | //$data['etaDate'] = substr($line,129,5); |
@@ -685,8 +685,8 @@ discard block |
||
685 | 685 | ) { |
686 | 686 | //$buffer = $Common->getData($hosts[$id]); |
687 | 687 | $buffer = $Common->getData($value['host']); |
688 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
689 | - $buffer = explode('\n',$buffer); |
|
688 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
689 | + $buffer = explode('\n', $buffer); |
|
690 | 690 | $reset = 0; |
691 | 691 | foreach ($buffer as $line) { |
692 | 692 | if ($line != '') { |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
698 | 698 | $data['pilot_id'] = $line[1]; |
699 | 699 | $data['pilot_name'] = $line[2]; |
700 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
|
700 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); |
|
701 | 701 | $data['ident'] = $line[0]; // ident |
702 | 702 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
703 | 703 | $data['speed'] = $line[8]; // speed |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
714 | 714 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
715 | 715 | $data['departure_airport_icao'] = $line[11]; |
716 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
716 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
717 | 717 | $data['arrival_airport_icao'] = $line[13]; |
718 | 718 | $data['frequency'] = $line[4]; |
719 | 719 | $data['type'] = $line[18]; |
@@ -722,7 +722,7 @@ discard block |
||
722 | 722 | $data['id_source'] = $id_source; |
723 | 723 | //$data['arrival_airport_time'] = ; |
724 | 724 | if ($line[9] != '') { |
725 | - $aircraft_data = explode('/',$line[9]); |
|
725 | + $aircraft_data = explode('/', $line[9]); |
|
726 | 726 | if (isset($aircraft_data[1])) { |
727 | 727 | $data['aircraft_icao'] = $aircraft_data[1]; |
728 | 728 | } |
@@ -737,9 +737,9 @@ discard block |
||
737 | 737 | if ($line[3] == 'PILOT') $SI->add($data); |
738 | 738 | elseif ($line[3] == 'ATC') { |
739 | 739 | //print_r($data); |
740 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
741 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
742 | - $typec = substr($data['ident'],-3); |
|
740 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
741 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
742 | + $typec = substr($data['ident'], -3); |
|
743 | 743 | if ($typec == 'APP') $data['type'] = 'Approach'; |
744 | 744 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
745 | 745 | elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
@@ -751,8 +751,8 @@ discard block |
||
751 | 751 | elseif ($data['type'] == '') $data['type'] = 'Observer'; |
752 | 752 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
753 | 753 | if (isset($ATC)) { |
754 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
755 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
754 | + if (count($ATC->getByIdent($data['ident'], $data['format_source'])) > 0) echo $ATC->update($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
755 | + else echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
756 | 756 | } |
757 | 757 | } |
758 | 758 | unset($data); |
@@ -768,24 +768,24 @@ discard block |
||
768 | 768 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
769 | 769 | ) |
770 | 770 | ) { |
771 | - $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php','get','','','','','20'); |
|
771 | + $buffer = $Common->getData('http://www.airwhere.co.uk/pilots.php', 'get', '', '', '', '', '20'); |
|
772 | 772 | if ($buffer != '') { |
773 | 773 | $all_data = simplexml_load_string($buffer); |
774 | - foreach($all_data->children() as $childdata) { |
|
774 | + foreach ($all_data->children() as $childdata) { |
|
775 | 775 | $data = array(); |
776 | 776 | $line = $childdata; |
777 | 777 | //$data['hex'] = str_pad(dechex((int)$line['pktPilotID']),6,'000000',STR_PAD_LEFT); |
778 | - $data['id'] = date('Ymd').(int)$line['pktPilotID']; |
|
779 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
|
780 | - $data['latitude'] = (float)$line['pktLatitude']; |
|
781 | - $data['longitude'] = (float)$line['pktLongitude']; |
|
782 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
783 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
784 | - $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
|
778 | + $data['id'] = date('Ymd').(int) $line['pktPilotID']; |
|
779 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['entryTime'].' BST')); |
|
780 | + $data['latitude'] = (float) $line['pktLatitude']; |
|
781 | + $data['longitude'] = (float) $line['pktLongitude']; |
|
782 | + if ((float) $line['pktTrack'] != 0) $data['heading'] = (float) $line['pktTrack']; |
|
783 | + if ((int) $line['pktSpeed'] != 0) $data['speed'] = (int) $line['pktSpeed']; |
|
784 | + $data['altitude'] = round((int) $line['pktAltitude']*3.28084); |
|
785 | 785 | $data['altitude_relative'] = 'AMSL'; |
786 | - $data['pilot_id'] = (int)$line['pktPilotID']; |
|
786 | + $data['pilot_id'] = (int) $line['pktPilotID']; |
|
787 | 787 | $data['aircraft_icao'] = 'PARAGLIDER'; |
788 | - $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
788 | + $pilot_data = explode(',', $Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
|
789 | 789 | if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
790 | 790 | $data['format_source'] = $value['format']; |
791 | 791 | $SI->add($data); |
@@ -793,22 +793,22 @@ discard block |
||
793 | 793 | } |
794 | 794 | } |
795 | 795 | $Source->deleteOldLocationByType('gs'); |
796 | - $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php','get','','','','','20'); |
|
796 | + $buffer = $Common->getData('http://www.airwhere.co.uk/gspositions.php', 'get', '', '', '', '', '20'); |
|
797 | 797 | if ($buffer != '') { |
798 | 798 | $all_data = simplexml_load_string($buffer); |
799 | - foreach($all_data->children() as $childdata) { |
|
799 | + foreach ($all_data->children() as $childdata) { |
|
800 | 800 | $data = array(); |
801 | 801 | $line = $childdata; |
802 | - $data['id'] = (int)$line['gsID']; |
|
803 | - $data['latitude'] = (float)$line['gsLatitude']; |
|
804 | - $data['longitude'] = (float)$line['gsLongitude']; |
|
805 | - $data['altitude'] = round((int)$line['gsHeight']*3.28084); |
|
802 | + $data['id'] = (int) $line['gsID']; |
|
803 | + $data['latitude'] = (float) $line['gsLatitude']; |
|
804 | + $data['longitude'] = (float) $line['gsLongitude']; |
|
805 | + $data['altitude'] = round((int) $line['gsHeight']*3.28084); |
|
806 | 806 | $data['altitude_relative'] = 'AMSL'; |
807 | - $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['gsLastUpdate'].' BST')); |
|
807 | + $data['datetime'] = date('Y-m-d H:i:s', strtotime((string) $line['gsLastUpdate'].' BST')); |
|
808 | 808 | if (count($Source->getLocationInfoByLocationID($data['id'])) > 0) { |
809 | - $Source->updateLocationByLocationID('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
809 | + $Source->updateLocationByLocationID('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
810 | 810 | } else { |
811 | - $Source->addLocation('',$data['latitude'],$data['longitude'],$data['altitude'],'','','airwhere','antenna.png','gs',$id,$data['id'],$data['datetime']); |
|
811 | + $Source->addLocation('', $data['latitude'], $data['longitude'], $data['altitude'], '', '', 'airwhere', 'antenna.png', 'gs', $id, $data['id'], $data['datetime']); |
|
812 | 812 | } |
813 | 813 | unset($data); |
814 | 814 | } |
@@ -826,9 +826,9 @@ discard block |
||
826 | 826 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch)) |
827 | 827 | ) |
828 | 828 | ) { |
829 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
829 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
830 | 830 | if ($buffer != '') { |
831 | - $all_data = json_decode($buffer,true); |
|
831 | + $all_data = json_decode($buffer, true); |
|
832 | 832 | if (isset($all_data['acList'])) { |
833 | 833 | $reset = 0; |
834 | 834 | foreach ($all_data['acList'] as $line) { |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
845 | 845 | $data['emergency'] = ''; // emergency |
846 | 846 | if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
847 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
847 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
848 | 848 | else $data['datetime'] = date('Y-m-d H:i:s'); |
849 | 849 | //$data['datetime'] = date('Y-m-d H:i:s'); |
850 | 850 | if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | $data['verticalrate'] = $line['vrt']; // verticale rate |
870 | 870 | $data['squawk'] = $line['squawk']; // squawk |
871 | 871 | $data['emergency'] = ''; // emergency |
872 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
872 | + if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s', round($line['PosTime']/1000)); |
|
873 | 873 | else $data['datetime'] = date('Y-m-d H:i:s'); |
874 | 874 | $data['format_source'] = 'aircraftlistjson'; |
875 | 875 | $data['id_source'] = $id_source; |
@@ -890,7 +890,7 @@ discard block |
||
890 | 890 | ) |
891 | 891 | ) { |
892 | 892 | $buffer = $Common->getData($value['host']); |
893 | - $all_data = json_decode($buffer,true); |
|
893 | + $all_data = json_decode($buffer, true); |
|
894 | 894 | if (isset($all_data['planes'])) { |
895 | 895 | $reset = 0; |
896 | 896 | foreach ($all_data['planes'] as $key => $line) { |
@@ -907,12 +907,12 @@ discard block |
||
907 | 907 | $data['emergency'] = ''; // emergency |
908 | 908 | $data['registration'] = $line[2]; |
909 | 909 | $data['aircraft_icao'] = $line[0]; |
910 | - $deparr = explode('-',$line[1]); |
|
910 | + $deparr = explode('-', $line[1]); |
|
911 | 911 | if (count($deparr) == 2) { |
912 | 912 | $data['departure_airport_icao'] = $deparr[0]; |
913 | 913 | $data['arrival_airport_icao'] = $deparr[1]; |
914 | 914 | } |
915 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
915 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
916 | 916 | $data['format_source'] = 'planeupdatefaa'; |
917 | 917 | $data['id_source'] = $id_source; |
918 | 918 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | ) |
931 | 931 | ) { |
932 | 932 | $buffer = $Common->getData($value['host']); |
933 | - $all_data = json_decode($buffer,true); |
|
933 | + $all_data = json_decode($buffer, true); |
|
934 | 934 | if (isset($all_data['states'])) { |
935 | 935 | $reset = 0; |
936 | 936 | foreach ($all_data['states'] as $key => $line) { |
@@ -947,7 +947,7 @@ discard block |
||
947 | 947 | //$data['emergency'] = ''; // emergency |
948 | 948 | //$data['registration'] = $line[2]; |
949 | 949 | //$data['aircraft_icao'] = $line[0]; |
950 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
950 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
951 | 951 | $data['format_source'] = 'opensky'; |
952 | 952 | $data['id_source'] = $id_source; |
953 | 953 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -966,7 +966,7 @@ discard block |
||
966 | 966 | ) { |
967 | 967 | //$buffer = $Common->getData($hosts[$id]); |
968 | 968 | $buffer = $Common->getData($value['host']); |
969 | - $all_data = json_decode($buffer,true); |
|
969 | + $all_data = json_decode($buffer, true); |
|
970 | 970 | if (!empty($all_data)) $reset = 0; |
971 | 971 | foreach ($all_data as $key => $line) { |
972 | 972 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
@@ -1004,11 +1004,11 @@ discard block |
||
1004 | 1004 | ) |
1005 | 1005 | ) { |
1006 | 1006 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
1007 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
1007 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
1008 | 1008 | //echo $buffer; |
1009 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
1010 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
1011 | - $all_data = json_decode($buffer,true); |
|
1009 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
1010 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
1011 | + $all_data = json_decode($buffer, true); |
|
1012 | 1012 | if (json_last_error() != JSON_ERROR_NONE) { |
1013 | 1013 | die(json_last_error_msg()); |
1014 | 1014 | } |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | //$data['departure_airport_iata'] = $line[11]; |
1032 | 1032 | //$data['arrival_airport_iata'] = $line[12]; |
1033 | 1033 | //$data['emergency'] = ''; // emergency |
1034 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
1034 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
1035 | 1035 | $data['format_source'] = 'radarvirtueljson'; |
1036 | 1036 | $data['id_source'] = $id_source; |
1037 | 1037 | if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
@@ -1052,14 +1052,14 @@ discard block |
||
1052 | 1052 | ) { |
1053 | 1053 | //$buffer = $Common->getData($hosts[$id]); |
1054 | 1054 | $buffer = $Common->getData($value['host'].'?'.time()); |
1055 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
1055 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
1056 | 1056 | |
1057 | 1057 | if (isset($all_data['pireps'])) { |
1058 | 1058 | $reset = 0; |
1059 | 1059 | foreach ($all_data['pireps'] as $line) { |
1060 | 1060 | $data = array(); |
1061 | 1061 | $data['id'] = $line['id']; |
1062 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
1062 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1063 | 1063 | $data['ident'] = $line['callsign']; // ident |
1064 | 1064 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
1065 | 1065 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -1089,9 +1089,9 @@ discard block |
||
1089 | 1089 | $SI->add($data); |
1090 | 1090 | // print_r($data); |
1091 | 1091 | } elseif ($line['icon'] == 'ct') { |
1092 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
1093 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
1094 | - $typec = substr($data['ident'],-3); |
|
1092 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
1093 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
1094 | + $typec = substr($data['ident'], -3); |
|
1095 | 1095 | $data['type'] = ''; |
1096 | 1096 | if ($typec == 'APP') $data['type'] = 'Approach'; |
1097 | 1097 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
@@ -1102,7 +1102,7 @@ discard block |
||
1102 | 1102 | elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
1103 | 1103 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
1104 | 1104 | else $data['type'] = 'Observer'; |
1105 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
1105 | + if (isset($ATC)) echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']); |
|
1106 | 1106 | } |
1107 | 1107 | unset($data); |
1108 | 1108 | } |
@@ -1119,14 +1119,14 @@ discard block |
||
1119 | 1119 | //$buffer = $Common->getData($hosts[$id]); |
1120 | 1120 | if ($globalDebug) echo 'Get Data...'."\n"; |
1121 | 1121 | $buffer = $Common->getData($value['host']); |
1122 | - $all_data = json_decode($buffer,true); |
|
1122 | + $all_data = json_decode($buffer, true); |
|
1123 | 1123 | if ($buffer != '' && is_array($all_data)) { |
1124 | 1124 | $reset = 0; |
1125 | 1125 | foreach ($all_data as $line) { |
1126 | 1126 | $data = array(); |
1127 | 1127 | //$data['id'] = $line['id']; // id not usable |
1128 | 1128 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
1129 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1129 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1130 | 1130 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
1131 | 1131 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
1132 | 1132 | $data['ident'] = $line['flightnum']; // ident |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | //$data['datetime'] = $line['lastupdate']; |
1142 | 1142 | //$data['last_update'] = $line['lastupdate']; |
1143 | 1143 | if (isset($value['timezone'])) { |
1144 | - $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
|
1144 | + $datetime = new DateTime($line['lastupdate'], new DateTimeZone($value['timezone'])); |
|
1145 | 1145 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
1146 | 1146 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
1147 | 1147 | } else $data['datetime'] = date('Y-m-d H:i:s'); |
@@ -1154,14 +1154,14 @@ discard block |
||
1154 | 1154 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
1155 | 1155 | if (isset($line['aircraftname'])) { |
1156 | 1156 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
1157 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
1158 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
1157 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
1158 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
1159 | 1159 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
1160 | 1160 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
1161 | 1161 | else { |
1162 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
1163 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
1164 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
1162 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
1163 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); |
|
1164 | + else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); |
|
1165 | 1165 | } |
1166 | 1166 | } |
1167 | 1167 | if (isset($line['route'])) $data['waypoints'] = $line['route']; |
@@ -1186,14 +1186,14 @@ discard block |
||
1186 | 1186 | //$buffer = $Common->getData($hosts[$id]); |
1187 | 1187 | if ($globalDebug) echo 'Get Data...'."\n"; |
1188 | 1188 | $buffer = $Common->getData($value['host']); |
1189 | - $all_data = json_decode($buffer,true); |
|
1189 | + $all_data = json_decode($buffer, true); |
|
1190 | 1190 | if ($buffer != '' && is_array($all_data)) { |
1191 | 1191 | $reset = 0; |
1192 | 1192 | foreach ($all_data as $line) { |
1193 | 1193 | $data = array(); |
1194 | 1194 | //$data['id'] = $line['id']; // id not usable |
1195 | 1195 | $data['id'] = trim($line['flight_id']); |
1196 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
1196 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
1197 | 1197 | $data['pilot_name'] = $line['pilot_name']; |
1198 | 1198 | $data['pilot_id'] = $line['pilot_id']; |
1199 | 1199 | $data['ident'] = trim($line['callsign']); // ident |
@@ -1237,24 +1237,24 @@ discard block |
||
1237 | 1237 | //$buffer = $Common->getData($hosts[$id]); |
1238 | 1238 | if ($globalDebug) echo 'Get Data...'."\n"; |
1239 | 1239 | $buffer = $Common->getData($value['host']); |
1240 | - $all_data = json_decode($buffer,true); |
|
1240 | + $all_data = json_decode($buffer, true); |
|
1241 | 1241 | if ($buffer != '') { |
1242 | 1242 | $Source->deleteLocationBySource('blitzortung'); |
1243 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
1244 | - $buffer = explode('\n',$buffer); |
|
1243 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
1244 | + $buffer = explode('\n', $buffer); |
|
1245 | 1245 | foreach ($buffer as $buffer_line) { |
1246 | - $line = json_decode($buffer_line,true); |
|
1246 | + $line = json_decode($buffer_line, true); |
|
1247 | 1247 | if (isset($line['time'])) { |
1248 | 1248 | $data = array(); |
1249 | 1249 | $data['altitude'] = $line['alt']; // altitude |
1250 | 1250 | $data['latitude'] = $line['lat']; // lat |
1251 | 1251 | $data['longitude'] = $line['lon']; // long |
1252 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line['time'],0,10)); |
|
1252 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line['time'], 0, 10)); |
|
1253 | 1253 | $data['id_source'] = $id_source; |
1254 | 1254 | $data['format_source'] = 'blitzortung'; |
1255 | 1255 | $SI->add($data); |
1256 | 1256 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
1257 | - $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
|
1257 | + $Source->addLocation('', $data['latitude'], $data['longitude'], 0, '', '', 'blitzortung', 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime']); |
|
1258 | 1258 | unset($data); |
1259 | 1259 | } |
1260 | 1260 | } |
@@ -1279,11 +1279,11 @@ discard block |
||
1279 | 1279 | //$value = $formats[$nb]; |
1280 | 1280 | $format = $globalSources[$nb]['format']; |
1281 | 1281 | if ($format == 'sbs' || $format == 'aprs' || $format == 'famaprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
1282 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
|
1282 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); |
|
1283 | 1283 | } elseif ($format == 'vrstcp') { |
1284 | 1284 | $buffer = @socket_read($r, 6000); |
1285 | 1285 | } else { |
1286 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
1286 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
1287 | 1287 | } |
1288 | 1288 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
1289 | 1289 | //echo $buffer."\n"; |
@@ -1292,8 +1292,8 @@ discard block |
||
1292 | 1292 | $error = false; |
1293 | 1293 | //$SI::del(); |
1294 | 1294 | if ($format == 'vrstcp') { |
1295 | - $buffer = explode('},{',$buffer); |
|
1296 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1295 | + $buffer = explode('},{', $buffer); |
|
1296 | + } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
1297 | 1297 | // SBS format is CSV format |
1298 | 1298 | if ($buffer !== FALSE && $buffer != '') { |
1299 | 1299 | $tt[$format] = 0; |
@@ -1327,13 +1327,13 @@ discard block |
||
1327 | 1327 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
1328 | 1328 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
1329 | 1329 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
1330 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1330 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
1331 | 1331 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1332 | 1332 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
1333 | 1333 | if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
1334 | 1334 | |
1335 | 1335 | if (isset($ais_data['timestamp'])) { |
1336 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
1336 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
1337 | 1337 | } else { |
1338 | 1338 | $data['datetime'] = date('Y-m-d H:i:s'); |
1339 | 1339 | } |
@@ -1344,10 +1344,10 @@ discard block |
||
1344 | 1344 | } elseif ($format == 'flightgearsp') { |
1345 | 1345 | //echo $buffer."\n"; |
1346 | 1346 | if (strlen($buffer) > 5) { |
1347 | - $line = explode(',',$buffer); |
|
1347 | + $line = explode(',', $buffer); |
|
1348 | 1348 | $data = array(); |
1349 | 1349 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
1350 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
1350 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1351 | 1351 | $data['ident'] = $line[6]; |
1352 | 1352 | $data['aircraft_name'] = $line[7]; |
1353 | 1353 | $data['longitude'] = $line[1]; |
@@ -1364,16 +1364,16 @@ discard block |
||
1364 | 1364 | } elseif ($format == 'acars') { |
1365 | 1365 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
1366 | 1366 | $ACARS->add(trim($buffer)); |
1367 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1367 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
1368 | 1368 | $ACARS->deleteLiveAcarsData(); |
1369 | 1369 | } elseif ($format == 'flightgearmp') { |
1370 | - if (substr($buffer,0,1) != '#') { |
|
1370 | + if (substr($buffer, 0, 1) != '#') { |
|
1371 | 1371 | $data = array(); |
1372 | 1372 | //echo $buffer."\n"; |
1373 | - $line = explode(' ',$buffer); |
|
1373 | + $line = explode(' ', $buffer); |
|
1374 | 1374 | if (count($line) == 11) { |
1375 | - $userserver = explode('@',$line[0]); |
|
1376 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
1375 | + $userserver = explode('@', $line[0]); |
|
1376 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
1377 | 1377 | $data['ident'] = $userserver[0]; |
1378 | 1378 | $data['registration'] = $userserver[0]; |
1379 | 1379 | $data['latitude'] = $line[4]; |
@@ -1381,8 +1381,8 @@ discard block |
||
1381 | 1381 | $data['altitude'] = $line[6]; |
1382 | 1382 | $data['datetime'] = date('Y-m-d H:i:s'); |
1383 | 1383 | $aircraft_type = $line[10]; |
1384 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
1385 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
1384 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
1385 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
1386 | 1386 | if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
1387 | 1387 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1388 | 1388 | } |
@@ -1391,8 +1391,8 @@ discard block |
||
1391 | 1391 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
1392 | 1392 | die; |
1393 | 1393 | } elseif ($format == 'vrstcp') { |
1394 | - foreach($buffer as $all_data) { |
|
1395 | - $line = json_decode('{'.$all_data.'}',true); |
|
1394 | + foreach ($buffer as $all_data) { |
|
1395 | + $line = json_decode('{'.$all_data.'}', true); |
|
1396 | 1396 | $data = array(); |
1397 | 1397 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
1398 | 1398 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -1418,16 +1418,16 @@ discard block |
||
1418 | 1418 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
1419 | 1419 | unset($data); |
1420 | 1420 | } |
1421 | - } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
|
1421 | + } elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') { |
|
1422 | 1422 | $line = explode("\t", $buffer); |
1423 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
1423 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
1424 | 1424 | $key = $line[$k]; |
1425 | - $lined[$key] = $line[$k+1]; |
|
1425 | + $lined[$key] = $line[$k + 1]; |
|
1426 | 1426 | } |
1427 | 1427 | if (count($lined) > 3) { |
1428 | 1428 | $data['hex'] = $lined['hexid']; |
1429 | 1429 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
1430 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
1430 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
1431 | 1431 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
1432 | 1432 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
1433 | 1433 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -1446,22 +1446,22 @@ discard block |
||
1446 | 1446 | } else $error = true; |
1447 | 1447 | } elseif ($format == 'aprs' && $use_aprs) { |
1448 | 1448 | if ($aprs_connect == 0) { |
1449 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
1449 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
1450 | 1450 | $aprs_connect = 1; |
1451 | 1451 | } |
1452 | 1452 | |
1453 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
1453 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
1454 | 1454 | $aprs_last_tx = time(); |
1455 | 1455 | $data_aprs = "# Keep alive"; |
1456 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
1456 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
1457 | 1457 | } |
1458 | 1458 | |
1459 | 1459 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
1460 | 1460 | //echo 'APRS data : '.$buffer."\n"; |
1461 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
1462 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
1461 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
1462 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
1463 | 1463 | //echo $buffer."\n"; |
1464 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
1464 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
1465 | 1465 | $line = $APRS->parse($buffer); |
1466 | 1466 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
1467 | 1467 | if (is_array($line) && isset($line['latitude']) && isset($line['longitude']) && (isset($line['ident']) || isset($line['address']) || isset($line['mmsi']))) { |
@@ -1476,7 +1476,7 @@ discard block |
||
1476 | 1476 | if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; |
1477 | 1477 | if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; |
1478 | 1478 | if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; |
1479 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1479 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
1480 | 1480 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1481 | 1481 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1482 | 1482 | if (isset($line['ident'])) $data['ident'] = $line['ident']; |
@@ -1555,29 +1555,29 @@ discard block |
||
1555 | 1555 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
1556 | 1556 | if (!isset($data['altitude'])) $data['altitude'] = 0; |
1557 | 1557 | $Source->deleteOldLocationByType('gs'); |
1558 | - if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
|
1559 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
1558 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'gs')) > 0) { |
|
1559 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
1560 | 1560 | } else { |
1561 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
|
1561 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], $data['altitude'], '', '', $data['source_name'], 'antenna.png', 'gs', $id, 0, $data['datetime']); |
|
1562 | 1562 | } |
1563 | 1563 | } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
1564 | 1564 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
1565 | 1565 | if ($globalDebug) echo '# Weather Station added'."\n"; |
1566 | 1566 | $Source->deleteOldLocationByType('wx'); |
1567 | 1567 | $weather_data = json_encode($line); |
1568 | - if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
|
1569 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
1568 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'wx')) > 0) { |
|
1569 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
1570 | 1570 | } else { |
1571 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'wx.png','wx',$id,0,$data['datetime'],$weather_data); |
|
1571 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'wx.png', 'wx', $id, 0, $data['datetime'], $weather_data); |
|
1572 | 1572 | } |
1573 | 1573 | } elseif (isset($line['symbol']) && $line['symbol'] == 'Lightning') { |
1574 | 1574 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
1575 | 1575 | if ($globalDebug) echo '☈ Lightning added'."\n"; |
1576 | 1576 | $Source->deleteOldLocationByType('lightning'); |
1577 | - if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
|
1578 | - $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
1577 | + if (count($Source->getLocationInfoByNameType($data['ident'], 'lightning')) > 0) { |
|
1578 | + $Source->updateLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
1579 | 1579 | } else { |
1580 | - $Source->addLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
|
1580 | + $Source->addLocation($data['ident'], $data['latitude'], $data['longitude'], 0, '', '', $data['source_name'], 'weather/thunderstorm.png', 'lightning', $id, 0, $data['datetime'], $data['comment']); |
|
1581 | 1581 | } |
1582 | 1582 | } elseif ($globalDebug) { |
1583 | 1583 | echo '/!\ Not added: '.$buffer."\n"; |
@@ -1586,7 +1586,7 @@ discard block |
||
1586 | 1586 | unset($data); |
1587 | 1587 | } |
1588 | 1588 | elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
1589 | - $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
|
1589 | + $Source->updateLocationDescByName($line['ident'], $line['source'], $id, $line['comment']); |
|
1590 | 1590 | } |
1591 | 1591 | /* |
1592 | 1592 | elseif (is_array($line) && $globalDebug && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ($line['symbol'] == 'Car' || $line['symbol'] == 'Ambulance' || $line['symbol'] == 'Van' || $line['symbol'] == 'Truck' || $line['symbol'] == 'Truck (18 Wheeler)' || $line['symbol'] == 'Motorcycle')) { |
@@ -1595,7 +1595,7 @@ discard block |
||
1595 | 1595 | */ |
1596 | 1596 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
1597 | 1597 | elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
1598 | - if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
1598 | + if (isset($globalSources[$nb]['last_weather_clean']) && time() - $globalSources[$nb]['last_weather_clean'] > 60*5) { |
|
1599 | 1599 | $Source->deleteOldLocationByType('lightning'); |
1600 | 1600 | $Source->deleteOldLocationByType('wx'); |
1601 | 1601 | $globalSources[$nb]['last_weather_clean'] = time(); |
@@ -1680,7 +1680,7 @@ discard block |
||
1680 | 1680 | connect_all($sourceee); |
1681 | 1681 | $sourceee = array(); |
1682 | 1682 | //connect_all($globalSources); |
1683 | - $tt[$format]=0; |
|
1683 | + $tt[$format] = 0; |
|
1684 | 1684 | break; |
1685 | 1685 | } |
1686 | 1686 | } |
@@ -1689,14 +1689,14 @@ discard block |
||
1689 | 1689 | } else { |
1690 | 1690 | $error = socket_strerror(socket_last_error()); |
1691 | 1691 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
1692 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
1692 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
1693 | 1693 | if (isset($globalDebug)) echo "Restarting...\n"; |
1694 | 1694 | // Restart the script if possible |
1695 | 1695 | if (is_array($sockets)) { |
1696 | 1696 | if ($globalDebug) echo "Shutdown all sockets..."; |
1697 | 1697 | |
1698 | 1698 | foreach ($sockets as $sock) { |
1699 | - @socket_shutdown($sock,2); |
|
1699 | + @socket_shutdown($sock, 2); |
|
1700 | 1700 | @socket_close($sock); |
1701 | 1701 | } |
1702 | 1702 |