@@ -79,7 +79,9 @@ |
||
79 | 79 | $output .= '"type": "'.$spotter_item['type'].'",'; |
80 | 80 | if ($spotter_item['type'] == 'wx') { |
81 | 81 | $weather = json_decode($spotter_item['description'],true); |
82 | - if (isset($weather['temp'])) $output.= '"temp": "'.$weather['temp'].'",'; |
|
82 | + if (isset($weather['temp'])) { |
|
83 | + $output.= '"temp": "'.$weather['temp'].'",'; |
|
84 | + } |
|
83 | 85 | } |
84 | 86 | $output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"'; |
85 | 87 | $output .= '},'; |
@@ -13,20 +13,20 @@ discard block |
||
13 | 13 | { |
14 | 14 | $coords = explode(',',$_GET['coord']); |
15 | 15 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
16 | - || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
16 | + || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
17 | 17 | //$spotter_array = $Source->getAllLocationInfo(); |
18 | 18 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs',$coords)); |
19 | 19 | } |
20 | 20 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
21 | - || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
21 | + || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
22 | 22 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx',$coords)); |
23 | 23 | } |
24 | 24 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
25 | - || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
25 | + || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
26 | 26 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning',$coords)); |
27 | 27 | } |
28 | 28 | if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') |
29 | - || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
29 | + || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
30 | 30 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',$coords,true)); |
31 | 31 | } |
32 | 32 | if (!isset($globalDemo)) { |
@@ -34,20 +34,20 @@ discard block |
||
34 | 34 | } |
35 | 35 | } else { |
36 | 36 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
37 | - || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
37 | + || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
38 | 38 | //$spotter_array = $Source->getAllLocationInfo(); |
39 | 39 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs')); |
40 | 40 | } |
41 | 41 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
42 | - || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
42 | + || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
43 | 43 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx')); |
44 | 44 | } |
45 | 45 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
46 | - || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
46 | + || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
47 | 47 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning')); |
48 | 48 | } |
49 | 49 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
50 | - || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
50 | + || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
51 | 51 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',array(),true)); |
52 | 52 | } |
53 | 53 | if (!isset($globalDemo)) { |
@@ -11,47 +11,47 @@ discard block |
||
11 | 11 | $spotter_array = array(); |
12 | 12 | if (isset($_GET['coord'])) |
13 | 13 | { |
14 | - $coords = explode(',',$_GET['coord']); |
|
14 | + $coords = explode(',', $_GET['coord']); |
|
15 | 15 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
16 | 16 | || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
17 | 17 | //$spotter_array = $Source->getAllLocationInfo(); |
18 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs',$coords)); |
|
18 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('gs', $coords)); |
|
19 | 19 | } |
20 | 20 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
21 | 21 | || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
22 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx',$coords)); |
|
22 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('wx', $coords)); |
|
23 | 23 | } |
24 | 24 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
25 | 25 | || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
26 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning',$coords)); |
|
26 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('lightning', $coords)); |
|
27 | 27 | } |
28 | 28 | if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') |
29 | 29 | || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
30 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',$coords,true)); |
|
30 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('fires', $coords, true)); |
|
31 | 31 | } |
32 | 32 | if (!isset($globalDemo)) { |
33 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('')); |
|
33 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('')); |
|
34 | 34 | } |
35 | 35 | } else { |
36 | 36 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
37 | 37 | || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
38 | 38 | //$spotter_array = $Source->getAllLocationInfo(); |
39 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs')); |
|
39 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('gs')); |
|
40 | 40 | } |
41 | 41 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
42 | 42 | || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
43 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx')); |
|
43 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('wx')); |
|
44 | 44 | } |
45 | 45 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
46 | 46 | || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
47 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning')); |
|
47 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('lightning')); |
|
48 | 48 | } |
49 | 49 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
50 | 50 | || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
51 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',array(),true)); |
|
51 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('fires', array(), true)); |
|
52 | 52 | } |
53 | 53 | if (!isset($globalDemo)) { |
54 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('')); |
|
54 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('')); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $output = '{"type": "FeatureCollection","features": ['; |
60 | 60 | if (!empty($spotter_array) && count($spotter_array) > 0) |
61 | 61 | { |
62 | - foreach($spotter_array as $spotter_item) |
|
62 | + foreach ($spotter_array as $spotter_item) |
|
63 | 63 | { |
64 | 64 | date_default_timezone_set('UTC'); |
65 | 65 | $output .= '{"type": "Feature",'; |
@@ -78,8 +78,8 @@ discard block |
||
78 | 78 | $output .= '"icon": "'.$globalURL.'/images/'.$spotter_item['logo'].'",'; |
79 | 79 | $output .= '"type": "'.$spotter_item['type'].'",'; |
80 | 80 | if ($spotter_item['type'] == 'wx') { |
81 | - $weather = json_decode($spotter_item['description'],true); |
|
82 | - if (isset($weather['temp'])) $output.= '"temp": "'.$weather['temp'].'",'; |
|
81 | + $weather = json_decode($spotter_item['description'], true); |
|
82 | + if (isset($weather['temp'])) $output .= '"temp": "'.$weather['temp'].'",'; |
|
83 | 83 | } |
84 | 84 | $output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"'; |
85 | 85 | $output .= '},'; |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $output .= '}'; |
90 | 90 | $output .= '},'; |
91 | 91 | } |
92 | - $output = substr($output, 0, -1); |
|
92 | + $output = substr($output, 0, -1); |
|
93 | 93 | } |
94 | 94 | $output .= ']}'; |
95 | 95 | print $output; |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | require_once('require/class.Language.php'); |
4 | 4 | require_once('require/class.Translation.php'); |
5 | 5 | $type = ''; |
6 | -$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
6 | +$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
7 | 7 | if (isset($_GET['marine'])) { |
8 | 8 | require_once('require/class.Marine.php'); |
9 | 9 | require_once('require/class.MarineLive.php'); |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | $page_url = $globalURL.'/ident/'.$_GET['ident']; |
31 | 31 | } |
32 | 32 | |
33 | -if (!isset($_GET['ident'])){ |
|
33 | +if (!isset($_GET['ident'])) { |
|
34 | 34 | header('Location: '.$globalURL.''); |
35 | 35 | } else { |
36 | 36 | $Translation = new Translation(); |
37 | 37 | //calculuation for the pagination |
38 | - if(!isset($_GET['limit'])) |
|
38 | + if (!isset($_GET['limit'])) |
|
39 | 39 | { |
40 | 40 | $limit_start = 0; |
41 | 41 | $limit_end = 25; |
@@ -54,18 +54,18 @@ discard block |
||
54 | 54 | $limit_previous_1 = $limit_start - $absolute_difference; |
55 | 55 | $limit_previous_2 = $limit_end - $absolute_difference; |
56 | 56 | |
57 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
57 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
58 | 58 | if ($type == 'aircraft') { |
59 | 59 | if ($sort != '') |
60 | 60 | { |
61 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
61 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
62 | 62 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
63 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
63 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
64 | 64 | } |
65 | 65 | } else { |
66 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
66 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
67 | 67 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
68 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
68 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | if (empty($spotter_array)) { |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | $ident = $new_ident; |
75 | 75 | if ($sort != '') |
76 | 76 | { |
77 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
77 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
78 | 78 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
79 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
79 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
80 | 80 | } |
81 | 81 | } else { |
82 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
82 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
83 | 83 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
84 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
84 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -89,34 +89,34 @@ discard block |
||
89 | 89 | } elseif ($type == 'marine') { |
90 | 90 | if ($sort != '') |
91 | 91 | { |
92 | - $spotter_array = $Marine->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
92 | + $spotter_array = $Marine->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
93 | 93 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
94 | - $spotter_array = $MarineArchive->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
94 | + $spotter_array = $MarineArchive->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
95 | 95 | } |
96 | 96 | } else { |
97 | - $spotter_array = $Marine->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
97 | + $spotter_array = $Marine->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
98 | 98 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
99 | - $spotter_array = $MarineArchive->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
99 | + $spotter_array = $MarineArchive->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } elseif ($type == 'tracker') { |
103 | 103 | if ($sort != '') |
104 | 104 | { |
105 | - $spotter_array = $Tracker->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
105 | + $spotter_array = $Tracker->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
106 | 106 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
107 | - $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
107 | + $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
108 | 108 | } |
109 | 109 | } else { |
110 | - $spotter_array = $Tracker->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
110 | + $spotter_array = $Tracker->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
111 | 111 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
112 | - $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
112 | + $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | 117 | if (!empty($spotter_array)) |
118 | 118 | { |
119 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']); |
|
119 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['ident']); |
|
120 | 120 | $ident = $spotter_array[0]['ident']; |
121 | 121 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
122 | 122 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | $altitude_data = ''; |
136 | 136 | $hour_data = ''; |
137 | 137 | $speed_data = ''; |
138 | - foreach($all_data as $data) |
|
138 | + foreach ($all_data as $data) |
|
139 | 139 | { |
140 | 140 | $hour_data .= '"'.$data['date'].'",'; |
141 | 141 | if (isset($data['real_altitude']) && $data['real_altitude'] != '') { |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | $speed_data .= $speed.','; |
164 | 164 | } |
165 | 165 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
166 | - $altitude_data = "['altitude',".substr($altitude_data,0,-1)."]"; |
|
167 | - $speed_data = "['speed',".substr($speed_data,0,-1)."]"; |
|
166 | + $altitude_data = "['altitude',".substr($altitude_data, 0, -1)."]"; |
|
167 | + $speed_data = "['speed',".substr($speed_data, 0, -1)."]"; |
|
168 | 168 | print 'c3.generate({ |
169 | 169 | bindto: "#chart", |
170 | 170 | data: { |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | |
209 | 209 | if ($type == 'aircraft') include('ident-sub-menu.php'); |
210 | 210 | print '<div class="table column">'; |
211 | - if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
212 | - elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
213 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
211 | + if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
212 | + elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
213 | + elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
214 | 214 | |
215 | 215 | include('table-output.php'); |
216 | 216 | print '<div class="pagination">'; |
@@ -123,15 +123,21 @@ discard block |
||
123 | 123 | { |
124 | 124 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']); |
125 | 125 | $ident = $spotter_array[0]['ident']; |
126 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
127 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
126 | + if (isset($spotter_array[0]['latitude'])) { |
|
127 | + $latitude = $spotter_array[0]['latitude']; |
|
128 | + } |
|
129 | + if (isset($spotter_array[0]['longitude'])) { |
|
130 | + $longitude = $spotter_array[0]['longitude']; |
|
131 | + } |
|
128 | 132 | require_once('header.php'); |
129 | 133 | if (isset($globalArchive) && $globalArchive && $type == 'aircraft') { |
130 | 134 | // Requirement for altitude graph |
131 | 135 | $all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']); |
132 | 136 | if (isset($globalTimezone)) { |
133 | 137 | date_default_timezone_set($globalTimezone); |
134 | - } else date_default_timezone_set('UTC'); |
|
138 | + } else { |
|
139 | + date_default_timezone_set('UTC'); |
|
140 | + } |
|
135 | 141 | if (is_array($all_data) && count($all_data) > 1) { |
136 | 142 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
137 | 143 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -205,18 +211,28 @@ discard block |
||
205 | 211 | print '<br/><br/><br/>'; |
206 | 212 | print '<h1>'.$spotter_array[0]['ident'].'</h1>'; |
207 | 213 | print '<div><span class="label">'._("Ident").'</span>'.$spotter_array[0]['ident'].'</div>'; |
208 | - if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) print '<div>'._("Callsign is in blocked FAA list").'</div>'; |
|
214 | + if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) { |
|
215 | + print '<div>'._("Callsign is in blocked FAA list").'</div>'; |
|
216 | + } |
|
209 | 217 | if (isset($spotter_array[0]['airline_icao'])) { |
210 | 218 | print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>'; |
211 | 219 | } |
212 | - if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>'; |
|
220 | + if ($type == 'aircraft') { |
|
221 | + print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>'; |
|
222 | + } |
|
213 | 223 | print '</div>'; |
214 | 224 | |
215 | - if ($type == 'aircraft') include('ident-sub-menu.php'); |
|
225 | + if ($type == 'aircraft') { |
|
226 | + include('ident-sub-menu.php'); |
|
227 | + } |
|
216 | 228 | print '<div class="table column">'; |
217 | - if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
218 | - elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
219 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
229 | + if ($type == 'aircraft') { |
|
230 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
231 | + } elseif ($type == 'marine') { |
|
232 | + print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
233 | + } elseif ($type == 'tracker') { |
|
234 | + print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
235 | + } |
|
220 | 236 | |
221 | 237 | include('table-output.php'); |
222 | 238 | print '<div class="pagination">'; |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | foreach($spotter_array as $spotter_item) |
22 | 22 | { |
23 | 23 | $output .= '<url>'; |
24 | - $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>'; |
|
25 | - $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
26 | - $output .= '<changefreq>weekly</changefreq>'; |
|
24 | + $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>'; |
|
25 | + $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
26 | + $output .= '<changefreq>weekly</changefreq>'; |
|
27 | 27 | $output .= '</url>'; |
28 | 28 | } |
29 | 29 | $output .= '</urlset>'; |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | foreach($aircraft_types as $aircraft_item) |
39 | 39 | { |
40 | 40 | $output .= '<url>'; |
41 | - $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>'; |
|
42 | - $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
43 | - $output .= '<changefreq>daily</changefreq>'; |
|
41 | + $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>'; |
|
42 | + $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
43 | + $output .= '<changefreq>daily</changefreq>'; |
|
44 | 44 | $output .= '</url>'; |
45 | 45 | } |
46 | 46 | $output .= '</urlset>'; |
@@ -55,9 +55,9 @@ discard block |
||
55 | 55 | foreach($aircraft_registrations as $aircraft_item) |
56 | 56 | { |
57 | 57 | $output .= '<url>'; |
58 | - $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>'; |
|
59 | - $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
60 | - $output .= '<changefreq>daily</changefreq>'; |
|
58 | + $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>'; |
|
59 | + $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
60 | + $output .= '<changefreq>daily</changefreq>'; |
|
61 | 61 | $output .= '</url>'; |
62 | 62 | } |
63 | 63 | $output .= '</urlset>'; |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | foreach($airline_names as $airline_item) |
72 | 72 | { |
73 | 73 | $output .= '<url>'; |
74 | - $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>'; |
|
75 | - $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
76 | - $output .= '<changefreq>daily</changefreq>'; |
|
74 | + $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>'; |
|
75 | + $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
76 | + $output .= '<changefreq>daily</changefreq>'; |
|
77 | 77 | $output .= '</url>'; |
78 | 78 | } |
79 | 79 | $output .= '</urlset>'; |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | foreach($airport_names as $airport_item) |
89 | 89 | { |
90 | 90 | $output .= '<url>'; |
91 | - $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>'; |
|
92 | - $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
93 | - $output .= '<changefreq>daily</changefreq>'; |
|
91 | + $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>'; |
|
92 | + $output .= '<lastmod>'.date("c", time()).'</lastmod>'; |
|
93 | + $output .= '<changefreq>daily</changefreq>'; |
|
94 | 94 | $output .= '</url>'; |
95 | 95 | } |
96 | 96 | $output .= '</urlset>'; |
@@ -34,7 +34,9 @@ discard block |
||
34 | 34 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
35 | 35 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
36 | 36 | $aircraft_types = $Stats->getAllAircraftTypes(); |
37 | - if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
37 | + if (empty($aircraft_types)) { |
|
38 | + $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
39 | + } |
|
38 | 40 | foreach($aircraft_types as $aircraft_item) |
39 | 41 | { |
40 | 42 | $output .= '<url>'; |
@@ -84,7 +86,9 @@ discard block |
||
84 | 86 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
85 | 87 | |
86 | 88 | $airport_names = $Stats->getAllAirportNames(); |
87 | - if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
|
89 | + if (empty($airport_names)) { |
|
90 | + $airport_names = $Spotter->getAllAirportNames(); |
|
91 | + } |
|
88 | 92 | foreach($airport_names as $airport_item) |
89 | 93 | { |
90 | 94 | $output .= '<url>'; |
@@ -99,7 +103,9 @@ discard block |
||
99 | 103 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
100 | 104 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
101 | 105 | $manufacturer_names = $Stats->getAllManufacturers(); |
102 | - if (empty($manufacturer_names)) $manufacturer_names = $Spotter->getAllManufacturers(); |
|
106 | + if (empty($manufacturer_names)) { |
|
107 | + $manufacturer_names = $Spotter->getAllManufacturers(); |
|
108 | + } |
|
103 | 109 | foreach($manufacturer_names as $manufacturer_item) |
104 | 110 | { |
105 | 111 | $output .= '<url>'; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
19 | 19 | |
20 | 20 | $spotter_array = $Spotter->getAllFlightsforSitemap(); |
21 | - foreach($spotter_array as $spotter_item) |
|
21 | + foreach ($spotter_array as $spotter_item) |
|
22 | 22 | { |
23 | 23 | $output .= '<url>'; |
24 | 24 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>'; |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | $output .= '</urlset>'; |
30 | 30 | |
31 | 31 | |
32 | -} else if (isset($_GET['type']) && $_GET['type'] == "aircraft"){ |
|
32 | +} else if (isset($_GET['type']) && $_GET['type'] == "aircraft") { |
|
33 | 33 | |
34 | 34 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
35 | 35 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
36 | 36 | $aircraft_types = $Stats->getAllAircraftTypes(); |
37 | 37 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
38 | - foreach($aircraft_types as $aircraft_item) |
|
38 | + foreach ($aircraft_types as $aircraft_item) |
|
39 | 39 | { |
40 | 40 | $output .= '<url>'; |
41 | 41 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>'; |
@@ -46,13 +46,13 @@ discard block |
||
46 | 46 | $output .= '</urlset>'; |
47 | 47 | |
48 | 48 | |
49 | -} else if (isset($_GET['type']) && $_GET['type'] == "registration"){ |
|
49 | +} else if (isset($_GET['type']) && $_GET['type'] == "registration") { |
|
50 | 50 | |
51 | 51 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
52 | 52 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
53 | 53 | |
54 | 54 | $aircraft_registrations = $Spotter->getAllAircraftRegistrations(); |
55 | - foreach($aircraft_registrations as $aircraft_item) |
|
55 | + foreach ($aircraft_registrations as $aircraft_item) |
|
56 | 56 | { |
57 | 57 | $output .= '<url>'; |
58 | 58 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>'; |
@@ -62,13 +62,13 @@ discard block |
||
62 | 62 | } |
63 | 63 | $output .= '</urlset>'; |
64 | 64 | |
65 | -} else if (isset($_GET['type']) && $_GET['type'] == "airline"){ |
|
65 | +} else if (isset($_GET['type']) && $_GET['type'] == "airline") { |
|
66 | 66 | |
67 | 67 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
68 | 68 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
69 | 69 | |
70 | 70 | $airline_names = $Stats->getAllAirlineNames(); |
71 | - foreach($airline_names as $airline_item) |
|
71 | + foreach ($airline_names as $airline_item) |
|
72 | 72 | { |
73 | 73 | $output .= '<url>'; |
74 | 74 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>'; |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | } |
79 | 79 | $output .= '</urlset>'; |
80 | 80 | |
81 | -} else if (isset($_GET['type']) && $_GET['type'] == "airport"){ |
|
81 | +} else if (isset($_GET['type']) && $_GET['type'] == "airport") { |
|
82 | 82 | |
83 | 83 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
84 | 84 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
85 | 85 | |
86 | 86 | $airport_names = $Stats->getAllAirportNames(); |
87 | 87 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
88 | - foreach($airport_names as $airport_item) |
|
88 | + foreach ($airport_names as $airport_item) |
|
89 | 89 | { |
90 | 90 | $output .= '<url>'; |
91 | 91 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>'; |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | } |
96 | 96 | $output .= '</urlset>'; |
97 | 97 | |
98 | -} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer"){ |
|
98 | +} else if (isset($_GET['type']) && $_GET['type'] == "manufacturer") { |
|
99 | 99 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
100 | 100 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
101 | 101 | $manufacturer_names = $Stats->getAllManufacturers(); |
102 | 102 | if (empty($manufacturer_names)) $manufacturer_names = $Spotter->getAllManufacturers(); |
103 | - foreach($manufacturer_names as $manufacturer_item) |
|
103 | + foreach ($manufacturer_names as $manufacturer_item) |
|
104 | 104 | { |
105 | 105 | $output .= '<url>'; |
106 | 106 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/manufacturer/'.urlencode(strtolower(str_replace(" ", "-", $manufacturer_item['aircraft_manufacturer']))).'</loc>'; |
@@ -109,11 +109,11 @@ discard block |
||
109 | 109 | $output .= '</url>'; |
110 | 110 | } |
111 | 111 | $output .= '</urlset>'; |
112 | -} else if (isset($_GET['type']) && $_GET['type'] == "country"){ |
|
112 | +} else if (isset($_GET['type']) && $_GET['type'] == "country") { |
|
113 | 113 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
114 | 114 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
115 | 115 | $country_names = $Spotter->getAllCountries(); |
116 | - foreach($country_names as $country_item) |
|
116 | + foreach ($country_names as $country_item) |
|
117 | 117 | { |
118 | 118 | $output .= '<url>'; |
119 | 119 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/country/'.urlencode(strtolower(str_replace(" ", "-", $country_item['country']))).'</loc>'; |
@@ -122,11 +122,11 @@ discard block |
||
122 | 122 | $output .= '</url>'; |
123 | 123 | } |
124 | 124 | $output .= '</urlset>'; |
125 | -} else if (isset($_GET['type']) && $_GET['type'] == "ident"){ |
|
125 | +} else if (isset($_GET['type']) && $_GET['type'] == "ident") { |
|
126 | 126 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
127 | 127 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
128 | 128 | $ident_names = $Spotter->getAllIdents(); |
129 | - foreach($ident_names as $ident_item) |
|
129 | + foreach ($ident_names as $ident_item) |
|
130 | 130 | { |
131 | 131 | if (ctype_alnum($ident_item['ident'])) { |
132 | 132 | $output .= '<url>'; |
@@ -137,11 +137,11 @@ discard block |
||
137 | 137 | } |
138 | 138 | } |
139 | 139 | $output .= '</urlset>'; |
140 | -} else if (isset($_GET['type']) && $_GET['type'] == "marine-ident"){ |
|
140 | +} else if (isset($_GET['type']) && $_GET['type'] == "marine-ident") { |
|
141 | 141 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
142 | 142 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
143 | 143 | $ident_names = $Marine->getAllIdents(); |
144 | - foreach($ident_names as $ident_item) |
|
144 | + foreach ($ident_names as $ident_item) |
|
145 | 145 | { |
146 | 146 | if (ctype_alnum($ident_item['ident'])) { |
147 | 147 | $output .= '<url>'; |
@@ -152,11 +152,11 @@ discard block |
||
152 | 152 | } |
153 | 153 | } |
154 | 154 | $output .= '</urlset>'; |
155 | -} else if (isset($_GET['type']) && $_GET['type'] == "date"){ |
|
155 | +} else if (isset($_GET['type']) && $_GET['type'] == "date") { |
|
156 | 156 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
157 | 157 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
158 | 158 | $date_names = $Spotter->getAllDates(); |
159 | - foreach($date_names as $date_item) |
|
159 | + foreach ($date_names as $date_item) |
|
160 | 160 | { |
161 | 161 | $output .= '<url>'; |
162 | 162 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>'; |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | $output .= '</url>'; |
166 | 166 | } |
167 | 167 | $output .= '</urlset>'; |
168 | -} else if (isset($_GET['type']) && $_GET['type'] == "marine-date"){ |
|
168 | +} else if (isset($_GET['type']) && $_GET['type'] == "marine-date") { |
|
169 | 169 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
170 | 170 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
171 | 171 | $date_names = $Marine->getAllDates(); |
172 | - foreach($date_names as $date_item) |
|
172 | + foreach ($date_names as $date_item) |
|
173 | 173 | { |
174 | 174 | $output .= '<url>'; |
175 | 175 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/marine/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>'; |
@@ -178,11 +178,11 @@ discard block |
||
178 | 178 | $output .= '</url>'; |
179 | 179 | } |
180 | 180 | $output .= '</urlset>'; |
181 | -} else if (isset($_GET['type']) && $_GET['type'] == "tracker-date"){ |
|
181 | +} else if (isset($_GET['type']) && $_GET['type'] == "tracker-date") { |
|
182 | 182 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
183 | 183 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
184 | 184 | $date_names = $Tracker->getAllDates(); |
185 | - foreach($date_names as $date_item) |
|
185 | + foreach ($date_names as $date_item) |
|
186 | 186 | { |
187 | 187 | $output .= '<url>'; |
188 | 188 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/tracker/date/'.date("Y-m-d", strtotime($date_item['date'])).'</loc>'; |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | $output .= '</url>'; |
192 | 192 | } |
193 | 193 | $output .= '</urlset>'; |
194 | -} else if (isset($_GET['type']) && $_GET['type'] == "route"){ |
|
194 | +} else if (isset($_GET['type']) && $_GET['type'] == "route") { |
|
195 | 195 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
196 | 196 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
197 | 197 | $route_names = $Spotter->getAllRoutes(); |
198 | - foreach($route_names as $route_item) |
|
198 | + foreach ($route_names as $route_item) |
|
199 | 199 | { |
200 | 200 | $output .= '<url>'; |
201 | 201 | $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/route/'.$route_item['airport_departure_icao'].'/'.$route_item['airport_arrival_icao'].'</loc>'; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | $output .= '</url>'; |
205 | 205 | } |
206 | 206 | $output .= '</urlset>'; |
207 | -} else if (isset($_GET['type']) && $_GET['type'] == "static"){ |
|
207 | +} else if (isset($_GET['type']) && $_GET['type'] == "static") { |
|
208 | 208 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
209 | 209 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
210 | 210 | /* STATIC PAGES */ |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $output .= '<changefreq>daily</changefreq>'; |
323 | 323 | $output .= '</url>'; |
324 | 324 | $output .= '</urlset>'; |
325 | -} else if (isset($_GET['type']) && $_GET['type'] == "marine-static"){ |
|
325 | +} else if (isset($_GET['type']) && $_GET['type'] == "marine-static") { |
|
326 | 326 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
327 | 327 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
328 | 328 | /* STATIC PAGES */ |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | $output .= '<changefreq>daily</changefreq>'; |
349 | 349 | $output .= '</url>'; |
350 | 350 | $output .= '</urlset>'; |
351 | -} else if (isset($_GET['type']) && $_GET['type'] == "tracker-static"){ |
|
351 | +} else if (isset($_GET['type']) && $_GET['type'] == "tracker-static") { |
|
352 | 352 | $output .= '<?xml version="1.0" encoding="UTF-8"?>'; |
353 | 353 | $output .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">'; |
354 | 354 | /* STATIC PAGES */ |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | - * Creates the database connection |
|
60 | - * |
|
61 | - * @return Boolean of the database connection |
|
62 | - * |
|
63 | - */ |
|
59 | + * Creates the database connection |
|
60 | + * |
|
61 | + * @return Boolean of the database connection |
|
62 | + * |
|
63 | + */ |
|
64 | 64 | public function createDBConnection($DBname = null, $user = null, $pass = null) |
65 | 65 | { |
66 | 66 | global $globalDBdriver, $globalDBhost, $globalDBuser, $globalDBpass, $globalDBname, $globalDebug, $globalDB, $globalDBport, $globalDBTimeOut, $globalDBretry, $globalDBPersistent; |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | if($results->rowCount()>0) { |
161 | - return true; |
|
161 | + return true; |
|
162 | 162 | } |
163 | 163 | else return false; |
164 | 164 | } |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | $sum = $sum->fetchColumn(0); |
177 | 177 | } else $sum = 0; |
178 | 178 | if (intval($sum) !== 2) { |
179 | - return false; |
|
179 | + return false; |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | } catch(PDOException $e) { |
183 | 183 | if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
184 | - throw $e; |
|
185 | - } |
|
186 | - //echo 'error ! '.$e->getMessage(); |
|
184 | + throw $e; |
|
185 | + } |
|
186 | + //echo 'error ! '.$e->getMessage(); |
|
187 | 187 | return false; |
188 | 188 | } |
189 | 189 | return true; |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | $version = 0; |
288 | 288 | if ($this->tableExists('aircraft')) { |
289 | 289 | if (!$this->tableExists('config')) { |
290 | - $version = '1'; |
|
291 | - return $version; |
|
290 | + $version = '1'; |
|
291 | + return $version; |
|
292 | 292 | } else { |
293 | 293 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
294 | 294 | try { |
@@ -309,10 +309,10 @@ discard block |
||
309 | 309 | * @return Boolean if latest version or not |
310 | 310 | */ |
311 | 311 | public function latest() { |
312 | - global $globalNoDB; |
|
313 | - if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
314 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
315 | - else return false; |
|
312 | + global $globalNoDB; |
|
313 | + if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
314 | + if ($this->check_schema_version() == $this->latest_schema) return true; |
|
315 | + else return false; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | } |
@@ -14,6 +14,9 @@ discard block |
||
14 | 14 | public $dbs = array(); |
15 | 15 | public $latest_schema = 55; |
16 | 16 | |
17 | + /** |
|
18 | + * @param string $dbname |
|
19 | + */ |
|
17 | 20 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
18 | 21 | global $globalNoDB; |
19 | 22 | if (!isset($globalNoDB) || $globalNoDB === FALSE) { |
@@ -146,6 +149,9 @@ discard block |
||
146 | 149 | return true; |
147 | 150 | } |
148 | 151 | |
152 | + /** |
|
153 | + * @param string $table |
|
154 | + */ |
|
149 | 155 | public function tableExists($table) |
150 | 156 | { |
151 | 157 | global $globalDBdriver; |
@@ -196,6 +202,11 @@ discard block |
||
196 | 202 | /* |
197 | 203 | * Check if index exist |
198 | 204 | */ |
205 | + |
|
206 | + /** |
|
207 | + * @param string $table |
|
208 | + * @param string $index |
|
209 | + */ |
|
199 | 210 | public function indexExists($table,$index) |
200 | 211 | { |
201 | 212 | global $globalDBdriver; |
@@ -238,6 +249,10 @@ discard block |
||
238 | 249 | return $columns; |
239 | 250 | } |
240 | 251 | |
252 | + /** |
|
253 | + * @param string $table |
|
254 | + * @param string $column |
|
255 | + */ |
|
241 | 256 | public function getColumnType($table,$column) { |
242 | 257 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
243 | 258 | $tomet = $select->getColumnMeta(0); |
@@ -248,6 +263,11 @@ discard block |
||
248 | 263 | * Check if a column name exist in a table |
249 | 264 | * @return Boolean column exist or not |
250 | 265 | */ |
266 | + |
|
267 | + /** |
|
268 | + * @param string $table |
|
269 | + * @param string $name |
|
270 | + */ |
|
251 | 271 | public function checkColumnName($table,$name) |
252 | 272 | { |
253 | 273 | global $globalDBdriver, $globalDBname; |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | */ |
9 | 9 | require_once(dirname(__FILE__).'/settings.php'); |
10 | 10 | |
11 | -class Connection{ |
|
11 | +class Connection { |
|
12 | 12 | /** @var $db PDO */ |
13 | 13 | public $db; |
14 | 14 | public $dbs = array(); |
15 | 15 | public $latest_schema = 55; |
16 | 16 | |
17 | - public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
|
17 | + public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) { |
|
18 | 18 | global $globalNoDB; |
19 | 19 | if (!isset($globalNoDB) || $globalNoDB === FALSE) { |
20 | 20 | if ($dbc === null) { |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | if ($user === null && $pass === null) { |
23 | 23 | $this->createDBConnection(); |
24 | 24 | } else { |
25 | - $this->createDBConnection(null,$user,$pass); |
|
25 | + $this->createDBConnection(null, $user, $pass); |
|
26 | 26 | } |
27 | 27 | } else { |
28 | 28 | $this->createDBConnection($dbname); |
@@ -104,14 +104,14 @@ discard block |
||
104 | 104 | while (true) { |
105 | 105 | try { |
106 | 106 | if ($globalDBSdriver == 'mysql') { |
107 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
107 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
108 | 108 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
109 | 109 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
110 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
111 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
112 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
113 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
114 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
110 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
111 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500); |
|
112 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
113 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
114 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
115 | 115 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
116 | 116 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
117 | 117 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -121,19 +121,19 @@ discard block |
||
121 | 121 | $this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"'); |
122 | 122 | //$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"'); |
123 | 123 | } else { |
124 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
124 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
125 | 125 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
126 | 126 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
127 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
128 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
129 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
130 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
131 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
127 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
128 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200); |
|
129 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
130 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
131 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
132 | 132 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
133 | 133 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
134 | 134 | } |
135 | 135 | break; |
136 | - } catch(PDOException $e) { |
|
136 | + } catch (PDOException $e) { |
|
137 | 137 | $i++; |
138 | 138 | if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
139 | 139 | //exit; |
@@ -158,10 +158,10 @@ discard block |
||
158 | 158 | try { |
159 | 159 | //$Connection = new Connection(); |
160 | 160 | $results = $this->db->query($query); |
161 | - } catch(PDOException $e) { |
|
161 | + } catch (PDOException $e) { |
|
162 | 162 | return false; |
163 | 163 | } |
164 | - if($results->rowCount()>0) { |
|
164 | + if ($results->rowCount() > 0) { |
|
165 | 165 | return true; |
166 | 166 | } |
167 | 167 | else return false; |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | return false; |
184 | 184 | } |
185 | 185 | |
186 | - } catch(PDOException $e) { |
|
187 | - if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
186 | + } catch (PDOException $e) { |
|
187 | + if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
188 | 188 | throw $e; |
189 | 189 | } |
190 | 190 | //echo 'error ! '.$e->getMessage(); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | /* |
197 | 197 | * Check if index exist |
198 | 198 | */ |
199 | - public function indexExists($table,$index) |
|
199 | + public function indexExists($table, $index) |
|
200 | 200 | { |
201 | 201 | global $globalDBdriver; |
202 | 202 | if ($globalDBdriver == 'mysql') { |
@@ -207,11 +207,11 @@ discard block |
||
207 | 207 | try { |
208 | 208 | //$Connection = new Connection(); |
209 | 209 | $results = $this->db->query($query); |
210 | - } catch(PDOException $e) { |
|
210 | + } catch (PDOException $e) { |
|
211 | 211 | return false; |
212 | 212 | } |
213 | 213 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
214 | - if($nb[0]['nb'] > 0) { |
|
214 | + if ($nb[0]['nb'] > 0) { |
|
215 | 215 | return true; |
216 | 216 | } |
217 | 217 | else return false; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
227 | 227 | try { |
228 | 228 | $results = $this->db->query($query); |
229 | - } catch(PDOException $e) { |
|
229 | + } catch (PDOException $e) { |
|
230 | 230 | return "error : ".$e->getMessage()."\n"; |
231 | 231 | } |
232 | 232 | $columns = array(); |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | return $columns; |
239 | 239 | } |
240 | 240 | |
241 | - public function getColumnType($table,$column) { |
|
241 | + public function getColumnType($table, $column) { |
|
242 | 242 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
243 | 243 | $tomet = $select->getColumnMeta(0); |
244 | 244 | return $tomet['native_type']; |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * Check if a column name exist in a table |
249 | 249 | * @return Boolean column exist or not |
250 | 250 | */ |
251 | - public function checkColumnName($table,$name) |
|
251 | + public function checkColumnName($table, $name) |
|
252 | 252 | { |
253 | 253 | global $globalDBdriver, $globalDBname; |
254 | 254 | if ($globalDBdriver == 'mysql') { |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | } |
259 | 259 | try { |
260 | 260 | $sth = $this->db()->prepare($query); |
261 | - $sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name)); |
|
262 | - } catch(PDOException $e) { |
|
261 | + $sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name)); |
|
262 | + } catch (PDOException $e) { |
|
263 | 263 | echo "error : ".$e->getMessage()."\n"; |
264 | 264 | return false; |
265 | 265 | } |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | try { |
300 | 300 | $sth = $this->db->prepare($query); |
301 | 301 | $sth->execute(); |
302 | - } catch(PDOException $e) { |
|
302 | + } catch (PDOException $e) { |
|
303 | 303 | return "error : ".$e->getMessage()."\n"; |
304 | 304 | } |
305 | 305 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -76,8 +76,11 @@ discard block |
||
76 | 76 | $globalDBSname = $globalDBname; |
77 | 77 | $globalDBSuser = $globalDBuser; |
78 | 78 | $globalDBSpass = $globalDBpass; |
79 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
80 | - else $globalDBSport = $globalDBport; |
|
79 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
80 | + $globalDBSport = 3306; |
|
81 | + } else { |
|
82 | + $globalDBSport = $globalDBport; |
|
83 | + } |
|
81 | 84 | } else { |
82 | 85 | $DBname = 'default'; |
83 | 86 | $globalDBSdriver = $globalDBdriver; |
@@ -85,8 +88,11 @@ discard block |
||
85 | 88 | $globalDBSname = $globalDBname; |
86 | 89 | $globalDBSuser = $user; |
87 | 90 | $globalDBSpass = $pass; |
88 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
89 | - else $globalDBSport = $globalDBport; |
|
91 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
92 | + $globalDBSport = 3306; |
|
93 | + } else { |
|
94 | + $globalDBSport = $globalDBport; |
|
95 | + } |
|
90 | 96 | } |
91 | 97 | } else { |
92 | 98 | $globalDBSdriver = $globalDB[$DBname]['driver']; |
@@ -94,12 +100,19 @@ discard block |
||
94 | 100 | $globalDBSname = $globalDB[$DBname]['name']; |
95 | 101 | $globalDBSuser = $globalDB[$DBname]['user']; |
96 | 102 | $globalDBSpass = $globalDB[$DBname]['pass']; |
97 | - if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port']; |
|
98 | - else $globalDBSport = 3306; |
|
103 | + if (isset($globalDB[$DBname]['port'])) { |
|
104 | + $globalDBSport = $globalDB[$DBname]['port']; |
|
105 | + } else { |
|
106 | + $globalDBSport = 3306; |
|
107 | + } |
|
108 | + } |
|
109 | + if ($globalDBSname == '' || $globalDBSuser == '') { |
|
110 | + return false; |
|
99 | 111 | } |
100 | - if ($globalDBSname == '' || $globalDBSuser == '') return false; |
|
101 | 112 | // Set number of try to connect to DB |
102 | - if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5; |
|
113 | + if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) { |
|
114 | + $globalDBretry = 5; |
|
115 | + } |
|
103 | 116 | $i = 0; |
104 | 117 | while (true) { |
105 | 118 | try { |
@@ -108,10 +121,16 @@ discard block |
||
108 | 121 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
109 | 122 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
110 | 123 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
111 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
112 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
113 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
114 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
124 | + if (!isset($globalDBTimeOut)) { |
|
125 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
126 | + } else { |
|
127 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
128 | + } |
|
129 | + if (!isset($globalDBPersistent)) { |
|
130 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
131 | + } else { |
|
132 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
133 | + } |
|
115 | 134 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
116 | 135 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
117 | 136 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -125,24 +144,36 @@ discard block |
||
125 | 144 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
126 | 145 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
127 | 146 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
128 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
129 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
130 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
131 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
147 | + if (!isset($globalDBTimeOut)) { |
|
148 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
149 | + } else { |
|
150 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
151 | + } |
|
152 | + if (!isset($globalDBPersistent)) { |
|
153 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
154 | + } else { |
|
155 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
156 | + } |
|
132 | 157 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
133 | 158 | $this->dbs[$DBname]->exec('SET timezone="UTC"'); |
134 | 159 | } |
135 | 160 | break; |
136 | 161 | } catch(PDOException $e) { |
137 | 162 | $i++; |
138 | - if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
|
163 | + if (isset($globalDebug) && $globalDebug) { |
|
164 | + echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n"; |
|
165 | + } |
|
139 | 166 | //exit; |
140 | - if ($i > $globalDBretry) return false; |
|
167 | + if ($i > $globalDBretry) { |
|
168 | + return false; |
|
169 | + } |
|
141 | 170 | //return false; |
142 | 171 | } |
143 | 172 | sleep(2); |
144 | 173 | } |
145 | - if ($DBname === 'default') $this->db = $this->dbs['default']; |
|
174 | + if ($DBname === 'default') { |
|
175 | + $this->db = $this->dbs['default']; |
|
176 | + } |
|
146 | 177 | return true; |
147 | 178 | } |
148 | 179 | |
@@ -154,7 +185,9 @@ discard block |
||
154 | 185 | } else { |
155 | 186 | $query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'"; |
156 | 187 | } |
157 | - if ($this->db == NULL) return false; |
|
188 | + if ($this->db == NULL) { |
|
189 | + return false; |
|
190 | + } |
|
158 | 191 | try { |
159 | 192 | //$Connection = new Connection(); |
160 | 193 | $results = $this->db->query($query); |
@@ -163,22 +196,31 @@ discard block |
||
163 | 196 | } |
164 | 197 | if($results->rowCount()>0) { |
165 | 198 | return true; |
199 | + } else { |
|
200 | + return false; |
|
166 | 201 | } |
167 | - else return false; |
|
168 | 202 | } |
169 | 203 | |
170 | 204 | public function connectionExists() |
171 | 205 | { |
172 | 206 | global $globalDBCheckConnection, $globalNoDB; |
173 | - if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true; |
|
174 | - if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
207 | + if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) { |
|
208 | + return true; |
|
209 | + } |
|
210 | + if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
211 | + return true; |
|
212 | + } |
|
175 | 213 | $query = "SELECT 1 + 1"; |
176 | - if ($this->db === null) return false; |
|
214 | + if ($this->db === null) { |
|
215 | + return false; |
|
216 | + } |
|
177 | 217 | try { |
178 | 218 | $sum = @$this->db->query($query); |
179 | 219 | if ($sum instanceof \PDOStatement) { |
180 | 220 | $sum = $sum->fetchColumn(0); |
181 | - } else $sum = 0; |
|
221 | + } else { |
|
222 | + $sum = 0; |
|
223 | + } |
|
182 | 224 | if (intval($sum) !== 2) { |
183 | 225 | return false; |
184 | 226 | } |
@@ -213,8 +255,9 @@ discard block |
||
213 | 255 | $nb = $results->fetchAll(PDO::FETCH_ASSOC); |
214 | 256 | if($nb[0]['nb'] > 0) { |
215 | 257 | return true; |
258 | + } else { |
|
259 | + return false; |
|
216 | 260 | } |
217 | - else return false; |
|
218 | 261 | } |
219 | 262 | |
220 | 263 | /* |
@@ -265,9 +308,12 @@ discard block |
||
265 | 308 | } |
266 | 309 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
267 | 310 | $sth->closeCursor(); |
268 | - if ($result['nb'] > 0) return true; |
|
269 | - else return false; |
|
270 | -/* } else { |
|
311 | + if ($result['nb'] > 0) { |
|
312 | + return true; |
|
313 | + } else { |
|
314 | + return false; |
|
315 | + } |
|
316 | + /* } else { |
|
271 | 317 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
272 | 318 | try { |
273 | 319 | $results = $this->db->query($query); |
@@ -306,7 +352,9 @@ discard block |
||
306 | 352 | $sth->closeCursor(); |
307 | 353 | return $result['value']; |
308 | 354 | } |
309 | - } else return $version; |
|
355 | + } else { |
|
356 | + return $version; |
|
357 | + } |
|
310 | 358 | } |
311 | 359 | |
312 | 360 | /* |
@@ -315,9 +363,14 @@ discard block |
||
315 | 363 | */ |
316 | 364 | public function latest() { |
317 | 365 | global $globalNoDB; |
318 | - if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
319 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
320 | - else return false; |
|
366 | + if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
367 | + return true; |
|
368 | + } |
|
369 | + if ($this->check_schema_version() == $this->latest_schema) { |
|
370 | + return true; |
|
371 | + } else { |
|
372 | + return false; |
|
373 | + } |
|
321 | 374 | } |
322 | 375 | |
323 | 376 | } |
@@ -22,7 +22,9 @@ |
||
22 | 22 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
25 | + if (empty($all_manufacturers)) { |
|
26 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
27 | + } |
|
26 | 28 | foreach($all_manufacturers as $all_manufacturer) |
27 | 29 | { |
28 | 30 | if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | die(); |
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | -$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
|
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort); |
|
11 | +$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)))); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort); |
|
14 | 14 | |
15 | 15 | if (!empty($spotter_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("Most Common Airlines by Country from %s"),$manufacturer); |
|
17 | + $title = sprintf(_("Most Common Airlines by Country from %s"), $manufacturer); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | 25 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
26 | - foreach($all_manufacturers as $all_manufacturer) |
|
26 | + foreach ($all_manufacturers as $all_manufacturer) |
|
27 | 27 | { |
28 | - if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
|
28 | + if ($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
|
29 | 29 | { |
30 | 30 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
31 | 31 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | include('manufacturer-sub-menu.php'); |
45 | 45 | print '<div class="column">'; |
46 | 46 | print '<h2>'._("Most Common Airlines by Country").'</h2>'; |
47 | - print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights from <strong>%s</strong>."),$manufacturer).'</p>'; |
|
47 | + print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights from <strong>%s</strong>."), $manufacturer).'</p>'; |
|
48 | 48 | $airline_array = $Spotter->countAllAirlineCountriesByManufacturer($manufacturer); |
49 | 49 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
50 | 50 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
53 | 53 | print 'var series = ['; |
54 | 54 | $country_data = ''; |
55 | - foreach($airline_array as $airline_item) |
|
55 | + foreach ($airline_array as $airline_item) |
|
56 | 56 | { |
57 | 57 | $country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],'; |
58 | 58 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | print '</thead>'; |
100 | 100 | print '<tbody>'; |
101 | 101 | $i = 1; |
102 | - foreach($airline_array as $airline_item) |
|
102 | + foreach ($airline_array as $airline_item) |
|
103 | 103 | { |
104 | 104 | print '<tr>'; |
105 | 105 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['aircraft_manufacturer'])) { |
7 | - header('Location: '.$globalURL.'/manufacturer'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/manufacturer'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['country'])) { |
6 | - header('Location: '.$globalURL.'/country'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/country'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
|
11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
10 | +$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)))); |
|
11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
12 | 12 | if (isset($_GET['sort'])) { |
13 | 13 | $spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort); |
14 | 14 | } else { |
@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | |
18 | 18 | if (!empty($spotter_array)) |
19 | 19 | { |
20 | - $title = sprintf(_("Most Common Aircraft by registration from %s"),$country); |
|
20 | + $title = sprintf(_("Most Common Aircraft by registration from %s"), $country); |
|
21 | 21 | require_once('header.php'); |
22 | 22 | print '<div class="select-item">'; |
23 | 23 | print '<form action="'.$globalURL.'/country" method="post">'; |
24 | 24 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
25 | 25 | print '<option></option>'; |
26 | 26 | $all_countries = $Spotter->getAllCountries(); |
27 | - foreach($all_countries as $all_country) |
|
27 | + foreach ($all_countries as $all_country) |
|
28 | 28 | { |
29 | - if($country == $all_country['country']) |
|
29 | + if ($country == $all_country['country']) |
|
30 | 30 | { |
31 | 31 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
32 | 32 | } else { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | if ($_GET['country'] != "NA") |
42 | 42 | { |
43 | 43 | print '<div class="info column">'; |
44 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
44 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
45 | 45 | print '</div>'; |
46 | 46 | } else { |
47 | 47 | print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>'; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | include('country-sub-menu.php'); |
51 | 51 | print '<div class="column">'; |
52 | 52 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
53 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of airlines or departure/arrival airports from <strong>%s</strong>."),$country).'</p>'; |
|
53 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of airlines or departure/arrival airports from <strong>%s</strong>."), $country).'</p>'; |
|
54 | 54 | $aircraft_array = $Spotter->countAllAircraftRegistrationByCountry($country); |
55 | 55 | if (!empty($aircraft_array)) |
56 | 56 | { |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | print '</thead>'; |
66 | 66 | print '<tbody>'; |
67 | 67 | $i = 1; |
68 | - foreach($aircraft_array as $aircraft_item) |
|
68 | + foreach ($aircraft_array as $aircraft_item) |
|
69 | 69 | { |
70 | 70 | print '<tr>'; |
71 | 71 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
|
11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
10 | +$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)))); |
|
11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
12 | 12 | |
13 | 13 | if (isset($_GET['sort'])) { |
14 | 14 | $spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort); |
@@ -18,16 +18,16 @@ discard block |
||
18 | 18 | |
19 | 19 | if (!empty($spotter_array)) |
20 | 20 | { |
21 | - $title = sprintf(_("Most Common Departure Airports from %s"),$country); |
|
21 | + $title = sprintf(_("Most Common Departure Airports from %s"), $country); |
|
22 | 22 | require_once('header.php'); |
23 | 23 | print '<div class="select-item">'; |
24 | 24 | print '<form action="'.$globalURL.'/country" method="post">'; |
25 | 25 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
26 | 26 | print '<option></option>'; |
27 | 27 | $all_countries = $Spotter->getAllCountries(); |
28 | - foreach($all_countries as $all_country) |
|
28 | + foreach ($all_countries as $all_country) |
|
29 | 29 | { |
30 | - if($country == $all_country['country']) |
|
30 | + if ($country == $all_country['country']) |
|
31 | 31 | { |
32 | 32 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
33 | 33 | } else { |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | if ($_GET['country'] != "NA") |
42 | 42 | { |
43 | 43 | print '<div class="info column">'; |
44 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
44 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
45 | 45 | print '</div>'; |
46 | 46 | } else { |
47 | 47 | print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>'; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | include('country-sub-menu.php'); |
51 | 51 | print '<div class="column">'; |
52 | 52 | print '<h2>'._("Most Common Departure Airports").'</h2>'; |
53 | - print '<p>'.sprintf(_("The statistic below shows all departure airports of flights of airports & airlines from <strong>%s</strong>."),$country).'</p>'; |
|
53 | + print '<p>'.sprintf(_("The statistic below shows all departure airports of flights of airports & airlines from <strong>%s</strong>."), $country).'</p>'; |
|
54 | 54 | |
55 | 55 | $airport_airport_array = $Spotter->countAllDepartureAirportsByCountry($country); |
56 | 56 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | print '<script>'; |
61 | 61 | print 'var series = ['; |
62 | 62 | $airport_data = ''; |
63 | - foreach($airport_airport_array as $airport_item) |
|
63 | + foreach ($airport_airport_array as $airport_item) |
|
64 | 64 | { |
65 | 65 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
66 | 66 | } |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | print '</thead>'; |
115 | 115 | print '<tbody>'; |
116 | 116 | $i = 1; |
117 | - foreach($airport_airport_array as $airport_item) |
|
117 | + foreach ($airport_airport_array as $airport_item) |
|
118 | 118 | { |
119 | 119 | print '<tr>'; |
120 | 120 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -22,7 +22,9 @@ |
||
22 | 22 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
25 | + if (empty($all_manufacturers)) { |
|
26 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
27 | + } |
|
26 | 28 | foreach($all_manufacturers as $all_manufacturer) |
27 | 29 | { |
28 | 30 | if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['aircraft_manufacturer'])) { |
7 | - header('Location: '.$globalURL.'/manufacturer'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/manufacturer'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | die(); |
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | -$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
|
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort); |
|
11 | +$manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)))); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort); |
|
14 | 14 | |
15 | 15 | if (!empty($spotter_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("Most Common Aircraft from %s"),$manufacturer); |
|
17 | + $title = sprintf(_("Most Common Aircraft from %s"), $manufacturer); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | 25 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
26 | - foreach($all_manufacturers as $all_manufacturer) |
|
26 | + foreach ($all_manufacturers as $all_manufacturer) |
|
27 | 27 | { |
28 | - if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
|
28 | + if ($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer'])) |
|
29 | 29 | { |
30 | 30 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
31 | 31 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | include('manufacturer-sub-menu.php'); |
45 | 45 | print '<div class="column">'; |
46 | 46 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
47 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."),$manufacturer).'</p>'; |
|
47 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."), $manufacturer).'</p>'; |
|
48 | 48 | |
49 | 49 | $aircraft_array = $Spotter->countAllAircraftTypesByManufacturer($manufacturer); |
50 | 50 | if (!empty($aircraft_array)) |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | print '</thead>'; |
60 | 60 | print '<tbody>'; |
61 | 61 | $i = 1; |
62 | - foreach($aircraft_array as $aircraft_item) |
|
62 | + foreach ($aircraft_array as $aircraft_item) |
|
63 | 63 | { |
64 | 64 | print '<tr>'; |
65 | 65 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
|
11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
10 | +$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)))); |
|
11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
12 | 12 | |
13 | 13 | if (isset($_GET['sort'])) { |
14 | 14 | $spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort); |
@@ -18,16 +18,16 @@ discard block |
||
18 | 18 | |
19 | 19 | if (!empty($spotter_array)) |
20 | 20 | { |
21 | - $title = sprintf(_("Most Common Time of Day from %s"),$country); |
|
21 | + $title = sprintf(_("Most Common Time of Day from %s"), $country); |
|
22 | 22 | require_once('header.php'); |
23 | 23 | print '<div class="select-item">'; |
24 | 24 | print '<form action="'.$globalURL.'/country" method="post">'; |
25 | 25 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
26 | 26 | print '<option></option>'; |
27 | 27 | $all_countries = $Spotter->getAllCountries(); |
28 | - foreach($all_countries as $all_country) |
|
28 | + foreach ($all_countries as $all_country) |
|
29 | 29 | { |
30 | - if($country == $all_country['country']) |
|
30 | + if ($country == $all_country['country']) |
|
31 | 31 | { |
32 | 32 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
33 | 33 | } else { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | if ($_GET['country'] != "NA") |
43 | 43 | { |
44 | 44 | print '<div class="info column">'; |
45 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
45 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
46 | 46 | print '</div>'; |
47 | 47 | } else { |
48 | 48 | print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>'; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | include('country-sub-menu.php'); |
52 | 52 | print '<div class="column">'; |
53 | 53 | print '<h2>'._("Most Common Time of Day").'</h2>'; |
54 | - print '<p>'.sprintf(_("The statistic below shows the most common time of day of airports & airlines from <strong>%s</strong>."),$country).'</p>'; |
|
54 | + print '<p>'.sprintf(_("The statistic below shows the most common time of day of airports & airlines from <strong>%s</strong>."), $country).'</p>'; |
|
55 | 55 | $hour_array = $Spotter->countAllHoursByCountry($country); |
56 | 56 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
57 | 57 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | $hour_data = ''; |
61 | 61 | $hour_cnt = ''; |
62 | 62 | $last = 0; |
63 | - foreach($hour_array as $hour_item) |
|
63 | + foreach ($hour_array as $hour_item) |
|
64 | 64 | { |
65 | - while($last != $hour_item['hour_name']) { |
|
65 | + while ($last != $hour_item['hour_name']) { |
|
66 | 66 | $hour_data .= '"'.$last.':00",'; |
67 | 67 | $hour_cnt .= '0,'; |
68 | 68 | $last++; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | $hour_cnt .= $hour_item['hour_count'].','; |
73 | 73 | } |
74 | 74 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
75 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
75 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
76 | 76 | print 'c3.generate({ |
77 | 77 | bindto: "#chartHour", |
78 | 78 | data: { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | print '</thead>'; |
98 | 98 | print '<tbody>'; |
99 | 99 | $i = 1; |
100 | - foreach($hour_array as $hour_item) |
|
100 | + foreach ($hour_array as $hour_item) |
|
101 | 101 | { |
102 | 102 | print '<tr>'; |
103 | 103 | print '<td>'.$hour_item['hour_name'].':00</td>'; |
@@ -3,8 +3,8 @@ |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['country'])) { |
6 | - header('Location: '.$globalURL.'/country'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/country'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |