Completed
Push — master ( 73f088...7f17b6 )
by Yannick
07:13
created
require/libs/geoPHP/geoPHP.inc 1 patch
Indentation   +225 added lines, -225 removed lines patch added patch discarded remove patch
@@ -35,110 +35,110 @@  discard block
 block discarded – undo
35 35
 {
36 36
 
37 37
   static function version() {
38
-    return '1.1';
38
+	return '1.1';
39 39
   }
40 40
 
41 41
   // geoPHP::load($data, $type, $other_args);
42 42
   // if $data is an array, all passed in values will be combined into a single geometry
43 43
   static function load() {
44
-    $args = func_get_args();
44
+	$args = func_get_args();
45 45
 
46
-    $data = array_shift($args);
47
-    $type = array_shift($args);
46
+	$data = array_shift($args);
47
+	$type = array_shift($args);
48 48
 
49
-    $type_map = geoPHP::getAdapterMap();
49
+	$type_map = geoPHP::getAdapterMap();
50 50
 
51
-    // Auto-detect type if needed
52
-    if (!$type) {
53
-      // If the user is trying to load a Geometry from a Geometry... Just pass it back
54
-      if (is_object($data)) {
55
-        if ($data instanceOf Geometry) return $data;
56
-      }
51
+	// Auto-detect type if needed
52
+	if (!$type) {
53
+	  // If the user is trying to load a Geometry from a Geometry... Just pass it back
54
+	  if (is_object($data)) {
55
+		if ($data instanceOf Geometry) return $data;
56
+	  }
57 57
       
58
-      $detected = geoPHP::detectFormat($data);
59
-      if (!$detected) {
60
-        return FALSE;
61
-      }
58
+	  $detected = geoPHP::detectFormat($data);
59
+	  if (!$detected) {
60
+		return FALSE;
61
+	  }
62 62
       
63
-      $format = explode(':', $detected);
64
-      $type = array_shift($format);
65
-      $args = $format;
66
-    }
67
-
68
-    $processor_type = $type_map[$type];
69
-
70
-    if (!$processor_type) {
71
-      throw new exception('geoPHP could not find an adapter of type '.htmlentities($type));
72
-      exit;
73
-    }
74
-
75
-    $processor = new $processor_type();
76
-
77
-    // Data is not an array, just pass it normally
78
-    if (!is_array($data)) {
79
-      $result = call_user_func_array(array($processor, "read"), array_merge(array($data), $args));
80
-    }
81
-    // Data is an array, combine all passed in items into a single geomtetry
82
-    else {
83
-      $geoms = array();
84
-      foreach ($data as $item) {
85
-        $geoms[] = call_user_func_array(array($processor, "read"), array_merge(array($item), $args));
86
-      }
87
-      $result = geoPHP::geometryReduce($geoms);
88
-    }
89
-
90
-    return $result;
63
+	  $format = explode(':', $detected);
64
+	  $type = array_shift($format);
65
+	  $args = $format;
66
+	}
67
+
68
+	$processor_type = $type_map[$type];
69
+
70
+	if (!$processor_type) {
71
+	  throw new exception('geoPHP could not find an adapter of type '.htmlentities($type));
72
+	  exit;
73
+	}
74
+
75
+	$processor = new $processor_type();
76
+
77
+	// Data is not an array, just pass it normally
78
+	if (!is_array($data)) {
79
+	  $result = call_user_func_array(array($processor, "read"), array_merge(array($data), $args));
80
+	}
81
+	// Data is an array, combine all passed in items into a single geomtetry
82
+	else {
83
+	  $geoms = array();
84
+	  foreach ($data as $item) {
85
+		$geoms[] = call_user_func_array(array($processor, "read"), array_merge(array($item), $args));
86
+	  }
87
+	  $result = geoPHP::geometryReduce($geoms);
88
+	}
89
+
90
+	return $result;
91 91
   }
92 92
 
93 93
   static function getAdapterMap() {
94
-    return array (
95
-      'wkt' =>  'WKT',
96
-      'ewkt' => 'EWKT',
97
-      'wkb' =>  'WKB',
98
-      'ewkb' => 'EWKB',
99
-      'json' => 'GeoJSON',
100
-      'geojson' => 'GeoJSON',
101
-      'kml' =>  'KML',
102
-      'gpx' =>  'GPX',
103
-      'georss' => 'GeoRSS',
104
-      'google_geocode' => 'GoogleGeocode',
105
-      'geohash' => 'GeoHash',
106
-    );
94
+	return array (
95
+	  'wkt' =>  'WKT',
96
+	  'ewkt' => 'EWKT',
97
+	  'wkb' =>  'WKB',
98
+	  'ewkb' => 'EWKB',
99
+	  'json' => 'GeoJSON',
100
+	  'geojson' => 'GeoJSON',
101
+	  'kml' =>  'KML',
102
+	  'gpx' =>  'GPX',
103
+	  'georss' => 'GeoRSS',
104
+	  'google_geocode' => 'GoogleGeocode',
105
+	  'geohash' => 'GeoHash',
106
+	);
107 107
   }
108 108
 
109 109
   static function geometryList() {
110
-    return array(
111
-      'point' => 'Point',
112
-      'linestring' => 'LineString',
113
-      'polygon' => 'Polygon',
114
-      'multipoint' => 'MultiPoint',
115
-      'multilinestring' => 'MultiLineString',
116
-      'multipolygon' => 'MultiPolygon',
117
-      'geometrycollection' => 'GeometryCollection',
118
-    );
110
+	return array(
111
+	  'point' => 'Point',
112
+	  'linestring' => 'LineString',
113
+	  'polygon' => 'Polygon',
114
+	  'multipoint' => 'MultiPoint',
115
+	  'multilinestring' => 'MultiLineString',
116
+	  'multipolygon' => 'MultiPolygon',
117
+	  'geometrycollection' => 'GeometryCollection',
118
+	);
119 119
   }
120 120
 
121 121
   static function geosInstalled($force = NULL) {
122
-    static $geos_installed = NULL;
123
-    if ($force !== NULL) $geos_installed = $force;
124
-    if ($geos_installed !== NULL) {
125
-      return $geos_installed;
126
-    }
127
-    $geos_installed = class_exists('GEOSGeometry');
128
-    return $geos_installed;
122
+	static $geos_installed = NULL;
123
+	if ($force !== NULL) $geos_installed = $force;
124
+	if ($geos_installed !== NULL) {
125
+	  return $geos_installed;
126
+	}
127
+	$geos_installed = class_exists('GEOSGeometry');
128
+	return $geos_installed;
129 129
   }
130 130
 
131 131
   static function geosToGeometry($geos) {
132
-    if (!geoPHP::geosInstalled()) {
133
-      return NULL;
134
-    }
135
-    $wkb_writer = new GEOSWKBWriter();
136
-    $wkb = $wkb_writer->writeHEX($geos);
137
-    $geometry = geoPHP::load($wkb, 'wkb', TRUE);
138
-    if ($geometry) {
139
-      $geometry->setGeos($geos);
140
-      return $geometry;
141
-    }
132
+	if (!geoPHP::geosInstalled()) {
133
+	  return NULL;
134
+	}
135
+	$wkb_writer = new GEOSWKBWriter();
136
+	$wkb = $wkb_writer->writeHEX($geos);
137
+	$geometry = geoPHP::load($wkb, 'wkb', TRUE);
138
+	if ($geometry) {
139
+	  $geometry->setGeos($geos);
140
+	  return $geometry;
141
+	}
142 142
   }
143 143
 
144 144
   // Reduce a geometry, or an array of geometries, into their 'lowest' available common geometry.
@@ -146,155 +146,155 @@  discard block
 block discarded – undo
146 146
   // A multi-point containing a single point will return a point.
147 147
   // An array of geometries can be passed and they will be compiled into a single geometry
148 148
   static function geometryReduce($geometry) {
149
-    // If it's an array of one, then just parse the one
150
-    if (is_array($geometry)) {
151
-      if (empty($geometry)) return FALSE;
152
-      if (count($geometry) == 1) return geoPHP::geometryReduce(array_shift($geometry));
153
-    }
154
-
155
-    // If the geometry cannot even theoretically be reduced more, then pass it back
156
-    if (gettype($geometry) == 'object') {
157
-      $passbacks = array('Point','LineString','Polygon');
158
-      if (in_array($geometry->geometryType(),$passbacks)) {
159
-        return $geometry;
160
-      }
161
-    }
162
-
163
-    // If it is a mutlti-geometry, check to see if it just has one member
164
-    // If it does, then pass the member, if not, then just pass back the geometry
165
-    if (gettype($geometry) == 'object') {
166
-      $simple_collections = array('MultiPoint','MultiLineString','MultiPolygon');
167
-      if (in_array(get_class($geometry),$passbacks)) {
168
-        $components = $geometry->getComponents();
169
-        if (count($components) == 1) {
170
-          return $components[0];
171
-        }
172
-        else {
173
-          return $geometry;
174
-        }
175
-      }
176
-    }
177
-
178
-    // So now we either have an array of geometries, a GeometryCollection, or an array of GeometryCollections
179
-    if (!is_array($geometry)) {
180
-      $geometry = array($geometry);
181
-    }
182
-
183
-    $geometries = array();
184
-    $geom_types = array();
185
-
186
-    $collections = array('MultiPoint','MultiLineString','MultiPolygon','GeometryCollection');
187
-
188
-    foreach ($geometry as $item) {
189
-      if ($item) {
190
-        if (in_array(get_class($item), $collections)) {
191
-          foreach ($item->getComponents() as $component) {
192
-            $geometries[] = $component;
193
-            $geom_types[] = $component->geometryType();
194
-          }
195
-        }
196
-        else {
197
-          $geometries[] = $item;
198
-          $geom_types[] = $item->geometryType();
199
-        }
200
-      }
201
-    }
202
-
203
-    $geom_types = array_unique($geom_types);
149
+	// If it's an array of one, then just parse the one
150
+	if (is_array($geometry)) {
151
+	  if (empty($geometry)) return FALSE;
152
+	  if (count($geometry) == 1) return geoPHP::geometryReduce(array_shift($geometry));
153
+	}
154
+
155
+	// If the geometry cannot even theoretically be reduced more, then pass it back
156
+	if (gettype($geometry) == 'object') {
157
+	  $passbacks = array('Point','LineString','Polygon');
158
+	  if (in_array($geometry->geometryType(),$passbacks)) {
159
+		return $geometry;
160
+	  }
161
+	}
162
+
163
+	// If it is a mutlti-geometry, check to see if it just has one member
164
+	// If it does, then pass the member, if not, then just pass back the geometry
165
+	if (gettype($geometry) == 'object') {
166
+	  $simple_collections = array('MultiPoint','MultiLineString','MultiPolygon');
167
+	  if (in_array(get_class($geometry),$passbacks)) {
168
+		$components = $geometry->getComponents();
169
+		if (count($components) == 1) {
170
+		  return $components[0];
171
+		}
172
+		else {
173
+		  return $geometry;
174
+		}
175
+	  }
176
+	}
177
+
178
+	// So now we either have an array of geometries, a GeometryCollection, or an array of GeometryCollections
179
+	if (!is_array($geometry)) {
180
+	  $geometry = array($geometry);
181
+	}
182
+
183
+	$geometries = array();
184
+	$geom_types = array();
185
+
186
+	$collections = array('MultiPoint','MultiLineString','MultiPolygon','GeometryCollection');
187
+
188
+	foreach ($geometry as $item) {
189
+	  if ($item) {
190
+		if (in_array(get_class($item), $collections)) {
191
+		  foreach ($item->getComponents() as $component) {
192
+			$geometries[] = $component;
193
+			$geom_types[] = $component->geometryType();
194
+		  }
195
+		}
196
+		else {
197
+		  $geometries[] = $item;
198
+		  $geom_types[] = $item->geometryType();
199
+		}
200
+	  }
201
+	}
202
+
203
+	$geom_types = array_unique($geom_types);
204 204
     
205
-    if (empty($geom_types)) {
206
-      return FALSE;
207
-    }
208
-
209
-    if (count($geom_types) == 1) {
210
-      if (count($geometries) == 1) {
211
-        return $geometries[0];
212
-      }
213
-      else {
214
-        $class = 'Multi'.$geom_types[0];
215
-        return new $class($geometries);
216
-      }
217
-    }
218
-    else {
219
-      return new GeometryCollection($geometries);
220
-    }
205
+	if (empty($geom_types)) {
206
+	  return FALSE;
207
+	}
208
+
209
+	if (count($geom_types) == 1) {
210
+	  if (count($geometries) == 1) {
211
+		return $geometries[0];
212
+	  }
213
+	  else {
214
+		$class = 'Multi'.$geom_types[0];
215
+		return new $class($geometries);
216
+	  }
217
+	}
218
+	else {
219
+	  return new GeometryCollection($geometries);
220
+	}
221 221
   }
222 222
 
223 223
   // Detect a format given a value. This function is meant to be SPEEDY.
224 224
   // It could make a mistake in XML detection if you are mixing or using namespaces in weird ways (ie, KML inside an RSS feed)
225 225
   static function detectFormat(&$input) {
226
-    $mem = fopen('php://memory', 'r+');
227
-    fwrite($mem, $input, 11); // Write 11 bytes - we can detect the vast majority of formats in the first 11 bytes
228
-    fseek($mem, 0);
229
-
230
-    $bytes = unpack("c*", fread($mem, 11));
231
-
232
-    // If bytes is empty, then we were passed empty input
233
-    if (empty($bytes)) return FALSE;
234
-
235
-    // First char is a tab, space or carriage-return. trim it and try again
236
-    if ($bytes[1] == 9 || $bytes[1] == 10 || $bytes[1] == 32) {
237
-      return geoPHP::detectFormat(ltrim($input));
238
-    }
239
-
240
-    // Detect WKB or EWKB -- first byte is 1 (little endian indicator)
241
-    if ($bytes[1] == 1) {
242
-      // If SRID byte is TRUE (1), it's EWKB
243
-      if ($bytes[5]) return 'ewkb';
244
-      else return 'wkb';
245
-    }
246
-
247
-    // Detect HEX encoded WKB or EWKB (PostGIS format) -- first byte is 48, second byte is 49 (hex '01' => first-byte = 1)
248
-    if ($bytes[1] == 48 && $bytes[2] == 49) {
249
-      // The shortest possible WKB string (LINESTRING EMPTY) is 18 hex-chars (9 encoded bytes) long
250
-      // This differentiates it from a geohash, which is always shorter than 18 characters.
251
-      if (strlen($input) >= 18) {
252
-        //@@TODO: Differentiate between EWKB and WKB -- check hex-char 10 or 11 (SRID bool indicator at encoded byte 5)
253
-        return 'ewkb:1';
254
-      }
255
-    }
256
-
257
-    // Detect GeoJSON - first char starts with {
258
-    if ($bytes[1] == 123) {
259
-      return 'json';
260
-    }
261
-
262
-    // Detect EWKT - first char is S
263
-    if ($bytes[1] == 83) {
264
-      return 'ewkt';
265
-    }
266
-
267
-    // Detect WKT - first char starts with P (80), L (76), M (77), or G (71)
268
-    $wkt_chars = array(80, 76, 77, 71);
269
-    if (in_array($bytes[1], $wkt_chars)) {
270
-      return 'wkt';
271
-    }
272
-
273
-    // Detect XML -- first char is <
274
-    if ($bytes[1] == 60) {
275
-      // grab the first 256 characters
276
-      $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';
283
-    }
284
-
285
-    // We need an 8 byte string for geohash and unpacked WKB / WKT
286
-    fseek($mem, 0);
287
-    $string = trim(fread($mem, 8));
288
-
289
-    // Detect geohash - geohash ONLY contains lowercase chars and numerics
290
-    preg_match('/[a-z0-9]+/', $string, $matches);
291
-    if ($matches[0] == $string) {
292
-      return 'geohash';
293
-    }
294
-
295
-    // What do you get when you cross an elephant with a rhino?
296
-    // http://youtu.be/RCBn5J83Poc
297
-    return FALSE;
226
+	$mem = fopen('php://memory', 'r+');
227
+	fwrite($mem, $input, 11); // Write 11 bytes - we can detect the vast majority of formats in the first 11 bytes
228
+	fseek($mem, 0);
229
+
230
+	$bytes = unpack("c*", fread($mem, 11));
231
+
232
+	// If bytes is empty, then we were passed empty input
233
+	if (empty($bytes)) return FALSE;
234
+
235
+	// First char is a tab, space or carriage-return. trim it and try again
236
+	if ($bytes[1] == 9 || $bytes[1] == 10 || $bytes[1] == 32) {
237
+	  return geoPHP::detectFormat(ltrim($input));
238
+	}
239
+
240
+	// Detect WKB or EWKB -- first byte is 1 (little endian indicator)
241
+	if ($bytes[1] == 1) {
242
+	  // If SRID byte is TRUE (1), it's EWKB
243
+	  if ($bytes[5]) return 'ewkb';
244
+	  else return 'wkb';
245
+	}
246
+
247
+	// Detect HEX encoded WKB or EWKB (PostGIS format) -- first byte is 48, second byte is 49 (hex '01' => first-byte = 1)
248
+	if ($bytes[1] == 48 && $bytes[2] == 49) {
249
+	  // The shortest possible WKB string (LINESTRING EMPTY) is 18 hex-chars (9 encoded bytes) long
250
+	  // This differentiates it from a geohash, which is always shorter than 18 characters.
251
+	  if (strlen($input) >= 18) {
252
+		//@@TODO: Differentiate between EWKB and WKB -- check hex-char 10 or 11 (SRID bool indicator at encoded byte 5)
253
+		return 'ewkb:1';
254
+	  }
255
+	}
256
+
257
+	// Detect GeoJSON - first char starts with {
258
+	if ($bytes[1] == 123) {
259
+	  return 'json';
260
+	}
261
+
262
+	// Detect EWKT - first char is S
263
+	if ($bytes[1] == 83) {
264
+	  return 'ewkt';
265
+	}
266
+
267
+	// Detect WKT - first char starts with P (80), L (76), M (77), or G (71)
268
+	$wkt_chars = array(80, 76, 77, 71);
269
+	if (in_array($bytes[1], $wkt_chars)) {
270
+	  return 'wkt';
271
+	}
272
+
273
+	// Detect XML -- first char is <
274
+	if ($bytes[1] == 60) {
275
+	  // grab the first 256 characters
276
+	  $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';
283
+	}
284
+
285
+	// We need an 8 byte string for geohash and unpacked WKB / WKT
286
+	fseek($mem, 0);
287
+	$string = trim(fread($mem, 8));
288
+
289
+	// Detect geohash - geohash ONLY contains lowercase chars and numerics
290
+	preg_match('/[a-z0-9]+/', $string, $matches);
291
+	if ($matches[0] == $string) {
292
+	  return 'geohash';
293
+	}
294
+
295
+	// What do you get when you cross an elephant with a rhino?
296
+	// http://youtu.be/RCBn5J83Poc
297
+	return FALSE;
298 298
   }
299 299
 
300 300
 }
Please login to merge, or discard this patch.
require/class.Image.php 1 patch
Indentation   +227 added lines, -227 removed lines patch added patch discarded remove patch
@@ -4,27 +4,27 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/settings.php');
5 5
 
6 6
 class Image {
7
-    public $db;
7
+	public $db;
8 8
 
9
-    function __construct($dbc = null) {
10
-	    $Connection = new Connection($dbc);
11
-            $this->db = $Connection->db;
12
-    }
9
+	function __construct($dbc = null) {
10
+		$Connection = new Connection($dbc);
11
+			$this->db = $Connection->db;
12
+	}
13 13
 
14
-    /**
15
-    * Gets the images based on the aircraft registration
16
-    *
17
-    * @return Array the images list
18
-    *
19
-    */
20
-    public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
21
-    {
22
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
23
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
24
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
25
-	    if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
14
+	/**
15
+	 * Gets the images based on the aircraft registration
16
+	 *
17
+	 * @return Array the images list
18
+	 *
19
+	 */
20
+	public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
21
+	{
22
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
23
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
24
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
25
+		if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
26 26
 	    
27
-	    $registration = trim($registration);
27
+		$registration = trim($registration);
28 28
 
29 29
 	$query  = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright
30 30
 			FROM spotter_image 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	
34 34
 	$sth = $this->db->prepare($query);
35 35
 	$sth->execute(array(':registration' => $registration));
36
-          /*
36
+		  /*
37 37
         $images_array = array();
38 38
 	$temp_array = array();
39 39
 
@@ -52,36 +52,36 @@  discard block
 block discarded – undo
52 52
         
53 53
         return $images_array;
54 54
         */
55
-        return $sth->fetchAll(PDO::FETCH_ASSOC);
56
-    }
55
+		return $sth->fetchAll(PDO::FETCH_ASSOC);
56
+	}
57 57
 
58
-    /**
59
-    * Gets the image copyright based on the Exif data
60
-    *
61
-    * @return String image copyright
62
-    *
63
-    */
64
-    public function getExifCopyright($url) {
65
-        $exif = exif_read_data($url);
66
-        $copyright = '';
67
-        if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright'];
68
-        elseif (isset($exif['copyright'])) $copyright = $exif['copyright'];
69
-        if ($copyright != '') {
70
-    	    $copyright = str_replace('Copyright ','',$copyright);
71
-    	    $copyright = str_replace('© ','',$copyright);
72
-    	    $copyright = str_replace('(c) ','',$copyright);
73
-        }
74
-        return $copyright;
75
-    }
58
+	/**
59
+	 * Gets the image copyright based on the Exif data
60
+	 *
61
+	 * @return String image copyright
62
+	 *
63
+	 */
64
+	public function getExifCopyright($url) {
65
+		$exif = exif_read_data($url);
66
+		$copyright = '';
67
+		if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright'];
68
+		elseif (isset($exif['copyright'])) $copyright = $exif['copyright'];
69
+		if ($copyright != '') {
70
+			$copyright = str_replace('Copyright ','',$copyright);
71
+			$copyright = str_replace('© ','',$copyright);
72
+			$copyright = str_replace('(c) ','',$copyright);
73
+		}
74
+		return $copyright;
75
+	}
76 76
     
77
-    /**
78
-    * Adds the images based on the aircraft registration
79
-    *
80
-    * @return String either success or error
81
-    *
82
-    */
83
-    public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
84
-    {
77
+	/**
78
+	 * Adds the images based on the aircraft registration
79
+	 *
80
+	 * @return String either success or error
81
+	 *
82
+	 */
83
+	public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
84
+	{
85 85
 	global $globalAircraftImageFetch;
86 86
 	if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return '';
87 87
 	$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -90,29 +90,29 @@  discard block
 block discarded – undo
90 90
 	$image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao);
91 91
 	if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
92 92
 	if ($image_url['original'] != '') {
93
-	    $query  = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)";
94
-	    try {
93
+		$query  = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)";
94
+		try {
95 95
 		
96 96
 		$sth = $this->db->prepare($query);
97 97
 		$sth->execute(array(':registration' => $registration,':image' => $image_url['original'],':image_thumbnail' => $image_url['thumbnail'], ':copyright' => $image_url['copyright'],':source' => $image_url['source'],':source_website' => $image_url['source_website']));
98
-	    } catch(PDOException $e) {
98
+		} catch(PDOException $e) {
99 99
 		echo $e->getMessage."\n";
100 100
 		return "error";
101
-	    }
101
+		}
102 102
 	}
103 103
 	return "success";
104
-    }
104
+	}
105 105
     
106 106
     
107
-    /**
108
-    * Gets the aircraft image
109
-    *
110
-    * @param String $aircraft_registration the registration of the aircraft
111
-    * @return Array the aircraft thumbnail, orignal url and copyright
112
-    *
113
-    */
114
-    public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $airline_icao = '')
115
-    {
107
+	/**
108
+	 * Gets the aircraft image
109
+	 *
110
+	 * @param String $aircraft_registration the registration of the aircraft
111
+	 * @return Array the aircraft thumbnail, orignal url and copyright
112
+	 *
113
+	 */
114
+	public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $airline_icao = '')
115
+	{
116 116
 	global $globalAircraftImageSources, $globalIVAO;
117 117
 	$Spotter = new Spotter($this->db);
118 118
 	if (!isset($globalIVAO)) $globalIVAO = FALSE;
@@ -120,17 +120,17 @@  discard block
 block discarded – undo
120 120
 	
121 121
 	if ($aircraft_registration != '') {
122 122
 	if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
123
-	    $aircraft_registration = urlencode(trim($aircraft_registration));
124
-	    $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration);
125
-    	    if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name'];
126
-	    else $aircraft_name = '';
127
-	    if (isset($aircraft_info[0]['aircraft_icao'])) $aircraft_name = $aircraft_info[0]['aircraft_icao'];
128
-    	    else $aircraft_icao = '';
129
-    	    if (isset($aircraft_info[0]['airline_icao'])) $airline_icao = $aircraft_info[0]['airline_icao'];
130
-    	    else $airline_icao = '';
131
-        } elseif ($aircraft_icao != '') {
132
-    	    $aircraft_registration = $aircraft_icao;
133
-    	    $aircraft_name = '';
123
+		$aircraft_registration = urlencode(trim($aircraft_registration));
124
+		$aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration);
125
+			if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name'];
126
+		else $aircraft_name = '';
127
+		if (isset($aircraft_info[0]['aircraft_icao'])) $aircraft_name = $aircraft_info[0]['aircraft_icao'];
128
+			else $aircraft_icao = '';
129
+			if (isset($aircraft_info[0]['airline_icao'])) $airline_icao = $aircraft_info[0]['airline_icao'];
130
+			else $airline_icao = '';
131
+		} elseif ($aircraft_icao != '') {
132
+			$aircraft_registration = $aircraft_icao;
133
+			$aircraft_name = '';
134 134
 	} else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
135 135
 
136 136
 	if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
@@ -150,29 +150,29 @@  discard block
 block discarded – undo
150 150
 		if (isset($images_array) && $images_array['original'] != '') return $images_array;
151 151
 	}
152 152
 	return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
153
-    }
153
+	}
154 154
 
155
-    /**
156
-    * Gets the aircraft image from Planespotters
157
-    *
158
-    * @param String $aircraft_registration the registration of the aircraft
159
-    * @param String $aircraft_name type of the aircraft
160
-    * @return Array the aircraft thumbnail, orignal url and copyright
161
-    *
162
-    */
163
-    public function fromPlanespotters($aircraft_registration, $aircraft_name='') {
155
+	/**
156
+	 * Gets the aircraft image from Planespotters
157
+	 *
158
+	 * @param String $aircraft_registration the registration of the aircraft
159
+	 * @param String $aircraft_name type of the aircraft
160
+	 * @return Array the aircraft thumbnail, orignal url and copyright
161
+	 *
162
+	 */
163
+	public function fromPlanespotters($aircraft_registration, $aircraft_name='') {
164 164
 	$Common = new Common();
165 165
 	// If aircraft registration is only number, also check with aircraft model
166 166
 	if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') {
167
-	    $url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss';
167
+		$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$aircraft_registration.'&actype=s_'.urlencode($aircraft_name).'&output=rss';
168 168
 	} else {
169
-	    //$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss';
170
-	    $url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss';
169
+		//$url= 'http://www.planespotters.net/Aviation_Photos/search.php?tag='.$airline_aircraft_type.'&output=rss';
170
+		$url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss';
171 171
 	}
172 172
 	
173 173
 	$data = $Common->getData($url);
174 174
 	if ($xml = simplexml_load_string($data)) {
175
-	    if (isset($xml->channel->item)) {
175
+		if (isset($xml->channel->item)) {
176 176
 		$thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url);
177 177
 		$image_url['thumbnail'] = $thumbnail_url;
178 178
 		$image_url['original'] = str_replace('thumbnail','original',$thumbnail_url);
@@ -180,31 +180,31 @@  discard block
 block discarded – undo
180 180
 		$image_url['source_website'] = trim((string)$xml->channel->item->link);
181 181
 		$image_url['source'] = 'planespotters';
182 182
 		return $image_url;
183
-	    }
183
+		}
184 184
 	} 
185 185
 	return false;
186
-    }
186
+	}
187 187
 
188
-    /**
189
-    * Gets the aircraft image from Deviantart
190
-    *
191
-    * @param String $aircraft_registration the registration of the aircraft
192
-    * @param String $aircraft_name type of the aircraft
193
-    * @return Array the aircraft thumbnail, orignal url and copyright
194
-    *
195
-    */
196
-    public function fromDeviantart($aircraft_registration, $aircraft_name='') {
188
+	/**
189
+	 * Gets the aircraft image from Deviantart
190
+	 *
191
+	 * @param String $aircraft_registration the registration of the aircraft
192
+	 * @param String $aircraft_name type of the aircraft
193
+	 * @return Array the aircraft thumbnail, orignal url and copyright
194
+	 *
195
+	 */
196
+	public function fromDeviantart($aircraft_registration, $aircraft_name='') {
197 197
 	$Common = new Common();
198 198
 	// If aircraft registration is only number, also check with aircraft model
199 199
 	if (preg_match('/^[[:digit]]+$/',$aircraft_registration) && $aircraft_name != '') {
200
-	    $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$aircraft_registration.'%20'.urlencode($aircraft_name);
200
+		$url= 'http://backend.deviantart.com/rss.xml?type=deviation&q='.$aircraft_registration.'%20'.urlencode($aircraft_name);
201 201
 	} else {
202
-	    $url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$aircraft_registration;
202
+		$url= 'http://backend.deviantart.com/rss.xml?type=deviation&q=aircraft%20'.$aircraft_registration;
203 203
 	}
204 204
 	
205 205
 	$data = $Common->getData($url);
206 206
 	if ($xml = simplexml_load_string($data)) {
207
-	    if (isset($xml->channel->item->link)) {
207
+		if (isset($xml->channel->item->link)) {
208 208
 		$thumbnail_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->thumbnail->attributes()->url);
209 209
 		$image_url['thumbnail'] = $thumbnail_url;
210 210
 		$original_url = trim((string)$xml->channel->item->children('http://search.yahoo.com/mrss/')->content->attributes()->url);
@@ -213,20 +213,20 @@  discard block
 block discarded – undo
213 213
 		$image_url['source_website'] = trim((string)$xml->channel->item->link);
214 214
 		$image_url['source'] = 'deviantart';
215 215
 		return $image_url;
216
-	    }
216
+		}
217 217
 	} 
218 218
 	return false;
219
-    }
219
+	}
220 220
 
221
-    /**
222
-    * Gets the aircraft image from JetPhotos
223
-    *
224
-    * @param String $aircraft_registration the registration of the aircraft
225
-    * @param String $aircraft_name type of the aircraft
226
-    * @return Array the aircraft thumbnail, orignal url and copyright
227
-    *
228
-    */
229
-    public function fromJetPhotos($aircraft_registration, $aircraft_name='') {
221
+	/**
222
+	 * Gets the aircraft image from JetPhotos
223
+	 *
224
+	 * @param String $aircraft_registration the registration of the aircraft
225
+	 * @param String $aircraft_name type of the aircraft
226
+	 * @return Array the aircraft thumbnail, orignal url and copyright
227
+	 *
228
+	 */
229
+	public function fromJetPhotos($aircraft_registration, $aircraft_name='') {
230 230
 	$Common = new Common();
231 231
 	$url= 'http://jetphotos.net/showphotos.php?displaymode=2&regsearch='.$aircraft_registration;
232 232
 	
@@ -235,19 +235,19 @@  discard block
 block discarded – undo
235 235
 	@$dom->loadHTML($data);
236 236
 	$all_pics = array();
237 237
 	foreach($dom->getElementsByTagName('img') as $image) {
238
-	    if ($image->getAttribute('itemprop') == "http://schema.org/image") {
238
+		if ($image->getAttribute('itemprop') == "http://schema.org/image") {
239 239
 		$all_pics[] = $image->getAttribute('src');
240
-	    }
240
+		}
241 241
 	}
242 242
 	$all_authors = array();
243 243
 	foreach($dom->getElementsByTagName('meta') as $author) {
244
-	    if ($author->getAttribute('itemprop') == "http://schema.org/author") {
244
+		if ($author->getAttribute('itemprop') == "http://schema.org/author") {
245 245
 		$all_authors[] = $author->getAttribute('content');
246
-	    }
246
+		}
247 247
 	}
248 248
 	$all_ref = array();
249 249
 	foreach($dom->getElementsByTagName('a') as $link) {
250
-	    $all_ref[] = $link->getAttribute('href');
250
+		$all_ref[] = $link->getAttribute('href');
251 251
 	}
252 252
 
253 253
 	if (isset($all_pics[0])) {
@@ -259,17 +259,17 @@  discard block
 block discarded – undo
259 259
 		return $image_url;
260 260
 	}
261 261
 	return false;
262
-    }
262
+	}
263 263
   
264
-    /**
265
-    * Gets the aircraft image from PlanePictures
266
-    *
267
-    * @param String $aircraft_registration the registration of the aircraft
268
-    * @param String $aircraft_name type of the aircraft
269
-    * @return Array the aircraft thumbnail, orignal url and copyright
270
-    *
271
-    */
272
-    public function fromPlanePictures($aircraft_registration, $aircraft_name='') {
264
+	/**
265
+	 * Gets the aircraft image from PlanePictures
266
+	 *
267
+	 * @param String $aircraft_registration the registration of the aircraft
268
+	 * @param String $aircraft_name type of the aircraft
269
+	 * @return Array the aircraft thumbnail, orignal url and copyright
270
+	 *
271
+	 */
272
+	public function fromPlanePictures($aircraft_registration, $aircraft_name='') {
273 273
 	$Common = new Common();
274 274
 	$url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2';
275 275
 	
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 	@$dom->loadHTML($data);
279 279
 	$all_pics = array();
280 280
 	foreach($dom->getElementsByTagName('img') as $image) {
281
-	    $all_pics[] = $image->getAttribute('src');
281
+		$all_pics[] = $image->getAttribute('src');
282 282
 	}
283 283
 	$all_links = array();
284 284
 	foreach($dom->getElementsByTagName('a') as $link) {
285
-	    $all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href'));
285
+		$all_links[] = array('text' => $link->textContent,'href' => $link->getAttribute('href'));
286 286
 	}
287 287
 	if (isset($all_pics[1]) && !preg_match('/bit.ly/',$all_pics[1])) {
288 288
 		$image_url['thumbnail'] = 'http://www.planepictures.net'.$all_pics[1];
@@ -293,26 +293,26 @@  discard block
 block discarded – undo
293 293
 		return $image_url;
294 294
 	}
295 295
 	return false;
296
-    }
296
+	}
297 297
   
298
-    /**
299
-    * Gets the aircraft image from Flickr
300
-    *
301
-    * @param String $aircraft_registration the registration of the aircraft
302
-    * @param String $aircraft_name type of the aircraft
303
-    * @return Array the aircraft thumbnail, orignal url and copyright
304
-    *
305
-    */
306
-    public function fromFlickr($aircraft_registration,$aircraft_name='') {
298
+	/**
299
+	 * Gets the aircraft image from Flickr
300
+	 *
301
+	 * @param String $aircraft_registration the registration of the aircraft
302
+	 * @param String $aircraft_name type of the aircraft
303
+	 * @return Array the aircraft thumbnail, orignal url and copyright
304
+	 *
305
+	 */
306
+	public function fromFlickr($aircraft_registration,$aircraft_name='') {
307 307
 	$Common = new Common();
308 308
 
309
-	    if ($aircraft_name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.','.urlencode($aircraft_name);
310
-	    else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.',aircraft';
309
+		if ($aircraft_name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.','.urlencode($aircraft_name);
310
+		else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$aircraft_registration.',aircraft';
311 311
 	    
312 312
 	$data = $Common->getData($url);
313 313
 	
314 314
 	if ($xml = simplexml_load_string($data)) {
315
-	    if (isset($xml->channel->item)) {
315
+		if (isset($xml->channel->item)) {
316 316
 		$original_url = trim((string)$xml->channel->item->enclosure->attributes()->url);
317 317
 		$image_url['thumbnail'] = $original_url;
318 318
 		$image_url['original'] = $original_url;
@@ -320,39 +320,39 @@  discard block
 block discarded – undo
320 320
 		$image_url['source_website'] = trim((string)$xml->channel->item->link);
321 321
 		$image_url['source'] = 'flickr';
322 322
 		return $image_url;
323
-	    }
323
+		}
324 324
 	} 
325 325
 	
326 326
 	return false;
327
-    }
327
+	}
328 328
 
329 329
 
330
-    public function fromIvaoMtl($aircraft_icao,$airline_icao) {
330
+	public function fromIvaoMtl($aircraft_icao,$airline_icao) {
331 331
 	$Common = new Common();
332 332
 	//echo "\n".'SEARCH IMAGE : http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg';
333 333
 	if ($Common->urlexist('http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg')) {
334
-	    $image_url['thumbnail'] = 'http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg';
335
-	    $image_url['original'] = 'http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg';
336
-	    $image_url['copyright'] = 'IVAO';
337
-	    $image_url['source_website'] = 'http://mtlcatalog.ivao.aero/';
338
-	    $image_url['source'] = 'ivao.aero';
339
-	    return $image_url;
334
+		$image_url['thumbnail'] = 'http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg';
335
+		$image_url['original'] = 'http://mtlcatalog.ivao.aero/images/aircraft/'.$aircraft_icao.$airline_icao.'.jpg';
336
+		$image_url['copyright'] = 'IVAO';
337
+		$image_url['source_website'] = 'http://mtlcatalog.ivao.aero/';
338
+		$image_url['source'] = 'ivao.aero';
339
+		return $image_url;
340 340
 	} else {
341
-	    return false;
341
+		return false;
342 342
 	}
343 343
     
344
-    }
344
+	}
345 345
     
346 346
     
347
-    /**
348
-    * Gets the aircraft image from Bing
349
-    *
350
-    * @param String $aircraft_registration the registration of the aircraft
351
-    * @param String $aircraft_name type of the aircraft
352
-    * @return Array the aircraft thumbnail, orignal url and copyright
353
-    *
354
-    */
355
-    public function fromBing($aircraft_registration,$aircraft_name='') {
347
+	/**
348
+	 * Gets the aircraft image from Bing
349
+	 *
350
+	 * @param String $aircraft_registration the registration of the aircraft
351
+	 * @param String $aircraft_name type of the aircraft
352
+	 * @return Array the aircraft thumbnail, orignal url and copyright
353
+	 *
354
+	 */
355
+	public function fromBing($aircraft_registration,$aircraft_name='') {
356 356
 	global $globalImageBingKey;
357 357
 	$Common = new Common();
358 358
 	if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false;
@@ -365,54 +365,54 @@  discard block
 block discarded – undo
365 365
 
366 366
 	$result = json_decode($data);
367 367
 	if (isset($result->d->results[0]->MediaUrl)) {
368
-	    $image_url['original'] = $result->d->results[0]->MediaUrl;
369
-	    $image_url['source_website'] = $result->d->results[0]->SourceUrl;
370
-	    // Thumbnail can't be used this way...
371
-	    // $image_url['thumbnail'] = $result->d->results[0]->Thumbnail->MediaUrl;
372
-	    $image_url['thumbnail'] = $result->d->results[0]->MediaUrl;
373
-	    $url = parse_url($image_url['source_website']);
374
-	    $image_url['copyright'] = $url['host'];
375
-	    $image_url['source'] = 'bing';
376
-	    return $image_url;
368
+		$image_url['original'] = $result->d->results[0]->MediaUrl;
369
+		$image_url['source_website'] = $result->d->results[0]->SourceUrl;
370
+		// Thumbnail can't be used this way...
371
+		// $image_url['thumbnail'] = $result->d->results[0]->Thumbnail->MediaUrl;
372
+		$image_url['thumbnail'] = $result->d->results[0]->MediaUrl;
373
+		$url = parse_url($image_url['source_website']);
374
+		$image_url['copyright'] = $url['host'];
375
+		$image_url['source'] = 'bing';
376
+		return $image_url;
377 377
 	}
378 378
 	return false;
379
-    }
379
+	}
380 380
 
381
-    /**
382
-    * Gets the aircraft image from airport-data
383
-    *
384
-    * @param String $aircraft_registration the registration of the aircraft
385
-    * @param String $aircraft_name type of the aircraft
386
-    * @return Array the aircraft thumbnail, orignal url and copyright
387
-    *
388
-    */
389
-    public function fromAirportData($aircraft_registration,$aircraft_name='') {
381
+	/**
382
+	 * Gets the aircraft image from airport-data
383
+	 *
384
+	 * @param String $aircraft_registration the registration of the aircraft
385
+	 * @param String $aircraft_name type of the aircraft
386
+	 * @return Array the aircraft thumbnail, orignal url and copyright
387
+	 *
388
+	 */
389
+	public function fromAirportData($aircraft_registration,$aircraft_name='') {
390 390
 	$Common = new Common();
391 391
 	$url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration;
392 392
 	$data = $Common->getData($url);
393 393
 	$result = json_decode($data);
394 394
 	
395 395
 	if (isset($result->count) && $result->count > 0) {
396
-	    $image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image);
397
-	    $image_url['source_website'] = $result->data[0]->link;
398
-	    $image_url['thumbnail'] = $result->data[0]->image;
399
-	    $image_url['copyright'] = $result->data[0]->photographer;
400
-	    $image_url['source'] = 'AirportData';
396
+		$image_url['original'] = str_replace('thumbnails','large',$result->data[0]->image);
397
+		$image_url['source_website'] = $result->data[0]->link;
398
+		$image_url['thumbnail'] = $result->data[0]->image;
399
+		$image_url['copyright'] = $result->data[0]->photographer;
400
+		$image_url['source'] = 'AirportData';
401 401
 	
402
-	    return $image_url;
402
+		return $image_url;
403 403
 	}
404 404
 	return false;
405
-    }
405
+	}
406 406
 
407
-    /**
408
-    * Gets the aircraft image from WikiMedia
409
-    *
410
-    * @param String $aircraft_registration the registration of the aircraft
411
-    * @param String $aircraft_name type of the aircraft
412
-    * @return Array the aircraft thumbnail, orignal url and copyright
413
-    *
414
-    */
415
-    public function fromWikimedia($aircraft_registration,$aircraft_name='') {
407
+	/**
408
+	 * Gets the aircraft image from WikiMedia
409
+	 *
410
+	 * @param String $aircraft_registration the registration of the aircraft
411
+	 * @param String $aircraft_name type of the aircraft
412
+	 * @return Array the aircraft thumbnail, orignal url and copyright
413
+	 *
414
+	 */
415
+	public function fromWikimedia($aircraft_registration,$aircraft_name='') {
416 416
 	$Common = new Common();
417 417
 	if ($aircraft_name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20'.urlencode($aircraft_name);
418 418
 	else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$aircraft_registration.'"%20aircraft';
@@ -420,59 +420,59 @@  discard block
 block discarded – undo
420 420
 	$data = $Common->getData($url);
421 421
 	$result = json_decode($data);
422 422
 	if (isset($result->query->search[0]->title)) {
423
-	    $fileo = $result->query->search[0]->title;
424
-	    if (substr($fileo,-3) == 'pdf') return false;
425
-	    $file = urlencode($fileo);
426
-	    $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file;
423
+		$fileo = $result->query->search[0]->title;
424
+		if (substr($fileo,-3) == 'pdf') return false;
425
+		$file = urlencode($fileo);
426
+		$url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file;
427 427
 
428
-	    $data2 = $Common->getData($url2);
429
-	    $result2 = json_decode($data2);
430
-	    if (isset($result2->query->pages)) {
428
+		$data2 = $Common->getData($url2);
429
+		$result2 = json_decode($data2);
430
+		if (isset($result2->query->pages)) {
431 431
 		foreach ($result2->query->pages as $page) {
432
-		    if (isset($page->imageinfo[0]->user)) {
432
+			if (isset($page->imageinfo[0]->user)) {
433 433
 			$image_url['copyright'] = 'Wikimedia, '.$page->imageinfo[0]->user;
434 434
 			$image_url['original'] = $page->imageinfo[0]->url;
435 435
 			$image_url['thumbnail'] = $page->imageinfo[0]->thumburl;
436 436
 			$image_url['source'] = 'wikimedia';
437 437
 			$image_url['source_website'] = 'http://commons.wikimedia.org/wiki/'.$fileo;
438 438
 			//return $image_url;
439
-		    }
439
+			}
440
+		}
440 441
 		}
441
-	    }
442 442
 	    
443
-	    if (isset($image_url['original'])) {
443
+		if (isset($image_url['original'])) {
444 444
 		$url2 = 'https://commons.wikimedia.org/w/api.php?action=query&prop=imageinfo&iiprop=extmetadata&format=json&continue&titles='.$file;
445 445
 
446 446
 		$data2 = $Common->getData($url2);
447 447
 		$result2 = json_decode($data2);
448 448
 		if (isset($result2->query->pages)) {
449
-		    foreach ($result2->query->pages as $page) {
449
+			foreach ($result2->query->pages as $page) {
450 450
 			if (isset($page->imageinfo[0]->extmetadata->Artist)) {
451
-			    $image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value));
452
-			    if (isset($page->imageinfo[0]->extmetadata->License->value)) {
453
-			        $image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')';
454
-			    }
455
-			    $image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright']));
456
-			    return $image_url;
451
+				$image_url['copyright'] = preg_replace('/ from(.*)/','',strip_tags($page->imageinfo[0]->extmetadata->Artist->value));
452
+				if (isset($page->imageinfo[0]->extmetadata->License->value)) {
453
+					$image_url['copyright'] = $image_url['copyright'].' (under '.$page->imageinfo[0]->extmetadata->License->value.')';
454
+				}
455
+				$image_url['copyright'] = trim(str_replace('\n','',$image_url['copyright']));
456
+				return $image_url;
457
+			}
457 458
 			}
458
-		    }
459 459
 		}
460 460
 		return $image_url;
461
-	    }
461
+		}
462 462
 	    
463 463
 	}
464 464
 	return false;
465
-    }
465
+	}
466 466
 
467
-    /**
468
-    * Gets the aircraft image from custom url
469
-    *
470
-    * @param String $aircraft_registration the registration of the aircraft
471
-    * @param String $aircraft_name type of the aircraft
472
-    * @return Array the aircraft thumbnail, orignal url and copyright
473
-    *
474
-    */
475
-    public function fromCustomSource($aircraft_registration,$aircraft_name='') {
467
+	/**
468
+	 * Gets the aircraft image from custom url
469
+	 *
470
+	 * @param String $aircraft_registration the registration of the aircraft
471
+	 * @param String $aircraft_name type of the aircraft
472
+	 * @return Array the aircraft thumbnail, orignal url and copyright
473
+	 *
474
+	 */
475
+	public function fromCustomSource($aircraft_registration,$aircraft_name='') {
476 476
 	global $globalAircraftCustomSources;
477 477
 	//$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true);
478 478
 	if (!empty($globalAircraftImageCustomSources)) {
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 		}
496 496
 		return false;
497 497
 	} else return false;
498
-    }
498
+	}
499 499
 
500 500
 
501 501
 
Please login to merge, or discard this patch.
require/class.Spotter.php 1 patch
Indentation   +1277 added lines, -1277 removed lines patch added patch discarded remove patch
@@ -13,13 +13,13 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 	
15 15
 	/**
16
-	* Executes the SQL statements to get the spotter information
17
-	*
18
-	* @param String $query the SQL query
19
-	* @param String $limit the limit query
20
-	* @return Array the spotter information
21
-	*
22
-	*/
16
+	 * Executes the SQL statements to get the spotter information
17
+	 *
18
+	 * @param String $query the SQL query
19
+	 * @param String $limit the limit query
20
+	 * @return Array the spotter information
21
+	 *
22
+	 */
23 23
 	public function getDataFromDB($query, $params = array(), $limitQuery = '')
24 24
 	{
25 25
 		global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS;
@@ -178,11 +178,11 @@  discard block
 block discarded – undo
178 178
 					if ($aircraft_array[0]['aircraft_shadow'] != NULL) {
179 179
 						$temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow'];
180 180
 					} else $temp_array['aircraft_shadow'] = 'default.png';
181
-                                } else {
182
-                            		$temp_array['aircraft_shadow'] = 'default.png';
181
+								} else {
182
+									$temp_array['aircraft_shadow'] = 'default.png';
183 183
 					$temp_array['aircraft_name'] = 'N/A';
184 184
 					$temp_array['aircraft_manufacturer'] = 'N/A';
185
-                            	}
185
+								}
186 186
 			}
187 187
 			if (!isset($row['airline_name']) || $row['airline_name'] == '') {
188 188
 				$airline_array = array();
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
 	
361 361
 	
362 362
 	/**
363
-	* Gets all the spotter information
364
-	*
365
-	* @return Array the spotter information
366
-	*
367
-	*/
363
+	 * Gets all the spotter information
364
+	 *
365
+	 * @return Array the spotter information
366
+	 *
367
+	 */
368 368
 	public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '')
369 369
 	{
370 370
 		global $globalTimezone, $globalDBdriver;
@@ -711,11 +711,11 @@  discard block
 block discarded – undo
711 711
 	
712 712
 	
713 713
 	/**
714
-	* Gets all the spotter information based on the latest data entry
715
-	*
716
-	* @return Array the spotter information
717
-	*
718
-	*/
714
+	 * Gets all the spotter information based on the latest data entry
715
+	 *
716
+	 * @return Array the spotter information
717
+	 *
718
+	 */
719 719
 	public function getLatestSpotterData($limit = '', $sort = '')
720 720
 	{
721 721
 		global $global_query;
@@ -752,12 +752,12 @@  discard block
 block discarded – undo
752 752
 	}
753 753
     
754 754
     
755
-    /**
756
-	* Gets all the spotter information based on a user's latitude and longitude
757
-	*
758
-	* @return Array the spotter information
759
-	*
760
-	*/
755
+	/**
756
+	 * Gets all the spotter information based on a user's latitude and longitude
757
+	 *
758
+	 * @return Array the spotter information
759
+	 *
760
+	 */
761 761
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
762 762
 	{
763 763
 		date_default_timezone_set('UTC');
@@ -825,12 +825,12 @@  discard block
 block discarded – undo
825 825
 	}
826 826
     
827 827
     
828
-    /**
829
-	* Gets all the spotter information sorted by the newest aircraft type
830
-	*
831
-	* @return Array the spotter information
832
-	*
833
-	*/
828
+	/**
829
+	 * Gets all the spotter information sorted by the newest aircraft type
830
+	 *
831
+	 * @return Array the spotter information
832
+	 *
833
+	 */
834 834
 	public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '')
835 835
 	{
836 836
 		global $global_query;
@@ -867,12 +867,12 @@  discard block
 block discarded – undo
867 867
 	}
868 868
     
869 869
     
870
-    /**
871
-	* Gets all the spotter information sorted by the newest aircraft registration
872
-	*
873
-	* @return Array the spotter information
874
-	*
875
-	*/
870
+	/**
871
+	 * Gets all the spotter information sorted by the newest aircraft registration
872
+	 *
873
+	 * @return Array the spotter information
874
+	 *
875
+	 */
876 876
 	public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '')
877 877
 	{
878 878
 		global $global_query;
@@ -909,12 +909,12 @@  discard block
 block discarded – undo
909 909
 	}
910 910
     
911 911
     
912
-    /**
913
-	* Gets all the spotter information sorted by the newest airline
914
-	*
915
-	* @return Array the spotter information
916
-	*
917
-	*/
912
+	/**
913
+	 * Gets all the spotter information sorted by the newest airline
914
+	 *
915
+	 * @return Array the spotter information
916
+	 *
917
+	 */
918 918
 	public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '')
919 919
 	{
920 920
 		global $global_query;
@@ -951,12 +951,12 @@  discard block
 block discarded – undo
951 951
 	}
952 952
     
953 953
     
954
-    /**
955
-	* Gets all the spotter information sorted by the newest departure airport
956
-	*
957
-	* @return Array the spotter information
958
-	*
959
-	*/
954
+	/**
955
+	 * Gets all the spotter information sorted by the newest departure airport
956
+	 *
957
+	 * @return Array the spotter information
958
+	 *
959
+	 */
960 960
 	public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '')
961 961
 	{
962 962
 		global $global_query;
@@ -993,12 +993,12 @@  discard block
 block discarded – undo
993 993
 	}
994 994
     
995 995
     
996
-    /**
997
-	* Gets all the spotter information sorted by the newest arrival airport
998
-	*
999
-	* @return Array the spotter information
1000
-	*
1001
-	*/
996
+	/**
997
+	 * Gets all the spotter information sorted by the newest arrival airport
998
+	 *
999
+	 * @return Array the spotter information
1000
+	 *
1001
+	 */
1002 1002
 	public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '')
1003 1003
 	{
1004 1004
 		global $global_query;
@@ -1036,11 +1036,11 @@  discard block
 block discarded – undo
1036 1036
 	
1037 1037
 
1038 1038
 	/**
1039
-	* Gets all the spotter information based on the spotter id
1040
-	*
1041
-	* @return Array the spotter information
1042
-	*
1043
-	*/
1039
+	 * Gets all the spotter information based on the spotter id
1040
+	 *
1041
+	 * @return Array the spotter information
1042
+	 *
1043
+	 */
1044 1044
 	public function getSpotterDataByID($id = '')
1045 1045
 	{
1046 1046
 		global $global_query;
@@ -1071,11 +1071,11 @@  discard block
 block discarded – undo
1071 1071
 	
1072 1072
 	
1073 1073
 	/**
1074
-	* Gets all the spotter information based on the callsign
1075
-	*
1076
-	* @return Array the spotter information
1077
-	*
1078
-	*/
1074
+	 * Gets all the spotter information based on the callsign
1075
+	 *
1076
+	 * @return Array the spotter information
1077
+	 *
1078
+	 */
1079 1079
 	public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '')
1080 1080
 	{
1081 1081
 		global $global_query;
@@ -1127,11 +1127,11 @@  discard block
 block discarded – undo
1127 1127
 	
1128 1128
 	
1129 1129
 	/**
1130
-	* Gets all the spotter information based on the aircraft type
1131
-	*
1132
-	* @return Array the spotter information
1133
-	*
1134
-	*/
1130
+	 * Gets all the spotter information based on the aircraft type
1131
+	 *
1132
+	 * @return Array the spotter information
1133
+	 *
1134
+	 */
1135 1135
 	public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '')
1136 1136
 	{
1137 1137
 		global $global_query;
@@ -1182,11 +1182,11 @@  discard block
 block discarded – undo
1182 1182
 	
1183 1183
 	
1184 1184
 	/**
1185
-	* Gets all the spotter information based on the aircraft registration
1186
-	*
1187
-	* @return Array the spotter information
1188
-	*
1189
-	*/
1185
+	 * Gets all the spotter information based on the aircraft registration
1186
+	 *
1187
+	 * @return Array the spotter information
1188
+	 *
1189
+	 */
1190 1190
 	public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '')
1191 1191
 	{
1192 1192
 		global $global_query;
@@ -1239,11 +1239,11 @@  discard block
 block discarded – undo
1239 1239
 	
1240 1240
 	
1241 1241
 	/**
1242
-	* Gets all the spotter information based on the airline
1243
-	*
1244
-	* @return Array the spotter information
1245
-	*
1246
-	*/
1242
+	 * Gets all the spotter information based on the airline
1243
+	 *
1244
+	 * @return Array the spotter information
1245
+	 *
1246
+	 */
1247 1247
 	public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '')
1248 1248
 	{
1249 1249
 		global $global_query;
@@ -1293,11 +1293,11 @@  discard block
 block discarded – undo
1293 1293
 	
1294 1294
 	
1295 1295
 	/**
1296
-	* Gets all the spotter information based on the airport
1297
-	*
1298
-	* @return Array the spotter information
1299
-	*
1300
-	*/
1296
+	 * Gets all the spotter information based on the airport
1297
+	 *
1298
+	 * @return Array the spotter information
1299
+	 *
1300
+	 */
1301 1301
 	public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '')
1302 1302
 	{
1303 1303
 		global $global_query;
@@ -1349,11 +1349,11 @@  discard block
 block discarded – undo
1349 1349
 
1350 1350
 
1351 1351
 	/**
1352
-	* Gets all the spotter information based on the date
1353
-	*
1354
-	* @return Array the spotter information
1355
-	*
1356
-	*/
1352
+	 * Gets all the spotter information based on the date
1353
+	 *
1354
+	 * @return Array the spotter information
1355
+	 *
1356
+	 */
1357 1357
 	public function getSpotterDataByDate($date = '', $limit = '', $sort = '')
1358 1358
 	{
1359 1359
 		global $global_query, $globalTimezone, $globalDBdriver;
@@ -1408,11 +1408,11 @@  discard block
 block discarded – undo
1408 1408
 
1409 1409
 
1410 1410
 	/**
1411
-	* Gets all the spotter information based on the country name
1412
-	*
1413
-	* @return Array the spotter information
1414
-	*
1415
-	*/
1411
+	 * Gets all the spotter information based on the country name
1412
+	 *
1413
+	 * @return Array the spotter information
1414
+	 *
1415
+	 */
1416 1416
 	public function getSpotterDataByCountry($country = '', $limit = '', $sort = '')
1417 1417
 	{
1418 1418
 		global $global_query;
@@ -1464,11 +1464,11 @@  discard block
 block discarded – undo
1464 1464
 	
1465 1465
 	
1466 1466
 	/**
1467
-	* Gets all the spotter information based on the manufacturer name
1468
-	*
1469
-	* @return Array the spotter information
1470
-	*
1471
-	*/
1467
+	 * Gets all the spotter information based on the manufacturer name
1468
+	 *
1469
+	 * @return Array the spotter information
1470
+	 *
1471
+	 */
1472 1472
 	public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '')
1473 1473
 	{
1474 1474
 		global $global_query;
@@ -1521,14 +1521,14 @@  discard block
 block discarded – undo
1521 1521
 
1522 1522
   
1523 1523
   
1524
-    /**
1525
-	* Gets a list of all aircraft with a special highlight text
1526
-	*
1527
-	* @param String $aircraft_registration the aircraft registration
1528
-	* @param String $airport_departure the departure airport
1529
-	* @return Array the spotter information
1530
-	*
1531
-	*/
1524
+	/**
1525
+	 * Gets a list of all aircraft with a special highlight text
1526
+	 *
1527
+	 * @param String $aircraft_registration the aircraft registration
1528
+	 * @param String $airport_departure the departure airport
1529
+	 * @return Array the spotter information
1530
+	 *
1531
+	 */
1532 1532
 	public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '')
1533 1533
 	{
1534 1534
 		global $global_query;
@@ -1593,11 +1593,11 @@  discard block
 block discarded – undo
1593 1593
 	
1594 1594
 	
1595 1595
 	/**
1596
-	* Gets all the spotter information based on the special column in the table
1597
-	*
1598
-	* @return Array the spotter information
1599
-	*
1600
-	*/
1596
+	 * Gets all the spotter information based on the special column in the table
1597
+	 *
1598
+	 * @return Array the spotter information
1599
+	 *
1600
+	 */
1601 1601
 	public function getSpotterDataByHighlight($limit = '', $sort = '')
1602 1602
 	{
1603 1603
 		global $global_query;
@@ -1635,12 +1635,12 @@  discard block
 block discarded – undo
1635 1635
     
1636 1636
     
1637 1637
     
1638
-    /**
1639
-	* Gets all the highlight based on a aircraft registration
1640
-	*
1641
-	* @return String the highlight text
1642
-	*
1643
-	*/
1638
+	/**
1639
+	 * Gets all the highlight based on a aircraft registration
1640
+	 *
1641
+	 * @return String the highlight text
1642
+	 *
1643
+	 */
1644 1644
 	public function getHighlightByRegistration($registration)
1645 1645
 	{
1646 1646
 		global $global_query;
@@ -1663,13 +1663,13 @@  discard block
 block discarded – undo
1663 1663
 
1664 1664
 	
1665 1665
 	/**
1666
-	* Gets the squawk usage from squawk code
1667
-	*
1668
-	* @param String $squawk squawk code
1669
-	* @param String $country country
1670
-	* @return String usage
1671
-	*
1672
-	*/
1666
+	 * Gets the squawk usage from squawk code
1667
+	 *
1668
+	 * @param String $squawk squawk code
1669
+	 * @param String $country country
1670
+	 * @return String usage
1671
+	 *
1672
+	 */
1673 1673
 	public function getSquawkUsage($squawk = '',$country = 'FR')
1674 1674
 	{
1675 1675
 		
@@ -1693,12 +1693,12 @@  discard block
 block discarded – undo
1693 1693
 	}
1694 1694
 
1695 1695
 	/**
1696
-	* Gets the airport icao from the iata
1697
-	*
1698
-	* @param String $airport_iata the iata code of the airport
1699
-	* @return String airport iata
1700
-	*
1701
-	*/
1696
+	 * Gets the airport icao from the iata
1697
+	 *
1698
+	 * @param String $airport_iata the iata code of the airport
1699
+	 * @return String airport iata
1700
+	 *
1701
+	 */
1702 1702
 	public function getAirportIcao($airport_iata = '')
1703 1703
 	{
1704 1704
 		
@@ -1720,14 +1720,14 @@  discard block
 block discarded – undo
1720 1720
 	}
1721 1721
 
1722 1722
 	/**
1723
-	* Gets the airport distance
1724
-	*
1725
-	* @param String $airport_icao the icao code of the airport
1726
-	* @param Float $latitude the latitude
1727
-	* @param Float $longitude the longitude
1728
-	* @return Float distance to the airport
1729
-	*
1730
-	*/
1723
+	 * Gets the airport distance
1724
+	 *
1725
+	 * @param String $airport_icao the icao code of the airport
1726
+	 * @param Float $latitude the latitude
1727
+	 * @param Float $longitude the longitude
1728
+	 * @return Float distance to the airport
1729
+	 *
1730
+	 */
1731 1731
 	public function getAirportDistance($airport_icao,$latitude,$longitude)
1732 1732
 	{
1733 1733
 		
@@ -1749,12 +1749,12 @@  discard block
 block discarded – undo
1749 1749
 	}
1750 1750
 	
1751 1751
 	/**
1752
-	* Gets the airport info based on the icao
1753
-	*
1754
-	* @param String $airport_iata the icao code of the airport
1755
-	* @return Array airport information
1756
-	*
1757
-	*/
1752
+	 * Gets the airport info based on the icao
1753
+	 *
1754
+	 * @param String $airport_iata the icao code of the airport
1755
+	 * @return Array airport information
1756
+	 *
1757
+	 */
1758 1758
 	public function getAllAirportInfo($airport = '')
1759 1759
 	{
1760 1760
 		
@@ -1800,12 +1800,12 @@  discard block
 block discarded – undo
1800 1800
 	}
1801 1801
 	
1802 1802
 	/**
1803
-	* Gets the airport info based on the country
1804
-	*
1805
-	* @param Array $countries Airports countries
1806
-	* @return Array airport information
1807
-	*
1808
-	*/
1803
+	 * Gets the airport info based on the country
1804
+	 *
1805
+	 * @param Array $countries Airports countries
1806
+	 * @return Array airport information
1807
+	 *
1808
+	 */
1809 1809
 	public function getAllAirportInfobyCountry($countries)
1810 1810
 	{
1811 1811
 		$lst_countries = '';
@@ -1843,12 +1843,12 @@  discard block
 block discarded – undo
1843 1843
 	}
1844 1844
 	
1845 1845
 	/**
1846
-	* Gets airports info based on the coord
1847
-	*
1848
-	* @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1849
-	* @return Array airport information
1850
-	*
1851
-	*/
1846
+	 * Gets airports info based on the coord
1847
+	 *
1848
+	 * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max
1849
+	 * @return Array airport information
1850
+	 *
1851
+	 */
1852 1852
 	public function getAllAirportInfobyCoord($coord)
1853 1853
 	{
1854 1854
 		global $globalDBdriver;
@@ -1881,12 +1881,12 @@  discard block
 block discarded – undo
1881 1881
 	}
1882 1882
 
1883 1883
 	/**
1884
-	* Gets waypoints info based on the coord
1885
-	*
1886
-	* @param Array $coord waypoints coord
1887
-	* @return Array airport information
1888
-	*
1889
-	*/
1884
+	 * Gets waypoints info based on the coord
1885
+	 *
1886
+	 * @param Array $coord waypoints coord
1887
+	 * @return Array airport information
1888
+	 *
1889
+	 */
1890 1890
 	public function getAllWaypointsInfobyCoord($coord)
1891 1891
 	{
1892 1892
 		$lst_countries = '';
@@ -1922,12 +1922,12 @@  discard block
 block discarded – undo
1922 1922
 	
1923 1923
 	
1924 1924
 	/**
1925
-	* Gets the airline info based on the icao code or iata code
1926
-	*
1927
-	* @param String $airline_icao the iata code of the airport
1928
-	* @return Array airport information
1929
-	*
1930
-	*/
1925
+	 * Gets the airline info based on the icao code or iata code
1926
+	 *
1927
+	 * @param String $airline_icao the iata code of the airport
1928
+	 * @return Array airport information
1929
+	 *
1930
+	 */
1931 1931
 	public function getAllAirlineInfo($airline_icao)
1932 1932
 	{
1933 1933
 		$airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING));
@@ -1943,7 +1943,7 @@  discard block
 block discarded – undo
1943 1943
 			
1944 1944
 			$sth = $this->db->prepare($query);
1945 1945
 			$sth->execute(array(':airline_icao' => $airline_icao));
1946
-                        /*
1946
+						/*
1947 1947
 			$airline_array = array();
1948 1948
 			$temp_array = array();
1949 1949
 		
@@ -1966,12 +1966,12 @@  discard block
 block discarded – undo
1966 1966
 	
1967 1967
 	
1968 1968
 	/**
1969
-	* Gets the aircraft info based on the aircraft type
1970
-	*
1971
-	* @param String $aircraft_type the aircraft type
1972
-	* @return Array aircraft information
1973
-	*
1974
-	*/
1969
+	 * Gets the aircraft info based on the aircraft type
1970
+	 *
1971
+	 * @param String $aircraft_type the aircraft type
1972
+	 * @return Array aircraft information
1973
+	 *
1974
+	 */
1975 1975
 	public function getAllAircraftInfo($aircraft_type)
1976 1976
 	{
1977 1977
 		$aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING);
@@ -2003,12 +2003,12 @@  discard block
 block discarded – undo
2003 2003
 	}
2004 2004
 	
2005 2005
 	/**
2006
-	* Gets the aircraft info based on the aircraft ident
2007
-	*
2008
-	* @param String $aircraft_ident the aircraft ident (hex)
2009
-	* @return String aircraft type
2010
-	*
2011
-	*/
2006
+	 * Gets the aircraft info based on the aircraft ident
2007
+	 *
2008
+	 * @param String $aircraft_ident the aircraft ident (hex)
2009
+	 * @return String aircraft type
2010
+	 *
2011
+	 */
2012 2012
 	public function getAllAircraftType($aircraft_modes)
2013 2013
 	{
2014 2014
 		$aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING);
@@ -2025,12 +2025,12 @@  discard block
 block discarded – undo
2025 2025
 	}
2026 2026
 
2027 2027
 	/**
2028
-	* Gets correct aircraft operator corde
2029
-	*
2030
-	* @param String $operator the aircraft operator code (callsign)
2031
-	* @return String aircraft operator code
2032
-	*
2033
-	*/
2028
+	 * Gets correct aircraft operator corde
2029
+	 *
2030
+	 * @param String $operator the aircraft operator code (callsign)
2031
+	 * @return String aircraft operator code
2032
+	 *
2033
+	 */
2034 2034
 	public function getOperator($operator)
2035 2035
 	{
2036 2036
 		$operator = filter_var($operator,FILTER_SANITIZE_STRING);
@@ -2046,16 +2046,16 @@  discard block
 block discarded – undo
2046 2046
 	}
2047 2047
 
2048 2048
 	/**
2049
-	* Gets the aircraft route based on the aircraft callsign
2050
-	*
2051
-	* @param String $callsign the aircraft callsign
2052
-	* @return Array aircraft type
2053
-	*
2054
-	*/
2049
+	 * Gets the aircraft route based on the aircraft callsign
2050
+	 *
2051
+	 * @param String $callsign the aircraft callsign
2052
+	 * @return Array aircraft type
2053
+	 *
2054
+	 */
2055 2055
 	public function getRouteInfo($callsign)
2056 2056
 	{
2057 2057
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
2058
-                if ($callsign == '') return array();
2058
+				if ($callsign == '') return array();
2059 2059
 		$query  = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1";
2060 2060
 		
2061 2061
 		$sth = $this->db->prepare($query);
@@ -2068,12 +2068,12 @@  discard block
 block discarded – undo
2068 2068
 	}
2069 2069
 	
2070 2070
 	/**
2071
-	* Gets the aircraft info based on the aircraft registration
2072
-	*
2073
-	* @param String $aircraft_registration the aircraft registration
2074
-	* @return Array aircraft information
2075
-	*
2076
-	*/
2071
+	 * Gets the aircraft info based on the aircraft registration
2072
+	 *
2073
+	 * @param String $aircraft_registration the aircraft registration
2074
+	 * @return Array aircraft information
2075
+	 *
2076
+	 */
2077 2077
 	public function getAircraftInfoByRegistration($registration)
2078 2078
 	{
2079 2079
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2100,12 +2100,12 @@  discard block
 block discarded – undo
2100 2100
 	}
2101 2101
 	
2102 2102
 	/**
2103
-	* Gets the aircraft owner & base based on the aircraft registration
2104
-	*
2105
-	* @param String $aircraft_registration the aircraft registration
2106
-	* @return Array aircraft information
2107
-	*
2108
-	*/
2103
+	 * Gets the aircraft owner & base based on the aircraft registration
2104
+	 *
2105
+	 * @param String $aircraft_registration the aircraft registration
2106
+	 * @return Array aircraft information
2107
+	 *
2108
+	 */
2109 2109
 	public function getAircraftOwnerByRegistration($registration)
2110 2110
 	{
2111 2111
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -2121,11 +2121,11 @@  discard block
 block discarded – undo
2121 2121
 	
2122 2122
   
2123 2123
   /**
2124
-	* Gets all flights (but with only little info)
2125
-	*
2126
-	* @return Array basic flight information
2127
-	*
2128
-	*/
2124
+   * Gets all flights (but with only little info)
2125
+   *
2126
+   * @return Array basic flight information
2127
+   *
2128
+   */
2129 2129
 	public function getAllFlightsforSitemap()
2130 2130
 	{
2131 2131
 		//$query  = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT ";
@@ -2133,7 +2133,7 @@  discard block
 block discarded – undo
2133 2133
 		
2134 2134
 		$sth = $this->db->prepare($query);
2135 2135
 		$sth->execute();
2136
-                  /*
2136
+				  /*
2137 2137
 		$flight_array = array();
2138 2138
 		$temp_array = array();
2139 2139
 		
@@ -2155,11 +2155,11 @@  discard block
 block discarded – undo
2155 2155
 	}
2156 2156
   
2157 2157
 	/**
2158
-	* Gets a list of all aircraft manufacturers
2159
-	*
2160
-	* @return Array list of aircraft types
2161
-	*
2162
-	*/
2158
+	 * Gets a list of all aircraft manufacturers
2159
+	 *
2160
+	 * @return Array list of aircraft types
2161
+	 *
2162
+	 */
2163 2163
 	public function getAllManufacturers()
2164 2164
 	{
2165 2165
 		/*
@@ -2188,11 +2188,11 @@  discard block
 block discarded – undo
2188 2188
   
2189 2189
   
2190 2190
   /**
2191
-	* Gets a list of all aircraft types
2192
-	*
2193
-	* @return Array list of aircraft types
2194
-	*
2195
-	*/
2191
+   * Gets a list of all aircraft types
2192
+   *
2193
+   * @return Array list of aircraft types
2194
+   *
2195
+   */
2196 2196
 	public function getAllAircraftTypes()
2197 2197
 	{
2198 2198
 		/*
@@ -2224,11 +2224,11 @@  discard block
 block discarded – undo
2224 2224
 	
2225 2225
 	
2226 2226
 	/**
2227
-	* Gets a list of all aircraft registrations
2228
-	*
2229
-	* @return Array list of aircraft registrations
2230
-	*
2231
-	*/
2227
+	 * Gets a list of all aircraft registrations
2228
+	 *
2229
+	 * @return Array list of aircraft registrations
2230
+	 *
2231
+	 */
2232 2232
 	public function getAllAircraftRegistrations()
2233 2233
 	{
2234 2234
 		$query  = "SELECT DISTINCT spotter_output.registration 
@@ -2253,12 +2253,12 @@  discard block
 block discarded – undo
2253 2253
 	}
2254 2254
 
2255 2255
 	/**
2256
-	* Gets all source name
2257
-	*
2258
-	* @param String type format of source
2259
-	* @return Array list of source name
2260
-	*
2261
-	*/
2256
+	 * Gets all source name
2257
+	 *
2258
+	 * @param String type format of source
2259
+	 * @return Array list of source name
2260
+	 *
2261
+	 */
2262 2262
 	public function getAllSourceName($type = '')
2263 2263
 	{
2264 2264
 		$query_values = array();
@@ -2289,11 +2289,11 @@  discard block
 block discarded – undo
2289 2289
 
2290 2290
 
2291 2291
 	/**
2292
-	* Gets a list of all airline names
2293
-	*
2294
-	* @return Array list of airline names
2295
-	*
2296
-	*/
2292
+	 * Gets a list of all airline names
2293
+	 *
2294
+	 * @return Array list of airline names
2295
+	 *
2296
+	 */
2297 2297
 	public function getAllAirlineNames($airline_type = '')
2298 2298
 	{
2299 2299
 		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
@@ -2336,11 +2336,11 @@  discard block
 block discarded – undo
2336 2336
 	
2337 2337
 	
2338 2338
 	/**
2339
-	* Gets a list of all airline countries
2340
-	*
2341
-	* @return Array list of airline countries
2342
-	*
2343
-	*/
2339
+	 * Gets a list of all airline countries
2340
+	 *
2341
+	 * @return Array list of airline countries
2342
+	 *
2343
+	 */
2344 2344
 	public function getAllAirlineCountries()
2345 2345
 	{
2346 2346
 		
@@ -2369,11 +2369,11 @@  discard block
 block discarded – undo
2369 2369
 	
2370 2370
 	
2371 2371
 	/**
2372
-	* Gets a list of all departure & arrival names
2373
-	*
2374
-	* @return Array list of airport names
2375
-	*
2376
-	*/
2372
+	 * Gets a list of all departure & arrival names
2373
+	 *
2374
+	 * @return Array list of airport names
2375
+	 *
2376
+	 */
2377 2377
 	public function getAllAirportNames()
2378 2378
 	{
2379 2379
 		$airport_array = array();
@@ -2424,11 +2424,11 @@  discard block
 block discarded – undo
2424 2424
 	
2425 2425
 	
2426 2426
 	/**
2427
-	* Gets a list of all departure & arrival airport countries
2428
-	*
2429
-	* @return Array list of airport countries
2430
-	*
2431
-	*/
2427
+	 * Gets a list of all departure & arrival airport countries
2428
+	 *
2429
+	 * @return Array list of airport countries
2430
+	 *
2431
+	 */
2432 2432
 	public function getAllAirportCountries()
2433 2433
 	{
2434 2434
 		$airport_array = array();
@@ -2478,11 +2478,11 @@  discard block
 block discarded – undo
2478 2478
 	
2479 2479
 	
2480 2480
 	/**
2481
-	* Gets a list of all countries (airline, departure airport & arrival airport)
2482
-	*
2483
-	* @return Array list of countries
2484
-	*
2485
-	*/
2481
+	 * Gets a list of all countries (airline, departure airport & arrival airport)
2482
+	 *
2483
+	 * @return Array list of countries
2484
+	 *
2485
+	 */
2486 2486
 	public function getAllCountries()
2487 2487
 	{
2488 2488
 		$Connection= new Connection($this->db);
@@ -2566,11 +2566,11 @@  discard block
 block discarded – undo
2566 2566
 	
2567 2567
 	
2568 2568
 	/**
2569
-	* Gets a list of all idents/callsigns
2570
-	*
2571
-	* @return Array list of ident/callsign names
2572
-	*
2573
-	*/
2569
+	 * Gets a list of all idents/callsigns
2570
+	 *
2571
+	 * @return Array list of ident/callsign names
2572
+	 *
2573
+	 */
2574 2574
 	public function getAllIdents()
2575 2575
 	{
2576 2576
 		$query  = "SELECT DISTINCT spotter_output.ident
@@ -2594,9 +2594,9 @@  discard block
 block discarded – undo
2594 2594
 	}
2595 2595
 
2596 2596
 	/**
2597
-	* Get a list of flights from airport since 7 days
2598
-	* @return Array number, icao, name and city of airports
2599
-	*/
2597
+	 * Get a list of flights from airport since 7 days
2598
+	 * @return Array number, icao, name and city of airports
2599
+	 */
2600 2600
 
2601 2601
 	public function getLast7DaysAirportsDeparture($airport_icao = '') {
2602 2602
 		global $globalTimezone, $globalDBdriver;
@@ -2626,9 +2626,9 @@  discard block
 block discarded – undo
2626 2626
 	}
2627 2627
 
2628 2628
 	/**
2629
-	* Get a list of flights from detected airport since 7 days
2630
-	* @return Array number, icao, name and city of airports
2631
-	*/
2629
+	 * Get a list of flights from detected airport since 7 days
2630
+	 * @return Array number, icao, name and city of airports
2631
+	 */
2632 2632
 
2633 2633
 	public function getLast7DaysDetectedAirportsDeparture($airport_icao = '') {
2634 2634
 		global $globalTimezone, $globalDBdriver;
@@ -2669,9 +2669,9 @@  discard block
 block discarded – undo
2669 2669
 	}
2670 2670
 
2671 2671
 	/**
2672
-	* Get a list of flights to airport since 7 days
2673
-	* @return Array number, icao, name and city of airports
2674
-	*/
2672
+	 * Get a list of flights to airport since 7 days
2673
+	 * @return Array number, icao, name and city of airports
2674
+	 */
2675 2675
 
2676 2676
 	public function getLast7DaysAirportsArrival($airport_icao = '') {
2677 2677
 		global $globalTimezone, $globalDBdriver;
@@ -2703,9 +2703,9 @@  discard block
 block discarded – undo
2703 2703
 
2704 2704
 
2705 2705
 	/**
2706
-	* Get a list of flights detected to airport since 7 days
2707
-	* @return Array number, icao, name and city of airports
2708
-	*/
2706
+	 * Get a list of flights detected to airport since 7 days
2707
+	 * @return Array number, icao, name and city of airports
2708
+	 */
2709 2709
 
2710 2710
 	public function getLast7DaysDetectedAirportsArrival($airport_icao = '') {
2711 2711
 		global $globalTimezone, $globalDBdriver;
@@ -2749,11 +2749,11 @@  discard block
 block discarded – undo
2749 2749
 
2750 2750
 
2751 2751
 	/**
2752
-	* Gets a list of all dates
2753
-	*
2754
-	* @return Array list of date names
2755
-	*
2756
-	*/
2752
+	 * Gets a list of all dates
2753
+	 *
2754
+	 * @return Array list of date names
2755
+	 *
2756
+	 */
2757 2757
 	public function getAllDates()
2758 2758
 	{
2759 2759
 		global $globalTimezone, $globalDBdriver;
@@ -2794,11 +2794,11 @@  discard block
 block discarded – undo
2794 2794
 	
2795 2795
 	
2796 2796
 	/**
2797
-	* Gets all route combinations
2798
-	*
2799
-	* @return Array the route list
2800
-	*
2801
-	*/
2797
+	 * Gets all route combinations
2798
+	 *
2799
+	 * @return Array the route list
2800
+	 *
2801
+	 */
2802 2802
 	public function getAllRoutes()
2803 2803
 	{
2804 2804
 		$query  = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ',  spotter_output.arrival_airport_icao) AS route,  spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao 
@@ -2824,13 +2824,13 @@  discard block
 block discarded – undo
2824 2824
 	}
2825 2825
 
2826 2826
 	/**
2827
-	* Update ident spotter data
2828
-	*
2829
-	* @param String $flightaware_id the ID from flightaware
2830
-	* @param String $ident the flight ident
2831
-	* @return String success or false
2832
-	*
2833
-	*/	
2827
+	 * Update ident spotter data
2828
+	 *
2829
+	 * @param String $flightaware_id the ID from flightaware
2830
+	 * @param String $ident the flight ident
2831
+	 * @return String success or false
2832
+	 *
2833
+	 */	
2834 2834
 	public function updateIdentSpotterData($flightaware_id = '', $ident = '')
2835 2835
 	{
2836 2836
 		if (!is_numeric(substr($ident, 0, 3)))
@@ -2851,14 +2851,14 @@  discard block
 block discarded – undo
2851 2851
 		} else {
2852 2852
 			$airline_array = $this->getAllAirlineInfo("NA");
2853 2853
 		}
2854
-                $airline_name = $airline_array[0]['name'];
2855
-                $airline_icao = $airline_array[0]['icao'];
2856
-                $airline_country = $airline_array[0]['country'];
2857
-                $airline_type = $airline_array[0]['type'];
2854
+				$airline_name = $airline_array[0]['name'];
2855
+				$airline_icao = $airline_array[0]['icao'];
2856
+				$airline_country = $airline_array[0]['country'];
2857
+				$airline_type = $airline_array[0]['type'];
2858 2858
 
2859 2859
 
2860 2860
 		$query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id';
2861
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
2861
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type);
2862 2862
 
2863 2863
 		try {
2864 2864
 			$sth = $this->db->prepare($query);
@@ -2871,21 +2871,21 @@  discard block
 block discarded – undo
2871 2871
 
2872 2872
 	}
2873 2873
 	/**
2874
-	* Update latest spotter data
2875
-	*
2876
-	* @param String $flightaware_id the ID from flightaware
2877
-	* @param String $ident the flight ident
2878
-	* @param String $aircraft_icao the aircraft type
2879
-	* @param String $departure_airport_icao the departure airport
2880
-	* @param String $arrival_airport_icao the arrival airport
2881
-	* @return String success or false
2882
-	*
2883
-	*/	
2874
+	 * Update latest spotter data
2875
+	 *
2876
+	 * @param String $flightaware_id the ID from flightaware
2877
+	 * @param String $ident the flight ident
2878
+	 * @param String $aircraft_icao the aircraft type
2879
+	 * @param String $departure_airport_icao the departure airport
2880
+	 * @param String $arrival_airport_icao the arrival airport
2881
+	 * @return String success or false
2882
+	 *
2883
+	 */	
2884 2884
 	public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '')
2885 2885
 	{
2886 2886
 		if ($groundspeed == '') $groundspeed = NULL;
2887 2887
 		$query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id';
2888
-                $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
2888
+				$query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident);
2889 2889
 
2890 2890
 		try {
2891 2891
 			$sth = $this->db->prepare($query);
@@ -2899,16 +2899,16 @@  discard block
 block discarded – undo
2899 2899
 	}
2900 2900
 
2901 2901
 	/**
2902
-	* Adds a new spotter data
2903
-	*
2904
-	* @param String $flightaware_id the ID from flightaware
2905
-	* @param String $ident the flight ident
2906
-	* @param String $aircraft_icao the aircraft type
2907
-	* @param String $departure_airport_icao the departure airport
2908
-	* @param String $arrival_airport_icao the arrival airport
2909
-	* @return String success or false
2910
-	*
2911
-	*/
2902
+	 * Adds a new spotter data
2903
+	 *
2904
+	 * @param String $flightaware_id the ID from flightaware
2905
+	 * @param String $ident the flight ident
2906
+	 * @param String $aircraft_icao the aircraft type
2907
+	 * @param String $departure_airport_icao the departure airport
2908
+	 * @param String $arrival_airport_icao the arrival airport
2909
+	 * @return String success or false
2910
+	 *
2911
+	 */
2912 2912
 	public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '')
2913 2913
 	{
2914 2914
 		global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed;
@@ -3113,8 +3113,8 @@  discard block
 block discarded – undo
3113 3113
     
3114 3114
 		if ($globalIVAO && $aircraft_icao != '')
3115 3115
 		{
3116
-            		if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3117
-            		else $airline_icao = '';
3116
+					if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao'];
3117
+					else $airline_icao = '';
3118 3118
 			$image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao);
3119 3119
 			if (!isset($image_array[0]['registration']))
3120 3120
 			{
@@ -3145,49 +3145,49 @@  discard block
 block discarded – undo
3145 3145
 	
3146 3146
 		if (count($airline_array) == 0) 
3147 3147
 		{
3148
-                        $airline_array = $this->getAllAirlineInfo('NA');
3149
-                }
3150
-                if (count($aircraft_array) == 0) 
3151
-                {
3152
-                        $aircraft_array = $this->getAllAircraftInfo('NA');
3153
-                }
3154
-                if (count($departure_airport_array) == 0) 
3155
-                {
3156
-                        $departure_airport_array = $this->getAllAirportInfo('NA');
3157
-                }
3158
-                if (count($arrival_airport_array) == 0) 
3159
-                {
3160
-                        $arrival_airport_array = $this->getAllAirportInfo('NA');
3161
-                }
3162
-                if ($registration == '') $registration = 'NA';
3163
-                if ($squawk == '' || $Common->isInteger($squawk) == false) $squawk = NULL;
3164
-                if ($verticalrate == '' || $Common->isInteger($verticalrate) == false) $verticalrate = NULL;
3165
-                if ($heading == '' || $Common->isInteger($heading) == false) $heading = 0;
3166
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) == false) $groundspeed = 0;
3167
-                if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3168
-                $query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3148
+						$airline_array = $this->getAllAirlineInfo('NA');
3149
+				}
3150
+				if (count($aircraft_array) == 0) 
3151
+				{
3152
+						$aircraft_array = $this->getAllAircraftInfo('NA');
3153
+				}
3154
+				if (count($departure_airport_array) == 0) 
3155
+				{
3156
+						$departure_airport_array = $this->getAllAirportInfo('NA');
3157
+				}
3158
+				if (count($arrival_airport_array) == 0) 
3159
+				{
3160
+						$arrival_airport_array = $this->getAllAirportInfo('NA');
3161
+				}
3162
+				if ($registration == '') $registration = 'NA';
3163
+				if ($squawk == '' || $Common->isInteger($squawk) == false) $squawk = NULL;
3164
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) == false) $verticalrate = NULL;
3165
+				if ($heading == '' || $Common->isInteger($heading) == false) $heading = 0;
3166
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) == false) $groundspeed = 0;
3167
+				if (!isset($aircraft_owner)) $aircraft_owner = NULL;
3168
+				$query  = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) 
3169 3169
                 VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)";
3170 3170
 
3171
-                $airline_name = $airline_array[0]['name'];
3172
-                $airline_icao = $airline_array[0]['icao'];
3173
-                $airline_country = $airline_array[0]['country'];
3174
-                $airline_type = $airline_array[0]['type'];
3171
+				$airline_name = $airline_array[0]['name'];
3172
+				$airline_icao = $airline_array[0]['icao'];
3173
+				$airline_country = $airline_array[0]['country'];
3174
+				$airline_type = $airline_array[0]['type'];
3175 3175
 		if ($airline_type == '') {
3176 3176
 			$timeelapsed = microtime(true);
3177 3177
 			$airline_type = $this->getAircraftTypeBymodeS($ModeS);
3178 3178
 			if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
3179 3179
 		}
3180 3180
 		if ($airline_type == null) $airline_type = '';
3181
-                $aircraft_type = $aircraft_array[0]['type'];
3182
-                $aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3183
-                $departure_airport_name = $departure_airport_array[0]['name'];
3184
-                $departure_airport_city = $departure_airport_array[0]['city'];
3185
-                $departure_airport_country = $departure_airport_array[0]['country'];
3186
-                $arrival_airport_icao = $arrival_airport_icao;
3187
-                $arrival_airport_name = $arrival_airport_array[0]['name'];
3188
-                $arrival_airport_city = $arrival_airport_array[0]['city'];
3189
-                $arrival_airport_country = $arrival_airport_array[0]['country'];
3190
-                $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3181
+				$aircraft_type = $aircraft_array[0]['type'];
3182
+				$aircraft_manufacturer = $aircraft_array[0]['manufacturer'];
3183
+				$departure_airport_name = $departure_airport_array[0]['name'];
3184
+				$departure_airport_city = $departure_airport_array[0]['city'];
3185
+				$departure_airport_country = $departure_airport_array[0]['country'];
3186
+				$arrival_airport_icao = $arrival_airport_icao;
3187
+				$arrival_airport_name = $arrival_airport_array[0]['name'];
3188
+				$arrival_airport_city = $arrival_airport_array[0]['city'];
3189
+				$arrival_airport_country = $arrival_airport_array[0]['country'];
3190
+				$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name);
3191 3191
 
3192 3192
 		try {
3193 3193
 		        
@@ -3195,7 +3195,7 @@  discard block
 block discarded – undo
3195 3195
 			$sth->execute($query_values);
3196 3196
 			$this->db = null;
3197 3197
 		} catch (PDOException $e) {
3198
-		    return "error : ".$e->getMessage();
3198
+			return "error : ".$e->getMessage();
3199 3199
 		}
3200 3200
 		
3201 3201
 		return "success";
@@ -3204,11 +3204,11 @@  discard block
 block discarded – undo
3204 3204
 	
3205 3205
   
3206 3206
   /**
3207
-	* Gets the aircraft ident within the last hour
3208
-	*
3209
-	* @return String the ident
3210
-	*
3211
-	*/
3207
+   * Gets the aircraft ident within the last hour
3208
+   *
3209
+   * @return String the ident
3210
+   *
3211
+   */
3212 3212
 	public function getIdentFromLastHour($ident)
3213 3213
 	{
3214 3214
 		global $globalDBdriver, $globalTimezone;
@@ -3224,11 +3224,11 @@  discard block
 block discarded – undo
3224 3224
 								AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
3225 3225
 								AND spotter_output.date < now() AT TIME ZONE 'UTC'";
3226 3226
 			$query_data = array(':ident' => $ident);
3227
-    		}
3227
+			}
3228 3228
 		
3229 3229
 		$sth = $this->db->prepare($query);
3230 3230
 		$sth->execute($query_data);
3231
-    		$ident_result='';
3231
+			$ident_result='';
3232 3232
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3233 3233
 		{
3234 3234
 			$ident_result = $row['ident'];
@@ -3239,11 +3239,11 @@  discard block
 block discarded – undo
3239 3239
 	
3240 3240
 	
3241 3241
 	/**
3242
-	* Gets the aircraft data from the last 20 seconds
3243
-	*
3244
-	* @return Array the spotter data
3245
-	*
3246
-	*/
3242
+	 * Gets the aircraft data from the last 20 seconds
3243
+	 *
3244
+	 * @return Array the spotter data
3245
+	 *
3246
+	 */
3247 3247
 	public function getRealTimeData($q = '')
3248 3248
 	{
3249 3249
 		global $globalDBdriver;
@@ -3287,75 +3287,75 @@  discard block
 block discarded – undo
3287 3287
 	
3288 3288
 	
3289 3289
 	 /**
3290
-	* Gets all airlines that have flown over
3291
-	*
3292
-	* @return Array the airline list
3293
-	*
3294
-	*/
3290
+	  * Gets all airlines that have flown over
3291
+	  *
3292
+	  * @return Array the airline list
3293
+	  *
3294
+	  */
3295 3295
 	public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
3296 3296
 	{
3297 3297
 		global $globalDBdriver;
3298 3298
 		$query  = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count
3299 3299
 		 			FROM spotter_output
3300 3300
 					WHERE spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' ";
3301
-                if ($olderthanmonths > 0) {
3302
-            		if ($globalDBdriver == 'mysql') {
3301
+				if ($olderthanmonths > 0) {
3302
+					if ($globalDBdriver == 'mysql') {
3303 3303
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3304 3304
 			} else {
3305 3305
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3306 3306
 			}
3307 3307
 		}
3308
-                if ($sincedate != '') {
3309
-            		if ($globalDBdriver == 'mysql') {
3308
+				if ($sincedate != '') {
3309
+					if ($globalDBdriver == 'mysql') {
3310 3310
 				$query .= "AND date > '".$sincedate."' ";
3311 3311
 			} else {
3312 3312
 				$query .= "AND date > CAST('".$sincedate."' AS TIMESTAMP)";
3313 3313
 			}
3314 3314
 		}
3315
-        	$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3315
+			$query .= "GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC";
3316 3316
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3317 3317
       
3318 3318
 		
3319 3319
 		$sth = $this->db->prepare($query);
3320 3320
 		$sth->execute();
3321 3321
       
3322
-        $airline_array = array();
3322
+		$airline_array = array();
3323 3323
 		$temp_array = array();
3324 3324
         
3325 3325
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
3326 3326
 		{
3327 3327
 			$temp_array['airline_name'] = $row['airline_name'];
3328
-            $temp_array['airline_icao'] = $row['airline_icao'];
3329
-            $temp_array['airline_count'] = $row['airline_count'];
3330
-            $temp_array['airline_country'] = $row['airline_country'];
3328
+			$temp_array['airline_icao'] = $row['airline_icao'];
3329
+			$temp_array['airline_count'] = $row['airline_count'];
3330
+			$temp_array['airline_country'] = $row['airline_country'];
3331 3331
           
3332
-            $airline_array[] = $temp_array;
3332
+			$airline_array[] = $temp_array;
3333 3333
 		}
3334 3334
 
3335 3335
 		return $airline_array;
3336 3336
 	}
3337 3337
 
3338 3338
 	 /**
3339
-	* Gets all pilots that have flown over
3340
-	*
3341
-	* @return Array the pilots list
3342
-	*
3343
-	*/
3339
+	  * Gets all pilots that have flown over
3340
+	  *
3341
+	  * @return Array the pilots list
3342
+	  *
3343
+	  */
3344 3344
 	public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '')
3345 3345
 	{
3346 3346
 		global $globalDBdriver;
3347 3347
 		$query  = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count
3348 3348
 		 			FROM spotter_output
3349 3349
 					WHERE spotter_output.pilot_id <> '' ";
3350
-                if ($olderthanmonths > 0) {
3351
-            		if ($globalDBdriver == 'mysql') {
3350
+				if ($olderthanmonths > 0) {
3351
+					if ($globalDBdriver == 'mysql') {
3352 3352
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3353 3353
 			} else {
3354 3354
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3355 3355
 			}
3356 3356
 		}
3357
-                if ($sincedate != '') {
3358
-            		if ($globalDBdriver == 'mysql') {
3357
+				if ($sincedate != '') {
3358
+					if ($globalDBdriver == 'mysql') {
3359 3359
 				$query .= "AND date > '".$sincedate."' ";
3360 3360
 			} else {
3361 3361
 				$query .= "AND date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -3382,11 +3382,11 @@  discard block
 block discarded – undo
3382 3382
 	}
3383 3383
 	
3384 3384
 	 /**
3385
-	* Gets all owner that have flown over
3386
-	*
3387
-	* @return Array the pilots list
3388
-	*
3389
-	*/
3385
+	  * Gets all owner that have flown over
3386
+	  *
3387
+	  * @return Array the pilots list
3388
+	  *
3389
+	  */
3390 3390
 	public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '')
3391 3391
 	{
3392 3392
 		global $globalDBdriver;
@@ -3414,11 +3414,11 @@  discard block
 block discarded – undo
3414 3414
 	
3415 3415
 	
3416 3416
 	/**
3417
-	* Gets all airlines that have flown over by aircraft
3418
-	*
3419
-	* @return Array the airline list
3420
-	*
3421
-	*/
3417
+	 * Gets all airlines that have flown over by aircraft
3418
+	 *
3419
+	 * @return Array the airline list
3420
+	 *
3421
+	 */
3422 3422
 	public function countAllAirlinesByAircraft($aircraft_icao)
3423 3423
 	{
3424 3424
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3451,11 +3451,11 @@  discard block
 block discarded – undo
3451 3451
 
3452 3452
 
3453 3453
 	/**
3454
-	* Gets all airline countries that have flown over by aircraft
3455
-	*
3456
-	* @return Array the airline country list
3457
-	*
3458
-	*/
3454
+	 * Gets all airline countries that have flown over by aircraft
3455
+	 *
3456
+	 * @return Array the airline country list
3457
+	 *
3458
+	 */
3459 3459
 	public function countAllAirlineCountriesByAircraft($aircraft_icao)
3460 3460
 	{
3461 3461
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -3488,11 +3488,11 @@  discard block
 block discarded – undo
3488 3488
 	
3489 3489
 	
3490 3490
 	/**
3491
-	* Gets all airlines that have flown over by airport
3492
-	*
3493
-	* @return Array the airline list
3494
-	*
3495
-	*/
3491
+	 * Gets all airlines that have flown over by airport
3492
+	 *
3493
+	 * @return Array the airline list
3494
+	 *
3495
+	 */
3496 3496
 	public function countAllAirlinesByAirport($airport_icao)
3497 3497
 	{
3498 3498
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3524,11 +3524,11 @@  discard block
 block discarded – undo
3524 3524
 
3525 3525
 
3526 3526
 	/**
3527
-	* Gets all airline countries that have flown over by airport icao
3528
-	*
3529
-	* @return Array the airline country list
3530
-	*
3531
-	*/
3527
+	 * Gets all airline countries that have flown over by airport icao
3528
+	 *
3529
+	 * @return Array the airline country list
3530
+	 *
3531
+	 */
3532 3532
 	public function countAllAirlineCountriesByAirport($airport_icao)
3533 3533
 	{
3534 3534
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -3559,11 +3559,11 @@  discard block
 block discarded – undo
3559 3559
 
3560 3560
 
3561 3561
 	/**
3562
-	* Gets all airlines that have flown over by aircraft manufacturer
3563
-	*
3564
-	* @return Array the airline list
3565
-	*
3566
-	*/
3562
+	 * Gets all airlines that have flown over by aircraft manufacturer
3563
+	 *
3564
+	 * @return Array the airline list
3565
+	 *
3566
+	 */
3567 3567
 	public function countAllAirlinesByManufacturer($aircraft_manufacturer)
3568 3568
 	{
3569 3569
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -3595,11 +3595,11 @@  discard block
 block discarded – undo
3595 3595
 
3596 3596
 
3597 3597
 	/**
3598
-	* Gets all airline countries that have flown over by aircraft manufacturer
3599
-	*
3600
-	* @return Array the airline country list
3601
-	*
3602
-	*/
3598
+	 * Gets all airline countries that have flown over by aircraft manufacturer
3599
+	 *
3600
+	 * @return Array the airline country list
3601
+	 *
3602
+	 */
3603 3603
 	public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer)
3604 3604
 	{
3605 3605
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -3629,11 +3629,11 @@  discard block
 block discarded – undo
3629 3629
 
3630 3630
 
3631 3631
 	/**
3632
-	* Gets all airlines that have flown over by date
3633
-	*
3634
-	* @return Array the airline list
3635
-	*
3636
-	*/
3632
+	 * Gets all airlines that have flown over by date
3633
+	 *
3634
+	 * @return Array the airline list
3635
+	 *
3636
+	 */
3637 3637
 	public function countAllAirlinesByDate($date)
3638 3638
 	{
3639 3639
 		global $globalTimezone, $globalDBdriver;
@@ -3679,11 +3679,11 @@  discard block
 block discarded – undo
3679 3679
 	
3680 3680
 	
3681 3681
 	/**
3682
-	* Gets all airline countries that have flown over by date
3683
-	*
3684
-	* @return Array the airline country list
3685
-	*
3686
-	*/
3682
+	 * Gets all airline countries that have flown over by date
3683
+	 *
3684
+	 * @return Array the airline country list
3685
+	 *
3686
+	 */
3687 3687
 	public function countAllAirlineCountriesByDate($date)
3688 3688
 	{
3689 3689
 		global $globalTimezone, $globalDBdriver;
@@ -3727,11 +3727,11 @@  discard block
 block discarded – undo
3727 3727
 
3728 3728
 
3729 3729
 	/**
3730
-	* Gets all airlines that have flown over by ident/callsign
3731
-	*
3732
-	* @return Array the airline list
3733
-	*
3734
-	*/
3730
+	 * Gets all airlines that have flown over by ident/callsign
3731
+	 *
3732
+	 * @return Array the airline list
3733
+	 *
3734
+	 */
3735 3735
 	public function countAllAirlinesByIdent($ident)
3736 3736
 	{
3737 3737
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -3762,11 +3762,11 @@  discard block
 block discarded – undo
3762 3762
 	}
3763 3763
 
3764 3764
 	/**
3765
-	* Gets all airlines that have flown over by route
3766
-	*
3767
-	* @return Array the airline list
3768
-	*
3769
-	*/
3765
+	 * Gets all airlines that have flown over by route
3766
+	 *
3767
+	 * @return Array the airline list
3768
+	 *
3769
+	 */
3770 3770
 	public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao)
3771 3771
 	{
3772 3772
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -3798,11 +3798,11 @@  discard block
 block discarded – undo
3798 3798
 	}
3799 3799
 
3800 3800
 	/**
3801
-	* Gets all airline countries that have flown over by route
3802
-	*
3803
-	* @return Array the airline country list
3804
-	*
3805
-	*/
3801
+	 * Gets all airline countries that have flown over by route
3802
+	 *
3803
+	 * @return Array the airline country list
3804
+	 *
3805
+	 */
3806 3806
 	public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao)
3807 3807
 	{
3808 3808
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -3834,11 +3834,11 @@  discard block
 block discarded – undo
3834 3834
 
3835 3835
 
3836 3836
 	/**
3837
-	* Gets all airlines that have flown over by country
3838
-	*
3839
-	* @return Array the airline list
3840
-	*
3841
-	*/
3837
+	 * Gets all airlines that have flown over by country
3838
+	 *
3839
+	 * @return Array the airline list
3840
+	 *
3841
+	 */
3842 3842
 	public function countAllAirlinesByCountry($country)
3843 3843
 	{
3844 3844
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -3869,11 +3869,11 @@  discard block
 block discarded – undo
3869 3869
 
3870 3870
 
3871 3871
 	/**
3872
-	* Gets all airline countries that have flown over by country
3873
-	*
3874
-	* @return Array the airline country list
3875
-	*
3876
-	*/
3872
+	 * Gets all airline countries that have flown over by country
3873
+	 *
3874
+	 * @return Array the airline country list
3875
+	 *
3876
+	 */
3877 3877
 	public function countAllAirlineCountriesByCountry($country)
3878 3878
 	{
3879 3879
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -3903,11 +3903,11 @@  discard block
 block discarded – undo
3903 3903
 
3904 3904
 
3905 3905
 	/**
3906
-	* Gets all airlines countries
3907
-	*
3908
-	* @return Array the airline country list
3909
-	*
3910
-	*/
3906
+	 * Gets all airlines countries
3907
+	 *
3908
+	 * @return Array the airline country list
3909
+	 *
3910
+	 */
3911 3911
 	public function countAllAirlineCountries($limit = true)
3912 3912
 	{
3913 3913
 		$query  = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count
@@ -3933,11 +3933,11 @@  discard block
 block discarded – undo
3933 3933
 	}
3934 3934
 
3935 3935
 	/**
3936
-	* Gets all number of flight over countries
3937
-	*
3938
-	* @return Array the airline country list
3939
-	*
3940
-	*/
3936
+	 * Gets all number of flight over countries
3937
+	 *
3938
+	 * @return Array the airline country list
3939
+	 *
3940
+	 */
3941 3941
 	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
3942 3942
 	{
3943 3943
 		global $globalDBdriver;
@@ -3949,14 +3949,14 @@  discard block
 block discarded – undo
3949 3949
 		$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
3950 3950
 					FROM countries c, spotter_live s
3951 3951
 					WHERE c.iso2 = s.over_country ";
3952
-                if ($olderthanmonths > 0) {
3952
+				if ($olderthanmonths > 0) {
3953 3953
 			if ($globalDBdriver == 'mysql') {
3954 3954
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
3955 3955
 			} else {
3956 3956
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
3957 3957
 			}
3958 3958
 		}
3959
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
3959
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
3960 3960
 		$query .= "GROUP BY c.name ORDER BY nb DESC";
3961 3961
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
3962 3962
       
@@ -3980,35 +3980,35 @@  discard block
 block discarded – undo
3980 3980
 	
3981 3981
 	
3982 3982
 	/**
3983
-	* Gets all aircraft types that have flown over
3984
-	*
3985
-	* @return Array the aircraft list
3986
-	*
3987
-	*/
3983
+	 * Gets all aircraft types that have flown over
3984
+	 *
3985
+	 * @return Array the aircraft list
3986
+	 *
3987
+	 */
3988 3988
 	public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '')
3989 3989
 	{
3990 3990
 		global $globalDBdriver;
3991 3991
 		$query  = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name  
3992 3992
                     FROM spotter_output
3993 3993
                     WHERE spotter_output.aircraft_name  <> '' AND spotter_output.aircraft_icao  <> '' ";
3994
-                if ($olderthanmonths > 0) {
3995
-            		if ($globalDBdriver == 'mysql') {
3994
+				if ($olderthanmonths > 0) {
3995
+					if ($globalDBdriver == 'mysql') {
3996 3996
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
3997 3997
 			} else {
3998 3998
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
3999 3999
 			}
4000
-                }
4001
-                if ($sincedate != '') {
4002
-            		if ($globalDBdriver == 'mysql') {
4000
+				}
4001
+				if ($sincedate != '') {
4002
+					if ($globalDBdriver == 'mysql') {
4003 4003
 				$query .= "AND date > '".$sincedate."' ";
4004 4004
 			} else {
4005 4005
 				$query .= "AND date > CAST('".$sincedate."' AS TIMESTAMP)";
4006 4006
 			}
4007 4007
 		}
4008 4008
 
4009
-                //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4010
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
4011
-                $query .= "GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name ORDER BY aircraft_icao_count DESC";
4009
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4010
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
4011
+				$query .= "GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name ORDER BY aircraft_icao_count DESC";
4012 4012
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4013 4013
       
4014 4014
 		
@@ -4031,11 +4031,11 @@  discard block
 block discarded – undo
4031 4031
 
4032 4032
 
4033 4033
 	/**
4034
-	* Gets all aircraft registration that have flown over by aircaft icao
4035
-	*
4036
-	* @return Array the aircraft list
4037
-	*
4038
-	*/
4034
+	 * Gets all aircraft registration that have flown over by aircaft icao
4035
+	 *
4036
+	 * @return Array the aircraft list
4037
+	 *
4038
+	 */
4039 4039
 	public function countAllAircraftRegistrationByAircraft($aircraft_icao)
4040 4040
 	{
4041 4041
 		$Image = new Image($this->db);
@@ -4074,11 +4074,11 @@  discard block
 block discarded – undo
4074 4074
 
4075 4075
 
4076 4076
 	/**
4077
-	* Gets all aircraft types that have flown over by airline icao
4078
-	*
4079
-	* @return Array the aircraft list
4080
-	*
4081
-	*/
4077
+	 * Gets all aircraft types that have flown over by airline icao
4078
+	 *
4079
+	 * @return Array the aircraft list
4080
+	 *
4081
+	 */
4082 4082
 	public function countAllAircraftTypesByAirline($airline_icao)
4083 4083
 	{
4084 4084
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -4108,11 +4108,11 @@  discard block
 block discarded – undo
4108 4108
 
4109 4109
 
4110 4110
 	/**
4111
-	* Gets all aircraft registration that have flown over by airline icao
4112
-	*
4113
-	* @return Array the aircraft list
4114
-	*
4115
-	*/
4111
+	 * Gets all aircraft registration that have flown over by airline icao
4112
+	 *
4113
+	 * @return Array the aircraft list
4114
+	 *
4115
+	 */
4116 4116
 	public function countAllAircraftRegistrationByAirline($airline_icao)
4117 4117
 	{
4118 4118
 		$Image = new Image($this->db);
@@ -4150,11 +4150,11 @@  discard block
 block discarded – undo
4150 4150
 
4151 4151
 
4152 4152
 	/**
4153
-	* Gets all aircraft manufacturer that have flown over by airline icao
4154
-	*
4155
-	* @return Array the aircraft list
4156
-	*
4157
-	*/
4153
+	 * Gets all aircraft manufacturer that have flown over by airline icao
4154
+	 *
4155
+	 * @return Array the aircraft list
4156
+	 *
4157
+	 */
4158 4158
 	public function countAllAircraftManufacturerByAirline($airline_icao)
4159 4159
 	{
4160 4160
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -4183,11 +4183,11 @@  discard block
 block discarded – undo
4183 4183
 
4184 4184
 
4185 4185
 	/**
4186
-	* Gets all aircraft types that have flown over by airline icao
4187
-	*
4188
-	* @return Array the aircraft list
4189
-	*
4190
-	*/
4186
+	 * Gets all aircraft types that have flown over by airline icao
4187
+	 *
4188
+	 * @return Array the aircraft list
4189
+	 *
4190
+	 */
4191 4191
 	public function countAllAircraftTypesByAirport($airport_icao)
4192 4192
 	{
4193 4193
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4216,11 +4216,11 @@  discard block
 block discarded – undo
4216 4216
 
4217 4217
 
4218 4218
 	/**
4219
-	* Gets all aircraft registration that have flown over by airport icao
4220
-	*
4221
-	* @return Array the aircraft list
4222
-	*
4223
-	*/
4219
+	 * Gets all aircraft registration that have flown over by airport icao
4220
+	 *
4221
+	 * @return Array the aircraft list
4222
+	 *
4223
+	 */
4224 4224
 	public function countAllAircraftRegistrationByAirport($airport_icao)
4225 4225
 	{
4226 4226
 		$Image = new Image($this->db);
@@ -4236,24 +4236,24 @@  discard block
 block discarded – undo
4236 4236
 		$sth = $this->db->prepare($query);
4237 4237
 		$sth->execute(array(':airport_icao' => $airport_icao));
4238 4238
       
4239
-        $aircraft_array = array();
4239
+		$aircraft_array = array();
4240 4240
 		$temp_array = array();
4241 4241
         
4242
-        while($row = $sth->fetch(PDO::FETCH_ASSOC))
4242
+		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4243 4243
 		{
4244 4244
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4245 4245
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4246 4246
 			$temp_array['registration'] = $row['registration'];
4247
-            $temp_array['airline_name'] = $row['airline_name'];
4247
+			$temp_array['airline_name'] = $row['airline_name'];
4248 4248
 			$temp_array['image_thumbnail'] = "";
4249
-            if($row['registration'] != "")
4250
-              {
4251
-                  $image_array = $Image->getSpotterImage($row['registration']);
4252
-                  $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4253
-              }
4254
-            $temp_array['registration_count'] = $row['registration_count'];
4249
+			if($row['registration'] != "")
4250
+			  {
4251
+				  $image_array = $Image->getSpotterImage($row['registration']);
4252
+				  $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4253
+			  }
4254
+			$temp_array['registration_count'] = $row['registration_count'];
4255 4255
           
4256
-            $aircraft_array[] = $temp_array;
4256
+			$aircraft_array[] = $temp_array;
4257 4257
 		}
4258 4258
 
4259 4259
 		return $aircraft_array;
@@ -4261,11 +4261,11 @@  discard block
 block discarded – undo
4261 4261
 	
4262 4262
 	
4263 4263
 	/**
4264
-	* Gets all aircraft manufacturer that have flown over by airport icao
4265
-	*
4266
-	* @return Array the aircraft list
4267
-	*
4268
-	*/
4264
+	 * Gets all aircraft manufacturer that have flown over by airport icao
4265
+	 *
4266
+	 * @return Array the aircraft list
4267
+	 *
4268
+	 */
4269 4269
 	public function countAllAircraftManufacturerByAirport($airport_icao)
4270 4270
 	{
4271 4271
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -4280,15 +4280,15 @@  discard block
 block discarded – undo
4280 4280
 		$sth = $this->db->prepare($query);
4281 4281
 		$sth->execute(array(':airport_icao' => $airport_icao));
4282 4282
       
4283
-    $aircraft_array = array();
4283
+	$aircraft_array = array();
4284 4284
 		$temp_array = array();
4285 4285
         
4286
-    while($row = $sth->fetch(PDO::FETCH_ASSOC))
4286
+	while($row = $sth->fetch(PDO::FETCH_ASSOC))
4287 4287
 		{
4288 4288
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4289 4289
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
4290 4290
           
4291
-      $aircraft_array[] = $temp_array;
4291
+	  $aircraft_array[] = $temp_array;
4292 4292
 		}
4293 4293
 
4294 4294
 		return $aircraft_array;
@@ -4297,11 +4297,11 @@  discard block
 block discarded – undo
4297 4297
 	
4298 4298
 	
4299 4299
 	/**
4300
-	* Gets all aircraft types that have flown over by aircraft manufacturer
4301
-	*
4302
-	* @return Array the aircraft list
4303
-	*
4304
-	*/
4300
+	 * Gets all aircraft types that have flown over by aircraft manufacturer
4301
+	 *
4302
+	 * @return Array the aircraft list
4303
+	 *
4304
+	 */
4305 4305
 	public function countAllAircraftTypesByManufacturer($aircraft_manufacturer)
4306 4306
 	{
4307 4307
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -4316,16 +4316,16 @@  discard block
 block discarded – undo
4316 4316
 		$sth = $this->db->prepare($query);
4317 4317
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4318 4318
       
4319
-        $aircraft_array = array();
4319
+		$aircraft_array = array();
4320 4320
 		$temp_array = array();
4321 4321
         
4322
-        while($row = $sth->fetch(PDO::FETCH_ASSOC))
4322
+		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4323 4323
 		{
4324 4324
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4325 4325
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4326
-            $temp_array['aircraft_icao_count'] = $row['aircraft_icao_count'];
4326
+			$temp_array['aircraft_icao_count'] = $row['aircraft_icao_count'];
4327 4327
           
4328
-            $aircraft_array[] = $temp_array;
4328
+			$aircraft_array[] = $temp_array;
4329 4329
 		}
4330 4330
 
4331 4331
 		return $aircraft_array;
@@ -4333,11 +4333,11 @@  discard block
 block discarded – undo
4333 4333
 	
4334 4334
 	
4335 4335
 	/**
4336
-	* Gets all aircraft registration that have flown over by aircaft manufacturer
4337
-	*
4338
-	* @return Array the aircraft list
4339
-	*
4340
-	*/
4336
+	 * Gets all aircraft registration that have flown over by aircaft manufacturer
4337
+	 *
4338
+	 * @return Array the aircraft list
4339
+	 *
4340
+	 */
4341 4341
 	public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer)
4342 4342
 	{
4343 4343
 		$Image = new Image($this->db);
@@ -4353,24 +4353,24 @@  discard block
 block discarded – undo
4353 4353
 		$sth = $this->db->prepare($query);
4354 4354
 		$sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer));
4355 4355
       
4356
-        $aircraft_array = array();
4356
+		$aircraft_array = array();
4357 4357
 		$temp_array = array();
4358 4358
         
4359
-        while($row = $sth->fetch(PDO::FETCH_ASSOC))
4359
+		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4360 4360
 		{
4361 4361
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4362 4362
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4363 4363
 			$temp_array['registration'] = $row['registration'];
4364
-            $temp_array['airline_name'] = $row['airline_name'];
4364
+			$temp_array['airline_name'] = $row['airline_name'];
4365 4365
 			$temp_array['image_thumbnail'] = "";
4366
-            if($row['registration'] != "")
4367
-              {
4368
-                  $image_array = $Image->getSpotterImage($row['registration']);
4369
-                  $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4370
-              }
4371
-            $temp_array['registration_count'] = $row['registration_count'];
4366
+			if($row['registration'] != "")
4367
+			  {
4368
+				  $image_array = $Image->getSpotterImage($row['registration']);
4369
+				  $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail'];
4370
+			  }
4371
+			$temp_array['registration_count'] = $row['registration_count'];
4372 4372
           
4373
-            $aircraft_array[] = $temp_array;
4373
+			$aircraft_array[] = $temp_array;
4374 4374
 		}
4375 4375
 
4376 4376
 		return $aircraft_array;
@@ -4379,11 +4379,11 @@  discard block
 block discarded – undo
4379 4379
 	
4380 4380
 	
4381 4381
 	/**
4382
-	* Gets all aircraft types that have flown over by date
4383
-	*
4384
-	* @return Array the aircraft list
4385
-	*
4386
-	*/
4382
+	 * Gets all aircraft types that have flown over by date
4383
+	 *
4384
+	 * @return Array the aircraft list
4385
+	 *
4386
+	 */
4387 4387
 	public function countAllAircraftTypesByDate($date)
4388 4388
 	{
4389 4389
 		global $globalTimezone, $globalDBdriver;
@@ -4426,11 +4426,11 @@  discard block
 block discarded – undo
4426 4426
 
4427 4427
 
4428 4428
 	/**
4429
-	* Gets all aircraft registration that have flown over by date
4430
-	*
4431
-	* @return Array the aircraft list
4432
-	*
4433
-	*/
4429
+	 * Gets all aircraft registration that have flown over by date
4430
+	 *
4431
+	 * @return Array the aircraft list
4432
+	 *
4433
+	 */
4434 4434
 	public function countAllAircraftRegistrationByDate($date)
4435 4435
 	{
4436 4436
 		global $globalTimezone, $globalDBdriver;
@@ -4482,11 +4482,11 @@  discard block
 block discarded – undo
4482 4482
 
4483 4483
 
4484 4484
 	/**
4485
-	* Gets all aircraft manufacturer that have flown over by date
4486
-	*
4487
-	* @return Array the aircraft manufacturer list
4488
-	*
4489
-	*/
4485
+	 * Gets all aircraft manufacturer that have flown over by date
4486
+	 *
4487
+	 * @return Array the aircraft manufacturer list
4488
+	 *
4489
+	 */
4490 4490
 	public function countAllAircraftManufacturerByDate($date)
4491 4491
 	{
4492 4492
 		global $globalTimezone, $globalDBdriver;
@@ -4529,11 +4529,11 @@  discard block
 block discarded – undo
4529 4529
 
4530 4530
 
4531 4531
 	/**
4532
-	* Gets all aircraft types that have flown over by ident/callsign
4533
-	*
4534
-	* @return Array the aircraft list
4535
-	*
4536
-	*/
4532
+	 * Gets all aircraft types that have flown over by ident/callsign
4533
+	 *
4534
+	 * @return Array the aircraft list
4535
+	 *
4536
+	 */
4537 4537
 	public function countAllAircraftTypesByIdent($ident)
4538 4538
 	{
4539 4539
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4563,11 +4563,11 @@  discard block
 block discarded – undo
4563 4563
 
4564 4564
 
4565 4565
 	/**
4566
-	* Gets all aircraft registration that have flown over by ident/callsign
4567
-	*
4568
-	* @return Array the aircraft list
4569
-	*
4570
-	*/
4566
+	 * Gets all aircraft registration that have flown over by ident/callsign
4567
+	 *
4568
+	 * @return Array the aircraft list
4569
+	 *
4570
+	 */
4571 4571
 	public function countAllAircraftRegistrationByIdent($ident)
4572 4572
 	{
4573 4573
 		$Image = new Image($this->db);
@@ -4607,11 +4607,11 @@  discard block
 block discarded – undo
4607 4607
 
4608 4608
 
4609 4609
 	/**
4610
-	* Gets all aircraft manufacturer that have flown over by ident/callsign
4611
-	*
4612
-	* @return Array the aircraft manufacturer list
4613
-	*
4614
-	*/
4610
+	 * Gets all aircraft manufacturer that have flown over by ident/callsign
4611
+	 *
4612
+	 * @return Array the aircraft manufacturer list
4613
+	 *
4614
+	 */
4615 4615
 	public function countAllAircraftManufacturerByIdent($ident)
4616 4616
 	{
4617 4617
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -4626,15 +4626,15 @@  discard block
 block discarded – undo
4626 4626
 		$sth = $this->db->prepare($query);
4627 4627
 		$sth->execute(array(':ident' => $ident));
4628 4628
       
4629
-    $aircraft_array = array();
4629
+	$aircraft_array = array();
4630 4630
 		$temp_array = array();
4631 4631
         
4632
-    while($row = $sth->fetch(PDO::FETCH_ASSOC))
4632
+	while($row = $sth->fetch(PDO::FETCH_ASSOC))
4633 4633
 		{
4634 4634
 			$temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer'];
4635 4635
 			$temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count'];
4636 4636
           
4637
-      $aircraft_array[] = $temp_array;
4637
+	  $aircraft_array[] = $temp_array;
4638 4638
 		}
4639 4639
 
4640 4640
 		return $aircraft_array;
@@ -4642,11 +4642,11 @@  discard block
 block discarded – undo
4642 4642
 	
4643 4643
 	
4644 4644
 	/**
4645
-	* Gets all aircraft types that have flown over by route
4646
-	*
4647
-	* @return Array the aircraft list
4648
-	*
4649
-	*/
4645
+	 * Gets all aircraft types that have flown over by route
4646
+	 *
4647
+	 * @return Array the aircraft list
4648
+	 *
4649
+	 */
4650 4650
 	public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao)
4651 4651
 	{
4652 4652
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -4663,16 +4663,16 @@  discard block
 block discarded – undo
4663 4663
 		$sth = $this->db->prepare($query);
4664 4664
 		$sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao));
4665 4665
       
4666
-        $aircraft_array = array();
4666
+		$aircraft_array = array();
4667 4667
 		$temp_array = array();
4668 4668
         
4669
-        while($row = $sth->fetch(PDO::FETCH_ASSOC))
4669
+		while($row = $sth->fetch(PDO::FETCH_ASSOC))
4670 4670
 		{
4671 4671
 			$temp_array['aircraft_icao'] = $row['aircraft_icao'];
4672 4672
 			$temp_array['aircraft_name'] = $row['aircraft_name'];
4673
-            $temp_array['aircraft_icao_count'] = $row['aircraft_icao_count'];
4673
+			$temp_array['aircraft_icao_count'] = $row['aircraft_icao_count'];
4674 4674
           
4675
-            $aircraft_array[] = $temp_array;
4675
+			$aircraft_array[] = $temp_array;
4676 4676
 		}
4677 4677
 
4678 4678
 		return $aircraft_array;
@@ -4680,11 +4680,11 @@  discard block
 block discarded – undo
4680 4680
 	
4681 4681
 	
4682 4682
 	/**
4683
-	* Gets all aircraft registration that have flown over by route
4684
-	*
4685
-	* @return Array the aircraft list
4686
-	*
4687
-	*/
4683
+	 * Gets all aircraft registration that have flown over by route
4684
+	 *
4685
+	 * @return Array the aircraft list
4686
+	 *
4687
+	 */
4688 4688
 	public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao)
4689 4689
 	{
4690 4690
 		$Image = new Image($this->db);
@@ -4726,11 +4726,11 @@  discard block
 block discarded – undo
4726 4726
 	
4727 4727
 	
4728 4728
 	/**
4729
-	* Gets all aircraft manufacturer that have flown over by route
4730
-	*
4731
-	* @return Array the aircraft manufacturer list
4732
-	*
4733
-	*/
4729
+	 * Gets all aircraft manufacturer that have flown over by route
4730
+	 *
4731
+	 * @return Array the aircraft manufacturer list
4732
+	 *
4733
+	 */
4734 4734
 	public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao)
4735 4735
 	{
4736 4736
 		$departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING);
@@ -4764,11 +4764,11 @@  discard block
 block discarded – undo
4764 4764
 	
4765 4765
 	
4766 4766
 	/**
4767
-	* Gets all aircraft types that have flown over by country
4768
-	*
4769
-	* @return Array the aircraft list
4770
-	*
4771
-	*/
4767
+	 * Gets all aircraft types that have flown over by country
4768
+	 *
4769
+	 * @return Array the aircraft list
4770
+	 *
4771
+	 */
4772 4772
 	public function countAllAircraftTypesByCountry($country)
4773 4773
 	{
4774 4774
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4800,11 +4800,11 @@  discard block
 block discarded – undo
4800 4800
 
4801 4801
 
4802 4802
 	/**
4803
-	* Gets all aircraft registration that have flown over by country
4804
-	*
4805
-	* @return Array the aircraft list
4806
-	*
4807
-	*/
4803
+	 * Gets all aircraft registration that have flown over by country
4804
+	 *
4805
+	 * @return Array the aircraft list
4806
+	 *
4807
+	 */
4808 4808
 	public function countAllAircraftRegistrationByCountry($country)
4809 4809
 	{
4810 4810
 		$Image = new Image($this->db);
@@ -4845,11 +4845,11 @@  discard block
 block discarded – undo
4845 4845
 	
4846 4846
 	
4847 4847
 	/**
4848
-	* Gets all aircraft manufacturer that have flown over by country
4849
-	*
4850
-	* @return Array the aircraft manufacturer list
4851
-	*
4852
-	*/
4848
+	 * Gets all aircraft manufacturer that have flown over by country
4849
+	 *
4850
+	 * @return Array the aircraft manufacturer list
4851
+	 *
4852
+	 */
4853 4853
 	public function countAllAircraftManufacturerByCountry($country)
4854 4854
 	{
4855 4855
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -4881,11 +4881,11 @@  discard block
 block discarded – undo
4881 4881
 	
4882 4882
 	
4883 4883
 	/**
4884
-	* Gets all aircraft manufacturers that have flown over
4885
-	*
4886
-	* @return Array the aircraft list
4887
-	*
4888
-	*/
4884
+	 * Gets all aircraft manufacturers that have flown over
4885
+	 *
4886
+	 * @return Array the aircraft list
4887
+	 *
4888
+	 */
4889 4889
 	public function countAllAircraftManufacturers()
4890 4890
 	{
4891 4891
 		$query  = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count  
@@ -4916,11 +4916,11 @@  discard block
 block discarded – undo
4916 4916
 	
4917 4917
 	
4918 4918
 	/**
4919
-	* Gets all aircraft registrations that have flown over
4920
-	*
4921
-	* @return Array the aircraft list
4922
-	*
4923
-	*/
4919
+	 * Gets all aircraft registrations that have flown over
4920
+	 *
4921
+	 * @return Array the aircraft list
4922
+	 *
4923
+	 */
4924 4924
 	public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '')
4925 4925
 	{
4926 4926
 		global $globalDBdriver;
@@ -4928,15 +4928,15 @@  discard block
 block discarded – undo
4928 4928
 		$query  = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao,  spotter_output.aircraft_name, spotter_output.airline_name    
4929 4929
                     FROM spotter_output 
4930 4930
                     WHERE spotter_output.registration <> '' AND spotter_output.registration <> 'NA' ";
4931
-                if ($olderthanmonths > 0) {
4932
-            		if ($globalDBdriver == 'mysql') {
4931
+				if ($olderthanmonths > 0) {
4932
+					if ($globalDBdriver == 'mysql') {
4933 4933
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4934 4934
 			} else {
4935 4935
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4936 4936
 			}
4937 4937
 		}
4938
-                if ($sincedate != '') {
4939
-            		if ($globalDBdriver == 'mysql') {
4938
+				if ($sincedate != '') {
4939
+					if ($globalDBdriver == 'mysql') {
4940 4940
 				$query .= "AND date > '".$sincedate."' ";
4941 4941
 			} else {
4942 4942
 				$query .= "AND date > CAST('".$sincedate."' AS TIMESTAMP)";
@@ -4945,7 +4945,7 @@  discard block
 block discarded – undo
4945 4945
 
4946 4946
 		// if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
4947 4947
 		//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
4948
-                $query .= "GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
4948
+				$query .= "GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC";
4949 4949
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
4950 4950
 		
4951 4951
 		$sth = $this->db->prepare($query);
@@ -4978,35 +4978,35 @@  discard block
 block discarded – undo
4978 4978
 	
4979 4979
 	
4980 4980
 	/**
4981
-	* Gets all departure airports of the airplanes that have flown over
4982
-	*
4983
-	* @return Array the airport list
4984
-	*
4985
-	*/
4981
+	 * Gets all departure airports of the airplanes that have flown over
4982
+	 *
4983
+	 * @return Array the airport list
4984
+	 *
4985
+	 */
4986 4986
 	public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '')
4987 4987
 	{
4988 4988
 		global $globalDBdriver;
4989 4989
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country 
4990 4990
 								FROM spotter_output
4991 4991
                     WHERE spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' ";
4992
-                if ($olderthanmonths > 0) {
4993
-            		if ($globalDBdriver == 'mysql') {
4992
+				if ($olderthanmonths > 0) {
4993
+					if ($globalDBdriver == 'mysql') {
4994 4994
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
4995 4995
 			} else {
4996 4996
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
4997 4997
 			}
4998
-                }
4999
-                if ($sincedate != '') {
5000
-            		if ($globalDBdriver == 'mysql') {
4998
+				}
4999
+				if ($sincedate != '') {
5000
+					if ($globalDBdriver == 'mysql') {
5001 5001
 				$query .= "AND date > '".$sincedate."' ";
5002 5002
 			} else {
5003 5003
 				$query .= "AND date > CAST('".$sincedate."' AS TIMESTAMP)";
5004 5004
 			}
5005 5005
 		}
5006 5006
 
5007
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5008
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5009
-                $query .= "GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5007
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5008
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5009
+				$query .= "GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country
5010 5010
 				ORDER BY airport_departure_icao_count DESC";
5011 5011
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5012 5012
       
@@ -5030,35 +5030,35 @@  discard block
 block discarded – undo
5030 5030
 	}
5031 5031
 	
5032 5032
 	/**
5033
-	* Gets all detected departure airports of the airplanes that have flown over
5034
-	*
5035
-	* @return Array the airport list
5036
-	*
5037
-	*/
5033
+	 * Gets all detected departure airports of the airplanes that have flown over
5034
+	 *
5035
+	 * @return Array the airport list
5036
+	 *
5037
+	 */
5038 5038
 	public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '')
5039 5039
 	{
5040 5040
 		global $globalDBdriver;
5041 5041
 		$query  = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country
5042 5042
 				FROM spotter_output, airport
5043 5043
                     WHERE spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao ";
5044
-                if ($olderthanmonths > 0) {
5045
-            		if ($globalDBdriver == 'mysql') {
5044
+				if ($olderthanmonths > 0) {
5045
+					if ($globalDBdriver == 'mysql') {
5046 5046
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5047 5047
 			} else {
5048 5048
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5049 5049
 			}
5050
-                }
5051
-                if ($sincedate != '') {
5052
-            		if ($globalDBdriver == 'mysql') {
5050
+				}
5051
+				if ($sincedate != '') {
5052
+					if ($globalDBdriver == 'mysql') {
5053 5053
 				$query .= "AND date > '".$sincedate."' ";
5054 5054
 			} else {
5055 5055
 				$query .= "AND date > CAST('".$sincedate."' AS TIMESTAMP)";
5056 5056
 			}
5057 5057
 		}
5058 5058
 
5059
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5060
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5061
-                $query .= "GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5059
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5060
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5061
+				$query .= "GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country
5062 5062
 				ORDER BY airport_departure_icao_count DESC";
5063 5063
 		if ($limit) $query .= " LIMIT 10 OFFSET 0";
5064 5064
       
@@ -5084,11 +5084,11 @@  discard block
 block discarded – undo
5084 5084
 	
5085 5085
 	
5086 5086
 	/**
5087
-	* Gets all departure airports of the airplanes that have flown over based on an airline icao
5088
-	*
5089
-	* @return Array the airport list
5090
-	*
5091
-	*/
5087
+	 * Gets all departure airports of the airplanes that have flown over based on an airline icao
5088
+	 *
5089
+	 * @return Array the airport list
5090
+	 *
5091
+	 */
5092 5092
 	public function countAllDepartureAirportsByAirline($airline_icao)
5093 5093
 	{
5094 5094
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -5123,11 +5123,11 @@  discard block
 block discarded – undo
5123 5123
 	
5124 5124
 	
5125 5125
 	/**
5126
-	* Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5127
-	*
5128
-	* @return Array the airport list
5129
-	*
5130
-	*/
5126
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airline icao
5127
+	 *
5128
+	 * @return Array the airport list
5129
+	 *
5130
+	 */
5131 5131
 	public function countAllDepartureAirportCountriesByAirline($airline_icao)
5132 5132
 	{
5133 5133
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -5159,11 +5159,11 @@  discard block
 block discarded – undo
5159 5159
 	
5160 5160
 	
5161 5161
 	/**
5162
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5163
-	*
5164
-	* @return Array the airport list
5165
-	*
5166
-	*/
5162
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft icao
5163
+	 *
5164
+	 * @return Array the airport list
5165
+	 *
5166
+	 */
5167 5167
 	public function countAllDepartureAirportsByAircraft($aircraft_icao)
5168 5168
 	{
5169 5169
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -5197,11 +5197,11 @@  discard block
 block discarded – undo
5197 5197
 	
5198 5198
 	
5199 5199
 	/**
5200
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5201
-	*
5202
-	* @return Array the airport list
5203
-	*
5204
-	*/
5200
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5201
+	 *
5202
+	 * @return Array the airport list
5203
+	 *
5204
+	 */
5205 5205
 	public function countAllDepartureAirportCountriesByAircraft($aircraft_icao)
5206 5206
 	{
5207 5207
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -5232,11 +5232,11 @@  discard block
 block discarded – undo
5232 5232
 	
5233 5233
 	
5234 5234
 	/**
5235
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5236
-	*
5237
-	* @return Array the airport list
5238
-	*
5239
-	*/
5235
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft registration
5236
+	 *
5237
+	 * @return Array the airport list
5238
+	 *
5239
+	 */
5240 5240
 	public function countAllDepartureAirportsByRegistration($registration)
5241 5241
 	{
5242 5242
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -5270,11 +5270,11 @@  discard block
 block discarded – undo
5270 5270
 	
5271 5271
 	
5272 5272
 	/**
5273
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5274
-	*
5275
-	* @return Array the airport list
5276
-	*
5277
-	*/
5273
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration
5274
+	 *
5275
+	 * @return Array the airport list
5276
+	 *
5277
+	 */
5278 5278
 	public function countAllDepartureAirportCountriesByRegistration($registration)
5279 5279
 	{
5280 5280
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -5305,11 +5305,11 @@  discard block
 block discarded – undo
5305 5305
 	
5306 5306
 	
5307 5307
 	/**
5308
-	* Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5309
-	*
5310
-	* @return Array the airport list
5311
-	*
5312
-	*/
5308
+	 * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao
5309
+	 *
5310
+	 * @return Array the airport list
5311
+	 *
5312
+	 */
5313 5313
 	public function countAllDepartureAirportsByAirport($airport_icao)
5314 5314
 	{
5315 5315
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -5343,11 +5343,11 @@  discard block
 block discarded – undo
5343 5343
 	
5344 5344
 	
5345 5345
 	/**
5346
-	* Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5347
-	*
5348
-	* @return Array the airport list
5349
-	*
5350
-	*/
5346
+	 * Gets all departure airports by country of the airplanes that have flown over based on an airport icao
5347
+	 *
5348
+	 * @return Array the airport list
5349
+	 *
5350
+	 */
5351 5351
 	public function countAllDepartureAirportCountriesByAirport($airport_icao)
5352 5352
 	{
5353 5353
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -5379,11 +5379,11 @@  discard block
 block discarded – undo
5379 5379
 	
5380 5380
 	
5381 5381
 	/**
5382
-	* Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5383
-	*
5384
-	* @return Array the airport list
5385
-	*
5386
-	*/
5382
+	 * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer
5383
+	 *
5384
+	 * @return Array the airport list
5385
+	 *
5386
+	 */
5387 5387
 	public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer)
5388 5388
 	{
5389 5389
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -5417,11 +5417,11 @@  discard block
 block discarded – undo
5417 5417
 	
5418 5418
 	
5419 5419
 	/**
5420
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5421
-	*
5422
-	* @return Array the airport list
5423
-	*
5424
-	*/
5420
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer
5421
+	 *
5422
+	 * @return Array the airport list
5423
+	 *
5424
+	 */
5425 5425
 	public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer)
5426 5426
 	{
5427 5427
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -5452,11 +5452,11 @@  discard block
 block discarded – undo
5452 5452
 	
5453 5453
 	
5454 5454
 	/**
5455
-	* Gets all departure airports of the airplanes that have flown over based on a date
5456
-	*
5457
-	* @return Array the airport list
5458
-	*
5459
-	*/
5455
+	 * Gets all departure airports of the airplanes that have flown over based on a date
5456
+	 *
5457
+	 * @return Array the airport list
5458
+	 *
5459
+	 */
5460 5460
 	public function countAllDepartureAirportsByDate($date)
5461 5461
 	{
5462 5462
 		global $globalTimezone, $globalDBdriver;
@@ -5504,11 +5504,11 @@  discard block
 block discarded – undo
5504 5504
 	
5505 5505
 	
5506 5506
 	/**
5507
-	* Gets all departure airports by country of the airplanes that have flown over based on a date
5508
-	*
5509
-	* @return Array the airport list
5510
-	*
5511
-	*/
5507
+	 * Gets all departure airports by country of the airplanes that have flown over based on a date
5508
+	 *
5509
+	 * @return Array the airport list
5510
+	 *
5511
+	 */
5512 5512
 	public function countAllDepartureAirportCountriesByDate($date)
5513 5513
 	{
5514 5514
 		global $globalTimezone, $globalDBdriver;
@@ -5552,11 +5552,11 @@  discard block
 block discarded – undo
5552 5552
 	
5553 5553
 	
5554 5554
 	/**
5555
-	* Gets all departure airports of the airplanes that have flown over based on a ident/callsign
5556
-	*
5557
-	* @return Array the airport list
5558
-	*
5559
-	*/
5555
+	 * Gets all departure airports of the airplanes that have flown over based on a ident/callsign
5556
+	 *
5557
+	 * @return Array the airport list
5558
+	 *
5559
+	 */
5560 5560
 	public function countAllDepartureAirportsByIdent($ident)
5561 5561
 	{
5562 5562
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -5591,11 +5591,11 @@  discard block
 block discarded – undo
5591 5591
 	
5592 5592
 	
5593 5593
 	/**
5594
-	* Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
5595
-	*
5596
-	* @return Array the airport list
5597
-	*
5598
-	*/
5594
+	 * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident
5595
+	 *
5596
+	 * @return Array the airport list
5597
+	 *
5598
+	 */
5599 5599
 	public function countAllDepartureAirportCountriesByIdent($ident)
5600 5600
 	{
5601 5601
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -5627,11 +5627,11 @@  discard block
 block discarded – undo
5627 5627
 	
5628 5628
 	
5629 5629
 	/**
5630
-	* Gets all departure airports of the airplanes that have flown over based on a country
5631
-	*
5632
-	* @return Array the airport list
5633
-	*
5634
-	*/
5630
+	 * Gets all departure airports of the airplanes that have flown over based on a country
5631
+	 *
5632
+	 * @return Array the airport list
5633
+	 *
5634
+	 */
5635 5635
 	public function countAllDepartureAirportsByCountry($country)
5636 5636
 	{
5637 5637
 		$date = filter_var($date,FILTER_SANITIZE_STRING);
@@ -5665,11 +5665,11 @@  discard block
 block discarded – undo
5665 5665
 
5666 5666
 
5667 5667
 	/**
5668
-	* Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5669
-	*
5670
-	* @return Array the airport list
5671
-	*
5672
-	*/
5668
+	 * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao
5669
+	 *
5670
+	 * @return Array the airport list
5671
+	 *
5672
+	 */
5673 5673
 	public function countAllDepartureAirportCountriesByCountry($country)
5674 5674
 	{
5675 5675
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -5700,40 +5700,40 @@  discard block
 block discarded – undo
5700 5700
 	
5701 5701
 
5702 5702
 	/**
5703
-	* Gets all arrival airports of the airplanes that have flown over
5704
-	*
5705
-	* @return Array the airport list
5706
-	*
5707
-	*/
5703
+	 * Gets all arrival airports of the airplanes that have flown over
5704
+	 *
5705
+	 * @return Array the airport list
5706
+	 *
5707
+	 */
5708 5708
 	public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false)
5709 5709
 	{
5710 5710
 		global $globalDBdriver;
5711 5711
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country 
5712 5712
 								FROM spotter_output 
5713 5713
                     WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' ";
5714
-                if ($olderthanmonths > 0) {
5715
-            		if ($globalDBdriver == 'mysql') {
5714
+				if ($olderthanmonths > 0) {
5715
+					if ($globalDBdriver == 'mysql') {
5716 5716
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5717 5717
 			} else {
5718 5718
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5719 5719
 			}
5720
-                if ($sincedate != '') {
5721
-            		if ($globalDBdriver == 'mysql') {
5720
+				if ($sincedate != '') {
5721
+					if ($globalDBdriver == 'mysql') {
5722 5722
 				$query .= "AND date > '".$sincedate."' ";
5723 5723
 			} else {
5724 5724
 				$query .= "AND date > CAST('".$sincedate."' AS TIMESTAMP)";
5725 5725
 			}
5726 5726
 		}
5727
-            		if ($globalDBdriver == 'mysql') {
5727
+					if ($globalDBdriver == 'mysql') {
5728 5728
 				$query .= "AND date > '".$sincedate."' ";
5729 5729
 			} else {
5730 5730
 				$query .= "AND date > CAST('".$sincedate."' AS TIMESTAMP)";
5731 5731
 			}
5732 5732
 		}
5733 5733
 
5734
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5735
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5736
-                $query .= "GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
5734
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5735
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5736
+				$query .= "GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country
5737 5737
 					ORDER BY airport_arrival_icao_count DESC";
5738 5738
 		if ($limit) $query .= " LIMIT 10";
5739 5739
       
@@ -5762,40 +5762,40 @@  discard block
 block discarded – undo
5762 5762
 	}
5763 5763
 	
5764 5764
 	/**
5765
-	* Gets all detected arrival airports of the airplanes that have flown over
5766
-	*
5767
-	* @return Array the airport list
5768
-	*
5769
-	*/
5765
+	 * Gets all detected arrival airports of the airplanes that have flown over
5766
+	 *
5767
+	 * @return Array the airport list
5768
+	 *
5769
+	 */
5770 5770
 	public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false)
5771 5771
 	{
5772 5772
 		global $globalDBdriver;
5773 5773
 		$query  = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country 
5774 5774
 			FROM spotter_output, airport 
5775 5775
                     WHERE spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao ";
5776
-                if ($olderthanmonths > 0) {
5777
-            		if ($globalDBdriver == 'mysql') {
5776
+				if ($olderthanmonths > 0) {
5777
+					if ($globalDBdriver == 'mysql') {
5778 5778
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) ';
5779 5779
 			} else {
5780 5780
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' ";
5781 5781
 			}
5782
-                if ($sincedate != '') {
5783
-            		if ($globalDBdriver == 'mysql') {
5782
+				if ($sincedate != '') {
5783
+					if ($globalDBdriver == 'mysql') {
5784 5784
 				$query .= "AND date > '".$sincedate."' ";
5785 5785
 			} else {
5786 5786
 				$query .= "AND date > CAST('".$sincedate."' AS TIMESTAMP)";
5787 5787
 			}
5788 5788
 		}
5789
-            		if ($globalDBdriver == 'mysql') {
5789
+					if ($globalDBdriver == 'mysql') {
5790 5790
 				$query .= "AND date > '".$sincedate."' ";
5791 5791
 			} else {
5792 5792
 				$query .= "AND date > CAST('".$sincedate."' AS TIMESTAMP)";
5793 5793
 			}
5794 5794
 		}
5795 5795
 
5796
-            	//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5797
-                //if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5798
-                $query .= "GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
5796
+				//if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
5797
+				//if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
5798
+				$query .= "GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country
5799 5799
 					ORDER BY airport_arrival_icao_count DESC";
5800 5800
 		if ($limit) $query .= " LIMIT 10";
5801 5801
       
@@ -5826,11 +5826,11 @@  discard block
 block discarded – undo
5826 5826
 	
5827 5827
 	
5828 5828
 	/**
5829
-	* Gets all arrival airports of the airplanes that have flown over based on an airline icao
5830
-	*
5831
-	* @return Array the airport list
5832
-	*
5833
-	*/
5829
+	 * Gets all arrival airports of the airplanes that have flown over based on an airline icao
5830
+	 *
5831
+	 * @return Array the airport list
5832
+	 *
5833
+	 */
5834 5834
 	public function countAllArrivalAirportsByAirline($airline_icao)
5835 5835
 	{
5836 5836
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -5864,11 +5864,11 @@  discard block
 block discarded – undo
5864 5864
 	
5865 5865
 	
5866 5866
 	/**
5867
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
5868
-	*
5869
-	* @return Array the airport list
5870
-	*
5871
-	*/
5867
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao
5868
+	 *
5869
+	 * @return Array the airport list
5870
+	 *
5871
+	 */
5872 5872
 	public function countAllArrivalAirportCountriesByAirline($airline_icao)
5873 5873
 	{
5874 5874
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -5899,11 +5899,11 @@  discard block
 block discarded – undo
5899 5899
 	
5900 5900
 	
5901 5901
 	/**
5902
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
5903
-	*
5904
-	* @return Array the airport list
5905
-	*
5906
-	*/
5902
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao
5903
+	 *
5904
+	 * @return Array the airport list
5905
+	 *
5906
+	 */
5907 5907
 	public function countAllArrivalAirportsByAircraft($aircraft_icao)
5908 5908
 	{
5909 5909
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -5938,11 +5938,11 @@  discard block
 block discarded – undo
5938 5938
 	
5939 5939
 	
5940 5940
 	/**
5941
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
5942
-	*
5943
-	* @return Array the airport list
5944
-	*
5945
-	*/
5941
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao
5942
+	 *
5943
+	 * @return Array the airport list
5944
+	 *
5945
+	 */
5946 5946
 	public function countAllArrivalAirportCountriesByAircraft($aircraft_icao)
5947 5947
 	{
5948 5948
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -5973,11 +5973,11 @@  discard block
 block discarded – undo
5973 5973
 	
5974 5974
 	
5975 5975
 	/**
5976
-	* Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
5977
-	*
5978
-	* @return Array the airport list
5979
-	*
5980
-	*/
5976
+	 * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration
5977
+	 *
5978
+	 * @return Array the airport list
5979
+	 *
5980
+	 */
5981 5981
 	public function countAllArrivalAirportsByRegistration($registration)
5982 5982
 	{
5983 5983
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -6011,11 +6011,11 @@  discard block
 block discarded – undo
6011 6011
 	
6012 6012
 	
6013 6013
 	/**
6014
-	* Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6015
-	*
6016
-	* @return Array the airport list
6017
-	*
6018
-	*/
6014
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration
6015
+	 *
6016
+	 * @return Array the airport list
6017
+	 *
6018
+	 */
6019 6019
 	public function countAllArrivalAirportCountriesByRegistration($registration)
6020 6020
 	{
6021 6021
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -6047,11 +6047,11 @@  discard block
 block discarded – undo
6047 6047
 	
6048 6048
 	
6049 6049
 	/**
6050
-	* Gets all arrival airports of the airplanes that have flown over based on an departure airport
6051
-	*
6052
-	* @return Array the airport list
6053
-	*
6054
-	*/
6050
+	 * Gets all arrival airports of the airplanes that have flown over based on an departure airport
6051
+	 *
6052
+	 * @return Array the airport list
6053
+	 *
6054
+	 */
6055 6055
 	public function countAllArrivalAirportsByAirport($airport_icao)
6056 6056
 	{
6057 6057
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -6085,11 +6085,11 @@  discard block
 block discarded – undo
6085 6085
 	
6086 6086
 	
6087 6087
 	/**
6088
-	* Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6089
-	*
6090
-	* @return Array the airport list
6091
-	*
6092
-	*/
6088
+	 * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao
6089
+	 *
6090
+	 * @return Array the airport list
6091
+	 *
6092
+	 */
6093 6093
 	public function countAllArrivalAirportCountriesByAirport($airport_icao)
6094 6094
 	{
6095 6095
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -6120,11 +6120,11 @@  discard block
 block discarded – undo
6120 6120
 	
6121 6121
 	
6122 6122
 	/**
6123
-	* Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6124
-	*
6125
-	* @return Array the airport list
6126
-	*
6127
-	*/
6123
+	 * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer
6124
+	 *
6125
+	 * @return Array the airport list
6126
+	 *
6127
+	 */
6128 6128
 	public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer)
6129 6129
 	{
6130 6130
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -6159,11 +6159,11 @@  discard block
 block discarded – undo
6159 6159
 	
6160 6160
 	
6161 6161
 	/**
6162
-	* Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6163
-	*
6164
-	* @return Array the airport list
6165
-	*
6166
-	*/
6162
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer
6163
+	 *
6164
+	 * @return Array the airport list
6165
+	 *
6166
+	 */
6167 6167
 	public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer)
6168 6168
 	{
6169 6169
 		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
@@ -6195,11 +6195,11 @@  discard block
 block discarded – undo
6195 6195
 	
6196 6196
 	
6197 6197
 	/**
6198
-	* Gets all arrival airports of the airplanes that have flown over based on a date
6199
-	*
6200
-	* @return Array the airport list
6201
-	*
6202
-	*/
6198
+	 * Gets all arrival airports of the airplanes that have flown over based on a date
6199
+	 *
6200
+	 * @return Array the airport list
6201
+	 *
6202
+	 */
6203 6203
 	public function countAllArrivalAirportsByDate($date)
6204 6204
 	{
6205 6205
 		global $globalTimezone, $globalDBdriver;
@@ -6246,11 +6246,11 @@  discard block
 block discarded – undo
6246 6246
 	
6247 6247
 	
6248 6248
 	/**
6249
-	* Gets all arrival airports by country of the airplanes that have flown over based on a date
6250
-	*
6251
-	* @return Array the airport list
6252
-	*
6253
-	*/
6249
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a date
6250
+	 *
6251
+	 * @return Array the airport list
6252
+	 *
6253
+	 */
6254 6254
 	public function countAllArrivalAirportCountriesByDate($date)
6255 6255
 	{
6256 6256
 		global $globalTimezone, $globalDBdriver;
@@ -6294,11 +6294,11 @@  discard block
 block discarded – undo
6294 6294
 	
6295 6295
 	
6296 6296
 	/**
6297
-	* Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6298
-	*
6299
-	* @return Array the airport list
6300
-	*
6301
-	*/
6297
+	 * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign
6298
+	 *
6299
+	 * @return Array the airport list
6300
+	 *
6301
+	 */
6302 6302
 	public function countAllArrivalAirportsByIdent($ident)
6303 6303
 	{
6304 6304
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -6332,11 +6332,11 @@  discard block
 block discarded – undo
6332 6332
 	
6333 6333
 	
6334 6334
 	/**
6335
-	* Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
6336
-	*
6337
-	* @return Array the airport list
6338
-	*
6339
-	*/
6335
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident
6336
+	 *
6337
+	 * @return Array the airport list
6338
+	 *
6339
+	 */
6340 6340
 	public function countAllArrivalAirportCountriesByIdent($ident)
6341 6341
 	{
6342 6342
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -6368,11 +6368,11 @@  discard block
 block discarded – undo
6368 6368
 	
6369 6369
 	
6370 6370
 	/**
6371
-	* Gets all arrival airports of the airplanes that have flown over based on a country
6372
-	*
6373
-	* @return Array the airport list
6374
-	*
6375
-	*/
6371
+	 * Gets all arrival airports of the airplanes that have flown over based on a country
6372
+	 *
6373
+	 * @return Array the airport list
6374
+	 *
6375
+	 */
6376 6376
 	public function countAllArrivalAirportsByCountry($country)
6377 6377
 	{
6378 6378
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -6406,11 +6406,11 @@  discard block
 block discarded – undo
6406 6406
 	
6407 6407
 	
6408 6408
 	/**
6409
-	* Gets all arrival airports by country of the airplanes that have flown over based on a country
6410
-	*
6411
-	* @return Array the airport list
6412
-	*
6413
-	*/
6409
+	 * Gets all arrival airports by country of the airplanes that have flown over based on a country
6410
+	 *
6411
+	 * @return Array the airport list
6412
+	 *
6413
+	 */
6414 6414
 	public function countAllArrivalAirportCountriesByCountry($country)
6415 6415
 	{
6416 6416
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -6442,11 +6442,11 @@  discard block
 block discarded – undo
6442 6442
 
6443 6443
 
6444 6444
 	/**
6445
-	* Counts all airport departure countries
6446
-	*
6447
-	* @return Array the airport departure list
6448
-	*
6449
-	*/
6445
+	 * Counts all airport departure countries
6446
+	 *
6447
+	 * @return Array the airport departure list
6448
+	 *
6449
+	 */
6450 6450
 	public function countAllDepartureCountries()
6451 6451
 	{
6452 6452
 		$query  = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count 
@@ -6476,11 +6476,11 @@  discard block
 block discarded – undo
6476 6476
 	
6477 6477
 	
6478 6478
 	/**
6479
-	* Counts all airport arrival countries
6480
-	*
6481
-	* @return Array the airport arrival list
6482
-	*
6483
-	*/
6479
+	 * Counts all airport arrival countries
6480
+	 *
6481
+	 * @return Array the airport arrival list
6482
+	 *
6483
+	 */
6484 6484
 	public function countAllArrivalCountries($limit = true)
6485 6485
 	{
6486 6486
 		$query  = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count 
@@ -6513,11 +6513,11 @@  discard block
 block discarded – undo
6513 6513
 
6514 6514
 
6515 6515
 	/**
6516
-	* Gets all route combinations
6517
-	*
6518
-	* @return Array the route list
6519
-	*
6520
-	*/
6516
+	 * Gets all route combinations
6517
+	 *
6518
+	 * @return Array the route list
6519
+	 *
6520
+	 */
6521 6521
 	public function countAllRoutes()
6522 6522
 	{
6523 6523
 		
@@ -6557,11 +6557,11 @@  discard block
 block discarded – undo
6557 6557
 	
6558 6558
 	
6559 6559
 	/**
6560
-	* Gets all route combinations based on an aircraft
6561
-	*
6562
-	* @return Array the route list
6563
-	*
6564
-	*/
6560
+	 * Gets all route combinations based on an aircraft
6561
+	 *
6562
+	 * @return Array the route list
6563
+	 *
6564
+	 */
6565 6565
 	public function countAllRoutesByAircraft($aircraft_icao)
6566 6566
 	{
6567 6567
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
@@ -6599,11 +6599,11 @@  discard block
 block discarded – undo
6599 6599
 	
6600 6600
 	
6601 6601
 	/**
6602
-	* Gets all route combinations based on an aircraft registration
6603
-	*
6604
-	* @return Array the route list
6605
-	*
6606
-	*/
6602
+	 * Gets all route combinations based on an aircraft registration
6603
+	 *
6604
+	 * @return Array the route list
6605
+	 *
6606
+	 */
6607 6607
 	public function countAllRoutesByRegistration($registration)
6608 6608
 	{
6609 6609
 		$registration = filter_var($registration, FILTER_SANITIZE_STRING);
@@ -6642,11 +6642,11 @@  discard block
 block discarded – undo
6642 6642
 	
6643 6643
 	
6644 6644
 	/**
6645
-	* Gets all route combinations based on an airline
6646
-	*
6647
-	* @return Array the route list
6648
-	*
6649
-	*/
6645
+	 * Gets all route combinations based on an airline
6646
+	 *
6647
+	 * @return Array the route list
6648
+	 *
6649
+	 */
6650 6650
 	public function countAllRoutesByAirline($airline_icao)
6651 6651
 	{
6652 6652
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
@@ -6685,11 +6685,11 @@  discard block
 block discarded – undo
6685 6685
 	
6686 6686
 	
6687 6687
 	/**
6688
-	* Gets all route combinations based on an airport
6689
-	*
6690
-	* @return Array the route list
6691
-	*
6692
-	*/
6688
+	 * Gets all route combinations based on an airport
6689
+	 *
6690
+	 * @return Array the route list
6691
+	 *
6692
+	 */
6693 6693
 	public function countAllRoutesByAirport($airport_icao)
6694 6694
 	{
6695 6695
 		$airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING);
@@ -6728,11 +6728,11 @@  discard block
 block discarded – undo
6728 6728
 	
6729 6729
 	
6730 6730
 	/**
6731
-	* Gets all route combinations based on an country
6732
-	*
6733
-	* @return Array the route list
6734
-	*
6735
-	*/
6731
+	 * Gets all route combinations based on an country
6732
+	 *
6733
+	 * @return Array the route list
6734
+	 *
6735
+	 */
6736 6736
 	public function countAllRoutesByCountry($country)
6737 6737
 	{
6738 6738
 		$country = filter_var($country,FILTER_SANITIZE_STRING);
@@ -6770,11 +6770,11 @@  discard block
 block discarded – undo
6770 6770
 
6771 6771
 
6772 6772
 	/**
6773
-	* Gets all route combinations based on an date
6774
-	*
6775
-	* @return Array the route list
6776
-	*
6777
-	*/
6773
+	 * Gets all route combinations based on an date
6774
+	 *
6775
+	 * @return Array the route list
6776
+	 *
6777
+	 */
6778 6778
 	public function countAllRoutesByDate($date)
6779 6779
 	{
6780 6780
 		global $globalTimezone, $globalDBdriver;
@@ -6825,11 +6825,11 @@  discard block
 block discarded – undo
6825 6825
 	
6826 6826
 	
6827 6827
 	/**
6828
-	* Gets all route combinations based on an ident/callsign
6829
-	*
6830
-	* @return Array the route list
6831
-	*
6832
-	*/
6828
+	 * Gets all route combinations based on an ident/callsign
6829
+	 *
6830
+	 * @return Array the route list
6831
+	 *
6832
+	 */
6833 6833
 	public function countAllRoutesByIdent($ident)
6834 6834
 	{
6835 6835
 		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
@@ -6867,11 +6867,11 @@  discard block
 block discarded – undo
6867 6867
 	
6868 6868
 	
6869 6869
 	/**
6870
-	* Gets all route combinations based on an manufacturer
6871
-	*
6872
-	* @return Array the route list
6873
-	*
6874
-	*/
6870
+	 * Gets all route combinations based on an manufacturer
6871
+	 *
6872
+	 * @return Array the route list
6873
+	 *
6874
+	 */
6875 6875
 	public function countAllRoutesByManufacturer($aircraft_manufacturer)
6876 6876
 	{
6877 6877
 		$aircraft_manufacturer = filter_var($aircraft_manufactuer,FILTER_SANITIZE_STRING);
@@ -6910,11 +6910,11 @@  discard block
 block discarded – undo
6910 6910
 	
6911 6911
 	
6912 6912
 	/**
6913
-	* Gets all route combinations with waypoints
6914
-	*
6915
-	* @return Array the route list
6916
-	*
6917
-	*/
6913
+	 * Gets all route combinations with waypoints
6914
+	 *
6915
+	 * @return Array the route list
6916
+	 *
6917
+	 */
6918 6918
 	public function countAllRoutesWithWaypoints()
6919 6919
 	{
6920 6920
 		$query  = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country
@@ -6954,11 +6954,11 @@  discard block
 block discarded – undo
6954 6954
 	
6955 6955
 	
6956 6956
 	/**
6957
-	* Gets all callsigns that have flown over
6958
-	*
6959
-	* @return Array the callsign list
6960
-	*
6961
-	*/
6957
+	 * Gets all callsigns that have flown over
6958
+	 *
6959
+	 * @return Array the callsign list
6960
+	 *
6961
+	 */
6962 6962
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '')
6963 6963
 	{
6964 6964
 		global $globalDBdriver;
@@ -6999,11 +6999,11 @@  discard block
 block discarded – undo
6999 6999
 
7000 7000
 
7001 7001
 	/**
7002
-	* Counts all dates
7003
-	*
7004
-	* @return Array the date list
7005
-	*
7006
-	*/
7002
+	 * Counts all dates
7003
+	 *
7004
+	 * @return Array the date list
7005
+	 *
7006
+	 */
7007 7007
 	public function countAllDates()
7008 7008
 	{
7009 7009
 		global $globalTimezone, $globalDBdriver;
@@ -7048,11 +7048,11 @@  discard block
 block discarded – undo
7048 7048
 	
7049 7049
 	
7050 7050
 	/**
7051
-	* Counts all dates during the last 7 days
7052
-	*
7053
-	* @return Array the date list
7054
-	*
7055
-	*/
7051
+	 * Counts all dates during the last 7 days
7052
+	 *
7053
+	 * @return Array the date list
7054
+	 *
7055
+	 */
7056 7056
 	public function countAllDatesLast7Days()
7057 7057
 	{
7058 7058
 		global $globalTimezone, $globalDBdriver;
@@ -7076,7 +7076,7 @@  discard block
 block discarded – undo
7076 7076
 								GROUP BY date_name 
7077 7077
 								ORDER BY date_name ASC";
7078 7078
 			$query_data = array(':offset' => $offset);
7079
-    		}
7079
+			}
7080 7080
 		
7081 7081
 		$sth = $this->db->prepare($query);
7082 7082
 		$sth->execute($query_data);
@@ -7096,11 +7096,11 @@  discard block
 block discarded – undo
7096 7096
 	}
7097 7097
 
7098 7098
 	/**
7099
-	* Counts all dates during the last month
7100
-	*
7101
-	* @return Array the date list
7102
-	*
7103
-	*/
7099
+	 * Counts all dates during the last month
7100
+	 *
7101
+	 * @return Array the date list
7102
+	 *
7103
+	 */
7104 7104
 	public function countAllDatesLastMonth()
7105 7105
 	{
7106 7106
 		global $globalTimezone, $globalDBdriver;
@@ -7124,7 +7124,7 @@  discard block
 block discarded – undo
7124 7124
 								GROUP BY date_name 
7125 7125
 								ORDER BY date_name ASC";
7126 7126
 			$query_data = array(':offset' => $offset);
7127
-    		}
7127
+			}
7128 7128
 		
7129 7129
 		$sth = $this->db->prepare($query);
7130 7130
 		$sth->execute($query_data);
@@ -7144,11 +7144,11 @@  discard block
 block discarded – undo
7144 7144
 	}
7145 7145
 	
7146 7146
 	/**
7147
-	* Counts all month
7148
-	*
7149
-	* @return Array the month list
7150
-	*
7151
-	*/
7147
+	 * Counts all month
7148
+	 *
7149
+	 * @return Array the month list
7150
+	 *
7151
+	 */
7152 7152
 	public function countAllMonths()
7153 7153
 	{
7154 7154
 		global $globalTimezone, $globalDBdriver;
@@ -7190,11 +7190,11 @@  discard block
 block discarded – undo
7190 7190
 	}
7191 7191
 
7192 7192
 	/**
7193
-	* Counts all military month
7194
-	*
7195
-	* @return Array the month list
7196
-	*
7197
-	*/
7193
+	 * Counts all military month
7194
+	 *
7195
+	 * @return Array the month list
7196
+	 *
7197
+	 */
7198 7198
 	public function countAllMilitaryMonths()
7199 7199
 	{
7200 7200
 		global $globalTimezone, $globalDBdriver;
@@ -7237,11 +7237,11 @@  discard block
 block discarded – undo
7237 7237
 	}
7238 7238
 	
7239 7239
 	/**
7240
-	* Counts all month owners
7241
-	*
7242
-	* @return Array the month list
7243
-	*
7244
-	*/
7240
+	 * Counts all month owners
7241
+	 *
7242
+	 * @return Array the month list
7243
+	 *
7244
+	 */
7245 7245
 	public function countAllMonthsOwners()
7246 7246
 	{
7247 7247
 		global $globalTimezone, $globalDBdriver;
@@ -7284,11 +7284,11 @@  discard block
 block discarded – undo
7284 7284
 	}
7285 7285
 
7286 7286
 	/**
7287
-	* Counts all month pilot
7288
-	*
7289
-	* @return Array the month list
7290
-	*
7291
-	*/
7287
+	 * Counts all month pilot
7288
+	 *
7289
+	 * @return Array the month list
7290
+	 *
7291
+	 */
7292 7292
 	public function countAllMonthsPilots()
7293 7293
 	{
7294 7294
 		global $globalTimezone, $globalDBdriver;
@@ -7332,11 +7332,11 @@  discard block
 block discarded – undo
7332 7332
 	
7333 7333
 
7334 7334
 	/**
7335
-	* Counts all month airline
7336
-	*
7337
-	* @return Array the month list
7338
-	*
7339
-	*/
7335
+	 * Counts all month airline
7336
+	 *
7337
+	 * @return Array the month list
7338
+	 *
7339
+	 */
7340 7340
 	public function countAllMonthsAirlines()
7341 7341
 	{
7342 7342
 		global $globalTimezone, $globalDBdriver;
@@ -7379,11 +7379,11 @@  discard block
 block discarded – undo
7379 7379
 	}
7380 7380
 	
7381 7381
 	/**
7382
-	* Counts all month aircraft
7383
-	*
7384
-	* @return Array the month list
7385
-	*
7386
-	*/
7382
+	 * Counts all month aircraft
7383
+	 *
7384
+	 * @return Array the month list
7385
+	 *
7386
+	 */
7387 7387
 	public function countAllMonthsAircrafts()
7388 7388
 	{
7389 7389
 		global $globalTimezone, $globalDBdriver;
@@ -7427,11 +7427,11 @@  discard block
 block discarded – undo
7427 7427
 	
7428 7428
 
7429 7429
 	/**
7430
-	* Counts all month real arrival
7431
-	*
7432
-	* @return Array the month list
7433
-	*
7434
-	*/
7430
+	 * Counts all month real arrival
7431
+	 *
7432
+	 * @return Array the month list
7433
+	 *
7434
+	 */
7435 7435
 	public function countAllMonthsRealArrivals()
7436 7436
 	{
7437 7437
 		global $globalTimezone, $globalDBdriver;
@@ -7476,11 +7476,11 @@  discard block
 block discarded – undo
7476 7476
 
7477 7477
 
7478 7478
 	/**
7479
-	* Counts all dates during the last year
7480
-	*
7481
-	* @return Array the date list
7482
-	*
7483
-	*/
7479
+	 * Counts all dates during the last year
7480
+	 *
7481
+	 * @return Array the date list
7482
+	 *
7483
+	 */
7484 7484
 	public function countAllMonthsLastYear()
7485 7485
 	{
7486 7486
 		global $globalTimezone, $globalDBdriver;
@@ -7506,7 +7506,7 @@  discard block
 block discarded – undo
7506 7506
 								GROUP BY year_name, month_name
7507 7507
 								ORDER BY year_name, month_name ASC";
7508 7508
 			$query_data = array(':offset' => $offset);
7509
-    		}
7509
+			}
7510 7510
 		
7511 7511
 		$sth = $this->db->prepare($query);
7512 7512
 		$sth->execute($query_data);
@@ -7529,11 +7529,11 @@  discard block
 block discarded – undo
7529 7529
 	
7530 7530
 	
7531 7531
 	/**
7532
-	* Counts all hours
7533
-	*
7534
-	* @return Array the hour list
7535
-	*
7536
-	*/
7532
+	 * Counts all hours
7533
+	 *
7534
+	 * @return Array the hour list
7535
+	 *
7536
+	 */
7537 7537
 	public function countAllHours($orderby)
7538 7538
 	{
7539 7539
 		global $globalTimezone, $globalDBdriver;
@@ -7592,11 +7592,11 @@  discard block
 block discarded – undo
7592 7592
 	
7593 7593
 	
7594 7594
 	/**
7595
-	* Counts all hours by airline
7596
-	*
7597
-	* @return Array the hour list
7598
-	*
7599
-	*/
7595
+	 * Counts all hours by airline
7596
+	 *
7597
+	 * @return Array the hour list
7598
+	 *
7599
+	 */
7600 7600
 	public function countAllHoursByAirline($airline_icao)
7601 7601
 	{
7602 7602
 		global $globalTimezone, $globalDBdriver;
@@ -7643,11 +7643,11 @@  discard block
 block discarded – undo
7643 7643
 	
7644 7644
 	
7645 7645
 	/**
7646
-	* Counts all hours by aircraft
7647
-	*
7648
-	* @return Array the hour list
7649
-	*
7650
-	*/
7646
+	 * Counts all hours by aircraft
7647
+	 *
7648
+	 * @return Array the hour list
7649
+	 *
7650
+	 */
7651 7651
 	public function countAllHoursByAircraft($aircraft_icao)
7652 7652
 	{
7653 7653
 		global $globalTimezone, $globalDBdriver;
@@ -7691,11 +7691,11 @@  discard block
 block discarded – undo
7691 7691
 	
7692 7692
 	
7693 7693
 	/**
7694
-	* Counts all hours by aircraft registration
7695
-	*
7696
-	* @return Array the hour list
7697
-	*
7698
-	*/
7694
+	 * Counts all hours by aircraft registration
7695
+	 *
7696
+	 * @return Array the hour list
7697
+	 *
7698
+	 */
7699 7699
 	public function countAllHoursByRegistration($registration)
7700 7700
 	{
7701 7701
 		global $globalTimezone, $globalDBdriver;
@@ -7739,11 +7739,11 @@  discard block
 block discarded – undo
7739 7739
 	
7740 7740
 	
7741 7741
 	/**
7742
-	* Counts all hours by airport
7743
-	*
7744
-	* @return Array the hour list
7745
-	*
7746
-	*/
7742
+	 * Counts all hours by airport
7743
+	 *
7744
+	 * @return Array the hour list
7745
+	 *
7746
+	 */
7747 7747
 	public function countAllHoursByAirport($airport_icao)
7748 7748
 	{
7749 7749
 		global $globalTimezone, $globalDBdriver;
@@ -7788,11 +7788,11 @@  discard block
 block discarded – undo
7788 7788
 	
7789 7789
 	
7790 7790
 	/**
7791
-	* Counts all hours by manufacturer
7792
-	*
7793
-	* @return Array the hour list
7794
-	*
7795
-	*/
7791
+	 * Counts all hours by manufacturer
7792
+	 *
7793
+	 * @return Array the hour list
7794
+	 *
7795
+	 */
7796 7796
 	public function countAllHoursByManufacturer($aircraft_manufacturer)
7797 7797
 	{
7798 7798
 		global $globalTimezone, $globalDBdriver;
@@ -7837,11 +7837,11 @@  discard block
 block discarded – undo
7837 7837
 	
7838 7838
 	
7839 7839
 	/**
7840
-	* Counts all hours by date
7841
-	*
7842
-	* @return Array the hour list
7843
-	*
7844
-	*/
7840
+	 * Counts all hours by date
7841
+	 *
7842
+	 * @return Array the hour list
7843
+	 *
7844
+	 */
7845 7845
 	public function countAllHoursByDate($date)
7846 7846
 	{
7847 7847
 		global $globalTimezone, $globalDBdriver;
@@ -7886,11 +7886,11 @@  discard block
 block discarded – undo
7886 7886
 	
7887 7887
 	
7888 7888
 	/**
7889
-	* Counts all hours by a ident/callsign
7890
-	*
7891
-	* @return Array the hour list
7892
-	*
7893
-	*/
7889
+	 * Counts all hours by a ident/callsign
7890
+	 *
7891
+	 * @return Array the hour list
7892
+	 *
7893
+	 */
7894 7894
 	public function countAllHoursByIdent($ident)
7895 7895
 	{
7896 7896
 		global $globalTimezone, $globalDBdriver;
@@ -7936,11 +7936,11 @@  discard block
 block discarded – undo
7936 7936
 	
7937 7937
 	
7938 7938
 	/**
7939
-	* Counts all hours by route
7940
-	*
7941
-	* @return Array the hour list
7942
-	*
7943
-	*/
7939
+	 * Counts all hours by route
7940
+	 *
7941
+	 * @return Array the hour list
7942
+	 *
7943
+	 */
7944 7944
 	public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao)
7945 7945
 	{
7946 7946
 		global $globalTimezone, $globalDBdriver;
@@ -7985,11 +7985,11 @@  discard block
 block discarded – undo
7985 7985
 	
7986 7986
 	
7987 7987
 	/**
7988
-	* Counts all hours by country
7989
-	*
7990
-	* @return Array the hour list
7991
-	*
7992
-	*/
7988
+	 * Counts all hours by country
7989
+	 *
7990
+	 * @return Array the hour list
7991
+	 *
7992
+	 */
7993 7993
 	public function countAllHoursByCountry($country)
7994 7994
 	{
7995 7995
 		global $globalTimezone, $globalDBdriver;
@@ -8035,11 +8035,11 @@  discard block
 block discarded – undo
8035 8035
 
8036 8036
 
8037 8037
 	/**
8038
-	* Counts all aircraft that have flown over
8039
-	*
8040
-	* @return Integer the number of aircrafts
8041
-	*
8042
-	*/
8038
+	 * Counts all aircraft that have flown over
8039
+	 *
8040
+	 * @return Integer the number of aircrafts
8041
+	 *
8042
+	 */
8043 8043
 	public function countOverallAircrafts()
8044 8044
 	{
8045 8045
 		$query  = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count  
@@ -8053,11 +8053,11 @@  discard block
 block discarded – undo
8053 8053
 	}
8054 8054
 
8055 8055
 	/**
8056
-	* Counts all flight that really arrival
8057
-	*
8058
-	* @return Integer the number of aircrafts
8059
-	*
8060
-	*/
8056
+	 * Counts all flight that really arrival
8057
+	 *
8058
+	 * @return Integer the number of aircrafts
8059
+	 *
8060
+	 */
8061 8061
 	public function countOverallArrival()
8062 8062
 	{
8063 8063
 		$query  = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count  
@@ -8071,11 +8071,11 @@  discard block
 block discarded – undo
8071 8071
 	}
8072 8072
 
8073 8073
 	/**
8074
-	* Counts all pilots that have flown over
8075
-	*
8076
-	* @return Integer the number of pilots
8077
-	*
8078
-	*/
8074
+	 * Counts all pilots that have flown over
8075
+	 *
8076
+	 * @return Integer the number of pilots
8077
+	 *
8078
+	 */
8079 8079
 	public function countOverallPilots()
8080 8080
 	{
8081 8081
 		$query  = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count  
@@ -8089,11 +8089,11 @@  discard block
 block discarded – undo
8089 8089
 	}
8090 8090
 
8091 8091
 	/**
8092
-	* Counts all owners that have flown over
8093
-	*
8094
-	* @return Integer the number of owners
8095
-	*
8096
-	*/
8092
+	 * Counts all owners that have flown over
8093
+	 *
8094
+	 * @return Integer the number of owners
8095
+	 *
8096
+	 */
8097 8097
 	public function countOverallOwners()
8098 8098
 	{
8099 8099
 		$query  = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count  
@@ -8108,11 +8108,11 @@  discard block
 block discarded – undo
8108 8108
 	
8109 8109
 	
8110 8110
 	/**
8111
-	* Counts all flights that have flown over
8112
-	*
8113
-	* @return Integer the number of flights
8114
-	*
8115
-	*/
8111
+	 * Counts all flights that have flown over
8112
+	 *
8113
+	 * @return Integer the number of flights
8114
+	 *
8115
+	 */
8116 8116
 	public function countOverallFlights()
8117 8117
 	{
8118 8118
 		$query  = "SELECT COUNT(spotter_output.spotter_id) AS flight_count  
@@ -8125,11 +8125,11 @@  discard block
 block discarded – undo
8125 8125
 	}
8126 8126
 	
8127 8127
 	/**
8128
-	* Counts all military flights that have flown over
8129
-	*
8130
-	* @return Integer the number of flights
8131
-	*
8132
-	*/
8128
+	 * Counts all military flights that have flown over
8129
+	 *
8130
+	 * @return Integer the number of flights
8131
+	 *
8132
+	 */
8133 8133
 	public function countOverallMilitaryFlights()
8134 8134
 	{
8135 8135
 		$query  = "SELECT COUNT(s.spotter_id) AS flight_count  
@@ -8144,11 +8144,11 @@  discard block
 block discarded – undo
8144 8144
 	
8145 8145
 	
8146 8146
 	/**
8147
-	* Counts all airlines that have flown over
8148
-	*
8149
-	* @return Integer the number of airlines
8150
-	*
8151
-	*/
8147
+	 * Counts all airlines that have flown over
8148
+	 *
8149
+	 * @return Integer the number of airlines
8150
+	 *
8151
+	 */
8152 8152
 	public function countOverallAirlines()
8153 8153
 	{
8154 8154
 		$query  = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count 
@@ -8162,11 +8162,11 @@  discard block
 block discarded – undo
8162 8162
 
8163 8163
   
8164 8164
 	/**
8165
-	* Counts all hours of today
8166
-	*
8167
-	* @return Array the hour list
8168
-	*
8169
-	*/
8165
+	 * Counts all hours of today
8166
+	 *
8167
+	 * @return Array the hour list
8168
+	 *
8169
+	 */
8170 8170
 	public function countAllHoursFromToday()
8171 8171
 	{
8172 8172
 		global $globalTimezone, $globalDBdriver;
@@ -8207,11 +8207,11 @@  discard block
 block discarded – undo
8207 8207
 	}
8208 8208
     
8209 8209
 	/**
8210
-	* Gets all the spotter information based on calculated upcoming flights
8211
-	*
8212
-	* @return Array the spotter information
8213
-	*
8214
-	*/
8210
+	 * Gets all the spotter information based on calculated upcoming flights
8211
+	 *
8212
+	 * @return Array the spotter information
8213
+	 *
8214
+	 */
8215 8215
 	public function getUpcomingFlights($limit = '', $sort = '')
8216 8216
 	{
8217 8217
 		global $global_query, $globalDBdriver, $globalTimezone;
@@ -8273,12 +8273,12 @@  discard block
 block discarded – undo
8273 8273
 	}
8274 8274
     
8275 8275
     
8276
-     /**
8277
-	* Gets the Barrie Spotter ID based on the FlightAware ID
8278
-	*
8279
-	* @return Integer the Barrie Spotter ID
8280
-	*
8281
-	*/
8276
+	 /**
8277
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
8278
+	  *
8279
+	  * @return Integer the Barrie Spotter ID
8280
+	  *
8281
+	  */
8282 8282
 	public function getSpotterIDBasedOnFlightAwareID($flightaware_id)
8283 8283
 	{
8284 8284
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -8299,13 +8299,13 @@  discard block
 block discarded – undo
8299 8299
   
8300 8300
  
8301 8301
 	/**
8302
-	* Parses a date string
8303
-	*
8304
-	* @param String $dateString the date string
8305
-	* @param String $timezone the timezone of a user
8306
-	* @return Array the time information
8307
-	*
8308
-	*/
8302
+	 * Parses a date string
8303
+	 *
8304
+	 * @param String $dateString the date string
8305
+	 * @param String $timezone the timezone of a user
8306
+	 * @return Array the time information
8307
+	 *
8308
+	 */
8309 8309
 	public function parseDateString($dateString, $timezone = '')
8310 8310
 	{
8311 8311
 		$time_array = array();
@@ -8341,12 +8341,12 @@  discard block
 block discarded – undo
8341 8341
 	
8342 8342
 	
8343 8343
 	/**
8344
-	* Parses the direction degrees to working
8345
-	*
8346
-	* @param Float $direction the direction in degrees
8347
-	* @return Array the direction information
8348
-	*
8349
-	*/
8344
+	 * Parses the direction degrees to working
8345
+	 *
8346
+	 * @param Float $direction the direction in degrees
8347
+	 * @return Array the direction information
8348
+	 *
8349
+	 */
8350 8350
 	public function parseDirection($direction = 0)
8351 8351
 	{
8352 8352
 		if ($direction == '') $direction = 0;
@@ -8425,18 +8425,18 @@  discard block
 block discarded – undo
8425 8425
 	
8426 8426
 	
8427 8427
 	/**
8428
-	* Gets the aircraft registration
8429
-	*
8430
-	* @param String $flightaware_id the flight aware id
8431
-	* @return String the aircraft registration
8432
-	*
8433
-	*/
8428
+	 * Gets the aircraft registration
8429
+	 *
8430
+	 * @param String $flightaware_id the flight aware id
8431
+	 * @return String the aircraft registration
8432
+	 *
8433
+	 */
8434 8434
 	
8435 8435
 	public function getAircraftRegistration($flightaware_id)
8436 8436
 	{
8437 8437
 		global $globalFlightAwareUsername, $globalFlightAwarePassword;
8438 8438
         
8439
-        $options = array(
8439
+		$options = array(
8440 8440
 			'trace' => true,
8441 8441
 			'exceptions' => 0,
8442 8442
 			'login' => $globalFlightAwareUsername,
@@ -8459,12 +8459,12 @@  discard block
 block discarded – undo
8459 8459
 
8460 8460
 
8461 8461
 	/**
8462
-	* Gets the aircraft registration from ModeS
8463
-	*
8464
-	* @param String $aircraft_modes the flight ModeS in hex
8465
-	* @return String the aircraft registration
8466
-	*
8467
-	*/
8462
+	 * Gets the aircraft registration from ModeS
8463
+	 *
8464
+	 * @param String $aircraft_modes the flight ModeS in hex
8465
+	 * @return String the aircraft registration
8466
+	 *
8467
+	 */
8468 8468
 	
8469 8469
 	public function getAircraftRegistrationBymodeS($aircraft_modes)
8470 8470
 	{
@@ -8477,19 +8477,19 @@  discard block
 block discarded – undo
8477 8477
     
8478 8478
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
8479 8479
 		if (count($row) > 0) {
8480
-		    //return $row['Registration'];
8481
-		    return $row['registration'];
8480
+			//return $row['Registration'];
8481
+			return $row['registration'];
8482 8482
 		} else return '';
8483 8483
 	
8484 8484
 	}
8485 8485
 
8486 8486
 	/**
8487
-	* Gets the aircraft type from ModeS
8488
-	*
8489
-	* @param String $aircraft_modes the flight ModeS in hex
8490
-	* @return String the aircraft type
8491
-	*
8492
-	*/
8487
+	 * Gets the aircraft type from ModeS
8488
+	 *
8489
+	 * @param String $aircraft_modes the flight ModeS in hex
8490
+	 * @return String the aircraft type
8491
+	 *
8492
+	 */
8493 8493
 	
8494 8494
 	public function getAircraftTypeBymodeS($aircraft_modes)
8495 8495
 	{
@@ -8502,19 +8502,19 @@  discard block
 block discarded – undo
8502 8502
     
8503 8503
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
8504 8504
 		if (count($row) > 0) {
8505
-		    if ($row['type_flight'] == null) return '';
8506
-		    else return $row['type_flight'];
8505
+			if ($row['type_flight'] == null) return '';
8506
+			else return $row['type_flight'];
8507 8507
 		} else return '';
8508 8508
 	
8509 8509
 	}
8510 8510
 
8511 8511
 	/**
8512
-	* Gets Countrie from latitude/longitude
8513
-	*
8514
-	* @param String $aircraft_modes the flight ModeS in hex
8515
-	* @return String the aircraft registration
8516
-	*
8517
-	*/
8512
+	 * Gets Countrie from latitude/longitude
8513
+	 *
8514
+	 * @param String $aircraft_modes the flight ModeS in hex
8515
+	 * @return String the aircraft registration
8516
+	 *
8517
+	 */
8518 8518
 	
8519 8519
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
8520 8520
 	{
@@ -8548,12 +8548,12 @@  discard block
 block discarded – undo
8548 8548
 	}
8549 8549
 
8550 8550
 	/**
8551
-	* converts the registration code using the country prefix
8552
-	*
8553
-	* @param String $registration the aircraft registration
8554
-	* @return String the aircraft registration
8555
-	*
8556
-	*/
8551
+	 * converts the registration code using the country prefix
8552
+	 *
8553
+	 * @param String $registration the aircraft registration
8554
+	 * @return String the aircraft registration
8555
+	 *
8556
+	 */
8557 8557
 	public function convertAircraftRegistration($registration)
8558 8558
 	{
8559 8559
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -8591,28 +8591,28 @@  discard block
 block discarded – undo
8591 8591
 		if (strlen($registration_prefix) == 1)
8592 8592
 		{
8593 8593
 			if (0 === strpos($registration, 'N')) {
8594
-                $registration = preg_replace("/^(.{1})/", "$1", $registration);
8595
-            } else {
8596
-                $registration = preg_replace("/^(.{1})/", "$1-", $registration);
8597
-            }
8594
+				$registration = preg_replace("/^(.{1})/", "$1", $registration);
8595
+			} else {
8596
+				$registration = preg_replace("/^(.{1})/", "$1-", $registration);
8597
+			}
8598 8598
 		} else if(strlen($registration_prefix) == 2){
8599
-            if (0 === strpos($registration, 'N')) {
8600
-                $registration = preg_replace("/^(.{2})/", "$1", $registration);
8601
-            } else {
8602
-                $registration = preg_replace("/^(.{2})/", "$1-", $registration);
8603
-            }
8599
+			if (0 === strpos($registration, 'N')) {
8600
+				$registration = preg_replace("/^(.{2})/", "$1", $registration);
8601
+			} else {
8602
+				$registration = preg_replace("/^(.{2})/", "$1-", $registration);
8603
+			}
8604 8604
 		}
8605 8605
 
8606 8606
 		return $registration;	
8607 8607
 	}
8608 8608
 
8609 8609
 	/**
8610
-	* Country from the registration code
8611
-	*
8612
-	* @param String $registration the aircraft registration
8613
-	* @return String the country
8614
-	*
8615
-	*/
8610
+	 * Country from the registration code
8611
+	 *
8612
+	 * @param String $registration the aircraft registration
8613
+	 * @return String the country
8614
+	 *
8615
+	 */
8616 8616
 	public function countryFromAircraftRegistration($registration)
8617 8617
 	{
8618 8618
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -8633,8 +8633,8 @@  discard block
 block discarded – undo
8633 8633
 				$country = $row['country'];
8634 8634
 			}
8635 8635
 		} else {
8636
-    			$registration_1 = substr($registration, 0, 1);
8637
-		        $registration_2 = substr($registration, 0, 2);
8636
+				$registration_1 = substr($registration, 0, 1);
8637
+				$registration_2 = substr($registration, 0, 2);
8638 8638
 
8639 8639
 			$country = '';
8640 8640
 			//first get the prefix based on two characters
@@ -8670,11 +8670,11 @@  discard block
 block discarded – undo
8670 8670
 	}
8671 8671
 	
8672 8672
 	/**
8673
-	* Set a new highlight value for a flight
8674
-	*
8675
-	* @param String $flightaware_id flightaware_id from spotter_output table
8676
-	* @param String $highlight New highlight value
8677
-	*/
8673
+	 * Set a new highlight value for a flight
8674
+	 *
8675
+	 * @param String $flightaware_id flightaware_id from spotter_output table
8676
+	 * @param String $highlight New highlight value
8677
+	 */
8678 8678
 	public function setHighlightFlight($flightaware_id,$highlight) {
8679 8679
 		
8680 8680
 		$query  = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id";
@@ -8683,12 +8683,12 @@  discard block
 block discarded – undo
8683 8683
 	}
8684 8684
 	
8685 8685
 	/**
8686
-	* Gets the short url from bit.ly
8687
-	*
8688
-	* @param String $url the full url
8689
-	* @return String the bit.ly url
8690
-	*
8691
-	*/
8686
+	 * Gets the short url from bit.ly
8687
+	 *
8688
+	 * @param String $url the full url
8689
+	 * @return String the bit.ly url
8690
+	 *
8691
+	 */
8692 8692
 	public function getBitlyURL($url)
8693 8693
 	{
8694 8694
 		global $globalBitlyAccessToken;
@@ -8723,130 +8723,130 @@  discard block
 block discarded – undo
8723 8723
 	}
8724 8724
     
8725 8725
     
8726
-    public function importFromFlightAware()
8727
-    {
8728
-       global $globalFlightAwareUsername, $globalFlightAwarePassword, $globalLatitudeMax, $globalLatitudeMin, $globalLongitudeMax, $globalLongitudeMin, $globalAirportIgnore;
8726
+	public function importFromFlightAware()
8727
+	{
8728
+	   global $globalFlightAwareUsername, $globalFlightAwarePassword, $globalLatitudeMax, $globalLatitudeMin, $globalLongitudeMax, $globalLongitudeMin, $globalAirportIgnore;
8729 8729
 	$Spotter = new Spotter($this->db);
8730 8730
 	$SPotterLive = new SpotterLive($this->db);
8731
-        $options = array(
8732
-            'trace' => true,
8733
-            'exceptions' => 0,
8734
-            'login' => $globalFlightAwareUsername,
8735
-            'password' => $globalFlightAwarePassword,
8736
-        );
8737
-        $client = new SoapClient('http://flightxml.flightaware.com/soap/FlightXML2/wsdl', $options);
8738
-
8739
-        $params = array('query' => '{range lat '.$globalLatitudeMin.' '.$globalLatitudeMax.'} {range lon '.$globalLongitudeMax.' '.$globalLongitudeMin.'} {true inAir}', 'howMany' => '15', 'offset' => '0');
8731
+		$options = array(
8732
+			'trace' => true,
8733
+			'exceptions' => 0,
8734
+			'login' => $globalFlightAwareUsername,
8735
+			'password' => $globalFlightAwarePassword,
8736
+		);
8737
+		$client = new SoapClient('http://flightxml.flightaware.com/soap/FlightXML2/wsdl', $options);
8738
+
8739
+		$params = array('query' => '{range lat '.$globalLatitudeMin.' '.$globalLatitudeMax.'} {range lon '.$globalLongitudeMax.' '.$globalLongitudeMin.'} {true inAir}', 'howMany' => '15', 'offset' => '0');
8740 8740
         
8741
-        $result = $client->SearchBirdseyeInFlight($params);
8741
+		$result = $client->SearchBirdseyeInFlight($params);
8742 8742
 
8743
-        $dataFound = false;
8744
-        $ignoreImport = false;
8743
+		$dataFound = false;
8744
+		$ignoreImport = false;
8745 8745
         
8746
-        if (isset($result->SearchBirdseyeInFlightResult))
8747
-        {
8748
-            if (is_array($result->SearchBirdseyeInFlightResult->aircraft))
8749
-            {
8750
-                    foreach($result->SearchBirdseyeInFlightResult->aircraft as $aircraft)
8751
-                    {
8752
-                        if (!strstr($aircraft->origin, 'L ') && !strstr($aircraft->destination, 'L '))
8753
-                        {
8754
-                            foreach($globalAirportIgnore as $airportIgnore)
8755
-                            {
8756
-                                if ($aircraft->origin == $airportIgnore || $aircraft->destination == $airportIgnore)
8757
-                                {
8758
-                                   $ignoreImport = true; 
8759
-                                }
8760
-                            }
8761
-                            if ($ignoreImport == false)
8762
-                            {
8763
-                            $flightaware_id = $aircraft->faFlightID;
8764
-                            $ident = $aircraft->ident;
8765
-                            $aircraft_type = $aircraft->type;
8766
-                            $departure_airport = $aircraft->origin;
8767
-                            $arrival_airport = $aircraft->destination;
8768
-                            $latitude = $aircraft->latitude;
8769
-                            $longitude = $aircraft->longitude;
8770
-                            $waypoints = $aircraft->waypoints;
8771
-                            $altitude = $aircraft->altitude;
8772
-                            $heading = $aircraft->heading;
8773
-                            $groundspeed = $aircraft->groundspeed;
8774
-
8775
-                            $dataFound = true;
8776
-
8777
-                            //gets the callsign from the last hour
8778
-                            $last_hour_ident = $this->getIdentFromLastHour($ident);
8779
-
8780
-                            //change the departure/arrival airport to NA if its not available
8781
-                                if ($departure_airport == "" || $departure_airport == "---" || $departure_airport == "ZZZ" || $departure_airport == "ZZZZ") { $departure_airport = "NA"; }
8782
-                                if ($arrival_airport == "" || $arrival_airport == "---" || $arrival_airport == "ZZZ" || $arrival_airport == "ZZZZ") { $arrival_airport = "NA"; }
8783
-
8784
-
8785
-                            //if there was no aircraft with the same callsign within the last hour and go post it into the archive
8786
-                            if($last_hour_ident == "")
8787
-                            {
8788
-                                //adds the spotter data for the archive
8789
-                                $Spotter->addSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
8790
-                            }
8791
-
8792
-                            //adds the spotter LIVE data
8793
-                            $SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
8794
-                        }
8795
-                        }
8796
-                        $ignoreImport = false;
8797
-                    }
8798
-                } else {
8799
-                    if (!strstr($result->SearchBirdseyeInFlightResult->aircraft->origin, 'L ') && !strstr($result->SearchBirdseyeInFlightResult->aircraft->destination, 'L '))
8800
-                    {
8801
-                        foreach($globalAirportIgnore as $airportIgnore)
8802
-                        {
8803
-                            foreach($globalAirportIgnore as $airportIgnore)
8804
-                            {
8805
-                                if ($aircraft->origin == $airportIgnore || $aircraft->destination == $airportIgnore)
8806
-                                {
8807
-                                   $ignoreImport = true; 
8808
-                                }
8809
-                            }
8810
-                            if ($ignoreImport == false)
8811
-                            {
8812
-                        $flightaware_id = $result->SearchBirdseyeInFlightResult->aircraft->faFlightID;
8813
-                        $ident = $result->SearchBirdseyeInFlightResult->aircraft->ident;
8814
-                        $aircraft_type = $result->SearchBirdseyeInFlightResult->aircraft->type;
8815
-                        $departure_airport = $result->SearchBirdseyeInFlightResult->aircraft->origin;
8816
-                        $arrival_airport = $result->SearchBirdseyeInFlightResult->aircraft->destination;
8817
-                        $latitude = $result->SearchBirdseyeInFlightResult->aircraft->latitude;
8818
-                        $longitude = $result->SearchBirdseyeInFlightResult->aircraft->longitude;
8819
-                        $waypoints = $result->SearchBirdseyeInFlightResult->aircraft->waypoints;
8820
-                        $altitude = $result->SearchBirdseyeInFlightResult->aircraft->altitude;
8821
-                        $heading = $result->SearchBirdseyeInFlightResult->aircraft->heading;
8822
-                        $groundspeed = $result->SearchBirdseyeInFlightResult->aircraft->groundspeed;
8823
-
8824
-                        $dataFound = true;
8825
-
8826
-                        //gets the callsign from the last hour
8827
-                        $last_hour_ident = $this->getIdentFromLastHour($ident);
8828
-
8829
-                        //change the departure/arrival airport to NA if its not available
8830
-                                if ($departure_airport == "" || $departure_airport == "---" || $departure_airport == "ZZZ" || $departure_airport == "ZZZZ") { $departure_airport = "NA"; }
8831
-                                if ($arrival_airport == "" || $arrival_airport == "---" || $arrival_airport == "ZZZ" || $arrival_airport == "ZZZZ") { $arrival_airport = "NA"; }
8832
-
8833
-                        //if there was no aircraft with the same callsign within the last hour and go post it into the archive
8834
-                        if($last_hour_ident == "")
8835
-                        {
8836
-                            //adds the spotter data for the archive
8837
-                            $Spotter->addSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
8838
-                        }
8839
-
8840
-                        //adds the spotter LIVE data
8841
-                        $SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
8842
-                    }
8843
-                            $ignoreImport = false;
8844
-                        }
8845
-                    }
8846
-
8847
-                }
8848
-        } 
8849
-    }
8746
+		if (isset($result->SearchBirdseyeInFlightResult))
8747
+		{
8748
+			if (is_array($result->SearchBirdseyeInFlightResult->aircraft))
8749
+			{
8750
+					foreach($result->SearchBirdseyeInFlightResult->aircraft as $aircraft)
8751
+					{
8752
+						if (!strstr($aircraft->origin, 'L ') && !strstr($aircraft->destination, 'L '))
8753
+						{
8754
+							foreach($globalAirportIgnore as $airportIgnore)
8755
+							{
8756
+								if ($aircraft->origin == $airportIgnore || $aircraft->destination == $airportIgnore)
8757
+								{
8758
+								   $ignoreImport = true; 
8759
+								}
8760
+							}
8761
+							if ($ignoreImport == false)
8762
+							{
8763
+							$flightaware_id = $aircraft->faFlightID;
8764
+							$ident = $aircraft->ident;
8765
+							$aircraft_type = $aircraft->type;
8766
+							$departure_airport = $aircraft->origin;
8767
+							$arrival_airport = $aircraft->destination;
8768
+							$latitude = $aircraft->latitude;
8769
+							$longitude = $aircraft->longitude;
8770
+							$waypoints = $aircraft->waypoints;
8771
+							$altitude = $aircraft->altitude;
8772
+							$heading = $aircraft->heading;
8773
+							$groundspeed = $aircraft->groundspeed;
8774
+
8775
+							$dataFound = true;
8776
+
8777
+							//gets the callsign from the last hour
8778
+							$last_hour_ident = $this->getIdentFromLastHour($ident);
8779
+
8780
+							//change the departure/arrival airport to NA if its not available
8781
+								if ($departure_airport == "" || $departure_airport == "---" || $departure_airport == "ZZZ" || $departure_airport == "ZZZZ") { $departure_airport = "NA"; }
8782
+								if ($arrival_airport == "" || $arrival_airport == "---" || $arrival_airport == "ZZZ" || $arrival_airport == "ZZZZ") { $arrival_airport = "NA"; }
8783
+
8784
+
8785
+							//if there was no aircraft with the same callsign within the last hour and go post it into the archive
8786
+							if($last_hour_ident == "")
8787
+							{
8788
+								//adds the spotter data for the archive
8789
+								$Spotter->addSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
8790
+							}
8791
+
8792
+							//adds the spotter LIVE data
8793
+							$SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
8794
+						}
8795
+						}
8796
+						$ignoreImport = false;
8797
+					}
8798
+				} else {
8799
+					if (!strstr($result->SearchBirdseyeInFlightResult->aircraft->origin, 'L ') && !strstr($result->SearchBirdseyeInFlightResult->aircraft->destination, 'L '))
8800
+					{
8801
+						foreach($globalAirportIgnore as $airportIgnore)
8802
+						{
8803
+							foreach($globalAirportIgnore as $airportIgnore)
8804
+							{
8805
+								if ($aircraft->origin == $airportIgnore || $aircraft->destination == $airportIgnore)
8806
+								{
8807
+								   $ignoreImport = true; 
8808
+								}
8809
+							}
8810
+							if ($ignoreImport == false)
8811
+							{
8812
+						$flightaware_id = $result->SearchBirdseyeInFlightResult->aircraft->faFlightID;
8813
+						$ident = $result->SearchBirdseyeInFlightResult->aircraft->ident;
8814
+						$aircraft_type = $result->SearchBirdseyeInFlightResult->aircraft->type;
8815
+						$departure_airport = $result->SearchBirdseyeInFlightResult->aircraft->origin;
8816
+						$arrival_airport = $result->SearchBirdseyeInFlightResult->aircraft->destination;
8817
+						$latitude = $result->SearchBirdseyeInFlightResult->aircraft->latitude;
8818
+						$longitude = $result->SearchBirdseyeInFlightResult->aircraft->longitude;
8819
+						$waypoints = $result->SearchBirdseyeInFlightResult->aircraft->waypoints;
8820
+						$altitude = $result->SearchBirdseyeInFlightResult->aircraft->altitude;
8821
+						$heading = $result->SearchBirdseyeInFlightResult->aircraft->heading;
8822
+						$groundspeed = $result->SearchBirdseyeInFlightResult->aircraft->groundspeed;
8823
+
8824
+						$dataFound = true;
8825
+
8826
+						//gets the callsign from the last hour
8827
+						$last_hour_ident = $this->getIdentFromLastHour($ident);
8828
+
8829
+						//change the departure/arrival airport to NA if its not available
8830
+								if ($departure_airport == "" || $departure_airport == "---" || $departure_airport == "ZZZ" || $departure_airport == "ZZZZ") { $departure_airport = "NA"; }
8831
+								if ($arrival_airport == "" || $arrival_airport == "---" || $arrival_airport == "ZZZ" || $arrival_airport == "ZZZZ") { $arrival_airport = "NA"; }
8832
+
8833
+						//if there was no aircraft with the same callsign within the last hour and go post it into the archive
8834
+						if($last_hour_ident == "")
8835
+						{
8836
+							//adds the spotter data for the archive
8837
+							$Spotter->addSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
8838
+						}
8839
+
8840
+						//adds the spotter LIVE data
8841
+						$SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed);
8842
+					}
8843
+							$ignoreImport = false;
8844
+						}
8845
+					}
8846
+
8847
+				}
8848
+		} 
8849
+	}
8850 8850
 
8851 8851
 
8852 8852
 	// Update flights data when new data in DB
@@ -8987,11 +8987,11 @@  discard block
 block discarded – undo
8987 8987
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance 
8988 8988
 	                      FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
8989 8989
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
8990
-                } else {
8990
+				} else {
8991 8991
 			$query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance 
8992 8992
 	                      FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
8993 8993
 	                      AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;";
8994
-    		}
8994
+			}
8995 8995
 		$sth = $this->db->prepare($query);
8996 8996
 		$sth->execute();
8997 8997
 		return $sth->fetchAll(PDO::FETCH_ASSOC);
Please login to merge, or discard this patch.
require/class.ATC.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -4,76 +4,76 @@
 block discarded – undo
4 4
 
5 5
 class ATC {
6 6
 	public $db;
7
-        function __construct($dbc = null) {
8
-    		$Connection = new Connection($dbc);
9
-    		$this->db = $Connection->db;
7
+		function __construct($dbc = null) {
8
+			$Connection = new Connection($dbc);
9
+			$this->db = $Connection->db;
10 10
 	}
11 11
 
12
-       public function getAll() {
13
-                $query = "SELECT * FROM atc GROUP BY ident";
14
-                $query_values = array();
15
-                 try {
16
-                        $sth = $this->db->prepare($query);
17
-                        $sth->execute($query_values);
18
-                } catch(PDOException $e) {
19
-                        return "error : ".$e->getMessage();
20
-                }
21
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
22
-                return $all;
23
-        }
12
+	   public function getAll() {
13
+				$query = "SELECT * FROM atc GROUP BY ident";
14
+				$query_values = array();
15
+				 try {
16
+						$sth = $this->db->prepare($query);
17
+						$sth->execute($query_values);
18
+				} catch(PDOException $e) {
19
+						return "error : ".$e->getMessage();
20
+				}
21
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
22
+				return $all;
23
+		}
24 24
 
25
-       public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '') {
26
-    		$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
27
-    		$info = str_replace('^','<br />',$info);
28
-    		$info = str_replace('&amp;sect;','',$info);
29
-    		$info = str_replace('"','',$info);
30
-    		if ($type == '') $type = NULL;
31
-                $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name)";
32
-                $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type);
33
-                 try {
34
-                        $sth = $this->db->prepare($query);
35
-                        $sth->execute($query_values);
36
-                } catch(PDOException $e) {
37
-                        return "error : ".$e->getMessage();
38
-                }
39
-        }
25
+	   public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '') {
26
+			$info = preg_replace('/[^(\x20-\x7F)]*/','',$info);
27
+			$info = str_replace('^','<br />',$info);
28
+			$info = str_replace('&amp;sect;','',$info);
29
+			$info = str_replace('"','',$info);
30
+			if ($type == '') $type = NULL;
31
+				$query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name)";
32
+				$query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type);
33
+				 try {
34
+						$sth = $this->db->prepare($query);
35
+						$sth->execute($query_values);
36
+				} catch(PDOException $e) {
37
+						return "error : ".$e->getMessage();
38
+				}
39
+		}
40 40
 
41
-       public function deleteById($id) {
42
-                $query = "DELETE FROM atc WHERE atc_id = :id";
43
-                $query_values = array(':id' => $id);
44
-                 try {
45
-                        $sth = $this->db->prepare($query);
46
-                        $sth->execute($query_values);
47
-                } catch(PDOException $e) {
48
-                        return "error : ".$e->getMessage();
49
-                }
50
-        }
41
+	   public function deleteById($id) {
42
+				$query = "DELETE FROM atc WHERE atc_id = :id";
43
+				$query_values = array(':id' => $id);
44
+				 try {
45
+						$sth = $this->db->prepare($query);
46
+						$sth->execute($query_values);
47
+				} catch(PDOException $e) {
48
+						return "error : ".$e->getMessage();
49
+				}
50
+		}
51 51
 
52
-       public function deleteAll() {
53
-                $query = "DELETE FROM atc";
54
-                $query_values = array();
55
-                 try {
56
-                        $sth = $this->db->prepare($query);
57
-                        $sth->execute($query_values);
58
-                } catch(PDOException $e) {
59
-                        return "error : ".$e->getMessage();
60
-                }
61
-        }
52
+	   public function deleteAll() {
53
+				$query = "DELETE FROM atc";
54
+				$query_values = array();
55
+				 try {
56
+						$sth = $this->db->prepare($query);
57
+						$sth->execute($query_values);
58
+				} catch(PDOException $e) {
59
+						return "error : ".$e->getMessage();
60
+				}
61
+		}
62 62
 
63 63
 	public function deleteOldATC() {
64
-                global $globalDBdriver;
65
-                if ($globalDBdriver == 'mysql') {
66
-                        $query  = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen";
67
-                } elseif ($globalDBdriver == 'pgsql') {
68
-                        $query  = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen";
69
-                }
70
-                try {
71
-                        $sth = $this->db->prepare($query);
72
-                        $sth->execute();
73
-                } catch(PDOException $e) {
74
-                        return "error";
75
-                }
76
-                return "success";
77
-        }
64
+				global $globalDBdriver;
65
+				if ($globalDBdriver == 'mysql') {
66
+						$query  = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen";
67
+				} elseif ($globalDBdriver == 'pgsql') {
68
+						$query  = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen";
69
+				}
70
+				try {
71
+						$sth = $this->db->prepare($query);
72
+						$sth->execute();
73
+				} catch(PDOException $e) {
74
+						return "error";
75
+				}
76
+				return "success";
77
+		}
78 78
 }
79 79
 ?>
80 80
\ No newline at end of file
Please login to merge, or discard this patch.
require/class.SpotterServer.php 1 patch
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -7,121 +7,121 @@
 block discarded – undo
7 7
 require_once(dirname(__FILE__).'/class.Translation.php');
8 8
 
9 9
 class SpotterServer {
10
-    public $dbs = null;
10
+	public $dbs = null;
11 11
     
12
-    function __construct($dbs = null) {
12
+	function __construct($dbs = null) {
13 13
 	if ($dbs === null) {
14
-	    $Connection = new Connection(null,'server');
15
-	    $this->dbs = $Connection->dbs;
16
-	    $query = "CREATE TABLE IF NOT EXISTS `spotter_temp` ( `id_data` INT NOT NULL AUTO_INCREMENT , `id_user` INT NOT NULL , `datetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `hex` VARCHAR(20) NOT NULL , `ident` VARCHAR(20) NULL , `latitude` FLOAT NULL , `longitude` FLOAT NULL , `verticalrate` INT NULL , `speed` INT NULL , `squawk` INT NULL , `altitude` INT NULL , `heading` INT NULL , `registration` VARCHAR(10) NULL , `aircraft_icao` VARCHAR(10) NULL , `waypoints` VARCHAR(255) NULL , `noarchive` BOOLEAN NOT NULL DEFAULT FALSE, `id_source` INT NOT NULL DEFAULT '1', `format_source` VARCHAR(25) NULL, `source_name` VARCHAR(25) NULL, `over_country` VARCHAR(255) NULL, PRIMARY KEY (`id_data`) ) ENGINE = MEMORY;";
17
-	    try {
14
+		$Connection = new Connection(null,'server');
15
+		$this->dbs = $Connection->dbs;
16
+		$query = "CREATE TABLE IF NOT EXISTS `spotter_temp` ( `id_data` INT NOT NULL AUTO_INCREMENT , `id_user` INT NOT NULL , `datetime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , `hex` VARCHAR(20) NOT NULL , `ident` VARCHAR(20) NULL , `latitude` FLOAT NULL , `longitude` FLOAT NULL , `verticalrate` INT NULL , `speed` INT NULL , `squawk` INT NULL , `altitude` INT NULL , `heading` INT NULL , `registration` VARCHAR(10) NULL , `aircraft_icao` VARCHAR(10) NULL , `waypoints` VARCHAR(255) NULL , `noarchive` BOOLEAN NOT NULL DEFAULT FALSE, `id_source` INT NOT NULL DEFAULT '1', `format_source` VARCHAR(25) NULL, `source_name` VARCHAR(25) NULL, `over_country` VARCHAR(255) NULL, PRIMARY KEY (`id_data`) ) ENGINE = MEMORY;";
17
+		try {
18 18
 		$sth = $this->dbs['server']->exec($query);
19
-	    } catch(PDOException $e) {
19
+		} catch(PDOException $e) {
20 20
 		return "error : ".$e->getMessage();
21
-	    }
21
+		}
22
+	}
22 23
 	}
23
-    }
24 24
     
25
-    function checkAll() {
26
-        return true;
27
-    }
25
+	function checkAll() {
26
+		return true;
27
+	}
28 28
     
29
-    function add($line) {
29
+	function add($line) {
30 30
 	global $globalDebug, $globalServerUserID;
31 31
 	date_default_timezone_set('UTC');
32 32
 	//if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'aprs')) {
33 33
 	if (isset($line['format_source'])) {
34
-	    if(is_array($line) && isset($line['hex'])) {
34
+		if(is_array($line) && isset($line['hex'])) {
35 35
 		if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) {
36
-		    $data['hex'] = trim($line['hex']);
37
-		    if (preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
38
-		        $data['datetime'] = $line['datetime'];
39
-		    } else $data['datetime'] = date('Y-m-d H:i:s');
40
-		    if (!isset($line['aircraft_icao'])) {
41
-		        $Spotter = new Spotter();
42
-		        $aircraft_icao = $Spotter->getAllAircraftType($data['hex']);
43
-		        $Spotter->db = null;
36
+			$data['hex'] = trim($line['hex']);
37
+			if (preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
38
+				$data['datetime'] = $line['datetime'];
39
+			} else $data['datetime'] = date('Y-m-d H:i:s');
40
+			if (!isset($line['aircraft_icao'])) {
41
+				$Spotter = new Spotter();
42
+				$aircraft_icao = $Spotter->getAllAircraftType($data['hex']);
43
+				$Spotter->db = null;
44 44
 			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';
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';
49 49
 			}
50 50
 			$data['aircraft_icao'] = $aircraft_icao;
51
-		    } else $data['aircraft_icao'] = $line['aircraft_icao'];
52
-		    //if ($globalDebug) echo "*********** New aircraft hex : ".$data['hex']." ***********\n";
51
+			} else $data['aircraft_icao'] = $line['aircraft_icao'];
52
+			//if ($globalDebug) echo "*********** New aircraft hex : ".$data['hex']." ***********\n";
53 53
 		}
54 54
 		if (isset($line['registration']) && $line['registration'] != '') {
55
-		    $data['registration'] = $line['registration'];
55
+			$data['registration'] = $line['registration'];
56 56
 		} else $data['registration'] = null;
57 57
 		if (isset($line['waypoints']) && $line['waypoints'] != '') {
58
-		    $data['waypoints'] = $line['waypoints'];
58
+			$data['waypoints'] = $line['waypoints'];
59 59
 		} else $data['waypoints'] = null;
60 60
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) {
61
-		    $data['ident'] = trim($line['ident']);
61
+			$data['ident'] = trim($line['ident']);
62 62
 		} else $data['ident'] = null;
63 63
 
64
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '') {
65
-		    if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
64
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '') {
65
+			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
66 66
 			$data['latitude'] = $line['latitude'];
67
-		    } else $data['latitude'] = null;
68
-		    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;
67
+			} else $data['latitude'] = null;
68
+			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;
70 70
 			$data['longitude'] = $line['longitude'];
71
-		    } else $data['longitude'] = null;
71
+			} else $data['longitude'] = null;
72 72
 		} else {
73
-		    $data['latitude'] = null;
74
-		    $data['longitude'] = null;
73
+			$data['latitude'] = null;
74
+			$data['longitude'] = null;
75 75
 		}
76 76
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
77
-		    $data['verticalrate'] = $line['verticalrate'];
77
+			$data['verticalrate'] = $line['verticalrate'];
78 78
 		} else $data['verticalrate'] = null;
79 79
 		if (isset($line['emergency']) && $line['emergency'] != '') {
80
-		    $data['emergency'] = $line['emergency'];
80
+			$data['emergency'] = $line['emergency'];
81 81
 		} else $data['emergency'] = null;
82 82
 		if (isset($line['ground']) && $line['ground'] != '') {
83
-		    $data['ground'] = $line['ground'];
83
+			$data['ground'] = $line['ground'];
84 84
 		} else $data['ground'] = null;
85 85
 		if (isset($line['speed']) && $line['speed'] != '') {
86
-		    $data['speed'] = round($line['speed']);
86
+			$data['speed'] = round($line['speed']);
87 87
 		} else $data['speed'] = null;
88 88
 		if (isset($line['squawk']) && $line['squawk'] != '') {
89
-		    $data['squawk'] = $line['squawk'];
89
+			$data['squawk'] = $line['squawk'];
90 90
 		} else $data['squawk'] = null;
91 91
 
92 92
 		if (isset($line['altitude']) && $line['altitude'] != '') {
93 93
 			$data['altitude'] = round($line['altitude']);
94 94
   		} else $data['altitude'] = null;
95 95
 		if (isset($line['heading']) && $line['heading'] != '') {
96
-		    $data['heading'] = round($line['heading']);
96
+			$data['heading'] = round($line['heading']);
97 97
   		} else $data['heading'] = null;
98 98
 		if (isset($line['source_name']) && $line['source_name'] != '') {
99
-		    $data['source_name'] = $line['source_name'];
99
+			$data['source_name'] = $line['source_name'];
100 100
   		} else $data['source_name'] = null;
101 101
 		if (isset($line['over_country']) && $line['over_country'] != '') {
102
-		    $data['over_country'] = $line['over_country'];
102
+			$data['over_country'] = $line['over_country'];
103 103
   		} else $data['over_country'] = null;
104 104
   		if (isset($line['noarchive']) && $line['noarchive']) {
105
-  		    $data['noarchive'] = true;
105
+  			$data['noarchive'] = true;
106 106
   		} else $data['noarchive'] = false;
107 107
   		$data['format_source'] = $line['format_source'];
108 108
   		if (isset($line['id_source'])) $id_source = $line['id_source'];
109 109
   		if (isset($data['hex'])) {
110
-  		    echo '.';
111
-  		    $id_user = $globalServerUserID;
112
-  		    if ($id_user == NULL) $id_user = 1;
113
-  		    if (!isset($id_source)) $id_source = 1;
114
-  		    $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
-		    $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
-		    try {
117
-                        $sth = $this->dbs['server']->prepare($query);
118
-                        $sth->execute($query_values);
119
-                    } catch(PDOException $e) {
120
-                        return "error : ".$e->getMessage();
121
-            	    }
122
-        	}
123
-    	    }
110
+  			echo '.';
111
+  			$id_user = $globalServerUserID;
112
+  			if ($id_user == NULL) $id_user = 1;
113
+  			if (!isset($id_source)) $id_source = 1;
114
+  			$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
+			$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
+			try {
117
+						$sth = $this->dbs['server']->prepare($query);
118
+						$sth->execute($query_values);
119
+					} catch(PDOException $e) {
120
+						return "error : ".$e->getMessage();
121
+					}
122
+			}
123
+			}
124
+	}
124 125
 	}
125
-    }
126 126
 }
127 127
 ?>
Please login to merge, or discard this patch.
manufacturer-statistics-time.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['aircraft_manufacturer'])) {
6
-        header('Location: '.$globalURL.'/manufacturer');
7
-        die();
6
+		header('Location: '.$globalURL.'/manufacturer');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)));
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
           function drawChart() {
54 54
             var data = google.visualization.arrayToDataTable([
55 55
             	["'._("Hour").'", "'._("# of Flights").'"], ';
56
-            	$hour_data = '';
56
+				$hour_data = '';
57 57
 	foreach($hour_array as $hour_item)
58 58
 	{
59 59
 		$hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],';
Please login to merge, or discard this patch.
search-json.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -4,55 +4,55 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7
-        //for the date manipulation into the query
8
-        if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
-                $start_date = $_GET['start_date'].":00";
10
-                $end_date = $_GET['end_date'].":00";
11
-                $sql_date = $start_date.",".$end_date;
12
-        } else if($_GET['start_date'] != ""){
13
-                $start_date = $_GET['start_date'].":00";
14
-                $sql_date = $start_date;
15
-        } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
-                $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
-                $sql_date = $end_date;
18
-        } else $sql_date = '';
7
+		//for the date manipulation into the query
8
+		if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
9
+				$start_date = $_GET['start_date'].":00";
10
+				$end_date = $_GET['end_date'].":00";
11
+				$sql_date = $start_date.",".$end_date;
12
+		} else if($_GET['start_date'] != ""){
13
+				$start_date = $_GET['start_date'].":00";
14
+				$sql_date = $start_date;
15
+		} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16
+				$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17
+				$sql_date = $end_date;
18
+		} else $sql_date = '';
19 19
 } else $sql_date = '';
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22
-        //for altitude manipulation
23
-        if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-                $end_altitude = $_GET['highest_altitude'];
25
-                $start_altitude = $_GET['lowest_altitude'];
26
-                $sql_altitude = $start_altitude.",".$end_altitude;
27
-        } else if($_GET['highest_altitude'] != ""){
28
-                $end_altitude = $_GET['highest_altitude'];
29
-                $sql_altitude = $end_altitude;
30
-        } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-                $start_altitude = $_GET['lowest_altitude'].",60000";
32
-                $sql_altitude = $start_altitude;
33
-        } else $sql_altitude = '';
22
+		//for altitude manipulation
23
+		if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
+				$end_altitude = $_GET['highest_altitude'];
25
+				$start_altitude = $_GET['lowest_altitude'];
26
+				$sql_altitude = $start_altitude.",".$end_altitude;
27
+		} else if($_GET['highest_altitude'] != ""){
28
+				$end_altitude = $_GET['highest_altitude'];
29
+				$sql_altitude = $end_altitude;
30
+		} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
+				$start_altitude = $_GET['lowest_altitude'].",60000";
32
+				$sql_altitude = $start_altitude;
33
+		} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37 37
 if(!isset($_GET['limit']))
38 38
 {
39
-        if (!isset($_GET['number_results']))
40
-        {
41
-                $limit_start = 0;
42
-                $limit_end = 25;
43
-                $absolute_difference = 25;
44
-        } else {
45
-                if ($_GET['number_results'] > 1000){
46
-                        $_GET['number_results'] = 1000;
47
-                }
48
-                $limit_start = 0;
49
-                $limit_end = $_GET['number_results'];
50
-                $absolute_difference = $_GET['number_results'];
51
-        }
39
+		if (!isset($_GET['number_results']))
40
+		{
41
+				$limit_start = 0;
42
+				$limit_end = 25;
43
+				$absolute_difference = 25;
44
+		} else {
45
+				if ($_GET['number_results'] > 1000){
46
+						$_GET['number_results'] = 1000;
47
+				}
48
+				$limit_start = 0;
49
+				$limit_end = $_GET['number_results'];
50
+				$absolute_difference = $_GET['number_results'];
51
+		}
52 52
 }  else {
53
-        $limit_explode = explode(",", $_GET['limit']);
54
-        $limit_start = $limit_explode[0];
55
-        $limit_end = $limit_explode[1];
53
+		$limit_explode = explode(",", $_GET['limit']);
54
+		$limit_start = $limit_explode[0];
55
+		$limit_end = $limit_explode[1];
56 56
 }
57 57
 
58 58
 $absolute_difference = abs($limit_start - $limit_end);
@@ -89,52 +89,52 @@  discard block
 block discarded – undo
89 89
        
90 90
 $output = '{';
91 91
   $output .= '"flightairmap": {';
92
-    $output .= '"title": "FlightAirMap JSON Feed",';
93
-    $output .= '"link": "http://www.flightairmap.fr",';
94
-    $output .= '"aircraft": [';
92
+	$output .= '"title": "FlightAirMap JSON Feed",';
93
+	$output .= '"link": "http://www.flightairmap.fr",';
94
+	$output .= '"aircraft": [';
95 95
     
96
-    if (!empty($spotter_array))
96
+	if (!empty($spotter_array))
97 97
 	  {
98
-	    foreach($spotter_array as $spotter_item)
99
-	    {
98
+		foreach($spotter_array as $spotter_item)
99
+		{
100 100
 				
101 101
 				$output .= '{';    	
102
-		            $output .= '"id": "'.$spotter_item['spotter_id'].'",';
103
-                    $output .= '"ident": "'.$spotter_item['ident'].'",';
104
-                    $output .= '"registration": "'.$spotter_item['registration'].'",';
105
-                    $output .= '"aircraft_icao": "'.$spotter_item['aircraft_type'].'",';
106
-                    $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].'",';
107
-                    $output .= '"aircraft_manufacturer": "'.$spotter_item['aircraft_manufacturer'].'",';
108
-                    $output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
109
-                    $output .= '"airline_icao": "'.$spotter_item['airline_icao'].'",';
110
-                    $output .= '"airline_iata": "'.$spotter_item['airline_iata'].'",';
111
-                    $output .= '"airline_country": "'.$spotter_item['airline_country'].'",';
112
-                    $output .= '"airline_callsign": "'.$spotter_item['airline_callsign'].'",';
113
-                    $output .= '"airline_type": "'.$spotter_item['airline_type'].'",';
114
-                    $output .= '"departure_airport_city": "'.$spotter_item['departure_airport_city'].'",';
115
-                    $output .= '"departure_airport_country": "'.$spotter_item['departure_airport_country'].'",';
116
-                    $output .= '"departure_airport_iata": "'.$spotter_item['departure_airport_iata'].'",';
117
-                    $output .= '"departure_airport_icao": "'.$spotter_item['departure_airport_icao'].'",';
118
-                    $output .= '"departure_airport_latitude": "'.$spotter_item['departure_airport_latitude'].'",';
119
-                    $output .= '"departure_airport_longitude": "'.$spotter_item['departure_airport_longitude'].'",';
120
-                    $output .= '"departure_airport_altitude": "'.$spotter_item['departure_airport_altitude'].'",'; 
121
-                    $output .= '"arrival_airport_city": "'.$spotter_item['arrival_airport_city'].'",';
122
-                    $output .= '"arrival_airport_country": "'.$spotter_item['arrival_airport_country'].'",';
123
-                    $output .= '"arrival_airport_iata": "'.$spotter_item['arrival_airport_iata'].'",';
124
-                    $output .= '"departure_airport_icao": "'.$spotter_item['arrival_airport_icao'].'",';
125
-                    $output .= '"arrival_airport_latitude": "'.$spotter_item['arrival_airport_latitude'].'",';
126
-                    $output .= '"arrival_airport_longitude": "'.$spotter_item['arrival_airport_longitude'].'",';
127
-                    $output .= '"arrival_airport_altitude": "'.$spotter_item['arrival_airport_altitude'].'",';
128
-                    $output .= '"latitude": "'.$spotter_item['latitude'].'",';
129
-                    $output .= '"longitude": "'.$spotter_item['longitude'].'",';
130
-                    $output .= '"altitude": "'.$spotter_item['altitude'].'",';
131
-                    $output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
132
-                    $output .= '"heading": "'.$spotter_item['heading'].'",';
133
-                    $output .= '"heading_name": "'.$spotter_item['heading_name'].'",';
134
-                    $output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
135
-                    $output .= '"date": "'.date("c", strtotime($spotter_item['date_iso_8601'])).'"';
102
+					$output .= '"id": "'.$spotter_item['spotter_id'].'",';
103
+					$output .= '"ident": "'.$spotter_item['ident'].'",';
104
+					$output .= '"registration": "'.$spotter_item['registration'].'",';
105
+					$output .= '"aircraft_icao": "'.$spotter_item['aircraft_type'].'",';
106
+					$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].'",';
107
+					$output .= '"aircraft_manufacturer": "'.$spotter_item['aircraft_manufacturer'].'",';
108
+					$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
109
+					$output .= '"airline_icao": "'.$spotter_item['airline_icao'].'",';
110
+					$output .= '"airline_iata": "'.$spotter_item['airline_iata'].'",';
111
+					$output .= '"airline_country": "'.$spotter_item['airline_country'].'",';
112
+					$output .= '"airline_callsign": "'.$spotter_item['airline_callsign'].'",';
113
+					$output .= '"airline_type": "'.$spotter_item['airline_type'].'",';
114
+					$output .= '"departure_airport_city": "'.$spotter_item['departure_airport_city'].'",';
115
+					$output .= '"departure_airport_country": "'.$spotter_item['departure_airport_country'].'",';
116
+					$output .= '"departure_airport_iata": "'.$spotter_item['departure_airport_iata'].'",';
117
+					$output .= '"departure_airport_icao": "'.$spotter_item['departure_airport_icao'].'",';
118
+					$output .= '"departure_airport_latitude": "'.$spotter_item['departure_airport_latitude'].'",';
119
+					$output .= '"departure_airport_longitude": "'.$spotter_item['departure_airport_longitude'].'",';
120
+					$output .= '"departure_airport_altitude": "'.$spotter_item['departure_airport_altitude'].'",'; 
121
+					$output .= '"arrival_airport_city": "'.$spotter_item['arrival_airport_city'].'",';
122
+					$output .= '"arrival_airport_country": "'.$spotter_item['arrival_airport_country'].'",';
123
+					$output .= '"arrival_airport_iata": "'.$spotter_item['arrival_airport_iata'].'",';
124
+					$output .= '"departure_airport_icao": "'.$spotter_item['arrival_airport_icao'].'",';
125
+					$output .= '"arrival_airport_latitude": "'.$spotter_item['arrival_airport_latitude'].'",';
126
+					$output .= '"arrival_airport_longitude": "'.$spotter_item['arrival_airport_longitude'].'",';
127
+					$output .= '"arrival_airport_altitude": "'.$spotter_item['arrival_airport_altitude'].'",';
128
+					$output .= '"latitude": "'.$spotter_item['latitude'].'",';
129
+					$output .= '"longitude": "'.$spotter_item['longitude'].'",';
130
+					$output .= '"altitude": "'.$spotter_item['altitude'].'",';
131
+					$output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
132
+					$output .= '"heading": "'.$spotter_item['heading'].'",';
133
+					$output .= '"heading_name": "'.$spotter_item['heading_name'].'",';
134
+					$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
135
+					$output .= '"date": "'.date("c", strtotime($spotter_item['date_iso_8601'])).'"';
136 136
 				$output .= '},';
137
-	    }
137
+		}
138 138
 	   }
139 139
 	   $output  = substr($output, 0, -1);
140 140
 		 $output .= ']';
Please login to merge, or discard this patch.
airport-statistics-departure-airport-country.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['airport'])) {
6
-        header('Location: '.$globalURL.'/airport');
7
-        die();
6
+		header('Location: '.$globalURL.'/airport');
7
+		die();
8 8
 }
9 9
 $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
10 10
 $Spotter = new Spotter();
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
           function drawChart() {
66 66
             var data = google.visualization.arrayToDataTable([
67 67
             	["'._("Country").'", "'._("# of times").'"], ';
68
-            	$country_data = '';
68
+				$country_data = '';
69 69
 	foreach($airport_country_array as $airport_item)
70 70
 	{
71 71
 		$country_data .= '[ "'.$airport_item['departure_airport_country'].'",'.$airport_item['airport_departure_country_count'].'],';
Please login to merge, or discard this patch.
airport-geojson.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		date_default_timezone_set('UTC');
27 27
 		//waypoint plotting
28 28
 		$output .= '{"type": "Feature",';
29
-		    $output .= '"properties": {';
29
+			$output .= '"properties": {';
30 30
 			$output .= '"name": "'.str_replace('"',"'",$spotter_item['name']).'",';
31 31
 			$output .= '"city": "'.$spotter_item['city'].'",';
32 32
 			$output .= '"country": "'.$spotter_item['country'].'",';
@@ -49,13 +49,13 @@  discard block
 block discarded – undo
49 49
 			$output .= '"homepage": "'.$spotter_item['home_link'].'",';
50 50
 			$output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"';
51 51
 //			$output .= '"photo": "'.$spotter_item['image_thumbnail'].'",';
52
-		    $output .= '},';
53
-		    $output .= '"geometry": {';
52
+			$output .= '},';
53
+			$output .= '"geometry": {';
54 54
 			$output .= '"type": "Point",';
55 55
 			$output .= '"coordinates": [';
56
-			    $output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
56
+				$output .= $spotter_item['longitude'].', '.$spotter_item['latitude'];
57 57
 			$output .= ']';
58
-		    $output .= '}';
58
+			$output .= '}';
59 59
 		$output .= '},';
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.