Completed
Push — master ( e238bb...5f361c )
by Yannick
05:26
created
require/libs/geoPHP/lib/geometry/Geometry.class.php 1 patch
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,7 +57,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
require/libs/geoPHP/geoPHP.inc 1 patch
Braces   +42 added lines, -21 removed lines patch added patch discarded remove patch
@@ -52,7 +52,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
Please login to merge, or discard this patch.
require/class.SpotterServer.php 1 patch
Braces   +72 added lines, -25 removed lines patch added patch discarded remove patch
@@ -36,81 +36,128 @@
 block discarded – undo
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 {
Please login to merge, or discard this patch.
notam-geojson.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,9 @@
 block discarded – undo
54 54
 			$radius = $spotter_item['radius']*1852;
55 55
 			$output .= '"radiusm": "'.$radius.'",';
56 56
 			$output .= '"radiusnm": "'.$spotter_item['radius'].'",';
57
-			if ($radius > 25000) $radius = 25000;
57
+			if ($radius > 25000) {
58
+				$radius = 25000;
59
+			}
58 60
 			$output .= '"radius": "'.$radius.'"';
59 61
 		    $output .= '},';
60 62
 		    $output .= '"geometry": {';
Please login to merge, or discard this patch.
country-detailed.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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];
Please login to merge, or discard this patch.
airport-data.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@
 block discarded – undo
12 12
 		$METAR = new METAR();
13 13
 		$metar_info = $METAR->getMETAR($icao);
14 14
 		//print_r($metar_info);
15
-		if (isset($metar_info[0]['metar'])) $metar_parse = $METAR->parse($metar_info[0]['metar']);
15
+		if (isset($metar_info[0]['metar'])) {
16
+			$metar_parse = $METAR->parse($metar_info[0]['metar']);
17
+		}
16 18
 		//print_r($metar_parse);
17 19
 	}
18 20
 }
Please login to merge, or discard this patch.
archive-country.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,11 @@
 block discarded – undo
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
 {
Please login to merge, or discard this patch.
registration-statistics-departure-airport.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 $registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING);
7 7
 $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
8
-if (isset($_GET['sort'])) $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort);
9
-else $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1");
8
+if (isset($_GET['sort'])) {
9
+	$spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort);
10
+} else {
11
+	$spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1");
12
+}
10 13
 $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration);
11 14
 
12 15
 
Please login to merge, or discard this patch.
tools-metar.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@  discard block
 block discarded – undo
23 23
 print '<fieldset class="form-group">';
24 24
 print '<label for="metar_message">'._("METAR Message").'</label>';
25 25
 print '<textarea class="form-control" name="metar_message" id="metar_message" rows="5">';
26
-if ($message != '') print $message;
26
+if ($message != '') {
27
+	print $message;
28
+}
27 29
 print '</textarea>';
28 30
 print '</fieldset>';
29 31
 print '<button type="submit" class="btn btn-primary">Submit</button>';
@@ -59,7 +61,9 @@  discard block
 block discarded – undo
59 61
 		if (isset($metar_parse['cloud'])) {
60 62
 			print '<b>'._("Cloud:").'</b> ';
61 63
 			foreach ($metar_parse['cloud'] as $key => $cloud) {
62
-				if ($key > 0) print ' / ';
64
+				if ($key > 0) {
65
+					print ' / ';
66
+				}
63 67
 				print $cloud['type'].' at '.$cloud['level'].' m';
64 68
 			}
65 69
 			print " ";
Please login to merge, or discard this patch.