@@ -8,32 +8,32 @@ |
||
8 | 8 | */ |
9 | 9 | class Predict_SGSDPStatic |
10 | 10 | { |
11 | - public $aodp; |
|
12 | - public $aycof; |
|
13 | - public $c1; |
|
14 | - public $c4; |
|
15 | - public $c5; |
|
16 | - public $cosio; |
|
17 | - public $d2; |
|
18 | - public $d3; |
|
19 | - public $d4; |
|
20 | - public $delmo; |
|
21 | - public $omgcof; |
|
22 | - public $eta; |
|
23 | - public $omgdot; |
|
24 | - public $sinio; |
|
25 | - public $xnodp; |
|
26 | - public $sinmo; |
|
27 | - public $t2cof; |
|
28 | - public $t3cof; |
|
29 | - public $t4cof; |
|
30 | - public $t5cof; |
|
31 | - public $x1mth2; |
|
32 | - public $x3thm1; |
|
33 | - public $x7thm1; |
|
34 | - public $xmcof; |
|
35 | - public $xmdot; |
|
36 | - public $xnodcf; |
|
37 | - public $xnodot; |
|
38 | - public $xlcof; |
|
11 | + public $aodp; |
|
12 | + public $aycof; |
|
13 | + public $c1; |
|
14 | + public $c4; |
|
15 | + public $c5; |
|
16 | + public $cosio; |
|
17 | + public $d2; |
|
18 | + public $d3; |
|
19 | + public $d4; |
|
20 | + public $delmo; |
|
21 | + public $omgcof; |
|
22 | + public $eta; |
|
23 | + public $omgdot; |
|
24 | + public $sinio; |
|
25 | + public $xnodp; |
|
26 | + public $sinmo; |
|
27 | + public $t2cof; |
|
28 | + public $t3cof; |
|
29 | + public $t4cof; |
|
30 | + public $t5cof; |
|
31 | + public $x1mth2; |
|
32 | + public $x3thm1; |
|
33 | + public $x7thm1; |
|
34 | + public $xmcof; |
|
35 | + public $xmdot; |
|
36 | + public $xnodcf; |
|
37 | + public $xnodot; |
|
38 | + public $xlcof; |
|
39 | 39 | } |
@@ -7,14 +7,14 @@ |
||
7 | 7 | */ |
8 | 8 | class Predict_QTH |
9 | 9 | { |
10 | - public $name; /*!< Name, eg. callsign. */ |
|
11 | - public $loc; /*!< Location, eg City, Country. */ |
|
12 | - public $desc; /*!< Short description. */ |
|
13 | - public $lat; /*!< Latitude in dec. deg. North. */ |
|
14 | - public $lon; /*!< Longitude in dec. deg. East. */ |
|
15 | - public $alt; /*!< Altitude above sea level in meters. */ |
|
16 | - public $qra; /*!< QRA locator */ |
|
17 | - public $wx; /*!< Weather station code (4 chars). */ |
|
10 | + public $name; /*!< Name, eg. callsign. */ |
|
11 | + public $loc; /*!< Location, eg City, Country. */ |
|
12 | + public $desc; /*!< Short description. */ |
|
13 | + public $lat; /*!< Latitude in dec. deg. North. */ |
|
14 | + public $lon; /*!< Longitude in dec. deg. East. */ |
|
15 | + public $alt; /*!< Altitude above sea level in meters. */ |
|
16 | + public $qra; /*!< QRA locator */ |
|
17 | + public $wx; /*!< Weather station code (4 chars). */ |
|
18 | 18 | |
19 | - public $data; /*!< Raw data from cfg file. */ |
|
19 | + public $data; /*!< Raw data from cfg file. */ |
|
20 | 20 | } |
@@ -7,14 +7,14 @@ |
||
7 | 7 | */ |
8 | 8 | class Predict_QTH |
9 | 9 | { |
10 | - public $name; /*!< Name, eg. callsign. */ |
|
11 | - public $loc; /*!< Location, eg City, Country. */ |
|
12 | - public $desc; /*!< Short description. */ |
|
13 | - public $lat; /*!< Latitude in dec. deg. North. */ |
|
14 | - public $lon; /*!< Longitude in dec. deg. East. */ |
|
15 | - public $alt; /*!< Altitude above sea level in meters. */ |
|
16 | - public $qra; /*!< QRA locator */ |
|
17 | - public $wx; /*!< Weather station code (4 chars). */ |
|
10 | + public $name; /*!< Name, eg. callsign. */ |
|
11 | + public $loc; /*!< Location, eg City, Country. */ |
|
12 | + public $desc; /*!< Short description. */ |
|
13 | + public $lat; /*!< Latitude in dec. deg. North. */ |
|
14 | + public $lon; /*!< Longitude in dec. deg. East. */ |
|
15 | + public $alt; /*!< Altitude above sea level in meters. */ |
|
16 | + public $qra; /*!< QRA locator */ |
|
17 | + public $wx; /*!< Weather station code (4 chars). */ |
|
18 | 18 | |
19 | - public $data; /*!< Raw data from cfg file. */ |
|
19 | + public $data; /*!< Raw data from cfg file. */ |
|
20 | 20 | } |
@@ -6,8 +6,8 @@ |
||
6 | 6 | */ |
7 | 7 | class Predict_Vector |
8 | 8 | { |
9 | - public $x = 0; |
|
10 | - public $y = 0; |
|
11 | - public $z = 0; |
|
12 | - public $w = 0; |
|
9 | + public $x = 0; |
|
10 | + public $y = 0; |
|
11 | + public $z = 0; |
|
12 | + public $w = 0; |
|
13 | 13 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | try { |
20 | 20 | $sth = $this->db->prepare($query); |
21 | 21 | $sth->execute(array(':name' => $name)); |
22 | - } catch(PDOException $e) { |
|
22 | + } catch (PDOException $e) { |
|
23 | 23 | echo $e->getMessage(); |
24 | 24 | } |
25 | 25 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | try { |
32 | 32 | $sth = $this->db->prepare($query); |
33 | 33 | $sth->execute(); |
34 | - } catch(PDOException $e) { |
|
34 | + } catch (PDOException $e) { |
|
35 | 35 | echo $e->getMessage(); |
36 | 36 | } |
37 | 37 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | try { |
44 | 44 | $sth = $this->db->prepare($query); |
45 | 45 | $sth->execute(); |
46 | - } catch(PDOException $e) { |
|
46 | + } catch (PDOException $e) { |
|
47 | 47 | echo $e->getMessage(); |
48 | 48 | } |
49 | 49 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | try { |
56 | 56 | $sth = $this->db->prepare($query); |
57 | 57 | $sth->execute(array(':type' => $type)); |
58 | - } catch(PDOException $e) { |
|
58 | + } catch (PDOException $e) { |
|
59 | 59 | echo $e->getMessage(); |
60 | 60 | } |
61 | 61 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -63,27 +63,27 @@ discard block |
||
63 | 63 | else return array(); |
64 | 64 | } |
65 | 65 | |
66 | - public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
66 | + public function position_all($timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
67 | 67 | $all_sat = $this->get_tle_names(); |
68 | 68 | $result = array(); |
69 | 69 | foreach ($all_sat as $sat) { |
70 | - $position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second); |
|
71 | - $result = array_merge($position,$result); |
|
70 | + $position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second); |
|
71 | + $result = array_merge($position, $result); |
|
72 | 72 | } |
73 | 73 | return $result; |
74 | 74 | } |
75 | 75 | |
76 | - public function position_all_type($type,$timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
76 | + public function position_all_type($type, $timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
77 | 77 | $all_sat = $this->get_tle_names_type($type); |
78 | 78 | $result = array(); |
79 | 79 | foreach ($all_sat as $sat) { |
80 | - $position = $this->position($sat['tle_name'],$timestamp_begin,$timestamp_end,$second); |
|
81 | - $result = array_merge($position,$result); |
|
80 | + $position = $this->position($sat['tle_name'], $timestamp_begin, $timestamp_end, $second); |
|
81 | + $result = array_merge($position, $result); |
|
82 | 82 | } |
83 | 83 | return $result; |
84 | 84 | } |
85 | 85 | |
86 | - public function position($name,$timestamp_begin = '',$timestamp_end = '',$second = 10) { |
|
86 | + public function position($name, $timestamp_begin = '', $timestamp_end = '', $second = 10) { |
|
87 | 87 | $qth = new Predict_QTH(); |
88 | 88 | $qth->lat = 37.790252; |
89 | 89 | $qth->lon = -122.419968; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $tle_file = $this->get_tle($name); |
92 | 92 | //print_r($tle_file); |
93 | 93 | $type = $tle_file['tle_type']; |
94 | - $tle = new Predict_TLE($tle_file['tle_name'],$tle_file['tle_tle1'],$tle_file['tle_tle2']); |
|
94 | + $tle = new Predict_TLE($tle_file['tle_name'], $tle_file['tle_tle1'], $tle_file['tle_tle2']); |
|
95 | 95 | $sat = new Predict_Sat($tle); |
96 | 96 | $predict = new Predict(); |
97 | 97 | //if ($timestamp == '') $now = Predict_Time::get_current_daynum(); |
@@ -99,15 +99,15 @@ discard block |
||
99 | 99 | if ($timestamp_end == '') { |
100 | 100 | $now = Predict_Time::unix2daynum($timestamp_begin); |
101 | 101 | //echo $now; |
102 | - $predict->predict_calc($sat,$qth,$now); |
|
103 | - return array('name' => $name, 'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp_begin,'type' => $type); |
|
102 | + $predict->predict_calc($sat, $qth, $now); |
|
103 | + return array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp_begin, 'type' => $type); |
|
104 | 104 | } else { |
105 | - for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp=$timestamp+$second) { |
|
105 | + for ($timestamp = $timestamp_begin; $timestamp <= $timestamp_end; $timestamp = $timestamp + $second) { |
|
106 | 106 | //echo $timestamp."\n"; |
107 | 107 | $now = Predict_Time::unix2daynum($timestamp); |
108 | 108 | //echo $now; |
109 | - $predict->predict_calc($sat,$qth,$now); |
|
110 | - $result[] = array('name' => $name,'latitude' => $sat->ssplat,'longitude' => $sat->ssplon, 'altitude' => $sat->alt,'speed' => $sat->velo*60*60,'timestamp' => $timestamp,'type' => $type); |
|
109 | + $predict->predict_calc($sat, $qth, $now); |
|
110 | + $result[] = array('name' => $name, 'latitude' => $sat->ssplat, 'longitude' => $sat->ssplon, 'altitude' => $sat->alt, 'speed' => $sat->velo*60*60, 'timestamp' => $timestamp, 'type' => $type); |
|
111 | 111 | } |
112 | 112 | return $result; |
113 | 113 | } |
@@ -23,8 +23,11 @@ discard block |
||
23 | 23 | echo $e->getMessage(); |
24 | 24 | } |
25 | 25 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
26 | - if (isset($result[0])) return $result[0]; |
|
27 | - else return array(); |
|
26 | + if (isset($result[0])) { |
|
27 | + return $result[0]; |
|
28 | + } else { |
|
29 | + return array(); |
|
30 | + } |
|
28 | 31 | } |
29 | 32 | public function get_tle_types() { |
30 | 33 | $query = 'SELECT DISTINCT tle_type FROM tle ORDER BY tle_type'; |
@@ -35,8 +38,11 @@ discard block |
||
35 | 38 | echo $e->getMessage(); |
36 | 39 | } |
37 | 40 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
38 | - if (isset($result[0])) return $result; |
|
39 | - else return array(); |
|
41 | + if (isset($result[0])) { |
|
42 | + return $result; |
|
43 | + } else { |
|
44 | + return array(); |
|
45 | + } |
|
40 | 46 | } |
41 | 47 | public function get_tle_names() { |
42 | 48 | $query = 'SELECT DISTINCT tle_name, tle_type FROM tle'; |
@@ -47,8 +53,11 @@ discard block |
||
47 | 53 | echo $e->getMessage(); |
48 | 54 | } |
49 | 55 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
50 | - if (isset($result[0])) return $result; |
|
51 | - else return array(); |
|
56 | + if (isset($result[0])) { |
|
57 | + return $result; |
|
58 | + } else { |
|
59 | + return array(); |
|
60 | + } |
|
52 | 61 | } |
53 | 62 | public function get_tle_names_type($type) { |
54 | 63 | $query = 'SELECT tle_name, tle_type FROM tle WHERE tle_type = :type ORDER BY tle_name'; |
@@ -59,8 +68,11 @@ discard block |
||
59 | 68 | echo $e->getMessage(); |
60 | 69 | } |
61 | 70 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
62 | - if (isset($result[0])) return $result; |
|
63 | - else return array(); |
|
71 | + if (isset($result[0])) { |
|
72 | + return $result; |
|
73 | + } else { |
|
74 | + return array(); |
|
75 | + } |
|
64 | 76 | } |
65 | 77 | |
66 | 78 | public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) { |
@@ -95,7 +107,9 @@ discard block |
||
95 | 107 | $sat = new Predict_Sat($tle); |
96 | 108 | $predict = new Predict(); |
97 | 109 | //if ($timestamp == '') $now = Predict_Time::get_current_daynum(); |
98 | - if ($timestamp_begin == '') $timestamp_begin = time(); |
|
110 | + if ($timestamp_begin == '') { |
|
111 | + $timestamp_begin = time(); |
|
112 | + } |
|
99 | 113 | if ($timestamp_end == '') { |
100 | 114 | $now = Predict_Time::unix2daynum($timestamp_begin); |
101 | 115 | //echo $now; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | <button type="button" class="close">×</button> |
8 | 8 | <?php |
9 | 9 | |
10 | -$sat = filter_input(INPUT_GET,'sat',FILTER_SANITIZE_STRING); |
|
10 | +$sat = filter_input(INPUT_GET, 'sat', FILTER_SANITIZE_STRING); |
|
11 | 11 | $sat = urldecode($sat); |
12 | 12 | |
13 | 13 | if ($sat == 'ISS (ZARYA)') { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $aircraft_name = 'INTEGRAL'; |
43 | 43 | // $ground_speed = 14970; |
44 | 44 | $launch_date = '17 October 2002'; |
45 | -} elseif (strpos($sat,'IRIDIUM') !== false) { |
|
45 | +} elseif (strpos($sat, 'IRIDIUM') !== false) { |
|
46 | 46 | $image = 'https://upload.wikimedia.org/wikipedia/commons/b/b6/Iridium_Satellite.jpg'; |
47 | 47 | $image_copyright = 'Cliff'; |
48 | 48 | $ident = 'Iridium satellite constellation'; |
@@ -50,15 +50,15 @@ discard block |
||
50 | 50 | $aircraft_name = $sat; |
51 | 51 | // $ground_speed = 14970; |
52 | 52 | // $launch_date = '29 september 2011'; |
53 | -} elseif (strpos($sat,'ORBCOMM') !== false) { |
|
53 | +} elseif (strpos($sat, 'ORBCOMM') !== false) { |
|
54 | 54 | $ident = 'Orbcomm'; |
55 | 55 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/Orbcomm_(satellite)'; |
56 | 56 | $aircraft_name = $sat; |
57 | -} elseif (strpos($sat,'GLOBALSTAR') !== false) { |
|
57 | +} elseif (strpos($sat, 'GLOBALSTAR') !== false) { |
|
58 | 58 | $ident = 'Globalstar'; |
59 | 59 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/Globalstar'; |
60 | 60 | $aircraft_name = $sat; |
61 | -} elseif (strpos($sat,'OSCAR 7') !== false) { |
|
61 | +} elseif (strpos($sat, 'OSCAR 7') !== false) { |
|
62 | 62 | $image = 'https://upload.wikimedia.org/wikipedia/en/a/ad/AMSAT-OSCAR_7.jpg'; |
63 | 63 | $image_copyright = 'Amsat.org'; |
64 | 64 | $ident = 'AMSAT-OSCAR 7'; |
@@ -1,48 +1,48 @@ |
||
1 | 1 | #!/usr/bin/php |
2 | 2 | <?php |
3 | - require_once('../require/settings.php'); |
|
4 | - if ($globalInstalled) { |
|
5 | - echo '$globalInstalled must be set to FALSE in require/settings.php'; |
|
6 | - exit; |
|
7 | - } |
|
8 | - require('class.update_db.php'); |
|
9 | - echo "Populate all tables...\n"; |
|
10 | - update_db::update_all(); |
|
11 | - echo "\nInstall waypoints...(VERY slow!)"; |
|
12 | - update_db::update_waypoints(); |
|
13 | - echo "Done !\n"; |
|
14 | - echo "Install airspace..."; |
|
15 | - update_db::update_airspace(); |
|
16 | - echo "Done !\n"; |
|
17 | - echo "Install countries..."; |
|
18 | - update_db::update_countries(); |
|
19 | - echo "Done !\n"; |
|
20 | - if (isset($globalOwner) && $globalOwner) { |
|
3 | + require_once('../require/settings.php'); |
|
4 | + if ($globalInstalled) { |
|
5 | + echo '$globalInstalled must be set to FALSE in require/settings.php'; |
|
6 | + exit; |
|
7 | + } |
|
8 | + require('class.update_db.php'); |
|
9 | + echo "Populate all tables...\n"; |
|
10 | + update_db::update_all(); |
|
11 | + echo "\nInstall waypoints...(VERY slow!)"; |
|
12 | + update_db::update_waypoints(); |
|
13 | + echo "Done !\n"; |
|
14 | + echo "Install airspace..."; |
|
15 | + update_db::update_airspace(); |
|
16 | + echo "Done !\n"; |
|
17 | + echo "Install countries..."; |
|
18 | + update_db::update_countries(); |
|
19 | + echo "Done !\n"; |
|
20 | + if (isset($globalOwner) && $globalOwner) { |
|
21 | 21 | echo "Install private owners..."; |
22 | 22 | update_db::update_owner(); |
23 | - echo "Done !\n"; |
|
24 | - } |
|
25 | - /* |
|
23 | + echo "Done !\n"; |
|
24 | + } |
|
25 | + /* |
|
26 | 26 | if (isset($globalIVAO) && $globalIVAO) { |
27 | 27 | echo "Install IVAO airlines and logos..."; |
28 | 28 | update_db::update_IVAO(); |
29 | 29 | echo "Done !\n"; |
30 | 30 | } |
31 | 31 | */ |
32 | - if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
|
32 | + if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
|
33 | 33 | echo "Install NOTAM from notaminfo.com..."; |
34 | - update_db:update_notam(); |
|
35 | - echo "Done !\n"; |
|
36 | - } |
|
37 | - if (isset($globalMap3D) && $globalMap3D) { |
|
34 | + update_db:update_notam(); |
|
35 | + echo "Done !\n"; |
|
36 | + } |
|
37 | + if (isset($globalMap3D) && $globalMap3D) { |
|
38 | 38 | echo "Install 3D models..."; |
39 | 39 | update_db::update_models(); |
40 | 40 | echo "Done !\n"; |
41 | 41 | if (isset($globalMapSatellites) && $globalMapSatellites) { |
42 | - echo "Install Space 3D models..."; |
|
43 | - update_db::update_space_models(); |
|
44 | - echo "Done !\n"; |
|
45 | - } |
|
46 | - } |
|
42 | + echo "Install Space 3D models..."; |
|
43 | + update_db::update_space_models(); |
|
44 | + echo "Done !\n"; |
|
45 | + } |
|
46 | + } |
|
47 | 47 | |
48 | 48 | ?> |
49 | 49 | \ No newline at end of file |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | |
21 | 21 | $spotter_array = array(); |
22 | 22 | if (isset($_COOKIE['sattypes']) && $_COOKIE['sattypes'] != '') { |
23 | - $sattypes = explode(',',$_COOKIE['sattypes']); |
|
23 | + $sattypes = explode(',', $_COOKIE['sattypes']); |
|
24 | 24 | foreach ($sattypes as $sattype) { |
25 | - $spotter_array = array_merge($Satellite->position_all_type($sattype,$timeb-$globalLiveInterval,$timeb),$spotter_array); |
|
25 | + $spotter_array = array_merge($Satellite->position_all_type($sattype, $timeb - $globalLiveInterval, $timeb), $spotter_array); |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss']) { |
29 | - $spotter_array = array_merge($Satellite->position('ISS (ZARYA)',time()-$globalLiveInterval,time()),$spotter_array); |
|
30 | - $spotter_array = array_merge($Satellite->position('TIANGONG 1',time()-$globalLiveInterval,time()),$spotter_array); |
|
31 | - $spotter_array = array_merge($Satellite->position('TIANGONG-2',time()-$globalLiveInterval,time()),$spotter_array); |
|
29 | + $spotter_array = array_merge($Satellite->position('ISS (ZARYA)', time() - $globalLiveInterval, time()), $spotter_array); |
|
30 | + $spotter_array = array_merge($Satellite->position('TIANGONG 1', time() - $globalLiveInterval, time()), $spotter_array); |
|
31 | + $spotter_array = array_merge($Satellite->position('TIANGONG-2', time() - $globalLiveInterval, time()), $spotter_array); |
|
32 | 32 | } |
33 | -$spotter_array = array_unique($spotter_array,SORT_REGULAR); |
|
33 | +$spotter_array = array_unique($spotter_array, SORT_REGULAR); |
|
34 | 34 | /* |
35 | 35 | $modelsdb = array(); |
36 | 36 | if (file_exists('models/space/space_modelsdb')) { |
@@ -54,14 +54,14 @@ discard block |
||
54 | 54 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
55 | 55 | |
56 | 56 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
57 | -$output .= ',"clock": {"currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
|
57 | +$output .= ',"clock": {"currentTime" : "'.date("c", time() - $globalLiveInterval).'","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
|
58 | 58 | //$output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : 1,"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
59 | 59 | |
60 | 60 | // $output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
61 | 61 | $output .= '},'; |
62 | 62 | if (!empty($spotter_array) && is_array($spotter_array)) |
63 | 63 | { |
64 | - foreach($spotter_array as $spotter_item) |
|
64 | + foreach ($spotter_array as $spotter_item) |
|
65 | 65 | { |
66 | 66 | $j++; |
67 | 67 | date_default_timezone_set('UTC'); |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $orientation = ''; |
77 | 77 | $prev_satname = $spotter_item['name']; |
78 | 78 | $output .= '{'; |
79 | - $output .= '"id": "'.trim(str_replace(array('[+]','[-]'),'',$spotter_item['name'])).'",'; |
|
79 | + $output .= '"id": "'.trim(str_replace(array('[+]', '[-]'), '', $spotter_item['name'])).'",'; |
|
80 | 80 | $output .= '"properties": {'; |
81 | 81 | // Not yet supported in CZML with Cesium |
82 | 82 | $output .= '},'; |
@@ -114,23 +114,23 @@ discard block |
||
114 | 114 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubiesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
115 | 115 | } elseif ($spotter_item['name'] == 'TERRA') { |
116 | 116 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/terra.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
117 | - } elseif (strpos($spotter_item['name'],'O3B') !== false) { |
|
117 | + } elseif (strpos($spotter_item['name'], 'O3B') !== false) { |
|
118 | 118 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/o3b.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
119 | - } elseif (strpos($spotter_item['name'],'GLOBALSTAR') !== false) { |
|
119 | + } elseif (strpos($spotter_item['name'], 'GLOBALSTAR') !== false) { |
|
120 | 120 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/globalstar.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
121 | - } elseif (strpos($spotter_item['name'],'GPS') !== false) { |
|
121 | + } elseif (strpos($spotter_item['name'], 'GPS') !== false) { |
|
122 | 122 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/gps.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
123 | - } elseif (strpos($spotter_item['name'],'GENESIS') !== false) { |
|
123 | + } elseif (strpos($spotter_item['name'], 'GENESIS') !== false) { |
|
124 | 124 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/genesis.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
125 | - } elseif (strpos($spotter_item['name'],'OSCAR 7') !== false) { |
|
125 | + } elseif (strpos($spotter_item['name'], 'OSCAR 7') !== false) { |
|
126 | 126 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/oscar7.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
127 | - } elseif (strpos($spotter_item['name'],'FLOCK') !== false) { |
|
127 | + } elseif (strpos($spotter_item['name'], 'FLOCK') !== false) { |
|
128 | 128 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/cubesat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
129 | - } elseif (strpos($spotter_item['name'],'PLEIADES') !== false) { |
|
129 | + } elseif (strpos($spotter_item['name'], 'PLEIADES') !== false) { |
|
130 | 130 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/pleiades.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
131 | - } elseif (strpos($spotter_item['name'],'DUCHIFAT') !== false) { |
|
131 | + } elseif (strpos($spotter_item['name'], 'DUCHIFAT') !== false) { |
|
132 | 132 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/duchifat.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
133 | - } elseif (strpos($spotter_item['name'],'FORMOSAT-2') !== false) { |
|
133 | + } elseif (strpos($spotter_item['name'], 'FORMOSAT-2') !== false) { |
|
134 | 134 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/formosat2.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
135 | 135 | } elseif ($spotter_item['type'] == 'iridium') { |
136 | 136 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/space/iridium.glb'.'","scale" : 1.0,"minimumPixelSize": 25,"maximunPixelSize": 300 },'; |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | // $output .= '"interpolationDegree" : 5,'; |
152 | 152 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
153 | 153 | $output .= '"cartographicDegrees": ['; |
154 | - $output .= '"'.date("c",$spotter_item['timestamp']).'", '; |
|
154 | + $output .= '"'.date("c", $spotter_item['timestamp']).'", '; |
|
155 | 155 | $output .= $spotter_item['longitude'].', '; |
156 | 156 | $output .= $spotter_item['latitude'].', '; |
157 | 157 | $output .= $spotter_item['altitude']*1000; |
158 | 158 | $orientation = '"orientation" : { '; |
159 | 159 | $orientation .= '"unitQuaternion": ['; |
160 | 160 | } else { |
161 | - $output .= ',"'.date("c",$spotter_item['timestamp']).'", '; |
|
161 | + $output .= ',"'.date("c", $spotter_item['timestamp']).'", '; |
|
162 | 162 | $output .= $spotter_item['longitude'].', '; |
163 | 163 | $output .= $spotter_item['latitude'].', '; |
164 | 164 | $output .= $spotter_item['altitude']*1000; |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | require_once('require/class.Satellite.php'); |
6 | 6 | |
7 | -$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING); |
|
7 | +$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($trackident != '') { |
9 | 9 | require_once('require/class.SpotterLive.php'); |
10 | 10 | $SpotterLive = new SpotterLive(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident); |
15 | 15 | header('Location: '.$globalURL.'/flightid/'.$spotterid); |
16 | 16 | } else { |
17 | - setcookie('MapTrack',$resulttrackident[0]['flightaware_id']); |
|
17 | + setcookie('MapTrack', $resulttrackident[0]['flightaware_id']); |
|
18 | 18 | } |
19 | 19 | } else { |
20 | 20 | unset($_COOKIE['MapTrack']); |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | <div class="form-group"> |
119 | 119 | <label>From (UTC):</label> |
120 | 120 | <div class='input-group date' id='datetimepicker1'> |
121 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_COOKIE['archive_begin'])) print date("d/m/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
121 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_COOKIE['archive_begin'])) print date("d/m/Y h:i a", $_COOKIE['archive_begin']); ?>" required /> |
|
122 | 122 | <span class="input-group-addon"> |
123 | 123 | <span class="glyphicon glyphicon-calendar"></span> |
124 | 124 | </span> |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | <div class="form-group"> |
128 | 128 | <label>To (UTC):</label> |
129 | 129 | <div class='input-group date' id='datetimepicker2'> |
130 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_COOKIE['archive_end'])) print date("d/m/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
130 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_COOKIE['archive_end'])) print date("d/m/Y h:i a", $_COOKIE['archive_end']); ?>" /> |
|
131 | 131 | <span class="input-group-addon"> |
132 | 132 | <span class="glyphicon glyphicon-calendar"></span> |
133 | 133 | </span> |
@@ -248,8 +248,8 @@ discard block |
||
248 | 248 | <li><?php echo _("Type of Terrain:"); ?> |
249 | 249 | <select class="selectpicker" onchange="terrainType(this);"> |
250 | 250 | <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
251 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
252 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
251 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option> |
|
252 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option> |
|
253 | 253 | </select> |
254 | 254 | </li> |
255 | 255 | <?php |
@@ -346,10 +346,10 @@ discard block |
||
346 | 346 | <select class="selectpicker" multiple onchange="airlines(this);"> |
347 | 347 | <?php |
348 | 348 | $Spotter = new Spotter(); |
349 | - foreach($Spotter->getAllAirlineNames() as $airline) { |
|
349 | + foreach ($Spotter->getAllAirlineNames() as $airline) { |
|
350 | 350 | $airline_name = $airline['airline_name']; |
351 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
352 | - if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) { |
|
351 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
352 | + if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['Airlines']))) { |
|
353 | 353 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
354 | 354 | } else { |
355 | 355 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
@@ -365,8 +365,8 @@ discard block |
||
365 | 365 | <select class="selectpicker" multiple onchange="sources(this);"> |
366 | 366 | <?php |
367 | 367 | $Spotter = new Spotter(); |
368 | - foreach($Spotter->getAllSourceName('aprs') as $source) { |
|
369 | - if (isset($_COOKIE['Sources']) && in_array($source['source_name'],explode(',',$_COOKIE['Sources']))) { |
|
368 | + foreach ($Spotter->getAllSourceName('aprs') as $source) { |
|
369 | + if (isset($_COOKIE['Sources']) && in_array($source['source_name'], explode(',', $_COOKIE['Sources']))) { |
|
370 | 370 | echo '<option value="'.$source['source_name'].'" selected>'.$source['source_name'].'</option>'; |
371 | 371 | } else { |
372 | 372 | echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>'; |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
452 | 452 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
453 | 453 | |
454 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
454 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
455 | 455 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
456 | 456 | } else { |
457 | 457 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | <div id="showdetails" class="showdetails"></div> |
35 | 35 | <div id="infobox" class="infobox"></div> |
36 | 36 | <?php |
37 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
37 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
38 | 38 | |
39 | 39 | ?> |
40 | 40 | <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script> |
41 | 41 | <?php |
42 | - } |
|
42 | + } |
|
43 | 43 | ?> |
44 | 44 | <div id="dialog" title="<?php echo _("Session has timed-out"); ?>"> |
45 | 45 | <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p> |
@@ -53,31 +53,31 @@ discard block |
||
53 | 53 | <li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
54 | 54 | <li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
55 | 55 | <?php |
56 | - if (isset($globalArchive) && $globalArchive == TRUE && (isset($globalBeta) && $globalBeta == TRUE)) { |
|
56 | + if (isset($globalArchive) && $globalArchive == TRUE && (isset($globalBeta) && $globalBeta == TRUE)) { |
|
57 | 57 | ?> |
58 | 58 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
59 | 59 | <?php |
60 | - } |
|
60 | + } |
|
61 | 61 | ?> |
62 | 62 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
63 | 63 | <li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li> |
64 | 64 | <?php |
65 | - if (isset($globalMap3D) && $globalMap3D) { |
|
65 | + if (isset($globalMap3D) && $globalMap3D) { |
|
66 | 66 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
67 | 67 | ?> |
68 | 68 | <li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
69 | 69 | <?php |
70 | - } else { |
|
71 | - if (isset($globalMapSatellites) && $globalMapSatellites) { |
|
70 | + } else { |
|
71 | + if (isset($globalMapSatellites) && $globalMapSatellites) { |
|
72 | 72 | ?> |
73 | 73 | <li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li> |
74 | 74 | <?php |
75 | - } |
|
75 | + } |
|
76 | 76 | ?> |
77 | 77 | <li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
78 | 78 | <?php |
79 | 79 | } |
80 | - } |
|
80 | + } |
|
81 | 81 | ?> |
82 | 82 | </ul> |
83 | 83 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | ?> |
110 | 110 | </div> |
111 | 111 | <?php |
112 | - if (isset($globalArchive) && $globalArchive == TRUE) { |
|
112 | + if (isset($globalArchive) && $globalArchive == TRUE) { |
|
113 | 113 | ?> |
114 | 114 | <div class="sidebar-pane" id="archive"> |
115 | 115 | <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | </form> |
166 | 166 | </div> |
167 | 167 | <?php |
168 | - } |
|
168 | + } |
|
169 | 169 | ?> |
170 | 170 | <div class="sidebar-pane" id="settings"> |
171 | 171 | <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -176,56 +176,56 @@ discard block |
||
176 | 176 | <?php |
177 | 177 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
178 | 178 | else $MapType = $_COOKIE['MapType']; |
179 | - ?> |
|
179 | + ?> |
|
180 | 180 | <?php |
181 | 181 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
182 | - ?> |
|
182 | + ?> |
|
183 | 183 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
184 | 184 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
185 | 185 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
186 | 186 | <?php |
187 | 187 | } |
188 | - ?> |
|
188 | + ?> |
|
189 | 189 | <?php |
190 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
191 | - ?> |
|
190 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
191 | + ?> |
|
192 | 192 | <?php |
193 | - if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
|
194 | - ?> |
|
193 | + if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
|
194 | + ?> |
|
195 | 195 | <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
196 | 196 | <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
197 | 197 | <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
198 | 198 | <?php |
199 | - } |
|
200 | - ?> |
|
199 | + } |
|
200 | + ?> |
|
201 | 201 | <?php |
202 | - if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
|
203 | - ?> |
|
202 | + if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
|
203 | + ?> |
|
204 | 204 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
205 | 205 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
206 | 206 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
207 | 207 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
208 | 208 | <?php |
209 | - } |
|
210 | - ?> |
|
209 | + } |
|
210 | + ?> |
|
211 | 211 | <?php |
212 | - if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
|
213 | - ?> |
|
212 | + if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
|
213 | + ?> |
|
214 | 214 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
215 | 215 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
216 | 216 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
217 | 217 | <?php |
218 | - } |
|
219 | - ?> |
|
218 | + } |
|
219 | + ?> |
|
220 | 220 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
221 | 221 | <?php |
222 | 222 | } |
223 | - ?> |
|
223 | + ?> |
|
224 | 224 | <?php |
225 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
225 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
226 | 226 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
227 | 227 | else $MapBoxId = $_COOKIE['MapTypeId']; |
228 | - ?> |
|
228 | + ?> |
|
229 | 229 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
230 | 230 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
231 | 231 | <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
@@ -239,13 +239,13 @@ discard block |
||
239 | 239 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
240 | 240 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
241 | 241 | <?php |
242 | - } |
|
243 | - ?> |
|
242 | + } |
|
243 | + ?> |
|
244 | 244 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
245 | 245 | </select> |
246 | 246 | </li> |
247 | 247 | <?php |
248 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
248 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
249 | 249 | ?> |
250 | 250 | <li><?php echo _("Type of Terrain:"); ?> |
251 | 251 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | </select> |
256 | 256 | </li> |
257 | 257 | <?php |
258 | - } |
|
258 | + } |
|
259 | 259 | ?> |
260 | 260 | <?php |
261 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
261 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
262 | 262 | ?> |
263 | 263 | |
264 | 264 | <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
@@ -266,54 +266,54 @@ discard block |
||
266 | 266 | <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
267 | 267 | <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
268 | 268 | <?php |
269 | - } |
|
269 | + } |
|
270 | 270 | ?> |
271 | 271 | <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
272 | 272 | <?php |
273 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
273 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
274 | 274 | ?> |
275 | 275 | <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
276 | 276 | <?php |
277 | - } |
|
277 | + } |
|
278 | 278 | ?> |
279 | 279 | |
280 | 280 | <?php |
281 | 281 | if (function_exists('array_column')) { |
282 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
283 | - ?> |
|
282 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
283 | + ?> |
|
284 | 284 | <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
285 | 285 | <?php |
286 | - } |
|
286 | + } |
|
287 | 287 | } elseif (isset($globalSources)) { |
288 | - $dispolar = false; |
|
289 | - foreach ($globalSources as $testsource) { |
|
290 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
291 | - } |
|
292 | - if ($dispolar) { |
|
293 | - ?> |
|
288 | + $dispolar = false; |
|
289 | + foreach ($globalSources as $testsource) { |
|
290 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
291 | + } |
|
292 | + if ($dispolar) { |
|
293 | + ?> |
|
294 | 294 | <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
295 | 295 | <?php |
296 | - } |
|
297 | - } |
|
298 | - ?> |
|
296 | + } |
|
297 | + } |
|
298 | + ?> |
|
299 | 299 | <?php |
300 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
300 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
301 | 301 | ?> |
302 | 302 | |
303 | 303 | <?php |
304 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
305 | - ?> |
|
304 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
305 | + ?> |
|
306 | 306 | <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
307 | 307 | <?php |
308 | 308 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
309 | - ?> |
|
309 | + ?> |
|
310 | 310 | <li><?php echo _("Aircraft icon color:"); ?> |
311 | 311 | <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"> |
312 | 312 | </li> |
313 | 313 | <?php |
314 | - } |
|
315 | - } |
|
316 | - ?> |
|
314 | + } |
|
315 | + } |
|
316 | + ?> |
|
317 | 317 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
318 | 318 | <div class="range"> |
319 | 319 | <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
@@ -321,20 +321,20 @@ discard block |
||
321 | 321 | </div> |
322 | 322 | </li> |
323 | 323 | <?php |
324 | - } |
|
324 | + } |
|
325 | 325 | ?> |
326 | 326 | <?php |
327 | 327 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
328 | - ?> |
|
328 | + ?> |
|
329 | 329 | <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
330 | 330 | <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
331 | 331 | <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
332 | 332 | <?php |
333 | 333 | } |
334 | - ?> |
|
334 | + ?> |
|
335 | 335 | <?php |
336 | 336 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
337 | - ?> |
|
337 | + ?> |
|
338 | 338 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
339 | 339 | <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
340 | 340 | <?php } ?> |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | <?php } ?> |
344 | 344 | <?php |
345 | 345 | } |
346 | - ?> |
|
346 | + ?> |
|
347 | 347 | <li><?php echo _("Display airlines:"); ?> |
348 | 348 | <select class="selectpicker" multiple onchange="airlines(this);"> |
349 | 349 | <?php |
@@ -357,12 +357,12 @@ discard block |
||
357 | 357 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
358 | 358 | } |
359 | 359 | } |
360 | - ?> |
|
360 | + ?> |
|
361 | 361 | </select> |
362 | 362 | </li> |
363 | 363 | <?php |
364 | 364 | if (isset($globalAPRS) && $globalAPRS) { |
365 | - ?> |
|
365 | + ?> |
|
366 | 366 | <li><?php echo _("Display APRS sources name:"); ?> |
367 | 367 | <select class="selectpicker" multiple onchange="sources(this);"> |
368 | 368 | <?php |
@@ -374,15 +374,15 @@ discard block |
||
374 | 374 | echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>'; |
375 | 375 | } |
376 | 376 | } |
377 | - ?> |
|
377 | + ?> |
|
378 | 378 | </select> |
379 | 379 | </li> |
380 | 380 | <?php |
381 | 381 | } |
382 | - ?> |
|
382 | + ?> |
|
383 | 383 | <?php |
384 | 384 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
385 | - ?> |
|
385 | + ?> |
|
386 | 386 | <li><?php echo _("Display airlines of type:"); ?> |
387 | 387 | <select class="selectpicker" onchange="airlinestype(this);"> |
388 | 388 | <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | </li> |
394 | 394 | <?php |
395 | 395 | } |
396 | - ?> |
|
396 | + ?> |
|
397 | 397 | <li><?php echo _("Distance unit:"); ?> |
398 | 398 | <select class="selectpicker" onchange="unitdistance(this);"> |
399 | 399 | <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | <p><?php echo _("Any change in settings reload page"); ?></p> |
420 | 420 | </div> |
421 | 421 | <?php |
422 | - if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
422 | + if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
423 | 423 | ?> |
424 | 424 | <div class="sidebar-pane" id="satellites"> |
425 | 425 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -459,14 +459,14 @@ discard block |
||
459 | 459 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
460 | 460 | } |
461 | 461 | } |
462 | - ?> |
|
462 | + ?> |
|
463 | 463 | </select> |
464 | 464 | </li> |
465 | 465 | </ul> |
466 | 466 | </form> |
467 | 467 | </div> |
468 | 468 | <?php |
469 | - } |
|
469 | + } |
|
470 | 470 | ?> |
471 | 471 | </div> |
472 | 472 | </div> |
@@ -108,11 +108,26 @@ discard block |
||
108 | 108 | <li><div class="checkbox"><label><input type="checkbox" name="notam" value="1" onclick="showNotam();" /><?php echo _("NOTAM"); ?></label></div></li> |
109 | 109 | <li><?php echo _("NOTAM scope:"); ?> |
110 | 110 | <select class="selectpicker" onchange="notamscope(this);"> |
111 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
112 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
113 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
114 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
115 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
111 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
112 | + print ' selected'; |
|
113 | +} |
|
114 | +?>>All</option> |
|
115 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
116 | + print ' selected'; |
|
117 | +} |
|
118 | +?>>Airport/Enroute warning</option> |
|
119 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
120 | + print ' selected'; |
|
121 | +} |
|
122 | +?>>Airport warning</option> |
|
123 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
124 | + print ' selected'; |
|
125 | +} |
|
126 | +?>>Navigation warning</option> |
|
127 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
128 | + print ' selected'; |
|
129 | +} |
|
130 | +?>>Enroute warning</option> |
|
116 | 131 | </select |
117 | 132 | </li> |
118 | 133 | <?php |
@@ -133,7 +148,10 @@ discard block |
||
133 | 148 | <div class="form-group"> |
134 | 149 | <label>From (UTC):</label> |
135 | 150 | <div class='input-group date' id='datetimepicker1'> |
136 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_COOKIE['archive_begin'])) print date("d/m/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
151 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_COOKIE['archive_begin'])) { |
|
152 | + print date("d/m/Y h:i a",$_COOKIE['archive_begin']); |
|
153 | +} |
|
154 | +?>" required /> |
|
137 | 155 | <span class="input-group-addon"> |
138 | 156 | <span class="glyphicon glyphicon-calendar"></span> |
139 | 157 | </span> |
@@ -142,7 +160,10 @@ discard block |
||
142 | 160 | <div class="form-group"> |
143 | 161 | <label>To (UTC):</label> |
144 | 162 | <div class='input-group date' id='datetimepicker2'> |
145 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_COOKIE['archive_end'])) print date("d/m/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
163 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_COOKIE['archive_end'])) { |
|
164 | + print date("d/m/Y h:i a",$_COOKIE['archive_end']); |
|
165 | +} |
|
166 | +?>" /> |
|
146 | 167 | <span class="input-group-addon"> |
147 | 168 | <span class="glyphicon glyphicon-calendar"></span> |
148 | 169 | </span> |
@@ -165,8 +186,18 @@ discard block |
||
165 | 186 | |
166 | 187 | <li><?php echo _("Playback speed:"); ?> |
167 | 188 | <div class="range"> |
168 | - <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
169 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
189 | + <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_COOKIE['archive_speed'])) { |
|
190 | + print $_COOKIE['archive_speed']; |
|
191 | +} else { |
|
192 | + print '1'; |
|
193 | +} |
|
194 | +?>"> |
|
195 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
196 | + print $_COOKIE['archive_speed']; |
|
197 | +} else { |
|
198 | + print '1'; |
|
199 | +} |
|
200 | +?></output> |
|
170 | 201 | </div> |
171 | 202 | </li> |
172 | 203 | |
@@ -187,15 +218,27 @@ discard block |
||
187 | 218 | <li><?php echo _("Type of Map:"); ?> |
188 | 219 | <select class="selectpicker" onchange="mapType(this);"> |
189 | 220 | <?php |
190 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
191 | - else $MapType = $_COOKIE['MapType']; |
|
221 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
222 | + $MapType = $globalMapProvider; |
|
223 | + } else { |
|
224 | + $MapType = $_COOKIE['MapType']; |
|
225 | + } |
|
192 | 226 | ?> |
193 | 227 | <?php |
194 | 228 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
195 | 229 | ?> |
196 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
197 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
198 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
230 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
231 | + print ' selected'; |
|
232 | +} |
|
233 | +?>>Bing-Aerial</option> |
|
234 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
235 | + print ' selected'; |
|
236 | +} |
|
237 | +?>>Bing-Hybrid</option> |
|
238 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
239 | + print ' selected'; |
|
240 | +} |
|
241 | +?>>Bing-Road</option> |
|
199 | 242 | <?php |
200 | 243 | } |
201 | 244 | ?> |
@@ -205,56 +248,131 @@ discard block |
||
205 | 248 | <?php |
206 | 249 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
207 | 250 | ?> |
208 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
209 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
210 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
251 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
252 | + print ' selected'; |
|
253 | +} |
|
254 | +?>>Here-Aerial</option> |
|
255 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
256 | + print ' selected'; |
|
257 | +} |
|
258 | +?>>Here-Hybrid</option> |
|
259 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
260 | + print ' selected'; |
|
261 | +} |
|
262 | +?>>Here-Road</option> |
|
211 | 263 | <?php |
212 | 264 | } |
213 | 265 | ?> |
214 | 266 | <?php |
215 | 267 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
216 | 268 | ?> |
217 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
218 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
219 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
220 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
269 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
270 | + print ' selected'; |
|
271 | +} |
|
272 | +?>>Google Roadmap</option> |
|
273 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
274 | + print ' selected'; |
|
275 | +} |
|
276 | +?>>Google Satellite</option> |
|
277 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
278 | + print ' selected'; |
|
279 | +} |
|
280 | +?>>Google Hybrid</option> |
|
281 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
282 | + print ' selected'; |
|
283 | +} |
|
284 | +?>>Google Terrain</option> |
|
221 | 285 | <?php |
222 | 286 | } |
223 | 287 | ?> |
224 | 288 | <?php |
225 | 289 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
226 | 290 | ?> |
227 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
228 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
229 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
291 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
292 | + print ' selected'; |
|
293 | +} |
|
294 | +?>>MapQuest-OSM</option> |
|
295 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
296 | + print ' selected'; |
|
297 | +} |
|
298 | +?>>MapQuest-Aerial</option> |
|
299 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
300 | + print ' selected'; |
|
301 | +} |
|
302 | +?>>MapQuest-Hybrid</option> |
|
230 | 303 | <?php |
231 | 304 | } |
232 | 305 | ?> |
233 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
306 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
307 | + print ' selected'; |
|
308 | +} |
|
309 | +?>>Yandex</option> |
|
234 | 310 | <?php |
235 | 311 | } |
236 | 312 | ?> |
237 | 313 | <?php |
238 | 314 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
239 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
240 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
315 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
316 | + $MapBoxId = 'default'; |
|
317 | + } else { |
|
318 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
319 | + } |
|
241 | 320 | ?> |
242 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
243 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
244 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
245 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
246 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
247 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
248 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
249 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
250 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
251 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
252 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
253 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
321 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
322 | + print ' selected'; |
|
323 | +} |
|
324 | +?>>Mapbox default</option> |
|
325 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
326 | + print ' selected'; |
|
327 | +} |
|
328 | +?>>Mapbox streets</option> |
|
329 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
330 | + print ' selected'; |
|
331 | +} |
|
332 | +?>>Mapbox light</option> |
|
333 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
334 | + print ' selected'; |
|
335 | +} |
|
336 | +?>>Mapbox dark</option> |
|
337 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
338 | + print ' selected'; |
|
339 | +} |
|
340 | +?>>Mapbox satellite</option> |
|
341 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
342 | + print ' selected'; |
|
343 | +} |
|
344 | +?>>Mapbox streets-satellite</option> |
|
345 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
346 | + print ' selected'; |
|
347 | +} |
|
348 | +?>>Mapbox streets-basic</option> |
|
349 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
350 | + print ' selected'; |
|
351 | +} |
|
352 | +?>>Mapbox comic</option> |
|
353 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
354 | + print ' selected'; |
|
355 | +} |
|
356 | +?>>Mapbox outdoors</option> |
|
357 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
358 | + print ' selected'; |
|
359 | +} |
|
360 | +?>>Mapbox pencil</option> |
|
361 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
362 | + print ' selected'; |
|
363 | +} |
|
364 | +?>>Mapbox pirates</option> |
|
365 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
366 | + print ' selected'; |
|
367 | +} |
|
368 | +?>>Mapbox emerald</option> |
|
254 | 369 | <?php |
255 | 370 | } |
256 | 371 | ?> |
257 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
372 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
373 | + print ' selected'; |
|
374 | +} |
|
375 | +?>>OpenStreetMap</option> |
|
258 | 376 | </select> |
259 | 377 | </li> |
260 | 378 | <?php |
@@ -262,9 +380,18 @@ discard block |
||
262 | 380 | ?> |
263 | 381 | <li><?php echo _("Type of Terrain:"); ?> |
264 | 382 | <select class="selectpicker" onchange="terrainType(this);"> |
265 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
266 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
267 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
383 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
384 | + print ' selected'; |
|
385 | +} |
|
386 | +?>>stk terrain</option> |
|
387 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
388 | + print ' selected'; |
|
389 | +} |
|
390 | +?>>ellipsoid</option> |
|
391 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
392 | + print ' selected'; |
|
393 | +} |
|
394 | +?>>vr terrain</option> |
|
268 | 395 | </select> |
269 | 396 | </li> |
270 | 397 | <?php |
@@ -274,18 +401,36 @@ discard block |
||
274 | 401 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
275 | 402 | ?> |
276 | 403 | |
277 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
278 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
279 | - <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
280 | - <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
404 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
405 | + print 'checked'; |
|
406 | +} |
|
407 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
|
408 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) { |
|
409 | + print 'checked'; |
|
410 | +} |
|
411 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
412 | + <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) { |
|
413 | + print 'checked'; |
|
414 | +} |
|
415 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
416 | + <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
417 | + print 'checked'; |
|
418 | +} |
|
419 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
281 | 420 | <?php |
282 | 421 | } |
283 | 422 | ?> |
284 | - <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
423 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') { |
|
424 | + print 'checked'; |
|
425 | +} |
|
426 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
285 | 427 | <?php |
286 | 428 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
287 | 429 | ?> |
288 | - <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
430 | + <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { |
|
431 | + print 'checked'; |
|
432 | +} |
|
433 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
289 | 434 | <?php |
290 | 435 | } |
291 | 436 | ?> |
@@ -294,17 +439,25 @@ discard block |
||
294 | 439 | if (function_exists('array_column')) { |
295 | 440 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
296 | 441 | ?> |
297 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
442 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
443 | + print 'checked'; |
|
444 | +} |
|
445 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
298 | 446 | <?php |
299 | 447 | } |
300 | 448 | } elseif (isset($globalSources)) { |
301 | 449 | $dispolar = false; |
302 | 450 | foreach ($globalSources as $testsource) { |
303 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
451 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
452 | + $dispolar = true; |
|
453 | + } |
|
304 | 454 | } |
305 | 455 | if ($dispolar) { |
306 | 456 | ?> |
307 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
457 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
458 | + print 'checked'; |
|
459 | +} |
|
460 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
308 | 461 | <?php |
309 | 462 | } |
310 | 463 | } |
@@ -316,12 +469,22 @@ discard block |
||
316 | 469 | <?php |
317 | 470 | if (extension_loaded('gd') && function_exists('gd_info')) { |
318 | 471 | ?> |
319 | - <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
472 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
473 | + print 'checked'; |
|
474 | +} |
|
475 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
320 | 476 | <?php |
321 | 477 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
322 | 478 | ?> |
323 | 479 | <li><?php echo _("Aircraft icon color:"); ?> |
324 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"> |
|
480 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
481 | + print $_COOKIE['IconColor']; |
|
482 | +} elseif (isset($globalAircraftIconColor)) { |
|
483 | + print $globalAircraftIconColor; |
|
484 | +} else { |
|
485 | + print '1a3151'; |
|
486 | +} |
|
487 | +?>"> |
|
325 | 488 | </li> |
326 | 489 | <?php |
327 | 490 | } |
@@ -329,8 +492,22 @@ discard block |
||
329 | 492 | ?> |
330 | 493 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
331 | 494 | <div class="range"> |
332 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
|
333 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
495 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
496 | + print $_COOKIE['AirportZoom']; |
|
497 | +} elseif (isset($globalAirportZoom)) { |
|
498 | + print $globalAirportZoom; |
|
499 | +} else { |
|
500 | + print '7'; |
|
501 | +} |
|
502 | +?>"> |
|
503 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
504 | + print $_COOKIE['AirportZoom']; |
|
505 | +} elseif (isset($globalAirportZoom)) { |
|
506 | + print $globalAirportZoom; |
|
507 | +} else { |
|
508 | + print '7'; |
|
509 | +} |
|
510 | +?></output> |
|
334 | 511 | </div> |
335 | 512 | </li> |
336 | 513 | <?php |
@@ -339,9 +516,18 @@ discard block |
||
339 | 516 | <?php |
340 | 517 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
341 | 518 | ?> |
342 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
343 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
344 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
519 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) { |
|
520 | + print 'checked'; |
|
521 | +} |
|
522 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
523 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) { |
|
524 | + print 'checked'; |
|
525 | +} |
|
526 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
527 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) { |
|
528 | + print 'checked'; |
|
529 | +} |
|
530 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
345 | 531 | <?php |
346 | 532 | } |
347 | 533 | ?> |
@@ -349,10 +535,16 @@ discard block |
||
349 | 535 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
350 | 536 | ?> |
351 | 537 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
352 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
538 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) { |
|
539 | + print 'checked'; |
|
540 | +} |
|
541 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
353 | 542 | <?php } ?> |
354 | 543 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
355 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
544 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { |
|
545 | + print 'checked'; |
|
546 | +} |
|
547 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
356 | 548 | <?php } ?> |
357 | 549 | <?php |
358 | 550 | } |
@@ -363,7 +555,9 @@ discard block |
||
363 | 555 | $Spotter = new Spotter(); |
364 | 556 | foreach($Spotter->getAllAirlineNames() as $airline) { |
365 | 557 | $airline_name = $airline['airline_name']; |
366 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
558 | + if (strlen($airline_name) > 30) { |
|
559 | + $airline_name = substr($airline_name,0,30).'...'; |
|
560 | + } |
|
367 | 561 | if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) { |
368 | 562 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
369 | 563 | } else { |
@@ -398,10 +592,22 @@ discard block |
||
398 | 592 | ?> |
399 | 593 | <li><?php echo _("Display airlines of type:"); ?> |
400 | 594 | <select class="selectpicker" onchange="airlinestype(this);"> |
401 | - <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
402 | - <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
403 | - <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
404 | - <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
595 | + <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') { |
|
596 | + echo ' selected'; |
|
597 | +} |
|
598 | +?>><?php echo _("All"); ?></option> |
|
599 | + <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') { |
|
600 | + echo ' selected'; |
|
601 | +} |
|
602 | +?>><?php echo _("Passenger"); ?></option> |
|
603 | + <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') { |
|
604 | + echo ' selected'; |
|
605 | +} |
|
606 | +?>><?php echo _("Cargo"); ?></option> |
|
607 | + <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') { |
|
608 | + echo ' selected'; |
|
609 | +} |
|
610 | +?>><?php echo _("Military"); ?></option> |
|
405 | 611 | </select> |
406 | 612 | </li> |
407 | 613 | <?php |
@@ -409,22 +615,46 @@ discard block |
||
409 | 615 | ?> |
410 | 616 | <li><?php echo _("Distance unit:"); ?> |
411 | 617 | <select class="selectpicker" onchange="unitdistance(this);"> |
412 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
413 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
414 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
618 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
619 | + echo ' selected'; |
|
620 | +} |
|
621 | +?>>km</option> |
|
622 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
623 | + echo ' selected'; |
|
624 | +} |
|
625 | +?>>nm</option> |
|
626 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
627 | + echo ' selected'; |
|
628 | +} |
|
629 | +?>>mi</option> |
|
415 | 630 | </select> |
416 | 631 | </li> |
417 | 632 | <li><?php echo _("Altitude unit:"); ?> |
418 | 633 | <select class="selectpicker" onchange="unitaltitude(this);"> |
419 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
420 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
634 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
635 | + echo ' selected'; |
|
636 | +} |
|
637 | +?>>m</option> |
|
638 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
639 | + echo ' selected'; |
|
640 | +} |
|
641 | +?>>feet</option> |
|
421 | 642 | </select> |
422 | 643 | </li> |
423 | 644 | <li><?php echo _("Speed unit:"); ?> |
424 | 645 | <select class="selectpicker" onchange="unitspeed(this);"> |
425 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
426 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
427 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
646 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
647 | + echo ' selected'; |
|
648 | +} |
|
649 | +?>>km/h</option> |
|
650 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
651 | + echo ' selected'; |
|
652 | +} |
|
653 | +?>>mph</option> |
|
654 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
655 | + echo ' selected'; |
|
656 | +} |
|
657 | +?>>knots</option> |
|
428 | 658 | </select> |
429 | 659 | </li> |
430 | 660 | </ul> |
@@ -438,7 +668,10 @@ discard block |
||
438 | 668 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
439 | 669 | <form> |
440 | 670 | <ul> |
441 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
671 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') { |
|
672 | + print 'checked'; |
|
673 | +} |
|
674 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
442 | 675 | <li><?php echo _("Type:"); ?> |
443 | 676 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
444 | 677 | <?php |
@@ -446,25 +679,45 @@ discard block |
||
446 | 679 | $types = $Satellite->get_tle_types(); |
447 | 680 | foreach ($types as $type) { |
448 | 681 | $type_name = $type['tle_type']; |
449 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
450 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
451 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
452 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
453 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
454 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
455 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
456 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
457 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
458 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
459 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
460 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
461 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
462 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
463 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
464 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
465 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
466 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
467 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
682 | + if ($type_name == 'musson') { |
|
683 | + $type_name = 'Russian LEO Navigation'; |
|
684 | + } else if ($type_name == 'nnss') { |
|
685 | + $type_name = 'Navi Navigation Satellite System'; |
|
686 | + } else if ($type_name == 'sbas') { |
|
687 | + $type_name = 'Satellite-Based Augmentation System'; |
|
688 | + } else if ($type_name == 'glo-ops') { |
|
689 | + $type_name = 'Glonass Operational'; |
|
690 | + } else if ($type_name == 'gps-ops') { |
|
691 | + $type_name = 'GPS Operational'; |
|
692 | + } else if ($type_name == 'argos') { |
|
693 | + $type_name = 'ARGOS Data Collection System'; |
|
694 | + } else if ($type_name == 'tdrss') { |
|
695 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
696 | + } else if ($type_name == 'sarsat') { |
|
697 | + $type_name = 'Search & Rescue'; |
|
698 | + } else if ($type_name == 'dmc') { |
|
699 | + $type_name = 'Disaster Monitoring'; |
|
700 | + } else if ($type_name == 'resource') { |
|
701 | + $type_name = 'Earth Resources'; |
|
702 | + } else if ($type_name == 'stations') { |
|
703 | + $type_name = 'Space Stations'; |
|
704 | + } else if ($type_name == 'geo') { |
|
705 | + $type_name = 'Geostationary'; |
|
706 | + } else if ($type_name == 'amateur') { |
|
707 | + $type_name = 'Amateur Radio'; |
|
708 | + } else if ($type_name == 'x-comm') { |
|
709 | + $type_name = 'Experimental'; |
|
710 | + } else if ($type_name == 'other-comm') { |
|
711 | + $type_name = 'Other Comm'; |
|
712 | + } else if ($type_name == 'science') { |
|
713 | + $type_name = 'Space & Earth Science'; |
|
714 | + } else if ($type_name == 'military') { |
|
715 | + $type_name = 'Miscellaneous Military'; |
|
716 | + } else if ($type_name == 'radar') { |
|
717 | + $type_name = 'Radar Calibration'; |
|
718 | + } else if ($type_name == 'tle-new') { |
|
719 | + $type_name = 'Last 30 days launches'; |
|
720 | + } |
|
468 | 721 | |
469 | 722 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
470 | 723 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
@@ -13,6 +13,10 @@ discard block |
||
13 | 13 | $this->db = $Connection->db(); |
14 | 14 | } |
15 | 15 | |
16 | + /** |
|
17 | + * @param string $type |
|
18 | + * @param string $stats_date |
|
19 | + */ |
|
16 | 20 | public function addLastStatsUpdate($type,$stats_date) { |
17 | 21 | $query = "DELETE FROM config WHERE name = :type; |
18 | 22 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
@@ -578,6 +582,11 @@ discard block |
||
578 | 582 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
579 | 583 | return $all; |
580 | 584 | } |
585 | + |
|
586 | + /** |
|
587 | + * @param string $type |
|
588 | + * @param string $year |
|
589 | + */ |
|
581 | 590 | public function getSumStats($type,$year,$stats_airline = '') { |
582 | 591 | global $globalArchiveMonths, $globalDBdriver; |
583 | 592 | if ($globalDBdriver == 'mysql') { |
@@ -677,6 +686,10 @@ discard block |
||
677 | 686 | return $all[0]['total']; |
678 | 687 | } |
679 | 688 | |
689 | + /** |
|
690 | + * @param string $type |
|
691 | + * @param string $stats_date |
|
692 | + */ |
|
680 | 693 | public function addStat($type,$cnt,$stats_date,$stats_airline = '') { |
681 | 694 | global $globalDBdriver; |
682 | 695 | if ($globalDBdriver == 'mysql') { |
@@ -708,6 +721,10 @@ discard block |
||
708 | 721 | return "error : ".$e->getMessage(); |
709 | 722 | } |
710 | 723 | } |
724 | + |
|
725 | + /** |
|
726 | + * @param string $date |
|
727 | + */ |
|
711 | 728 | public function getStatsSource($date,$stats_type = '') { |
712 | 729 | if ($stats_type == '') { |
713 | 730 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
@@ -726,6 +743,9 @@ discard block |
||
726 | 743 | return $all; |
727 | 744 | } |
728 | 745 | |
746 | + /** |
|
747 | + * @param string $stats_type |
|
748 | + */ |
|
729 | 749 | public function addStatSource($data,$source_name,$stats_type,$date) { |
730 | 750 | global $globalDBdriver; |
731 | 751 | if ($globalDBdriver == 'mysql') { |
@@ -741,6 +761,10 @@ discard block |
||
741 | 761 | return "error : ".$e->getMessage(); |
742 | 762 | } |
743 | 763 | } |
764 | + |
|
765 | + /** |
|
766 | + * @param string $type |
|
767 | + */ |
|
744 | 768 | public function addStatFlight($type,$date_name,$cnt,$stats_airline = '') { |
745 | 769 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline) VALUES (:type,:flight_date,:cnt,:stats_airline)"; |
746 | 770 | $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline); |
@@ -927,6 +951,10 @@ discard block |
||
927 | 951 | return "error : ".$e->getMessage(); |
928 | 952 | } |
929 | 953 | } |
954 | + |
|
955 | + /** |
|
956 | + * @param string $type |
|
957 | + */ |
|
930 | 958 | public function deleteStatFlight($type) { |
931 | 959 | $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
932 | 960 | $query_values = array(':type' => $type); |
@@ -937,6 +965,10 @@ discard block |
||
937 | 965 | return "error : ".$e->getMessage(); |
938 | 966 | } |
939 | 967 | } |
968 | + |
|
969 | + /** |
|
970 | + * @param string $type |
|
971 | + */ |
|
940 | 972 | public function deleteStatAirport($type) { |
941 | 973 | $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
942 | 974 | $query_values = array(':type' => $type); |
@@ -13,14 +13,14 @@ discard block |
||
13 | 13 | $this->db = $Connection->db(); |
14 | 14 | } |
15 | 15 | |
16 | - public function addLastStatsUpdate($type,$stats_date) { |
|
16 | + public function addLastStatsUpdate($type, $stats_date) { |
|
17 | 17 | $query = "DELETE FROM config WHERE name = :type; |
18 | 18 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
19 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
19 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
20 | 20 | try { |
21 | 21 | $sth = $this->db->prepare($query); |
22 | 22 | $sth->execute($query_values); |
23 | - } catch(PDOException $e) { |
|
23 | + } catch (PDOException $e) { |
|
24 | 24 | return "error : ".$e->getMessage(); |
25 | 25 | } |
26 | 26 | } |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | try { |
31 | 31 | $sth = $this->db->prepare($query); |
32 | 32 | $sth->execute(array(':type' => $type)); |
33 | - } catch(PDOException $e) { |
|
33 | + } catch (PDOException $e) { |
|
34 | 34 | echo "error : ".$e->getMessage(); |
35 | 35 | } |
36 | 36 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | try { |
42 | 42 | $sth = $this->db->prepare($query); |
43 | 43 | $sth->execute(); |
44 | - } catch(PDOException $e) { |
|
44 | + } catch (PDOException $e) { |
|
45 | 45 | echo "error : ".$e->getMessage(); |
46 | 46 | } |
47 | 47 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | try { |
53 | 53 | $sth = $this->db->prepare($query); |
54 | 54 | $sth->execute(array(':stats_airline' => $stats_airline)); |
55 | - } catch(PDOException $e) { |
|
55 | + } catch (PDOException $e) { |
|
56 | 56 | echo "error : ".$e->getMessage(); |
57 | 57 | } |
58 | 58 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | try { |
64 | 64 | $sth = $this->db->prepare($query); |
65 | 65 | $sth->execute(array(':stats_airline' => $stats_airline)); |
66 | - } catch(PDOException $e) { |
|
66 | + } catch (PDOException $e) { |
|
67 | 67 | echo "error : ".$e->getMessage(); |
68 | 68 | } |
69 | 69 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -77,14 +77,14 @@ discard block |
||
77 | 77 | try { |
78 | 78 | $sth = $this->db->prepare($query); |
79 | 79 | $sth->execute(array(':stats_airline' => $stats_airline)); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | echo "error : ".$e->getMessage(); |
82 | 82 | } |
83 | 83 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
84 | 84 | if (empty($all)) { |
85 | 85 | $filters = array('airlines' => array($stats_airline)); |
86 | 86 | $Spotter = new Spotter($this->db); |
87 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
87 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
88 | 88 | } |
89 | 89 | return $all; |
90 | 90 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | try { |
95 | 95 | $sth = $this->db->prepare($query); |
96 | 96 | $sth->execute(); |
97 | - } catch(PDOException $e) { |
|
97 | + } catch (PDOException $e) { |
|
98 | 98 | echo "error : ".$e->getMessage(); |
99 | 99 | } |
100 | 100 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | } |
106 | 106 | return $all; |
107 | 107 | } |
108 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '') { |
|
108 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '') { |
|
109 | 109 | if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
110 | 110 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
111 | 111 | try { |
112 | 112 | $sth = $this->db->prepare($query); |
113 | 113 | $sth->execute(array(':stats_airline' => $stats_airline)); |
114 | - } catch(PDOException $e) { |
|
114 | + } catch (PDOException $e) { |
|
115 | 115 | echo "error : ".$e->getMessage(); |
116 | 116 | } |
117 | 117 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -129,14 +129,14 @@ discard block |
||
129 | 129 | try { |
130 | 130 | $sth = $this->db->prepare($query); |
131 | 131 | $sth->execute(array(':stats_airline' => $stats_airline)); |
132 | - } catch(PDOException $e) { |
|
132 | + } catch (PDOException $e) { |
|
133 | 133 | echo "error : ".$e->getMessage(); |
134 | 134 | } |
135 | 135 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
136 | 136 | if (empty($all)) { |
137 | 137 | $filters = array('airlines' => array($stats_airline)); |
138 | 138 | $Spotter = new Spotter($this->db); |
139 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
139 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
140 | 140 | } |
141 | 141 | return $all; |
142 | 142 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | try { |
147 | 147 | $sth = $this->db->prepare($query); |
148 | 148 | $sth->execute(array(':stats_airline' => $stats_airline)); |
149 | - } catch(PDOException $e) { |
|
149 | + } catch (PDOException $e) { |
|
150 | 150 | echo "error : ".$e->getMessage(); |
151 | 151 | } |
152 | 152 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | try { |
165 | 165 | $sth = $this->db->prepare($query); |
166 | 166 | $sth->execute(); |
167 | - } catch(PDOException $e) { |
|
167 | + } catch (PDOException $e) { |
|
168 | 168 | echo "error : ".$e->getMessage(); |
169 | 169 | } |
170 | 170 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -174,37 +174,37 @@ discard block |
||
174 | 174 | } |
175 | 175 | return $all; |
176 | 176 | } |
177 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '') { |
|
177 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '') { |
|
178 | 178 | if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
179 | 179 | else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline ORDER BY aircraft_registration_count DESC"; |
180 | 180 | try { |
181 | 181 | $sth = $this->db->prepare($query); |
182 | 182 | $sth->execute(array(':stats_airline' => $stats_airline)); |
183 | - } catch(PDOException $e) { |
|
183 | + } catch (PDOException $e) { |
|
184 | 184 | echo "error : ".$e->getMessage(); |
185 | 185 | } |
186 | 186 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
187 | 187 | if (empty($all)) { |
188 | 188 | $filters = array('airlines' => array($stats_airline)); |
189 | 189 | $Spotter = new Spotter($this->db); |
190 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
190 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
191 | 191 | } |
192 | 192 | return $all; |
193 | 193 | } |
194 | - public function countAllCallsigns($limit = true,$stats_airline = '') { |
|
194 | + public function countAllCallsigns($limit = true, $stats_airline = '') { |
|
195 | 195 | if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.stats_airline = :stats_airline ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
196 | 196 | else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.stats_airline = :stats_airline ORDER BY callsign_icao_count DESC"; |
197 | 197 | try { |
198 | 198 | $sth = $this->db->prepare($query); |
199 | 199 | $sth->execute(array(':stats_airline' => $stats_airline)); |
200 | - } catch(PDOException $e) { |
|
200 | + } catch (PDOException $e) { |
|
201 | 201 | echo "error : ".$e->getMessage(); |
202 | 202 | } |
203 | 203 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
204 | 204 | if (empty($all)) { |
205 | 205 | $filters = array('airlines' => array($stats_airline)); |
206 | 206 | $Spotter = new Spotter($this->db); |
207 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
207 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
208 | 208 | } |
209 | 209 | return $all; |
210 | 210 | } |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | try { |
217 | 217 | $sth = $this->db->prepare($query); |
218 | 218 | $sth->execute(array(':stats_airline' => $stats_airline)); |
219 | - } catch(PDOException $e) { |
|
219 | + } catch (PDOException $e) { |
|
220 | 220 | echo "error : ".$e->getMessage(); |
221 | 221 | } |
222 | 222 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -231,55 +231,55 @@ discard block |
||
231 | 231 | return array(); |
232 | 232 | } |
233 | 233 | } |
234 | - public function countAllPilots($limit = true,$stats_airline = '') { |
|
234 | + public function countAllPilots($limit = true, $stats_airline = '') { |
|
235 | 235 | if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
236 | 236 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline ORDER BY pilot_count DESC"; |
237 | 237 | try { |
238 | 238 | $sth = $this->db->prepare($query); |
239 | 239 | $sth->execute(array(':stats_airline' => $stats_airline)); |
240 | - } catch(PDOException $e) { |
|
240 | + } catch (PDOException $e) { |
|
241 | 241 | echo "error : ".$e->getMessage(); |
242 | 242 | } |
243 | 243 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
244 | 244 | if (empty($all)) { |
245 | 245 | $filters = array('airlines' => array($stats_airline)); |
246 | 246 | $Spotter = new Spotter($this->db); |
247 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
247 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
248 | 248 | } |
249 | 249 | return $all; |
250 | 250 | } |
251 | - public function countAllOwners($limit = true,$stats_airline = '') { |
|
251 | + public function countAllOwners($limit = true, $stats_airline = '') { |
|
252 | 252 | if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
253 | 253 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline ORDER BY owner_count DESC"; |
254 | 254 | try { |
255 | 255 | $sth = $this->db->prepare($query); |
256 | 256 | $sth->execute(array(':stats_airline' => $stats_airline)); |
257 | - } catch(PDOException $e) { |
|
257 | + } catch (PDOException $e) { |
|
258 | 258 | echo "error : ".$e->getMessage(); |
259 | 259 | } |
260 | 260 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
261 | 261 | if (empty($all)) { |
262 | 262 | $filters = array('airlines' => array($stats_airline)); |
263 | 263 | $Spotter = new Spotter($this->db); |
264 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
264 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
265 | 265 | } |
266 | 266 | return $all; |
267 | 267 | } |
268 | - public function countAllDepartureAirports($limit = true,$stats_airline = '') { |
|
268 | + public function countAllDepartureAirports($limit = true, $stats_airline = '') { |
|
269 | 269 | if ($limit) $query = "SELECT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline LIMIT 10 OFFSET 0"; |
270 | 270 | else $query = "SELECT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline"; |
271 | 271 | try { |
272 | 272 | $sth = $this->db->prepare($query); |
273 | 273 | $sth->execute(array(':stats_airline' => $stats_airline)); |
274 | - } catch(PDOException $e) { |
|
274 | + } catch (PDOException $e) { |
|
275 | 275 | echo "error : ".$e->getMessage(); |
276 | 276 | } |
277 | 277 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
278 | 278 | if (empty($all)) { |
279 | 279 | $filters = array('airlines' => array($stats_airline)); |
280 | 280 | $Spotter = new Spotter($this->db); |
281 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
282 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
281 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
282 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
283 | 283 | $all = array(); |
284 | 284 | foreach ($pall as $value) { |
285 | 285 | $icao = $value['airport_departure_icao']; |
@@ -296,25 +296,25 @@ discard block |
||
296 | 296 | foreach ($all as $key => $row) { |
297 | 297 | $count[$key] = $row['airport_departure_icao_count']; |
298 | 298 | } |
299 | - array_multisort($count,SORT_DESC,$all); |
|
299 | + array_multisort($count, SORT_DESC, $all); |
|
300 | 300 | } |
301 | 301 | return $all; |
302 | 302 | } |
303 | - public function countAllArrivalAirports($limit = true,$stats_airline = '') { |
|
303 | + public function countAllArrivalAirports($limit = true, $stats_airline = '') { |
|
304 | 304 | if ($limit) $query = "SELECT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline LIMIT 10 OFFSET 0"; |
305 | 305 | else $query = "SELECT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline"; |
306 | 306 | try { |
307 | 307 | $sth = $this->db->prepare($query); |
308 | 308 | $sth->execute(array(':stats_airline' => $stats_airline)); |
309 | - } catch(PDOException $e) { |
|
309 | + } catch (PDOException $e) { |
|
310 | 310 | echo "error : ".$e->getMessage(); |
311 | 311 | } |
312 | 312 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
313 | 313 | if (empty($all)) { |
314 | 314 | $filters = array('airlines' => array($stats_airline)); |
315 | 315 | $Spotter = new Spotter($this->db); |
316 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
317 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
316 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
317 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
318 | 318 | $all = array(); |
319 | 319 | foreach ($pall as $value) { |
320 | 320 | $icao = $value['airport_arrival_icao']; |
@@ -331,11 +331,11 @@ discard block |
||
331 | 331 | foreach ($all as $key => $row) { |
332 | 332 | $count[$key] = $row['airport_arrival_icao_count']; |
333 | 333 | } |
334 | - array_multisort($count,SORT_DESC,$all); |
|
334 | + array_multisort($count, SORT_DESC, $all); |
|
335 | 335 | } |
336 | 336 | return $all; |
337 | 337 | } |
338 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '') { |
|
338 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '') { |
|
339 | 339 | global $globalDBdriver; |
340 | 340 | if ($globalDBdriver == 'mysql') { |
341 | 341 | if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline"; |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | try { |
349 | 349 | $sth = $this->db->prepare($query); |
350 | 350 | $sth->execute($query_data); |
351 | - } catch(PDOException $e) { |
|
351 | + } catch (PDOException $e) { |
|
352 | 352 | echo "error : ".$e->getMessage(); |
353 | 353 | } |
354 | 354 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | try { |
368 | 368 | $sth = $this->db->prepare($query); |
369 | 369 | $sth->execute($query_data); |
370 | - } catch(PDOException $e) { |
|
370 | + } catch (PDOException $e) { |
|
371 | 371 | echo "error : ".$e->getMessage(); |
372 | 372 | } |
373 | 373 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | try { |
390 | 390 | $sth = $this->db->prepare($query); |
391 | 391 | $sth->execute($query_data); |
392 | - } catch(PDOException $e) { |
|
392 | + } catch (PDOException $e) { |
|
393 | 393 | echo "error : ".$e->getMessage(); |
394 | 394 | } |
395 | 395 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | try { |
407 | 407 | $sth = $this->db->prepare($query); |
408 | 408 | $sth->execute($query_data); |
409 | - } catch(PDOException $e) { |
|
409 | + } catch (PDOException $e) { |
|
410 | 410 | echo "error : ".$e->getMessage(); |
411 | 411 | } |
412 | 412 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | try { |
424 | 424 | $sth = $this->db->prepare($query); |
425 | 425 | $sth->execute($query_data); |
426 | - } catch(PDOException $e) { |
|
426 | + } catch (PDOException $e) { |
|
427 | 427 | echo "error : ".$e->getMessage(); |
428 | 428 | } |
429 | 429 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | try { |
439 | 439 | $sth = $this->db->prepare($query); |
440 | 440 | $sth->execute(array(':stats_airline' => $stats_airline)); |
441 | - } catch(PDOException $e) { |
|
441 | + } catch (PDOException $e) { |
|
442 | 442 | echo "error : ".$e->getMessage(); |
443 | 443 | } |
444 | 444 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | try { |
455 | 455 | $sth = $this->db->prepare($query); |
456 | 456 | $sth->execute(); |
457 | - } catch(PDOException $e) { |
|
457 | + } catch (PDOException $e) { |
|
458 | 458 | echo "error : ".$e->getMessage(); |
459 | 459 | } |
460 | 460 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | } |
465 | 465 | return $all; |
466 | 466 | } |
467 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '') { |
|
467 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '') { |
|
468 | 468 | global $globalTimezone, $globalDBdriver; |
469 | 469 | |
470 | 470 | if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline"; |
@@ -480,20 +480,20 @@ discard block |
||
480 | 480 | try { |
481 | 481 | $sth = $this->db->prepare($query); |
482 | 482 | $sth->execute(array(':stats_airline' => $stats_airline)); |
483 | - } catch(PDOException $e) { |
|
483 | + } catch (PDOException $e) { |
|
484 | 484 | echo "error : ".$e->getMessage(); |
485 | 485 | } |
486 | 486 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
487 | 487 | if (empty($all)) { |
488 | 488 | $filters = array('airlines' => array($stats_airline)); |
489 | 489 | $Spotter = new Spotter($this->db); |
490 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
490 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
491 | 491 | } |
492 | 492 | return $all; |
493 | 493 | } |
494 | 494 | |
495 | 495 | public function countOverallFlights($stats_airline = '') { |
496 | - $all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline); |
|
496 | + $all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline); |
|
497 | 497 | if (empty($all)) { |
498 | 498 | $filters = array('airlines' => array($stats_airline)); |
499 | 499 | $Spotter = new Spotter($this->db); |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | return $all; |
503 | 503 | } |
504 | 504 | public function countOverallMilitaryFlights() { |
505 | - $all = $this->getSumStats('military_flights_bymonth',date('Y')); |
|
505 | + $all = $this->getSumStats('military_flights_bymonth', date('Y')); |
|
506 | 506 | if (empty($all)) { |
507 | 507 | $Spotter = new Spotter($this->db); |
508 | 508 | $all = $Spotter->countOverallMilitaryFlights(); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | return $all; |
511 | 511 | } |
512 | 512 | public function countOverallArrival($stats_airline = '') { |
513 | - $all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline); |
|
513 | + $all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline); |
|
514 | 514 | if (empty($all)) { |
515 | 515 | $filters = array('airlines' => array($stats_airline)); |
516 | 516 | $Spotter = new Spotter($this->db); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | return $all; |
520 | 520 | } |
521 | 521 | public function countOverallAircrafts($stats_airline = '') { |
522 | - $all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline); |
|
522 | + $all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline); |
|
523 | 523 | if (empty($all)) { |
524 | 524 | $filters = array('airlines' => array($stats_airline)); |
525 | 525 | $Spotter = new Spotter($this->db); |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | try { |
533 | 533 | $sth = $this->db->prepare($query); |
534 | 534 | $sth->execute(); |
535 | - } catch(PDOException $e) { |
|
535 | + } catch (PDOException $e) { |
|
536 | 536 | echo "error : ".$e->getMessage(); |
537 | 537 | } |
538 | 538 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
557 | 557 | $all = $result[0]['nb_owner']; |
558 | 558 | */ |
559 | - $all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline); |
|
559 | + $all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline); |
|
560 | 560 | if (empty($all)) { |
561 | 561 | $filters = array('airlines' => array($stats_airline)); |
562 | 562 | $Spotter = new Spotter($this->db); |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | return $all; |
566 | 566 | } |
567 | 567 | public function countOverallPilots($stats_airline = '') { |
568 | - $all = $this->getSumStats('pilots_bymonth',date('Y')); |
|
568 | + $all = $this->getSumStats('pilots_bymonth', date('Y')); |
|
569 | 569 | if (empty($all)) { |
570 | 570 | $filters = array('airlines' => array($stats_airline)); |
571 | 571 | $Spotter = new Spotter($this->db); |
@@ -576,29 +576,29 @@ discard block |
||
576 | 576 | |
577 | 577 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '') { |
578 | 578 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline ORDER BY date"; |
579 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline); |
|
579 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline); |
|
580 | 580 | try { |
581 | 581 | $sth = $this->db->prepare($query); |
582 | 582 | $sth->execute($query_values); |
583 | - } catch(PDOException $e) { |
|
583 | + } catch (PDOException $e) { |
|
584 | 584 | echo "error : ".$e->getMessage(); |
585 | 585 | } |
586 | 586 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
587 | 587 | return $all; |
588 | 588 | } |
589 | - public function getStats($type,$stats_airline = '') { |
|
589 | + public function getStats($type, $stats_airline = '') { |
|
590 | 590 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline ORDER BY stats_date"; |
591 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline); |
|
591 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline); |
|
592 | 592 | try { |
593 | 593 | $sth = $this->db->prepare($query); |
594 | 594 | $sth->execute($query_values); |
595 | - } catch(PDOException $e) { |
|
595 | + } catch (PDOException $e) { |
|
596 | 596 | echo "error : ".$e->getMessage(); |
597 | 597 | } |
598 | 598 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
599 | 599 | return $all; |
600 | 600 | } |
601 | - public function getSumStats($type,$year,$stats_airline = '') { |
|
601 | + public function getSumStats($type, $year, $stats_airline = '') { |
|
602 | 602 | global $globalArchiveMonths, $globalDBdriver; |
603 | 603 | if ($globalDBdriver == 'mysql') { |
604 | 604 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline"; |
@@ -609,7 +609,7 @@ discard block |
||
609 | 609 | try { |
610 | 610 | $sth = $this->db->prepare($query); |
611 | 611 | $sth->execute($query_values); |
612 | - } catch(PDOException $e) { |
|
612 | + } catch (PDOException $e) { |
|
613 | 613 | echo "error : ".$e->getMessage(); |
614 | 614 | } |
615 | 615 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -626,7 +626,7 @@ discard block |
||
626 | 626 | try { |
627 | 627 | $sth = $this->db->prepare($query); |
628 | 628 | $sth->execute($query_values); |
629 | - } catch(PDOException $e) { |
|
629 | + } catch (PDOException $e) { |
|
630 | 630 | echo "error : ".$e->getMessage(); |
631 | 631 | } |
632 | 632 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | try { |
643 | 643 | $sth = $this->db->prepare($query); |
644 | 644 | $sth->execute(array(':stats_airline' => $stats_airline)); |
645 | - } catch(PDOException $e) { |
|
645 | + } catch (PDOException $e) { |
|
646 | 646 | echo "error : ".$e->getMessage(); |
647 | 647 | } |
648 | 648 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | try { |
659 | 659 | $sth = $this->db->prepare($query); |
660 | 660 | $sth->execute(); |
661 | - } catch(PDOException $e) { |
|
661 | + } catch (PDOException $e) { |
|
662 | 662 | echo "error : ".$e->getMessage(); |
663 | 663 | } |
664 | 664 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | try { |
675 | 675 | $sth = $this->db->prepare($query); |
676 | 676 | $sth->execute(); |
677 | - } catch(PDOException $e) { |
|
677 | + } catch (PDOException $e) { |
|
678 | 678 | echo "error : ".$e->getMessage(); |
679 | 679 | } |
680 | 680 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -690,29 +690,29 @@ discard block |
||
690 | 690 | try { |
691 | 691 | $sth = $this->db->prepare($query); |
692 | 692 | $sth->execute(); |
693 | - } catch(PDOException $e) { |
|
693 | + } catch (PDOException $e) { |
|
694 | 694 | echo "error : ".$e->getMessage(); |
695 | 695 | } |
696 | 696 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
697 | 697 | return $all[0]['total']; |
698 | 698 | } |
699 | 699 | |
700 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '') { |
|
700 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '') { |
|
701 | 701 | global $globalDBdriver; |
702 | 702 | if ($globalDBdriver == 'mysql') { |
703 | 703 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline) VALUES (:type,:cnt,:stats_date,:stats_airline) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
704 | 704 | } else { |
705 | 705 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline) SELECT :type,:cnt,:stats_date,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline);"; |
706 | 706 | } |
707 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline); |
|
707 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline); |
|
708 | 708 | try { |
709 | 709 | $sth = $this->db->prepare($query); |
710 | 710 | $sth->execute($query_values); |
711 | - } catch(PDOException $e) { |
|
711 | + } catch (PDOException $e) { |
|
712 | 712 | return "error : ".$e->getMessage(); |
713 | 713 | } |
714 | 714 | } |
715 | - public function updateStat($type,$cnt,$stats_date) { |
|
715 | + public function updateStat($type, $cnt, $stats_date) { |
|
716 | 716 | global $globalDBdriver; |
717 | 717 | if ($globalDBdriver == 'mysql') { |
718 | 718 | $query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
@@ -720,219 +720,219 @@ discard block |
||
720 | 720 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
721 | 721 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date; INSERT INTO stats (stats_type,cnt,stats_date) SELECT :type,:cnt,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date);"; |
722 | 722 | } |
723 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date); |
|
723 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date); |
|
724 | 724 | try { |
725 | 725 | $sth = $this->db->prepare($query); |
726 | 726 | $sth->execute($query_values); |
727 | - } catch(PDOException $e) { |
|
727 | + } catch (PDOException $e) { |
|
728 | 728 | return "error : ".$e->getMessage(); |
729 | 729 | } |
730 | 730 | } |
731 | - public function getStatsSource($date,$stats_type = '') { |
|
731 | + public function getStatsSource($date, $stats_type = '') { |
|
732 | 732 | if ($stats_type == '') { |
733 | 733 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
734 | 734 | $query_values = array(':date' => $date); |
735 | 735 | } else { |
736 | 736 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
737 | - $query_values = array(':date' => $date,':stats_type' => $stats_type); |
|
737 | + $query_values = array(':date' => $date, ':stats_type' => $stats_type); |
|
738 | 738 | } |
739 | 739 | try { |
740 | 740 | $sth = $this->db->prepare($query); |
741 | 741 | $sth->execute($query_values); |
742 | - } catch(PDOException $e) { |
|
742 | + } catch (PDOException $e) { |
|
743 | 743 | echo "error : ".$e->getMessage(); |
744 | 744 | } |
745 | 745 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
746 | 746 | return $all; |
747 | 747 | } |
748 | 748 | |
749 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
749 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
750 | 750 | global $globalDBdriver; |
751 | 751 | if ($globalDBdriver == 'mysql') { |
752 | 752 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
753 | 753 | } else { |
754 | 754 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
755 | 755 | } |
756 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
756 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
757 | 757 | try { |
758 | 758 | $sth = $this->db->prepare($query); |
759 | 759 | $sth->execute($query_values); |
760 | - } catch(PDOException $e) { |
|
760 | + } catch (PDOException $e) { |
|
761 | 761 | return "error : ".$e->getMessage(); |
762 | 762 | } |
763 | 763 | } |
764 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '') { |
|
764 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '') { |
|
765 | 765 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline) VALUES (:type,:flight_date,:cnt,:stats_airline)"; |
766 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline); |
|
766 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline); |
|
767 | 767 | try { |
768 | 768 | $sth = $this->db->prepare($query); |
769 | 769 | $sth->execute($query_values); |
770 | - } catch(PDOException $e) { |
|
770 | + } catch (PDOException $e) { |
|
771 | 771 | return "error : ".$e->getMessage(); |
772 | 772 | } |
773 | 773 | } |
774 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '') { |
|
774 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '') { |
|
775 | 775 | global $globalDBdriver; |
776 | 776 | if ($globalDBdriver == 'mysql') { |
777 | 777 | $query = "INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline) VALUES (:aircraft_icao,:registration,:cnt,:stats_airline) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
778 | 778 | } else { |
779 | 779 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline) SELECT :aircraft_icao,:registration,:cnt,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline);"; |
780 | 780 | } |
781 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao); |
|
781 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao); |
|
782 | 782 | try { |
783 | 783 | $sth = $this->db->prepare($query); |
784 | 784 | $sth->execute($query_values); |
785 | - } catch(PDOException $e) { |
|
785 | + } catch (PDOException $e) { |
|
786 | 786 | return "error : ".$e->getMessage(); |
787 | 787 | } |
788 | 788 | } |
789 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '') { |
|
789 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '') { |
|
790 | 790 | global $globalDBdriver; |
791 | 791 | if ($globalDBdriver == 'mysql') { |
792 | 792 | $query = "INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt) VALUES (:callsign_icao,:airline_icao,:cnt) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
793 | 793 | } else { |
794 | 794 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt) SELECT :callsign_icao,:airline_icao,:cnt WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao);"; |
795 | 795 | } |
796 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt); |
|
796 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt); |
|
797 | 797 | try { |
798 | 798 | $sth = $this->db->prepare($query); |
799 | 799 | $sth->execute($query_values); |
800 | - } catch(PDOException $e) { |
|
800 | + } catch (PDOException $e) { |
|
801 | 801 | return "error : ".$e->getMessage(); |
802 | 802 | } |
803 | 803 | } |
804 | - public function addStatCountry($iso2,$iso3,$name,$cnt) { |
|
804 | + public function addStatCountry($iso2, $iso3, $name, $cnt) { |
|
805 | 805 | global $globalDBdriver; |
806 | 806 | if ($globalDBdriver == 'mysql') { |
807 | 807 | $query = "INSERT INTO stats_country (iso2,iso3,name,cnt) VALUES (:iso2,:iso3,:name,:cnt) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
808 | 808 | } else { |
809 | 809 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2; INSERT INTO stats_country (iso2,iso3,name,cnt) SELECT :iso2,:iso3,:name,:cnt WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2);"; |
810 | 810 | } |
811 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt); |
|
811 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt); |
|
812 | 812 | try { |
813 | 813 | $sth = $this->db->prepare($query); |
814 | 814 | $sth->execute($query_values); |
815 | - } catch(PDOException $e) { |
|
815 | + } catch (PDOException $e) { |
|
816 | 816 | return "error : ".$e->getMessage(); |
817 | 817 | } |
818 | 818 | } |
819 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '') { |
|
819 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '') { |
|
820 | 820 | global $globalDBdriver; |
821 | 821 | if ($globalDBdriver == 'mysql') { |
822 | 822 | $query = "INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline) VALUES (:aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, stats_airline = :stats_airline"; |
823 | 823 | } else { |
824 | 824 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline);"; |
825 | 825 | } |
826 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao); |
|
826 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao); |
|
827 | 827 | try { |
828 | 828 | $sth = $this->db->prepare($query); |
829 | 829 | $sth->execute($query_values); |
830 | - } catch(PDOException $e) { |
|
830 | + } catch (PDOException $e) { |
|
831 | 831 | return "error : ".$e->getMessage(); |
832 | 832 | } |
833 | 833 | } |
834 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '') { |
|
834 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '') { |
|
835 | 835 | global $globalDBdriver; |
836 | 836 | if ($globalDBdriver == 'mysql') { |
837 | 837 | $query = "INSERT INTO stats_airline (airline_icao,airline_name,cnt) VALUES (:airline_icao,:airline_name,:cnt) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt,airline_name = :airline_name"; |
838 | 838 | } else { |
839 | 839 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao; INSERT INTO stats_airline (airline_icao,airline_name,cnt) SELECT :airline_icao,:airline_name,:cnt WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao);"; |
840 | 840 | } |
841 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt); |
|
841 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt); |
|
842 | 842 | try { |
843 | 843 | $sth = $this->db->prepare($query); |
844 | 844 | $sth->execute($query_values); |
845 | - } catch(PDOException $e) { |
|
845 | + } catch (PDOException $e) { |
|
846 | 846 | return "error : ".$e->getMessage(); |
847 | 847 | } |
848 | 848 | } |
849 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '') { |
|
849 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '') { |
|
850 | 850 | global $globalDBdriver; |
851 | 851 | if ($globalDBdriver == 'mysql') { |
852 | 852 | $query = "INSERT INTO stats_owner (owner_name,cnt,stats_airline) VALUES (:owner_name,:cnt,:stats_airline) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
853 | 853 | } else { |
854 | 854 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline; INSERT INTO stats_owner (owner_name,cnt,stats_airline) SELECT :owner_name,:cnt,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline);"; |
855 | 855 | } |
856 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline); |
|
856 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline); |
|
857 | 857 | try { |
858 | 858 | $sth = $this->db->prepare($query); |
859 | 859 | $sth->execute($query_values); |
860 | - } catch(PDOException $e) { |
|
860 | + } catch (PDOException $e) { |
|
861 | 861 | return "error : ".$e->getMessage(); |
862 | 862 | } |
863 | 863 | } |
864 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '') { |
|
864 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '') { |
|
865 | 865 | global $globalDBdriver; |
866 | 866 | if ($globalDBdriver == 'mysql') { |
867 | 867 | $query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name"; |
868 | 868 | } else { |
869 | 869 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline);"; |
870 | 870 | } |
871 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline); |
|
871 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline); |
|
872 | 872 | try { |
873 | 873 | $sth = $this->db->prepare($query); |
874 | 874 | $sth->execute($query_values); |
875 | - } catch(PDOException $e) { |
|
875 | + } catch (PDOException $e) { |
|
876 | 876 | return "error : ".$e->getMessage(); |
877 | 877 | } |
878 | 878 | } |
879 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '') { |
|
879 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '') { |
|
880 | 880 | global $globalDBdriver; |
881 | 881 | if ($globalDBdriver == 'mysql') { |
882 | 882 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline) ON DUPLICATE KEY UPDATE departure = departure+:departure"; |
883 | 883 | } else { |
884 | 884 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date, :stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline);"; |
885 | 885 | } |
886 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao); |
|
886 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao); |
|
887 | 887 | try { |
888 | 888 | $sth = $this->db->prepare($query); |
889 | 889 | $sth->execute($query_values); |
890 | - } catch(PDOException $e) { |
|
890 | + } catch (PDOException $e) { |
|
891 | 891 | return "error : ".$e->getMessage(); |
892 | 892 | } |
893 | 893 | } |
894 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '') { |
|
894 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '') { |
|
895 | 895 | global $globalDBdriver; |
896 | 896 | if ($globalDBdriver == 'mysql') { |
897 | 897 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline) ON DUPLICATE KEY UPDATE departure = :departure"; |
898 | 898 | } else { |
899 | 899 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date);"; |
900 | 900 | } |
901 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao); |
|
901 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao); |
|
902 | 902 | try { |
903 | 903 | $sth = $this->db->prepare($query); |
904 | 904 | $sth->execute($query_values); |
905 | - } catch(PDOException $e) { |
|
905 | + } catch (PDOException $e) { |
|
906 | 906 | return "error : ".$e->getMessage(); |
907 | 907 | } |
908 | 908 | } |
909 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '') { |
|
909 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '') { |
|
910 | 910 | global $globalDBdriver; |
911 | 911 | if ($globalDBdriver == 'mysql') { |
912 | 912 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline) ON DUPLICATE KEY UPDATE arrival = arrival+:arrival"; |
913 | 913 | } else { |
914 | 914 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline);"; |
915 | 915 | } |
916 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao); |
|
916 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao); |
|
917 | 917 | try { |
918 | 918 | $sth = $this->db->prepare($query); |
919 | 919 | $sth->execute($query_values); |
920 | - } catch(PDOException $e) { |
|
920 | + } catch (PDOException $e) { |
|
921 | 921 | return "error : ".$e->getMessage(); |
922 | 922 | } |
923 | 923 | } |
924 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '') { |
|
924 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '') { |
|
925 | 925 | global $globalDBdriver; |
926 | 926 | if ($globalDBdriver == 'mysql') { |
927 | 927 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline) ON DUPLICATE KEY UPDATE arrival = :arrival"; |
928 | 928 | } else { |
929 | 929 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline);"; |
930 | 930 | } |
931 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao); |
|
931 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao); |
|
932 | 932 | try { |
933 | 933 | $sth = $this->db->prepare($query); |
934 | 934 | $sth->execute($query_values); |
935 | - } catch(PDOException $e) { |
|
935 | + } catch (PDOException $e) { |
|
936 | 936 | return "error : ".$e->getMessage(); |
937 | 937 | } |
938 | 938 | } |
@@ -943,7 +943,7 @@ discard block |
||
943 | 943 | try { |
944 | 944 | $sth = $this->db->prepare($query); |
945 | 945 | $sth->execute($query_values); |
946 | - } catch(PDOException $e) { |
|
946 | + } catch (PDOException $e) { |
|
947 | 947 | return "error : ".$e->getMessage(); |
948 | 948 | } |
949 | 949 | } |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | try { |
954 | 954 | $sth = $this->db->prepare($query); |
955 | 955 | $sth->execute($query_values); |
956 | - } catch(PDOException $e) { |
|
956 | + } catch (PDOException $e) { |
|
957 | 957 | return "error : ".$e->getMessage(); |
958 | 958 | } |
959 | 959 | } |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | try { |
964 | 964 | $sth = $this->db->prepare($query); |
965 | 965 | $sth->execute($query_values); |
966 | - } catch(PDOException $e) { |
|
966 | + } catch (PDOException $e) { |
|
967 | 967 | return "error : ".$e->getMessage(); |
968 | 968 | } |
969 | 969 | } |
@@ -1201,33 +1201,33 @@ discard block |
||
1201 | 1201 | $last_update_day = $last_update[0]['value']; |
1202 | 1202 | } else $last_update_day = '2012-12-12 12:12:12'; |
1203 | 1203 | $Spotter = new Spotter($this->db); |
1204 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1204 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1205 | 1205 | foreach ($alldata as $number) { |
1206 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']); |
|
1206 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']); |
|
1207 | 1207 | } |
1208 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
1208 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
1209 | 1209 | foreach ($alldata as $number) { |
1210 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']); |
|
1210 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']); |
|
1211 | 1211 | } |
1212 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
1212 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
1213 | 1213 | foreach ($alldata as $number) { |
1214 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']); |
|
1214 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']); |
|
1215 | 1215 | } |
1216 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
1216 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
1217 | 1217 | foreach ($alldata as $number) { |
1218 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1218 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1219 | 1219 | } |
1220 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
1220 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
1221 | 1221 | foreach ($alldata as $number) { |
1222 | - $this->addStatOwner($number['owner_name'],$number['owner_count']); |
|
1222 | + $this->addStatOwner($number['owner_name'], $number['owner_count']); |
|
1223 | 1223 | } |
1224 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
1224 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
1225 | 1225 | foreach ($alldata as $number) { |
1226 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name']); |
|
1226 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name']); |
|
1227 | 1227 | } |
1228 | 1228 | |
1229 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
1230 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1229 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
1230 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
1231 | 1231 | $alldata = array(); |
1232 | 1232 | |
1233 | 1233 | foreach ($pall as $value) { |
@@ -1244,12 +1244,12 @@ discard block |
||
1244 | 1244 | foreach ($alldata as $key => $row) { |
1245 | 1245 | $count[$key] = $row['airport_departure_icao_count']; |
1246 | 1246 | } |
1247 | - array_multisort($count,SORT_DESC,$alldata); |
|
1247 | + array_multisort($count, SORT_DESC, $alldata); |
|
1248 | 1248 | foreach ($alldata as $number) { |
1249 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
|
1249 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']); |
|
1250 | 1250 | } |
1251 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
1252 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1251 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
1252 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
1253 | 1253 | $alldata = array(); |
1254 | 1254 | foreach ($pall as $value) { |
1255 | 1255 | $icao = $value['airport_arrival_icao']; |
@@ -1265,15 +1265,15 @@ discard block |
||
1265 | 1265 | foreach ($alldata as $key => $row) { |
1266 | 1266 | $count[$key] = $row['airport_arrival_icao_count']; |
1267 | 1267 | } |
1268 | - array_multisort($count,SORT_DESC,$alldata); |
|
1268 | + array_multisort($count, SORT_DESC, $alldata); |
|
1269 | 1269 | foreach ($alldata as $number) { |
1270 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
|
1270 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']); |
|
1271 | 1271 | } |
1272 | 1272 | if ($Connection->tableExists('countries')) { |
1273 | 1273 | $SpotterArchive = new SpotterArchive(); |
1274 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
1274 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
1275 | 1275 | foreach ($alldata as $number) { |
1276 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']); |
|
1276 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']); |
|
1277 | 1277 | } |
1278 | 1278 | } |
1279 | 1279 | |
@@ -1286,31 +1286,31 @@ discard block |
||
1286 | 1286 | $lastyear = false; |
1287 | 1287 | foreach ($alldata as $number) { |
1288 | 1288 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1289 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1289 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1290 | 1290 | } |
1291 | 1291 | $alldata = $Spotter->countAllMilitaryMonths(); |
1292 | 1292 | foreach ($alldata as $number) { |
1293 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1293 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1294 | 1294 | } |
1295 | 1295 | $alldata = $Spotter->countAllMonthsOwners(); |
1296 | 1296 | foreach ($alldata as $number) { |
1297 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1297 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1298 | 1298 | } |
1299 | 1299 | $alldata = $Spotter->countAllMonthsPilots(); |
1300 | 1300 | foreach ($alldata as $number) { |
1301 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1301 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1302 | 1302 | } |
1303 | 1303 | $alldata = $Spotter->countAllMonthsAirlines(); |
1304 | 1304 | foreach ($alldata as $number) { |
1305 | - $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1305 | + $this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1306 | 1306 | } |
1307 | 1307 | $alldata = $Spotter->countAllMonthsAircrafts(); |
1308 | 1308 | foreach ($alldata as $number) { |
1309 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1309 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1310 | 1310 | } |
1311 | 1311 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
1312 | 1312 | foreach ($alldata as $number) { |
1313 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1313 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1314 | 1314 | } |
1315 | 1315 | echo 'Airports data...'."\n"; |
1316 | 1316 | echo '...Departure'."\n"; |
@@ -1355,7 +1355,7 @@ discard block |
||
1355 | 1355 | } |
1356 | 1356 | $alldata = $pall; |
1357 | 1357 | foreach ($alldata as $number) { |
1358 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
1358 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
1359 | 1359 | } |
1360 | 1360 | echo '...Arrival'."\n"; |
1361 | 1361 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1397,7 +1397,7 @@ discard block |
||
1397 | 1397 | } |
1398 | 1398 | $alldata = $pall; |
1399 | 1399 | foreach ($alldata as $number) { |
1400 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
1400 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
1401 | 1401 | } |
1402 | 1402 | |
1403 | 1403 | echo 'Flights data...'."\n"; |
@@ -1405,55 +1405,55 @@ discard block |
||
1405 | 1405 | echo '-> countAllDatesLastMonth...'."\n"; |
1406 | 1406 | $alldata = $Spotter->countAllDatesLastMonth(); |
1407 | 1407 | foreach ($alldata as $number) { |
1408 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
1408 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
1409 | 1409 | } |
1410 | 1410 | echo '-> countAllDates...'."\n"; |
1411 | 1411 | $previousdata = $this->countAllDates(); |
1412 | 1412 | $this->deleteStatFlight('date'); |
1413 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
1413 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
1414 | 1414 | $values = array(); |
1415 | 1415 | foreach ($alldata as $cnt) { |
1416 | 1416 | $values[] = $cnt['date_count']; |
1417 | 1417 | } |
1418 | - array_multisort($values,SORT_DESC,$alldata); |
|
1419 | - array_splice($alldata,11); |
|
1418 | + array_multisort($values, SORT_DESC, $alldata); |
|
1419 | + array_splice($alldata, 11); |
|
1420 | 1420 | foreach ($alldata as $number) { |
1421 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
1421 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
1422 | 1422 | } |
1423 | 1423 | |
1424 | 1424 | $this->deleteStatFlight('hour'); |
1425 | 1425 | echo '-> countAllHours...'."\n"; |
1426 | 1426 | $alldata = $Spotter->countAllHours('hour'); |
1427 | 1427 | foreach ($alldata as $number) { |
1428 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
1428 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
1429 | 1429 | } |
1430 | 1430 | |
1431 | 1431 | // Count by airlines |
1432 | 1432 | echo '--- Stats by airlines ---'."\n"; |
1433 | 1433 | $Spotter = new Spotter($this->db); |
1434 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
1434 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
1435 | 1435 | foreach ($alldata as $number) { |
1436 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']); |
|
1436 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']); |
|
1437 | 1437 | } |
1438 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
1438 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
1439 | 1439 | foreach ($alldata as $number) { |
1440 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']); |
|
1440 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']); |
|
1441 | 1441 | } |
1442 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
1442 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
1443 | 1443 | foreach ($alldata as $number) { |
1444 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1444 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1445 | 1445 | } |
1446 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
1446 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
1447 | 1447 | foreach ($alldata as $number) { |
1448 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']); |
|
1448 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']); |
|
1449 | 1449 | } |
1450 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
1450 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
1451 | 1451 | foreach ($alldata as $number) { |
1452 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao']); |
|
1452 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao']); |
|
1453 | 1453 | } |
1454 | 1454 | |
1455 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1456 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1455 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1456 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1457 | 1457 | //$alldata = array(); |
1458 | 1458 | foreach ($dall as $value) { |
1459 | 1459 | $icao = $value['airport_departure_icao']; |
@@ -1472,10 +1472,10 @@ discard block |
||
1472 | 1472 | } |
1473 | 1473 | $alldata = $pall; |
1474 | 1474 | foreach ($alldata as $number) { |
1475 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao']); |
|
1475 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao']); |
|
1476 | 1476 | } |
1477 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1478 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1477 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1478 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1479 | 1479 | //$alldata = array(); |
1480 | 1480 | foreach ($dall as $value) { |
1481 | 1481 | $icao = $value['airport_arrival_icao']; |
@@ -1494,30 +1494,30 @@ discard block |
||
1494 | 1494 | } |
1495 | 1495 | $alldata = $pall; |
1496 | 1496 | foreach ($alldata as $number) { |
1497 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']); |
|
1497 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao']); |
|
1498 | 1498 | } |
1499 | 1499 | $Spotter = new Spotter($this->db); |
1500 | 1500 | $alldata = $Spotter->countAllMonthsByAirlines(); |
1501 | 1501 | $lastyear = false; |
1502 | 1502 | foreach ($alldata as $number) { |
1503 | 1503 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1504 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1504 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1505 | 1505 | } |
1506 | 1506 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
1507 | 1507 | foreach ($alldata as $number) { |
1508 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1508 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1509 | 1509 | } |
1510 | 1510 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
1511 | 1511 | foreach ($alldata as $number) { |
1512 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1512 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1513 | 1513 | } |
1514 | 1514 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
1515 | 1515 | foreach ($alldata as $number) { |
1516 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1516 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1517 | 1517 | } |
1518 | 1518 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
1519 | 1519 | foreach ($alldata as $number) { |
1520 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1520 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1521 | 1521 | } |
1522 | 1522 | echo '...Departure'."\n"; |
1523 | 1523 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1540,7 +1540,7 @@ discard block |
||
1540 | 1540 | } |
1541 | 1541 | $alldata = $pall; |
1542 | 1542 | foreach ($alldata as $number) { |
1543 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
|
1543 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']); |
|
1544 | 1544 | } |
1545 | 1545 | echo '...Arrival'."\n"; |
1546 | 1546 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1563,32 +1563,32 @@ discard block |
||
1563 | 1563 | } |
1564 | 1564 | $alldata = $pall; |
1565 | 1565 | foreach ($alldata as $number) { |
1566 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
|
1566 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']); |
|
1567 | 1567 | } |
1568 | 1568 | |
1569 | 1569 | echo 'Flights data...'."\n"; |
1570 | 1570 | echo '-> countAllDatesLastMonth...'."\n"; |
1571 | 1571 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
1572 | 1572 | foreach ($alldata as $number) { |
1573 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
1573 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1574 | 1574 | } |
1575 | 1575 | echo '-> countAllDates...'."\n"; |
1576 | 1576 | $previousdata = $this->countAllDatesByAirlines(); |
1577 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDatesByAirlines()); |
|
1577 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDatesByAirlines()); |
|
1578 | 1578 | $values = array(); |
1579 | 1579 | foreach ($alldata as $cnt) { |
1580 | 1580 | $values[] = $cnt['date_count']; |
1581 | 1581 | } |
1582 | - array_multisort($values,SORT_DESC,$alldata); |
|
1583 | - array_splice($alldata,11); |
|
1582 | + array_multisort($values, SORT_DESC, $alldata); |
|
1583 | + array_splice($alldata, 11); |
|
1584 | 1584 | foreach ($alldata as $number) { |
1585 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
1585 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1586 | 1586 | } |
1587 | 1587 | |
1588 | 1588 | echo '-> countAllHours...'."\n"; |
1589 | 1589 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
1590 | 1590 | foreach ($alldata as $number) { |
1591 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
1591 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
1592 | 1592 | } |
1593 | 1593 | |
1594 | 1594 | |
@@ -1599,16 +1599,16 @@ discard block |
||
1599 | 1599 | // SUM all previous month to put as year |
1600 | 1600 | $previous_year = date('Y'); |
1601 | 1601 | $previous_year--; |
1602 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1603 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1604 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1605 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1602 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1603 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1604 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1605 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1606 | 1606 | $allairlines = $this->getAllAirlineNames(); |
1607 | 1607 | foreach ($allairlines as $data) { |
1608 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1609 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1610 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1611 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1608 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1609 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1610 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1611 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1612 | 1612 | } |
1613 | 1613 | |
1614 | 1614 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -1617,7 +1617,7 @@ discard block |
||
1617 | 1617 | try { |
1618 | 1618 | $sth = $this->db->prepare($query); |
1619 | 1619 | $sth->execute(); |
1620 | - } catch(PDOException $e) { |
|
1620 | + } catch (PDOException $e) { |
|
1621 | 1621 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
1622 | 1622 | } |
1623 | 1623 | } |
@@ -1626,7 +1626,7 @@ discard block |
||
1626 | 1626 | try { |
1627 | 1627 | $sth = $this->db->prepare($query); |
1628 | 1628 | $sth->execute(); |
1629 | - } catch(PDOException $e) { |
|
1629 | + } catch (PDOException $e) { |
|
1630 | 1630 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
1631 | 1631 | } |
1632 | 1632 | } |
@@ -1648,7 +1648,7 @@ discard block |
||
1648 | 1648 | try { |
1649 | 1649 | $sth = $this->db->prepare($query); |
1650 | 1650 | $sth->execute(); |
1651 | - } catch(PDOException $e) { |
|
1651 | + } catch (PDOException $e) { |
|
1652 | 1652 | return "error : ".$e->getMessage(); |
1653 | 1653 | } |
1654 | 1654 | } |
@@ -1662,13 +1662,13 @@ discard block |
||
1662 | 1662 | try { |
1663 | 1663 | $sth = $this->db->prepare($query); |
1664 | 1664 | $sth->execute(); |
1665 | - } catch(PDOException $e) { |
|
1665 | + } catch (PDOException $e) { |
|
1666 | 1666 | return "error : ".$e->getMessage(); |
1667 | 1667 | } |
1668 | 1668 | } |
1669 | 1669 | echo 'Insert last stats update date...'."\n"; |
1670 | 1670 | date_default_timezone_set('UTC'); |
1671 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
1671 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
1672 | 1672 | //} |
1673 | 1673 | } |
1674 | 1674 | } |
@@ -11,185 +11,185 @@ discard block |
||
11 | 11 | public function __construct($dbc = null) { |
12 | 12 | $Connection = new Connection($dbc); |
13 | 13 | $this->db = $Connection->db(); |
14 | - } |
|
14 | + } |
|
15 | 15 | |
16 | 16 | public function addLastStatsUpdate($type,$stats_date) { |
17 | - $query = "DELETE FROM config WHERE name = :type; |
|
17 | + $query = "DELETE FROM config WHERE name = :type; |
|
18 | 18 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
19 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
20 | - try { |
|
21 | - $sth = $this->db->prepare($query); |
|
22 | - $sth->execute($query_values); |
|
23 | - } catch(PDOException $e) { |
|
24 | - return "error : ".$e->getMessage(); |
|
25 | - } |
|
26 | - } |
|
19 | + $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
20 | + try { |
|
21 | + $sth = $this->db->prepare($query); |
|
22 | + $sth->execute($query_values); |
|
23 | + } catch(PDOException $e) { |
|
24 | + return "error : ".$e->getMessage(); |
|
25 | + } |
|
26 | + } |
|
27 | 27 | |
28 | 28 | public function getLastStatsUpdate($type = 'last_update_stats') { |
29 | - $query = "SELECT value FROM config WHERE name = :type"; |
|
30 | - try { |
|
31 | - $sth = $this->db->prepare($query); |
|
32 | - $sth->execute(array(':type' => $type)); |
|
33 | - } catch(PDOException $e) { |
|
34 | - echo "error : ".$e->getMessage(); |
|
35 | - } |
|
36 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
37 | - return $all; |
|
38 | - } |
|
29 | + $query = "SELECT value FROM config WHERE name = :type"; |
|
30 | + try { |
|
31 | + $sth = $this->db->prepare($query); |
|
32 | + $sth->execute(array(':type' => $type)); |
|
33 | + } catch(PDOException $e) { |
|
34 | + echo "error : ".$e->getMessage(); |
|
35 | + } |
|
36 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
37 | + return $all; |
|
38 | + } |
|
39 | 39 | public function getAllAirlineNames() { |
40 | - $query = "SELECT * FROM stats_airline ORDER BY airline_name ASC"; |
|
41 | - try { |
|
42 | - $sth = $this->db->prepare($query); |
|
43 | - $sth->execute(); |
|
44 | - } catch(PDOException $e) { |
|
45 | - echo "error : ".$e->getMessage(); |
|
46 | - } |
|
47 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
48 | - return $all; |
|
49 | - } |
|
40 | + $query = "SELECT * FROM stats_airline ORDER BY airline_name ASC"; |
|
41 | + try { |
|
42 | + $sth = $this->db->prepare($query); |
|
43 | + $sth->execute(); |
|
44 | + } catch(PDOException $e) { |
|
45 | + echo "error : ".$e->getMessage(); |
|
46 | + } |
|
47 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
48 | + return $all; |
|
49 | + } |
|
50 | 50 | public function getAllAircraftTypes($stats_airline = '') { |
51 | - $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline ORDER BY aircraft_manufacturer ASC"; |
|
52 | - try { |
|
53 | - $sth = $this->db->prepare($query); |
|
54 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
55 | - } catch(PDOException $e) { |
|
56 | - echo "error : ".$e->getMessage(); |
|
57 | - } |
|
58 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
59 | - return $all; |
|
60 | - } |
|
51 | + $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline ORDER BY aircraft_manufacturer ASC"; |
|
52 | + try { |
|
53 | + $sth = $this->db->prepare($query); |
|
54 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
55 | + } catch(PDOException $e) { |
|
56 | + echo "error : ".$e->getMessage(); |
|
57 | + } |
|
58 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
59 | + return $all; |
|
60 | + } |
|
61 | 61 | public function getAllAirportNames($stats_airline = '') { |
62 | - $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
|
63 | - try { |
|
64 | - $sth = $this->db->prepare($query); |
|
65 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
66 | - } catch(PDOException $e) { |
|
67 | - echo "error : ".$e->getMessage(); |
|
68 | - } |
|
69 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
70 | - return $all; |
|
71 | - } |
|
62 | + $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
|
63 | + try { |
|
64 | + $sth = $this->db->prepare($query); |
|
65 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
66 | + } catch(PDOException $e) { |
|
67 | + echo "error : ".$e->getMessage(); |
|
68 | + } |
|
69 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
70 | + return $all; |
|
71 | + } |
|
72 | 72 | |
73 | 73 | |
74 | 74 | public function countAllAircraftTypes($limit = true, $stats_airline = '') { |
75 | 75 | if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
76 | 76 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline ORDER BY aircraft_icao_count DESC"; |
77 | - try { |
|
78 | - $sth = $this->db->prepare($query); |
|
79 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
80 | - } catch(PDOException $e) { |
|
81 | - echo "error : ".$e->getMessage(); |
|
82 | - } |
|
83 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
84 | - if (empty($all)) { |
|
85 | - $filters = array('airlines' => array($stats_airline)); |
|
86 | - $Spotter = new Spotter($this->db); |
|
87 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
88 | - } |
|
89 | - return $all; |
|
77 | + try { |
|
78 | + $sth = $this->db->prepare($query); |
|
79 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
80 | + } catch(PDOException $e) { |
|
81 | + echo "error : ".$e->getMessage(); |
|
82 | + } |
|
83 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
84 | + if (empty($all)) { |
|
85 | + $filters = array('airlines' => array($stats_airline)); |
|
86 | + $Spotter = new Spotter($this->db); |
|
87 | + $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
88 | + } |
|
89 | + return $all; |
|
90 | 90 | } |
91 | 91 | public function countAllAirlineCountries($limit = true) { |
92 | 92 | if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao AND GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
93 | 93 | else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao GROUP BY airline_country ORDER BY airline_country_count DESC"; |
94 | - try { |
|
95 | - $sth = $this->db->prepare($query); |
|
96 | - $sth->execute(); |
|
97 | - } catch(PDOException $e) { |
|
98 | - echo "error : ".$e->getMessage(); |
|
99 | - } |
|
100 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
101 | - if (empty($all)) { |
|
102 | - $Spotter = new Spotter($this->db); |
|
103 | - $all = $Spotter->countAllAirlineCountries($limit); |
|
94 | + try { |
|
95 | + $sth = $this->db->prepare($query); |
|
96 | + $sth->execute(); |
|
97 | + } catch(PDOException $e) { |
|
98 | + echo "error : ".$e->getMessage(); |
|
99 | + } |
|
100 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
101 | + if (empty($all)) { |
|
102 | + $Spotter = new Spotter($this->db); |
|
103 | + $all = $Spotter->countAllAirlineCountries($limit); |
|
104 | 104 | |
105 | - } |
|
106 | - return $all; |
|
105 | + } |
|
106 | + return $all; |
|
107 | 107 | } |
108 | 108 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '') { |
109 | 109 | if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
110 | 110 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
111 | - try { |
|
112 | - $sth = $this->db->prepare($query); |
|
113 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
114 | - } catch(PDOException $e) { |
|
115 | - echo "error : ".$e->getMessage(); |
|
116 | - } |
|
117 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
118 | - if (empty($all)) { |
|
119 | - $filters = array('airlines' => array($stats_airline)); |
|
120 | - $Spotter = new Spotter($this->db); |
|
111 | + try { |
|
112 | + $sth = $this->db->prepare($query); |
|
113 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
114 | + } catch(PDOException $e) { |
|
115 | + echo "error : ".$e->getMessage(); |
|
116 | + } |
|
117 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
118 | + if (empty($all)) { |
|
119 | + $filters = array('airlines' => array($stats_airline)); |
|
120 | + $Spotter = new Spotter($this->db); |
|
121 | 121 | $all = $Spotter->countAllAircraftManufacturers($filters); |
122 | - } |
|
123 | - return $all; |
|
122 | + } |
|
123 | + return $all; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | public function countAllArrivalCountries($limit = true, $stats_airline = '') { |
127 | 127 | if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
128 | 128 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
129 | - try { |
|
130 | - $sth = $this->db->prepare($query); |
|
131 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
132 | - } catch(PDOException $e) { |
|
133 | - echo "error : ".$e->getMessage(); |
|
134 | - } |
|
135 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
136 | - if (empty($all)) { |
|
129 | + try { |
|
130 | + $sth = $this->db->prepare($query); |
|
131 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
132 | + } catch(PDOException $e) { |
|
133 | + echo "error : ".$e->getMessage(); |
|
134 | + } |
|
135 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
136 | + if (empty($all)) { |
|
137 | 137 | $filters = array('airlines' => array($stats_airline)); |
138 | 138 | $Spotter = new Spotter($this->db); |
139 | 139 | $all = $Spotter->countAllArrivalCountries($limit,$filters); |
140 | - } |
|
141 | - return $all; |
|
140 | + } |
|
141 | + return $all; |
|
142 | 142 | } |
143 | 143 | public function countAllDepartureCountries($limit = true, $stats_airline = '') { |
144 | 144 | if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
145 | 145 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
146 | - try { |
|
147 | - $sth = $this->db->prepare($query); |
|
148 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
149 | - } catch(PDOException $e) { |
|
150 | - echo "error : ".$e->getMessage(); |
|
151 | - } |
|
152 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
153 | - if (empty($all)) { |
|
146 | + try { |
|
147 | + $sth = $this->db->prepare($query); |
|
148 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
149 | + } catch(PDOException $e) { |
|
150 | + echo "error : ".$e->getMessage(); |
|
151 | + } |
|
152 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
153 | + if (empty($all)) { |
|
154 | 154 | $filters = array('airlines' => array($stats_airline)); |
155 | 155 | $Spotter = new Spotter($this->db); |
156 | 156 | $all = $Spotter->countAllDepartureCountries($filters); |
157 | - } |
|
158 | - return $all; |
|
157 | + } |
|
158 | + return $all; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | public function countAllAirlines($limit = true) { |
162 | 162 | if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
163 | 163 | else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao ORDER BY airline_count DESC"; |
164 | - try { |
|
165 | - $sth = $this->db->prepare($query); |
|
166 | - $sth->execute(); |
|
167 | - } catch(PDOException $e) { |
|
168 | - echo "error : ".$e->getMessage(); |
|
169 | - } |
|
170 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
171 | - if (empty($all)) { |
|
172 | - $Spotter = new Spotter($this->db); |
|
173 | - $all = $Spotter->countAllAirlines($limit); |
|
174 | - } |
|
175 | - return $all; |
|
164 | + try { |
|
165 | + $sth = $this->db->prepare($query); |
|
166 | + $sth->execute(); |
|
167 | + } catch(PDOException $e) { |
|
168 | + echo "error : ".$e->getMessage(); |
|
169 | + } |
|
170 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
171 | + if (empty($all)) { |
|
172 | + $Spotter = new Spotter($this->db); |
|
173 | + $all = $Spotter->countAllAirlines($limit); |
|
174 | + } |
|
175 | + return $all; |
|
176 | 176 | } |
177 | 177 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '') { |
178 | 178 | if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
179 | 179 | else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline ORDER BY aircraft_registration_count DESC"; |
180 | - try { |
|
181 | - $sth = $this->db->prepare($query); |
|
182 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
183 | - } catch(PDOException $e) { |
|
184 | - echo "error : ".$e->getMessage(); |
|
185 | - } |
|
186 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
187 | - if (empty($all)) { |
|
180 | + try { |
|
181 | + $sth = $this->db->prepare($query); |
|
182 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
183 | + } catch(PDOException $e) { |
|
184 | + echo "error : ".$e->getMessage(); |
|
185 | + } |
|
186 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
187 | + if (empty($all)) { |
|
188 | 188 | $filters = array('airlines' => array($stats_airline)); |
189 | - $Spotter = new Spotter($this->db); |
|
190 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
191 | - } |
|
192 | - return $all; |
|
189 | + $Spotter = new Spotter($this->db); |
|
190 | + $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
191 | + } |
|
192 | + return $all; |
|
193 | 193 | } |
194 | 194 | public function countAllCallsigns($limit = true,$stats_airline = '') { |
195 | 195 | if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | echo "error : ".$e->getMessage(); |
221 | 221 | } |
222 | 222 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
223 | - /* |
|
223 | + /* |
|
224 | 224 | if (empty($all)) { |
225 | 225 | $Spotter = new Spotter($this->db); |
226 | 226 | $all = $Spotter->countAllFlightOverCountries($limit); |
@@ -234,71 +234,71 @@ discard block |
||
234 | 234 | public function countAllPilots($limit = true,$stats_airline = '') { |
235 | 235 | if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
236 | 236 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline ORDER BY pilot_count DESC"; |
237 | - try { |
|
238 | - $sth = $this->db->prepare($query); |
|
239 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
240 | - } catch(PDOException $e) { |
|
241 | - echo "error : ".$e->getMessage(); |
|
242 | - } |
|
243 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
244 | - if (empty($all)) { |
|
237 | + try { |
|
238 | + $sth = $this->db->prepare($query); |
|
239 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
240 | + } catch(PDOException $e) { |
|
241 | + echo "error : ".$e->getMessage(); |
|
242 | + } |
|
243 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
244 | + if (empty($all)) { |
|
245 | 245 | $filters = array('airlines' => array($stats_airline)); |
246 | - $Spotter = new Spotter($this->db); |
|
247 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
248 | - } |
|
249 | - return $all; |
|
246 | + $Spotter = new Spotter($this->db); |
|
247 | + $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
248 | + } |
|
249 | + return $all; |
|
250 | 250 | } |
251 | 251 | public function countAllOwners($limit = true,$stats_airline = '') { |
252 | 252 | if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
253 | 253 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline ORDER BY owner_count DESC"; |
254 | - try { |
|
255 | - $sth = $this->db->prepare($query); |
|
256 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
257 | - } catch(PDOException $e) { |
|
258 | - echo "error : ".$e->getMessage(); |
|
259 | - } |
|
260 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
261 | - if (empty($all)) { |
|
254 | + try { |
|
255 | + $sth = $this->db->prepare($query); |
|
256 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
257 | + } catch(PDOException $e) { |
|
258 | + echo "error : ".$e->getMessage(); |
|
259 | + } |
|
260 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
261 | + if (empty($all)) { |
|
262 | 262 | $filters = array('airlines' => array($stats_airline)); |
263 | - $Spotter = new Spotter($this->db); |
|
264 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
265 | - } |
|
266 | - return $all; |
|
263 | + $Spotter = new Spotter($this->db); |
|
264 | + $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
265 | + } |
|
266 | + return $all; |
|
267 | 267 | } |
268 | 268 | public function countAllDepartureAirports($limit = true,$stats_airline = '') { |
269 | 269 | if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
270 | 270 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_departure_icao_count DESC"; |
271 | - try { |
|
272 | - $sth = $this->db->prepare($query); |
|
273 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
274 | - } catch(PDOException $e) { |
|
275 | - echo "error : ".$e->getMessage(); |
|
276 | - } |
|
277 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
278 | - if (empty($all)) { |
|
271 | + try { |
|
272 | + $sth = $this->db->prepare($query); |
|
273 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
274 | + } catch(PDOException $e) { |
|
275 | + echo "error : ".$e->getMessage(); |
|
276 | + } |
|
277 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
278 | + if (empty($all)) { |
|
279 | 279 | $filters = array('airlines' => array($stats_airline)); |
280 | - $Spotter = new Spotter($this->db); |
|
281 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
282 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
283 | - $all = array(); |
|
284 | - foreach ($pall as $value) { |
|
285 | - $icao = $value['airport_departure_icao']; |
|
286 | - $all[$icao] = $value; |
|
287 | - } |
|
280 | + $Spotter = new Spotter($this->db); |
|
281 | + $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
282 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
283 | + $all = array(); |
|
284 | + foreach ($pall as $value) { |
|
285 | + $icao = $value['airport_departure_icao']; |
|
286 | + $all[$icao] = $value; |
|
287 | + } |
|
288 | 288 | |
289 | - foreach ($dall as $value) { |
|
290 | - $icao = $value['airport_departure_icao']; |
|
291 | - if (isset($all[$icao])) { |
|
292 | - $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
293 | - } else $all[$icao] = $value; |
|
294 | - } |
|
295 | - $count = array(); |
|
296 | - foreach ($all as $key => $row) { |
|
297 | - $count[$key] = $row['airport_departure_icao_count']; |
|
298 | - } |
|
299 | - array_multisort($count,SORT_DESC,$all); |
|
300 | - } |
|
301 | - return $all; |
|
289 | + foreach ($dall as $value) { |
|
290 | + $icao = $value['airport_departure_icao']; |
|
291 | + if (isset($all[$icao])) { |
|
292 | + $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
293 | + } else $all[$icao] = $value; |
|
294 | + } |
|
295 | + $count = array(); |
|
296 | + foreach ($all as $key => $row) { |
|
297 | + $count[$key] = $row['airport_departure_icao_count']; |
|
298 | + } |
|
299 | + array_multisort($count,SORT_DESC,$all); |
|
300 | + } |
|
301 | + return $all; |
|
302 | 302 | } |
303 | 303 | public function countAllArrivalAirports($limit = true,$stats_airline = '') { |
304 | 304 | if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
@@ -315,26 +315,26 @@ discard block |
||
315 | 315 | $Spotter = new Spotter($this->db); |
316 | 316 | $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
317 | 317 | $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
318 | - $all = array(); |
|
319 | - foreach ($pall as $value) { |
|
320 | - $icao = $value['airport_arrival_icao']; |
|
321 | - $all[$icao] = $value; |
|
322 | - } |
|
318 | + $all = array(); |
|
319 | + foreach ($pall as $value) { |
|
320 | + $icao = $value['airport_arrival_icao']; |
|
321 | + $all[$icao] = $value; |
|
322 | + } |
|
323 | 323 | |
324 | - foreach ($dall as $value) { |
|
325 | - $icao = $value['airport_arrival_icao']; |
|
326 | - if (isset($all[$icao])) { |
|
327 | - $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
328 | - } else $all[$icao] = $value; |
|
329 | - } |
|
330 | - $count = array(); |
|
331 | - foreach ($all as $key => $row) { |
|
332 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
333 | - } |
|
334 | - array_multisort($count,SORT_DESC,$all); |
|
335 | - } |
|
324 | + foreach ($dall as $value) { |
|
325 | + $icao = $value['airport_arrival_icao']; |
|
326 | + if (isset($all[$icao])) { |
|
327 | + $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
328 | + } else $all[$icao] = $value; |
|
329 | + } |
|
330 | + $count = array(); |
|
331 | + foreach ($all as $key => $row) { |
|
332 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
333 | + } |
|
334 | + array_multisort($count,SORT_DESC,$all); |
|
335 | + } |
|
336 | 336 | |
337 | - return $all; |
|
337 | + return $all; |
|
338 | 338 | } |
339 | 339 | public function countAllMonthsLastYear($limit = true,$stats_airline = '') { |
340 | 340 | global $globalDBdriver; |
@@ -346,38 +346,38 @@ discard block |
||
346 | 346 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline"; |
347 | 347 | } |
348 | 348 | $query_data = array(':stats_airline' => $stats_airline); |
349 | - try { |
|
350 | - $sth = $this->db->prepare($query); |
|
351 | - $sth->execute($query_data); |
|
352 | - } catch(PDOException $e) { |
|
353 | - echo "error : ".$e->getMessage(); |
|
354 | - } |
|
355 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
356 | - if (empty($all)) { |
|
349 | + try { |
|
350 | + $sth = $this->db->prepare($query); |
|
351 | + $sth->execute($query_data); |
|
352 | + } catch(PDOException $e) { |
|
353 | + echo "error : ".$e->getMessage(); |
|
354 | + } |
|
355 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
356 | + if (empty($all)) { |
|
357 | 357 | $filters = array('airlines' => array($stats_airline)); |
358 | - $Spotter = new Spotter($this->db); |
|
359 | - $all = $Spotter->countAllMonthsLastYear($filters); |
|
360 | - } |
|
358 | + $Spotter = new Spotter($this->db); |
|
359 | + $all = $Spotter->countAllMonthsLastYear($filters); |
|
360 | + } |
|
361 | 361 | |
362 | - return $all; |
|
362 | + return $all; |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | public function countAllDatesLastMonth($stats_airline = '') { |
366 | 366 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline"; |
367 | 367 | $query_data = array(':stats_airline' => $stats_airline); |
368 | - try { |
|
369 | - $sth = $this->db->prepare($query); |
|
370 | - $sth->execute($query_data); |
|
371 | - } catch(PDOException $e) { |
|
372 | - echo "error : ".$e->getMessage(); |
|
373 | - } |
|
374 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
375 | - if (empty($all)) { |
|
368 | + try { |
|
369 | + $sth = $this->db->prepare($query); |
|
370 | + $sth->execute($query_data); |
|
371 | + } catch(PDOException $e) { |
|
372 | + echo "error : ".$e->getMessage(); |
|
373 | + } |
|
374 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
375 | + if (empty($all)) { |
|
376 | 376 | $filters = array('airlines' => array($stats_airline)); |
377 | - $Spotter = new Spotter($this->db); |
|
378 | - $all = $Spotter->countAllDatesLastMonth($filters); |
|
379 | - } |
|
380 | - return $all; |
|
377 | + $Spotter = new Spotter($this->db); |
|
378 | + $all = $Spotter->countAllDatesLastMonth($filters); |
|
379 | + } |
|
380 | + return $all; |
|
381 | 381 | } |
382 | 382 | public function countAllDatesLast7Days($stats_airline = '') { |
383 | 383 | global $globalDBdriver; |
@@ -387,83 +387,83 @@ discard block |
||
387 | 387 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline"; |
388 | 388 | } |
389 | 389 | $query_data = array(':stats_airline' => $stats_airline); |
390 | - try { |
|
391 | - $sth = $this->db->prepare($query); |
|
392 | - $sth->execute($query_data); |
|
393 | - } catch(PDOException $e) { |
|
394 | - echo "error : ".$e->getMessage(); |
|
395 | - } |
|
396 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
397 | - if (empty($all)) { |
|
390 | + try { |
|
391 | + $sth = $this->db->prepare($query); |
|
392 | + $sth->execute($query_data); |
|
393 | + } catch(PDOException $e) { |
|
394 | + echo "error : ".$e->getMessage(); |
|
395 | + } |
|
396 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
397 | + if (empty($all)) { |
|
398 | 398 | $filters = array('airlines' => array($stats_airline)); |
399 | - $Spotter = new Spotter($this->db); |
|
400 | - $all = $Spotter->countAllDatesLast7Days($filters); |
|
401 | - } |
|
402 | - return $all; |
|
399 | + $Spotter = new Spotter($this->db); |
|
400 | + $all = $Spotter->countAllDatesLast7Days($filters); |
|
401 | + } |
|
402 | + return $all; |
|
403 | 403 | } |
404 | 404 | public function countAllDates($stats_airline = '') { |
405 | 405 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline"; |
406 | 406 | $query_data = array(':stats_airline' => $stats_airline); |
407 | - try { |
|
408 | - $sth = $this->db->prepare($query); |
|
409 | - $sth->execute($query_data); |
|
410 | - } catch(PDOException $e) { |
|
411 | - echo "error : ".$e->getMessage(); |
|
412 | - } |
|
413 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
414 | - if (empty($all)) { |
|
407 | + try { |
|
408 | + $sth = $this->db->prepare($query); |
|
409 | + $sth->execute($query_data); |
|
410 | + } catch(PDOException $e) { |
|
411 | + echo "error : ".$e->getMessage(); |
|
412 | + } |
|
413 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
414 | + if (empty($all)) { |
|
415 | 415 | $filters = array('airlines' => array($stats_airline)); |
416 | - $Spotter = new Spotter($this->db); |
|
417 | - $all = $Spotter->countAllDates($filters); |
|
418 | - } |
|
419 | - return $all; |
|
416 | + $Spotter = new Spotter($this->db); |
|
417 | + $all = $Spotter->countAllDates($filters); |
|
418 | + } |
|
419 | + return $all; |
|
420 | 420 | } |
421 | 421 | public function countAllDatesByAirlines() { |
422 | 422 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date'"; |
423 | 423 | $query_data = array(); |
424 | - try { |
|
425 | - $sth = $this->db->prepare($query); |
|
426 | - $sth->execute($query_data); |
|
427 | - } catch(PDOException $e) { |
|
428 | - echo "error : ".$e->getMessage(); |
|
429 | - } |
|
430 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
431 | - if (empty($all)) { |
|
432 | - $Spotter = new Spotter($this->db); |
|
433 | - $all = $Spotter->countAllDatesByAirlines(); |
|
434 | - } |
|
435 | - return $all; |
|
424 | + try { |
|
425 | + $sth = $this->db->prepare($query); |
|
426 | + $sth->execute($query_data); |
|
427 | + } catch(PDOException $e) { |
|
428 | + echo "error : ".$e->getMessage(); |
|
429 | + } |
|
430 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
431 | + if (empty($all)) { |
|
432 | + $Spotter = new Spotter($this->db); |
|
433 | + $all = $Spotter->countAllDatesByAirlines(); |
|
434 | + } |
|
435 | + return $all; |
|
436 | 436 | } |
437 | 437 | public function countAllMonths($stats_airline = '') { |
438 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline"; |
|
439 | - try { |
|
440 | - $sth = $this->db->prepare($query); |
|
441 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
442 | - } catch(PDOException $e) { |
|
443 | - echo "error : ".$e->getMessage(); |
|
444 | - } |
|
445 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
446 | - if (empty($all)) { |
|
438 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline"; |
|
439 | + try { |
|
440 | + $sth = $this->db->prepare($query); |
|
441 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
442 | + } catch(PDOException $e) { |
|
443 | + echo "error : ".$e->getMessage(); |
|
444 | + } |
|
445 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
446 | + if (empty($all)) { |
|
447 | 447 | $filters = array('airlines' => array($stats_airline)); |
448 | - $Spotter = new Spotter($this->db); |
|
449 | - $all = $Spotter->countAllMonths($filters); |
|
450 | - } |
|
451 | - return $all; |
|
448 | + $Spotter = new Spotter($this->db); |
|
449 | + $all = $Spotter->countAllMonths($filters); |
|
450 | + } |
|
451 | + return $all; |
|
452 | 452 | } |
453 | 453 | public function countAllMilitaryMonths() { |
454 | - $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth'"; |
|
455 | - try { |
|
456 | - $sth = $this->db->prepare($query); |
|
457 | - $sth->execute(); |
|
458 | - } catch(PDOException $e) { |
|
459 | - echo "error : ".$e->getMessage(); |
|
460 | - } |
|
461 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
462 | - if (empty($all)) { |
|
463 | - $Spotter = new Spotter($this->db); |
|
464 | - $all = $Spotter->countAllMilitaryMonths(); |
|
465 | - } |
|
466 | - return $all; |
|
454 | + $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'military_flights_bymonth'"; |
|
455 | + try { |
|
456 | + $sth = $this->db->prepare($query); |
|
457 | + $sth->execute(); |
|
458 | + } catch(PDOException $e) { |
|
459 | + echo "error : ".$e->getMessage(); |
|
460 | + } |
|
461 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
462 | + if (empty($all)) { |
|
463 | + $Spotter = new Spotter($this->db); |
|
464 | + $all = $Spotter->countAllMilitaryMonths(); |
|
465 | + } |
|
466 | + return $all; |
|
467 | 467 | } |
468 | 468 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '') { |
469 | 469 | global $globalTimezone, $globalDBdriver; |
@@ -478,19 +478,19 @@ discard block |
||
478 | 478 | } |
479 | 479 | } |
480 | 480 | if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
481 | - try { |
|
482 | - $sth = $this->db->prepare($query); |
|
483 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
484 | - } catch(PDOException $e) { |
|
485 | - echo "error : ".$e->getMessage(); |
|
486 | - } |
|
487 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
488 | - if (empty($all)) { |
|
481 | + try { |
|
482 | + $sth = $this->db->prepare($query); |
|
483 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
484 | + } catch(PDOException $e) { |
|
485 | + echo "error : ".$e->getMessage(); |
|
486 | + } |
|
487 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
488 | + if (empty($all)) { |
|
489 | 489 | $filters = array('airlines' => array($stats_airline)); |
490 | - $Spotter = new Spotter($this->db); |
|
491 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
492 | - } |
|
493 | - return $all; |
|
490 | + $Spotter = new Spotter($this->db); |
|
491 | + $all = $Spotter->countAllHours($orderby,$filters); |
|
492 | + } |
|
493 | + return $all; |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | public function countOverallFlights($stats_airline = '') { |
@@ -530,14 +530,14 @@ discard block |
||
530 | 530 | } |
531 | 531 | public function countOverallAirlines() { |
532 | 532 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline"; |
533 | - try { |
|
534 | - $sth = $this->db->prepare($query); |
|
535 | - $sth->execute(); |
|
536 | - } catch(PDOException $e) { |
|
537 | - echo "error : ".$e->getMessage(); |
|
538 | - } |
|
539 | - $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
540 | - $all = $result[0]['nb_airline']; |
|
533 | + try { |
|
534 | + $sth = $this->db->prepare($query); |
|
535 | + $sth->execute(); |
|
536 | + } catch(PDOException $e) { |
|
537 | + echo "error : ".$e->getMessage(); |
|
538 | + } |
|
539 | + $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
540 | + $all = $result[0]['nb_airline']; |
|
541 | 541 | //$all = $this->getSumStats('airlines_bymonth',date('Y')); |
542 | 542 | if (empty($all)) { |
543 | 543 | $Spotter = new Spotter($this->db); |
@@ -578,157 +578,157 @@ discard block |
||
578 | 578 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '') { |
579 | 579 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline ORDER BY date"; |
580 | 580 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline); |
581 | - try { |
|
582 | - $sth = $this->db->prepare($query); |
|
583 | - $sth->execute($query_values); |
|
584 | - } catch(PDOException $e) { |
|
585 | - echo "error : ".$e->getMessage(); |
|
586 | - } |
|
587 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
588 | - return $all; |
|
581 | + try { |
|
582 | + $sth = $this->db->prepare($query); |
|
583 | + $sth->execute($query_values); |
|
584 | + } catch(PDOException $e) { |
|
585 | + echo "error : ".$e->getMessage(); |
|
586 | + } |
|
587 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
588 | + return $all; |
|
589 | 589 | } |
590 | 590 | public function getStats($type,$stats_airline = '') { |
591 | - $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline ORDER BY stats_date"; |
|
592 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline); |
|
593 | - try { |
|
594 | - $sth = $this->db->prepare($query); |
|
595 | - $sth->execute($query_values); |
|
596 | - } catch(PDOException $e) { |
|
597 | - echo "error : ".$e->getMessage(); |
|
598 | - } |
|
599 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
600 | - return $all; |
|
601 | - } |
|
591 | + $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline ORDER BY stats_date"; |
|
592 | + $query_values = array(':type' => $type,':stats_airline' => $stats_airline); |
|
593 | + try { |
|
594 | + $sth = $this->db->prepare($query); |
|
595 | + $sth->execute($query_values); |
|
596 | + } catch(PDOException $e) { |
|
597 | + echo "error : ".$e->getMessage(); |
|
598 | + } |
|
599 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
600 | + return $all; |
|
601 | + } |
|
602 | 602 | public function getSumStats($type,$year,$stats_airline = '') { |
603 | - global $globalArchiveMonths, $globalDBdriver; |
|
604 | - if ($globalDBdriver == 'mysql') { |
|
605 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline"; |
|
606 | - } else { |
|
607 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline"; |
|
608 | - } |
|
609 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline); |
|
610 | - try { |
|
611 | - $sth = $this->db->prepare($query); |
|
612 | - $sth->execute($query_values); |
|
613 | - } catch(PDOException $e) { |
|
614 | - echo "error : ".$e->getMessage(); |
|
615 | - } |
|
616 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
617 | - return $all[0]['total']; |
|
618 | - } |
|
603 | + global $globalArchiveMonths, $globalDBdriver; |
|
604 | + if ($globalDBdriver == 'mysql') { |
|
605 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline"; |
|
606 | + } else { |
|
607 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline"; |
|
608 | + } |
|
609 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline); |
|
610 | + try { |
|
611 | + $sth = $this->db->prepare($query); |
|
612 | + $sth->execute($query_values); |
|
613 | + } catch(PDOException $e) { |
|
614 | + echo "error : ".$e->getMessage(); |
|
615 | + } |
|
616 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
617 | + return $all[0]['total']; |
|
618 | + } |
|
619 | 619 | public function getStatsTotal($type, $stats_airline = '') { |
620 | - global $globalArchiveMonths, $globalDBdriver; |
|
621 | - if ($globalDBdriver == 'mysql') { |
|
620 | + global $globalArchiveMonths, $globalDBdriver; |
|
621 | + if ($globalDBdriver == 'mysql') { |
|
622 | 622 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL ".$globalArchiveMonths." MONTH) AND stats_airline = :stats_airline"; |
623 | 623 | } else { |
624 | 624 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND stats_date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveMonths." MONTHS' AND stats_airline = :stats_airline"; |
625 | - } |
|
626 | - $query_values = array(':type' => $type, ':stats_airline' => $stats_airline); |
|
627 | - try { |
|
628 | - $sth = $this->db->prepare($query); |
|
629 | - $sth->execute($query_values); |
|
630 | - } catch(PDOException $e) { |
|
631 | - echo "error : ".$e->getMessage(); |
|
632 | - } |
|
633 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
634 | - return $all[0]['total']; |
|
635 | - } |
|
625 | + } |
|
626 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline); |
|
627 | + try { |
|
628 | + $sth = $this->db->prepare($query); |
|
629 | + $sth->execute($query_values); |
|
630 | + } catch(PDOException $e) { |
|
631 | + echo "error : ".$e->getMessage(); |
|
632 | + } |
|
633 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
634 | + return $all[0]['total']; |
|
635 | + } |
|
636 | 636 | public function getStatsAircraftTotal($stats_airline = '') { |
637 | - global $globalArchiveMonths, $globalDBdriver; |
|
638 | - if ($globalDBdriver == 'mysql') { |
|
637 | + global $globalArchiveMonths, $globalDBdriver; |
|
638 | + if ($globalDBdriver == 'mysql') { |
|
639 | 639 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline"; |
640 | - } else { |
|
640 | + } else { |
|
641 | 641 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline"; |
642 | - } |
|
643 | - try { |
|
644 | - $sth = $this->db->prepare($query); |
|
645 | - $sth->execute(array(':stats_airline' => $stats_airline)); |
|
646 | - } catch(PDOException $e) { |
|
647 | - echo "error : ".$e->getMessage(); |
|
648 | - } |
|
649 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
650 | - return $all[0]['total']; |
|
651 | - } |
|
642 | + } |
|
643 | + try { |
|
644 | + $sth = $this->db->prepare($query); |
|
645 | + $sth->execute(array(':stats_airline' => $stats_airline)); |
|
646 | + } catch(PDOException $e) { |
|
647 | + echo "error : ".$e->getMessage(); |
|
648 | + } |
|
649 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
650 | + return $all[0]['total']; |
|
651 | + } |
|
652 | 652 | public function getStatsAirlineTotal() { |
653 | - global $globalArchiveMonths, $globalDBdriver; |
|
654 | - if ($globalDBdriver == 'mysql') { |
|
653 | + global $globalArchiveMonths, $globalDBdriver; |
|
654 | + if ($globalDBdriver == 'mysql') { |
|
655 | 655 | $query = "SELECT SUM(cnt) as total FROM stats_airline"; |
656 | - } else { |
|
656 | + } else { |
|
657 | 657 | $query = "SELECT SUM(cnt) as total FROM stats_airline"; |
658 | - } |
|
659 | - try { |
|
660 | - $sth = $this->db->prepare($query); |
|
661 | - $sth->execute(); |
|
662 | - } catch(PDOException $e) { |
|
663 | - echo "error : ".$e->getMessage(); |
|
664 | - } |
|
665 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
666 | - return $all[0]['total']; |
|
667 | - } |
|
658 | + } |
|
659 | + try { |
|
660 | + $sth = $this->db->prepare($query); |
|
661 | + $sth->execute(); |
|
662 | + } catch(PDOException $e) { |
|
663 | + echo "error : ".$e->getMessage(); |
|
664 | + } |
|
665 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
666 | + return $all[0]['total']; |
|
667 | + } |
|
668 | 668 | public function getStatsOwnerTotal() { |
669 | - global $globalArchiveMonths, $globalDBdriver; |
|
670 | - if ($globalDBdriver == 'mysql') { |
|
669 | + global $globalArchiveMonths, $globalDBdriver; |
|
670 | + if ($globalDBdriver == 'mysql') { |
|
671 | 671 | $query = "SELECT SUM(cnt) as total FROM stats_owner"; |
672 | 672 | } else { |
673 | 673 | $query = "SELECT SUM(cnt) as total FROM stats_owner"; |
674 | - } |
|
675 | - try { |
|
676 | - $sth = $this->db->prepare($query); |
|
677 | - $sth->execute(); |
|
678 | - } catch(PDOException $e) { |
|
679 | - echo "error : ".$e->getMessage(); |
|
680 | - } |
|
681 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
682 | - return $all[0]['total']; |
|
683 | - } |
|
674 | + } |
|
675 | + try { |
|
676 | + $sth = $this->db->prepare($query); |
|
677 | + $sth->execute(); |
|
678 | + } catch(PDOException $e) { |
|
679 | + echo "error : ".$e->getMessage(); |
|
680 | + } |
|
681 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
682 | + return $all[0]['total']; |
|
683 | + } |
|
684 | 684 | public function getStatsPilotTotal() { |
685 | - global $globalArchiveMonths, $globalDBdriver; |
|
686 | - if ($globalDBdriver == 'mysql') { |
|
687 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot"; |
|
688 | - } else { |
|
689 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot"; |
|
690 | - } |
|
691 | - try { |
|
692 | - $sth = $this->db->prepare($query); |
|
693 | - $sth->execute(); |
|
694 | - } catch(PDOException $e) { |
|
695 | - echo "error : ".$e->getMessage(); |
|
696 | - } |
|
697 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
698 | - return $all[0]['total']; |
|
699 | - } |
|
685 | + global $globalArchiveMonths, $globalDBdriver; |
|
686 | + if ($globalDBdriver == 'mysql') { |
|
687 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot"; |
|
688 | + } else { |
|
689 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot"; |
|
690 | + } |
|
691 | + try { |
|
692 | + $sth = $this->db->prepare($query); |
|
693 | + $sth->execute(); |
|
694 | + } catch(PDOException $e) { |
|
695 | + echo "error : ".$e->getMessage(); |
|
696 | + } |
|
697 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
698 | + return $all[0]['total']; |
|
699 | + } |
|
700 | 700 | |
701 | 701 | public function addStat($type,$cnt,$stats_date,$stats_airline = '') { |
702 | 702 | global $globalDBdriver; |
703 | 703 | if ($globalDBdriver == 'mysql') { |
704 | 704 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline) VALUES (:type,:cnt,:stats_date,:stats_airline) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
705 | - } else { |
|
705 | + } else { |
|
706 | 706 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline) SELECT :type,:cnt,:stats_date,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline);"; |
707 | 707 | } |
708 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline); |
|
709 | - try { |
|
710 | - $sth = $this->db->prepare($query); |
|
711 | - $sth->execute($query_values); |
|
712 | - } catch(PDOException $e) { |
|
713 | - return "error : ".$e->getMessage(); |
|
714 | - } |
|
715 | - } |
|
708 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline); |
|
709 | + try { |
|
710 | + $sth = $this->db->prepare($query); |
|
711 | + $sth->execute($query_values); |
|
712 | + } catch(PDOException $e) { |
|
713 | + return "error : ".$e->getMessage(); |
|
714 | + } |
|
715 | + } |
|
716 | 716 | public function updateStat($type,$cnt,$stats_date) { |
717 | 717 | global $globalDBdriver; |
718 | 718 | if ($globalDBdriver == 'mysql') { |
719 | 719 | $query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
720 | 720 | } else { |
721 | - //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
721 | + //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
722 | 722 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date; INSERT INTO stats (stats_type,cnt,stats_date) SELECT :type,:cnt,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date);"; |
723 | - } |
|
724 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date); |
|
725 | - try { |
|
726 | - $sth = $this->db->prepare($query); |
|
727 | - $sth->execute($query_values); |
|
728 | - } catch(PDOException $e) { |
|
729 | - return "error : ".$e->getMessage(); |
|
730 | - } |
|
731 | - } |
|
723 | + } |
|
724 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date); |
|
725 | + try { |
|
726 | + $sth = $this->db->prepare($query); |
|
727 | + $sth->execute($query_values); |
|
728 | + } catch(PDOException $e) { |
|
729 | + return "error : ".$e->getMessage(); |
|
730 | + } |
|
731 | + } |
|
732 | 732 | public function getStatsSource($date,$stats_type = '') { |
733 | 733 | if ($stats_type == '') { |
734 | 734 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
@@ -737,15 +737,15 @@ discard block |
||
737 | 737 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
738 | 738 | $query_values = array(':date' => $date,':stats_type' => $stats_type); |
739 | 739 | } |
740 | - try { |
|
741 | - $sth = $this->db->prepare($query); |
|
742 | - $sth->execute($query_values); |
|
743 | - } catch(PDOException $e) { |
|
744 | - echo "error : ".$e->getMessage(); |
|
745 | - } |
|
746 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
747 | - return $all; |
|
748 | - } |
|
740 | + try { |
|
741 | + $sth = $this->db->prepare($query); |
|
742 | + $sth->execute($query_values); |
|
743 | + } catch(PDOException $e) { |
|
744 | + echo "error : ".$e->getMessage(); |
|
745 | + } |
|
746 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
747 | + return $all; |
|
748 | + } |
|
749 | 749 | |
750 | 750 | public function addStatSource($data,$source_name,$stats_type,$date) { |
751 | 751 | global $globalDBdriver; |
@@ -753,25 +753,25 @@ discard block |
||
753 | 753 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
754 | 754 | } else { |
755 | 755 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
756 | - } |
|
757 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
758 | - try { |
|
759 | - $sth = $this->db->prepare($query); |
|
760 | - $sth->execute($query_values); |
|
761 | - } catch(PDOException $e) { |
|
762 | - return "error : ".$e->getMessage(); |
|
763 | - } |
|
764 | - } |
|
756 | + } |
|
757 | + $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
758 | + try { |
|
759 | + $sth = $this->db->prepare($query); |
|
760 | + $sth->execute($query_values); |
|
761 | + } catch(PDOException $e) { |
|
762 | + return "error : ".$e->getMessage(); |
|
763 | + } |
|
764 | + } |
|
765 | 765 | public function addStatFlight($type,$date_name,$cnt,$stats_airline = '') { |
766 | - $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline) VALUES (:type,:flight_date,:cnt,:stats_airline)"; |
|
767 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline); |
|
768 | - try { |
|
769 | - $sth = $this->db->prepare($query); |
|
770 | - $sth->execute($query_values); |
|
771 | - } catch(PDOException $e) { |
|
772 | - return "error : ".$e->getMessage(); |
|
773 | - } |
|
774 | - } |
|
766 | + $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline) VALUES (:type,:flight_date,:cnt,:stats_airline)"; |
|
767 | + $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline); |
|
768 | + try { |
|
769 | + $sth = $this->db->prepare($query); |
|
770 | + $sth->execute($query_values); |
|
771 | + } catch(PDOException $e) { |
|
772 | + return "error : ".$e->getMessage(); |
|
773 | + } |
|
774 | + } |
|
775 | 775 | public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '') { |
776 | 776 | global $globalDBdriver; |
777 | 777 | if ($globalDBdriver == 'mysql') { |
@@ -779,14 +779,14 @@ discard block |
||
779 | 779 | } else { |
780 | 780 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline) SELECT :aircraft_icao,:registration,:cnt,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline);"; |
781 | 781 | } |
782 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao); |
|
783 | - try { |
|
784 | - $sth = $this->db->prepare($query); |
|
785 | - $sth->execute($query_values); |
|
786 | - } catch(PDOException $e) { |
|
787 | - return "error : ".$e->getMessage(); |
|
788 | - } |
|
789 | - } |
|
782 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao); |
|
783 | + try { |
|
784 | + $sth = $this->db->prepare($query); |
|
785 | + $sth->execute($query_values); |
|
786 | + } catch(PDOException $e) { |
|
787 | + return "error : ".$e->getMessage(); |
|
788 | + } |
|
789 | + } |
|
790 | 790 | public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '') { |
791 | 791 | global $globalDBdriver; |
792 | 792 | if ($globalDBdriver == 'mysql') { |
@@ -794,14 +794,14 @@ discard block |
||
794 | 794 | } else { |
795 | 795 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt) SELECT :callsign_icao,:airline_icao,:cnt WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao);"; |
796 | 796 | } |
797 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt); |
|
798 | - try { |
|
799 | - $sth = $this->db->prepare($query); |
|
800 | - $sth->execute($query_values); |
|
801 | - } catch(PDOException $e) { |
|
802 | - return "error : ".$e->getMessage(); |
|
803 | - } |
|
804 | - } |
|
797 | + $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt); |
|
798 | + try { |
|
799 | + $sth = $this->db->prepare($query); |
|
800 | + $sth->execute($query_values); |
|
801 | + } catch(PDOException $e) { |
|
802 | + return "error : ".$e->getMessage(); |
|
803 | + } |
|
804 | + } |
|
805 | 805 | public function addStatCountry($iso2,$iso3,$name,$cnt) { |
806 | 806 | global $globalDBdriver; |
807 | 807 | if ($globalDBdriver == 'mysql') { |
@@ -809,14 +809,14 @@ discard block |
||
809 | 809 | } else { |
810 | 810 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2; INSERT INTO stats_country (iso2,iso3,name,cnt) SELECT :iso2,:iso3,:name,:cnt WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2);"; |
811 | 811 | } |
812 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt); |
|
813 | - try { |
|
814 | - $sth = $this->db->prepare($query); |
|
815 | - $sth->execute($query_values); |
|
816 | - } catch(PDOException $e) { |
|
817 | - return "error : ".$e->getMessage(); |
|
818 | - } |
|
819 | - } |
|
812 | + $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt); |
|
813 | + try { |
|
814 | + $sth = $this->db->prepare($query); |
|
815 | + $sth->execute($query_values); |
|
816 | + } catch(PDOException $e) { |
|
817 | + return "error : ".$e->getMessage(); |
|
818 | + } |
|
819 | + } |
|
820 | 820 | public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '') { |
821 | 821 | global $globalDBdriver; |
822 | 822 | if ($globalDBdriver == 'mysql') { |
@@ -824,14 +824,14 @@ discard block |
||
824 | 824 | } else { |
825 | 825 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline);"; |
826 | 826 | } |
827 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao); |
|
828 | - try { |
|
829 | - $sth = $this->db->prepare($query); |
|
830 | - $sth->execute($query_values); |
|
831 | - } catch(PDOException $e) { |
|
832 | - return "error : ".$e->getMessage(); |
|
833 | - } |
|
834 | - } |
|
827 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao); |
|
828 | + try { |
|
829 | + $sth = $this->db->prepare($query); |
|
830 | + $sth->execute($query_values); |
|
831 | + } catch(PDOException $e) { |
|
832 | + return "error : ".$e->getMessage(); |
|
833 | + } |
|
834 | + } |
|
835 | 835 | public function addStatAirline($airline_icao,$cnt,$airline_name = '') { |
836 | 836 | global $globalDBdriver; |
837 | 837 | if ($globalDBdriver == 'mysql') { |
@@ -839,14 +839,14 @@ discard block |
||
839 | 839 | } else { |
840 | 840 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao; INSERT INTO stats_airline (airline_icao,airline_name,cnt) SELECT :airline_icao,:airline_name,:cnt WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao);"; |
841 | 841 | } |
842 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt); |
|
843 | - try { |
|
844 | - $sth = $this->db->prepare($query); |
|
845 | - $sth->execute($query_values); |
|
846 | - } catch(PDOException $e) { |
|
847 | - return "error : ".$e->getMessage(); |
|
848 | - } |
|
849 | - } |
|
842 | + $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt); |
|
843 | + try { |
|
844 | + $sth = $this->db->prepare($query); |
|
845 | + $sth->execute($query_values); |
|
846 | + } catch(PDOException $e) { |
|
847 | + return "error : ".$e->getMessage(); |
|
848 | + } |
|
849 | + } |
|
850 | 850 | public function addStatOwner($owner_name,$cnt,$stats_airline = '') { |
851 | 851 | global $globalDBdriver; |
852 | 852 | if ($globalDBdriver == 'mysql') { |
@@ -854,14 +854,14 @@ discard block |
||
854 | 854 | } else { |
855 | 855 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline; INSERT INTO stats_owner (owner_name,cnt,stats_airline) SELECT :owner_name,:cnt,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline);"; |
856 | 856 | } |
857 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline); |
|
858 | - try { |
|
859 | - $sth = $this->db->prepare($query); |
|
860 | - $sth->execute($query_values); |
|
861 | - } catch(PDOException $e) { |
|
862 | - return "error : ".$e->getMessage(); |
|
863 | - } |
|
864 | - } |
|
857 | + $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline); |
|
858 | + try { |
|
859 | + $sth = $this->db->prepare($query); |
|
860 | + $sth->execute($query_values); |
|
861 | + } catch(PDOException $e) { |
|
862 | + return "error : ".$e->getMessage(); |
|
863 | + } |
|
864 | + } |
|
865 | 865 | public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '') { |
866 | 866 | global $globalDBdriver; |
867 | 867 | if ($globalDBdriver == 'mysql') { |
@@ -869,14 +869,14 @@ discard block |
||
869 | 869 | } else { |
870 | 870 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline);"; |
871 | 871 | } |
872 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline); |
|
873 | - try { |
|
874 | - $sth = $this->db->prepare($query); |
|
875 | - $sth->execute($query_values); |
|
876 | - } catch(PDOException $e) { |
|
877 | - return "error : ".$e->getMessage(); |
|
878 | - } |
|
879 | - } |
|
872 | + $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline); |
|
873 | + try { |
|
874 | + $sth = $this->db->prepare($query); |
|
875 | + $sth->execute($query_values); |
|
876 | + } catch(PDOException $e) { |
|
877 | + return "error : ".$e->getMessage(); |
|
878 | + } |
|
879 | + } |
|
880 | 880 | public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '') { |
881 | 881 | global $globalDBdriver; |
882 | 882 | if ($globalDBdriver == 'mysql') { |
@@ -884,14 +884,14 @@ discard block |
||
884 | 884 | } else { |
885 | 885 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date);"; |
886 | 886 | } |
887 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao); |
|
888 | - try { |
|
889 | - $sth = $this->db->prepare($query); |
|
890 | - $sth->execute($query_values); |
|
891 | - } catch(PDOException $e) { |
|
892 | - return "error : ".$e->getMessage(); |
|
893 | - } |
|
894 | - } |
|
887 | + $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao); |
|
888 | + try { |
|
889 | + $sth = $this->db->prepare($query); |
|
890 | + $sth->execute($query_values); |
|
891 | + } catch(PDOException $e) { |
|
892 | + return "error : ".$e->getMessage(); |
|
893 | + } |
|
894 | + } |
|
895 | 895 | public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '') { |
896 | 896 | global $globalDBdriver; |
897 | 897 | if ($globalDBdriver == 'mysql') { |
@@ -899,14 +899,14 @@ discard block |
||
899 | 899 | } else { |
900 | 900 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date);"; |
901 | 901 | } |
902 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao); |
|
903 | - try { |
|
904 | - $sth = $this->db->prepare($query); |
|
905 | - $sth->execute($query_values); |
|
906 | - } catch(PDOException $e) { |
|
907 | - return "error : ".$e->getMessage(); |
|
908 | - } |
|
909 | - } |
|
902 | + $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao); |
|
903 | + try { |
|
904 | + $sth = $this->db->prepare($query); |
|
905 | + $sth->execute($query_values); |
|
906 | + } catch(PDOException $e) { |
|
907 | + return "error : ".$e->getMessage(); |
|
908 | + } |
|
909 | + } |
|
910 | 910 | public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '') { |
911 | 911 | global $globalDBdriver; |
912 | 912 | if ($globalDBdriver == 'mysql') { |
@@ -914,14 +914,14 @@ discard block |
||
914 | 914 | } else { |
915 | 915 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date);"; |
916 | 916 | } |
917 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao); |
|
918 | - try { |
|
919 | - $sth = $this->db->prepare($query); |
|
920 | - $sth->execute($query_values); |
|
921 | - } catch(PDOException $e) { |
|
922 | - return "error : ".$e->getMessage(); |
|
923 | - } |
|
924 | - } |
|
917 | + $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao); |
|
918 | + try { |
|
919 | + $sth = $this->db->prepare($query); |
|
920 | + $sth->execute($query_values); |
|
921 | + } catch(PDOException $e) { |
|
922 | + return "error : ".$e->getMessage(); |
|
923 | + } |
|
924 | + } |
|
925 | 925 | public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '') { |
926 | 926 | global $globalDBdriver; |
927 | 927 | if ($globalDBdriver == 'mysql') { |
@@ -929,52 +929,52 @@ discard block |
||
929 | 929 | } else { |
930 | 930 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline);"; |
931 | 931 | } |
932 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao); |
|
933 | - try { |
|
934 | - $sth = $this->db->prepare($query); |
|
935 | - $sth->execute($query_values); |
|
936 | - } catch(PDOException $e) { |
|
937 | - return "error : ".$e->getMessage(); |
|
938 | - } |
|
939 | - } |
|
932 | + $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao); |
|
933 | + try { |
|
934 | + $sth = $this->db->prepare($query); |
|
935 | + $sth->execute($query_values); |
|
936 | + } catch(PDOException $e) { |
|
937 | + return "error : ".$e->getMessage(); |
|
938 | + } |
|
939 | + } |
|
940 | 940 | |
941 | 941 | public function deleteStat($id) { |
942 | - $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
943 | - $query_values = array(':id' => $id); |
|
944 | - try { |
|
945 | - $sth = $this->db->prepare($query); |
|
946 | - $sth->execute($query_values); |
|
947 | - } catch(PDOException $e) { |
|
948 | - return "error : ".$e->getMessage(); |
|
949 | - } |
|
950 | - } |
|
942 | + $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
943 | + $query_values = array(':id' => $id); |
|
944 | + try { |
|
945 | + $sth = $this->db->prepare($query); |
|
946 | + $sth->execute($query_values); |
|
947 | + } catch(PDOException $e) { |
|
948 | + return "error : ".$e->getMessage(); |
|
949 | + } |
|
950 | + } |
|
951 | 951 | public function deleteStatFlight($type) { |
952 | - $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
953 | - $query_values = array(':type' => $type); |
|
954 | - try { |
|
955 | - $sth = $this->db->prepare($query); |
|
956 | - $sth->execute($query_values); |
|
957 | - } catch(PDOException $e) { |
|
958 | - return "error : ".$e->getMessage(); |
|
959 | - } |
|
960 | - } |
|
952 | + $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
953 | + $query_values = array(':type' => $type); |
|
954 | + try { |
|
955 | + $sth = $this->db->prepare($query); |
|
956 | + $sth->execute($query_values); |
|
957 | + } catch(PDOException $e) { |
|
958 | + return "error : ".$e->getMessage(); |
|
959 | + } |
|
960 | + } |
|
961 | 961 | public function deleteStatAirport($type) { |
962 | - $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
963 | - $query_values = array(':type' => $type); |
|
964 | - try { |
|
965 | - $sth = $this->db->prepare($query); |
|
966 | - $sth->execute($query_values); |
|
967 | - } catch(PDOException $e) { |
|
968 | - return "error : ".$e->getMessage(); |
|
969 | - } |
|
970 | - } |
|
962 | + $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
963 | + $query_values = array(':type' => $type); |
|
964 | + try { |
|
965 | + $sth = $this->db->prepare($query); |
|
966 | + $sth->execute($query_values); |
|
967 | + } catch(PDOException $e) { |
|
968 | + return "error : ".$e->getMessage(); |
|
969 | + } |
|
970 | + } |
|
971 | 971 | |
972 | - public function addOldStats() { |
|
973 | - global $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver; |
|
974 | - $Common = new Common(); |
|
975 | - $Connection = new Connection(); |
|
976 | - date_default_timezone_set('UTC'); |
|
977 | - $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
972 | + public function addOldStats() { |
|
973 | + global $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver; |
|
974 | + $Common = new Common(); |
|
975 | + $Connection = new Connection(); |
|
976 | + date_default_timezone_set('UTC'); |
|
977 | + $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
978 | 978 | //print_r($last_update); |
979 | 979 | /* |
980 | 980 | $flightsbymonth = $this->getStats('flights_by_month'); |
@@ -1228,46 +1228,46 @@ discard block |
||
1228 | 1228 | } |
1229 | 1229 | |
1230 | 1230 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
1231 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1232 | - $alldata = array(); |
|
1231 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1232 | + $alldata = array(); |
|
1233 | 1233 | |
1234 | - foreach ($pall as $value) { |
|
1235 | - $icao = $value['airport_departure_icao']; |
|
1236 | - $alldata[$icao] = $value; |
|
1237 | - } |
|
1238 | - foreach ($dall as $value) { |
|
1239 | - $icao = $value['airport_departure_icao']; |
|
1240 | - if (isset($alldata[$icao])) { |
|
1241 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1242 | - } else $alldata[$icao] = $value; |
|
1234 | + foreach ($pall as $value) { |
|
1235 | + $icao = $value['airport_departure_icao']; |
|
1236 | + $alldata[$icao] = $value; |
|
1237 | + } |
|
1238 | + foreach ($dall as $value) { |
|
1239 | + $icao = $value['airport_departure_icao']; |
|
1240 | + if (isset($alldata[$icao])) { |
|
1241 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1242 | + } else $alldata[$icao] = $value; |
|
1243 | 1243 | } |
1244 | - $count = array(); |
|
1245 | - foreach ($alldata as $key => $row) { |
|
1246 | - $count[$key] = $row['airport_departure_icao_count']; |
|
1247 | - } |
|
1244 | + $count = array(); |
|
1245 | + foreach ($alldata as $key => $row) { |
|
1246 | + $count[$key] = $row['airport_departure_icao_count']; |
|
1247 | + } |
|
1248 | 1248 | array_multisort($count,SORT_DESC,$alldata); |
1249 | 1249 | foreach ($alldata as $number) { |
1250 | 1250 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
1251 | 1251 | } |
1252 | 1252 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
1253 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1254 | - $alldata = array(); |
|
1255 | - foreach ($pall as $value) { |
|
1256 | - $icao = $value['airport_arrival_icao']; |
|
1257 | - $alldata[$icao] = $value; |
|
1258 | - } |
|
1259 | - foreach ($dall as $value) { |
|
1260 | - $icao = $value['airport_arrival_icao']; |
|
1261 | - if (isset($alldata[$icao])) { |
|
1262 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1263 | - } else $alldata[$icao] = $value; |
|
1264 | - } |
|
1265 | - $count = array(); |
|
1266 | - foreach ($alldata as $key => $row) { |
|
1267 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
1268 | - } |
|
1269 | - array_multisort($count,SORT_DESC,$alldata); |
|
1270 | - foreach ($alldata as $number) { |
|
1253 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1254 | + $alldata = array(); |
|
1255 | + foreach ($pall as $value) { |
|
1256 | + $icao = $value['airport_arrival_icao']; |
|
1257 | + $alldata[$icao] = $value; |
|
1258 | + } |
|
1259 | + foreach ($dall as $value) { |
|
1260 | + $icao = $value['airport_arrival_icao']; |
|
1261 | + if (isset($alldata[$icao])) { |
|
1262 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1263 | + } else $alldata[$icao] = $value; |
|
1264 | + } |
|
1265 | + $count = array(); |
|
1266 | + foreach ($alldata as $key => $row) { |
|
1267 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
1268 | + } |
|
1269 | + array_multisort($count,SORT_DESC,$alldata); |
|
1270 | + foreach ($alldata as $number) { |
|
1271 | 1271 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
1272 | 1272 | } |
1273 | 1273 | if ($Connection->tableExists('countries')) { |
@@ -1319,8 +1319,8 @@ discard block |
||
1319 | 1319 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
1320 | 1320 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
1321 | 1321 | $pall = $Spotter->getLast7DaysAirportsDeparture(); |
1322 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
1323 | - /* |
|
1322 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
1323 | + /* |
|
1324 | 1324 | $alldata = array(); |
1325 | 1325 | foreach ($pall as $value) { |
1326 | 1326 | $icao = $value['departure_airport_icao']; |
@@ -1339,29 +1339,29 @@ discard block |
||
1339 | 1339 | } |
1340 | 1340 | array_multisort($count,SORT_DESC,$alldata); |
1341 | 1341 | */ |
1342 | - foreach ($dall as $value) { |
|
1343 | - $icao = $value['departure_airport_icao']; |
|
1344 | - $ddate = $value['date']; |
|
1345 | - $find = false; |
|
1346 | - foreach ($pall as $pvalue) { |
|
1347 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1348 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1349 | - $find = true; |
|
1350 | - break; |
|
1351 | - } |
|
1352 | - } |
|
1353 | - if ($find === false) { |
|
1354 | - $pall[] = $value; |
|
1355 | - } |
|
1356 | - } |
|
1357 | - $alldata = $pall; |
|
1342 | + foreach ($dall as $value) { |
|
1343 | + $icao = $value['departure_airport_icao']; |
|
1344 | + $ddate = $value['date']; |
|
1345 | + $find = false; |
|
1346 | + foreach ($pall as $pvalue) { |
|
1347 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1348 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1349 | + $find = true; |
|
1350 | + break; |
|
1351 | + } |
|
1352 | + } |
|
1353 | + if ($find === false) { |
|
1354 | + $pall[] = $value; |
|
1355 | + } |
|
1356 | + } |
|
1357 | + $alldata = $pall; |
|
1358 | 1358 | foreach ($alldata as $number) { |
1359 | 1359 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
1360 | 1360 | } |
1361 | 1361 | echo '...Arrival'."\n"; |
1362 | 1362 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
1363 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
1364 | - /* |
|
1363 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
1364 | + /* |
|
1365 | 1365 | $alldata = array(); |
1366 | 1366 | foreach ($pall as $value) { |
1367 | 1367 | $icao = $value['arrival_airport_icao']; |
@@ -1381,22 +1381,22 @@ discard block |
||
1381 | 1381 | */ |
1382 | 1382 | |
1383 | 1383 | |
1384 | - foreach ($dall as $value) { |
|
1385 | - $icao = $value['arrival_airport_icao']; |
|
1386 | - $ddate = $value['date']; |
|
1387 | - $find = false; |
|
1388 | - foreach ($pall as $pvalue) { |
|
1389 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1390 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1391 | - $find = true; |
|
1392 | - break; |
|
1393 | - } |
|
1394 | - } |
|
1395 | - if ($find === false) { |
|
1396 | - $pall[] = $value; |
|
1397 | - } |
|
1398 | - } |
|
1399 | - $alldata = $pall; |
|
1384 | + foreach ($dall as $value) { |
|
1385 | + $icao = $value['arrival_airport_icao']; |
|
1386 | + $ddate = $value['date']; |
|
1387 | + $find = false; |
|
1388 | + foreach ($pall as $pvalue) { |
|
1389 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1390 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1391 | + $find = true; |
|
1392 | + break; |
|
1393 | + } |
|
1394 | + } |
|
1395 | + if ($find === false) { |
|
1396 | + $pall[] = $value; |
|
1397 | + } |
|
1398 | + } |
|
1399 | + $alldata = $pall; |
|
1400 | 1400 | foreach ($alldata as $number) { |
1401 | 1401 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
1402 | 1402 | } |
@@ -1454,47 +1454,47 @@ discard block |
||
1454 | 1454 | } |
1455 | 1455 | |
1456 | 1456 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
1457 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1458 | - //$alldata = array(); |
|
1459 | - foreach ($dall as $value) { |
|
1460 | - $icao = $value['airport_departure_icao']; |
|
1461 | - $dicao = $value['airline_icap']; |
|
1462 | - $find = false; |
|
1463 | - foreach ($pall as $pvalue) { |
|
1464 | - if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1465 | - $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1466 | - $find = true; |
|
1467 | - break; |
|
1468 | - } |
|
1469 | - } |
|
1470 | - if ($find === false) { |
|
1471 | - $pall[] = $value; |
|
1472 | - } |
|
1473 | - } |
|
1474 | - $alldata = $pall; |
|
1457 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1458 | + //$alldata = array(); |
|
1459 | + foreach ($dall as $value) { |
|
1460 | + $icao = $value['airport_departure_icao']; |
|
1461 | + $dicao = $value['airline_icap']; |
|
1462 | + $find = false; |
|
1463 | + foreach ($pall as $pvalue) { |
|
1464 | + if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1465 | + $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1466 | + $find = true; |
|
1467 | + break; |
|
1468 | + } |
|
1469 | + } |
|
1470 | + if ($find === false) { |
|
1471 | + $pall[] = $value; |
|
1472 | + } |
|
1473 | + } |
|
1474 | + $alldata = $pall; |
|
1475 | 1475 | foreach ($alldata as $number) { |
1476 | 1476 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao']); |
1477 | 1477 | } |
1478 | 1478 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
1479 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1480 | - //$alldata = array(); |
|
1481 | - foreach ($dall as $value) { |
|
1482 | - $icao = $value['airport_arrival_icao']; |
|
1483 | - $dicao = $value['airline_icao']; |
|
1484 | - $find = false; |
|
1485 | - foreach ($pall as $pvalue) { |
|
1486 | - if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1487 | - $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1488 | - $find = true; |
|
1489 | - break; |
|
1490 | - } |
|
1491 | - } |
|
1492 | - if ($find === false) { |
|
1493 | - $pall[] = $value; |
|
1494 | - } |
|
1495 | - } |
|
1496 | - $alldata = $pall; |
|
1497 | - foreach ($alldata as $number) { |
|
1479 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1480 | + //$alldata = array(); |
|
1481 | + foreach ($dall as $value) { |
|
1482 | + $icao = $value['airport_arrival_icao']; |
|
1483 | + $dicao = $value['airline_icao']; |
|
1484 | + $find = false; |
|
1485 | + foreach ($pall as $pvalue) { |
|
1486 | + if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1487 | + $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1488 | + $find = true; |
|
1489 | + break; |
|
1490 | + } |
|
1491 | + } |
|
1492 | + if ($find === false) { |
|
1493 | + $pall[] = $value; |
|
1494 | + } |
|
1495 | + } |
|
1496 | + $alldata = $pall; |
|
1497 | + foreach ($alldata as $number) { |
|
1498 | 1498 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao']); |
1499 | 1499 | } |
1500 | 1500 | $Spotter = new Spotter($this->db); |
@@ -1522,47 +1522,47 @@ discard block |
||
1522 | 1522 | } |
1523 | 1523 | echo '...Departure'."\n"; |
1524 | 1524 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
1525 | - $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
1526 | - foreach ($dall as $value) { |
|
1527 | - $icao = $value['departure_airport_icao']; |
|
1528 | - $airline = $value['airline_icao']; |
|
1529 | - $ddate = $value['date']; |
|
1530 | - $find = false; |
|
1531 | - foreach ($pall as $pvalue) { |
|
1532 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
1533 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1534 | - $find = true; |
|
1535 | - break; |
|
1536 | - } |
|
1537 | - } |
|
1538 | - if ($find === false) { |
|
1539 | - $pall[] = $value; |
|
1540 | - } |
|
1541 | - } |
|
1542 | - $alldata = $pall; |
|
1525 | + $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
1526 | + foreach ($dall as $value) { |
|
1527 | + $icao = $value['departure_airport_icao']; |
|
1528 | + $airline = $value['airline_icao']; |
|
1529 | + $ddate = $value['date']; |
|
1530 | + $find = false; |
|
1531 | + foreach ($pall as $pvalue) { |
|
1532 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
1533 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1534 | + $find = true; |
|
1535 | + break; |
|
1536 | + } |
|
1537 | + } |
|
1538 | + if ($find === false) { |
|
1539 | + $pall[] = $value; |
|
1540 | + } |
|
1541 | + } |
|
1542 | + $alldata = $pall; |
|
1543 | 1543 | foreach ($alldata as $number) { |
1544 | 1544 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
1545 | 1545 | } |
1546 | 1546 | echo '...Arrival'."\n"; |
1547 | 1547 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
1548 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
1549 | - foreach ($dall as $value) { |
|
1550 | - $icao = $value['arrival_airport_icao']; |
|
1551 | - $airline = $value['airline_icao']; |
|
1552 | - $ddate = $value['date']; |
|
1553 | - $find = false; |
|
1554 | - foreach ($pall as $pvalue) { |
|
1555 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
1556 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1557 | - $find = true; |
|
1558 | - break; |
|
1559 | - } |
|
1560 | - } |
|
1561 | - if ($find === false) { |
|
1562 | - $pall[] = $value; |
|
1563 | - } |
|
1564 | - } |
|
1565 | - $alldata = $pall; |
|
1548 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
1549 | + foreach ($dall as $value) { |
|
1550 | + $icao = $value['arrival_airport_icao']; |
|
1551 | + $airline = $value['airline_icao']; |
|
1552 | + $ddate = $value['date']; |
|
1553 | + $find = false; |
|
1554 | + foreach ($pall as $pvalue) { |
|
1555 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
1556 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1557 | + $find = true; |
|
1558 | + break; |
|
1559 | + } |
|
1560 | + } |
|
1561 | + if ($find === false) { |
|
1562 | + $pall[] = $value; |
|
1563 | + } |
|
1564 | + } |
|
1565 | + $alldata = $pall; |
|
1566 | 1566 | foreach ($alldata as $number) { |
1567 | 1567 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
1568 | 1568 | } |
@@ -72,8 +72,11 @@ discard block |
||
72 | 72 | |
73 | 73 | |
74 | 74 | public function countAllAircraftTypes($limit = true, $stats_airline = '') { |
75 | - if ($limit) $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
76 | - else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline ORDER BY aircraft_icao_count DESC"; |
|
75 | + if ($limit) { |
|
76 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
77 | + } else { |
|
78 | + $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline ORDER BY aircraft_icao_count DESC"; |
|
79 | + } |
|
77 | 80 | try { |
78 | 81 | $sth = $this->db->prepare($query); |
79 | 82 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -89,8 +92,11 @@ discard block |
||
89 | 92 | return $all; |
90 | 93 | } |
91 | 94 | public function countAllAirlineCountries($limit = true) { |
92 | - if ($limit) $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
93 | - else $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
95 | + if ($limit) { |
|
96 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
97 | + } else { |
|
98 | + $query = "SELECT airlines.country AS airline_country, SUM(stats_airline.cnt) as airline_country_count FROM stats_airline,airlines WHERE stats_airline.airline_icao=airlines.icao GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
99 | + } |
|
94 | 100 | try { |
95 | 101 | $sth = $this->db->prepare($query); |
96 | 102 | $sth->execute(); |
@@ -106,8 +112,11 @@ discard block |
||
106 | 112 | return $all; |
107 | 113 | } |
108 | 114 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '') { |
109 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
110 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
115 | + if ($limit) { |
|
116 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
117 | + } else { |
|
118 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
119 | + } |
|
111 | 120 | try { |
112 | 121 | $sth = $this->db->prepare($query); |
113 | 122 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -124,8 +133,11 @@ discard block |
||
124 | 133 | } |
125 | 134 | |
126 | 135 | public function countAllArrivalCountries($limit = true, $stats_airline = '') { |
127 | - if ($limit) $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
128 | - else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
136 | + if ($limit) { |
|
137 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
138 | + } else { |
|
139 | + $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
140 | + } |
|
129 | 141 | try { |
130 | 142 | $sth = $this->db->prepare($query); |
131 | 143 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -141,8 +153,11 @@ discard block |
||
141 | 153 | return $all; |
142 | 154 | } |
143 | 155 | public function countAllDepartureCountries($limit = true, $stats_airline = '') { |
144 | - if ($limit) $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
145 | - else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
156 | + if ($limit) { |
|
157 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
158 | + } else { |
|
159 | + $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
160 | + } |
|
146 | 161 | try { |
147 | 162 | $sth = $this->db->prepare($query); |
148 | 163 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -159,8 +174,11 @@ discard block |
||
159 | 174 | } |
160 | 175 | |
161 | 176 | public function countAllAirlines($limit = true) { |
162 | - if ($limit) $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
163 | - else $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao ORDER BY airline_count DESC"; |
|
177 | + if ($limit) { |
|
178 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
179 | + } else { |
|
180 | + $query = "SELECT DISTINCT stats_airline.airline_icao, stats_airline.cnt AS airline_count, stats_airline.airline_name, airlines.country as airline_country FROM stats_airline, airlines WHERE stats_airline.airline_name <> '' AND stats_airline.airline_icao <> '' AND airlines.icao = stats_airline.airline_icao ORDER BY airline_count DESC"; |
|
181 | + } |
|
164 | 182 | try { |
165 | 183 | $sth = $this->db->prepare($query); |
166 | 184 | $sth->execute(); |
@@ -175,8 +193,11 @@ discard block |
||
175 | 193 | return $all; |
176 | 194 | } |
177 | 195 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '') { |
178 | - if ($limit) $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
179 | - else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline ORDER BY aircraft_registration_count DESC"; |
|
196 | + if ($limit) { |
|
197 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name, s.registration FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
198 | + } else { |
|
199 | + $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline ORDER BY aircraft_registration_count DESC"; |
|
200 | + } |
|
180 | 201 | try { |
181 | 202 | $sth = $this->db->prepare($query); |
182 | 203 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -192,8 +213,11 @@ discard block |
||
192 | 213 | return $all; |
193 | 214 | } |
194 | 215 | public function countAllCallsigns($limit = true,$stats_airline = '') { |
195 | - if ($limit) $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
196 | - else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline ORDER BY callsign_icao_count DESC"; |
|
216 | + if ($limit) { |
|
217 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
218 | + } else { |
|
219 | + $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline ORDER BY callsign_icao_count DESC"; |
|
220 | + } |
|
197 | 221 | try { |
198 | 222 | $sth = $this->db->prepare($query); |
199 | 223 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -211,8 +235,11 @@ discard block |
||
211 | 235 | public function countAllFlightOverCountries($limit = true, $stats_airline = '') { |
212 | 236 | $Connection = new Connection(); |
213 | 237 | if ($Connection->tableExists('countries')) { |
214 | - if ($limit) $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
215 | - else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline ORDER BY flight_count DESC"; |
|
238 | + if ($limit) { |
|
239 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
240 | + } else { |
|
241 | + $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline ORDER BY flight_count DESC"; |
|
242 | + } |
|
216 | 243 | try { |
217 | 244 | $sth = $this->db->prepare($query); |
218 | 245 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -232,8 +259,11 @@ discard block |
||
232 | 259 | } |
233 | 260 | } |
234 | 261 | public function countAllPilots($limit = true,$stats_airline = '') { |
235 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
236 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline ORDER BY pilot_count DESC"; |
|
262 | + if ($limit) { |
|
263 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
264 | + } else { |
|
265 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline ORDER BY pilot_count DESC"; |
|
266 | + } |
|
237 | 267 | try { |
238 | 268 | $sth = $this->db->prepare($query); |
239 | 269 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -249,8 +279,11 @@ discard block |
||
249 | 279 | return $all; |
250 | 280 | } |
251 | 281 | public function countAllOwners($limit = true,$stats_airline = '') { |
252 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
253 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline ORDER BY owner_count DESC"; |
|
282 | + if ($limit) { |
|
283 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
284 | + } else { |
|
285 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline ORDER BY owner_count DESC"; |
|
286 | + } |
|
254 | 287 | try { |
255 | 288 | $sth = $this->db->prepare($query); |
256 | 289 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -266,8 +299,11 @@ discard block |
||
266 | 299 | return $all; |
267 | 300 | } |
268 | 301 | public function countAllDepartureAirports($limit = true,$stats_airline = '') { |
269 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
270 | - else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_departure_icao_count DESC"; |
|
302 | + if ($limit) { |
|
303 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
304 | + } else { |
|
305 | + $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_departure_icao_count DESC"; |
|
306 | + } |
|
271 | 307 | try { |
272 | 308 | $sth = $this->db->prepare($query); |
273 | 309 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -290,7 +326,9 @@ discard block |
||
290 | 326 | $icao = $value['airport_departure_icao']; |
291 | 327 | if (isset($all[$icao])) { |
292 | 328 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
293 | - } else $all[$icao] = $value; |
|
329 | + } else { |
|
330 | + $all[$icao] = $value; |
|
331 | + } |
|
294 | 332 | } |
295 | 333 | $count = array(); |
296 | 334 | foreach ($all as $key => $row) { |
@@ -301,8 +339,11 @@ discard block |
||
301 | 339 | return $all; |
302 | 340 | } |
303 | 341 | public function countAllArrivalAirports($limit = true,$stats_airline = '') { |
304 | - if ($limit) $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
305 | - else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_arrival_icao_count DESC"; |
|
342 | + if ($limit) { |
|
343 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
344 | + } else { |
|
345 | + $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline ORDER BY airport_arrival_icao_count DESC"; |
|
346 | + } |
|
306 | 347 | try { |
307 | 348 | $sth = $this->db->prepare($query); |
308 | 349 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -325,7 +366,9 @@ discard block |
||
325 | 366 | $icao = $value['airport_arrival_icao']; |
326 | 367 | if (isset($all[$icao])) { |
327 | 368 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
328 | - } else $all[$icao] = $value; |
|
369 | + } else { |
|
370 | + $all[$icao] = $value; |
|
371 | + } |
|
329 | 372 | } |
330 | 373 | $count = array(); |
331 | 374 | foreach ($all as $key => $row) { |
@@ -339,11 +382,17 @@ discard block |
||
339 | 382 | public function countAllMonthsLastYear($limit = true,$stats_airline = '') { |
340 | 383 | global $globalDBdriver; |
341 | 384 | if ($globalDBdriver == 'mysql') { |
342 | - if ($limit) $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline"; |
|
343 | - else $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline"; |
|
385 | + if ($limit) { |
|
386 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 MONTH) AND stats_airline = :stats_airline"; |
|
387 | + } else { |
|
388 | + $query = "SELECT MONTH(stats_date) as month_name, YEAR(stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline"; |
|
389 | + } |
|
344 | 390 | } else { |
345 | - if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline"; |
|
346 | - else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline"; |
|
391 | + if ($limit) { |
|
392 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline"; |
|
393 | + } else { |
|
394 | + $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline"; |
|
395 | + } |
|
347 | 396 | } |
348 | 397 | $query_data = array(':stats_airline' => $stats_airline); |
349 | 398 | try { |
@@ -468,8 +517,11 @@ discard block |
||
468 | 517 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '') { |
469 | 518 | global $globalTimezone, $globalDBdriver; |
470 | 519 | |
471 | - if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline"; |
|
472 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline"; |
|
520 | + if ($limit) { |
|
521 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline"; |
|
522 | + } else { |
|
523 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline"; |
|
524 | + } |
|
473 | 525 | if ($orderby == 'hour') { |
474 | 526 | if ($globalDBdriver == 'mysql') { |
475 | 527 | $query .= " ORDER BY flight_date ASC"; |
@@ -477,7 +529,9 @@ discard block |
||
477 | 529 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
478 | 530 | } |
479 | 531 | } |
480 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
532 | + if ($orderby == 'count') { |
|
533 | + $query .= " ORDER BY hour_count DESC"; |
|
534 | + } |
|
481 | 535 | try { |
482 | 536 | $sth = $this->db->prepare($query); |
483 | 537 | $sth->execute(array(':stats_airline' => $stats_airline)); |
@@ -1200,7 +1254,9 @@ discard block |
||
1200 | 1254 | echo 'Update stats !'."\n"; |
1201 | 1255 | if (isset($last_update[0]['value'])) { |
1202 | 1256 | $last_update_day = $last_update[0]['value']; |
1203 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
1257 | + } else { |
|
1258 | + $last_update_day = '2012-12-12 12:12:12'; |
|
1259 | + } |
|
1204 | 1260 | $Spotter = new Spotter($this->db); |
1205 | 1261 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
1206 | 1262 | foreach ($alldata as $number) { |
@@ -1239,7 +1295,9 @@ discard block |
||
1239 | 1295 | $icao = $value['airport_departure_icao']; |
1240 | 1296 | if (isset($alldata[$icao])) { |
1241 | 1297 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
1242 | - } else $alldata[$icao] = $value; |
|
1298 | + } else { |
|
1299 | + $alldata[$icao] = $value; |
|
1300 | + } |
|
1243 | 1301 | } |
1244 | 1302 | $count = array(); |
1245 | 1303 | foreach ($alldata as $key => $row) { |
@@ -1260,7 +1318,9 @@ discard block |
||
1260 | 1318 | $icao = $value['airport_arrival_icao']; |
1261 | 1319 | if (isset($alldata[$icao])) { |
1262 | 1320 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
1263 | - } else $alldata[$icao] = $value; |
|
1321 | + } else { |
|
1322 | + $alldata[$icao] = $value; |
|
1323 | + } |
|
1264 | 1324 | } |
1265 | 1325 | $count = array(); |
1266 | 1326 | foreach ($alldata as $key => $row) { |
@@ -1286,7 +1346,9 @@ discard block |
||
1286 | 1346 | $alldata = $Spotter->countAllMonths(); |
1287 | 1347 | $lastyear = false; |
1288 | 1348 | foreach ($alldata as $number) { |
1289 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1349 | + if ($number['year_name'] != date('Y')) { |
|
1350 | + $lastyear = true; |
|
1351 | + } |
|
1290 | 1352 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
1291 | 1353 | } |
1292 | 1354 | $alldata = $Spotter->countAllMilitaryMonths(); |
@@ -1501,7 +1563,9 @@ discard block |
||
1501 | 1563 | $alldata = $Spotter->countAllMonthsByAirlines(); |
1502 | 1564 | $lastyear = false; |
1503 | 1565 | foreach ($alldata as $number) { |
1504 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1566 | + if ($number['year_name'] != date('Y')) { |
|
1567 | + $lastyear = true; |
|
1568 | + } |
|
1505 | 1569 | $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
1506 | 1570 | } |
1507 | 1571 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |