Completed
Push — master ( 39e860...0f5d36 )
by Yannick
05:38
created
ident-statistics-aircraft.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['ident'])) {
6
-        header('Location: '.$globalURL.'/ident');
7
-        die();
6
+		header('Location: '.$globalURL.'/ident');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
aircraft-statistics-time.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Stats.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['aircraft_type'])) {
7
-        header('Location: '.$globalURL.'/aircraft');
8
-        die();
7
+		header('Location: '.$globalURL.'/aircraft');
8
+		die();
9 9
 }
10 10
 
11 11
 $aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING);
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
           function drawChart() {
65 65
             var data = google.visualization.arrayToDataTable([
66 66
             	["'._("Hour").'", "'._("# of Flights").'"], ';
67
-        $hour_data = '';
67
+		$hour_data = '';
68 68
 	foreach($hour_array as $hour_item)
69 69
 	{
70 70
 		$hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],';
71 71
 	}
72 72
 	$hour_data = substr($hour_data, 0, -1);
73 73
 	print $hour_data;
74
-        print ']);
74
+		print ']);
75 75
     
76 76
             var options = {
77 77
             	legend: {position: "none"},
Please login to merge, or discard this patch.
ident-statistics-airline.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['ident'])) {
6
-        header('Location: '.$globalURL.'/ident');
7
-        die();
6
+		header('Location: '.$globalURL.'/ident');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
airspace-geojson.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,13 +11,13 @@  discard block
 block discarded – undo
11 11
 $Connection = new Connection();
12 12
 
13 13
 if (!$Connection->tableExists('airspace')) {
14
-    die;
14
+	die;
15 15
 }
16 16
 
17 17
 if (isset($_GET['coord'])) 
18 18
 {
19 19
 	$coords = explode(',',$_GET['coord']);
20
-        if ($globalDBdriver == 'mysql') {
20
+		if ($globalDBdriver == 'mysql') {
21 21
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, ST_Envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))";
22 22
 		try {
23 23
 			$sth = $Connection->db->prepare($query);
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		}
38 38
 	}
39 39
 } else {
40
-        if ($globalDBdriver == 'mysql') {
40
+		if ($globalDBdriver == 'mysql') {
41 41
 		$query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace";
42 42
 	} else {
43 43
 		$query = "SELECT *, ST_AsBinary(wkb_geometry,'NDR') AS wkb FROM airspace";
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 }
52 52
 
53 53
 $geojson = array(
54
-    'type' => 'FeatureCollection',
55
-    'features' => array()
54
+	'type' => 'FeatureCollection',
55
+	'features' => array()
56 56
 );
57 57
 
58 58
 while ($row = $sth->fetch(PDO::FETCH_ASSOC))
@@ -109,9 +109,9 @@  discard block
 block discarded – undo
109 109
 			$properties['color'] = '#d9ffcb';
110 110
 		}
111 111
 		$feature = array(
112
-		    'type' => 'Feature',
113
-		    'geometry' => json_decode($geom->out('json')),
114
-		    'properties' => $properties
112
+			'type' => 'Feature',
113
+			'geometry' => json_decode($geom->out('json')),
114
+			'properties' => $properties
115 115
 		);
116 116
 		array_push($geojson['features'], $feature);
117 117
 }
Please login to merge, or discard this patch.
country-statistics-departure-airport-country.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 if (!isset($_GET['country'])) {
6
-        header('Location: '.$globalURL.'/country');
7
-        die();
6
+		header('Location: '.$globalURL.'/country');
7
+		die();
8 8
 }
9 9
 $Spotter = new Spotter();
10 10
 $country = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)));
Please login to merge, or discard this patch.
require/libs/simple_html_dom.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -824,11 +824,11 @@
 block discarded – undo
824 824
 	}
825 825
 
826 826
 	/**
827
-	* Returns true if $string is valid UTF-8 and false otherwise.
828
-	*
829
-	* @param mixed $str String to be tested
830
-	* @return boolean
831
-	*/
827
+	 * Returns true if $string is valid UTF-8 and false otherwise.
828
+	 *
829
+	 * @param mixed $str String to be tested
830
+	 * @return boolean
831
+	 */
832 832
 	static function is_utf8($str)
833 833
 	{
834 834
 		$c=0; $b=0;
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName;
21 21
 		$filters = array();
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 	/**
89
-	* Gets all the spotter information based on the latest data entry
90
-	*
91
-	* @return Array the spotter information
92
-	*
93
-	*/
89
+	 * Gets all the spotter information based on the latest data entry
90
+	 *
91
+	 * @return Array the spotter information
92
+	 *
93
+	 */
94 94
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
95 95
 	{
96 96
 		global $globalDBdriver, $globalLiveInterval;
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	}
133 133
 
134 134
 	/**
135
-	* Gets Minimal Live Spotter data
136
-	*
137
-	* @return Array the spotter information
138
-	*
139
-	*/
135
+	 * Gets Minimal Live Spotter data
136
+	 *
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getMinLiveSpotterData($filter = array())
141 141
 	{
142 142
 		global $globalDBdriver, $globalLiveInterval;
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
 	}
190 190
 
191 191
 	/**
192
-	* Gets Minimal Live Spotter data since xx seconds
193
-	*
194
-	* @return Array the spotter information
195
-	*
196
-	*/
192
+	 * Gets Minimal Live Spotter data since xx seconds
193
+	 *
194
+	 * @return Array the spotter information
195
+	 *
196
+	 */
197 197
 	public function getMinLastLiveSpotterData($filter = array())
198 198
 	{
199 199
 		global $globalDBdriver, $globalLiveInterval;
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 			$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
212 212
 			FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
213 213
 			ORDER BY spotter_live.flightaware_id, spotter_live.date";
214
-                } else {
214
+				} else {
215 215
 /*
216 216
 			$query  = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source 
217 217
 			FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 //			echo $query;
224 224
 		}
225 225
 
226
-    		try {
226
+			try {
227 227
 			$sth = $this->db->prepare($query);
228 228
 			$sth->execute();
229 229
 		} catch(PDOException $e) {
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 	}
236 236
 
237 237
 	/**
238
-	* Gets number of latest data entry
239
-	*
240
-	* @return String number of entry
241
-	*
242
-	*/
238
+	 * Gets number of latest data entry
239
+	 *
240
+	 * @return String number of entry
241
+	 *
242
+	 */
243 243
 	public function getLiveSpotterCount($filter = array())
244 244
 	{
245 245
 		global $globalDBdriver, $globalLiveInterval;
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	}
267 267
 
268 268
 	/**
269
-	* Gets all the spotter information based on the latest data entry and coord
270
-	*
271
-	* @return Array the spotter information
272
-	*
273
-	*/
269
+	 * Gets all the spotter information based on the latest data entry and coord
270
+	 *
271
+	 * @return Array the spotter information
272
+	 *
273
+	 */
274 274
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
275 275
 	{
276 276
 		global $globalDBdriver, $globalLiveInterval;
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
 	}
296 296
 
297 297
 	/**
298
-	* Gets all the spotter information based on a user's latitude and longitude
299
-	*
300
-	* @return Array the spotter information
301
-	*
302
-	*/
298
+	 * Gets all the spotter information based on a user's latitude and longitude
299
+	 *
300
+	 * @return Array the spotter information
301
+	 *
302
+	 */
303 303
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
304 304
 	{
305 305
 		$Spotter = new Spotter($this->db);
@@ -309,145 +309,145 @@  discard block
 block discarded – undo
309 309
 				return false;
310 310
 			}
311 311
 		}
312
-        if ($lng != '')
313
-                {
314
-                        if (!is_numeric($lng))
315
-                        {
316
-                                return false;
317
-                        }
318
-                }
319
-
320
-                if ($radius != '')
321
-                {
322
-                        if (!is_numeric($radius))
323
-                        {
324
-                                return false;
325
-                        }
326
-                }
312
+		if ($lng != '')
313
+				{
314
+						if (!is_numeric($lng))
315
+						{
316
+								return false;
317
+						}
318
+				}
319
+
320
+				if ($radius != '')
321
+				{
322
+						if (!is_numeric($radius))
323
+						{
324
+								return false;
325
+						}
326
+				}
327 327
 		$additional_query = '';
328
-        if ($interval != '')
329
-                {
330
-                        if (!is_string($interval))
331
-                        {
332
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
333
-			        return false;
334
-                        } else {
335
-                if ($interval == '1m')
336
-                {
337
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
338
-                } else if ($interval == '15m'){
339
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
340
-                } 
341
-            }
342
-                } else {
343
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
344
-        }
345
-
346
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
328
+		if ($interval != '')
329
+				{
330
+						if (!is_string($interval))
331
+						{
332
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
333
+					return false;
334
+						} else {
335
+				if ($interval == '1m')
336
+				{
337
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
338
+				} else if ($interval == '15m'){
339
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
340
+				} 
341
+			}
342
+				} else {
343
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
344
+		}
345
+
346
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
347 347
                    WHERE spotter_live.latitude <> '' 
348 348
                                    AND spotter_live.longitude <> '' 
349 349
                    ".$additional_query."
350 350
                    HAVING distance < :radius  
351 351
                                    ORDER BY distance";
352 352
 
353
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
353
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
354 354
 
355
-                return $spotter_array;
356
-        }
355
+				return $spotter_array;
356
+		}
357 357
 
358 358
     
359
-        /**
360
-	* Gets all the spotter information based on a particular callsign
361
-	*
362
-	* @return Array the spotter information
363
-	*
364
-	*/
359
+		/**
360
+		 * Gets all the spotter information based on a particular callsign
361
+		 *
362
+		 * @return Array the spotter information
363
+		 *
364
+		 */
365 365
 	public function getLastLiveSpotterDataByIdent($ident)
366 366
 	{
367 367
 		$Spotter = new Spotter($this->db);
368 368
 		date_default_timezone_set('UTC');
369 369
 
370 370
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
371
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
371
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
372 372
 
373 373
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
374 374
 
375 375
 		return $spotter_array;
376 376
 	}
377 377
 
378
-        /**
379
-	* Gets all the spotter information based on a particular callsign
380
-	*
381
-	* @return Array the spotter information
382
-	*
383
-	*/
378
+		/**
379
+		 * Gets all the spotter information based on a particular callsign
380
+		 *
381
+		 * @return Array the spotter information
382
+		 *
383
+		 */
384 384
 	public function getDateLiveSpotterDataByIdent($ident,$date)
385 385
 	{
386 386
 		$Spotter = new Spotter($this->db);
387 387
 		date_default_timezone_set('UTC');
388 388
 
389 389
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
390
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
390
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
391 391
 
392
-                $date = date('c',$date);
392
+				$date = date('c',$date);
393 393
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
394 394
 
395 395
 		return $spotter_array;
396 396
 	}
397 397
 
398
-        /**
399
-	* Gets last spotter information based on a particular callsign
400
-	*
401
-	* @return Array the spotter information
402
-	*
403
-	*/
398
+		/**
399
+		 * Gets last spotter information based on a particular callsign
400
+		 *
401
+		 * @return Array the spotter information
402
+		 *
403
+		 */
404 404
 	public function getLastLiveSpotterDataById($id)
405 405
 	{
406 406
 		$Spotter = new Spotter($this->db);
407 407
 		date_default_timezone_set('UTC');
408 408
 
409 409
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
410
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
410
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
411 411
 
412 412
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true);
413 413
 
414 414
 		return $spotter_array;
415 415
 	}
416 416
 
417
-        /**
418
-	* Gets last spotter information based on a particular callsign
419
-	*
420
-	* @return Array the spotter information
421
-	*
422
-	*/
417
+		/**
418
+		 * Gets last spotter information based on a particular callsign
419
+		 *
420
+		 * @return Array the spotter information
421
+		 *
422
+		 */
423 423
 	public function getDateLiveSpotterDataById($id,$date)
424 424
 	{
425 425
 		$Spotter = new Spotter($this->db);
426 426
 		date_default_timezone_set('UTC');
427 427
 
428 428
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
429
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
430
-                $date = date('c',$date);
429
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
430
+				$date = date('c',$date);
431 431
 		$spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
432 432
 
433 433
 		return $spotter_array;
434 434
 	}
435 435
 
436
-        /**
437
-	* Gets altitude information based on a particular callsign
438
-	*
439
-	* @return Array the spotter information
440
-	*
441
-	*/
436
+		/**
437
+		 * Gets altitude information based on a particular callsign
438
+		 *
439
+		 * @return Array the spotter information
440
+		 *
441
+		 */
442 442
 	public function getAltitudeLiveSpotterDataByIdent($ident)
443 443
 	{
444 444
 
445 445
 		date_default_timezone_set('UTC');
446 446
 
447 447
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
448
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
448
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
449 449
 
450
-    		try {
450
+			try {
451 451
 			
452 452
 			$sth = $this->db->prepare($query);
453 453
 			$sth->execute(array(':ident' => $ident));
@@ -460,12 +460,12 @@  discard block
 block discarded – undo
460 460
 		return $spotter_array;
461 461
 	}
462 462
 
463
-        /**
464
-	* Gets all the spotter information based on a particular id
465
-	*
466
-	* @return Array the spotter information
467
-	*
468
-	*/
463
+		/**
464
+		 * Gets all the spotter information based on a particular id
465
+		 *
466
+		 * @return Array the spotter information
467
+		 *
468
+		 */
469 469
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
470 470
 	{
471 471
 		global $globalDBdriver, $globalLiveInterval;
@@ -493,18 +493,18 @@  discard block
 block discarded – undo
493 493
 		return $spotter_array;
494 494
 	}
495 495
 
496
-        /**
497
-	* Gets all the spotter information based on a particular ident
498
-	*
499
-	* @return Array the spotter information
500
-	*
501
-	*/
496
+		/**
497
+		 * Gets all the spotter information based on a particular ident
498
+		 *
499
+		 * @return Array the spotter information
500
+		 *
501
+		 */
502 502
 	public function getAllLiveSpotterDataByIdent($ident)
503 503
 	{
504 504
 		date_default_timezone_set('UTC');
505 505
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
506 506
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
507
-    		try {
507
+			try {
508 508
 			
509 509
 			$sth = $this->db->prepare($query);
510 510
 			$sth->execute(array(':ident' => $ident));
@@ -518,23 +518,23 @@  discard block
 block discarded – undo
518 518
 
519 519
 
520 520
 	/**
521
-	* Deletes all info in the table
522
-	*
523
-	* @return String success or false
524
-	*
525
-	*/
521
+	 * Deletes all info in the table
522
+	 *
523
+	 * @return String success or false
524
+	 *
525
+	 */
526 526
 	public function deleteLiveSpotterData()
527 527
 	{
528 528
 		global $globalDBdriver;
529 529
 		if ($globalDBdriver == 'mysql') {
530 530
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
531 531
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
532
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
532
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
533 533
 		} else {
534 534
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
535 535
 		}
536 536
         
537
-    		try {
537
+			try {
538 538
 			
539 539
 			$sth = $this->db->prepare($query);
540 540
 			$sth->execute();
@@ -546,18 +546,18 @@  discard block
 block discarded – undo
546 546
 	}
547 547
 
548 548
 	/**
549
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
550
-	*
551
-	* @return String success or false
552
-	*
553
-	*/
549
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
550
+	 *
551
+	 * @return String success or false
552
+	 *
553
+	 */
554 554
 	public function deleteLiveSpotterDataNotUpdated()
555 555
 	{
556 556
 		global $globalDBdriver, $globalDebug;
557 557
 		if ($globalDBdriver == 'mysql') {
558 558
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
559
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
560
-    			try {
559
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
560
+				try {
561 561
 				
562 562
 				$sth = $this->db->prepare($query);
563 563
 				$sth->execute();
@@ -565,8 +565,8 @@  discard block
 block discarded – undo
565 565
 				return "error";
566 566
 			}
567 567
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
568
-                        $i = 0;
569
-                        $j =0;
568
+						$i = 0;
569
+						$j =0;
570 570
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
571 571
 			foreach($all as $row)
572 572
 			{
@@ -574,20 +574,20 @@  discard block
 block discarded – undo
574 574
 				$j++;
575 575
 				if ($j == 30) {
576 576
 					if ($globalDebug) echo ".";
577
-				    	try {
577
+						try {
578 578
 						
579 579
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
580 580
 						$sth->execute();
581 581
 					} catch(PDOException $e) {
582 582
 						return "error";
583 583
 					}
584
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
585
-                                	$j = 0;
584
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
585
+									$j = 0;
586 586
 				}
587 587
 				$query_delete .= "'".$row['flightaware_id']."',";
588 588
 			}
589 589
 			if ($i > 0) {
590
-    				try {
590
+					try {
591 591
 					
592 592
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
593 593
 					$sth->execute();
@@ -598,9 +598,9 @@  discard block
 block discarded – undo
598 598
 			return "success";
599 599
 		} elseif ($globalDBdriver == 'pgsql') {
600 600
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
601
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
602
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
603
-    			try {
601
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
602
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
603
+				try {
604 604
 				
605 605
 				$sth = $this->db->prepare($query);
606 606
 				$sth->execute();
@@ -644,17 +644,17 @@  discard block
 block discarded – undo
644 644
 	}
645 645
 
646 646
 	/**
647
-	* Deletes all info in the table for an ident
648
-	*
649
-	* @return String success or false
650
-	*
651
-	*/
647
+	 * Deletes all info in the table for an ident
648
+	 *
649
+	 * @return String success or false
650
+	 *
651
+	 */
652 652
 	public function deleteLiveSpotterDataByIdent($ident)
653 653
 	{
654 654
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
655 655
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
656 656
         
657
-    		try {
657
+			try {
658 658
 			
659 659
 			$sth = $this->db->prepare($query);
660 660
 			$sth->execute(array(':ident' => $ident));
@@ -666,17 +666,17 @@  discard block
 block discarded – undo
666 666
 	}
667 667
 
668 668
 	/**
669
-	* Deletes all info in the table for an id
670
-	*
671
-	* @return String success or false
672
-	*
673
-	*/
669
+	 * Deletes all info in the table for an id
670
+	 *
671
+	 * @return String success or false
672
+	 *
673
+	 */
674 674
 	public function deleteLiveSpotterDataById($id)
675 675
 	{
676 676
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
677 677
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
678 678
         
679
-    		try {
679
+			try {
680 680
 			
681 681
 			$sth = $this->db->prepare($query);
682 682
 			$sth->execute(array(':id' => $id));
@@ -689,11 +689,11 @@  discard block
 block discarded – undo
689 689
 
690 690
 
691 691
 	/**
692
-	* Gets the aircraft ident within the last hour
693
-	*
694
-	* @return String the ident
695
-	*
696
-	*/
692
+	 * Gets the aircraft ident within the last hour
693
+	 *
694
+	 * @return String the ident
695
+	 *
696
+	 */
697 697
 	public function getIdentFromLastHour($ident)
698 698
 	{
699 699
 		global $globalDBdriver, $globalTimezone;
@@ -719,14 +719,14 @@  discard block
 block discarded – undo
719 719
 			$ident_result = $row['ident'];
720 720
 		}
721 721
 		return $ident_result;
722
-        }
722
+		}
723 723
 
724 724
 	/**
725
-	* Check recent aircraft
726
-	*
727
-	* @return String the ident
728
-	*
729
-	*/
725
+	 * Check recent aircraft
726
+	 *
727
+	 * @return String the ident
728
+	 *
729
+	 */
730 730
 	public function checkIdentRecent($ident)
731 731
 	{
732 732
 		global $globalDBdriver, $globalTimezone;
@@ -752,14 +752,14 @@  discard block
 block discarded – undo
752 752
 			$ident_result = $row['flightaware_id'];
753 753
 		}
754 754
 		return $ident_result;
755
-        }
755
+		}
756 756
 
757 757
 	/**
758
-	* Check recent aircraft by id
759
-	*
760
-	* @return String the ident
761
-	*
762
-	*/
758
+	 * Check recent aircraft by id
759
+	 *
760
+	 * @return String the ident
761
+	 *
762
+	 */
763 763
 	public function checkIdRecent($id)
764 764
 	{
765 765
 		global $globalDBdriver, $globalTimezone;
@@ -785,14 +785,14 @@  discard block
 block discarded – undo
785 785
 			$ident_result = $row['flightaware_id'];
786 786
 		}
787 787
 		return $ident_result;
788
-        }
788
+		}
789 789
 
790 790
 	/**
791
-	* Check recent aircraft by ModeS
792
-	*
793
-	* @return String the ModeS
794
-	*
795
-	*/
791
+	 * Check recent aircraft by ModeS
792
+	 *
793
+	 * @return String the ModeS
794
+	 *
795
+	 */
796 796
 	public function checkModeSRecent($modes)
797 797
 	{
798 798
 		global $globalDBdriver, $globalTimezone;
@@ -819,19 +819,19 @@  discard block
 block discarded – undo
819 819
 			$ident_result = $row['flightaware_id'];
820 820
 		}
821 821
 		return $ident_result;
822
-        }
822
+		}
823 823
 
824 824
 	/**
825
-	* Adds a new spotter data
826
-	*
827
-	* @param String $flightaware_id the ID from flightaware
828
-	* @param String $ident the flight ident
829
-	* @param String $aircraft_icao the aircraft type
830
-	* @param String $departure_airport_icao the departure airport
831
-	* @param String $arrival_airport_icao the arrival airport
832
-	* @return String success or false
833
-	*
834
-	*/
825
+	 * Adds a new spotter data
826
+	 *
827
+	 * @param String $flightaware_id the ID from flightaware
828
+	 * @param String $ident the flight ident
829
+	 * @param String $aircraft_icao the aircraft type
830
+	 * @param String $departure_airport_icao the departure airport
831
+	 * @param String $arrival_airport_icao the arrival airport
832
+	 * @return String success or false
833
+	 *
834
+	 */
835 835
 	public function addLiveSpotterData($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 = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
836 836
 	{
837 837
 		global $globalURL, $globalArchive, $globalDebug;
@@ -966,10 +966,10 @@  discard block
 block discarded – undo
966 966
 		$arrival_airport_country = '';
967 967
 		
968 968
             	
969
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
970
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
971
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
972
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
969
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
970
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
971
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
972
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
973 973
             	
974 974
 		$query  = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, 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, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) 
975 975
 		VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,: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,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)';
@@ -979,14 +979,14 @@  discard block
 block discarded – undo
979 979
 			
980 980
 			$sth = $this->db->prepare($query);
981 981
 			$sth->execute($query_values);
982
-                } catch(PDOException $e) {
983
-                	return "error : ".$e->getMessage();
984
-                }
982
+				} catch(PDOException $e) {
983
+					return "error : ".$e->getMessage();
984
+				}
985 985
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
986
-		    if ($globalDebug) echo '(Add to SBS archive : ';
987
-		    $SpotterArchive = new SpotterArchive($this->db);
988
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
989
-		    if ($globalDebug) echo $result.')';
986
+			if ($globalDebug) echo '(Add to SBS archive : ';
987
+			$SpotterArchive = new SpotterArchive($this->db);
988
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
989
+			if ($globalDebug) echo $result.')';
990 990
 		}
991 991
 		return "success";
992 992
 
Please login to merge, or discard this patch.
require/class.Source.php 1 patch
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -7,73 +7,73 @@
 block discarded – undo
7 7
 	public function __construct($dbc = null) {
8 8
 		$Connection = new Connection($dbc);
9 9
 		$this->db = $Connection->db;
10
-        }
11
-       public function getAllLocationInfo() {
12
-                $query = "SELECT * FROM source_location";
13
-                $query_values = array();
14
-                 try {
15
-                        $sth = $this->db->prepare($query);
16
-                        $sth->execute($query_values);
17
-                } catch(PDOException $e) {
18
-                        return "error : ".$e->getMessage();
19
-                }
20
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
21
-                return $all;
22
-        }
23
-       public function getLocationInfobyName($name) {
24
-                $query = "SELECT * FROM source_location WHERE name = :name";
25
-                $query_values = array(':name' => $name);
26
-                 try {
27
-                        $sth = $this->db->prepare($query);
28
-                        $sth->execute($query_values);
29
-                } catch(PDOException $e) {
30
-                        return "error : ".$e->getMessage();
31
-                }
32
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
33
-                return $all;
34
-        }
35
-       public function getLocationInfobySourceName($name) {
36
-                $query = "SELECT * FROM source_location WHERE source = :name";
37
-                $query_values = array(':name' => $name);
38
-                 try {
39
-                        $sth = $this->db->prepare($query);
40
-                        $sth->execute($query_values);
41
-                } catch(PDOException $e) {
42
-                        return "error : ".$e->getMessage();
43
-                }
44
-                $all = $sth->fetchAll(PDO::FETCH_ASSOC);
45
-                return $all;
46
-        }
10
+		}
11
+	   public function getAllLocationInfo() {
12
+				$query = "SELECT * FROM source_location";
13
+				$query_values = array();
14
+				 try {
15
+						$sth = $this->db->prepare($query);
16
+						$sth->execute($query_values);
17
+				} catch(PDOException $e) {
18
+						return "error : ".$e->getMessage();
19
+				}
20
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
21
+				return $all;
22
+		}
23
+	   public function getLocationInfobyName($name) {
24
+				$query = "SELECT * FROM source_location WHERE name = :name";
25
+				$query_values = array(':name' => $name);
26
+				 try {
27
+						$sth = $this->db->prepare($query);
28
+						$sth->execute($query_values);
29
+				} catch(PDOException $e) {
30
+						return "error : ".$e->getMessage();
31
+				}
32
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
33
+				return $all;
34
+		}
35
+	   public function getLocationInfobySourceName($name) {
36
+				$query = "SELECT * FROM source_location WHERE source = :name";
37
+				$query_values = array(':name' => $name);
38
+				 try {
39
+						$sth = $this->db->prepare($query);
40
+						$sth->execute($query_values);
41
+				} catch(PDOException $e) {
42
+						return "error : ".$e->getMessage();
43
+				}
44
+				$all = $sth->fetchAll(PDO::FETCH_ASSOC);
45
+				return $all;
46
+		}
47 47
   
48
-       public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png') {
49
-                $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source)";
50
-                $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source);
51
-                 try {
52
-                        $sth = $this->db->prepare($query);
53
-                        $sth->execute($query_values);
54
-                } catch(PDOException $e) {
55
-                        return "error : ".$e->getMessage();
56
-                }
57
-        }
48
+	   public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png') {
49
+				$query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source)";
50
+				$query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source);
51
+				 try {
52
+						$sth = $this->db->prepare($query);
53
+						$sth->execute($query_values);
54
+				} catch(PDOException $e) {
55
+						return "error : ".$e->getMessage();
56
+				}
57
+		}
58 58
 
59
-       public function deleteLocation($id) {
60
-                $query = "DELETE FROM source_location WHERE id = :id";
61
-                $query_values = array(':id' => $id);
62
-                 try {
63
-                        $sth = $this->db->prepare($query);
64
-                        $sth->execute($query_values);
65
-                } catch(PDOException $e) {
66
-                        return "error : ".$e->getMessage();
67
-                }
68
-        }
69
-       public function deleteAllLocation() {
70
-                $query = "DELETE FROM source_location";
71
-                 try {
72
-                        $sth = $this->db->prepare($query);
73
-                        $sth->execute();
74
-                } catch(PDOException $e) {
75
-                        return "error : ".$e->getMessage();
76
-                }
77
-        }
59
+	   public function deleteLocation($id) {
60
+				$query = "DELETE FROM source_location WHERE id = :id";
61
+				$query_values = array(':id' => $id);
62
+				 try {
63
+						$sth = $this->db->prepare($query);
64
+						$sth->execute($query_values);
65
+				} catch(PDOException $e) {
66
+						return "error : ".$e->getMessage();
67
+				}
68
+		}
69
+	   public function deleteAllLocation() {
70
+				$query = "DELETE FROM source_location";
71
+				 try {
72
+						$sth = $this->db->prepare($query);
73
+						$sth->execute();
74
+				} catch(PDOException $e) {
75
+						return "error : ".$e->getMessage();
76
+				}
77
+		}
78 78
 }
79 79
 ?>
80 80
\ No newline at end of file
Please login to merge, or discard this patch.
require/class.Image.php 1 patch
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@  discard block
 block discarded – undo
12 12
 	}
13 13
 
14 14
 	/**
15
-	* Gets the images based on the aircraft registration
16
-	*
17
-	* @return Array the images list
18
-	*
19
-	*/
15
+	 * Gets the images based on the aircraft registration
16
+	 *
17
+	 * @return Array the images list
18
+	 *
19
+	 */
20 20
 	public function getSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
21 21
 	{
22 22
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 			WHERE spotter_image.registration = :registration";
30 30
 		$sth = $this->db->prepare($query);
31 31
 		$sth->execute(array(':registration' => $registration));
32
-          /*
32
+		  /*
33 33
         $images_array = array();
34 34
 	$temp_array = array();
35 35
 
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
 	}
53 53
 
54 54
 	/**
55
-	* Gets the image copyright based on the Exif data
56
-	*
57
-	* @return String image copyright
58
-	*
59
-	*/
55
+	 * Gets the image copyright based on the Exif data
56
+	 *
57
+	 * @return String image copyright
58
+	 *
59
+	 */
60 60
 	public function getExifCopyright($url) {
61 61
 		$exif = exif_read_data($url);
62 62
 		$copyright = '';
@@ -71,11 +71,11 @@  discard block
 block discarded – undo
71 71
 	}
72 72
 
73 73
 	/**
74
-	* Adds the images based on the aircraft registration
75
-	*
76
-	* @return String either success or error
77
-	*
78
-	*/
74
+	 * Adds the images based on the aircraft registration
75
+	 *
76
+	 * @return String either success or error
77
+	 *
78
+	 */
79 79
 	public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
80 80
 	{
81 81
 		global $globalDebug,$globalAircraftImageFetch;
@@ -104,12 +104,12 @@  discard block
 block discarded – undo
104 104
 	}
105 105
 
106 106
 	/**
107
-	* Gets the aircraft image
108
-	*
109
-	* @param String $aircraft_registration the registration of the aircraft
110
-	* @return Array the aircraft thumbnail, orignal url and copyright
111
-	*
112
-	*/
107
+	 * Gets the aircraft image
108
+	 *
109
+	 * @param String $aircraft_registration the registration of the aircraft
110
+	 * @return Array the aircraft thumbnail, orignal url and copyright
111
+	 *
112
+	 */
113 113
 	public function findAircraftImage($aircraft_registration, $aircraft_icao = '', $airline_icao = '')
114 114
 	{
115 115
 		global $globalAircraftImageSources, $globalIVAO;
@@ -149,13 +149,13 @@  discard block
 block discarded – undo
149 149
 	}
150 150
 
151 151
 	/**
152
-	* Gets the aircraft image from Planespotters
153
-	*
154
-	* @param String $aircraft_registration the registration of the aircraft
155
-	* @param String $aircraft_name type of the aircraft
156
-	* @return Array the aircraft thumbnail, orignal url and copyright
157
-	*
158
-	*/
152
+	 * Gets the aircraft image from Planespotters
153
+	 *
154
+	 * @param String $aircraft_registration the registration of the aircraft
155
+	 * @param String $aircraft_name type of the aircraft
156
+	 * @return Array the aircraft thumbnail, orignal url and copyright
157
+	 *
158
+	 */
159 159
 	public function fromPlanespotters($aircraft_registration, $aircraft_name='') {
160 160
 		$Common = new Common();
161 161
 		// If aircraft registration is only number, also check with aircraft model
@@ -182,13 +182,13 @@  discard block
 block discarded – undo
182 182
 	}
183 183
 
184 184
 	/**
185
-	* Gets the aircraft image from Deviantart
186
-	*
187
-	* @param String $aircraft_registration the registration of the aircraft
188
-	* @param String $aircraft_name type of the aircraft
189
-	* @return Array the aircraft thumbnail, orignal url and copyright
190
-	*
191
-	*/
185
+	 * Gets the aircraft image from Deviantart
186
+	 *
187
+	 * @param String $aircraft_registration the registration of the aircraft
188
+	 * @param String $aircraft_name type of the aircraft
189
+	 * @return Array the aircraft thumbnail, orignal url and copyright
190
+	 *
191
+	 */
192 192
 	public function fromDeviantart($aircraft_registration, $aircraft_name='') {
193 193
 		$Common = new Common();
194 194
 		// If aircraft registration is only number, also check with aircraft model
@@ -216,13 +216,13 @@  discard block
 block discarded – undo
216 216
 	}
217 217
 
218 218
 	/**
219
-	* Gets the aircraft image from JetPhotos
220
-	*
221
-	* @param String $aircraft_registration the registration of the aircraft
222
-	* @param String $aircraft_name type of the aircraft
223
-	* @return Array the aircraft thumbnail, orignal url and copyright
224
-	*
225
-	*/
219
+	 * Gets the aircraft image from JetPhotos
220
+	 *
221
+	 * @param String $aircraft_registration the registration of the aircraft
222
+	 * @param String $aircraft_name type of the aircraft
223
+	 * @return Array the aircraft thumbnail, orignal url and copyright
224
+	 *
225
+	 */
226 226
 	public function fromJetPhotos($aircraft_registration, $aircraft_name='') {
227 227
 		$Common = new Common();
228 228
 		$url= 'http://jetphotos.net/showphotos.php?displaymode=2&regsearch='.$aircraft_registration;
@@ -258,13 +258,13 @@  discard block
 block discarded – undo
258 258
 	}
259 259
 
260 260
 	/**
261
-	* Gets the aircraft image from PlanePictures
262
-	*
263
-	* @param String $aircraft_registration the registration of the aircraft
264
-	* @param String $aircraft_name type of the aircraft
265
-	* @return Array the aircraft thumbnail, orignal url and copyright
266
-	*
267
-	*/
261
+	 * Gets the aircraft image from PlanePictures
262
+	 *
263
+	 * @param String $aircraft_registration the registration of the aircraft
264
+	 * @param String $aircraft_name type of the aircraft
265
+	 * @return Array the aircraft thumbnail, orignal url and copyright
266
+	 *
267
+	 */
268 268
 	public function fromPlanePictures($aircraft_registration, $aircraft_name='') {
269 269
 		$Common = new Common();
270 270
 		$url= 'http://www.planepictures.net/netsearch4.cgi?srch='.$aircraft_registration.'&stype=reg&srng=2';
@@ -292,13 +292,13 @@  discard block
 block discarded – undo
292 292
 	}
293 293
 
294 294
 	/**
295
-	* Gets the aircraft image from Flickr
296
-	*
297
-	* @param String $aircraft_registration the registration of the aircraft
298
-	* @param String $aircraft_name type of the aircraft
299
-	* @return Array the aircraft thumbnail, orignal url and copyright
300
-	*
301
-	*/
295
+	 * Gets the aircraft image from Flickr
296
+	 *
297
+	 * @param String $aircraft_registration the registration of the aircraft
298
+	 * @param String $aircraft_name type of the aircraft
299
+	 * @return Array the aircraft thumbnail, orignal url and copyright
300
+	 *
301
+	 */
302 302
 	public function fromFlickr($aircraft_registration,$aircraft_name='') {
303 303
 		$Common = new Common();
304 304
 		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);
@@ -336,13 +336,13 @@  discard block
 block discarded – undo
336 336
 	}
337 337
 
338 338
 	/**
339
-	* Gets the aircraft image from Bing
340
-	*
341
-	* @param String $aircraft_registration the registration of the aircraft
342
-	* @param String $aircraft_name type of the aircraft
343
-	* @return Array the aircraft thumbnail, orignal url and copyright
344
-	*
345
-	*/
339
+	 * Gets the aircraft image from Bing
340
+	 *
341
+	 * @param String $aircraft_registration the registration of the aircraft
342
+	 * @param String $aircraft_name type of the aircraft
343
+	 * @return Array the aircraft thumbnail, orignal url and copyright
344
+	 *
345
+	 */
346 346
 	public function fromBing($aircraft_registration,$aircraft_name='') {
347 347
 		global $globalImageBingKey;
348 348
 		$Common = new Common();
@@ -368,13 +368,13 @@  discard block
 block discarded – undo
368 368
 	}
369 369
 
370 370
 	/**
371
-	* Gets the aircraft image from airport-data
372
-	*
373
-	* @param String $aircraft_registration the registration of the aircraft
374
-	* @param String $aircraft_name type of the aircraft
375
-	* @return Array the aircraft thumbnail, orignal url and copyright
376
-	*
377
-	*/
371
+	 * Gets the aircraft image from airport-data
372
+	 *
373
+	 * @param String $aircraft_registration the registration of the aircraft
374
+	 * @param String $aircraft_name type of the aircraft
375
+	 * @return Array the aircraft thumbnail, orignal url and copyright
376
+	 *
377
+	 */
378 378
 	public function fromAirportData($aircraft_registration,$aircraft_name='') {
379 379
 		$Common = new Common();
380 380
 		$url = 'http://www.airport-data.com/api/ac_thumb.json?&n=1&r='.$aircraft_registration;
@@ -393,13 +393,13 @@  discard block
 block discarded – undo
393 393
 	}
394 394
 
395 395
 	/**
396
-	* Gets the aircraft image from WikiMedia
397
-	*
398
-	* @param String $aircraft_registration the registration of the aircraft
399
-	* @param String $aircraft_name type of the aircraft
400
-	* @return Array the aircraft thumbnail, orignal url and copyright
401
-	*
402
-	*/
396
+	 * Gets the aircraft image from WikiMedia
397
+	 *
398
+	 * @param String $aircraft_registration the registration of the aircraft
399
+	 * @param String $aircraft_name type of the aircraft
400
+	 * @return Array the aircraft thumbnail, orignal url and copyright
401
+	 *
402
+	 */
403 403
 	public function fromWikimedia($aircraft_registration,$aircraft_name='') {
404 404
 		$Common = new Common();
405 405
 		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);
@@ -449,13 +449,13 @@  discard block
 block discarded – undo
449 449
 	}
450 450
 
451 451
 	/**
452
-	* Gets the aircraft image from custom url
453
-	*
454
-	* @param String $aircraft_registration the registration of the aircraft
455
-	* @param String $aircraft_name type of the aircraft
456
-	* @return Array the aircraft thumbnail, orignal url and copyright
457
-	*
458
-	*/
452
+	 * Gets the aircraft image from custom url
453
+	 *
454
+	 * @param String $aircraft_registration the registration of the aircraft
455
+	 * @param String $aircraft_name type of the aircraft
456
+	 * @return Array the aircraft thumbnail, orignal url and copyright
457
+	 *
458
+	 */
459 459
 	public function fromCustomSource($aircraft_registration,$aircraft_name='') {
460 460
 		global $globalAircraftImageCustomSources, $globalDebug;
461 461
 		//$globalAircraftImageCustomSource[] = array('thumbnail' => '','original' => '', 'copyright' => '', 'source_website' => '', 'source' => '','exif' => true);
Please login to merge, or discard this patch.