@@ -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); |
@@ -11,215 +11,215 @@ 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($filter_name = '') { |
40 | - $query = "SELECT * FROM stats_airline WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
41 | - try { |
|
42 | - $sth = $this->db->prepare($query); |
|
43 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
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 WHERE filter_name = :filter_name ORDER BY airline_name ASC"; |
|
41 | + try { |
|
42 | + $sth = $this->db->prepare($query); |
|
43 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
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 = '',$filter_name = '') { |
51 | - $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
52 | - try { |
|
53 | - $sth = $this->db->prepare($query); |
|
54 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
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 AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
|
52 | + try { |
|
53 | + $sth = $this->db->prepare($query); |
|
54 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
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 = '',$filter_name = '') { |
62 | - $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name 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,':filter_name' => $filter_name)); |
|
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 AND filter_name = :filter_name 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,':filter_name' => $filter_name)); |
|
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 = '', $filter_name = '') { |
75 | 75 | global $globalStatsFilters; |
76 | 76 | 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 AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
77 | 77 | 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 AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
78 | - try { |
|
79 | - $sth = $this->db->prepare($query); |
|
80 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
81 | - } catch(PDOException $e) { |
|
82 | - echo "error : ".$e->getMessage(); |
|
83 | - } |
|
84 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
85 | - if (empty($all)) { |
|
86 | - $filters = array('airlines' => array($stats_airline)); |
|
87 | - if ($filter_name != '') { |
|
88 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
89 | - } |
|
90 | - $Spotter = new Spotter($this->db); |
|
91 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
92 | - } |
|
93 | - return $all; |
|
78 | + try { |
|
79 | + $sth = $this->db->prepare($query); |
|
80 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
81 | + } catch(PDOException $e) { |
|
82 | + echo "error : ".$e->getMessage(); |
|
83 | + } |
|
84 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
85 | + if (empty($all)) { |
|
86 | + $filters = array('airlines' => array($stats_airline)); |
|
87 | + if ($filter_name != '') { |
|
88 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
89 | + } |
|
90 | + $Spotter = new Spotter($this->db); |
|
91 | + $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
92 | + } |
|
93 | + return $all; |
|
94 | 94 | } |
95 | 95 | public function countAllAirlineCountries($limit = true,$filter_name = '') { |
96 | 96 | global $globalStatsFilters; |
97 | 97 | 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 filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
98 | 98 | 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 AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
99 | - try { |
|
100 | - $sth = $this->db->prepare($query); |
|
101 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
102 | - } catch(PDOException $e) { |
|
103 | - echo "error : ".$e->getMessage(); |
|
104 | - } |
|
105 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
106 | - if (empty($all)) { |
|
107 | - $Spotter = new Spotter($this->db); |
|
108 | - $filters = array(); |
|
109 | - if ($filter_name != '') { |
|
110 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
111 | - } |
|
112 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
113 | - } |
|
114 | - return $all; |
|
99 | + try { |
|
100 | + $sth = $this->db->prepare($query); |
|
101 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
102 | + } catch(PDOException $e) { |
|
103 | + echo "error : ".$e->getMessage(); |
|
104 | + } |
|
105 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
106 | + if (empty($all)) { |
|
107 | + $Spotter = new Spotter($this->db); |
|
108 | + $filters = array(); |
|
109 | + if ($filter_name != '') { |
|
110 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
111 | + } |
|
112 | + $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
113 | + } |
|
114 | + return $all; |
|
115 | 115 | } |
116 | 116 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
117 | 117 | global $globalStatsFilters; |
118 | 118 | if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
119 | 119 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
120 | - try { |
|
121 | - $sth = $this->db->prepare($query); |
|
122 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
123 | - } catch(PDOException $e) { |
|
124 | - echo "error : ".$e->getMessage(); |
|
125 | - } |
|
126 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
127 | - if (empty($all)) { |
|
128 | - $filters = array('airlines' => array($stats_airline)); |
|
129 | - if ($filter_name != '') { |
|
130 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
120 | + try { |
|
121 | + $sth = $this->db->prepare($query); |
|
122 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
123 | + } catch(PDOException $e) { |
|
124 | + echo "error : ".$e->getMessage(); |
|
125 | + } |
|
126 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
127 | + if (empty($all)) { |
|
128 | + $filters = array('airlines' => array($stats_airline)); |
|
129 | + if ($filter_name != '') { |
|
130 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
131 | 131 | } |
132 | - $Spotter = new Spotter($this->db); |
|
132 | + $Spotter = new Spotter($this->db); |
|
133 | 133 | $all = $Spotter->countAllAircraftManufacturers($filters); |
134 | - } |
|
135 | - return $all; |
|
134 | + } |
|
135 | + return $all; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') { |
139 | 139 | global $globalStatsFilters; |
140 | 140 | 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 AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
141 | 141 | 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 AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
142 | - try { |
|
143 | - $sth = $this->db->prepare($query); |
|
144 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
145 | - } catch(PDOException $e) { |
|
146 | - echo "error : ".$e->getMessage(); |
|
147 | - } |
|
148 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
149 | - if (empty($all)) { |
|
142 | + try { |
|
143 | + $sth = $this->db->prepare($query); |
|
144 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
145 | + } catch(PDOException $e) { |
|
146 | + echo "error : ".$e->getMessage(); |
|
147 | + } |
|
148 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
149 | + if (empty($all)) { |
|
150 | 150 | $filters = array('airlines' => array($stats_airline)); |
151 | 151 | if ($filter_name != '') { |
152 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
152 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
153 | 153 | } |
154 | 154 | $Spotter = new Spotter($this->db); |
155 | 155 | $all = $Spotter->countAllArrivalCountries($limit,$filters); |
156 | - } |
|
157 | - return $all; |
|
156 | + } |
|
157 | + return $all; |
|
158 | 158 | } |
159 | 159 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') { |
160 | 160 | global $globalStatsFilters; |
161 | 161 | 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 AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
162 | 162 | 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 AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
163 | - try { |
|
164 | - $sth = $this->db->prepare($query); |
|
165 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
166 | - } catch(PDOException $e) { |
|
167 | - echo "error : ".$e->getMessage(); |
|
168 | - } |
|
169 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
170 | - if (empty($all)) { |
|
163 | + try { |
|
164 | + $sth = $this->db->prepare($query); |
|
165 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
166 | + } catch(PDOException $e) { |
|
167 | + echo "error : ".$e->getMessage(); |
|
168 | + } |
|
169 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
170 | + if (empty($all)) { |
|
171 | 171 | $filters = array('airlines' => array($stats_airline)); |
172 | 172 | if ($filter_name != '') { |
173 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
173 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
174 | 174 | } |
175 | 175 | $Spotter = new Spotter($this->db); |
176 | 176 | $all = $Spotter->countAllDepartureCountries($filters); |
177 | - } |
|
178 | - return $all; |
|
177 | + } |
|
178 | + return $all; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | public function countAllAirlines($limit = true,$filter_name = '') { |
182 | 182 | global $globalStatsFilters; |
183 | 183 | 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 AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
184 | 184 | 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 AND filter_name = :filter_name ORDER BY airline_count DESC"; |
185 | - try { |
|
186 | - $sth = $this->db->prepare($query); |
|
187 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
188 | - } catch(PDOException $e) { |
|
189 | - echo "error : ".$e->getMessage(); |
|
190 | - } |
|
191 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
192 | - if (empty($all)) { |
|
193 | - $Spotter = new Spotter($this->db); |
|
194 | - $filters = array(); |
|
195 | - if ($filter_name != '') { |
|
196 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
185 | + try { |
|
186 | + $sth = $this->db->prepare($query); |
|
187 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
188 | + } catch(PDOException $e) { |
|
189 | + echo "error : ".$e->getMessage(); |
|
190 | + } |
|
191 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
192 | + if (empty($all)) { |
|
193 | + $Spotter = new Spotter($this->db); |
|
194 | + $filters = array(); |
|
195 | + if ($filter_name != '') { |
|
196 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
197 | 197 | } |
198 | 198 | |
199 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
200 | - } |
|
201 | - return $all; |
|
199 | + $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
200 | + } |
|
201 | + return $all; |
|
202 | 202 | } |
203 | 203 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
204 | 204 | global $globalStatsFilters; |
205 | 205 | 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 AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
206 | 206 | 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 AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
207 | - try { |
|
208 | - $sth = $this->db->prepare($query); |
|
209 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
210 | - } catch(PDOException $e) { |
|
211 | - echo "error : ".$e->getMessage(); |
|
212 | - } |
|
213 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
214 | - if (empty($all)) { |
|
207 | + try { |
|
208 | + $sth = $this->db->prepare($query); |
|
209 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
210 | + } catch(PDOException $e) { |
|
211 | + echo "error : ".$e->getMessage(); |
|
212 | + } |
|
213 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
214 | + if (empty($all)) { |
|
215 | 215 | $filters = array('airlines' => array($stats_airline)); |
216 | 216 | if ($filter_name != '') { |
217 | 217 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
218 | 218 | } |
219 | - $Spotter = new Spotter($this->db); |
|
220 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
221 | - } |
|
222 | - return $all; |
|
219 | + $Spotter = new Spotter($this->db); |
|
220 | + $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
221 | + } |
|
222 | + return $all; |
|
223 | 223 | } |
224 | 224 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
225 | 225 | global $globalStatsFilters; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | echo "error : ".$e->getMessage(); |
255 | 255 | } |
256 | 256 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
257 | - /* |
|
257 | + /* |
|
258 | 258 | if (empty($all)) { |
259 | 259 | $Spotter = new Spotter($this->db); |
260 | 260 | $all = $Spotter->countAllFlightOverCountries($limit); |
@@ -269,82 +269,82 @@ discard block |
||
269 | 269 | global $globalStatsFilters; |
270 | 270 | if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
271 | 271 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
272 | - try { |
|
273 | - $sth = $this->db->prepare($query); |
|
274 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
275 | - } catch(PDOException $e) { |
|
276 | - echo "error : ".$e->getMessage(); |
|
277 | - } |
|
278 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
279 | - if (empty($all)) { |
|
272 | + try { |
|
273 | + $sth = $this->db->prepare($query); |
|
274 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
275 | + } catch(PDOException $e) { |
|
276 | + echo "error : ".$e->getMessage(); |
|
277 | + } |
|
278 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
279 | + if (empty($all)) { |
|
280 | 280 | $filters = array('airlines' => array($stats_airline)); |
281 | 281 | if ($filter_name != '') { |
282 | 282 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
283 | 283 | } |
284 | - $Spotter = new Spotter($this->db); |
|
285 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
286 | - } |
|
287 | - return $all; |
|
284 | + $Spotter = new Spotter($this->db); |
|
285 | + $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
286 | + } |
|
287 | + return $all; |
|
288 | 288 | } |
289 | 289 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
290 | 290 | global $globalStatsFilters; |
291 | 291 | if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
292 | 292 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
293 | - try { |
|
294 | - $sth = $this->db->prepare($query); |
|
295 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
296 | - } catch(PDOException $e) { |
|
297 | - echo "error : ".$e->getMessage(); |
|
298 | - } |
|
299 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
300 | - if (empty($all)) { |
|
293 | + try { |
|
294 | + $sth = $this->db->prepare($query); |
|
295 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
296 | + } catch(PDOException $e) { |
|
297 | + echo "error : ".$e->getMessage(); |
|
298 | + } |
|
299 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
300 | + if (empty($all)) { |
|
301 | 301 | $filters = array('airlines' => array($stats_airline)); |
302 | 302 | if ($filter_name != '') { |
303 | 303 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
304 | 304 | } |
305 | - $Spotter = new Spotter($this->db); |
|
306 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
307 | - } |
|
308 | - return $all; |
|
305 | + $Spotter = new Spotter($this->db); |
|
306 | + $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
307 | + } |
|
308 | + return $all; |
|
309 | 309 | } |
310 | 310 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
311 | 311 | global $globalStatsFilters; |
312 | 312 | 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 AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
313 | 313 | 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 AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
314 | - try { |
|
315 | - $sth = $this->db->prepare($query); |
|
316 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
317 | - } catch(PDOException $e) { |
|
318 | - echo "error : ".$e->getMessage(); |
|
319 | - } |
|
320 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
321 | - if (empty($all)) { |
|
314 | + try { |
|
315 | + $sth = $this->db->prepare($query); |
|
316 | + $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
317 | + } catch(PDOException $e) { |
|
318 | + echo "error : ".$e->getMessage(); |
|
319 | + } |
|
320 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
321 | + if (empty($all)) { |
|
322 | 322 | $filters = array('airlines' => array($stats_airline)); |
323 | - if ($filter_name != '') { |
|
324 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
325 | - } |
|
326 | - $Spotter = new Spotter($this->db); |
|
327 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
328 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
329 | - $all = array(); |
|
330 | - foreach ($pall as $value) { |
|
331 | - $icao = $value['airport_departure_icao']; |
|
332 | - $all[$icao] = $value; |
|
333 | - } |
|
323 | + if ($filter_name != '') { |
|
324 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
325 | + } |
|
326 | + $Spotter = new Spotter($this->db); |
|
327 | + $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
328 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
329 | + $all = array(); |
|
330 | + foreach ($pall as $value) { |
|
331 | + $icao = $value['airport_departure_icao']; |
|
332 | + $all[$icao] = $value; |
|
333 | + } |
|
334 | 334 | |
335 | - foreach ($dall as $value) { |
|
336 | - $icao = $value['airport_departure_icao']; |
|
337 | - if (isset($all[$icao])) { |
|
338 | - $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
339 | - } else $all[$icao] = $value; |
|
340 | - } |
|
341 | - $count = array(); |
|
342 | - foreach ($all as $key => $row) { |
|
343 | - $count[$key] = $row['airport_departure_icao_count']; |
|
344 | - } |
|
345 | - array_multisort($count,SORT_DESC,$all); |
|
346 | - } |
|
347 | - return $all; |
|
335 | + foreach ($dall as $value) { |
|
336 | + $icao = $value['airport_departure_icao']; |
|
337 | + if (isset($all[$icao])) { |
|
338 | + $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
339 | + } else $all[$icao] = $value; |
|
340 | + } |
|
341 | + $count = array(); |
|
342 | + foreach ($all as $key => $row) { |
|
343 | + $count[$key] = $row['airport_departure_icao_count']; |
|
344 | + } |
|
345 | + array_multisort($count,SORT_DESC,$all); |
|
346 | + } |
|
347 | + return $all; |
|
348 | 348 | } |
349 | 349 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
350 | 350 | global $globalStatsFilters; |
@@ -365,26 +365,26 @@ discard block |
||
365 | 365 | $Spotter = new Spotter($this->db); |
366 | 366 | $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
367 | 367 | $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
368 | - $all = array(); |
|
369 | - foreach ($pall as $value) { |
|
370 | - $icao = $value['airport_arrival_icao']; |
|
371 | - $all[$icao] = $value; |
|
372 | - } |
|
368 | + $all = array(); |
|
369 | + foreach ($pall as $value) { |
|
370 | + $icao = $value['airport_arrival_icao']; |
|
371 | + $all[$icao] = $value; |
|
372 | + } |
|
373 | 373 | |
374 | - foreach ($dall as $value) { |
|
375 | - $icao = $value['airport_arrival_icao']; |
|
376 | - if (isset($all[$icao])) { |
|
377 | - $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
378 | - } else $all[$icao] = $value; |
|
379 | - } |
|
380 | - $count = array(); |
|
381 | - foreach ($all as $key => $row) { |
|
382 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
383 | - } |
|
384 | - array_multisort($count,SORT_DESC,$all); |
|
385 | - } |
|
374 | + foreach ($dall as $value) { |
|
375 | + $icao = $value['airport_arrival_icao']; |
|
376 | + if (isset($all[$icao])) { |
|
377 | + $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
378 | + } else $all[$icao] = $value; |
|
379 | + } |
|
380 | + $count = array(); |
|
381 | + foreach ($all as $key => $row) { |
|
382 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
383 | + } |
|
384 | + array_multisort($count,SORT_DESC,$all); |
|
385 | + } |
|
386 | 386 | |
387 | - return $all; |
|
387 | + return $all; |
|
388 | 388 | } |
389 | 389 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
390 | 390 | global $globalDBdriver, $globalStatsFilters; |
@@ -396,45 +396,45 @@ discard block |
||
396 | 396 | 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 AND filter_name = :filter_name"; |
397 | 397 | } |
398 | 398 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
399 | - try { |
|
400 | - $sth = $this->db->prepare($query); |
|
401 | - $sth->execute($query_data); |
|
402 | - } catch(PDOException $e) { |
|
403 | - echo "error : ".$e->getMessage(); |
|
404 | - } |
|
405 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
406 | - if (empty($all)) { |
|
399 | + try { |
|
400 | + $sth = $this->db->prepare($query); |
|
401 | + $sth->execute($query_data); |
|
402 | + } catch(PDOException $e) { |
|
403 | + echo "error : ".$e->getMessage(); |
|
404 | + } |
|
405 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
406 | + if (empty($all)) { |
|
407 | 407 | $filters = array('airlines' => array($stats_airline)); |
408 | 408 | if ($filter_name != '') { |
409 | 409 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
410 | 410 | } |
411 | - $Spotter = new Spotter($this->db); |
|
412 | - $all = $Spotter->countAllMonthsLastYear($filters); |
|
413 | - } |
|
411 | + $Spotter = new Spotter($this->db); |
|
412 | + $all = $Spotter->countAllMonthsLastYear($filters); |
|
413 | + } |
|
414 | 414 | |
415 | - return $all; |
|
415 | + return $all; |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
419 | 419 | global $globalStatsFilters; |
420 | 420 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
421 | 421 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
422 | - try { |
|
423 | - $sth = $this->db->prepare($query); |
|
424 | - $sth->execute($query_data); |
|
425 | - } catch(PDOException $e) { |
|
426 | - echo "error : ".$e->getMessage(); |
|
427 | - } |
|
428 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
429 | - if (empty($all)) { |
|
422 | + try { |
|
423 | + $sth = $this->db->prepare($query); |
|
424 | + $sth->execute($query_data); |
|
425 | + } catch(PDOException $e) { |
|
426 | + echo "error : ".$e->getMessage(); |
|
427 | + } |
|
428 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
429 | + if (empty($all)) { |
|
430 | 430 | $filters = array('airlines' => array($stats_airline)); |
431 | 431 | if ($filter_name != '') { |
432 | 432 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
433 | 433 | } |
434 | - $Spotter = new Spotter($this->db); |
|
435 | - $all = $Spotter->countAllDatesLastMonth($filters); |
|
436 | - } |
|
437 | - return $all; |
|
434 | + $Spotter = new Spotter($this->db); |
|
435 | + $all = $Spotter->countAllDatesLastMonth($filters); |
|
436 | + } |
|
437 | + return $all; |
|
438 | 438 | } |
439 | 439 | public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
440 | 440 | global $globalDBdriver, $globalStatsFilters; |
@@ -444,103 +444,103 @@ discard block |
||
444 | 444 | $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 AND filter_name = :filter_name"; |
445 | 445 | } |
446 | 446 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
447 | - try { |
|
448 | - $sth = $this->db->prepare($query); |
|
449 | - $sth->execute($query_data); |
|
450 | - } catch(PDOException $e) { |
|
451 | - echo "error : ".$e->getMessage(); |
|
452 | - } |
|
453 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
454 | - if (empty($all)) { |
|
447 | + try { |
|
448 | + $sth = $this->db->prepare($query); |
|
449 | + $sth->execute($query_data); |
|
450 | + } catch(PDOException $e) { |
|
451 | + echo "error : ".$e->getMessage(); |
|
452 | + } |
|
453 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
454 | + if (empty($all)) { |
|
455 | 455 | $filters = array('airlines' => array($stats_airline)); |
456 | 456 | if ($filter_name != '') { |
457 | 457 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
458 | 458 | } |
459 | - $Spotter = new Spotter($this->db); |
|
460 | - $all = $Spotter->countAllDatesLast7Days($filters); |
|
461 | - } |
|
462 | - return $all; |
|
459 | + $Spotter = new Spotter($this->db); |
|
460 | + $all = $Spotter->countAllDatesLast7Days($filters); |
|
461 | + } |
|
462 | + return $all; |
|
463 | 463 | } |
464 | 464 | public function countAllDates($stats_airline = '',$filter_name = '') { |
465 | 465 | global $globalStatsFilters; |
466 | 466 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
467 | 467 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
468 | - try { |
|
469 | - $sth = $this->db->prepare($query); |
|
470 | - $sth->execute($query_data); |
|
471 | - } catch(PDOException $e) { |
|
472 | - echo "error : ".$e->getMessage(); |
|
473 | - } |
|
474 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
475 | - if (empty($all)) { |
|
468 | + try { |
|
469 | + $sth = $this->db->prepare($query); |
|
470 | + $sth->execute($query_data); |
|
471 | + } catch(PDOException $e) { |
|
472 | + echo "error : ".$e->getMessage(); |
|
473 | + } |
|
474 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
475 | + if (empty($all)) { |
|
476 | 476 | $filters = array('airlines' => array($stats_airline)); |
477 | 477 | if ($filter_name != '') { |
478 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
478 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
479 | 479 | } |
480 | - $Spotter = new Spotter($this->db); |
|
481 | - $all = $Spotter->countAllDates($filters); |
|
482 | - } |
|
483 | - return $all; |
|
480 | + $Spotter = new Spotter($this->db); |
|
481 | + $all = $Spotter->countAllDates($filters); |
|
482 | + } |
|
483 | + return $all; |
|
484 | 484 | } |
485 | 485 | public function countAllDatesByAirlines($filter_name = '') { |
486 | 486 | $query = "SELECT stats_airline as airline_icao, flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND filter_name = :filter_name"; |
487 | 487 | $query_data = array('filter_name' => $filter_name); |
488 | - try { |
|
489 | - $sth = $this->db->prepare($query); |
|
490 | - $sth->execute($query_data); |
|
491 | - } catch(PDOException $e) { |
|
492 | - echo "error : ".$e->getMessage(); |
|
493 | - } |
|
494 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
495 | - if (empty($all)) { |
|
496 | - $filters = array(); |
|
497 | - if ($filter_name != '') { |
|
498 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
499 | - } |
|
500 | - $Spotter = new Spotter($this->db); |
|
501 | - $all = $Spotter->countAllDatesByAirlines($filters); |
|
502 | - } |
|
503 | - return $all; |
|
488 | + try { |
|
489 | + $sth = $this->db->prepare($query); |
|
490 | + $sth->execute($query_data); |
|
491 | + } catch(PDOException $e) { |
|
492 | + echo "error : ".$e->getMessage(); |
|
493 | + } |
|
494 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
495 | + if (empty($all)) { |
|
496 | + $filters = array(); |
|
497 | + if ($filter_name != '') { |
|
498 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
499 | + } |
|
500 | + $Spotter = new Spotter($this->db); |
|
501 | + $all = $Spotter->countAllDatesByAirlines($filters); |
|
502 | + } |
|
503 | + return $all; |
|
504 | 504 | } |
505 | 505 | public function countAllMonths($stats_airline = '',$filter_name = '') { |
506 | 506 | global $globalStatsFilters; |
507 | - $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 AND filter_name = :filter_name"; |
|
508 | - try { |
|
509 | - $sth = $this->db->prepare($query); |
|
510 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
511 | - } catch(PDOException $e) { |
|
512 | - echo "error : ".$e->getMessage(); |
|
513 | - } |
|
514 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
515 | - if (empty($all)) { |
|
507 | + $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 AND filter_name = :filter_name"; |
|
508 | + try { |
|
509 | + $sth = $this->db->prepare($query); |
|
510 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
511 | + } catch(PDOException $e) { |
|
512 | + echo "error : ".$e->getMessage(); |
|
513 | + } |
|
514 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
515 | + if (empty($all)) { |
|
516 | 516 | $filters = array('airlines' => array($stats_airline)); |
517 | 517 | if ($filter_name != '') { |
518 | 518 | $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
519 | 519 | } |
520 | - $Spotter = new Spotter($this->db); |
|
521 | - $all = $Spotter->countAllMonths($filters); |
|
522 | - } |
|
523 | - return $all; |
|
520 | + $Spotter = new Spotter($this->db); |
|
521 | + $all = $Spotter->countAllMonths($filters); |
|
522 | + } |
|
523 | + return $all; |
|
524 | 524 | } |
525 | 525 | public function countAllMilitaryMonths($filter_name = '') { |
526 | 526 | global $globalStatsFilters; |
527 | - $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' AND filter_name = :filter_name"; |
|
528 | - try { |
|
529 | - $sth = $this->db->prepare($query); |
|
530 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
531 | - } catch(PDOException $e) { |
|
532 | - echo "error : ".$e->getMessage(); |
|
533 | - } |
|
534 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
535 | - if (empty($all)) { |
|
536 | - $filters = array(); |
|
537 | - if ($filter_name != '') { |
|
538 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
539 | - } |
|
540 | - $Spotter = new Spotter($this->db); |
|
541 | - $all = $Spotter->countAllMilitaryMonths($filters); |
|
542 | - } |
|
543 | - return $all; |
|
527 | + $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' AND filter_name = :filter_name"; |
|
528 | + try { |
|
529 | + $sth = $this->db->prepare($query); |
|
530 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
531 | + } catch(PDOException $e) { |
|
532 | + echo "error : ".$e->getMessage(); |
|
533 | + } |
|
534 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
535 | + if (empty($all)) { |
|
536 | + $filters = array(); |
|
537 | + if ($filter_name != '') { |
|
538 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
539 | + } |
|
540 | + $Spotter = new Spotter($this->db); |
|
541 | + $all = $Spotter->countAllMilitaryMonths($filters); |
|
542 | + } |
|
543 | + return $all; |
|
544 | 544 | } |
545 | 545 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
546 | 546 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
@@ -555,22 +555,22 @@ discard block |
||
555 | 555 | } |
556 | 556 | } |
557 | 557 | if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
558 | - try { |
|
559 | - $sth = $this->db->prepare($query); |
|
560 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
561 | - } catch(PDOException $e) { |
|
562 | - echo "error : ".$e->getMessage(); |
|
563 | - } |
|
564 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
565 | - if (empty($all)) { |
|
558 | + try { |
|
559 | + $sth = $this->db->prepare($query); |
|
560 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
561 | + } catch(PDOException $e) { |
|
562 | + echo "error : ".$e->getMessage(); |
|
563 | + } |
|
564 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
565 | + if (empty($all)) { |
|
566 | 566 | $filters = array('airlines' => array($stats_airline)); |
567 | 567 | if ($filter_name != '') { |
568 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
568 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
569 | 569 | } |
570 | - $Spotter = new Spotter($this->db); |
|
571 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
572 | - } |
|
573 | - return $all; |
|
570 | + $Spotter = new Spotter($this->db); |
|
571 | + $all = $Spotter->countAllHours($orderby,$filters); |
|
572 | + } |
|
573 | + return $all; |
|
574 | 574 | } |
575 | 575 | |
576 | 576 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
@@ -589,9 +589,9 @@ discard block |
||
589 | 589 | public function countOverallMilitaryFlights($filter_name = '') { |
590 | 590 | $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
591 | 591 | if (empty($all)) { |
592 | - $filters = array(); |
|
593 | - if ($filter_name != '') { |
|
594 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
592 | + $filters = array(); |
|
593 | + if ($filter_name != '') { |
|
594 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
595 | 595 | } |
596 | 596 | $Spotter = new Spotter($this->db); |
597 | 597 | $all = $Spotter->countOverallMilitaryFlights($filters); |
@@ -626,19 +626,19 @@ discard block |
||
626 | 626 | } |
627 | 627 | public function countOverallAirlines($filter_name = '') { |
628 | 628 | $query = "SELECT COUNT(*) AS nb_airline FROM stats_airline WHERE filter_name = :filter_name"; |
629 | - try { |
|
630 | - $sth = $this->db->prepare($query); |
|
631 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
632 | - } catch(PDOException $e) { |
|
633 | - echo "error : ".$e->getMessage(); |
|
634 | - } |
|
635 | - $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
636 | - $all = $result[0]['nb_airline']; |
|
629 | + try { |
|
630 | + $sth = $this->db->prepare($query); |
|
631 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
632 | + } catch(PDOException $e) { |
|
633 | + echo "error : ".$e->getMessage(); |
|
634 | + } |
|
635 | + $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
636 | + $all = $result[0]['nb_airline']; |
|
637 | 637 | //$all = $this->getSumStats('airlines_bymonth',date('Y')); |
638 | 638 | if (empty($all)) { |
639 | - $filters = array(); |
|
640 | - if ($filter_name != '') { |
|
641 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
639 | + $filters = array(); |
|
640 | + if ($filter_name != '') { |
|
641 | + $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
642 | 642 | } |
643 | 643 | $Spotter = new Spotter($this->db); |
644 | 644 | $all = $Spotter->countOverallAirlines($filters); |
@@ -686,157 +686,157 @@ discard block |
||
686 | 686 | public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
687 | 687 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
688 | 688 | $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
689 | - try { |
|
690 | - $sth = $this->db->prepare($query); |
|
691 | - $sth->execute($query_values); |
|
692 | - } catch(PDOException $e) { |
|
693 | - echo "error : ".$e->getMessage(); |
|
694 | - } |
|
695 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
696 | - return $all; |
|
689 | + try { |
|
690 | + $sth = $this->db->prepare($query); |
|
691 | + $sth->execute($query_values); |
|
692 | + } catch(PDOException $e) { |
|
693 | + echo "error : ".$e->getMessage(); |
|
694 | + } |
|
695 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
696 | + return $all; |
|
697 | 697 | } |
698 | 698 | public function getStats($type,$stats_airline = '', $filter_name = '') { |
699 | - $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
700 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
701 | - try { |
|
702 | - $sth = $this->db->prepare($query); |
|
703 | - $sth->execute($query_values); |
|
704 | - } catch(PDOException $e) { |
|
705 | - echo "error : ".$e->getMessage(); |
|
706 | - } |
|
707 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
708 | - return $all; |
|
709 | - } |
|
699 | + $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
|
700 | + $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
701 | + try { |
|
702 | + $sth = $this->db->prepare($query); |
|
703 | + $sth->execute($query_values); |
|
704 | + } catch(PDOException $e) { |
|
705 | + echo "error : ".$e->getMessage(); |
|
706 | + } |
|
707 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
708 | + return $all; |
|
709 | + } |
|
710 | 710 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
711 | - global $globalArchiveMonths, $globalDBdriver; |
|
712 | - if ($globalDBdriver == 'mysql') { |
|
713 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
714 | - } else { |
|
715 | - $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
716 | - } |
|
717 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
718 | - try { |
|
719 | - $sth = $this->db->prepare($query); |
|
720 | - $sth->execute($query_values); |
|
721 | - } catch(PDOException $e) { |
|
722 | - echo "error : ".$e->getMessage(); |
|
723 | - } |
|
724 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
725 | - return $all[0]['total']; |
|
726 | - } |
|
711 | + global $globalArchiveMonths, $globalDBdriver; |
|
712 | + if ($globalDBdriver == 'mysql') { |
|
713 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
714 | + } else { |
|
715 | + $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
716 | + } |
|
717 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
718 | + try { |
|
719 | + $sth = $this->db->prepare($query); |
|
720 | + $sth->execute($query_values); |
|
721 | + } catch(PDOException $e) { |
|
722 | + echo "error : ".$e->getMessage(); |
|
723 | + } |
|
724 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
725 | + return $all[0]['total']; |
|
726 | + } |
|
727 | 727 | public function getStatsTotal($type, $stats_airline = '', $filter_name = '') { |
728 | - global $globalArchiveMonths, $globalDBdriver; |
|
729 | - if ($globalDBdriver == 'mysql') { |
|
728 | + global $globalArchiveMonths, $globalDBdriver; |
|
729 | + if ($globalDBdriver == 'mysql') { |
|
730 | 730 | $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 AND filter_name = :filter_name"; |
731 | 731 | } else { |
732 | 732 | $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 AND filter_name = :filter_name"; |
733 | - } |
|
734 | - $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
735 | - try { |
|
736 | - $sth = $this->db->prepare($query); |
|
737 | - $sth->execute($query_values); |
|
738 | - } catch(PDOException $e) { |
|
739 | - echo "error : ".$e->getMessage(); |
|
740 | - } |
|
741 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
742 | - return $all[0]['total']; |
|
743 | - } |
|
733 | + } |
|
734 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
735 | + try { |
|
736 | + $sth = $this->db->prepare($query); |
|
737 | + $sth->execute($query_values); |
|
738 | + } catch(PDOException $e) { |
|
739 | + echo "error : ".$e->getMessage(); |
|
740 | + } |
|
741 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
742 | + return $all[0]['total']; |
|
743 | + } |
|
744 | 744 | public function getStatsAircraftTotal($stats_airline = '', $filter_name = '') { |
745 | - global $globalArchiveMonths, $globalDBdriver; |
|
746 | - if ($globalDBdriver == 'mysql') { |
|
745 | + global $globalArchiveMonths, $globalDBdriver; |
|
746 | + if ($globalDBdriver == 'mysql') { |
|
747 | 747 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
748 | - } else { |
|
748 | + } else { |
|
749 | 749 | $query = "SELECT SUM(cnt) as total FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name"; |
750 | - } |
|
751 | - try { |
|
752 | - $sth = $this->db->prepare($query); |
|
753 | - $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
754 | - } catch(PDOException $e) { |
|
755 | - echo "error : ".$e->getMessage(); |
|
756 | - } |
|
757 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
758 | - return $all[0]['total']; |
|
759 | - } |
|
750 | + } |
|
751 | + try { |
|
752 | + $sth = $this->db->prepare($query); |
|
753 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
754 | + } catch(PDOException $e) { |
|
755 | + echo "error : ".$e->getMessage(); |
|
756 | + } |
|
757 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
758 | + return $all[0]['total']; |
|
759 | + } |
|
760 | 760 | public function getStatsAirlineTotal($filter_name = '') { |
761 | - global $globalArchiveMonths, $globalDBdriver; |
|
762 | - if ($globalDBdriver == 'mysql') { |
|
761 | + global $globalArchiveMonths, $globalDBdriver; |
|
762 | + if ($globalDBdriver == 'mysql') { |
|
763 | 763 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
764 | - } else { |
|
764 | + } else { |
|
765 | 765 | $query = "SELECT SUM(cnt) as total FROM stats_airline WHERE filter_name = :filter_name"; |
766 | - } |
|
767 | - try { |
|
768 | - $sth = $this->db->prepare($query); |
|
769 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
770 | - } catch(PDOException $e) { |
|
771 | - echo "error : ".$e->getMessage(); |
|
772 | - } |
|
773 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
774 | - return $all[0]['total']; |
|
775 | - } |
|
766 | + } |
|
767 | + try { |
|
768 | + $sth = $this->db->prepare($query); |
|
769 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
770 | + } catch(PDOException $e) { |
|
771 | + echo "error : ".$e->getMessage(); |
|
772 | + } |
|
773 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
774 | + return $all[0]['total']; |
|
775 | + } |
|
776 | 776 | public function getStatsOwnerTotal($filter_name = '') { |
777 | - global $globalArchiveMonths, $globalDBdriver; |
|
778 | - if ($globalDBdriver == 'mysql') { |
|
777 | + global $globalArchiveMonths, $globalDBdriver; |
|
778 | + if ($globalDBdriver == 'mysql') { |
|
779 | 779 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
780 | 780 | } else { |
781 | 781 | $query = "SELECT SUM(cnt) as total FROM stats_owner WHERE filter_name = :filter_name"; |
782 | - } |
|
783 | - try { |
|
784 | - $sth = $this->db->prepare($query); |
|
785 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
786 | - } catch(PDOException $e) { |
|
787 | - echo "error : ".$e->getMessage(); |
|
788 | - } |
|
789 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
790 | - return $all[0]['total']; |
|
791 | - } |
|
782 | + } |
|
783 | + try { |
|
784 | + $sth = $this->db->prepare($query); |
|
785 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
786 | + } catch(PDOException $e) { |
|
787 | + echo "error : ".$e->getMessage(); |
|
788 | + } |
|
789 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
790 | + return $all[0]['total']; |
|
791 | + } |
|
792 | 792 | public function getStatsPilotTotal($filter_name = '') { |
793 | - global $globalArchiveMonths, $globalDBdriver; |
|
794 | - if ($globalDBdriver == 'mysql') { |
|
795 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
796 | - } else { |
|
797 | - $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
798 | - } |
|
799 | - try { |
|
800 | - $sth = $this->db->prepare($query); |
|
801 | - $sth->execute(array(':filter_name' => $filter_name)); |
|
802 | - } catch(PDOException $e) { |
|
803 | - echo "error : ".$e->getMessage(); |
|
804 | - } |
|
805 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
806 | - return $all[0]['total']; |
|
807 | - } |
|
793 | + global $globalArchiveMonths, $globalDBdriver; |
|
794 | + if ($globalDBdriver == 'mysql') { |
|
795 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
796 | + } else { |
|
797 | + $query = "SELECT SUM(cnt) as total FROM stats_pilot WHERE filter_name = :filter_name"; |
|
798 | + } |
|
799 | + try { |
|
800 | + $sth = $this->db->prepare($query); |
|
801 | + $sth->execute(array(':filter_name' => $filter_name)); |
|
802 | + } catch(PDOException $e) { |
|
803 | + echo "error : ".$e->getMessage(); |
|
804 | + } |
|
805 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
806 | + return $all[0]['total']; |
|
807 | + } |
|
808 | 808 | |
809 | 809 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
810 | 810 | global $globalDBdriver; |
811 | 811 | if ($globalDBdriver == 'mysql') { |
812 | 812 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
813 | - } else { |
|
813 | + } else { |
|
814 | 814 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
815 | 815 | } |
816 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
817 | - try { |
|
818 | - $sth = $this->db->prepare($query); |
|
819 | - $sth->execute($query_values); |
|
820 | - } catch(PDOException $e) { |
|
821 | - return "error : ".$e->getMessage(); |
|
822 | - } |
|
823 | - } |
|
816 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
817 | + try { |
|
818 | + $sth = $this->db->prepare($query); |
|
819 | + $sth->execute($query_values); |
|
820 | + } catch(PDOException $e) { |
|
821 | + return "error : ".$e->getMessage(); |
|
822 | + } |
|
823 | + } |
|
824 | 824 | public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
825 | 825 | global $globalDBdriver; |
826 | 826 | if ($globalDBdriver == 'mysql') { |
827 | 827 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
828 | 828 | } else { |
829 | - //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
829 | + //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
|
830 | 830 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
831 | - } |
|
832 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
833 | - try { |
|
834 | - $sth = $this->db->prepare($query); |
|
835 | - $sth->execute($query_values); |
|
836 | - } catch(PDOException $e) { |
|
837 | - return "error : ".$e->getMessage(); |
|
838 | - } |
|
839 | - } |
|
831 | + } |
|
832 | + $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
833 | + try { |
|
834 | + $sth = $this->db->prepare($query); |
|
835 | + $sth->execute($query_values); |
|
836 | + } catch(PDOException $e) { |
|
837 | + return "error : ".$e->getMessage(); |
|
838 | + } |
|
839 | + } |
|
840 | 840 | public function getStatsSource($date,$stats_type = '') { |
841 | 841 | if ($stats_type == '') { |
842 | 842 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
@@ -845,15 +845,15 @@ discard block |
||
845 | 845 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
846 | 846 | $query_values = array(':date' => $date,':stats_type' => $stats_type); |
847 | 847 | } |
848 | - try { |
|
849 | - $sth = $this->db->prepare($query); |
|
850 | - $sth->execute($query_values); |
|
851 | - } catch(PDOException $e) { |
|
852 | - echo "error : ".$e->getMessage(); |
|
853 | - } |
|
854 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
855 | - return $all; |
|
856 | - } |
|
848 | + try { |
|
849 | + $sth = $this->db->prepare($query); |
|
850 | + $sth->execute($query_values); |
|
851 | + } catch(PDOException $e) { |
|
852 | + echo "error : ".$e->getMessage(); |
|
853 | + } |
|
854 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
855 | + return $all; |
|
856 | + } |
|
857 | 857 | |
858 | 858 | public function addStatSource($data,$source_name,$stats_type,$date) { |
859 | 859 | global $globalDBdriver; |
@@ -861,25 +861,25 @@ discard block |
||
861 | 861 | $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"; |
862 | 862 | } else { |
863 | 863 | $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);"; |
864 | - } |
|
865 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
866 | - try { |
|
867 | - $sth = $this->db->prepare($query); |
|
868 | - $sth->execute($query_values); |
|
869 | - } catch(PDOException $e) { |
|
870 | - return "error : ".$e->getMessage(); |
|
871 | - } |
|
872 | - } |
|
864 | + } |
|
865 | + $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
866 | + try { |
|
867 | + $sth = $this->db->prepare($query); |
|
868 | + $sth->execute($query_values); |
|
869 | + } catch(PDOException $e) { |
|
870 | + return "error : ".$e->getMessage(); |
|
871 | + } |
|
872 | + } |
|
873 | 873 | public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
874 | - $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
875 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
876 | - try { |
|
877 | - $sth = $this->db->prepare($query); |
|
878 | - $sth->execute($query_values); |
|
879 | - } catch(PDOException $e) { |
|
880 | - return "error : ".$e->getMessage(); |
|
881 | - } |
|
882 | - } |
|
874 | + $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
|
875 | + $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
876 | + try { |
|
877 | + $sth = $this->db->prepare($query); |
|
878 | + $sth->execute($query_values); |
|
879 | + } catch(PDOException $e) { |
|
880 | + return "error : ".$e->getMessage(); |
|
881 | + } |
|
882 | + } |
|
883 | 883 | public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') { |
884 | 884 | global $globalDBdriver; |
885 | 885 | if ($globalDBdriver == 'mysql') { |
@@ -887,14 +887,14 @@ discard block |
||
887 | 887 | } else { |
888 | 888 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
889 | 889 | } |
890 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
891 | - try { |
|
892 | - $sth = $this->db->prepare($query); |
|
893 | - $sth->execute($query_values); |
|
894 | - } catch(PDOException $e) { |
|
895 | - return "error : ".$e->getMessage(); |
|
896 | - } |
|
897 | - } |
|
890 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
891 | + try { |
|
892 | + $sth = $this->db->prepare($query); |
|
893 | + $sth->execute($query_values); |
|
894 | + } catch(PDOException $e) { |
|
895 | + return "error : ".$e->getMessage(); |
|
896 | + } |
|
897 | + } |
|
898 | 898 | public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') { |
899 | 899 | global $globalDBdriver; |
900 | 900 | if ($globalDBdriver == 'mysql') { |
@@ -902,14 +902,14 @@ discard block |
||
902 | 902 | } else { |
903 | 903 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
904 | 904 | } |
905 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
906 | - try { |
|
907 | - $sth = $this->db->prepare($query); |
|
908 | - $sth->execute($query_values); |
|
909 | - } catch(PDOException $e) { |
|
910 | - return "error : ".$e->getMessage(); |
|
911 | - } |
|
912 | - } |
|
905 | + $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
906 | + try { |
|
907 | + $sth = $this->db->prepare($query); |
|
908 | + $sth->execute($query_values); |
|
909 | + } catch(PDOException $e) { |
|
910 | + return "error : ".$e->getMessage(); |
|
911 | + } |
|
912 | + } |
|
913 | 913 | public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') { |
914 | 914 | global $globalDBdriver; |
915 | 915 | if ($globalDBdriver == 'mysql') { |
@@ -917,14 +917,14 @@ discard block |
||
917 | 917 | } else { |
918 | 918 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
919 | 919 | } |
920 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
921 | - try { |
|
922 | - $sth = $this->db->prepare($query); |
|
923 | - $sth->execute($query_values); |
|
924 | - } catch(PDOException $e) { |
|
925 | - return "error : ".$e->getMessage(); |
|
926 | - } |
|
927 | - } |
|
920 | + $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
921 | + try { |
|
922 | + $sth = $this->db->prepare($query); |
|
923 | + $sth->execute($query_values); |
|
924 | + } catch(PDOException $e) { |
|
925 | + return "error : ".$e->getMessage(); |
|
926 | + } |
|
927 | + } |
|
928 | 928 | public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
929 | 929 | global $globalDBdriver; |
930 | 930 | if ($globalDBdriver == 'mysql') { |
@@ -932,14 +932,14 @@ discard block |
||
932 | 932 | } else { |
933 | 933 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
934 | 934 | } |
935 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
936 | - try { |
|
937 | - $sth = $this->db->prepare($query); |
|
938 | - $sth->execute($query_values); |
|
939 | - } catch(PDOException $e) { |
|
940 | - return "error : ".$e->getMessage(); |
|
941 | - } |
|
942 | - } |
|
935 | + $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
936 | + try { |
|
937 | + $sth = $this->db->prepare($query); |
|
938 | + $sth->execute($query_values); |
|
939 | + } catch(PDOException $e) { |
|
940 | + return "error : ".$e->getMessage(); |
|
941 | + } |
|
942 | + } |
|
943 | 943 | public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') { |
944 | 944 | global $globalDBdriver; |
945 | 945 | if ($globalDBdriver == 'mysql') { |
@@ -947,14 +947,14 @@ discard block |
||
947 | 947 | } else { |
948 | 948 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
949 | 949 | } |
950 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
951 | - try { |
|
952 | - $sth = $this->db->prepare($query); |
|
953 | - $sth->execute($query_values); |
|
954 | - } catch(PDOException $e) { |
|
955 | - return "error : ".$e->getMessage(); |
|
956 | - } |
|
957 | - } |
|
950 | + $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
951 | + try { |
|
952 | + $sth = $this->db->prepare($query); |
|
953 | + $sth->execute($query_values); |
|
954 | + } catch(PDOException $e) { |
|
955 | + return "error : ".$e->getMessage(); |
|
956 | + } |
|
957 | + } |
|
958 | 958 | public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') { |
959 | 959 | global $globalDBdriver; |
960 | 960 | if ($globalDBdriver == 'mysql') { |
@@ -962,14 +962,14 @@ discard block |
||
962 | 962 | } else { |
963 | 963 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
964 | 964 | } |
965 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
966 | - try { |
|
967 | - $sth = $this->db->prepare($query); |
|
968 | - $sth->execute($query_values); |
|
969 | - } catch(PDOException $e) { |
|
970 | - return "error : ".$e->getMessage(); |
|
971 | - } |
|
972 | - } |
|
965 | + $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
966 | + try { |
|
967 | + $sth = $this->db->prepare($query); |
|
968 | + $sth->execute($query_values); |
|
969 | + } catch(PDOException $e) { |
|
970 | + return "error : ".$e->getMessage(); |
|
971 | + } |
|
972 | + } |
|
973 | 973 | public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '') { |
974 | 974 | global $globalDBdriver; |
975 | 975 | if ($globalDBdriver == 'mysql') { |
@@ -977,14 +977,14 @@ discard block |
||
977 | 977 | } else { |
978 | 978 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
979 | 979 | } |
980 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
981 | - try { |
|
982 | - $sth = $this->db->prepare($query); |
|
983 | - $sth->execute($query_values); |
|
984 | - } catch(PDOException $e) { |
|
985 | - return "error : ".$e->getMessage(); |
|
986 | - } |
|
987 | - } |
|
980 | + $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
981 | + try { |
|
982 | + $sth = $this->db->prepare($query); |
|
983 | + $sth->execute($query_values); |
|
984 | + } catch(PDOException $e) { |
|
985 | + return "error : ".$e->getMessage(); |
|
986 | + } |
|
987 | + } |
|
988 | 988 | public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
989 | 989 | global $globalDBdriver; |
990 | 990 | if ($globalDBdriver == 'mysql') { |
@@ -992,14 +992,14 @@ discard block |
||
992 | 992 | } else { |
993 | 993 | $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 AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name 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 AND filter_name = :filter_name);"; |
994 | 994 | } |
995 | - $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,':filter_name' => $filter_name); |
|
996 | - try { |
|
997 | - $sth = $this->db->prepare($query); |
|
998 | - $sth->execute($query_values); |
|
999 | - } catch(PDOException $e) { |
|
1000 | - return "error : ".$e->getMessage(); |
|
1001 | - } |
|
1002 | - } |
|
995 | + $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,':filter_name' => $filter_name); |
|
996 | + try { |
|
997 | + $sth = $this->db->prepare($query); |
|
998 | + $sth->execute($query_values); |
|
999 | + } catch(PDOException $e) { |
|
1000 | + return "error : ".$e->getMessage(); |
|
1001 | + } |
|
1002 | + } |
|
1003 | 1003 | public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
1004 | 1004 | global $globalDBdriver; |
1005 | 1005 | if ($globalDBdriver == 'mysql') { |
@@ -1007,14 +1007,14 @@ discard block |
||
1007 | 1007 | } else { |
1008 | 1008 | $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 AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name 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 AND filter_name = :filter_name);"; |
1009 | 1009 | } |
1010 | - $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,':filter_name' => $filter_name); |
|
1011 | - try { |
|
1012 | - $sth = $this->db->prepare($query); |
|
1013 | - $sth->execute($query_values); |
|
1014 | - } catch(PDOException $e) { |
|
1015 | - return "error : ".$e->getMessage(); |
|
1016 | - } |
|
1017 | - } |
|
1010 | + $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,':filter_name' => $filter_name); |
|
1011 | + try { |
|
1012 | + $sth = $this->db->prepare($query); |
|
1013 | + $sth->execute($query_values); |
|
1014 | + } catch(PDOException $e) { |
|
1015 | + return "error : ".$e->getMessage(); |
|
1016 | + } |
|
1017 | + } |
|
1018 | 1018 | public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
1019 | 1019 | global $globalDBdriver; |
1020 | 1020 | if ($globalDBdriver == 'mysql') { |
@@ -1022,14 +1022,14 @@ discard block |
||
1022 | 1022 | } else { |
1023 | 1023 | $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 AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name 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 AND filter_name = :filter_name);"; |
1024 | 1024 | } |
1025 | - $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,':filter_name' => $filter_name); |
|
1026 | - try { |
|
1027 | - $sth = $this->db->prepare($query); |
|
1028 | - $sth->execute($query_values); |
|
1029 | - } catch(PDOException $e) { |
|
1030 | - return "error : ".$e->getMessage(); |
|
1031 | - } |
|
1032 | - } |
|
1025 | + $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,':filter_name' => $filter_name); |
|
1026 | + try { |
|
1027 | + $sth = $this->db->prepare($query); |
|
1028 | + $sth->execute($query_values); |
|
1029 | + } catch(PDOException $e) { |
|
1030 | + return "error : ".$e->getMessage(); |
|
1031 | + } |
|
1032 | + } |
|
1033 | 1033 | public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
1034 | 1034 | global $globalDBdriver; |
1035 | 1035 | if ($globalDBdriver == 'mysql') { |
@@ -1037,52 +1037,52 @@ discard block |
||
1037 | 1037 | } else { |
1038 | 1038 | $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 AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name 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 AND filter_name = :filter_name);"; |
1039 | 1039 | } |
1040 | - $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,':filter_name' => $filter_name); |
|
1041 | - try { |
|
1042 | - $sth = $this->db->prepare($query); |
|
1043 | - $sth->execute($query_values); |
|
1044 | - } catch(PDOException $e) { |
|
1045 | - return "error : ".$e->getMessage(); |
|
1046 | - } |
|
1047 | - } |
|
1040 | + $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,':filter_name' => $filter_name); |
|
1041 | + try { |
|
1042 | + $sth = $this->db->prepare($query); |
|
1043 | + $sth->execute($query_values); |
|
1044 | + } catch(PDOException $e) { |
|
1045 | + return "error : ".$e->getMessage(); |
|
1046 | + } |
|
1047 | + } |
|
1048 | 1048 | |
1049 | 1049 | public function deleteStat($id) { |
1050 | - $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
1051 | - $query_values = array(':id' => $id); |
|
1052 | - try { |
|
1053 | - $sth = $this->db->prepare($query); |
|
1054 | - $sth->execute($query_values); |
|
1055 | - } catch(PDOException $e) { |
|
1056 | - return "error : ".$e->getMessage(); |
|
1057 | - } |
|
1058 | - } |
|
1050 | + $query = "DELETE FROM stats WHERE stats_id = :id"; |
|
1051 | + $query_values = array(':id' => $id); |
|
1052 | + try { |
|
1053 | + $sth = $this->db->prepare($query); |
|
1054 | + $sth->execute($query_values); |
|
1055 | + } catch(PDOException $e) { |
|
1056 | + return "error : ".$e->getMessage(); |
|
1057 | + } |
|
1058 | + } |
|
1059 | 1059 | public function deleteStatFlight($type) { |
1060 | - $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
1061 | - $query_values = array(':type' => $type); |
|
1062 | - try { |
|
1063 | - $sth = $this->db->prepare($query); |
|
1064 | - $sth->execute($query_values); |
|
1065 | - } catch(PDOException $e) { |
|
1066 | - return "error : ".$e->getMessage(); |
|
1067 | - } |
|
1068 | - } |
|
1060 | + $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
|
1061 | + $query_values = array(':type' => $type); |
|
1062 | + try { |
|
1063 | + $sth = $this->db->prepare($query); |
|
1064 | + $sth->execute($query_values); |
|
1065 | + } catch(PDOException $e) { |
|
1066 | + return "error : ".$e->getMessage(); |
|
1067 | + } |
|
1068 | + } |
|
1069 | 1069 | public function deleteStatAirport($type) { |
1070 | - $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
1071 | - $query_values = array(':type' => $type); |
|
1072 | - try { |
|
1073 | - $sth = $this->db->prepare($query); |
|
1074 | - $sth->execute($query_values); |
|
1075 | - } catch(PDOException $e) { |
|
1076 | - return "error : ".$e->getMessage(); |
|
1077 | - } |
|
1078 | - } |
|
1070 | + $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
|
1071 | + $query_values = array(':type' => $type); |
|
1072 | + try { |
|
1073 | + $sth = $this->db->prepare($query); |
|
1074 | + $sth->execute($query_values); |
|
1075 | + } catch(PDOException $e) { |
|
1076 | + return "error : ".$e->getMessage(); |
|
1077 | + } |
|
1078 | + } |
|
1079 | 1079 | |
1080 | - public function addOldStats() { |
|
1081 | - global $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters; |
|
1082 | - $Common = new Common(); |
|
1083 | - $Connection = new Connection(); |
|
1084 | - date_default_timezone_set('UTC'); |
|
1085 | - $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
1080 | + public function addOldStats() { |
|
1081 | + global $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters; |
|
1082 | + $Common = new Common(); |
|
1083 | + $Connection = new Connection(); |
|
1084 | + date_default_timezone_set('UTC'); |
|
1085 | + $last_update = $this->getLastStatsUpdate('last_update_stats'); |
|
1086 | 1086 | //print_r($last_update); |
1087 | 1087 | /* |
1088 | 1088 | $flightsbymonth = $this->getStats('flights_by_month'); |
@@ -1336,46 +1336,46 @@ discard block |
||
1336 | 1336 | } |
1337 | 1337 | |
1338 | 1338 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
1339 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1340 | - $alldata = array(); |
|
1339 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1340 | + $alldata = array(); |
|
1341 | 1341 | |
1342 | - foreach ($pall as $value) { |
|
1343 | - $icao = $value['airport_departure_icao']; |
|
1344 | - $alldata[$icao] = $value; |
|
1345 | - } |
|
1346 | - foreach ($dall as $value) { |
|
1347 | - $icao = $value['airport_departure_icao']; |
|
1348 | - if (isset($alldata[$icao])) { |
|
1349 | - $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1350 | - } else $alldata[$icao] = $value; |
|
1351 | - } |
|
1352 | - $count = array(); |
|
1353 | - foreach ($alldata as $key => $row) { |
|
1354 | - $count[$key] = $row['airport_departure_icao_count']; |
|
1355 | - } |
|
1342 | + foreach ($pall as $value) { |
|
1343 | + $icao = $value['airport_departure_icao']; |
|
1344 | + $alldata[$icao] = $value; |
|
1345 | + } |
|
1346 | + foreach ($dall as $value) { |
|
1347 | + $icao = $value['airport_departure_icao']; |
|
1348 | + if (isset($alldata[$icao])) { |
|
1349 | + $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1350 | + } else $alldata[$icao] = $value; |
|
1351 | + } |
|
1352 | + $count = array(); |
|
1353 | + foreach ($alldata as $key => $row) { |
|
1354 | + $count[$key] = $row['airport_departure_icao_count']; |
|
1355 | + } |
|
1356 | 1356 | array_multisort($count,SORT_DESC,$alldata); |
1357 | 1357 | foreach ($alldata as $number) { |
1358 | 1358 | echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
1359 | 1359 | } |
1360 | 1360 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
1361 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1362 | - $alldata = array(); |
|
1363 | - foreach ($pall as $value) { |
|
1364 | - $icao = $value['airport_arrival_icao']; |
|
1365 | - $alldata[$icao] = $value; |
|
1366 | - } |
|
1367 | - foreach ($dall as $value) { |
|
1368 | - $icao = $value['airport_arrival_icao']; |
|
1369 | - if (isset($alldata[$icao])) { |
|
1370 | - $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1371 | - } else $alldata[$icao] = $value; |
|
1372 | - } |
|
1373 | - $count = array(); |
|
1374 | - foreach ($alldata as $key => $row) { |
|
1375 | - $count[$key] = $row['airport_arrival_icao_count']; |
|
1376 | - } |
|
1377 | - array_multisort($count,SORT_DESC,$alldata); |
|
1378 | - foreach ($alldata as $number) { |
|
1361 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1362 | + $alldata = array(); |
|
1363 | + foreach ($pall as $value) { |
|
1364 | + $icao = $value['airport_arrival_icao']; |
|
1365 | + $alldata[$icao] = $value; |
|
1366 | + } |
|
1367 | + foreach ($dall as $value) { |
|
1368 | + $icao = $value['airport_arrival_icao']; |
|
1369 | + if (isset($alldata[$icao])) { |
|
1370 | + $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1371 | + } else $alldata[$icao] = $value; |
|
1372 | + } |
|
1373 | + $count = array(); |
|
1374 | + foreach ($alldata as $key => $row) { |
|
1375 | + $count[$key] = $row['airport_arrival_icao_count']; |
|
1376 | + } |
|
1377 | + array_multisort($count,SORT_DESC,$alldata); |
|
1378 | + foreach ($alldata as $number) { |
|
1379 | 1379 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
1380 | 1380 | } |
1381 | 1381 | if ($Connection->tableExists('countries')) { |
@@ -1427,8 +1427,8 @@ discard block |
||
1427 | 1427 | // $pall = $Spotter->getLast7DaysAirportsDeparture(); |
1428 | 1428 | // $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
1429 | 1429 | $pall = $Spotter->getLast7DaysAirportsDeparture(); |
1430 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
1431 | - /* |
|
1430 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture(); |
|
1431 | + /* |
|
1432 | 1432 | $alldata = array(); |
1433 | 1433 | foreach ($pall as $value) { |
1434 | 1434 | $icao = $value['departure_airport_icao']; |
@@ -1447,29 +1447,29 @@ discard block |
||
1447 | 1447 | } |
1448 | 1448 | array_multisort($count,SORT_DESC,$alldata); |
1449 | 1449 | */ |
1450 | - foreach ($dall as $value) { |
|
1451 | - $icao = $value['departure_airport_icao']; |
|
1452 | - $ddate = $value['date']; |
|
1453 | - $find = false; |
|
1454 | - foreach ($pall as $pvalue) { |
|
1455 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1456 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1457 | - $find = true; |
|
1458 | - break; |
|
1459 | - } |
|
1460 | - } |
|
1461 | - if ($find === false) { |
|
1462 | - $pall[] = $value; |
|
1463 | - } |
|
1464 | - } |
|
1465 | - $alldata = $pall; |
|
1450 | + foreach ($dall as $value) { |
|
1451 | + $icao = $value['departure_airport_icao']; |
|
1452 | + $ddate = $value['date']; |
|
1453 | + $find = false; |
|
1454 | + foreach ($pall as $pvalue) { |
|
1455 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1456 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1457 | + $find = true; |
|
1458 | + break; |
|
1459 | + } |
|
1460 | + } |
|
1461 | + if ($find === false) { |
|
1462 | + $pall[] = $value; |
|
1463 | + } |
|
1464 | + } |
|
1465 | + $alldata = $pall; |
|
1466 | 1466 | foreach ($alldata as $number) { |
1467 | 1467 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
1468 | 1468 | } |
1469 | 1469 | echo '...Arrival'."\n"; |
1470 | 1470 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
1471 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
1472 | - /* |
|
1471 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival(); |
|
1472 | + /* |
|
1473 | 1473 | $alldata = array(); |
1474 | 1474 | foreach ($pall as $value) { |
1475 | 1475 | $icao = $value['arrival_airport_icao']; |
@@ -1489,22 +1489,22 @@ discard block |
||
1489 | 1489 | */ |
1490 | 1490 | |
1491 | 1491 | |
1492 | - foreach ($dall as $value) { |
|
1493 | - $icao = $value['arrival_airport_icao']; |
|
1494 | - $ddate = $value['date']; |
|
1495 | - $find = false; |
|
1496 | - foreach ($pall as $pvalue) { |
|
1497 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1498 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1499 | - $find = true; |
|
1500 | - break; |
|
1501 | - } |
|
1502 | - } |
|
1503 | - if ($find === false) { |
|
1504 | - $pall[] = $value; |
|
1505 | - } |
|
1506 | - } |
|
1507 | - $alldata = $pall; |
|
1492 | + foreach ($dall as $value) { |
|
1493 | + $icao = $value['arrival_airport_icao']; |
|
1494 | + $ddate = $value['date']; |
|
1495 | + $find = false; |
|
1496 | + foreach ($pall as $pvalue) { |
|
1497 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate) { |
|
1498 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1499 | + $find = true; |
|
1500 | + break; |
|
1501 | + } |
|
1502 | + } |
|
1503 | + if ($find === false) { |
|
1504 | + $pall[] = $value; |
|
1505 | + } |
|
1506 | + } |
|
1507 | + $alldata = $pall; |
|
1508 | 1508 | foreach ($alldata as $number) { |
1509 | 1509 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
1510 | 1510 | } |
@@ -1564,47 +1564,47 @@ discard block |
||
1564 | 1564 | } |
1565 | 1565 | |
1566 | 1566 | $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
1567 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1568 | - //$alldata = array(); |
|
1569 | - foreach ($dall as $value) { |
|
1570 | - $icao = $value['airport_departure_icao']; |
|
1571 | - $dicao = $value['airline_icap']; |
|
1572 | - $find = false; |
|
1573 | - foreach ($pall as $pvalue) { |
|
1574 | - if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1575 | - $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1576 | - $find = true; |
|
1577 | - break; |
|
1578 | - } |
|
1579 | - } |
|
1580 | - if ($find === false) { |
|
1581 | - $pall[] = $value; |
|
1582 | - } |
|
1583 | - } |
|
1584 | - $alldata = $pall; |
|
1567 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1568 | + //$alldata = array(); |
|
1569 | + foreach ($dall as $value) { |
|
1570 | + $icao = $value['airport_departure_icao']; |
|
1571 | + $dicao = $value['airline_icap']; |
|
1572 | + $find = false; |
|
1573 | + foreach ($pall as $pvalue) { |
|
1574 | + if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1575 | + $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1576 | + $find = true; |
|
1577 | + break; |
|
1578 | + } |
|
1579 | + } |
|
1580 | + if ($find === false) { |
|
1581 | + $pall[] = $value; |
|
1582 | + } |
|
1583 | + } |
|
1584 | + $alldata = $pall; |
|
1585 | 1585 | foreach ($alldata as $number) { |
1586 | 1586 | 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']); |
1587 | 1587 | } |
1588 | 1588 | $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
1589 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1590 | - //$alldata = array(); |
|
1591 | - foreach ($dall as $value) { |
|
1592 | - $icao = $value['airport_arrival_icao']; |
|
1593 | - $dicao = $value['airline_icao']; |
|
1594 | - $find = false; |
|
1595 | - foreach ($pall as $pvalue) { |
|
1596 | - if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1597 | - $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1598 | - $find = true; |
|
1599 | - break; |
|
1600 | - } |
|
1601 | - } |
|
1602 | - if ($find === false) { |
|
1603 | - $pall[] = $value; |
|
1604 | - } |
|
1605 | - } |
|
1606 | - $alldata = $pall; |
|
1607 | - foreach ($alldata as $number) { |
|
1589 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1590 | + //$alldata = array(); |
|
1591 | + foreach ($dall as $value) { |
|
1592 | + $icao = $value['airport_arrival_icao']; |
|
1593 | + $dicao = $value['airline_icao']; |
|
1594 | + $find = false; |
|
1595 | + foreach ($pall as $pvalue) { |
|
1596 | + if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1597 | + $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
|
1598 | + $find = true; |
|
1599 | + break; |
|
1600 | + } |
|
1601 | + } |
|
1602 | + if ($find === false) { |
|
1603 | + $pall[] = $value; |
|
1604 | + } |
|
1605 | + } |
|
1606 | + $alldata = $pall; |
|
1607 | + foreach ($alldata as $number) { |
|
1608 | 1608 | 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']); |
1609 | 1609 | } |
1610 | 1610 | $Spotter = new Spotter($this->db); |
@@ -1632,47 +1632,47 @@ discard block |
||
1632 | 1632 | } |
1633 | 1633 | echo '...Departure'."\n"; |
1634 | 1634 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
1635 | - $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
1636 | - foreach ($dall as $value) { |
|
1637 | - $icao = $value['departure_airport_icao']; |
|
1638 | - $airline = $value['airline_icao']; |
|
1639 | - $ddate = $value['date']; |
|
1640 | - $find = false; |
|
1641 | - foreach ($pall as $pvalue) { |
|
1642 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
1643 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1644 | - $find = true; |
|
1645 | - break; |
|
1646 | - } |
|
1647 | - } |
|
1648 | - if ($find === false) { |
|
1649 | - $pall[] = $value; |
|
1650 | - } |
|
1651 | - } |
|
1652 | - $alldata = $pall; |
|
1635 | + $dall = $Spotter->getLast7DaysDetectedAirportsDepartureByAirlines(); |
|
1636 | + foreach ($dall as $value) { |
|
1637 | + $icao = $value['departure_airport_icao']; |
|
1638 | + $airline = $value['airline_icao']; |
|
1639 | + $ddate = $value['date']; |
|
1640 | + $find = false; |
|
1641 | + foreach ($pall as $pvalue) { |
|
1642 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
1643 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1644 | + $find = true; |
|
1645 | + break; |
|
1646 | + } |
|
1647 | + } |
|
1648 | + if ($find === false) { |
|
1649 | + $pall[] = $value; |
|
1650 | + } |
|
1651 | + } |
|
1652 | + $alldata = $pall; |
|
1653 | 1653 | foreach ($alldata as $number) { |
1654 | 1654 | $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']); |
1655 | 1655 | } |
1656 | 1656 | echo '...Arrival'."\n"; |
1657 | 1657 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
1658 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
1659 | - foreach ($dall as $value) { |
|
1660 | - $icao = $value['arrival_airport_icao']; |
|
1661 | - $airline = $value['airline_icao']; |
|
1662 | - $ddate = $value['date']; |
|
1663 | - $find = false; |
|
1664 | - foreach ($pall as $pvalue) { |
|
1665 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
1666 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1667 | - $find = true; |
|
1668 | - break; |
|
1669 | - } |
|
1670 | - } |
|
1671 | - if ($find === false) { |
|
1672 | - $pall[] = $value; |
|
1673 | - } |
|
1674 | - } |
|
1675 | - $alldata = $pall; |
|
1658 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrivalByAirlines(); |
|
1659 | + foreach ($dall as $value) { |
|
1660 | + $icao = $value['arrival_airport_icao']; |
|
1661 | + $airline = $value['airline_icao']; |
|
1662 | + $ddate = $value['date']; |
|
1663 | + $find = false; |
|
1664 | + foreach ($pall as $pvalue) { |
|
1665 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
1666 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1667 | + $find = true; |
|
1668 | + break; |
|
1669 | + } |
|
1670 | + } |
|
1671 | + if ($find === false) { |
|
1672 | + $pall[] = $value; |
|
1673 | + } |
|
1674 | + } |
|
1675 | + $alldata = $pall; |
|
1676 | 1676 | foreach ($alldata as $number) { |
1677 | 1677 | $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']); |
1678 | 1678 | } |
@@ -1732,45 +1732,45 @@ discard block |
||
1732 | 1732 | } |
1733 | 1733 | |
1734 | 1734 | $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
1735 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1736 | - //$alldata = array(); |
|
1737 | - foreach ($dall as $value) { |
|
1738 | - $icao = $value['airport_departure_icao']; |
|
1739 | - $dicao = $value['airline_icap']; |
|
1740 | - $find = false; |
|
1741 | - foreach ($pall as $pvalue) { |
|
1742 | - if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1743 | - $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1744 | - $find = true; |
|
1745 | - break; |
|
1746 | - } |
|
1747 | - } |
|
1748 | - if ($find === false) { |
|
1749 | - $pall[] = $value; |
|
1750 | - } |
|
1751 | - } |
|
1752 | - $alldata = $pall; |
|
1735 | + $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1736 | + //$alldata = array(); |
|
1737 | + foreach ($dall as $value) { |
|
1738 | + $icao = $value['airport_departure_icao']; |
|
1739 | + $dicao = $value['airline_icap']; |
|
1740 | + $find = false; |
|
1741 | + foreach ($pall as $pvalue) { |
|
1742 | + if ($pvalue['airport_departure_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1743 | + $pvalue['airport_departure_icao_count'] = $pvalue['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
|
1744 | + $find = true; |
|
1745 | + break; |
|
1746 | + } |
|
1747 | + } |
|
1748 | + if ($find === false) { |
|
1749 | + $pall[] = $value; |
|
1750 | + } |
|
1751 | + } |
|
1752 | + $alldata = $pall; |
|
1753 | 1753 | foreach ($alldata as $number) { |
1754 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name); |
|
1754 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name); |
|
1755 | 1755 | } |
1756 | 1756 | $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter); |
1757 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
1758 | - //$alldata = array(); |
|
1757 | + $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
1758 | + //$alldata = array(); |
|
1759 | 1759 | foreach ($dall as $value) { |
1760 | - $icao = $value['airport_arrival_icao']; |
|
1761 | - $dicao = $value['airline_icao']; |
|
1762 | - $find = false; |
|
1763 | - foreach ($pall as $pvalue) { |
|
1764 | - if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1760 | + $icao = $value['airport_arrival_icao']; |
|
1761 | + $dicao = $value['airline_icao']; |
|
1762 | + $find = false; |
|
1763 | + foreach ($pall as $pvalue) { |
|
1764 | + if ($pvalue['airport_arrival_icao'] == $icao && $pvalue['airline_icao'] = $dicao) { |
|
1765 | 1765 | $pvalue['airport_arrival_icao_count'] = $pvalue['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
1766 | 1766 | $find = true; |
1767 | 1767 | break; |
1768 | - } |
|
1768 | + } |
|
1769 | 1769 | } |
1770 | 1770 | if ($find === false) { |
1771 | 1771 | $pall[] = $value; |
1772 | 1772 | } |
1773 | - } |
|
1773 | + } |
|
1774 | 1774 | $alldata = $pall; |
1775 | 1775 | foreach ($alldata as $number) { |
1776 | 1776 | echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name); |
@@ -1800,47 +1800,47 @@ discard block |
||
1800 | 1800 | } |
1801 | 1801 | echo '...Departure'."\n"; |
1802 | 1802 | $pall = $Spotter->getLast7DaysAirportsDeparture($filter); |
1803 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture($filter); |
|
1804 | - foreach ($dall as $value) { |
|
1805 | - $icao = $value['departure_airport_icao']; |
|
1806 | - $airline = $value['airline_icao']; |
|
1807 | - $ddate = $value['date']; |
|
1808 | - $find = false; |
|
1809 | - foreach ($pall as $pvalue) { |
|
1810 | - if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
1811 | - $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1812 | - $find = true; |
|
1813 | - break; |
|
1814 | - } |
|
1815 | - } |
|
1803 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture($filter); |
|
1804 | + foreach ($dall as $value) { |
|
1805 | + $icao = $value['departure_airport_icao']; |
|
1806 | + $airline = $value['airline_icao']; |
|
1807 | + $ddate = $value['date']; |
|
1808 | + $find = false; |
|
1809 | + foreach ($pall as $pvalue) { |
|
1810 | + if ($pvalue['departure_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] = $airline) { |
|
1811 | + $pvalue['departure_airport_count'] = $pvalue['departure_airport_count'] + $value['departure_airport_count']; |
|
1812 | + $find = true; |
|
1813 | + break; |
|
1814 | + } |
|
1815 | + } |
|
1816 | 1816 | if ($find === false) { |
1817 | - $pall[] = $value; |
|
1818 | - } |
|
1819 | - } |
|
1820 | - $alldata = $pall; |
|
1817 | + $pall[] = $value; |
|
1818 | + } |
|
1819 | + } |
|
1820 | + $alldata = $pall; |
|
1821 | 1821 | foreach ($alldata as $number) { |
1822 | 1822 | $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
1823 | 1823 | } |
1824 | 1824 | echo '...Arrival'."\n"; |
1825 | 1825 | $pall = $Spotter->getLast7DaysAirportsArrival($filter); |
1826 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival($filter); |
|
1826 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival($filter); |
|
1827 | 1827 | foreach ($dall as $value) { |
1828 | 1828 | $icao = $value['arrival_airport_icao']; |
1829 | 1829 | $airline = $value['airline_icao']; |
1830 | 1830 | $ddate = $value['date']; |
1831 | - $find = false; |
|
1831 | + $find = false; |
|
1832 | 1832 | foreach ($pall as $pvalue) { |
1833 | - if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
1834 | - $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1835 | - $find = true; |
|
1836 | - break; |
|
1837 | - } |
|
1838 | - } |
|
1839 | - if ($find === false) { |
|
1840 | - $pall[] = $value; |
|
1841 | - } |
|
1842 | - } |
|
1843 | - $alldata = $pall; |
|
1833 | + if ($pvalue['arrival_airport_icao'] == $icao && $pvalue['date'] == $ddate && $pvalue['airline_icao'] == $airline) { |
|
1834 | + $pvalue['arrival_airport_count'] = $pvalue['arrival_airport_count'] + $value['arrival_airport_count']; |
|
1835 | + $find = true; |
|
1836 | + break; |
|
1837 | + } |
|
1838 | + } |
|
1839 | + if ($find === false) { |
|
1840 | + $pall[] = $value; |
|
1841 | + } |
|
1842 | + } |
|
1843 | + $alldata = $pall; |
|
1844 | 1844 | foreach ($alldata as $number) { |
1845 | 1845 | $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
1846 | 1846 | } |
@@ -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,29 +41,29 @@ discard block |
||
41 | 41 | try { |
42 | 42 | $sth = $this->db->prepare($query); |
43 | 43 | $sth->execute(array(':filter_name' => $filter_name)); |
44 | - } catch(PDOException $e) { |
|
44 | + } catch (PDOException $e) { |
|
45 | 45 | echo "error : ".$e->getMessage(); |
46 | 46 | } |
47 | 47 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
48 | 48 | return $all; |
49 | 49 | } |
50 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
50 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
51 | 51 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
52 | 52 | try { |
53 | 53 | $sth = $this->db->prepare($query); |
54 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
55 | - } catch(PDOException $e) { |
|
54 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
55 | + } catch (PDOException $e) { |
|
56 | 56 | echo "error : ".$e->getMessage(); |
57 | 57 | } |
58 | 58 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
59 | 59 | return $all; |
60 | 60 | } |
61 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
61 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
62 | 62 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
63 | 63 | try { |
64 | 64 | $sth = $this->db->prepare($query); |
65 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
66 | - } catch(PDOException $e) { |
|
65 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
66 | + } catch (PDOException $e) { |
|
67 | 67 | echo "error : ".$e->getMessage(); |
68 | 68 | } |
69 | 69 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -77,29 +77,29 @@ discard block |
||
77 | 77 | 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 AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
78 | 78 | try { |
79 | 79 | $sth = $this->db->prepare($query); |
80 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
81 | - } catch(PDOException $e) { |
|
80 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
81 | + } catch (PDOException $e) { |
|
82 | 82 | echo "error : ".$e->getMessage(); |
83 | 83 | } |
84 | 84 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
85 | 85 | if (empty($all)) { |
86 | 86 | $filters = array('airlines' => array($stats_airline)); |
87 | 87 | if ($filter_name != '') { |
88 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
88 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
89 | 89 | } |
90 | 90 | $Spotter = new Spotter($this->db); |
91 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters); |
|
91 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters); |
|
92 | 92 | } |
93 | 93 | return $all; |
94 | 94 | } |
95 | - public function countAllAirlineCountries($limit = true,$filter_name = '') { |
|
95 | + public function countAllAirlineCountries($limit = true, $filter_name = '') { |
|
96 | 96 | global $globalStatsFilters; |
97 | 97 | 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 filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
98 | 98 | 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 AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
99 | 99 | try { |
100 | 100 | $sth = $this->db->prepare($query); |
101 | 101 | $sth->execute(array(':filter_name' => $filter_name)); |
102 | - } catch(PDOException $e) { |
|
102 | + } catch (PDOException $e) { |
|
103 | 103 | echo "error : ".$e->getMessage(); |
104 | 104 | } |
105 | 105 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -107,27 +107,27 @@ discard block |
||
107 | 107 | $Spotter = new Spotter($this->db); |
108 | 108 | $filters = array(); |
109 | 109 | if ($filter_name != '') { |
110 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
110 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
111 | 111 | } |
112 | - $all = $Spotter->countAllAirlineCountries($limit,$filters); |
|
112 | + $all = $Spotter->countAllAirlineCountries($limit, $filters); |
|
113 | 113 | } |
114 | 114 | return $all; |
115 | 115 | } |
116 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
|
116 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '') { |
|
117 | 117 | global $globalStatsFilters; |
118 | 118 | if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
119 | 119 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
120 | 120 | try { |
121 | 121 | $sth = $this->db->prepare($query); |
122 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
123 | - } catch(PDOException $e) { |
|
122 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
123 | + } catch (PDOException $e) { |
|
124 | 124 | echo "error : ".$e->getMessage(); |
125 | 125 | } |
126 | 126 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
127 | 127 | if (empty($all)) { |
128 | 128 | $filters = array('airlines' => array($stats_airline)); |
129 | 129 | if ($filter_name != '') { |
130 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
130 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
131 | 131 | } |
132 | 132 | $Spotter = new Spotter($this->db); |
133 | 133 | $all = $Spotter->countAllAircraftManufacturers($filters); |
@@ -141,18 +141,18 @@ discard block |
||
141 | 141 | 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 AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
142 | 142 | try { |
143 | 143 | $sth = $this->db->prepare($query); |
144 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
145 | - } catch(PDOException $e) { |
|
144 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
145 | + } catch (PDOException $e) { |
|
146 | 146 | echo "error : ".$e->getMessage(); |
147 | 147 | } |
148 | 148 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
149 | 149 | if (empty($all)) { |
150 | 150 | $filters = array('airlines' => array($stats_airline)); |
151 | 151 | if ($filter_name != '') { |
152 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
152 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
153 | 153 | } |
154 | 154 | $Spotter = new Spotter($this->db); |
155 | - $all = $Spotter->countAllArrivalCountries($limit,$filters); |
|
155 | + $all = $Spotter->countAllArrivalCountries($limit, $filters); |
|
156 | 156 | } |
157 | 157 | return $all; |
158 | 158 | } |
@@ -162,15 +162,15 @@ discard block |
||
162 | 162 | 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 AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
163 | 163 | try { |
164 | 164 | $sth = $this->db->prepare($query); |
165 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
166 | - } catch(PDOException $e) { |
|
165 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
166 | + } catch (PDOException $e) { |
|
167 | 167 | echo "error : ".$e->getMessage(); |
168 | 168 | } |
169 | 169 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
170 | 170 | if (empty($all)) { |
171 | 171 | $filters = array('airlines' => array($stats_airline)); |
172 | 172 | if ($filter_name != '') { |
173 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
173 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
174 | 174 | } |
175 | 175 | $Spotter = new Spotter($this->db); |
176 | 176 | $all = $Spotter->countAllDepartureCountries($filters); |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | return $all; |
179 | 179 | } |
180 | 180 | |
181 | - public function countAllAirlines($limit = true,$filter_name = '') { |
|
181 | + public function countAllAirlines($limit = true, $filter_name = '') { |
|
182 | 182 | global $globalStatsFilters; |
183 | 183 | 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 AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
184 | 184 | 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 AND filter_name = :filter_name ORDER BY airline_count DESC"; |
185 | 185 | try { |
186 | 186 | $sth = $this->db->prepare($query); |
187 | 187 | $sth->execute(array(':filter_name' => $filter_name)); |
188 | - } catch(PDOException $e) { |
|
188 | + } catch (PDOException $e) { |
|
189 | 189 | echo "error : ".$e->getMessage(); |
190 | 190 | } |
191 | 191 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -193,64 +193,64 @@ discard block |
||
193 | 193 | $Spotter = new Spotter($this->db); |
194 | 194 | $filters = array(); |
195 | 195 | if ($filter_name != '') { |
196 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
196 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
197 | 197 | } |
198 | 198 | |
199 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters); |
|
199 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters); |
|
200 | 200 | } |
201 | 201 | return $all; |
202 | 202 | } |
203 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
|
203 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '') { |
|
204 | 204 | global $globalStatsFilters; |
205 | 205 | 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 AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
206 | 206 | 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 AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
207 | 207 | try { |
208 | 208 | $sth = $this->db->prepare($query); |
209 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
210 | - } catch(PDOException $e) { |
|
209 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
210 | + } catch (PDOException $e) { |
|
211 | 211 | echo "error : ".$e->getMessage(); |
212 | 212 | } |
213 | 213 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
214 | 214 | if (empty($all)) { |
215 | 215 | $filters = array('airlines' => array($stats_airline)); |
216 | 216 | if ($filter_name != '') { |
217 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
217 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
218 | 218 | } |
219 | 219 | $Spotter = new Spotter($this->db); |
220 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters); |
|
220 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters); |
|
221 | 221 | } |
222 | 222 | return $all; |
223 | 223 | } |
224 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
|
224 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '') { |
|
225 | 225 | global $globalStatsFilters; |
226 | 226 | 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 AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
227 | 227 | 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 AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
228 | 228 | try { |
229 | 229 | $sth = $this->db->prepare($query); |
230 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
231 | - } catch(PDOException $e) { |
|
230 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
231 | + } catch (PDOException $e) { |
|
232 | 232 | echo "error : ".$e->getMessage(); |
233 | 233 | } |
234 | 234 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
235 | 235 | if (empty($all)) { |
236 | 236 | $filters = array('airlines' => array($stats_airline)); |
237 | 237 | if ($filter_name != '') { |
238 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
238 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
239 | 239 | } |
240 | 240 | $Spotter = new Spotter($this->db); |
241 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters); |
|
241 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters); |
|
242 | 242 | } |
243 | 243 | return $all; |
244 | 244 | } |
245 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') { |
|
245 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '') { |
|
246 | 246 | $Connection = new Connection(); |
247 | 247 | if ($Connection->tableExists('countries')) { |
248 | 248 | 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 AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
249 | 249 | 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 AND filter_name = :filter_name ORDER BY flight_count DESC"; |
250 | 250 | try { |
251 | 251 | $sth = $this->db->prepare($query); |
252 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
253 | - } catch(PDOException $e) { |
|
252 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
253 | + } catch (PDOException $e) { |
|
254 | 254 | echo "error : ".$e->getMessage(); |
255 | 255 | } |
256 | 256 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -265,67 +265,67 @@ discard block |
||
265 | 265 | return array(); |
266 | 266 | } |
267 | 267 | } |
268 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') { |
|
268 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '') { |
|
269 | 269 | global $globalStatsFilters; |
270 | 270 | if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
271 | 271 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
272 | 272 | try { |
273 | 273 | $sth = $this->db->prepare($query); |
274 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
275 | - } catch(PDOException $e) { |
|
274 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
275 | + } catch (PDOException $e) { |
|
276 | 276 | echo "error : ".$e->getMessage(); |
277 | 277 | } |
278 | 278 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
279 | 279 | if (empty($all)) { |
280 | 280 | $filters = array('airlines' => array($stats_airline)); |
281 | 281 | if ($filter_name != '') { |
282 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
282 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
283 | 283 | } |
284 | 284 | $Spotter = new Spotter($this->db); |
285 | - $all = $Spotter->countAllPilots($limit,0,'',$filters); |
|
285 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters); |
|
286 | 286 | } |
287 | 287 | return $all; |
288 | 288 | } |
289 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
|
289 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '') { |
|
290 | 290 | global $globalStatsFilters; |
291 | 291 | if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
292 | 292 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
293 | 293 | try { |
294 | 294 | $sth = $this->db->prepare($query); |
295 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
296 | - } catch(PDOException $e) { |
|
295 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
296 | + } catch (PDOException $e) { |
|
297 | 297 | echo "error : ".$e->getMessage(); |
298 | 298 | } |
299 | 299 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
300 | 300 | if (empty($all)) { |
301 | 301 | $filters = array('airlines' => array($stats_airline)); |
302 | 302 | if ($filter_name != '') { |
303 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
303 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
304 | 304 | } |
305 | 305 | $Spotter = new Spotter($this->db); |
306 | - $all = $Spotter->countAllOwners($limit,0,'',$filters); |
|
306 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters); |
|
307 | 307 | } |
308 | 308 | return $all; |
309 | 309 | } |
310 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
310 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
311 | 311 | global $globalStatsFilters; |
312 | 312 | 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 AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
313 | 313 | 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 AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
314 | 314 | try { |
315 | 315 | $sth = $this->db->prepare($query); |
316 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
317 | - } catch(PDOException $e) { |
|
316 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
317 | + } catch (PDOException $e) { |
|
318 | 318 | echo "error : ".$e->getMessage(); |
319 | 319 | } |
320 | 320 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
321 | 321 | if (empty($all)) { |
322 | 322 | $filters = array('airlines' => array($stats_airline)); |
323 | 323 | if ($filter_name != '') { |
324 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
324 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
325 | 325 | } |
326 | 326 | $Spotter = new Spotter($this->db); |
327 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters); |
|
328 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters); |
|
327 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters); |
|
328 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters); |
|
329 | 329 | $all = array(); |
330 | 330 | foreach ($pall as $value) { |
331 | 331 | $icao = $value['airport_departure_icao']; |
@@ -342,29 +342,29 @@ discard block |
||
342 | 342 | foreach ($all as $key => $row) { |
343 | 343 | $count[$key] = $row['airport_departure_icao_count']; |
344 | 344 | } |
345 | - array_multisort($count,SORT_DESC,$all); |
|
345 | + array_multisort($count, SORT_DESC, $all); |
|
346 | 346 | } |
347 | 347 | return $all; |
348 | 348 | } |
349 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
|
349 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '') { |
|
350 | 350 | global $globalStatsFilters; |
351 | 351 | 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 AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
352 | 352 | 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 AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
353 | 353 | try { |
354 | 354 | $sth = $this->db->prepare($query); |
355 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
356 | - } catch(PDOException $e) { |
|
355 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
356 | + } catch (PDOException $e) { |
|
357 | 357 | echo "error : ".$e->getMessage(); |
358 | 358 | } |
359 | 359 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
360 | 360 | if (empty($all)) { |
361 | 361 | $filters = array('airlines' => array($stats_airline)); |
362 | 362 | if ($filter_name != '') { |
363 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
363 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
364 | 364 | } |
365 | 365 | $Spotter = new Spotter($this->db); |
366 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters); |
|
367 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters); |
|
366 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters); |
|
367 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters); |
|
368 | 368 | $all = array(); |
369 | 369 | foreach ($pall as $value) { |
370 | 370 | $icao = $value['airport_arrival_icao']; |
@@ -381,12 +381,12 @@ discard block |
||
381 | 381 | foreach ($all as $key => $row) { |
382 | 382 | $count[$key] = $row['airport_arrival_icao_count']; |
383 | 383 | } |
384 | - array_multisort($count,SORT_DESC,$all); |
|
384 | + array_multisort($count, SORT_DESC, $all); |
|
385 | 385 | } |
386 | 386 | |
387 | 387 | return $all; |
388 | 388 | } |
389 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
389 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
390 | 390 | global $globalDBdriver, $globalStatsFilters; |
391 | 391 | if ($globalDBdriver == 'mysql') { |
392 | 392 | 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 AND filter_name = :filter_name"; |
@@ -395,18 +395,18 @@ discard block |
||
395 | 395 | 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 AND filter_name = :filter_name"; |
396 | 396 | 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 AND filter_name = :filter_name"; |
397 | 397 | } |
398 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
398 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
399 | 399 | try { |
400 | 400 | $sth = $this->db->prepare($query); |
401 | 401 | $sth->execute($query_data); |
402 | - } catch(PDOException $e) { |
|
402 | + } catch (PDOException $e) { |
|
403 | 403 | echo "error : ".$e->getMessage(); |
404 | 404 | } |
405 | 405 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
406 | 406 | if (empty($all)) { |
407 | 407 | $filters = array('airlines' => array($stats_airline)); |
408 | 408 | if ($filter_name != '') { |
409 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
409 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
410 | 410 | } |
411 | 411 | $Spotter = new Spotter($this->db); |
412 | 412 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -415,67 +415,67 @@ discard block |
||
415 | 415 | return $all; |
416 | 416 | } |
417 | 417 | |
418 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
418 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
419 | 419 | global $globalStatsFilters; |
420 | 420 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
421 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
421 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
422 | 422 | try { |
423 | 423 | $sth = $this->db->prepare($query); |
424 | 424 | $sth->execute($query_data); |
425 | - } catch(PDOException $e) { |
|
425 | + } catch (PDOException $e) { |
|
426 | 426 | echo "error : ".$e->getMessage(); |
427 | 427 | } |
428 | 428 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
429 | 429 | if (empty($all)) { |
430 | 430 | $filters = array('airlines' => array($stats_airline)); |
431 | 431 | if ($filter_name != '') { |
432 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
432 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
433 | 433 | } |
434 | 434 | $Spotter = new Spotter($this->db); |
435 | 435 | $all = $Spotter->countAllDatesLastMonth($filters); |
436 | 436 | } |
437 | 437 | return $all; |
438 | 438 | } |
439 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
439 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
440 | 440 | global $globalDBdriver, $globalStatsFilters; |
441 | 441 | if ($globalDBdriver == 'mysql') { |
442 | 442 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
443 | 443 | } else { |
444 | 444 | $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 AND filter_name = :filter_name"; |
445 | 445 | } |
446 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
446 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
447 | 447 | try { |
448 | 448 | $sth = $this->db->prepare($query); |
449 | 449 | $sth->execute($query_data); |
450 | - } catch(PDOException $e) { |
|
450 | + } catch (PDOException $e) { |
|
451 | 451 | echo "error : ".$e->getMessage(); |
452 | 452 | } |
453 | 453 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
454 | 454 | if (empty($all)) { |
455 | 455 | $filters = array('airlines' => array($stats_airline)); |
456 | 456 | if ($filter_name != '') { |
457 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
457 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
458 | 458 | } |
459 | 459 | $Spotter = new Spotter($this->db); |
460 | 460 | $all = $Spotter->countAllDatesLast7Days($filters); |
461 | 461 | } |
462 | 462 | return $all; |
463 | 463 | } |
464 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
464 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
465 | 465 | global $globalStatsFilters; |
466 | 466 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
467 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
467 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
468 | 468 | try { |
469 | 469 | $sth = $this->db->prepare($query); |
470 | 470 | $sth->execute($query_data); |
471 | - } catch(PDOException $e) { |
|
471 | + } catch (PDOException $e) { |
|
472 | 472 | echo "error : ".$e->getMessage(); |
473 | 473 | } |
474 | 474 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
475 | 475 | if (empty($all)) { |
476 | 476 | $filters = array('airlines' => array($stats_airline)); |
477 | 477 | if ($filter_name != '') { |
478 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
478 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
479 | 479 | } |
480 | 480 | $Spotter = new Spotter($this->db); |
481 | 481 | $all = $Spotter->countAllDates($filters); |
@@ -488,34 +488,34 @@ discard block |
||
488 | 488 | try { |
489 | 489 | $sth = $this->db->prepare($query); |
490 | 490 | $sth->execute($query_data); |
491 | - } catch(PDOException $e) { |
|
491 | + } catch (PDOException $e) { |
|
492 | 492 | echo "error : ".$e->getMessage(); |
493 | 493 | } |
494 | 494 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
495 | 495 | if (empty($all)) { |
496 | 496 | $filters = array(); |
497 | 497 | if ($filter_name != '') { |
498 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
498 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
499 | 499 | } |
500 | 500 | $Spotter = new Spotter($this->db); |
501 | 501 | $all = $Spotter->countAllDatesByAirlines($filters); |
502 | 502 | } |
503 | 503 | return $all; |
504 | 504 | } |
505 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
505 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
506 | 506 | global $globalStatsFilters; |
507 | 507 | $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 AND filter_name = :filter_name"; |
508 | 508 | try { |
509 | 509 | $sth = $this->db->prepare($query); |
510 | 510 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
511 | - } catch(PDOException $e) { |
|
511 | + } catch (PDOException $e) { |
|
512 | 512 | echo "error : ".$e->getMessage(); |
513 | 513 | } |
514 | 514 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
515 | 515 | if (empty($all)) { |
516 | 516 | $filters = array('airlines' => array($stats_airline)); |
517 | 517 | if ($filter_name != '') { |
518 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
518 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
519 | 519 | } |
520 | 520 | $Spotter = new Spotter($this->db); |
521 | 521 | $all = $Spotter->countAllMonths($filters); |
@@ -528,21 +528,21 @@ discard block |
||
528 | 528 | try { |
529 | 529 | $sth = $this->db->prepare($query); |
530 | 530 | $sth->execute(array(':filter_name' => $filter_name)); |
531 | - } catch(PDOException $e) { |
|
531 | + } catch (PDOException $e) { |
|
532 | 532 | echo "error : ".$e->getMessage(); |
533 | 533 | } |
534 | 534 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
535 | 535 | if (empty($all)) { |
536 | 536 | $filters = array(); |
537 | 537 | if ($filter_name != '') { |
538 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
538 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
539 | 539 | } |
540 | 540 | $Spotter = new Spotter($this->db); |
541 | 541 | $all = $Spotter->countAllMilitaryMonths($filters); |
542 | 542 | } |
543 | 543 | return $all; |
544 | 544 | } |
545 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
545 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
546 | 546 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
547 | 547 | |
548 | 548 | 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 AND filter_name = :filter_name"; |
@@ -558,28 +558,28 @@ discard block |
||
558 | 558 | try { |
559 | 559 | $sth = $this->db->prepare($query); |
560 | 560 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
561 | - } catch(PDOException $e) { |
|
561 | + } catch (PDOException $e) { |
|
562 | 562 | echo "error : ".$e->getMessage(); |
563 | 563 | } |
564 | 564 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
565 | 565 | if (empty($all)) { |
566 | 566 | $filters = array('airlines' => array($stats_airline)); |
567 | 567 | if ($filter_name != '') { |
568 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
568 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
569 | 569 | } |
570 | 570 | $Spotter = new Spotter($this->db); |
571 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
571 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
572 | 572 | } |
573 | 573 | return $all; |
574 | 574 | } |
575 | 575 | |
576 | 576 | public function countOverallFlights($stats_airline = '', $filter_name = '') { |
577 | 577 | global $globalStatsFilters; |
578 | - $all = $this->getSumStats('flights_bymonth',date('Y'),$stats_airline,$filter_name); |
|
578 | + $all = $this->getSumStats('flights_bymonth', date('Y'), $stats_airline, $filter_name); |
|
579 | 579 | if (empty($all)) { |
580 | 580 | $filters = array('airlines' => array($stats_airline)); |
581 | 581 | if ($filter_name != '') { |
582 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
582 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
583 | 583 | } |
584 | 584 | $Spotter = new Spotter($this->db); |
585 | 585 | $all = $Spotter->countOverallFlights($filters); |
@@ -587,37 +587,37 @@ discard block |
||
587 | 587 | return $all; |
588 | 588 | } |
589 | 589 | public function countOverallMilitaryFlights($filter_name = '') { |
590 | - $all = $this->getSumStats('military_flights_bymonth',date('Y'),'',$filter_name); |
|
590 | + $all = $this->getSumStats('military_flights_bymonth', date('Y'), '', $filter_name); |
|
591 | 591 | if (empty($all)) { |
592 | 592 | $filters = array(); |
593 | 593 | if ($filter_name != '') { |
594 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
594 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
595 | 595 | } |
596 | 596 | $Spotter = new Spotter($this->db); |
597 | 597 | $all = $Spotter->countOverallMilitaryFlights($filters); |
598 | 598 | } |
599 | 599 | return $all; |
600 | 600 | } |
601 | - public function countOverallArrival($stats_airline = '',$filter_name = '') { |
|
601 | + public function countOverallArrival($stats_airline = '', $filter_name = '') { |
|
602 | 602 | global $globalStatsFilters; |
603 | - $all = $this->getSumStats('realarrivals_bymonth',date('Y'),$stats_airline,$filter_name); |
|
603 | + $all = $this->getSumStats('realarrivals_bymonth', date('Y'), $stats_airline, $filter_name); |
|
604 | 604 | if (empty($all)) { |
605 | 605 | $filters = array('airlines' => array($stats_airline)); |
606 | 606 | if ($filter_name != '') { |
607 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
607 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
608 | 608 | } |
609 | 609 | $Spotter = new Spotter($this->db); |
610 | 610 | $all = $Spotter->countOverallArrival($filters); |
611 | 611 | } |
612 | 612 | return $all; |
613 | 613 | } |
614 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '') { |
|
614 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '') { |
|
615 | 615 | global $globalStatsFilters; |
616 | - $all = $this->getSumStats('aircrafts_bymonth',date('Y'),$stats_airline,$filter_name); |
|
616 | + $all = $this->getSumStats('aircrafts_bymonth', date('Y'), $stats_airline, $filter_name); |
|
617 | 617 | if (empty($all)) { |
618 | 618 | $filters = array('airlines' => array($stats_airline)); |
619 | 619 | if ($filter_name != '') { |
620 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
620 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
621 | 621 | } |
622 | 622 | $Spotter = new Spotter($this->db); |
623 | 623 | $all = $Spotter->countOverallAircrafts($filters); |
@@ -629,7 +629,7 @@ discard block |
||
629 | 629 | try { |
630 | 630 | $sth = $this->db->prepare($query); |
631 | 631 | $sth->execute(array(':filter_name' => $filter_name)); |
632 | - } catch(PDOException $e) { |
|
632 | + } catch (PDOException $e) { |
|
633 | 633 | echo "error : ".$e->getMessage(); |
634 | 634 | } |
635 | 635 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -638,14 +638,14 @@ discard block |
||
638 | 638 | if (empty($all)) { |
639 | 639 | $filters = array(); |
640 | 640 | if ($filter_name != '') { |
641 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
641 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
642 | 642 | } |
643 | 643 | $Spotter = new Spotter($this->db); |
644 | 644 | $all = $Spotter->countOverallAirlines($filters); |
645 | 645 | } |
646 | 646 | return $all; |
647 | 647 | } |
648 | - public function countOverallOwners($stats_airline = '',$filter_name = '') { |
|
648 | + public function countOverallOwners($stats_airline = '', $filter_name = '') { |
|
649 | 649 | global $globalStatsFilters; |
650 | 650 | /* |
651 | 651 | $query = "SELECT COUNT(*) AS nb_owner FROM stats_owner"; |
@@ -658,24 +658,24 @@ discard block |
||
658 | 658 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
659 | 659 | $all = $result[0]['nb_owner']; |
660 | 660 | */ |
661 | - $all = $this->getSumStats('owners_bymonth',date('Y'),$stats_airline,$filter_name); |
|
661 | + $all = $this->getSumStats('owners_bymonth', date('Y'), $stats_airline, $filter_name); |
|
662 | 662 | if (empty($all)) { |
663 | 663 | $filters = array('airlines' => array($stats_airline)); |
664 | 664 | if ($filter_name != '') { |
665 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
665 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
666 | 666 | } |
667 | 667 | $Spotter = new Spotter($this->db); |
668 | 668 | $all = $Spotter->countOverallOwners($filters); |
669 | 669 | } |
670 | 670 | return $all; |
671 | 671 | } |
672 | - public function countOverallPilots($stats_airline = '',$filter_name = '') { |
|
672 | + public function countOverallPilots($stats_airline = '', $filter_name = '') { |
|
673 | 673 | global $globalStatsFilters; |
674 | - $all = $this->getSumStats('pilots_bymonth',date('Y'),$stats_airline,$filter_name); |
|
674 | + $all = $this->getSumStats('pilots_bymonth', date('Y'), $stats_airline, $filter_name); |
|
675 | 675 | if (empty($all)) { |
676 | 676 | $filters = array('airlines' => array($stats_airline)); |
677 | 677 | if ($filter_name != '') { |
678 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
678 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
679 | 679 | } |
680 | 680 | $Spotter = new Spotter($this->db); |
681 | 681 | $all = $Spotter->countOverallPilots($filters); |
@@ -683,42 +683,42 @@ discard block |
||
683 | 683 | return $all; |
684 | 684 | } |
685 | 685 | |
686 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
686 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
687 | 687 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
688 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
688 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
689 | 689 | try { |
690 | 690 | $sth = $this->db->prepare($query); |
691 | 691 | $sth->execute($query_values); |
692 | - } catch(PDOException $e) { |
|
692 | + } catch (PDOException $e) { |
|
693 | 693 | echo "error : ".$e->getMessage(); |
694 | 694 | } |
695 | 695 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
696 | 696 | return $all; |
697 | 697 | } |
698 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
698 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
699 | 699 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
700 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
700 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
701 | 701 | try { |
702 | 702 | $sth = $this->db->prepare($query); |
703 | 703 | $sth->execute($query_values); |
704 | - } catch(PDOException $e) { |
|
704 | + } catch (PDOException $e) { |
|
705 | 705 | echo "error : ".$e->getMessage(); |
706 | 706 | } |
707 | 707 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
708 | 708 | return $all; |
709 | 709 | } |
710 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '') { |
|
710 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '') { |
|
711 | 711 | global $globalArchiveMonths, $globalDBdriver; |
712 | 712 | if ($globalDBdriver == 'mysql') { |
713 | 713 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
714 | 714 | } else { |
715 | 715 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
716 | 716 | } |
717 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
717 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
718 | 718 | try { |
719 | 719 | $sth = $this->db->prepare($query); |
720 | 720 | $sth->execute($query_values); |
721 | - } catch(PDOException $e) { |
|
721 | + } catch (PDOException $e) { |
|
722 | 722 | echo "error : ".$e->getMessage(); |
723 | 723 | } |
724 | 724 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | try { |
736 | 736 | $sth = $this->db->prepare($query); |
737 | 737 | $sth->execute($query_values); |
738 | - } catch(PDOException $e) { |
|
738 | + } catch (PDOException $e) { |
|
739 | 739 | echo "error : ".$e->getMessage(); |
740 | 740 | } |
741 | 741 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | try { |
752 | 752 | $sth = $this->db->prepare($query); |
753 | 753 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
754 | - } catch(PDOException $e) { |
|
754 | + } catch (PDOException $e) { |
|
755 | 755 | echo "error : ".$e->getMessage(); |
756 | 756 | } |
757 | 757 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | try { |
768 | 768 | $sth = $this->db->prepare($query); |
769 | 769 | $sth->execute(array(':filter_name' => $filter_name)); |
770 | - } catch(PDOException $e) { |
|
770 | + } catch (PDOException $e) { |
|
771 | 771 | echo "error : ".$e->getMessage(); |
772 | 772 | } |
773 | 773 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | try { |
784 | 784 | $sth = $this->db->prepare($query); |
785 | 785 | $sth->execute(array(':filter_name' => $filter_name)); |
786 | - } catch(PDOException $e) { |
|
786 | + } catch (PDOException $e) { |
|
787 | 787 | echo "error : ".$e->getMessage(); |
788 | 788 | } |
789 | 789 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -799,29 +799,29 @@ discard block |
||
799 | 799 | try { |
800 | 800 | $sth = $this->db->prepare($query); |
801 | 801 | $sth->execute(array(':filter_name' => $filter_name)); |
802 | - } catch(PDOException $e) { |
|
802 | + } catch (PDOException $e) { |
|
803 | 803 | echo "error : ".$e->getMessage(); |
804 | 804 | } |
805 | 805 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
806 | 806 | return $all[0]['total']; |
807 | 807 | } |
808 | 808 | |
809 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
809 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
810 | 810 | global $globalDBdriver; |
811 | 811 | if ($globalDBdriver == 'mysql') { |
812 | 812 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = :cnt"; |
813 | 813 | } else { |
814 | 814 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
815 | 815 | } |
816 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
816 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
817 | 817 | try { |
818 | 818 | $sth = $this->db->prepare($query); |
819 | 819 | $sth->execute($query_values); |
820 | - } catch(PDOException $e) { |
|
820 | + } catch (PDOException $e) { |
|
821 | 821 | return "error : ".$e->getMessage(); |
822 | 822 | } |
823 | 823 | } |
824 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
824 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
825 | 825 | global $globalDBdriver; |
826 | 826 | if ($globalDBdriver == 'mysql') { |
827 | 827 | $query = "INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) VALUES (:type,:cnt,:stats_date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
@@ -829,219 +829,219 @@ discard block |
||
829 | 829 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
830 | 830 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
831 | 831 | } |
832 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
832 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
833 | 833 | try { |
834 | 834 | $sth = $this->db->prepare($query); |
835 | 835 | $sth->execute($query_values); |
836 | - } catch(PDOException $e) { |
|
836 | + } catch (PDOException $e) { |
|
837 | 837 | return "error : ".$e->getMessage(); |
838 | 838 | } |
839 | 839 | } |
840 | - public function getStatsSource($date,$stats_type = '') { |
|
840 | + public function getStatsSource($date, $stats_type = '') { |
|
841 | 841 | if ($stats_type == '') { |
842 | 842 | $query = "SELECT * FROM stats_source WHERE stats_date = :date ORDER BY source_name"; |
843 | 843 | $query_values = array(':date' => $date); |
844 | 844 | } else { |
845 | 845 | $query = "SELECT * FROM stats_source WHERE stats_date = :date AND stats_type = :stats_type ORDER BY source_name"; |
846 | - $query_values = array(':date' => $date,':stats_type' => $stats_type); |
|
846 | + $query_values = array(':date' => $date, ':stats_type' => $stats_type); |
|
847 | 847 | } |
848 | 848 | try { |
849 | 849 | $sth = $this->db->prepare($query); |
850 | 850 | $sth->execute($query_values); |
851 | - } catch(PDOException $e) { |
|
851 | + } catch (PDOException $e) { |
|
852 | 852 | echo "error : ".$e->getMessage(); |
853 | 853 | } |
854 | 854 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
855 | 855 | return $all; |
856 | 856 | } |
857 | 857 | |
858 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
858 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
859 | 859 | global $globalDBdriver; |
860 | 860 | if ($globalDBdriver == 'mysql') { |
861 | 861 | $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"; |
862 | 862 | } else { |
863 | 863 | $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);"; |
864 | 864 | } |
865 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
865 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
866 | 866 | try { |
867 | 867 | $sth = $this->db->prepare($query); |
868 | 868 | $sth->execute($query_values); |
869 | - } catch(PDOException $e) { |
|
869 | + } catch (PDOException $e) { |
|
870 | 870 | return "error : ".$e->getMessage(); |
871 | 871 | } |
872 | 872 | } |
873 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
873 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
874 | 874 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
875 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
875 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
876 | 876 | try { |
877 | 877 | $sth = $this->db->prepare($query); |
878 | 878 | $sth->execute($query_values); |
879 | - } catch(PDOException $e) { |
|
879 | + } catch (PDOException $e) { |
|
880 | 880 | return "error : ".$e->getMessage(); |
881 | 881 | } |
882 | 882 | } |
883 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '') { |
|
883 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '') { |
|
884 | 884 | global $globalDBdriver; |
885 | 885 | if ($globalDBdriver == 'mysql') { |
886 | 886 | $query = "INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) VALUES (:aircraft_icao,:registration,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
887 | 887 | } else { |
888 | 888 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
889 | 889 | } |
890 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
890 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
891 | 891 | try { |
892 | 892 | $sth = $this->db->prepare($query); |
893 | 893 | $sth->execute($query_values); |
894 | - } catch(PDOException $e) { |
|
894 | + } catch (PDOException $e) { |
|
895 | 895 | return "error : ".$e->getMessage(); |
896 | 896 | } |
897 | 897 | } |
898 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '') { |
|
898 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '') { |
|
899 | 899 | global $globalDBdriver; |
900 | 900 | if ($globalDBdriver == 'mysql') { |
901 | 901 | $query = "INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) VALUES (:callsign_icao,:airline_icao,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
902 | 902 | } else { |
903 | 903 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
904 | 904 | } |
905 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
905 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
906 | 906 | try { |
907 | 907 | $sth = $this->db->prepare($query); |
908 | 908 | $sth->execute($query_values); |
909 | - } catch(PDOException $e) { |
|
909 | + } catch (PDOException $e) { |
|
910 | 910 | return "error : ".$e->getMessage(); |
911 | 911 | } |
912 | 912 | } |
913 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '') { |
|
913 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '') { |
|
914 | 914 | global $globalDBdriver; |
915 | 915 | if ($globalDBdriver == 'mysql') { |
916 | 916 | $query = "INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) VALUES (:iso2,:iso3,:name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
917 | 917 | } else { |
918 | 918 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
919 | 919 | } |
920 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
920 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
921 | 921 | try { |
922 | 922 | $sth = $this->db->prepare($query); |
923 | 923 | $sth->execute($query_values); |
924 | - } catch(PDOException $e) { |
|
924 | + } catch (PDOException $e) { |
|
925 | 925 | return "error : ".$e->getMessage(); |
926 | 926 | } |
927 | 927 | } |
928 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
928 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '') { |
|
929 | 929 | global $globalDBdriver; |
930 | 930 | if ($globalDBdriver == 'mysql') { |
931 | 931 | $query = "INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline, filter_name) VALUES (:aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, stats_airline = :stats_airline"; |
932 | 932 | } else { |
933 | 933 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
934 | 934 | } |
935 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
935 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
936 | 936 | try { |
937 | 937 | $sth = $this->db->prepare($query); |
938 | 938 | $sth->execute($query_values); |
939 | - } catch(PDOException $e) { |
|
939 | + } catch (PDOException $e) { |
|
940 | 940 | return "error : ".$e->getMessage(); |
941 | 941 | } |
942 | 942 | } |
943 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '') { |
|
943 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '') { |
|
944 | 944 | global $globalDBdriver; |
945 | 945 | if ($globalDBdriver == 'mysql') { |
946 | 946 | $query = "INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) VALUES (:airline_icao,:airline_name,:cnt,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt,airline_name = :airline_name"; |
947 | 947 | } else { |
948 | 948 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
949 | 949 | } |
950 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
950 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
951 | 951 | try { |
952 | 952 | $sth = $this->db->prepare($query); |
953 | 953 | $sth->execute($query_values); |
954 | - } catch(PDOException $e) { |
|
954 | + } catch (PDOException $e) { |
|
955 | 955 | return "error : ".$e->getMessage(); |
956 | 956 | } |
957 | 957 | } |
958 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '') { |
|
958 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
959 | 959 | global $globalDBdriver; |
960 | 960 | if ($globalDBdriver == 'mysql') { |
961 | 961 | $query = "INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) VALUES (:owner_name,:cnt,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt"; |
962 | 962 | } else { |
963 | 963 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
964 | 964 | } |
965 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
965 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
966 | 966 | try { |
967 | 967 | $sth = $this->db->prepare($query); |
968 | 968 | $sth->execute($query_values); |
969 | - } catch(PDOException $e) { |
|
969 | + } catch (PDOException $e) { |
|
970 | 970 | return "error : ".$e->getMessage(); |
971 | 971 | } |
972 | 972 | } |
973 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '') { |
|
973 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '') { |
|
974 | 974 | global $globalDBdriver; |
975 | 975 | if ($globalDBdriver == 'mysql') { |
976 | 976 | $query = "INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) VALUES (:pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, pilot_name = :pilot_name"; |
977 | 977 | } else { |
978 | 978 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
979 | 979 | } |
980 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
980 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
981 | 981 | try { |
982 | 982 | $sth = $this->db->prepare($query); |
983 | 983 | $sth->execute($query_values); |
984 | - } catch(PDOException $e) { |
|
984 | + } catch (PDOException $e) { |
|
985 | 985 | return "error : ".$e->getMessage(); |
986 | 986 | } |
987 | 987 | } |
988 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
988 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
989 | 989 | global $globalDBdriver; |
990 | 990 | if ($globalDBdriver == 'mysql') { |
991 | 991 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = departure+:departure"; |
992 | 992 | } else { |
993 | 993 | $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 AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name 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 AND filter_name = :filter_name);"; |
994 | 994 | } |
995 | - $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,':filter_name' => $filter_name); |
|
995 | + $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, ':filter_name' => $filter_name); |
|
996 | 996 | try { |
997 | 997 | $sth = $this->db->prepare($query); |
998 | 998 | $sth->execute($query_values); |
999 | - } catch(PDOException $e) { |
|
999 | + } catch (PDOException $e) { |
|
1000 | 1000 | return "error : ".$e->getMessage(); |
1001 | 1001 | } |
1002 | 1002 | } |
1003 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1003 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1004 | 1004 | global $globalDBdriver; |
1005 | 1005 | if ($globalDBdriver == 'mysql') { |
1006 | 1006 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE departure = :departure"; |
1007 | 1007 | } else { |
1008 | 1008 | $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 AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name 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 AND filter_name = :filter_name);"; |
1009 | 1009 | } |
1010 | - $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,':filter_name' => $filter_name); |
|
1010 | + $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, ':filter_name' => $filter_name); |
|
1011 | 1011 | try { |
1012 | 1012 | $sth = $this->db->prepare($query); |
1013 | 1013 | $sth->execute($query_values); |
1014 | - } catch(PDOException $e) { |
|
1014 | + } catch (PDOException $e) { |
|
1015 | 1015 | return "error : ".$e->getMessage(); |
1016 | 1016 | } |
1017 | 1017 | } |
1018 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1018 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1019 | 1019 | global $globalDBdriver; |
1020 | 1020 | if ($globalDBdriver == 'mysql') { |
1021 | 1021 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = arrival+:arrival"; |
1022 | 1022 | } else { |
1023 | 1023 | $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 AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name 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 AND filter_name = :filter_name);"; |
1024 | 1024 | } |
1025 | - $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,':filter_name' => $filter_name); |
|
1025 | + $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, ':filter_name' => $filter_name); |
|
1026 | 1026 | try { |
1027 | 1027 | $sth = $this->db->prepare($query); |
1028 | 1028 | $sth->execute($query_values); |
1029 | - } catch(PDOException $e) { |
|
1029 | + } catch (PDOException $e) { |
|
1030 | 1030 | return "error : ".$e->getMessage(); |
1031 | 1031 | } |
1032 | 1032 | } |
1033 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1033 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1034 | 1034 | global $globalDBdriver; |
1035 | 1035 | if ($globalDBdriver == 'mysql') { |
1036 | 1036 | $query = "INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) VALUES (:airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name) ON DUPLICATE KEY UPDATE arrival = :arrival"; |
1037 | 1037 | } else { |
1038 | 1038 | $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 AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name 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 AND filter_name = :filter_name);"; |
1039 | 1039 | } |
1040 | - $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,':filter_name' => $filter_name); |
|
1040 | + $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, ':filter_name' => $filter_name); |
|
1041 | 1041 | try { |
1042 | 1042 | $sth = $this->db->prepare($query); |
1043 | 1043 | $sth->execute($query_values); |
1044 | - } catch(PDOException $e) { |
|
1044 | + } catch (PDOException $e) { |
|
1045 | 1045 | return "error : ".$e->getMessage(); |
1046 | 1046 | } |
1047 | 1047 | } |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | try { |
1053 | 1053 | $sth = $this->db->prepare($query); |
1054 | 1054 | $sth->execute($query_values); |
1055 | - } catch(PDOException $e) { |
|
1055 | + } catch (PDOException $e) { |
|
1056 | 1056 | return "error : ".$e->getMessage(); |
1057 | 1057 | } |
1058 | 1058 | } |
@@ -1062,7 +1062,7 @@ discard block |
||
1062 | 1062 | try { |
1063 | 1063 | $sth = $this->db->prepare($query); |
1064 | 1064 | $sth->execute($query_values); |
1065 | - } catch(PDOException $e) { |
|
1065 | + } catch (PDOException $e) { |
|
1066 | 1066 | return "error : ".$e->getMessage(); |
1067 | 1067 | } |
1068 | 1068 | } |
@@ -1072,7 +1072,7 @@ discard block |
||
1072 | 1072 | try { |
1073 | 1073 | $sth = $this->db->prepare($query); |
1074 | 1074 | $sth->execute($query_values); |
1075 | - } catch(PDOException $e) { |
|
1075 | + } catch (PDOException $e) { |
|
1076 | 1076 | return "error : ".$e->getMessage(); |
1077 | 1077 | } |
1078 | 1078 | } |
@@ -1310,33 +1310,33 @@ discard block |
||
1310 | 1310 | $last_update_day = $last_update[0]['value']; |
1311 | 1311 | } else $last_update_day = '2012-12-12 12:12:12'; |
1312 | 1312 | $Spotter = new Spotter($this->db); |
1313 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1313 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1314 | 1314 | foreach ($alldata as $number) { |
1315 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer']); |
|
1315 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer']); |
|
1316 | 1316 | } |
1317 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
1317 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
1318 | 1318 | foreach ($alldata as $number) { |
1319 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name']); |
|
1319 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name']); |
|
1320 | 1320 | } |
1321 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
1321 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
1322 | 1322 | foreach ($alldata as $number) { |
1323 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao']); |
|
1323 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao']); |
|
1324 | 1324 | } |
1325 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
1325 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
1326 | 1326 | foreach ($alldata as $number) { |
1327 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1327 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1328 | 1328 | } |
1329 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
1329 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
1330 | 1330 | foreach ($alldata as $number) { |
1331 | - $this->addStatOwner($number['owner_name'],$number['owner_count']); |
|
1331 | + $this->addStatOwner($number['owner_name'], $number['owner_count']); |
|
1332 | 1332 | } |
1333 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
1333 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
1334 | 1334 | foreach ($alldata as $number) { |
1335 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name']); |
|
1335 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name']); |
|
1336 | 1336 | } |
1337 | 1337 | |
1338 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
1339 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1338 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
1339 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
1340 | 1340 | $alldata = array(); |
1341 | 1341 | |
1342 | 1342 | foreach ($pall as $value) { |
@@ -1353,12 +1353,12 @@ discard block |
||
1353 | 1353 | foreach ($alldata as $key => $row) { |
1354 | 1354 | $count[$key] = $row['airport_departure_icao_count']; |
1355 | 1355 | } |
1356 | - array_multisort($count,SORT_DESC,$alldata); |
|
1356 | + array_multisort($count, SORT_DESC, $alldata); |
|
1357 | 1357 | foreach ($alldata as $number) { |
1358 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count']); |
|
1358 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count']); |
|
1359 | 1359 | } |
1360 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
1361 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1360 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
1361 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
1362 | 1362 | $alldata = array(); |
1363 | 1363 | foreach ($pall as $value) { |
1364 | 1364 | $icao = $value['airport_arrival_icao']; |
@@ -1374,15 +1374,15 @@ discard block |
||
1374 | 1374 | foreach ($alldata as $key => $row) { |
1375 | 1375 | $count[$key] = $row['airport_arrival_icao_count']; |
1376 | 1376 | } |
1377 | - array_multisort($count,SORT_DESC,$alldata); |
|
1377 | + array_multisort($count, SORT_DESC, $alldata); |
|
1378 | 1378 | foreach ($alldata as $number) { |
1379 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count']); |
|
1379 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count']); |
|
1380 | 1380 | } |
1381 | 1381 | if ($Connection->tableExists('countries')) { |
1382 | 1382 | $SpotterArchive = new SpotterArchive(); |
1383 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
1383 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
1384 | 1384 | foreach ($alldata as $number) { |
1385 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count']); |
|
1385 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count']); |
|
1386 | 1386 | } |
1387 | 1387 | } |
1388 | 1388 | |
@@ -1395,31 +1395,31 @@ discard block |
||
1395 | 1395 | $lastyear = false; |
1396 | 1396 | foreach ($alldata as $number) { |
1397 | 1397 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1398 | - $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']))); |
|
1398 | + $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']))); |
|
1399 | 1399 | } |
1400 | 1400 | $alldata = $Spotter->countAllMilitaryMonths(); |
1401 | 1401 | foreach ($alldata as $number) { |
1402 | - $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']))); |
|
1402 | + $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']))); |
|
1403 | 1403 | } |
1404 | 1404 | $alldata = $Spotter->countAllMonthsOwners(); |
1405 | 1405 | foreach ($alldata as $number) { |
1406 | - $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']))); |
|
1406 | + $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']))); |
|
1407 | 1407 | } |
1408 | 1408 | $alldata = $Spotter->countAllMonthsPilots(); |
1409 | 1409 | foreach ($alldata as $number) { |
1410 | - $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']))); |
|
1410 | + $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']))); |
|
1411 | 1411 | } |
1412 | 1412 | $alldata = $Spotter->countAllMonthsAirlines(); |
1413 | 1413 | foreach ($alldata as $number) { |
1414 | - $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']))); |
|
1414 | + $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']))); |
|
1415 | 1415 | } |
1416 | 1416 | $alldata = $Spotter->countAllMonthsAircrafts(); |
1417 | 1417 | foreach ($alldata as $number) { |
1418 | - $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']))); |
|
1418 | + $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']))); |
|
1419 | 1419 | } |
1420 | 1420 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
1421 | 1421 | foreach ($alldata as $number) { |
1422 | - $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']))); |
|
1422 | + $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']))); |
|
1423 | 1423 | } |
1424 | 1424 | echo 'Airports data...'."\n"; |
1425 | 1425 | echo '...Departure'."\n"; |
@@ -1464,7 +1464,7 @@ discard block |
||
1464 | 1464 | } |
1465 | 1465 | $alldata = $pall; |
1466 | 1466 | foreach ($alldata as $number) { |
1467 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
1467 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
1468 | 1468 | } |
1469 | 1469 | echo '...Arrival'."\n"; |
1470 | 1470 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | } |
1507 | 1507 | $alldata = $pall; |
1508 | 1508 | foreach ($alldata as $number) { |
1509 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
1509 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | echo 'Flights data...'."\n"; |
@@ -1514,27 +1514,27 @@ discard block |
||
1514 | 1514 | echo '-> countAllDatesLastMonth...'."\n"; |
1515 | 1515 | $alldata = $Spotter->countAllDatesLastMonth(); |
1516 | 1516 | foreach ($alldata as $number) { |
1517 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
1517 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
1518 | 1518 | } |
1519 | 1519 | echo '-> countAllDates...'."\n"; |
1520 | 1520 | $previousdata = $this->countAllDates(); |
1521 | 1521 | $this->deleteStatFlight('date'); |
1522 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
1522 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
1523 | 1523 | $values = array(); |
1524 | 1524 | foreach ($alldata as $cnt) { |
1525 | 1525 | $values[] = $cnt['date_count']; |
1526 | 1526 | } |
1527 | - array_multisort($values,SORT_DESC,$alldata); |
|
1528 | - array_splice($alldata,11); |
|
1527 | + array_multisort($values, SORT_DESC, $alldata); |
|
1528 | + array_splice($alldata, 11); |
|
1529 | 1529 | foreach ($alldata as $number) { |
1530 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
1530 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
1531 | 1531 | } |
1532 | 1532 | |
1533 | 1533 | $this->deleteStatFlight('hour'); |
1534 | 1534 | echo '-> countAllHours...'."\n"; |
1535 | 1535 | $alldata = $Spotter->countAllHours('hour'); |
1536 | 1536 | foreach ($alldata as $number) { |
1537 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
1537 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
1538 | 1538 | } |
1539 | 1539 | |
1540 | 1540 | |
@@ -1542,29 +1542,29 @@ discard block |
||
1542 | 1542 | // Count by airlines |
1543 | 1543 | echo '--- Stats by airlines ---'."\n"; |
1544 | 1544 | $Spotter = new Spotter($this->db); |
1545 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
1545 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
1546 | 1546 | foreach ($alldata as $number) { |
1547 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao']); |
|
1547 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao']); |
|
1548 | 1548 | } |
1549 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
1549 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
1550 | 1550 | foreach ($alldata as $number) { |
1551 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao']); |
|
1551 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao']); |
|
1552 | 1552 | } |
1553 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
1553 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
1554 | 1554 | foreach ($alldata as $number) { |
1555 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao']); |
|
1555 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao']); |
|
1556 | 1556 | } |
1557 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
1557 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
1558 | 1558 | foreach ($alldata as $number) { |
1559 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao']); |
|
1559 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao']); |
|
1560 | 1560 | } |
1561 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
1561 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
1562 | 1562 | foreach ($alldata as $number) { |
1563 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao']); |
|
1563 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao']); |
|
1564 | 1564 | } |
1565 | 1565 | |
1566 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1567 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1566 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1567 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1568 | 1568 | //$alldata = array(); |
1569 | 1569 | foreach ($dall as $value) { |
1570 | 1570 | $icao = $value['airport_departure_icao']; |
@@ -1583,10 +1583,10 @@ discard block |
||
1583 | 1583 | } |
1584 | 1584 | $alldata = $pall; |
1585 | 1585 | foreach ($alldata as $number) { |
1586 | - 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']); |
|
1586 | + 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']); |
|
1587 | 1587 | } |
1588 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1589 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1588 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1589 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1590 | 1590 | //$alldata = array(); |
1591 | 1591 | foreach ($dall as $value) { |
1592 | 1592 | $icao = $value['airport_arrival_icao']; |
@@ -1605,30 +1605,30 @@ discard block |
||
1605 | 1605 | } |
1606 | 1606 | $alldata = $pall; |
1607 | 1607 | foreach ($alldata as $number) { |
1608 | - 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']); |
|
1608 | + 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']); |
|
1609 | 1609 | } |
1610 | 1610 | $Spotter = new Spotter($this->db); |
1611 | 1611 | $alldata = $Spotter->countAllMonthsByAirlines(); |
1612 | 1612 | $lastyear = false; |
1613 | 1613 | foreach ($alldata as $number) { |
1614 | 1614 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1615 | - $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']); |
|
1615 | + $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']); |
|
1616 | 1616 | } |
1617 | 1617 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
1618 | 1618 | foreach ($alldata as $number) { |
1619 | - $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']); |
|
1619 | + $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']); |
|
1620 | 1620 | } |
1621 | 1621 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
1622 | 1622 | foreach ($alldata as $number) { |
1623 | - $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']); |
|
1623 | + $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']); |
|
1624 | 1624 | } |
1625 | 1625 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
1626 | 1626 | foreach ($alldata as $number) { |
1627 | - $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']); |
|
1627 | + $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']); |
|
1628 | 1628 | } |
1629 | 1629 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
1630 | 1630 | foreach ($alldata as $number) { |
1631 | - $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']); |
|
1631 | + $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']); |
|
1632 | 1632 | } |
1633 | 1633 | echo '...Departure'."\n"; |
1634 | 1634 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1651,7 +1651,7 @@ discard block |
||
1651 | 1651 | } |
1652 | 1652 | $alldata = $pall; |
1653 | 1653 | foreach ($alldata as $number) { |
1654 | - $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']); |
|
1654 | + $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']); |
|
1655 | 1655 | } |
1656 | 1656 | echo '...Arrival'."\n"; |
1657 | 1657 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1674,32 +1674,32 @@ discard block |
||
1674 | 1674 | } |
1675 | 1675 | $alldata = $pall; |
1676 | 1676 | foreach ($alldata as $number) { |
1677 | - $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']); |
|
1677 | + $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']); |
|
1678 | 1678 | } |
1679 | 1679 | |
1680 | 1680 | echo 'Flights data...'."\n"; |
1681 | 1681 | echo '-> countAllDatesLastMonth...'."\n"; |
1682 | 1682 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
1683 | 1683 | foreach ($alldata as $number) { |
1684 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
1684 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1685 | 1685 | } |
1686 | 1686 | echo '-> countAllDates...'."\n"; |
1687 | 1687 | $previousdata = $this->countAllDatesByAirlines(); |
1688 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDatesByAirlines()); |
|
1688 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDatesByAirlines()); |
|
1689 | 1689 | $values = array(); |
1690 | 1690 | foreach ($alldata as $cnt) { |
1691 | 1691 | $values[] = $cnt['date_count']; |
1692 | 1692 | } |
1693 | - array_multisort($values,SORT_DESC,$alldata); |
|
1694 | - array_splice($alldata,11); |
|
1693 | + array_multisort($values, SORT_DESC, $alldata); |
|
1694 | + array_splice($alldata, 11); |
|
1695 | 1695 | foreach ($alldata as $number) { |
1696 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
1696 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1697 | 1697 | } |
1698 | 1698 | |
1699 | 1699 | echo '-> countAllHours...'."\n"; |
1700 | 1700 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
1701 | 1701 | foreach ($alldata as $number) { |
1702 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
1702 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
1703 | 1703 | } |
1704 | 1704 | |
1705 | 1705 | |
@@ -1710,29 +1710,29 @@ discard block |
||
1710 | 1710 | // Count by filter |
1711 | 1711 | echo '--- Stats by airlines ---'."\n"; |
1712 | 1712 | $Spotter = new Spotter($this->db); |
1713 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
1713 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
1714 | 1714 | foreach ($alldata as $number) { |
1715 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name); |
|
1715 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name); |
|
1716 | 1716 | } |
1717 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
1717 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
1718 | 1718 | foreach ($alldata as $number) { |
1719 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name); |
|
1719 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name); |
|
1720 | 1720 | } |
1721 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
1721 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
1722 | 1722 | foreach ($alldata as $number) { |
1723 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name); |
|
1723 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name); |
|
1724 | 1724 | } |
1725 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
1725 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
1726 | 1726 | foreach ($alldata as $number) { |
1727 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name); |
|
1727 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name); |
|
1728 | 1728 | } |
1729 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
1729 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
1730 | 1730 | foreach ($alldata as $number) { |
1731 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name); |
|
1731 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name); |
|
1732 | 1732 | } |
1733 | 1733 | |
1734 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
1735 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1734 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
1735 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
1736 | 1736 | //$alldata = array(); |
1737 | 1737 | foreach ($dall as $value) { |
1738 | 1738 | $icao = $value['airport_departure_icao']; |
@@ -1751,10 +1751,10 @@ discard block |
||
1751 | 1751 | } |
1752 | 1752 | $alldata = $pall; |
1753 | 1753 | foreach ($alldata as $number) { |
1754 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name); |
|
1754 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name); |
|
1755 | 1755 | } |
1756 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,$filter); |
|
1757 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,$filter); |
|
1756 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, $filter); |
|
1757 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, $filter); |
|
1758 | 1758 | //$alldata = array(); |
1759 | 1759 | foreach ($dall as $value) { |
1760 | 1760 | $icao = $value['airport_arrival_icao']; |
@@ -1773,30 +1773,30 @@ discard block |
||
1773 | 1773 | } |
1774 | 1774 | $alldata = $pall; |
1775 | 1775 | foreach ($alldata as $number) { |
1776 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name); |
|
1776 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name); |
|
1777 | 1777 | } |
1778 | 1778 | $Spotter = new Spotter($this->db); |
1779 | 1779 | $alldata = $Spotter->countAllMonths($filter); |
1780 | 1780 | $lastyear = false; |
1781 | 1781 | foreach ($alldata as $number) { |
1782 | 1782 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1783 | - $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'])),'',$filter_name); |
|
1783 | + $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'])), '', $filter_name); |
|
1784 | 1784 | } |
1785 | 1785 | $alldata = $Spotter->countAllMonthsOwners($filter); |
1786 | 1786 | foreach ($alldata as $number) { |
1787 | - $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'])),'',$filter_name); |
|
1787 | + $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'])), '', $filter_name); |
|
1788 | 1788 | } |
1789 | 1789 | $alldata = $Spotter->countAllMonthsPilots($filter); |
1790 | 1790 | foreach ($alldata as $number) { |
1791 | - $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'])),'',$filter_name); |
|
1791 | + $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'])), '', $filter_name); |
|
1792 | 1792 | } |
1793 | 1793 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
1794 | 1794 | foreach ($alldata as $number) { |
1795 | - $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'])),'',$filter_name); |
|
1795 | + $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'])), '', $filter_name); |
|
1796 | 1796 | } |
1797 | 1797 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
1798 | 1798 | foreach ($alldata as $number) { |
1799 | - $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'])),'',$filter_name); |
|
1799 | + $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'])), '', $filter_name); |
|
1800 | 1800 | } |
1801 | 1801 | echo '...Departure'."\n"; |
1802 | 1802 | $pall = $Spotter->getLast7DaysAirportsDeparture($filter); |
@@ -1819,7 +1819,7 @@ discard block |
||
1819 | 1819 | } |
1820 | 1820 | $alldata = $pall; |
1821 | 1821 | foreach ($alldata as $number) { |
1822 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
|
1822 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name); |
|
1823 | 1823 | } |
1824 | 1824 | echo '...Arrival'."\n"; |
1825 | 1825 | $pall = $Spotter->getLast7DaysAirportsArrival($filter); |
@@ -1842,32 +1842,32 @@ discard block |
||
1842 | 1842 | } |
1843 | 1843 | $alldata = $pall; |
1844 | 1844 | foreach ($alldata as $number) { |
1845 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
|
1845 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name); |
|
1846 | 1846 | } |
1847 | 1847 | |
1848 | 1848 | echo 'Flights data...'."\n"; |
1849 | 1849 | echo '-> countAllDatesLastMonth...'."\n"; |
1850 | 1850 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
1851 | 1851 | foreach ($alldata as $number) { |
1852 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
1852 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
1853 | 1853 | } |
1854 | 1854 | echo '-> countAllDates...'."\n"; |
1855 | 1855 | $previousdata = $this->countAllDates($filter); |
1856 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
1856 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
1857 | 1857 | $values = array(); |
1858 | 1858 | foreach ($alldata as $cnt) { |
1859 | 1859 | $values[] = $cnt['date_count']; |
1860 | 1860 | } |
1861 | - array_multisort($values,SORT_DESC,$alldata); |
|
1862 | - array_splice($alldata,11); |
|
1861 | + array_multisort($values, SORT_DESC, $alldata); |
|
1862 | + array_splice($alldata, 11); |
|
1863 | 1863 | foreach ($alldata as $number) { |
1864 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
1864 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
1865 | 1865 | } |
1866 | 1866 | |
1867 | 1867 | echo '-> countAllHours...'."\n"; |
1868 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
1868 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
1869 | 1869 | foreach ($alldata as $number) { |
1870 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
1870 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
1871 | 1871 | } |
1872 | 1872 | } |
1873 | 1873 | |
@@ -1878,16 +1878,16 @@ discard block |
||
1878 | 1878 | // SUM all previous month to put as year |
1879 | 1879 | $previous_year = date('Y'); |
1880 | 1880 | $previous_year--; |
1881 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1882 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1883 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1884 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
1881 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1882 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1883 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1884 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
1885 | 1885 | $allairlines = $this->getAllAirlineNames(); |
1886 | 1886 | foreach ($allairlines as $data) { |
1887 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1888 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1889 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1890 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
1887 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1888 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1889 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1890 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
1891 | 1891 | } |
1892 | 1892 | |
1893 | 1893 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -1896,7 +1896,7 @@ discard block |
||
1896 | 1896 | try { |
1897 | 1897 | $sth = $this->db->prepare($query); |
1898 | 1898 | $sth->execute(); |
1899 | - } catch(PDOException $e) { |
|
1899 | + } catch (PDOException $e) { |
|
1900 | 1900 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
1901 | 1901 | } |
1902 | 1902 | } |
@@ -1905,7 +1905,7 @@ discard block |
||
1905 | 1905 | try { |
1906 | 1906 | $sth = $this->db->prepare($query); |
1907 | 1907 | $sth->execute(); |
1908 | - } catch(PDOException $e) { |
|
1908 | + } catch (PDOException $e) { |
|
1909 | 1909 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
1910 | 1910 | } |
1911 | 1911 | } |
@@ -1927,7 +1927,7 @@ discard block |
||
1927 | 1927 | try { |
1928 | 1928 | $sth = $this->db->prepare($query); |
1929 | 1929 | $sth->execute(); |
1930 | - } catch(PDOException $e) { |
|
1930 | + } catch (PDOException $e) { |
|
1931 | 1931 | return "error : ".$e->getMessage(); |
1932 | 1932 | } |
1933 | 1933 | } |
@@ -1941,13 +1941,13 @@ discard block |
||
1941 | 1941 | try { |
1942 | 1942 | $sth = $this->db->prepare($query); |
1943 | 1943 | $sth->execute(); |
1944 | - } catch(PDOException $e) { |
|
1944 | + } catch (PDOException $e) { |
|
1945 | 1945 | return "error : ".$e->getMessage(); |
1946 | 1946 | } |
1947 | 1947 | } |
1948 | 1948 | echo 'Insert last stats update date...'."\n"; |
1949 | 1949 | date_default_timezone_set('UTC'); |
1950 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
1950 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
1951 | 1951 | //} |
1952 | 1952 | } |
1953 | 1953 | } |
@@ -73,8 +73,11 @@ discard block |
||
73 | 73 | |
74 | 74 | public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '') { |
75 | 75 | global $globalStatsFilters; |
76 | - 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 AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
77 | - 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 AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
76 | + if ($limit) { |
|
77 | + $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 AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC LIMIT 10 OFFSET 0"; |
|
78 | + } else { |
|
79 | + $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 AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
|
80 | + } |
|
78 | 81 | try { |
79 | 82 | $sth = $this->db->prepare($query); |
80 | 83 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -94,8 +97,11 @@ discard block |
||
94 | 97 | } |
95 | 98 | public function countAllAirlineCountries($limit = true,$filter_name = '') { |
96 | 99 | global $globalStatsFilters; |
97 | - 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 filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
98 | - 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 AND filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
100 | + if ($limit) { |
|
101 | + $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 filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC LIMIT 10 OFFSET 0"; |
|
102 | + } else { |
|
103 | + $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 filter_name = :filter_name GROUP BY airline_country ORDER BY airline_country_count DESC"; |
|
104 | + } |
|
99 | 105 | try { |
100 | 106 | $sth = $this->db->prepare($query); |
101 | 107 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -115,8 +121,11 @@ discard block |
||
115 | 121 | } |
116 | 122 | public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '') { |
117 | 123 | global $globalStatsFilters; |
118 | - if ($limit) $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
119 | - else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
124 | + if ($limit) { |
|
125 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC LIMIT 10 OFFSET 0"; |
|
126 | + } else { |
|
127 | + $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
|
128 | + } |
|
120 | 129 | try { |
121 | 130 | $sth = $this->db->prepare($query); |
122 | 131 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -137,8 +146,11 @@ discard block |
||
137 | 146 | |
138 | 147 | public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '') { |
139 | 148 | global $globalStatsFilters; |
140 | - 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 AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
141 | - 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 AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
149 | + if ($limit) { |
|
150 | + $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 AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC LIMIT 10 OFFSET 0"; |
|
151 | + } else { |
|
152 | + $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 AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
|
153 | + } |
|
142 | 154 | try { |
143 | 155 | $sth = $this->db->prepare($query); |
144 | 156 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -158,8 +170,11 @@ discard block |
||
158 | 170 | } |
159 | 171 | public function countAllDepartureCountries($limit = true, $stats_airline = '', $filter_name = '') { |
160 | 172 | global $globalStatsFilters; |
161 | - 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 AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
162 | - 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 AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
173 | + if ($limit) { |
|
174 | + $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 AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC LIMIT 10 OFFSET 0"; |
|
175 | + } else { |
|
176 | + $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 AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
|
177 | + } |
|
163 | 178 | try { |
164 | 179 | $sth = $this->db->prepare($query); |
165 | 180 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -180,8 +195,11 @@ discard block |
||
180 | 195 | |
181 | 196 | public function countAllAirlines($limit = true,$filter_name = '') { |
182 | 197 | global $globalStatsFilters; |
183 | - 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 AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
184 | - 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 AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
198 | + if ($limit) { |
|
199 | + $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 AND filter_name = :filter_name ORDER BY airline_count DESC LIMIT 10 OFFSET 0"; |
|
200 | + } else { |
|
201 | + $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 AND filter_name = :filter_name ORDER BY airline_count DESC"; |
|
202 | + } |
|
185 | 203 | try { |
186 | 204 | $sth = $this->db->prepare($query); |
187 | 205 | $sth->execute(array(':filter_name' => $filter_name)); |
@@ -202,8 +220,11 @@ discard block |
||
202 | 220 | } |
203 | 221 | public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '') { |
204 | 222 | global $globalStatsFilters; |
205 | - 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 AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
206 | - 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 AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
223 | + if ($limit) { |
|
224 | + $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 AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC LIMIT 10 OFFSET 0"; |
|
225 | + } else { |
|
226 | + $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 AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
|
227 | + } |
|
207 | 228 | try { |
208 | 229 | $sth = $this->db->prepare($query); |
209 | 230 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -223,8 +244,11 @@ discard block |
||
223 | 244 | } |
224 | 245 | public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '') { |
225 | 246 | global $globalStatsFilters; |
226 | - 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 AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
227 | - 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 AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
247 | + if ($limit) { |
|
248 | + $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 AND filter_name = :filter_name ORDER BY callsign_icao_count DESC LIMIT 10 OFFSET 0"; |
|
249 | + } else { |
|
250 | + $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 AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
|
251 | + } |
|
228 | 252 | try { |
229 | 253 | $sth = $this->db->prepare($query); |
230 | 254 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -245,8 +269,11 @@ discard block |
||
245 | 269 | public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '') { |
246 | 270 | $Connection = new Connection(); |
247 | 271 | if ($Connection->tableExists('countries')) { |
248 | - 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 AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
249 | - 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 AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
272 | + if ($limit) { |
|
273 | + $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 AND filter_name = :filter_name ORDER BY flight_count DESC LIMIT 20 OFFSET 0"; |
|
274 | + } else { |
|
275 | + $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 AND filter_name = :filter_name ORDER BY flight_count DESC"; |
|
276 | + } |
|
250 | 277 | try { |
251 | 278 | $sth = $this->db->prepare($query); |
252 | 279 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -267,8 +294,11 @@ discard block |
||
267 | 294 | } |
268 | 295 | public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '') { |
269 | 296 | global $globalStatsFilters; |
270 | - if ($limit) $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
271 | - else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
297 | + if ($limit) { |
|
298 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC LIMIT 10 OFFSET 0"; |
|
299 | + } else { |
|
300 | + $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
|
301 | + } |
|
272 | 302 | try { |
273 | 303 | $sth = $this->db->prepare($query); |
274 | 304 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -288,8 +318,11 @@ discard block |
||
288 | 318 | } |
289 | 319 | public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '') { |
290 | 320 | global $globalStatsFilters; |
291 | - if ($limit) $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
292 | - else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
321 | + if ($limit) { |
|
322 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC LIMIT 10 OFFSET 0"; |
|
323 | + } else { |
|
324 | + $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
|
325 | + } |
|
293 | 326 | try { |
294 | 327 | $sth = $this->db->prepare($query); |
295 | 328 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -309,8 +342,11 @@ discard block |
||
309 | 342 | } |
310 | 343 | public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '') { |
311 | 344 | global $globalStatsFilters; |
312 | - 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 AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
313 | - 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 AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
345 | + if ($limit) { |
|
346 | + $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 AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC LIMIT 10 OFFSET 0"; |
|
347 | + } else { |
|
348 | + $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 AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
|
349 | + } |
|
314 | 350 | try { |
315 | 351 | $sth = $this->db->prepare($query); |
316 | 352 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -336,7 +372,9 @@ discard block |
||
336 | 372 | $icao = $value['airport_departure_icao']; |
337 | 373 | if (isset($all[$icao])) { |
338 | 374 | $all[$icao]['airport_departure_icao_count'] = $all[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
339 | - } else $all[$icao] = $value; |
|
375 | + } else { |
|
376 | + $all[$icao] = $value; |
|
377 | + } |
|
340 | 378 | } |
341 | 379 | $count = array(); |
342 | 380 | foreach ($all as $key => $row) { |
@@ -348,8 +386,11 @@ discard block |
||
348 | 386 | } |
349 | 387 | public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '') { |
350 | 388 | global $globalStatsFilters; |
351 | - 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 AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
352 | - 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 AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
389 | + if ($limit) { |
|
390 | + $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 AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC LIMIT 10 OFFSET 0"; |
|
391 | + } else { |
|
392 | + $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 AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
|
393 | + } |
|
353 | 394 | try { |
354 | 395 | $sth = $this->db->prepare($query); |
355 | 396 | $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
@@ -375,7 +416,9 @@ discard block |
||
375 | 416 | $icao = $value['airport_arrival_icao']; |
376 | 417 | if (isset($all[$icao])) { |
377 | 418 | $all[$icao]['airport_arrival_icao_count'] = $all[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
378 | - } else $all[$icao] = $value; |
|
419 | + } else { |
|
420 | + $all[$icao] = $value; |
|
421 | + } |
|
379 | 422 | } |
380 | 423 | $count = array(); |
381 | 424 | foreach ($all as $key => $row) { |
@@ -389,11 +432,17 @@ discard block |
||
389 | 432 | public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
390 | 433 | global $globalDBdriver, $globalStatsFilters; |
391 | 434 | if ($globalDBdriver == 'mysql') { |
392 | - 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 AND filter_name = :filter_name"; |
|
393 | - 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 AND filter_name = :filter_name"; |
|
435 | + if ($limit) { |
|
436 | + $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 AND filter_name = :filter_name"; |
|
437 | + } else { |
|
438 | + $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 AND filter_name = :filter_name"; |
|
439 | + } |
|
394 | 440 | } else { |
395 | - 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 AND filter_name = :filter_name"; |
|
396 | - 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 AND filter_name = :filter_name"; |
|
441 | + if ($limit) { |
|
442 | + $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 AND filter_name = :filter_name"; |
|
443 | + } else { |
|
444 | + $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 AND filter_name = :filter_name"; |
|
445 | + } |
|
397 | 446 | } |
398 | 447 | $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
399 | 448 | try { |
@@ -545,8 +594,11 @@ discard block |
||
545 | 594 | public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
546 | 595 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
547 | 596 | |
548 | - 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 AND filter_name = :filter_name"; |
|
549 | - else $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
597 | + if ($limit) { |
|
598 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
599 | + } else { |
|
600 | + $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
|
601 | + } |
|
550 | 602 | if ($orderby == 'hour') { |
551 | 603 | if ($globalDBdriver == 'mysql') { |
552 | 604 | $query .= " ORDER BY flight_date ASC"; |
@@ -554,7 +606,9 @@ discard block |
||
554 | 606 | $query .= " ORDER BY CAST(flight_date AS integer) ASC"; |
555 | 607 | } |
556 | 608 | } |
557 | - if ($orderby == 'count') $query .= " ORDER BY hour_count DESC"; |
|
609 | + if ($orderby == 'count') { |
|
610 | + $query .= " ORDER BY hour_count DESC"; |
|
611 | + } |
|
558 | 612 | try { |
559 | 613 | $sth = $this->db->prepare($query); |
560 | 614 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
@@ -1308,7 +1362,9 @@ discard block |
||
1308 | 1362 | echo 'Update stats !'."\n"; |
1309 | 1363 | if (isset($last_update[0]['value'])) { |
1310 | 1364 | $last_update_day = $last_update[0]['value']; |
1311 | - } else $last_update_day = '2012-12-12 12:12:12'; |
|
1365 | + } else { |
|
1366 | + $last_update_day = '2012-12-12 12:12:12'; |
|
1367 | + } |
|
1312 | 1368 | $Spotter = new Spotter($this->db); |
1313 | 1369 | $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
1314 | 1370 | foreach ($alldata as $number) { |
@@ -1347,7 +1403,9 @@ discard block |
||
1347 | 1403 | $icao = $value['airport_departure_icao']; |
1348 | 1404 | if (isset($alldata[$icao])) { |
1349 | 1405 | $alldata[$icao]['airport_departure_icao_count'] = $alldata[$icao]['airport_departure_icao_count'] + $value['airport_departure_icao_count']; |
1350 | - } else $alldata[$icao] = $value; |
|
1406 | + } else { |
|
1407 | + $alldata[$icao] = $value; |
|
1408 | + } |
|
1351 | 1409 | } |
1352 | 1410 | $count = array(); |
1353 | 1411 | foreach ($alldata as $key => $row) { |
@@ -1368,7 +1426,9 @@ discard block |
||
1368 | 1426 | $icao = $value['airport_arrival_icao']; |
1369 | 1427 | if (isset($alldata[$icao])) { |
1370 | 1428 | $alldata[$icao]['airport_arrival_icao_count'] = $alldata[$icao]['airport_arrival_icao_count'] + $value['airport_arrival_icao_count']; |
1371 | - } else $alldata[$icao] = $value; |
|
1429 | + } else { |
|
1430 | + $alldata[$icao] = $value; |
|
1431 | + } |
|
1372 | 1432 | } |
1373 | 1433 | $count = array(); |
1374 | 1434 | foreach ($alldata as $key => $row) { |
@@ -1394,7 +1454,9 @@ discard block |
||
1394 | 1454 | $alldata = $Spotter->countAllMonths(); |
1395 | 1455 | $lastyear = false; |
1396 | 1456 | foreach ($alldata as $number) { |
1397 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1457 | + if ($number['year_name'] != date('Y')) { |
|
1458 | + $lastyear = true; |
|
1459 | + } |
|
1398 | 1460 | $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']))); |
1399 | 1461 | } |
1400 | 1462 | $alldata = $Spotter->countAllMilitaryMonths(); |
@@ -1611,7 +1673,9 @@ discard block |
||
1611 | 1673 | $alldata = $Spotter->countAllMonthsByAirlines(); |
1612 | 1674 | $lastyear = false; |
1613 | 1675 | foreach ($alldata as $number) { |
1614 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1676 | + if ($number['year_name'] != date('Y')) { |
|
1677 | + $lastyear = true; |
|
1678 | + } |
|
1615 | 1679 | $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']); |
1616 | 1680 | } |
1617 | 1681 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
@@ -1703,7 +1767,9 @@ discard block |
||
1703 | 1767 | } |
1704 | 1768 | |
1705 | 1769 | |
1706 | - if (!isset($globalStatsFilters) || $globalStatsFilters == '') $globalStatsFilters = array(); |
|
1770 | + if (!isset($globalStatsFilters) || $globalStatsFilters == '') { |
|
1771 | + $globalStatsFilters = array(); |
|
1772 | + } |
|
1707 | 1773 | foreach ($globalStatsFilters as $name => $filter) { |
1708 | 1774 | //$filter_name = $filter['name']; |
1709 | 1775 | $filter_name = $name; |
@@ -1779,7 +1845,9 @@ discard block |
||
1779 | 1845 | $alldata = $Spotter->countAllMonths($filter); |
1780 | 1846 | $lastyear = false; |
1781 | 1847 | foreach ($alldata as $number) { |
1782 | - if ($number['year_name'] != date('Y')) $lastyear = true; |
|
1848 | + if ($number['year_name'] != date('Y')) { |
|
1849 | + $lastyear = true; |
|
1850 | + } |
|
1783 | 1851 | $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'])),'',$filter_name); |
1784 | 1852 | } |
1785 | 1853 | $alldata = $Spotter->countAllMonthsOwners($filter); |