@@ -46,38 +46,38 @@ discard block |
||
46 | 46 | // Public: Standard -- Common to all geometries |
47 | 47 | // -------------------------------------------- |
48 | 48 | public function SRID() { |
49 | - return $this->srid; |
|
49 | + return $this->srid; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function setSRID($srid) { |
53 | - if ($this->geos()) { |
|
54 | - $this->geos()->setSRID($srid); |
|
55 | - } |
|
56 | - $this->srid = $srid; |
|
53 | + if ($this->geos()) { |
|
54 | + $this->geos()->setSRID($srid); |
|
55 | + } |
|
56 | + $this->srid = $srid; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public function envelope() { |
60 | - if ($this->isEmpty()) return new Polygon(); |
|
60 | + if ($this->isEmpty()) return new Polygon(); |
|
61 | 61 | |
62 | - if ($this->geos()) { |
|
63 | - return geoPHP::geosToGeometry($this->geos()->envelope()); |
|
64 | - } |
|
62 | + if ($this->geos()) { |
|
63 | + return geoPHP::geosToGeometry($this->geos()->envelope()); |
|
64 | + } |
|
65 | 65 | |
66 | - $bbox = $this->getBBox(); |
|
67 | - $points = array ( |
|
68 | - new Point($bbox['maxx'],$bbox['miny']), |
|
69 | - new Point($bbox['maxx'],$bbox['maxy']), |
|
70 | - new Point($bbox['minx'],$bbox['maxy']), |
|
71 | - new Point($bbox['minx'],$bbox['miny']), |
|
72 | - new Point($bbox['maxx'],$bbox['miny']), |
|
73 | - ); |
|
66 | + $bbox = $this->getBBox(); |
|
67 | + $points = array ( |
|
68 | + new Point($bbox['maxx'],$bbox['miny']), |
|
69 | + new Point($bbox['maxx'],$bbox['maxy']), |
|
70 | + new Point($bbox['minx'],$bbox['maxy']), |
|
71 | + new Point($bbox['minx'],$bbox['miny']), |
|
72 | + new Point($bbox['maxx'],$bbox['miny']), |
|
73 | + ); |
|
74 | 74 | |
75 | - $outer_boundary = new LineString($points); |
|
76 | - return new Polygon(array($outer_boundary)); |
|
75 | + $outer_boundary = new LineString($points); |
|
76 | + return new Polygon(array($outer_boundary)); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | public function geometryType() { |
80 | - return $this->geom_type; |
|
80 | + return $this->geom_type; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | // Public: Non-Standard -- Common to all geometries |
@@ -85,263 +85,263 @@ discard block |
||
85 | 85 | |
86 | 86 | // $this->out($format, $other_args); |
87 | 87 | public function out() { |
88 | - $args = func_get_args(); |
|
88 | + $args = func_get_args(); |
|
89 | 89 | |
90 | - $format = array_shift($args); |
|
91 | - $type_map = geoPHP::getAdapterMap(); |
|
92 | - $processor_type = $type_map[$format]; |
|
93 | - $processor = new $processor_type(); |
|
90 | + $format = array_shift($args); |
|
91 | + $type_map = geoPHP::getAdapterMap(); |
|
92 | + $processor_type = $type_map[$format]; |
|
93 | + $processor = new $processor_type(); |
|
94 | 94 | |
95 | - array_unshift($args, $this); |
|
96 | - $result = call_user_func_array(array($processor, 'write'), $args); |
|
95 | + array_unshift($args, $this); |
|
96 | + $result = call_user_func_array(array($processor, 'write'), $args); |
|
97 | 97 | |
98 | - return $result; |
|
98 | + return $result; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | |
102 | 102 | // Public: Aliases |
103 | 103 | // --------------- |
104 | 104 | public function getCentroid() { |
105 | - return $this->centroid(); |
|
105 | + return $this->centroid(); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | public function getArea() { |
109 | - return $this->area(); |
|
109 | + return $this->area(); |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | public function getX() { |
113 | - return $this->x(); |
|
113 | + return $this->x(); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | public function getY() { |
117 | - return $this->y(); |
|
117 | + return $this->y(); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | public function getGeos() { |
121 | - return $this->geos(); |
|
121 | + return $this->geos(); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | public function getGeomType() { |
125 | - return $this->geometryType(); |
|
125 | + return $this->geometryType(); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | public function getSRID() { |
129 | - return $this->SRID(); |
|
129 | + return $this->SRID(); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | public function asText() { |
133 | - return $this->out('wkt'); |
|
133 | + return $this->out('wkt'); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | public function asBinary() { |
137 | - return $this->out('wkb'); |
|
137 | + return $this->out('wkb'); |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | // Public: GEOS Only Functions |
141 | 141 | // --------------------------- |
142 | 142 | public function geos() { |
143 | - // If it's already been set, just return it |
|
144 | - if ($this->geos && geoPHP::geosInstalled()) { |
|
145 | - return $this->geos; |
|
146 | - } |
|
147 | - // It hasn't been set yet, generate it |
|
148 | - if (geoPHP::geosInstalled()) { |
|
149 | - $reader = new GEOSWKBReader(); |
|
150 | - $this->geos = $reader->readHEX($this->out('wkb',TRUE)); |
|
151 | - } |
|
152 | - else { |
|
153 | - $this->geos = FALSE; |
|
154 | - } |
|
155 | - return $this->geos; |
|
143 | + // If it's already been set, just return it |
|
144 | + if ($this->geos && geoPHP::geosInstalled()) { |
|
145 | + return $this->geos; |
|
146 | + } |
|
147 | + // It hasn't been set yet, generate it |
|
148 | + if (geoPHP::geosInstalled()) { |
|
149 | + $reader = new GEOSWKBReader(); |
|
150 | + $this->geos = $reader->readHEX($this->out('wkb',TRUE)); |
|
151 | + } |
|
152 | + else { |
|
153 | + $this->geos = FALSE; |
|
154 | + } |
|
155 | + return $this->geos; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | public function setGeos($geos) { |
159 | - $this->geos = $geos; |
|
159 | + $this->geos = $geos; |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | public function pointOnSurface() { |
163 | - if ($this->geos()) { |
|
164 | - return geoPHP::geosToGeometry($this->geos()->pointOnSurface()); |
|
165 | - } |
|
163 | + if ($this->geos()) { |
|
164 | + return geoPHP::geosToGeometry($this->geos()->pointOnSurface()); |
|
165 | + } |
|
166 | 166 | } |
167 | 167 | |
168 | 168 | public function equalsExact(Geometry $geometry) { |
169 | - if ($this->geos()) { |
|
170 | - return $this->geos()->equalsExact($geometry->geos()); |
|
171 | - } |
|
169 | + if ($this->geos()) { |
|
170 | + return $this->geos()->equalsExact($geometry->geos()); |
|
171 | + } |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | public function relate(Geometry $geometry, $pattern = NULL) { |
175 | - if ($this->geos()) { |
|
176 | - if ($pattern) { |
|
177 | - return $this->geos()->relate($geometry->geos(), $pattern); |
|
178 | - } |
|
179 | - else { |
|
180 | - return $this->geos()->relate($geometry->geos()); |
|
181 | - } |
|
182 | - } |
|
175 | + if ($this->geos()) { |
|
176 | + if ($pattern) { |
|
177 | + return $this->geos()->relate($geometry->geos(), $pattern); |
|
178 | + } |
|
179 | + else { |
|
180 | + return $this->geos()->relate($geometry->geos()); |
|
181 | + } |
|
182 | + } |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | public function checkValidity() { |
186 | - if ($this->geos()) { |
|
187 | - return $this->geos()->checkValidity(); |
|
188 | - } |
|
186 | + if ($this->geos()) { |
|
187 | + return $this->geos()->checkValidity(); |
|
188 | + } |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | public function buffer($distance) { |
192 | - if ($this->geos()) { |
|
193 | - return geoPHP::geosToGeometry($this->geos()->buffer($distance)); |
|
194 | - } |
|
192 | + if ($this->geos()) { |
|
193 | + return geoPHP::geosToGeometry($this->geos()->buffer($distance)); |
|
194 | + } |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | public function intersection(Geometry $geometry) { |
198 | - if ($this->geos()) { |
|
199 | - return geoPHP::geosToGeometry($this->geos()->intersection($geometry->geos())); |
|
200 | - } |
|
198 | + if ($this->geos()) { |
|
199 | + return geoPHP::geosToGeometry($this->geos()->intersection($geometry->geos())); |
|
200 | + } |
|
201 | 201 | } |
202 | 202 | |
203 | 203 | public function convexHull() { |
204 | - if ($this->geos()) { |
|
205 | - return geoPHP::geosToGeometry($this->geos()->convexHull()); |
|
206 | - } |
|
204 | + if ($this->geos()) { |
|
205 | + return geoPHP::geosToGeometry($this->geos()->convexHull()); |
|
206 | + } |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | public function difference(Geometry $geometry) { |
210 | - if ($this->geos()) { |
|
211 | - return geoPHP::geosToGeometry($this->geos()->difference($geometry->geos())); |
|
212 | - } |
|
210 | + if ($this->geos()) { |
|
211 | + return geoPHP::geosToGeometry($this->geos()->difference($geometry->geos())); |
|
212 | + } |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | public function symDifference(Geometry $geometry) { |
216 | - if ($this->geos()) { |
|
217 | - return geoPHP::geosToGeometry($this->geos()->symDifference($geometry->geos())); |
|
218 | - } |
|
216 | + if ($this->geos()) { |
|
217 | + return geoPHP::geosToGeometry($this->geos()->symDifference($geometry->geos())); |
|
218 | + } |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | // Can pass in a geometry or an array of geometries |
222 | 222 | public function union(Geometry $geometry) { |
223 | - if ($this->geos()) { |
|
224 | - if (is_array($geometry)) { |
|
225 | - $geom = $this->geos(); |
|
226 | - foreach ($geometry as $item) { |
|
227 | - $geom = $geom->union($item->geos()); |
|
228 | - } |
|
229 | - return geoPHP::geosToGeometry($geom); |
|
230 | - } |
|
231 | - else { |
|
232 | - return geoPHP::geosToGeometry($this->geos()->union($geometry->geos())); |
|
233 | - } |
|
234 | - } |
|
223 | + if ($this->geos()) { |
|
224 | + if (is_array($geometry)) { |
|
225 | + $geom = $this->geos(); |
|
226 | + foreach ($geometry as $item) { |
|
227 | + $geom = $geom->union($item->geos()); |
|
228 | + } |
|
229 | + return geoPHP::geosToGeometry($geom); |
|
230 | + } |
|
231 | + else { |
|
232 | + return geoPHP::geosToGeometry($this->geos()->union($geometry->geos())); |
|
233 | + } |
|
234 | + } |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | public function simplify($tolerance, $preserveTopology = FALSE) { |
238 | - if ($this->geos()) { |
|
239 | - return geoPHP::geosToGeometry($this->geos()->simplify($tolerance, $preserveTopology)); |
|
240 | - } |
|
238 | + if ($this->geos()) { |
|
239 | + return geoPHP::geosToGeometry($this->geos()->simplify($tolerance, $preserveTopology)); |
|
240 | + } |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | public function disjoint(Geometry $geometry) { |
244 | - if ($this->geos()) { |
|
245 | - return $this->geos()->disjoint($geometry->geos()); |
|
246 | - } |
|
244 | + if ($this->geos()) { |
|
245 | + return $this->geos()->disjoint($geometry->geos()); |
|
246 | + } |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | public function touches(Geometry $geometry) { |
250 | - if ($this->geos()) { |
|
251 | - return $this->geos()->touches($geometry->geos()); |
|
252 | - } |
|
250 | + if ($this->geos()) { |
|
251 | + return $this->geos()->touches($geometry->geos()); |
|
252 | + } |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | public function intersects(Geometry $geometry) { |
256 | - if ($this->geos()) { |
|
257 | - return $this->geos()->intersects($geometry->geos()); |
|
258 | - } |
|
256 | + if ($this->geos()) { |
|
257 | + return $this->geos()->intersects($geometry->geos()); |
|
258 | + } |
|
259 | 259 | } |
260 | 260 | |
261 | 261 | public function crosses(Geometry $geometry) { |
262 | - if ($this->geos()) { |
|
263 | - return $this->geos()->crosses($geometry->geos()); |
|
264 | - } |
|
262 | + if ($this->geos()) { |
|
263 | + return $this->geos()->crosses($geometry->geos()); |
|
264 | + } |
|
265 | 265 | } |
266 | 266 | |
267 | 267 | public function within(Geometry $geometry) { |
268 | - if ($this->geos()) { |
|
269 | - return $this->geos()->within($geometry->geos()); |
|
270 | - } |
|
268 | + if ($this->geos()) { |
|
269 | + return $this->geos()->within($geometry->geos()); |
|
270 | + } |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | public function contains(Geometry $geometry) { |
274 | - if ($this->geos()) { |
|
275 | - return $this->geos()->contains($geometry->geos()); |
|
276 | - } |
|
274 | + if ($this->geos()) { |
|
275 | + return $this->geos()->contains($geometry->geos()); |
|
276 | + } |
|
277 | 277 | } |
278 | 278 | |
279 | 279 | public function overlaps(Geometry $geometry) { |
280 | - if ($this->geos()) { |
|
281 | - return $this->geos()->overlaps($geometry->geos()); |
|
282 | - } |
|
280 | + if ($this->geos()) { |
|
281 | + return $this->geos()->overlaps($geometry->geos()); |
|
282 | + } |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | public function covers(Geometry $geometry) { |
286 | - if ($this->geos()) { |
|
287 | - return $this->geos()->covers($geometry->geos()); |
|
288 | - } |
|
286 | + if ($this->geos()) { |
|
287 | + return $this->geos()->covers($geometry->geos()); |
|
288 | + } |
|
289 | 289 | } |
290 | 290 | |
291 | 291 | public function coveredBy(Geometry $geometry) { |
292 | - if ($this->geos()) { |
|
293 | - return $this->geos()->coveredBy($geometry->geos()); |
|
294 | - } |
|
292 | + if ($this->geos()) { |
|
293 | + return $this->geos()->coveredBy($geometry->geos()); |
|
294 | + } |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | public function distance(Geometry $geometry) { |
298 | - if ($this->geos()) { |
|
299 | - return $this->geos()->distance($geometry->geos()); |
|
300 | - } |
|
298 | + if ($this->geos()) { |
|
299 | + return $this->geos()->distance($geometry->geos()); |
|
300 | + } |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | public function hausdorffDistance(Geometry $geometry) { |
304 | - if ($this->geos()) { |
|
305 | - return $this->geos()->hausdorffDistance($geometry->geos()); |
|
306 | - } |
|
304 | + if ($this->geos()) { |
|
305 | + return $this->geos()->hausdorffDistance($geometry->geos()); |
|
306 | + } |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | public function project(Geometry $point, $normalized = NULL) { |
310 | - if ($this->geos()) { |
|
311 | - return $this->geos()->project($point->geos(), $normalized); |
|
312 | - } |
|
310 | + if ($this->geos()) { |
|
311 | + return $this->geos()->project($point->geos(), $normalized); |
|
312 | + } |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | // Public - Placeholders |
316 | 316 | // --------------------- |
317 | 317 | public function hasZ() { |
318 | - // geoPHP does not support Z values at the moment |
|
319 | - return FALSE; |
|
318 | + // geoPHP does not support Z values at the moment |
|
319 | + return FALSE; |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | public function is3D() { |
323 | - // geoPHP does not support 3D geometries at the moment |
|
324 | - return FALSE; |
|
323 | + // geoPHP does not support 3D geometries at the moment |
|
324 | + return FALSE; |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | public function isMeasured() { |
328 | - // geoPHP does not yet support M values |
|
329 | - return FALSE; |
|
328 | + // geoPHP does not yet support M values |
|
329 | + return FALSE; |
|
330 | 330 | } |
331 | 331 | |
332 | 332 | public function coordinateDimension() { |
333 | - // geoPHP only supports 2-dimentional space |
|
334 | - return 2; |
|
333 | + // geoPHP only supports 2-dimentional space |
|
334 | + return 2; |
|
335 | 335 | } |
336 | 336 | |
337 | 337 | public function z() { |
338 | - // geoPHP only supports 2-dimentional space |
|
339 | - return NULL; |
|
338 | + // geoPHP only supports 2-dimentional space |
|
339 | + return NULL; |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | public function m() { |
343 | - // geoPHP only supports 2-dimentional space |
|
344 | - return NULL; |
|
343 | + // geoPHP only supports 2-dimentional space |
|
344 | + return NULL; |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | } |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | abstract public function geometryN($n); |
22 | 22 | abstract public function startPoint(); |
23 | 23 | abstract public function endPoint(); |
24 | - abstract public function isRing(); // Mssing dependancy |
|
25 | - abstract public function isClosed(); // Missing dependancy |
|
24 | + abstract public function isRing(); // Mssing dependancy |
|
25 | + abstract public function isClosed(); // Missing dependancy |
|
26 | 26 | abstract public function numPoints(); |
27 | 27 | abstract public function pointN($n); |
28 | 28 | abstract public function exteriorRing(); |
@@ -64,12 +64,12 @@ discard block |
||
64 | 64 | } |
65 | 65 | |
66 | 66 | $bbox = $this->getBBox(); |
67 | - $points = array ( |
|
68 | - new Point($bbox['maxx'],$bbox['miny']), |
|
69 | - new Point($bbox['maxx'],$bbox['maxy']), |
|
70 | - new Point($bbox['minx'],$bbox['maxy']), |
|
71 | - new Point($bbox['minx'],$bbox['miny']), |
|
72 | - new Point($bbox['maxx'],$bbox['miny']), |
|
67 | + $points = array( |
|
68 | + new Point($bbox['maxx'], $bbox['miny']), |
|
69 | + new Point($bbox['maxx'], $bbox['maxy']), |
|
70 | + new Point($bbox['minx'], $bbox['maxy']), |
|
71 | + new Point($bbox['minx'], $bbox['miny']), |
|
72 | + new Point($bbox['maxx'], $bbox['miny']), |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | $outer_boundary = new LineString($points); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | // It hasn't been set yet, generate it |
148 | 148 | if (geoPHP::geosInstalled()) { |
149 | 149 | $reader = new GEOSWKBReader(); |
150 | - $this->geos = $reader->readHEX($this->out('wkb',TRUE)); |
|
150 | + $this->geos = $reader->readHEX($this->out('wkb', TRUE)); |
|
151 | 151 | } |
152 | 152 | else { |
153 | 153 | $this->geos = FALSE; |
@@ -57,7 +57,9 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | public function envelope() { |
60 | - if ($this->isEmpty()) return new Polygon(); |
|
60 | + if ($this->isEmpty()) { |
|
61 | + return new Polygon(); |
|
62 | + } |
|
61 | 63 | |
62 | 64 | if ($this->geos()) { |
63 | 65 | return geoPHP::geosToGeometry($this->geos()->envelope()); |
@@ -148,8 +150,7 @@ discard block |
||
148 | 150 | if (geoPHP::geosInstalled()) { |
149 | 151 | $reader = new GEOSWKBReader(); |
150 | 152 | $this->geos = $reader->readHEX($this->out('wkb',TRUE)); |
151 | - } |
|
152 | - else { |
|
153 | + } else { |
|
153 | 154 | $this->geos = FALSE; |
154 | 155 | } |
155 | 156 | return $this->geos; |
@@ -175,8 +176,7 @@ discard block |
||
175 | 176 | if ($this->geos()) { |
176 | 177 | if ($pattern) { |
177 | 178 | return $this->geos()->relate($geometry->geos(), $pattern); |
178 | - } |
|
179 | - else { |
|
179 | + } else { |
|
180 | 180 | return $this->geos()->relate($geometry->geos()); |
181 | 181 | } |
182 | 182 | } |
@@ -227,8 +227,7 @@ discard block |
||
227 | 227 | $geom = $geom->union($item->geos()); |
228 | 228 | } |
229 | 229 | return geoPHP::geosToGeometry($geom); |
230 | - } |
|
231 | - else { |
|
230 | + } else { |
|
232 | 231 | return geoPHP::geosToGeometry($this->geos()->union($geometry->geos())); |
233 | 232 | } |
234 | 233 | } |
@@ -3,15 +3,15 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
8 | 8 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
9 | 9 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
10 | 10 | |
11 | 11 | |
12 | 12 | if (!empty($spotter_array)) |
13 | 13 | { |
14 | - $title = sprintf(_("Most Common Routes from aircraft with registration %s"),$registration); |
|
14 | + $title = sprintf(_("Most Common Routes from aircraft with registration %s"), $registration); |
|
15 | 15 | |
16 | 16 | require_once('header.php'); |
17 | 17 | print '<div class="info column">'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('registration-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Routes").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows the most common routes of aircraft with registration <strong>%s</strong>."),$registration).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows the most common routes of aircraft with registration <strong>%s</strong>."), $registration).'</p>'; |
|
28 | 28 | |
29 | 29 | $route_array = $Spotter->countAllRoutesByRegistration($registration); |
30 | 30 | if (!empty($route_array)) |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | print '</thead>'; |
41 | 41 | print '<tbody>'; |
42 | 42 | $i = 1; |
43 | - foreach($route_array as $route_item) |
|
43 | + foreach ($route_array as $route_item) |
|
44 | 44 | { |
45 | 45 | print '<tr>'; |
46 | 46 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,7 +8,9 @@ |
||
8 | 8 | $registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING); |
9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | -} else $spotter_array = array(); |
|
11 | +} else { |
|
12 | + $spotter_array = array(); |
|
13 | +} |
|
12 | 14 | |
13 | 15 | if (!empty($spotter_array)) |
14 | 16 | { |
@@ -3,16 +3,16 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | 7 | if (isset($_GET['registration'])) { |
8 | - $registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING); |
|
8 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | 11 | } else $spotter_array = array(); |
12 | 12 | |
13 | 13 | if (!empty($spotter_array)) |
14 | 14 | { |
15 | - $title = sprintf(_("Most Common Departure Airports by Country of aircraft with registration %s"),$registration); |
|
15 | + $title = sprintf(_("Most Common Departure Airports by Country of aircraft with registration %s"), $registration); |
|
16 | 16 | require_once('header.php'); |
17 | 17 | print '<div class="info column">'; |
18 | 18 | print '<h1>'.$registration.' - '.$aircraft_array[0]['aircraft_name'].' ('.$aircraft_array[0]['aircraft_icao'].')</h1>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('registration-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Departure Airports by Country").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights with aircraft registration <strong>%s</strong>."),$registration).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights with aircraft registration <strong>%s</strong>."), $registration).'</p>'; |
|
28 | 28 | $airport_country_array = $Spotter->countAllDepartureAirportCountriesByRegistration($registration); |
29 | 29 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
30 | 30 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
33 | 33 | print 'var series = ['; |
34 | 34 | $country_data = ''; |
35 | - foreach($airport_country_array as $airport_item) |
|
35 | + foreach ($airport_country_array as $airport_item) |
|
36 | 36 | { |
37 | 37 | $country_data .= '[ "'.$airport_item['departure_airport_country_iso3'].'",'.$airport_item['airport_departure_country_count'].'],'; |
38 | 38 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | print '</thead>'; |
81 | 81 | print '<tbody>'; |
82 | 82 | $i = 1; |
83 | - foreach($airport_country_array as $airport_item) |
|
83 | + foreach ($airport_country_array as $airport_item) |
|
84 | 84 | { |
85 | 85 | print '<tr>'; |
86 | 86 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -13,7 +13,7 @@ |
||
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
15 | 15 | $absolute_difference = 25; |
16 | - } else { |
|
16 | + } else { |
|
17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
18 | 18 | $limit_start = $limit_explode[0]; |
19 | 19 | $limit_end = $limit_explode[1]; |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | |
6 | -if (!isset($_GET['country'])){ |
|
6 | +if (!isset($_GET['country'])) { |
|
7 | 7 | header('Location: '.$globalURL.''); |
8 | 8 | } else { |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | //calculuation for the pagination |
11 | - if(!isset($_GET['limit'])) |
|
11 | + if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
15 | 15 | $absolute_difference = 25; |
16 | - } else { |
|
16 | + } else { |
|
17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
18 | 18 | $limit_start = $limit_explode[0]; |
19 | 19 | $limit_end = $limit_explode[1]; |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | $limit_previous_1 = $limit_start - $absolute_difference; |
28 | 28 | $limit_previous_2 = $limit_end - $absolute_difference; |
29 | 29 | |
30 | - $country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
|
30 | + $country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)))); |
|
31 | 31 | |
32 | 32 | $page_url = $globalURL.'/country/'.$_GET['country']; |
33 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
33 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
34 | 34 | if ($country == 'Na') { |
35 | 35 | $spotter_array = array(); |
36 | 36 | } else { |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | |
44 | 44 | if (!empty($spotter_array)) |
45 | 45 | { |
46 | - $title = sprintf(_("Detailed View for Airports & Airlines from %s"),$country); |
|
46 | + $title = sprintf(_("Detailed View for Airports & Airlines from %s"), $country); |
|
47 | 47 | |
48 | 48 | require_once('header.php'); |
49 | 49 | print '<div class="select-item">'; |
@@ -51,9 +51,9 @@ discard block |
||
51 | 51 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
52 | 52 | print '<option></option>'; |
53 | 53 | $all_countries = $Spotter->getAllCountries(); |
54 | - foreach($all_countries as $all_country) |
|
54 | + foreach ($all_countries as $all_country) |
|
55 | 55 | { |
56 | - if($country == $all_country['country']) |
|
56 | + if ($country == $all_country['country']) |
|
57 | 57 | { |
58 | 58 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
59 | 59 | } else { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if ($_GET['country'] != "NA") |
69 | 69 | { |
70 | 70 | print '<div class="info column">'; |
71 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
71 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
72 | 72 | print '</div>'; |
73 | 73 | } else { |
74 | 74 | 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>'; |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | |
77 | 77 | include('country-sub-menu.php'); |
78 | 78 | print '<div class="table column">'; |
79 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure & arrival) OR airlines from <strong>%s</strong>."),$country).'</p>'; |
|
79 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure & arrival) OR airlines from <strong>%s</strong>."), $country).'</p>'; |
|
80 | 80 | |
81 | 81 | include('table-output.php'); |
82 | 82 | print '<div class="pagination">'; |
@@ -11,12 +11,12 @@ |
||
11 | 11 | //checks to see if FlightAware import is set |
12 | 12 | if ($globalFlightAware == TRUE) |
13 | 13 | { |
14 | - $SpotterLive = new SpotterLive(); |
|
15 | - $Spotter = new Spotter(); |
|
16 | - //deletes the spotter LIVE data |
|
17 | - $SpotterLive->deleteLiveSpotterData(); |
|
14 | + $SpotterLive = new SpotterLive(); |
|
15 | + $Spotter = new Spotter(); |
|
16 | + //deletes the spotter LIVE data |
|
17 | + $SpotterLive->deleteLiveSpotterData(); |
|
18 | 18 | |
19 | - //imports the new data from FlightAware |
|
20 | - $Spotter->importFromFlightAware(); |
|
19 | + //imports the new data from FlightAware |
|
20 | + $Spotter->importFromFlightAware(); |
|
21 | 21 | } |
22 | 22 | ?> |
23 | 23 | \ No newline at end of file |
@@ -5,8 +5,8 @@ |
||
5 | 5 | */ |
6 | 6 | require_once(dirname(__FILE__).'/../require/settings.php'); |
7 | 7 | if ($globalInstalled) { |
8 | - echo '$globalInstalled must be set to FALSE in require/settings.php'; |
|
9 | - exit; |
|
8 | + echo '$globalInstalled must be set to FALSE in require/settings.php'; |
|
9 | + exit; |
|
10 | 10 | } |
11 | 11 | |
12 | 12 | require_once('../require/class.Connection.php'); |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
12 | 12 | $schema = new Connection(); |
13 | 13 | if ($schema->latest() === false) { |
14 | - echo "You MUST update to latest schema. Run install/index.php"; |
|
15 | - exit(); |
|
14 | + echo "You MUST update to latest schema. Run install/index.php"; |
|
15 | + exit(); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $debug = true; |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | date_default_timezone_set('UTC'); |
22 | 22 | // signal handler - playing nice with sockets and dump1090 |
23 | 23 | pcntl_signal(SIGINT, function($signo) { |
24 | - global $sock; |
|
25 | - echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
26 | - socket_shutdown($sock, 0); |
|
27 | - socket_close($sock); |
|
28 | - die("Bye!\n"); |
|
24 | + global $sock; |
|
25 | + echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
26 | + socket_shutdown($sock, 0); |
|
27 | + socket_close($sock); |
|
28 | + die("Bye!\n"); |
|
29 | 29 | }); |
30 | 30 | pcntl_signal_dispatch(); |
31 | 31 | |
@@ -38,24 +38,24 @@ discard block |
||
38 | 38 | // Bind the source address |
39 | 39 | if( !socket_bind($sock, $globalACARSHost , $globalACARSPort) ) |
40 | 40 | { |
41 | - $errorcode = socket_last_error(); |
|
42 | - $errormsg = socket_strerror($errorcode); |
|
41 | + $errorcode = socket_last_error(); |
|
42 | + $errormsg = socket_strerror($errorcode); |
|
43 | 43 | |
44 | - die("Could not bind socket : [$errorcode] $errormsg \n"); |
|
44 | + die("Could not bind socket : [$errorcode] $errormsg \n"); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | echo "LISTEN UDP MODE \n\n"; |
48 | 48 | while(1) { |
49 | - $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port); |
|
50 | - |
|
51 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
52 | - pcntl_signal_dispatch(); |
|
53 | - $dataFound = false; |
|
54 | - // (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1 |
|
55 | - echo $buffer."\n"; |
|
56 | - $ACARS->add(trim($buffer)); |
|
57 | - socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
58 | - $ACARS->deleteLiveAcarsData(); |
|
49 | + $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port); |
|
50 | + |
|
51 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
52 | + pcntl_signal_dispatch(); |
|
53 | + $dataFound = false; |
|
54 | + // (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1 |
|
55 | + echo $buffer."\n"; |
|
56 | + $ACARS->add(trim($buffer)); |
|
57 | + socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
58 | + $ACARS->deleteLiveAcarsData(); |
|
59 | 59 | } |
60 | 60 | pcntl_exec($_,$argv); |
61 | 61 | ?> |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | |
18 | 18 | $debug = true; |
19 | 19 | |
20 | -$ACARS=new ACARS(null,true); |
|
20 | +$ACARS = new ACARS(null, true); |
|
21 | 21 | date_default_timezone_set('UTC'); |
22 | 22 | // signal handler - playing nice with sockets and dump1090 |
23 | -pcntl_signal(SIGINT, function($signo) { |
|
23 | +pcntl_signal(SIGINT, function($signo) { |
|
24 | 24 | global $sock; |
25 | 25 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
26 | 26 | socket_shutdown($sock, 0); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $sock = socket_create(AF_INET, SOCK_DGRAM, 0) or die("Unable to create socket\n"); |
37 | 37 | |
38 | 38 | // Bind the source address |
39 | -if( !socket_bind($sock, $globalACARSHost , $globalACARSPort) ) |
|
39 | +if (!socket_bind($sock, $globalACARSHost, $globalACARSPort)) |
|
40 | 40 | { |
41 | 41 | $errorcode = socket_last_error(); |
42 | 42 | $errormsg = socket_strerror($errorcode); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | echo "LISTEN UDP MODE \n\n"; |
48 | -while(1) { |
|
48 | +while (1) { |
|
49 | 49 | $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port); |
50 | 50 | |
51 | 51 | // lets play nice and handle signals such as ctrl-c/kill properly |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | // (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1 |
55 | 55 | echo $buffer."\n"; |
56 | 56 | $ACARS->add(trim($buffer)); |
57 | - socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
57 | + socket_sendto($sock, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
58 | 58 | $ACARS->deleteLiveAcarsData(); |
59 | 59 | } |
60 | -pcntl_exec($_,$argv); |
|
60 | +pcntl_exec($_, $argv); |
|
61 | 61 | ?> |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | $page_url = $globalURL.'/acars-archive'; |
10 | 10 | |
11 | -if(!isset($_GET['limit'])) |
|
11 | +if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
@@ -36,8 +36,12 @@ |
||
36 | 36 | if (!empty($spotter_array)) { |
37 | 37 | include('table-output.php'); |
38 | 38 | print '<div class="pagination">'; |
39 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
40 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
39 | + if ($limit_previous_1 >= 0) { |
|
40 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
41 | + } |
|
42 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
43 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
44 | + } |
|
41 | 45 | print '</div>'; |
42 | 46 | } |
43 | 47 | print '</div>'; |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$country = filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING); |
|
8 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$country = filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING); |
|
8 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
9 | 9 | |
10 | 10 | $Spotter = new Spotter(); |
11 | -if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
11 | +if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
12 | 12 | else $spotter_array = array(); |
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Airlines by Country on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
16 | + $title = sprintf(_("Most Common Airlines by Country on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="select-item">'; |
19 | 19 | print '<form action="'.$globalURL.'/date" method="post">'; |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | print '</div>'; |
25 | 25 | |
26 | 26 | print '<div class="info column">'; |
27 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
27 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
28 | 28 | print '</div>'; |
29 | 29 | |
30 | 30 | include('date-sub-menu.php'); |
31 | 31 | print '<div class="column">'; |
32 | 32 | print '<h2>'._("Most Common Airlines by Country").'</h2>'; |
33 | - print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
33 | + print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
34 | 34 | |
35 | 35 | $airline_array = $Spotter->countAllAirlineCountriesByDate($date); |
36 | 36 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | var data = google.visualization.arrayToDataTable([ |
43 | 43 | ["'._("Country").'", "'._("# of times").'"], '; |
44 | 44 | $country_data = ''; |
45 | - foreach($airline_array as $airline_item) |
|
45 | + foreach ($airline_array as $airline_item) |
|
46 | 46 | { |
47 | 47 | $country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],'; |
48 | 48 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | print '</thead>'; |
77 | 77 | print '<tbody>'; |
78 | 78 | $i = 1; |
79 | - foreach($airline_array as $airline_item) |
|
79 | + foreach ($airline_array as $airline_item) |
|
80 | 80 | { |
81 | 81 | print '<tr>'; |
82 | 82 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,8 +8,11 @@ |
||
8 | 8 | $date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
9 | 9 | |
10 | 10 | $Spotter = new Spotter(); |
11 | -if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
12 | -else $spotter_array = array(); |
|
11 | +if (isset($_GET['date'])) { |
|
12 | + $spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
13 | +} else { |
|
14 | + $spotter_array = array(); |
|
15 | +} |
|
13 | 16 | |
14 | 17 | if (!empty($spotter_array)) |
15 | 18 | { |