@@ -94,7 +94,9 @@ discard block |
||
94 | 94 | $line_length = unpack('L',fread($mem,4)); |
95 | 95 | |
96 | 96 | // Return an empty linestring if there is no line-length |
97 | - if (!$line_length[1]) return new LineString(); |
|
97 | + if (!$line_length[1]) { |
|
98 | + return new LineString(); |
|
99 | + } |
|
98 | 100 | |
99 | 101 | // Read the nubmer of points x2 (each point is two coords) into decimal-floats |
100 | 102 | $line_coords = unpack('d*', fread($mem,$line_length[1]*$this->dimension*8)); |
@@ -190,8 +192,7 @@ discard block |
||
190 | 192 | if ($write_as_hex) { |
191 | 193 | $unpacked = unpack('H*',$wkb); |
192 | 194 | return $unpacked[1]; |
193 | - } |
|
194 | - else { |
|
195 | + } else { |
|
195 | 196 | return $wkb; |
196 | 197 | } |
197 | 198 | } |
@@ -89,8 +89,7 @@ discard block |
||
89 | 89 | } |
90 | 90 | } |
91 | 91 | } |
92 | - } |
|
93 | - else { |
|
92 | + } else { |
|
94 | 93 | // The document does not have a placemark, try to create a valid geometry from the root element |
95 | 94 | $node_name = $this->xmlobj->documentElement->nodeName == 'multigeometry' ? 'geometrycollection' : $this->xmlobj->documentElement->nodeName; |
96 | 95 | if (array_key_exists($node_name, $geom_types)) { |
@@ -220,7 +219,9 @@ discard block |
||
220 | 219 | $str .= '<'.$this->nss.'coordinates>'; |
221 | 220 | $i=0; |
222 | 221 | foreach ($geom->getComponents() as $comp) { |
223 | - if ($i != 0) $str .= ' '; |
|
222 | + if ($i != 0) { |
|
223 | + $str .= ' '; |
|
224 | + } |
|
224 | 225 | $str .= $comp->getX() .','. $comp->getY(); |
225 | 226 | $i++; |
226 | 227 | } |
@@ -9,7 +9,9 @@ discard block |
||
9 | 9 | protected $geom_type = 'Polygon'; |
10 | 10 | |
11 | 11 | public function area($exterior_only = FALSE, $signed = FALSE) { |
12 | - if ($this->isEmpty()) return 0; |
|
12 | + if ($this->isEmpty()) { |
|
13 | + return 0; |
|
14 | + } |
|
13 | 15 | |
14 | 16 | if ($this->geos() && $exterior_only == FALSE) { |
15 | 17 | return $this->geos()->area(); |
@@ -19,15 +21,20 @@ discard block |
||
19 | 21 | $pts = $exterior_ring->getComponents(); |
20 | 22 | |
21 | 23 | $c = count($pts); |
22 | - if((int)$c == '0') return NULL; |
|
24 | + if((int)$c == '0') { |
|
25 | + return NULL; |
|
26 | + } |
|
23 | 27 | $a = '0'; |
24 | 28 | foreach($pts as $k => $p){ |
25 | 29 | $j = ($k + 1) % $c; |
26 | 30 | $a = $a + ($p->getX() * $pts[$j]->getY()) - ($p->getY() * $pts[$j]->getX()); |
27 | 31 | } |
28 | 32 | |
29 | - if ($signed) $area = ($a / 2); |
|
30 | - else $area = abs(($a / 2)); |
|
33 | + if ($signed) { |
|
34 | + $area = ($a / 2); |
|
35 | + } else { |
|
36 | + $area = abs(($a / 2)); |
|
37 | + } |
|
31 | 38 | |
32 | 39 | if ($exterior_only == TRUE) { |
33 | 40 | return $area; |
@@ -42,7 +49,9 @@ discard block |
||
42 | 49 | } |
43 | 50 | |
44 | 51 | public function centroid() { |
45 | - if ($this->isEmpty()) return NULL; |
|
52 | + if ($this->isEmpty()) { |
|
53 | + return NULL; |
|
54 | + } |
|
46 | 55 | |
47 | 56 | if ($this->geos()) { |
48 | 57 | return geoPHP::geosToGeometry($this->geos()->centroid()); |
@@ -52,7 +61,9 @@ discard block |
||
52 | 61 | $pts = $exterior_ring->getComponents(); |
53 | 62 | |
54 | 63 | $c = count($pts); |
55 | - if((int)$c == '0') return NULL; |
|
64 | + if((int)$c == '0') { |
|
65 | + return NULL; |
|
66 | + } |
|
56 | 67 | $cn = array('x' => '0', 'y' => '0'); |
57 | 68 | $a = $this->area(TRUE, TRUE); |
58 | 69 | |
@@ -98,12 +109,16 @@ discard block |
||
98 | 109 | } |
99 | 110 | |
100 | 111 | public function exteriorRing() { |
101 | - if ($this->isEmpty()) return new LineString(); |
|
112 | + if ($this->isEmpty()) { |
|
113 | + return new LineString(); |
|
114 | + } |
|
102 | 115 | return $this->components[0]; |
103 | 116 | } |
104 | 117 | |
105 | 118 | public function numInteriorRings() { |
106 | - if ($this->isEmpty()) return 0; |
|
119 | + if ($this->isEmpty()) { |
|
120 | + return 0; |
|
121 | + } |
|
107 | 122 | return $this->numGeometries()-1; |
108 | 123 | } |
109 | 124 | |
@@ -112,7 +127,9 @@ discard block |
||
112 | 127 | } |
113 | 128 | |
114 | 129 | public function dimension() { |
115 | - if ($this->isEmpty()) return 0; |
|
130 | + if ($this->isEmpty()) { |
|
131 | + return 0; |
|
132 | + } |
|
116 | 133 | return 2; |
117 | 134 | } |
118 | 135 | |
@@ -187,8 +204,7 @@ discard block |
||
187 | 204 | // If the number of edges we passed through is even, then it's in the polygon. |
188 | 205 | if ($intersections % 2 != 0) { |
189 | 206 | return TRUE; |
190 | - } |
|
191 | - else { |
|
207 | + } else { |
|
192 | 208 | return FALSE; |
193 | 209 | } |
194 | 210 | } |
@@ -71,8 +71,9 @@ |
||
71 | 71 | public function z() { |
72 | 72 | if ($this->dimention == 3) { |
73 | 73 | return $this->coords[2]; |
74 | + } else { |
|
75 | + return NULL; |
|
74 | 76 | } |
75 | - else return NULL; |
|
76 | 77 | } |
77 | 78 | |
78 | 79 | // A point's centroid is itself |
@@ -24,8 +24,7 @@ discard block |
||
24 | 24 | foreach ($components as $component) { |
25 | 25 | if ($component instanceof Geometry) { |
26 | 26 | $this->components[] = $component; |
27 | - } |
|
28 | - else { |
|
27 | + } else { |
|
29 | 28 | throw new Exception("Cannot create a collection with non-geometries"); |
30 | 29 | } |
31 | 30 | } |
@@ -41,7 +40,9 @@ discard block |
||
41 | 40 | } |
42 | 41 | |
43 | 42 | public function centroid() { |
44 | - if ($this->isEmpty()) return NULL; |
|
43 | + if ($this->isEmpty()) { |
|
44 | + return NULL; |
|
45 | + } |
|
45 | 46 | |
46 | 47 | if ($this->geos()) { |
47 | 48 | $geos_centroid = $this->geos()->centroid(); |
@@ -59,7 +60,9 @@ discard block |
||
59 | 60 | } |
60 | 61 | |
61 | 62 | public function getBBox() { |
62 | - if ($this->isEmpty()) return NULL; |
|
63 | + if ($this->isEmpty()) { |
|
64 | + return NULL; |
|
65 | + } |
|
63 | 66 | |
64 | 67 | if ($this->geos()) { |
65 | 68 | $envelope = $this->geos()->envelope(); |
@@ -127,7 +130,9 @@ discard block |
||
127 | 130 | |
128 | 131 | // By default, the boundary of a collection is the boundary of it's components |
129 | 132 | public function boundary() { |
130 | - if ($this->isEmpty()) return new LineString(); |
|
133 | + if ($this->isEmpty()) { |
|
134 | + return new LineString(); |
|
135 | + } |
|
131 | 136 | |
132 | 137 | if ($this->geos()) { |
133 | 138 | return $this->geos()->boundary(); |
@@ -149,8 +154,7 @@ discard block |
||
149 | 154 | $n = intval($n); |
150 | 155 | if (array_key_exists($n-1, $this->components)) { |
151 | 156 | return $this->components[$n-1]; |
152 | - } |
|
153 | - else { |
|
157 | + } else { |
|
154 | 158 | return NULL; |
155 | 159 | } |
156 | 160 | } |
@@ -193,10 +197,11 @@ discard block |
||
193 | 197 | public function isEmpty() { |
194 | 198 | if (!count($this->components)) { |
195 | 199 | return TRUE; |
196 | - } |
|
197 | - else { |
|
200 | + } else { |
|
198 | 201 | foreach ($this->components as $component) { |
199 | - if (!$component->isEmpty()) return FALSE; |
|
202 | + if (!$component->isEmpty()) { |
|
203 | + return FALSE; |
|
204 | + } |
|
200 | 205 | } |
201 | 206 | return TRUE; |
202 | 207 | } |
@@ -263,7 +268,9 @@ discard block |
||
263 | 268 | |
264 | 269 | // A collection is simple if all it's components are simple |
265 | 270 | foreach ($this->components as $component) { |
266 | - if (!$component->isSimple()) return FALSE; |
|
271 | + if (!$component->isSimple()) { |
|
272 | + return FALSE; |
|
273 | + } |
|
267 | 274 | } |
268 | 275 | |
269 | 276 | return TRUE; |
@@ -54,7 +54,9 @@ |
||
54 | 54 | } |
55 | 55 | |
56 | 56 | public function dimension() { |
57 | - if ($this->isEmpty()) return 0; |
|
57 | + if ($this->isEmpty()) { |
|
58 | + return 0; |
|
59 | + } |
|
58 | 60 | return 1; |
59 | 61 | } |
60 | 62 |
@@ -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 | } |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | if (!$type) { |
53 | 53 | // If the user is trying to load a Geometry from a Geometry... Just pass it back |
54 | 54 | if (is_object($data)) { |
55 | - if ($data instanceOf Geometry) return $data; |
|
55 | + if ($data instanceOf Geometry) { |
|
56 | + return $data; |
|
57 | + } |
|
56 | 58 | } |
57 | 59 | |
58 | 60 | $detected = geoPHP::detectFormat($data); |
@@ -120,7 +122,9 @@ discard block |
||
120 | 122 | |
121 | 123 | static function geosInstalled($force = NULL) { |
122 | 124 | static $geos_installed = NULL; |
123 | - if ($force !== NULL) $geos_installed = $force; |
|
125 | + if ($force !== NULL) { |
|
126 | + $geos_installed = $force; |
|
127 | + } |
|
124 | 128 | if ($geos_installed !== NULL) { |
125 | 129 | return $geos_installed; |
126 | 130 | } |
@@ -148,8 +152,12 @@ discard block |
||
148 | 152 | static function geometryReduce($geometry) { |
149 | 153 | // If it's an array of one, then just parse the one |
150 | 154 | if (is_array($geometry)) { |
151 | - if (empty($geometry)) return FALSE; |
|
152 | - if (count($geometry) == 1) return geoPHP::geometryReduce(array_shift($geometry)); |
|
155 | + if (empty($geometry)) { |
|
156 | + return FALSE; |
|
157 | + } |
|
158 | + if (count($geometry) == 1) { |
|
159 | + return geoPHP::geometryReduce(array_shift($geometry)); |
|
160 | + } |
|
153 | 161 | } |
154 | 162 | |
155 | 163 | // If the geometry cannot even theoretically be reduced more, then pass it back |
@@ -168,8 +176,7 @@ discard block |
||
168 | 176 | $components = $geometry->getComponents(); |
169 | 177 | if (count($components) == 1) { |
170 | 178 | return $components[0]; |
171 | - } |
|
172 | - else { |
|
179 | + } else { |
|
173 | 180 | return $geometry; |
174 | 181 | } |
175 | 182 | } |
@@ -192,8 +199,7 @@ discard block |
||
192 | 199 | $geometries[] = $component; |
193 | 200 | $geom_types[] = $component->geometryType(); |
194 | 201 | } |
195 | - } |
|
196 | - else { |
|
202 | + } else { |
|
197 | 203 | $geometries[] = $item; |
198 | 204 | $geom_types[] = $item->geometryType(); |
199 | 205 | } |
@@ -209,13 +215,11 @@ discard block |
||
209 | 215 | if (count($geom_types) == 1) { |
210 | 216 | if (count($geometries) == 1) { |
211 | 217 | return $geometries[0]; |
212 | - } |
|
213 | - else { |
|
218 | + } else { |
|
214 | 219 | $class = 'Multi'.$geom_types[0]; |
215 | 220 | return new $class($geometries); |
216 | 221 | } |
217 | - } |
|
218 | - else { |
|
222 | + } else { |
|
219 | 223 | return new GeometryCollection($geometries); |
220 | 224 | } |
221 | 225 | } |
@@ -230,7 +234,9 @@ discard block |
||
230 | 234 | $bytes = unpack("c*", fread($mem, 11)); |
231 | 235 | |
232 | 236 | // If bytes is empty, then we were passed empty input |
233 | - if (empty($bytes)) return FALSE; |
|
237 | + if (empty($bytes)) { |
|
238 | + return FALSE; |
|
239 | + } |
|
234 | 240 | |
235 | 241 | // First char is a tab, space or carriage-return. trim it and try again |
236 | 242 | if ($bytes[1] == 9 || $bytes[1] == 10 || $bytes[1] == 32) { |
@@ -240,8 +246,11 @@ discard block |
||
240 | 246 | // Detect WKB or EWKB -- first byte is 1 (little endian indicator) |
241 | 247 | if ($bytes[1] == 1) { |
242 | 248 | // If SRID byte is TRUE (1), it's EWKB |
243 | - if ($bytes[5]) return 'ewkb'; |
|
244 | - else return 'wkb'; |
|
249 | + if ($bytes[5]) { |
|
250 | + return 'ewkb'; |
|
251 | + } else { |
|
252 | + return 'wkb'; |
|
253 | + } |
|
245 | 254 | } |
246 | 255 | |
247 | 256 | // Detect HEX encoded WKB or EWKB (PostGIS format) -- first byte is 48, second byte is 49 (hex '01' => first-byte = 1) |
@@ -274,12 +283,24 @@ discard block |
||
274 | 283 | if ($bytes[1] == 60) { |
275 | 284 | // grab the first 256 characters |
276 | 285 | $string = substr($input, 0, 256); |
277 | - if (strpos($string, '<kml') !== FALSE) return 'kml'; |
|
278 | - if (strpos($string, '<coordinate') !== FALSE) return 'kml'; |
|
279 | - if (strpos($string, '<gpx') !== FALSE) return 'gpx'; |
|
280 | - if (strpos($string, '<georss') !== FALSE) return 'georss'; |
|
281 | - if (strpos($string, '<rss') !== FALSE) return 'georss'; |
|
282 | - if (strpos($string, '<feed') !== FALSE) return 'georss'; |
|
286 | + if (strpos($string, '<kml') !== FALSE) { |
|
287 | + return 'kml'; |
|
288 | + } |
|
289 | + if (strpos($string, '<coordinate') !== FALSE) { |
|
290 | + return 'kml'; |
|
291 | + } |
|
292 | + if (strpos($string, '<gpx') !== FALSE) { |
|
293 | + return 'gpx'; |
|
294 | + } |
|
295 | + if (strpos($string, '<georss') !== FALSE) { |
|
296 | + return 'georss'; |
|
297 | + } |
|
298 | + if (strpos($string, '<rss') !== FALSE) { |
|
299 | + return 'georss'; |
|
300 | + } |
|
301 | + if (strpos($string, '<feed') !== FALSE) { |
|
302 | + return 'georss'; |
|
303 | + } |
|
283 | 304 | } |
284 | 305 | |
285 | 306 | // We need an 8 byte string for geohash and unpacked WKB / WKT |
@@ -36,81 +36,128 @@ |
||
36 | 36 | $data['hex'] = trim($line['hex']); |
37 | 37 | if (preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
38 | 38 | $data['datetime'] = $line['datetime']; |
39 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
39 | + } else { |
|
40 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
41 | + } |
|
40 | 42 | if (!isset($line['aircraft_icao'])) { |
41 | 43 | $Spotter = new Spotter(); |
42 | 44 | $aircraft_icao = $Spotter->getAllAircraftType($data['hex']); |
43 | 45 | $Spotter->db = null; |
44 | 46 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
45 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
46 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
47 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
48 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
47 | + if ($line['aircraft_type'] == 'PARA_GLIDER') { |
|
48 | + $aircraft_icao = 'GLID'; |
|
49 | + } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') { |
|
50 | + $aircraft_icao = 'UHEL'; |
|
51 | + } elseif ($line['aircraft_type'] == 'TOW_PLANE') { |
|
52 | + $aircraft_icao = 'TOWPLANE'; |
|
53 | + } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') { |
|
54 | + $aircraft_icao = 'POWAIRC'; |
|
55 | + } |
|
49 | 56 | } |
50 | 57 | $data['aircraft_icao'] = $aircraft_icao; |
51 | - } else $data['aircraft_icao'] = $line['aircraft_icao']; |
|
58 | + } else { |
|
59 | + $data['aircraft_icao'] = $line['aircraft_icao']; |
|
60 | + } |
|
52 | 61 | //if ($globalDebug) echo "*********** New aircraft hex : ".$data['hex']." ***********\n"; |
53 | 62 | } |
54 | 63 | if (isset($line['registration']) && $line['registration'] != '') { |
55 | 64 | $data['registration'] = $line['registration']; |
56 | - } else $data['registration'] = null; |
|
65 | + } else { |
|
66 | + $data['registration'] = null; |
|
67 | + } |
|
57 | 68 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
58 | 69 | $data['waypoints'] = $line['waypoints']; |
59 | - } else $data['waypoints'] = null; |
|
70 | + } else { |
|
71 | + $data['waypoints'] = null; |
|
72 | + } |
|
60 | 73 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
61 | 74 | $data['ident'] = trim($line['ident']); |
62 | - } else $data['ident'] = null; |
|
75 | + } else { |
|
76 | + $data['ident'] = null; |
|
77 | + } |
|
63 | 78 | |
64 | 79 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '') { |
65 | 80 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
66 | 81 | $data['latitude'] = $line['latitude']; |
67 | - } else $data['latitude'] = null; |
|
82 | + } else { |
|
83 | + $data['latitude'] = null; |
|
84 | + } |
|
68 | 85 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
69 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
86 | + if ($line['longitude'] > 180) { |
|
87 | + $line['longitude'] = $line['longitude'] - 360; |
|
88 | + } |
|
70 | 89 | $data['longitude'] = $line['longitude']; |
71 | - } else $data['longitude'] = null; |
|
90 | + } else { |
|
91 | + $data['longitude'] = null; |
|
92 | + } |
|
72 | 93 | } else { |
73 | 94 | $data['latitude'] = null; |
74 | 95 | $data['longitude'] = null; |
75 | 96 | } |
76 | 97 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
77 | 98 | $data['verticalrate'] = $line['verticalrate']; |
78 | - } else $data['verticalrate'] = null; |
|
99 | + } else { |
|
100 | + $data['verticalrate'] = null; |
|
101 | + } |
|
79 | 102 | if (isset($line['emergency']) && $line['emergency'] != '') { |
80 | 103 | $data['emergency'] = $line['emergency']; |
81 | - } else $data['emergency'] = null; |
|
104 | + } else { |
|
105 | + $data['emergency'] = null; |
|
106 | + } |
|
82 | 107 | if (isset($line['ground']) && $line['ground'] != '') { |
83 | 108 | $data['ground'] = $line['ground']; |
84 | - } else $data['ground'] = null; |
|
109 | + } else { |
|
110 | + $data['ground'] = null; |
|
111 | + } |
|
85 | 112 | if (isset($line['speed']) && $line['speed'] != '') { |
86 | 113 | $data['speed'] = round($line['speed']); |
87 | - } else $data['speed'] = null; |
|
114 | + } else { |
|
115 | + $data['speed'] = null; |
|
116 | + } |
|
88 | 117 | if (isset($line['squawk']) && $line['squawk'] != '') { |
89 | 118 | $data['squawk'] = $line['squawk']; |
90 | - } else $data['squawk'] = null; |
|
119 | + } else { |
|
120 | + $data['squawk'] = null; |
|
121 | + } |
|
91 | 122 | |
92 | 123 | if (isset($line['altitude']) && $line['altitude'] != '') { |
93 | 124 | $data['altitude'] = round($line['altitude']); |
94 | - } else $data['altitude'] = null; |
|
125 | + } else { |
|
126 | + $data['altitude'] = null; |
|
127 | + } |
|
95 | 128 | if (isset($line['heading']) && $line['heading'] != '') { |
96 | 129 | $data['heading'] = round($line['heading']); |
97 | - } else $data['heading'] = null; |
|
130 | + } else { |
|
131 | + $data['heading'] = null; |
|
132 | + } |
|
98 | 133 | if (isset($line['source_name']) && $line['source_name'] != '') { |
99 | 134 | $data['source_name'] = $line['source_name']; |
100 | - } else $data['source_name'] = null; |
|
135 | + } else { |
|
136 | + $data['source_name'] = null; |
|
137 | + } |
|
101 | 138 | if (isset($line['over_country']) && $line['over_country'] != '') { |
102 | 139 | $data['over_country'] = $line['over_country']; |
103 | - } else $data['over_country'] = null; |
|
140 | + } else { |
|
141 | + $data['over_country'] = null; |
|
142 | + } |
|
104 | 143 | if (isset($line['noarchive']) && $line['noarchive']) { |
105 | 144 | $data['noarchive'] = true; |
106 | - } else $data['noarchive'] = false; |
|
145 | + } else { |
|
146 | + $data['noarchive'] = false; |
|
147 | + } |
|
107 | 148 | $data['format_source'] = $line['format_source']; |
108 | - if (isset($line['id_source'])) $id_source = $line['id_source']; |
|
149 | + if (isset($line['id_source'])) { |
|
150 | + $id_source = $line['id_source']; |
|
151 | + } |
|
109 | 152 | if (isset($data['hex'])) { |
110 | 153 | echo '.'; |
111 | 154 | $id_user = $globalServerUserID; |
112 | - if ($id_user == NULL) $id_user = 1; |
|
113 | - if (!isset($id_source)) $id_source = 1; |
|
155 | + if ($id_user == NULL) { |
|
156 | + $id_user = 1; |
|
157 | + } |
|
158 | + if (!isset($id_source)) { |
|
159 | + $id_source = 1; |
|
160 | + } |
|
114 | 161 | $query = 'INSERT INTO spotter_temp (id_user,datetime,hex,ident,latitude,longitude,verticalrate,speed,squawk,altitude,heading,registration,aircraft_icao,waypoints,id_source,noarchive,format_source,source_name,over_country) VALUES (:id_user,:datetime,:hex,:ident,:latitude,:longitude,:verticalrate,:speed,:squawk,:altitude,:heading,:registration,:aircraft_icao,:waypoints,:id_source,:noarchive, :format_source, :source_name, :over_country)'; |
115 | 162 | $query_values = array(':id_user' => $id_user,':datetime' => $data['datetime'],':hex' => $data['hex'],':ident' => $data['ident'],':latitude' => $data['latitude'],':longitude' => $data['longitude'],':verticalrate' => $data['verticalrate'],':speed' => $data['speed'],':squawk' => $data['squawk'],':altitude' => $data['altitude'],':heading' => $data['heading'],':registration' => $data['registration'],':aircraft_icao' => $data['aircraft_icao'],':waypoints' => $data['waypoints'],':id_source' => $id_source,':noarchive' => $data['noarchive'], ':format_source' => $data['format_source'], ':source_name' => $data['source_name'],':over_country' => $data['over_country']); |
116 | 163 | try { |