Completed
Push — master ( abe207...090b05 )
by Yannick
07:26
created
require/libs/geoPHP/lib/geometry/Point.class.php 1 patch
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,8 +71,9 @@
 block discarded – undo
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
Please login to merge, or discard this patch.
require/libs/geoPHP/lib/geometry/Collection.class.php 1 patch
Braces   +18 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,8 +24,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
require/libs/geoPHP/lib/geometry/LineString.class.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
   }
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
 
Please login to merge, or discard this patch.
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.
search-json.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
         } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
                 $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
                 $sql_date = $end_date;
18
-        } else $sql_date = '';
19
-} else $sql_date = '';
18
+        } else {
19
+        	$sql_date = '';
20
+        }
21
+        } else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
         //for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
         } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
                 $start_altitude = $_GET['lowest_altitude'].",60000";
32 36
                 $sql_altitude = $start_altitude;
33
-        } else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+        } else {
38
+        	$sql_altitude = '';
39
+        }
40
+        } else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -49,7 +57,7 @@  discard block
 block discarded – undo
49 57
                 $limit_end = $_GET['number_results'];
50 58
                 $absolute_difference = $_GET['number_results'];
51 59
         }
52
-}  else {
60
+} else {
53 61
         $limit_explode = explode(",", $_GET['limit']);
54 62
         $limit_start = $limit_explode[0];
55 63
         $limit_end = $limit_explode[1];
@@ -67,8 +75,11 @@  discard block
 block discarded – undo
67 75
 
68 76
 header('Content-Type: application/json');
69 77
 
70
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
71
-else $sort = '';
78
+if (isset($_GET['sort'])) {
79
+	$sort = $_GET['sort'];
80
+} else {
81
+	$sort = '';
82
+}
72 83
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73 84
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
74 85
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
registration-statistics-departure-airport-country.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
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
 {
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.