Completed
Push — master ( c585c5...63f6a6 )
by Yannick
32:09 queued 01:10
created
date-sub-menu.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,9 +3,9 @@  discard block
 block discarded – undo
3 3
 </span>
4 4
 <div class="sub-menu sub-menu-container">
5 5
 	<ul class="nav nav-pills">
6
-		<li><a href="<?php print $globalURL; ?>/date/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
6
+		<li><a href="<?php print $globalURL; ?>/date/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li>
7 7
 		<li class="dropdown">
8
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "date-statistics-aircraft" || strtolower($current_page) == "date-statistics-registration" || strtolower($current_page) == "date-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
8
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "date-statistics-aircraft" || strtolower($current_page) == "date-statistics-registration" || strtolower($current_page) == "date-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#">
9 9
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
10 10
 		    </a>
11 11
 		    <ul class="dropdown-menu" role="menu">
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		    </ul>
16 16
 		</li>
17 17
 		<li class="dropdown">
18
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "date-statistics-airline" || strtolower($current_page) == "date-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
18
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "date-statistics-airline" || strtolower($current_page) == "date-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
19 19
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
20 20
 		    </a>
21 21
 		    <ul class="dropdown-menu" role="menu">
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 		    </ul>
25 25
 		</li>
26 26
 		<li class="dropdown">
27
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "date-statistics-departure-airport" || strtolower($current_page) == "date-statistics-departure-airport-country" || strtolower($current_page) == "date-statistics-arrival-airport" || strtolower($current_page) == "date-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
27
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "date-statistics-departure-airport" || strtolower($current_page) == "date-statistics-departure-airport-country" || strtolower($current_page) == "date-statistics-arrival-airport" || strtolower($current_page) == "date-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
28 28
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
29 29
 		    </a>
30 30
 		    <ul class="dropdown-menu" role="menu">
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 			  <li><a href="<?php print $globalURL; ?>/date/statistics/arrival-airport-country/<?php print $date; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
35 35
 		    </ul>
36 36
 		</li>
37
-		<li><a href="<?php print $globalURL; ?>/date/statistics/route/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
38
-		<li><a href="<?php print $globalURL; ?>/date/statistics/time/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
37
+		<li><a href="<?php print $globalURL; ?>/date/statistics/route/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li>
38
+		<li><a href="<?php print $globalURL; ?>/date/statistics/time/<?php print $date; ?>" <?php if (strtolower($current_page) == "date-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li>
39 39
 	</ul>
40 40
 </div>
41 41
\ No newline at end of file
Please login to merge, or discard this patch.
route-statistics-time.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@
 block discarded – undo
14 14
 $arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING);
15 15
 if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) {
16 16
 	$spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort);
17
-} else $spotter_array = array();
17
+} else {
18
+	$spotter_array = array();
19
+}
18 20
   
19 21
 if (!empty($spotter_array))
20 22
 {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
 require_once('require/class.Language.php');
10 10
 
11 11
 $Spotter = new Spotter();
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING);
14
-$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING);
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING);
14
+$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING);
15 15
 if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) {
16 16
 	$spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort);
17 17
 } else $spotter_array = array();
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Time of Day between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']);
21
+	$title = sprintf(_("Most Common Time of Day between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>';
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 	include('route-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Time of Day").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>';
32
+	print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>';
33 33
 
34 34
 	$hour_array = $Spotter->countAllHoursByRoute($departure_airport, $arrival_airport);
35 35
 	print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 	$hour_data = '';
40 40
 	$hour_cnt = '';
41 41
 	$last = 0;
42
-	foreach($hour_array as $hour_item)
42
+	foreach ($hour_array as $hour_item)
43 43
 	{
44
-		while($last != $hour_item['hour_name']) {
44
+		while ($last != $hour_item['hour_name']) {
45 45
 			$hour_data .= '"'.$last.':00",';
46 46
 			$hour_cnt .= '0,';
47 47
 			$last++;
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		$hour_cnt .= $hour_item['hour_count'].',';
52 52
 	}
53 53
 	$hour_data = "['x',".substr($hour_data, 0, -1)."]";
54
-	$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
54
+	$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
55 55
 	print 'c3.generate({
56 56
 	    bindto: "#chartHour",
57 57
 	    data: {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 		print '</thead>';
77 77
 		print '<tbody>';
78 78
 		$i = 1;
79
-		foreach($hour_array as $hour_item)
79
+		foreach ($hour_array as $hour_item)
80 80
 		{
81 81
 			print '<tr>';
82 82
 			print '<td>'.$hour_item['hour_name'].':00</td>';
Please login to merge, or discard this patch.
require/class.Tracker.php 4 patches
Doc Comments   +2 added lines, -32 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 	/**
16 16
 	* Get SQL query part for filter used
17 17
 	* @param Array $filter the filter
18
-	* @return Array the SQL part
18
+	* @return string the SQL part
19 19
 	*/
20 20
 	
21 21
 	public function getFilter($filter = array(),$where = false,$and = false) {
@@ -486,9 +486,6 @@  discard block
 block discarded – undo
486 486
 	/**
487 487
 	* Update ident spotter data
488 488
 	*
489
-	* @param String $flightaware_id the ID from flightaware
490
-	* @param String $ident the flight ident
491
-	* @return String success or false
492 489
 	*
493 490
 	*/	
494 491
 	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
@@ -510,10 +507,6 @@  discard block
 block discarded – undo
510 507
 	/**
511 508
 	* Update latest spotter data
512 509
 	*
513
-	* @param String $flightaware_id the ID from flightaware
514
-	* @param String $ident the flight ident
515
-	* @param String $arrival_airport_icao the arrival airport
516
-	* @return String success or false
517 510
 	*
518 511
 	*/	
519 512
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
@@ -535,29 +528,6 @@  discard block
 block discarded – undo
535 528
 	/**
536 529
 	* Adds a new spotter data
537 530
 	*
538
-	* @param String $flightaware_id the ID from flightaware
539
-	* @param String $ident the flight ident
540
-	* @param String $aircraft_icao the aircraft type
541
-	* @param String $departure_airport_icao the departure airport
542
-	* @param String $arrival_airport_icao the arrival airport
543
-	* @param String $latitude latitude of flight
544
-	* @param String $longitude latitude of flight
545
-	* @param String $waypoints waypoints of flight
546
-	* @param String $altitude altitude of flight
547
-	* @param String $heading heading of flight
548
-	* @param String $groundspeed speed of flight
549
-	* @param String $date date of flight
550
-	* @param String $departure_airport_time departure time of flight
551
-	* @param String $arrival_airport_time arrival time of flight
552
-	* @param String $squawk squawk code of flight
553
-	* @param String $route_stop route stop of flight
554
-	* @param String $highlight highlight or not
555
-	* @param String $ModeS ModesS code of flight
556
-	* @param String $registration registration code of flight
557
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
558
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
559
-	* @param String $verticalrate vertival rate of flight
560
-	* @return String success or false
561 531
 	*/
562 532
 	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
563 533
 	{
@@ -1428,7 +1398,7 @@  discard block
 block discarded – undo
1428 1398
 	/**
1429 1399
 	* Parses the direction degrees to working
1430 1400
 	*
1431
-	* @param Float $direction the direction in degrees
1401
+	* @param integer $direction the direction in degrees
1432 1402
 	* @return Array the direction information
1433 1403
 	*
1434 1404
 	*/
Please login to merge, or discard this patch.
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 	}
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	
21 21
 	public function getFilter($filter = array(),$where = false,$and = false) {
22 22
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -80,14 +80,14 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 	/**
83
-	* Executes the SQL statements to get the spotter information
84
-	*
85
-	* @param String $query the SQL query
86
-	* @param Array $params parameter of the query
87
-	* @param String $limitQuery the limit query
88
-	* @return Array the spotter information
89
-	*
90
-	*/
83
+	 * Executes the SQL statements to get the spotter information
84
+	 *
85
+	 * @param String $query the SQL query
86
+	 * @param Array $params parameter of the query
87
+	 * @param String $limitQuery the limit query
88
+	 * @return Array the spotter information
89
+	 *
90
+	 */
91 91
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
92 92
 	{
93 93
 		date_default_timezone_set('UTC');
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
 	
201 201
 	
202 202
 	/**
203
-	* Gets all the spotter information based on the latest data entry
204
-	*
205
-	* @return Array the spotter information
206
-	*
207
-	*/
203
+	 * Gets all the spotter information based on the latest data entry
204
+	 *
205
+	 * @return Array the spotter information
206
+	 *
207
+	 */
208 208
 	public function getLatestTrackerData($limit = '', $sort = '', $filter = array())
209 209
 	{
210 210
 		global $global_query;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	/**
265
-	* Gets all the spotter information based on the callsign
266
-	*
267
-	* @return Array the spotter information
268
-	*
269
-	*/
265
+	 * Gets all the spotter information based on the callsign
266
+	 *
267
+	 * @return Array the spotter information
268
+	 *
269
+	 */
270 270
 	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
271 271
 	{
272 272
 		global $global_query;
@@ -377,12 +377,12 @@  discard block
 block discarded – undo
377 377
 
378 378
 
379 379
 	/**
380
-	* Gets all source name
381
-	*
382
-	* @param String type format of source
383
-	* @return Array list of source name
384
-	*
385
-	*/
380
+	 * Gets all source name
381
+	 *
382
+	 * @param String type format of source
383
+	 * @return Array list of source name
384
+	 *
385
+	 */
386 386
 	public function getAllSourceName($type = '',$filters = array())
387 387
 	{
388 388
 		$filter_query = $this->getFilter($filters,true,true);
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 
413 413
 
414 414
 	/**
415
-	* Gets a list of all idents/callsigns
416
-	*
417
-	* @return Array list of ident/callsign names
418
-	*
419
-	*/
415
+	 * Gets a list of all idents/callsigns
416
+	 *
417
+	 * @return Array list of ident/callsign names
418
+	 *
419
+	 */
420 420
 	public function getAllIdents($filters = array())
421 421
 	{
422 422
 		$filter_query = $this->getFilter($filters,true,true);
@@ -484,18 +484,18 @@  discard block
 block discarded – undo
484 484
 	
485 485
 	
486 486
 	/**
487
-	* Update ident spotter data
488
-	*
489
-	* @param String $flightaware_id the ID from flightaware
490
-	* @param String $ident the flight ident
491
-	* @return String success or false
492
-	*
493
-	*/	
487
+	 * Update ident spotter data
488
+	 *
489
+	 * @param String $flightaware_id the ID from flightaware
490
+	 * @param String $ident the flight ident
491
+	 * @return String success or false
492
+	 *
493
+	 */	
494 494
 	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
495 495
 	{
496 496
 
497 497
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
498
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
498
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
499 499
 
500 500
 		try {
501 501
 			$sth = $this->db->prepare($query);
@@ -508,18 +508,18 @@  discard block
 block discarded – undo
508 508
 
509 509
 	}
510 510
 	/**
511
-	* Update latest spotter data
512
-	*
513
-	* @param String $flightaware_id the ID from flightaware
514
-	* @param String $ident the flight ident
515
-	* @param String $arrival_airport_icao the arrival airport
516
-	* @return String success or false
517
-	*
518
-	*/	
511
+	 * Update latest spotter data
512
+	 *
513
+	 * @param String $flightaware_id the ID from flightaware
514
+	 * @param String $ident the flight ident
515
+	 * @param String $arrival_airport_icao the arrival airport
516
+	 * @return String success or false
517
+	 *
518
+	 */	
519 519
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
520 520
 	{
521 521
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
522
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
522
+				$query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
523 523
 
524 524
 		try {
525 525
 			$sth = $this->db->prepare($query);
@@ -533,32 +533,32 @@  discard block
 block discarded – undo
533 533
 	}
534 534
 
535 535
 	/**
536
-	* Adds a new spotter data
537
-	*
538
-	* @param String $flightaware_id the ID from flightaware
539
-	* @param String $ident the flight ident
540
-	* @param String $aircraft_icao the aircraft type
541
-	* @param String $departure_airport_icao the departure airport
542
-	* @param String $arrival_airport_icao the arrival airport
543
-	* @param String $latitude latitude of flight
544
-	* @param String $longitude latitude of flight
545
-	* @param String $waypoints waypoints of flight
546
-	* @param String $altitude altitude of flight
547
-	* @param String $heading heading of flight
548
-	* @param String $groundspeed speed of flight
549
-	* @param String $date date of flight
550
-	* @param String $departure_airport_time departure time of flight
551
-	* @param String $arrival_airport_time arrival time of flight
552
-	* @param String $squawk squawk code of flight
553
-	* @param String $route_stop route stop of flight
554
-	* @param String $highlight highlight or not
555
-	* @param String $ModeS ModesS code of flight
556
-	* @param String $registration registration code of flight
557
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
558
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
559
-	* @param String $verticalrate vertival rate of flight
560
-	* @return String success or false
561
-	*/
536
+	 * Adds a new spotter data
537
+	 *
538
+	 * @param String $flightaware_id the ID from flightaware
539
+	 * @param String $ident the flight ident
540
+	 * @param String $aircraft_icao the aircraft type
541
+	 * @param String $departure_airport_icao the departure airport
542
+	 * @param String $arrival_airport_icao the arrival airport
543
+	 * @param String $latitude latitude of flight
544
+	 * @param String $longitude latitude of flight
545
+	 * @param String $waypoints waypoints of flight
546
+	 * @param String $altitude altitude of flight
547
+	 * @param String $heading heading of flight
548
+	 * @param String $groundspeed speed of flight
549
+	 * @param String $date date of flight
550
+	 * @param String $departure_airport_time departure time of flight
551
+	 * @param String $arrival_airport_time arrival time of flight
552
+	 * @param String $squawk squawk code of flight
553
+	 * @param String $route_stop route stop of flight
554
+	 * @param String $highlight highlight or not
555
+	 * @param String $ModeS ModesS code of flight
556
+	 * @param String $registration registration code of flight
557
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
558
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
559
+	 * @param String $verticalrate vertival rate of flight
560
+	 * @return String success or false
561
+	 */
562 562
 	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
563 563
 	{
564 564
 		global $globalURL;
@@ -643,16 +643,16 @@  discard block
 block discarded – undo
643 643
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
644 644
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
645 645
 	
646
-                if ($latitude == '' && $longitude == '') {
647
-            		$latitude = 0;
648
-            		$longitude = 0;
649
-            	}
650
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
646
+				if ($latitude == '' && $longitude == '') {
647
+					$latitude = 0;
648
+					$longitude = 0;
649
+				}
650
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
651
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
652
+				$query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
653 653
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
654 654
 
655
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
655
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
656 656
 
657 657
 		try {
658 658
 		        
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
 			$sth->execute($query_values);
661 661
 			$this->db = null;
662 662
 		} catch (PDOException $e) {
663
-		    return "error : ".$e->getMessage();
663
+			return "error : ".$e->getMessage();
664 664
 		}
665 665
 		
666 666
 		return "success";
@@ -669,11 +669,11 @@  discard block
 block discarded – undo
669 669
 	
670 670
   
671 671
 	/**
672
-	* Gets the aircraft ident within the last hour
673
-	*
674
-	* @return String the ident
675
-	*
676
-	*/
672
+	 * Gets the aircraft ident within the last hour
673
+	 *
674
+	 * @return String the ident
675
+	 *
676
+	 */
677 677
 	public function getIdentFromLastHour($ident)
678 678
 	{
679 679
 		global $globalDBdriver, $globalTimezone;
@@ -689,11 +689,11 @@  discard block
 block discarded – undo
689 689
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
690 690
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
691 691
 			$query_data = array(':ident' => $ident);
692
-    		}
692
+			}
693 693
 		
694 694
 		$sth = $this->db->prepare($query);
695 695
 		$sth->execute($query_data);
696
-    		$ident_result='';
696
+			$ident_result='';
697 697
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
698 698
 		{
699 699
 			$ident_result = $row['ident'];
@@ -704,11 +704,11 @@  discard block
 block discarded – undo
704 704
 	
705 705
 	
706 706
 	/**
707
-	* Gets the aircraft data from the last 20 seconds
708
-	*
709
-	* @return Array the spotter data
710
-	*
711
-	*/
707
+	 * Gets the aircraft data from the last 20 seconds
708
+	 *
709
+	 * @return Array the spotter data
710
+	 *
711
+	 */
712 712
 	public function getRealTimeData($q = '')
713 713
 	{
714 714
 		global $globalDBdriver;
@@ -746,11 +746,11 @@  discard block
 block discarded – undo
746 746
 	
747 747
 
748 748
 	/**
749
-	* Gets all number of flight over countries
750
-	*
751
-	* @return Array the airline country list
752
-	*
753
-	*/
749
+	 * Gets all number of flight over countries
750
+	 *
751
+	 * @return Array the airline country list
752
+	 *
753
+	 */
754 754
 
755 755
 	public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
756 756
 	{
@@ -821,11 +821,11 @@  discard block
 block discarded – undo
821 821
 	}
822 822
 	
823 823
 	/**
824
-	* Gets all callsigns that have flown over
825
-	*
826
-	* @return Array the callsign list
827
-	*
828
-	*/
824
+	 * Gets all callsigns that have flown over
825
+	 *
826
+	 * @return Array the callsign list
827
+	 *
828
+	 */
829 829
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
830 830
 	{
831 831
 		global $globalDBdriver;
@@ -892,11 +892,11 @@  discard block
 block discarded – undo
892 892
 
893 893
 
894 894
 	/**
895
-	* Counts all dates
896
-	*
897
-	* @return Array the date list
898
-	*
899
-	*/
895
+	 * Counts all dates
896
+	 *
897
+	 * @return Array the date list
898
+	 *
899
+	 */
900 900
 	public function countAllDates($filters = array())
901 901
 	{
902 902
 		global $globalTimezone, $globalDBdriver;
@@ -942,11 +942,11 @@  discard block
 block discarded – undo
942 942
 	
943 943
 	
944 944
 	/**
945
-	* Counts all dates during the last 7 days
946
-	*
947
-	* @return Array the date list
948
-	*
949
-	*/
945
+	 * Counts all dates during the last 7 days
946
+	 *
947
+	 * @return Array the date list
948
+	 *
949
+	 */
950 950
 	public function countAllDatesLast7Days($filters = array())
951 951
 	{
952 952
 		global $globalTimezone, $globalDBdriver;
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
 			$query .= " GROUP BY date_name 
969 969
 								ORDER BY date_name ASC";
970 970
 			$query_data = array(':offset' => $offset);
971
-    		}
971
+			}
972 972
 		
973 973
 		$sth = $this->db->prepare($query);
974 974
 		$sth->execute($query_data);
@@ -988,11 +988,11 @@  discard block
 block discarded – undo
988 988
 	}
989 989
 
990 990
 	/**
991
-	* Counts all dates during the last month
992
-	*
993
-	* @return Array the date list
994
-	*
995
-	*/
991
+	 * Counts all dates during the last month
992
+	 *
993
+	 * @return Array the date list
994
+	 *
995
+	 */
996 996
 	public function countAllDatesLastMonth($filters = array())
997 997
 	{
998 998
 		global $globalTimezone, $globalDBdriver;
@@ -1014,7 +1014,7 @@  discard block
 block discarded – undo
1014 1014
 			$query .= " GROUP BY date_name 
1015 1015
 								ORDER BY date_name ASC";
1016 1016
 			$query_data = array(':offset' => $offset);
1017
-    		}
1017
+			}
1018 1018
 		
1019 1019
 		$sth = $this->db->prepare($query);
1020 1020
 		$sth->execute($query_data);
@@ -1036,11 +1036,11 @@  discard block
 block discarded – undo
1036 1036
 
1037 1037
 
1038 1038
 	/**
1039
-	* Counts all month
1040
-	*
1041
-	* @return Array the month list
1042
-	*
1043
-	*/
1039
+	 * Counts all month
1040
+	 *
1041
+	 * @return Array the month list
1042
+	 *
1043
+	 */
1044 1044
 	public function countAllMonths($filters = array())
1045 1045
 	{
1046 1046
 		global $globalTimezone, $globalDBdriver;
@@ -1085,11 +1085,11 @@  discard block
 block discarded – undo
1085 1085
 	
1086 1086
 
1087 1087
 	/**
1088
-	* Counts all dates during the last year
1089
-	*
1090
-	* @return Array the date list
1091
-	*
1092
-	*/
1088
+	 * Counts all dates during the last year
1089
+	 *
1090
+	 * @return Array the date list
1091
+	 *
1092
+	 */
1093 1093
 	public function countAllMonthsLastYear($filters)
1094 1094
 	{
1095 1095
 		global $globalTimezone, $globalDBdriver;
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
 			$query .= " GROUP BY year_name, month_name
1112 1112
 								ORDER BY year_name, month_name ASC";
1113 1113
 			$query_data = array(':offset' => $offset);
1114
-    		}
1114
+			}
1115 1115
 		
1116 1116
 		$sth = $this->db->prepare($query);
1117 1117
 		$sth->execute($query_data);
@@ -1134,11 +1134,11 @@  discard block
 block discarded – undo
1134 1134
 	
1135 1135
 	
1136 1136
 	/**
1137
-	* Counts all hours
1138
-	*
1139
-	* @return Array the hour list
1140
-	*
1141
-	*/
1137
+	 * Counts all hours
1138
+	 *
1139
+	 * @return Array the hour list
1140
+	 *
1141
+	 */
1142 1142
 	public function countAllHours($orderby,$filters = array())
1143 1143
 	{
1144 1144
 		global $globalTimezone, $globalDBdriver;
@@ -1201,11 +1201,11 @@  discard block
 block discarded – undo
1201 1201
 	
1202 1202
 	
1203 1203
 	/**
1204
-	* Counts all hours by date
1205
-	*
1206
-	* @return Array the hour list
1207
-	*
1208
-	*/
1204
+	 * Counts all hours by date
1205
+	 *
1206
+	 * @return Array the hour list
1207
+	 *
1208
+	 */
1209 1209
 	public function countAllHoursByDate($date, $filters = array())
1210 1210
 	{
1211 1211
 		global $globalTimezone, $globalDBdriver;
@@ -1249,11 +1249,11 @@  discard block
 block discarded – undo
1249 1249
 	
1250 1250
 	
1251 1251
 	/**
1252
-	* Counts all hours by a ident/callsign
1253
-	*
1254
-	* @return Array the hour list
1255
-	*
1256
-	*/
1252
+	 * Counts all hours by a ident/callsign
1253
+	 *
1254
+	 * @return Array the hour list
1255
+	 *
1256
+	 */
1257 1257
 	public function countAllHoursByIdent($ident, $filters = array())
1258 1258
 	{
1259 1259
 		global $globalTimezone, $globalDBdriver;
@@ -1298,11 +1298,11 @@  discard block
 block discarded – undo
1298 1298
 	
1299 1299
 	
1300 1300
 	/**
1301
-	* Counts all trackers that have flown over
1302
-	*
1303
-	* @return Integer the number of trackers
1304
-	*
1305
-	*/
1301
+	 * Counts all trackers that have flown over
1302
+	 *
1303
+	 * @return Integer the number of trackers
1304
+	 *
1305
+	 */
1306 1306
 	public function countOverallTracker($filters = array(),$year = '',$month = '')
1307 1307
 	{
1308 1308
 		global $globalDBdriver;
@@ -1337,11 +1337,11 @@  discard block
 block discarded – undo
1337 1337
 	}
1338 1338
 	
1339 1339
 	/**
1340
-	* Counts all trackers type that have flown over
1341
-	*
1342
-	* @return Integer the number of flights
1343
-	*
1344
-	*/
1340
+	 * Counts all trackers type that have flown over
1341
+	 *
1342
+	 * @return Integer the number of flights
1343
+	 *
1344
+	 */
1345 1345
 	public function countOverallTrackerTypes($filters = array(),$year = '',$month = '')
1346 1346
 	{
1347 1347
 		global $globalDBdriver;
@@ -1376,11 +1376,11 @@  discard block
 block discarded – undo
1376 1376
 	
1377 1377
   
1378 1378
 	/**
1379
-	* Counts all hours of today
1380
-	*
1381
-	* @return Array the hour list
1382
-	*
1383
-	*/
1379
+	 * Counts all hours of today
1380
+	 *
1381
+	 * @return Array the hour list
1382
+	 *
1383
+	 */
1384 1384
 	public function countAllHoursFromToday($filters = array())
1385 1385
 	{
1386 1386
 		global $globalTimezone, $globalDBdriver;
@@ -1420,12 +1420,12 @@  discard block
 block discarded – undo
1420 1420
 	}
1421 1421
     
1422 1422
     
1423
-     /**
1424
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1425
-	*
1426
-	* @return Integer the Barrie Spotter ID
1423
+	 /**
1424
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1425
+	  *
1426
+	  * @return Integer the Barrie Spotter ID
1427 1427
 q	*
1428
-	*/
1428
+	  */
1429 1429
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1430 1430
 	{
1431 1431
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -1446,13 +1446,13 @@  discard block
 block discarded – undo
1446 1446
   
1447 1447
  
1448 1448
 	/**
1449
-	* Parses a date string
1450
-	*
1451
-	* @param String $dateString the date string
1452
-	* @param String $timezone the timezone of a user
1453
-	* @return Array the time information
1454
-	*
1455
-	*/
1449
+	 * Parses a date string
1450
+	 *
1451
+	 * @param String $dateString the date string
1452
+	 * @param String $timezone the timezone of a user
1453
+	 * @return Array the time information
1454
+	 *
1455
+	 */
1456 1456
 	public function parseDateString($dateString, $timezone = '')
1457 1457
 	{
1458 1458
 		$time_array = array();
@@ -1485,12 +1485,12 @@  discard block
 block discarded – undo
1485 1485
 	}
1486 1486
 	
1487 1487
 	/**
1488
-	* Parses the direction degrees to working
1489
-	*
1490
-	* @param Float $direction the direction in degrees
1491
-	* @return Array the direction information
1492
-	*
1493
-	*/
1488
+	 * Parses the direction degrees to working
1489
+	 *
1490
+	 * @param Float $direction the direction in degrees
1491
+	 * @return Array the direction information
1492
+	 *
1493
+	 */
1494 1494
 	public function parseDirection($direction = 0)
1495 1495
 	{
1496 1496
 		if ($direction == '') $direction = 0;
@@ -1569,12 +1569,12 @@  discard block
 block discarded – undo
1569 1569
 	
1570 1570
 	
1571 1571
 	/**
1572
-	* Gets Country from latitude/longitude
1573
-	*
1574
-	* @param Float $latitude latitute of the flight
1575
-	* @param Float $longitude longitute of the flight
1576
-	* @return String the countrie
1577
-	*/
1572
+	 * Gets Country from latitude/longitude
1573
+	 *
1574
+	 * @param Float $latitude latitute of the flight
1575
+	 * @param Float $longitude longitute of the flight
1576
+	 * @return String the countrie
1577
+	 */
1578 1578
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1579 1579
 	{
1580 1580
 		global $globalDBdriver, $globalDebug;
@@ -1611,11 +1611,11 @@  discard block
 block discarded – undo
1611 1611
 	}
1612 1612
 
1613 1613
 	/**
1614
-	* Gets Country from iso2
1615
-	*
1616
-	* @param String $iso2 ISO2 country code
1617
-	* @return String the countrie
1618
-	*/
1614
+	 * Gets Country from iso2
1615
+	 *
1616
+	 * @param String $iso2 ISO2 country code
1617
+	 * @return String the countrie
1618
+	 */
1619 1619
 	public function getCountryFromISO2($iso2)
1620 1620
 	{
1621 1621
 		global $globalDBdriver, $globalDebug;
@@ -1643,11 +1643,11 @@  discard block
 block discarded – undo
1643 1643
 	}
1644 1644
 
1645 1645
 	/**
1646
-	* Gets all vessels types that have flown over
1647
-	*
1648
-	* @return Array the vessel type list
1649
-	*
1650
-	*/
1646
+	 * Gets all vessels types that have flown over
1647
+	 *
1648
+	 * @return Array the vessel type list
1649
+	 *
1650
+	 */
1651 1651
 	public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1652 1652
 	{
1653 1653
 		global $globalDBdriver;
@@ -1714,12 +1714,12 @@  discard block
 block discarded – undo
1714 1714
 
1715 1715
 	
1716 1716
 	/**
1717
-	* Gets the short url from bit.ly
1718
-	*
1719
-	* @param String $url the full url
1720
-	* @return String the bit.ly url
1721
-	*
1722
-	*/
1717
+	 * Gets the short url from bit.ly
1718
+	 *
1719
+	 * @param String $url the full url
1720
+	 * @return String the bit.ly url
1721
+	 *
1722
+	 */
1723 1723
 	public function getBitlyURL($url)
1724 1724
 	{
1725 1725
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once(dirname(__FILE__).'/class.Image.php');
5 5
 $global_query = "SELECT tracker_output.* FROM tracker_output";
6 6
 
7
-class Tracker{
7
+class Tracker {
8 8
 	public $db;
9 9
 	
10 10
 	public function __construct($dbc = null) {
@@ -19,33 +19,33 @@  discard block
 block discarded – undo
19 19
 	* @return Array the SQL part
20 20
 	*/
21 21
 	
22
-	public function getFilter($filter = array(),$where = false,$and = false) {
22
+	public function getFilter($filter = array(), $where = false, $and = false) {
23 23
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
24 24
 		$filters = array();
25 25
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
26 26
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
27 27
 				$filters = $globalStatsFilters[$globalFilterName];
28 28
 			} else {
29
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
29
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
30 30
 			}
31 31
 		}
32 32
 		if (isset($filter[0]['source'])) {
33
-			$filters = array_merge($filters,$filter);
33
+			$filters = array_merge($filters, $filter);
34 34
 		}
35
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
36 36
 		$filter_query_join = '';
37 37
 		$filter_query_where = '';
38
-		foreach($filters as $flt) {
38
+		foreach ($filters as $flt) {
39 39
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
40 40
 				if (isset($flt['source'])) {
41
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
41
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
42 42
 				} else {
43
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
43
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.famtrackid = tracker_output.famtrackid";
44 44
 				}
45 45
 			}
46 46
 		}
47 47
 		if (isset($filter['source']) && !empty($filter['source'])) {
48
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
48
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
49 49
 		}
50 50
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
51 51
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
75 75
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
76 76
 		if ($filter_query_where != '') {
77
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
77
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
78 78
 		}
79 79
 		$filter_query = $filter_query_join.$filter_query_where;
80 80
 		return $filter_query;
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 	* @return Array the spotter information
90 90
 	*
91 91
 	*/
92
-	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
92
+	public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false)
93 93
 	{
94 94
 		date_default_timezone_set('UTC');
95 95
 		if (!is_string($query))
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 			$sth = $this->db->prepare($query.$limitQuery);
110 110
 			$sth->execute($params);
111 111
 		} catch (PDOException $e) {
112
-			printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery);
112
+			printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery);
113 113
 			exit();
114 114
 		}
115 115
 		
116 116
 		$num_rows = 0;
117 117
 		$spotter_array = array();
118
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
118
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
119 119
 		{
120 120
 			$num_rows++;
121 121
 			$temp_array = array();
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
 				{
172 172
 					$temp_array['date'] = "about ".$dateArray['hours']." hours ago";
173 173
 				} else {
174
-					$temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC"));
174
+					$temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC"));
175 175
 				}
176 176
 				$temp_array['date_minutes_past'] = $dateArray['minutes'];
177
-				$temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC"));
178
-				$temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC"));
177
+				$temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC"));
178
+				$temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC"));
179 179
 				$temp_array['date_unix'] = strtotime($row['date']." UTC");
180 180
 				if (isset($row['last_seen']) && $row['last_seen'] != '') {
181 181
 					if (strtotime($row['last_seen']) > strtotime($row['date'])) {
182 182
 						$temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']);
183
-						$temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC"));
184
-						$temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC"));
183
+						$temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC"));
184
+						$temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC"));
185 185
 						$temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC");
186 186
 					}
187 187
 				}
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
 		{
219 219
 			$limit_array = explode(",", $limit);
220 220
 			
221
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
222
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
221
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
222
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
223 223
 			
224 224
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
225 225
 			{
@@ -236,9 +236,9 @@  discard block
 block discarded – undo
236 236
 			$orderby_query = " ORDER BY tracker_output.date DESC";
237 237
 		}
238 238
 
239
-		$query  = $global_query.$filter_query." ".$orderby_query;
239
+		$query = $global_query.$filter_query." ".$orderby_query;
240 240
 
241
-		$spotter_array = $this->getDataFromDB($query, array(),$limit_query,true);
241
+		$spotter_array = $this->getDataFromDB($query, array(), $limit_query, true);
242 242
 
243 243
 		return $spotter_array;
244 244
 	}
@@ -257,8 +257,8 @@  discard block
 block discarded – undo
257 257
 		if ($id == '') return array();
258 258
 		$additional_query = "tracker_output.famtrackid = :id";
259 259
 		$query_values = array(':id' => $id);
260
-		$query  = $global_query." WHERE ".$additional_query." ";
261
-		$spotter_array = $this->getDataFromDB($query,$query_values);
260
+		$query = $global_query." WHERE ".$additional_query." ";
261
+		$spotter_array = $this->getDataFromDB($query, $query_values);
262 262
 		return $spotter_array;
263 263
 	}
264 264
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 		$query_values = array();
278 278
 		$limit_query = '';
279 279
 		$additional_query = '';
280
-		$filter_query = $this->getFilter($filter,true,true);
280
+		$filter_query = $this->getFilter($filter, true, true);
281 281
 		if ($ident != "")
282 282
 		{
283 283
 			if (!is_string($ident))
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 		{
294 294
 			$limit_array = explode(",", $limit);
295 295
 			
296
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
297
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
296
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
297
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
298 298
 			
299 299
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
300 300
 			{
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		return $spotter_array;
319 319
 	}
320 320
 	
321
-	public function getTrackerDataByDate($date = '', $limit = '', $sort = '',$filter = array())
321
+	public function getTrackerDataByDate($date = '', $limit = '', $sort = '', $filter = array())
322 322
 	{
323 323
 		global $global_query, $globalTimezone, $globalDBdriver;
324 324
 		
@@ -326,7 +326,7 @@  discard block
 block discarded – undo
326 326
 		$limit_query = '';
327 327
 		$additional_query = '';
328 328
 
329
-		$filter_query = $this->getFilter($filter,true,true);
329
+		$filter_query = $this->getFilter($filter, true, true);
330 330
 		
331 331
 		if ($date != "")
332 332
 		{
@@ -352,8 +352,8 @@  discard block
 block discarded – undo
352 352
 		{
353 353
 			$limit_array = explode(",", $limit);
354 354
 			
355
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
356
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
355
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
356
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
357 357
 			
358 358
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
359 359
 			{
@@ -384,11 +384,11 @@  discard block
 block discarded – undo
384 384
 	* @return Array list of source name
385 385
 	*
386 386
 	*/
387
-	public function getAllSourceName($type = '',$filters = array())
387
+	public function getAllSourceName($type = '', $filters = array())
388 388
 	{
389
-		$filter_query = $this->getFilter($filters,true,true);
389
+		$filter_query = $this->getFilter($filters, true, true);
390 390
 		$query_values = array();
391
-		$query  = "SELECT DISTINCT tracker_output.source_name 
391
+		$query = "SELECT DISTINCT tracker_output.source_name 
392 392
 				FROM tracker_output".$filter_query." tracker_output.source_name <> ''";
393 393
 		if ($type != '') {
394 394
 			$query_values = array(':type' => $type);
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 		$source_array = array();
404 404
 		$temp_array = array();
405 405
 		
406
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
406
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
407 407
 		{
408 408
 			$temp_array['source_name'] = $row['source_name'];
409 409
 			$source_array[] = $temp_array;
@@ -420,8 +420,8 @@  discard block
 block discarded – undo
420 420
 	*/
421 421
 	public function getAllIdents($filters = array())
422 422
 	{
423
-		$filter_query = $this->getFilter($filters,true,true);
424
-		$query  = "SELECT DISTINCT tracker_output.ident
423
+		$filter_query = $this->getFilter($filters, true, true);
424
+		$query = "SELECT DISTINCT tracker_output.ident
425 425
 								FROM tracker_output".$filter_query." tracker_output.ident <> '' 
426 426
 								ORDER BY tracker_output.date ASC LIMIT 700 OFFSET 0";
427 427
 
@@ -431,7 +431,7 @@  discard block
 block discarded – undo
431 431
 		$ident_array = array();
432 432
 		$temp_array = array();
433 433
 		
434
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
434
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
435 435
 		{
436 436
 			$temp_array['ident'] = $row['ident'];
437 437
 			$ident_array[] = $temp_array;
@@ -456,12 +456,12 @@  discard block
 block discarded – undo
456 456
 		} else $offset = '+00:00';
457 457
 
458 458
 		if ($globalDBdriver == 'mysql') {
459
-			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
459
+			$query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
460 460
 								FROM tracker_output
461 461
 								WHERE tracker_output.date <> '' 
462 462
 								ORDER BY tracker_output.date ASC LIMIT 0,200";
463 463
 		} else {
464
-			$query  = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
464
+			$query = "SELECT DISTINCT to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date
465 465
 								FROM tracker_output
466 466
 								WHERE tracker_output.date <> '' 
467 467
 								ORDER BY tracker_output.date ASC LIMIT 0,200";
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 		$date_array = array();
474 474
 		$temp_array = array();
475 475
 		
476
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
476
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
477 477
 		{
478 478
 			$temp_array['date'] = $row['date'];
479 479
 
@@ -492,11 +492,11 @@  discard block
 block discarded – undo
492 492
 	* @return String success or false
493 493
 	*
494 494
 	*/	
495
-	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
495
+	public function updateIdentTrackerData($famtrackid = '', $ident = '', $fromsource = NULL)
496 496
 	{
497 497
 
498 498
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
499
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
499
+                $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident);
500 500
 
501 501
 		try {
502 502
 			$sth = $this->db->prepare($query);
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
521 521
 	{
522 522
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
523
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
523
+                $query_values = array(':famtrackid' => $famtrackid, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident);
524 524
 
525 525
 		try {
526 526
 			$sth = $this->db->prepare($query);
@@ -560,7 +560,7 @@  discard block
 block discarded – undo
560 560
 	* @param String $verticalrate vertival rate of flight
561 561
 	* @return String success or false
562 562
 	*/
563
-	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
563
+	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '', $format_source = '', $source_name = '')
564 564
 	{
565 565
 		global $globalURL;
566 566
 		
@@ -628,21 +628,21 @@  discard block
 block discarded – undo
628 628
 		}
629 629
 
630 630
     
631
-		if ($date == "" || strtotime($date) < time()-20*60)
631
+		if ($date == "" || strtotime($date) < time() - 20*60)
632 632
 		{
633 633
 			$date = date("Y-m-d H:i:s", time());
634 634
 		}
635 635
 
636
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
637
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
638
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
639
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
640
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
641
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
642
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
643
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
644
-		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
645
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
636
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
637
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
638
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
639
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
640
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
641
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
642
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
643
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
644
+		$comment = filter_var($comment, FILTER_SANITIZE_STRING);
645
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
646 646
 	
647 647
                 if ($latitude == '' && $longitude == '') {
648 648
             		$latitude = 0;
@@ -650,10 +650,10 @@  discard block
 block discarded – undo
650 650
             	}
651 651
                 if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
652 652
                 if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
653
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
653
+                $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
654 654
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
655 655
 
656
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
656
+                $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':comment' => $comment, ':type' => $type);
657 657
 
658 658
 		try {
659 659
 		        
@@ -679,13 +679,13 @@  discard block
 block discarded – undo
679 679
 	{
680 680
 		global $globalDBdriver, $globalTimezone;
681 681
 		if ($globalDBdriver == 'mysql') {
682
-			$query  = "SELECT tracker_output.ident FROM tracker_output 
682
+			$query = "SELECT tracker_output.ident FROM tracker_output 
683 683
 								WHERE tracker_output.ident = :ident 
684 684
 								AND tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
685 685
 								AND tracker_output.date < UTC_TIMESTAMP()";
686 686
 			$query_data = array(':ident' => $ident);
687 687
 		} else {
688
-			$query  = "SELECT tracker_output.ident FROM tracker_output 
688
+			$query = "SELECT tracker_output.ident FROM tracker_output 
689 689
 								WHERE tracker_output.ident = :ident 
690 690
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
691 691
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
@@ -694,8 +694,8 @@  discard block
 block discarded – undo
694 694
 		
695 695
 		$sth = $this->db->prepare($query);
696 696
 		$sth->execute($query_data);
697
-    		$ident_result='';
698
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
697
+    		$ident_result = '';
698
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
699 699
 		{
700 700
 			$ident_result = $row['ident'];
701 701
 		}
@@ -721,8 +721,8 @@  discard block
 block discarded – undo
721 721
 				return false;
722 722
 			} else {
723 723
 				$q_array = explode(" ", $q);
724
-				foreach ($q_array as $q_item){
725
-					$q_item = filter_var($q_item,FILTER_SANITIZE_STRING);
724
+				foreach ($q_array as $q_item) {
725
+					$q_item = filter_var($q_item, FILTER_SANITIZE_STRING);
726 726
 					$additional_query .= " AND (";
727 727
 					$additional_query .= "(tracker_output.ident like '%".$q_item."%')";
728 728
 					$additional_query .= ")";
@@ -730,11 +730,11 @@  discard block
 block discarded – undo
730 730
 			}
731 731
 		}
732 732
 		if ($globalDBdriver == 'mysql') {
733
-			$query  = "SELECT tracker_output.* FROM tracker_output 
733
+			$query = "SELECT tracker_output.* FROM tracker_output 
734 734
 				WHERE tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." 
735 735
 				AND tracker_output.date < UTC_TIMESTAMP()";
736 736
 		} else {
737
-			$query  = "SELECT tracker_output.* FROM tracker_output 
737
+			$query = "SELECT tracker_output.* FROM tracker_output 
738 738
 				WHERE tracker_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." 
739 739
 				AND tracker_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'";
740 740
 		}
@@ -753,16 +753,16 @@  discard block
 block discarded – undo
753 753
 	*
754 754
 	*/
755 755
 
756
-	public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
756
+	public function countAllTrackerOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array())
757 757
 	{
758 758
 		global $globalDBdriver, $globalArchive;
759 759
 		//$filter_query = $this->getFilter($filters,true,true);
760
-		$Connection= new Connection($this->db);
760
+		$Connection = new Connection($this->db);
761 761
 		if (!$Connection->tableExists('countries')) return array();
762 762
 		if (!isset($globalArchive) || $globalArchive !== TRUE) {
763 763
 			require_once('class.TrackerLive.php');
764 764
 			$TrackerLive = new TrackerLive($this->db);
765
-			$filter_query = $TrackerLive->getFilter($filters,true,true);
765
+			$filter_query = $TrackerLive->getFilter($filters, true, true);
766 766
 			$filter_query .= " over_country IS NOT NULL AND over_country <> ''";
767 767
 			if ($olderthanmonths > 0) {
768 768
 				if ($globalDBdriver == 'mysql') {
@@ -782,7 +782,7 @@  discard block
 block discarded – undo
782 782
 		} else {
783 783
 			require_once('class.TrackerArchive.php');
784 784
 			$TrackerArchive = new TrackerArchive($this->db);
785
-			$filter_query = $TrackerArchive->getFilter($filters,true,true);
785
+			$filter_query = $TrackerArchive->getFilter($filters, true, true);
786 786
 			$filter_query .= " over_country IS NOT NULL AND over_country <> ''";
787 787
 			if ($olderthanmonths > 0) {
788 788
 				if ($globalDBdriver == 'mysql') {
@@ -810,7 +810,7 @@  discard block
 block discarded – undo
810 810
 		$flight_array = array();
811 811
 		$temp_array = array();
812 812
         
813
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
813
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
814 814
 		{
815 815
 			$temp_array['flight_count'] = $row['nb'];
816 816
 			$temp_array['flight_country'] = $row['name'];
@@ -827,11 +827,11 @@  discard block
 block discarded – undo
827 827
 	* @return Array the callsign list
828 828
 	*
829 829
 	*/
830
-	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
830
+	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
831 831
 	{
832 832
 		global $globalDBdriver;
833
-		$filter_query = $this->getFilter($filters,true,true);
834
-		$query  = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
833
+		$filter_query = $this->getFilter($filters, true, true);
834
+		$query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
835 835
                     FROM tracker_output".$filter_query." tracker_output.ident <> ''";
836 836
 		 if ($olderthanmonths > 0) {
837 837
 			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
@@ -845,28 +845,28 @@  discard block
 block discarded – undo
845 845
 		if ($year != '') {
846 846
 			if ($globalDBdriver == 'mysql') {
847 847
 				$query .= " AND YEAR(tracker_output.date) = :year";
848
-				$query_values = array_merge($query_values,array(':year' => $year));
848
+				$query_values = array_merge($query_values, array(':year' => $year));
849 849
 			} else {
850 850
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
851
-				$query_values = array_merge($query_values,array(':year' => $year));
851
+				$query_values = array_merge($query_values, array(':year' => $year));
852 852
 			}
853 853
 		}
854 854
 		if ($month != '') {
855 855
 			if ($globalDBdriver == 'mysql') {
856 856
 				$query .= " AND MONTH(tracker_output.date) = :month";
857
-				$query_values = array_merge($query_values,array(':month' => $month));
857
+				$query_values = array_merge($query_values, array(':month' => $month));
858 858
 			} else {
859 859
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
860
-				$query_values = array_merge($query_values,array(':month' => $month));
860
+				$query_values = array_merge($query_values, array(':month' => $month));
861 861
 			}
862 862
 		}
863 863
 		if ($day != '') {
864 864
 			if ($globalDBdriver == 'mysql') {
865 865
 				$query .= " AND DAY(tracker_output.date) = :day";
866
-				$query_values = array_merge($query_values,array(':day' => $day));
866
+				$query_values = array_merge($query_values, array(':day' => $day));
867 867
 			} else {
868 868
 				$query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day";
869
-				$query_values = array_merge($query_values,array(':day' => $day));
869
+				$query_values = array_merge($query_values, array(':day' => $day));
870 870
 			}
871 871
 		}
872 872
 		$query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC";
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 		$callsign_array = array();
879 879
 		$temp_array = array();
880 880
         
881
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
881
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
882 882
 		{
883 883
 			$temp_array['callsign_icao'] = $row['ident'];
884 884
 			$temp_array['airline_name'] = $row['airline_name'];
@@ -930,7 +930,7 @@  discard block
 block discarded – undo
930 930
 		$date_array = array();
931 931
 		$temp_array = array();
932 932
         
933
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
933
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
934 934
 		{
935 935
 			$temp_array['date_name'] = $row['date_name'];
936 936
 			$temp_array['date_count'] = $row['date_count'];
@@ -956,7 +956,7 @@  discard block
 block discarded – undo
956 956
 			$datetime = new DateTime();
957 957
 			$offset = $datetime->format('P');
958 958
 		} else $offset = '+00:00';
959
-		$filter_query = $this->getFilter($filters,true,true);
959
+		$filter_query = $this->getFilter($filters, true, true);
960 960
 		if ($globalDBdriver == 'mysql') {
961 961
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
962 962
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)";
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 		$date_array = array();
978 978
 		$temp_array = array();
979 979
         
980
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
980
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
981 981
 		{
982 982
 			$temp_array['date_name'] = $row['date_name'];
983 983
 			$temp_array['date_count'] = $row['date_count'];
@@ -1002,7 +1002,7 @@  discard block
 block discarded – undo
1002 1002
 			$datetime = new DateTime();
1003 1003
 			$offset = $datetime->format('P');
1004 1004
 		} else $offset = '+00:00';
1005
-		$filter_query = $this->getFilter($filters,true,true);
1005
+		$filter_query = $this->getFilter($filters, true, true);
1006 1006
 		if ($globalDBdriver == 'mysql') {
1007 1007
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
1008 1008
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)";
@@ -1023,7 +1023,7 @@  discard block
 block discarded – undo
1023 1023
 		$date_array = array();
1024 1024
 		$temp_array = array();
1025 1025
         
1026
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1026
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1027 1027
 		{
1028 1028
 			$temp_array['date_name'] = $row['date_name'];
1029 1029
 			$temp_array['date_count'] = $row['date_count'];
@@ -1070,7 +1070,7 @@  discard block
 block discarded – undo
1070 1070
 		$date_array = array();
1071 1071
 		$temp_array = array();
1072 1072
         
1073
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1073
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1074 1074
 		{
1075 1075
 			$temp_array['month_name'] = $row['month_name'];
1076 1076
 			$temp_array['year_name'] = $row['year_name'];
@@ -1099,7 +1099,7 @@  discard block
 block discarded – undo
1099 1099
 			$datetime = new DateTime();
1100 1100
 			$offset = $datetime->format('P');
1101 1101
 		} else $offset = '+00:00';
1102
-		$filter_query = $this->getFilter($filters,true,true);
1102
+		$filter_query = $this->getFilter($filters, true, true);
1103 1103
 		if ($globalDBdriver == 'mysql') {
1104 1104
 			$query  = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
1105 1105
 								FROM tracker_output".$filter_query." tracker_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)";
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
 		$date_array = array();
1121 1121
 		$temp_array = array();
1122 1122
         
1123
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1123
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1124 1124
 		{
1125 1125
 			$temp_array['year_name'] = $row['year_name'];
1126 1126
 			$temp_array['month_name'] = $row['month_name'];
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 	* @return Array the hour list
1141 1141
 	*
1142 1142
 	*/
1143
-	public function countAllHours($orderby,$filters = array())
1143
+	public function countAllHours($orderby, $filters = array())
1144 1144
 	{
1145 1145
 		global $globalTimezone, $globalDBdriver;
1146 1146
 		if ($globalTimezone != '') {
@@ -1188,7 +1188,7 @@  discard block
 block discarded – undo
1188 1188
 		$hour_array = array();
1189 1189
 		$temp_array = array();
1190 1190
         
1191
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1191
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1192 1192
 		{
1193 1193
 			$temp_array['hour_name'] = $row['hour_name'];
1194 1194
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1210,8 +1210,8 @@  discard block
 block discarded – undo
1210 1210
 	public function countAllHoursByDate($date, $filters = array())
1211 1211
 	{
1212 1212
 		global $globalTimezone, $globalDBdriver;
1213
-		$filter_query = $this->getFilter($filters,true,true);
1214
-		$date = filter_var($date,FILTER_SANITIZE_STRING);
1213
+		$filter_query = $this->getFilter($filters, true, true);
1214
+		$date = filter_var($date, FILTER_SANITIZE_STRING);
1215 1215
 		if ($globalTimezone != '') {
1216 1216
 			date_default_timezone_set($globalTimezone);
1217 1217
 			$datetime = new DateTime($date);
@@ -1219,12 +1219,12 @@  discard block
 block discarded – undo
1219 1219
 		} else $offset = '+00:00';
1220 1220
 
1221 1221
 		if ($globalDBdriver == 'mysql') {
1222
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1222
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1223 1223
 								FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = :date
1224 1224
 								GROUP BY hour_name 
1225 1225
 								ORDER BY hour_name ASC";
1226 1226
 		} else {
1227
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1227
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1228 1228
 								FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date
1229 1229
 								GROUP BY hour_name 
1230 1230
 								ORDER BY hour_name ASC";
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 		$hour_array = array();
1237 1237
 		$temp_array = array();
1238 1238
         
1239
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1239
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1240 1240
 		{
1241 1241
 			$temp_array['hour_name'] = $row['hour_name'];
1242 1242
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1258,8 +1258,8 @@  discard block
 block discarded – undo
1258 1258
 	public function countAllHoursByIdent($ident, $filters = array())
1259 1259
 	{
1260 1260
 		global $globalTimezone, $globalDBdriver;
1261
-		$filter_query = $this->getFilter($filters,true,true);
1262
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
1261
+		$filter_query = $this->getFilter($filters, true, true);
1262
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1263 1263
 		if ($globalTimezone != '') {
1264 1264
 			date_default_timezone_set($globalTimezone);
1265 1265
 			$datetime = new DateTime();
@@ -1267,12 +1267,12 @@  discard block
 block discarded – undo
1267 1267
 		} else $offset = '+00:00';
1268 1268
 
1269 1269
 		if ($globalDBdriver == 'mysql') {
1270
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1270
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1271 1271
 								FROM tracker_output".$filter_query." tracker_output.ident = :ident 
1272 1272
 								GROUP BY hour_name 
1273 1273
 								ORDER BY hour_name ASC";
1274 1274
 		} else {
1275
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1275
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1276 1276
 								FROM tracker_output".$filter_query." tracker_output.ident = :ident 
1277 1277
 								GROUP BY hour_name 
1278 1278
 								ORDER BY hour_name ASC";
@@ -1280,12 +1280,12 @@  discard block
 block discarded – undo
1280 1280
       
1281 1281
 		
1282 1282
 		$sth = $this->db->prepare($query);
1283
-		$sth->execute(array(':ident' => $ident,':offset' => $offset));
1283
+		$sth->execute(array(':ident' => $ident, ':offset' => $offset));
1284 1284
       
1285 1285
 		$hour_array = array();
1286 1286
 		$temp_array = array();
1287 1287
         
1288
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1288
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1289 1289
 		{
1290 1290
 			$temp_array['hour_name'] = $row['hour_name'];
1291 1291
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1304,33 +1304,33 @@  discard block
 block discarded – undo
1304 1304
 	* @return Integer the number of trackers
1305 1305
 	*
1306 1306
 	*/
1307
-	public function countOverallTracker($filters = array(),$year = '',$month = '')
1307
+	public function countOverallTracker($filters = array(), $year = '', $month = '')
1308 1308
 	{
1309 1309
 		global $globalDBdriver;
1310 1310
 		//$queryi  = "SELECT COUNT(tracker_output.tracker_id) AS flight_count FROM tracker_output";
1311
-		$queryi  = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output";
1311
+		$queryi = "SELECT COUNT(DISTINCT tracker_output.ident) AS tracker_count FROM tracker_output";
1312 1312
 		$query_values = array();
1313 1313
 		$query = '';
1314 1314
 		if ($year != '') {
1315 1315
 			if ($globalDBdriver == 'mysql') {
1316 1316
 				$query .= " AND YEAR(tracker_output.date) = :year";
1317
-				$query_values = array_merge($query_values,array(':year' => $year));
1317
+				$query_values = array_merge($query_values, array(':year' => $year));
1318 1318
 			} else {
1319 1319
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
1320
-				$query_values = array_merge($query_values,array(':year' => $year));
1320
+				$query_values = array_merge($query_values, array(':year' => $year));
1321 1321
 			}
1322 1322
 		}
1323 1323
 		if ($month != '') {
1324 1324
 			if ($globalDBdriver == 'mysql') {
1325 1325
 				$query .= " AND MONTH(tracker_output.date) = :month";
1326
-				$query_values = array_merge($query_values,array(':month' => $month));
1326
+				$query_values = array_merge($query_values, array(':month' => $month));
1327 1327
 			} else {
1328 1328
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
1329
-				$query_values = array_merge($query_values,array(':month' => $month));
1329
+				$query_values = array_merge($query_values, array(':month' => $month));
1330 1330
 			}
1331 1331
 		}
1332 1332
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1333
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1333
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1334 1334
 		
1335 1335
 		$sth = $this->db->prepare($queryi);
1336 1336
 		$sth->execute($query_values);
@@ -1343,32 +1343,32 @@  discard block
 block discarded – undo
1343 1343
 	* @return Integer the number of flights
1344 1344
 	*
1345 1345
 	*/
1346
-	public function countOverallTrackerTypes($filters = array(),$year = '',$month = '')
1346
+	public function countOverallTrackerTypes($filters = array(), $year = '', $month = '')
1347 1347
 	{
1348 1348
 		global $globalDBdriver;
1349
-		$queryi  = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output";
1349
+		$queryi = "SELECT COUNT(DISTINCT tracker_output.type) AS tracker_count FROM tracker_output";
1350 1350
 		$query_values = array();
1351 1351
 		$query = '';
1352 1352
 		if ($year != '') {
1353 1353
 			if ($globalDBdriver == 'mysql') {
1354 1354
 				$query .= " AND YEAR(tracker_output.date) = :year";
1355
-				$query_values = array_merge($query_values,array(':year' => $year));
1355
+				$query_values = array_merge($query_values, array(':year' => $year));
1356 1356
 			} else {
1357 1357
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
1358
-				$query_values = array_merge($query_values,array(':year' => $year));
1358
+				$query_values = array_merge($query_values, array(':year' => $year));
1359 1359
 			}
1360 1360
 		}
1361 1361
 		if ($month != '') {
1362 1362
 			if ($globalDBdriver == 'mysql') {
1363 1363
 				$query .= " AND MONTH(tracker_output.date) = :month";
1364
-				$query_values = array_merge($query_values,array(':month' => $month));
1364
+				$query_values = array_merge($query_values, array(':month' => $month));
1365 1365
 			} else {
1366 1366
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
1367
-				$query_values = array_merge($query_values,array(':month' => $month));
1367
+				$query_values = array_merge($query_values, array(':month' => $month));
1368 1368
 			}
1369 1369
 		}
1370 1370
 		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1371
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1371
+		else $queryi .= $this->getFilter($filters, true, true).substr($query, 4);
1372 1372
 		
1373 1373
 		$sth = $this->db->prepare($queryi);
1374 1374
 		$sth->execute($query_values);
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
 	public function countAllHoursFromToday($filters = array())
1386 1386
 	{
1387 1387
 		global $globalTimezone, $globalDBdriver;
1388
-		$filter_query = $this->getFilter($filters,true,true);
1388
+		$filter_query = $this->getFilter($filters, true, true);
1389 1389
 		if ($globalTimezone != '') {
1390 1390
 			date_default_timezone_set($globalTimezone);
1391 1391
 			$datetime = new DateTime();
@@ -1393,12 +1393,12 @@  discard block
 block discarded – undo
1393 1393
 		} else $offset = '+00:00';
1394 1394
 
1395 1395
 		if ($globalDBdriver == 'mysql') {
1396
-			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1396
+			$query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
1397 1397
 								FROM tracker_output".$filter_query." DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) = CURDATE()
1398 1398
 								GROUP BY hour_name 
1399 1399
 								ORDER BY hour_name ASC";
1400 1400
 		} else {
1401
-			$query  = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1401
+			$query = "SELECT EXTRACT(HOUR FROM tracker_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count
1402 1402
 								FROM tracker_output".$filter_query." to_char(tracker_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date)
1403 1403
 								GROUP BY hour_name 
1404 1404
 								ORDER BY hour_name ASC";
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
 		$hour_array = array();
1411 1411
 		$temp_array = array();
1412 1412
         
1413
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1413
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1414 1414
 		{
1415 1415
 			$temp_array['hour_name'] = $row['hour_name'];
1416 1416
 			$temp_array['hour_count'] = $row['hour_count'];
@@ -1429,9 +1429,9 @@  discard block
 block discarded – undo
1429 1429
 	*/
1430 1430
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1431 1431
 	{
1432
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
1432
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
1433 1433
 
1434
-		$query  = "SELECT tracker_output.tracker_id
1434
+		$query = "SELECT tracker_output.tracker_id
1435 1435
 				FROM tracker_output 
1436 1436
 				WHERE tracker_output.famtrackid = '".$famtrackid."'";
1437 1437
         
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
 		$sth = $this->db->prepare($query);
1440 1440
 		$sth->execute();
1441 1441
 
1442
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1442
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1443 1443
 		{
1444 1444
 			return $row['tracker_id'];
1445 1445
 		}
@@ -1464,23 +1464,23 @@  discard block
 block discarded – undo
1464 1464
 		}
1465 1465
 		
1466 1466
 		$current_date = date("Y-m-d H:i:s");
1467
-		$date = date("Y-m-d H:i:s",strtotime($dateString." UTC"));
1467
+		$date = date("Y-m-d H:i:s", strtotime($dateString." UTC"));
1468 1468
 		
1469 1469
 		$diff = abs(strtotime($current_date) - strtotime($date));
1470 1470
 
1471
-		$time_array['years'] = floor($diff / (365*60*60*24)); 
1471
+		$time_array['years'] = floor($diff/(365*60*60*24)); 
1472 1472
 		$years = $time_array['years'];
1473 1473
 		
1474
-		$time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24));
1474
+		$time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24));
1475 1475
 		$months = $time_array['months'];
1476 1476
 		
1477
-		$time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24));
1477
+		$time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24));
1478 1478
 		$days = $time_array['days'];
1479
-		$time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60));
1479
+		$time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60));
1480 1480
 		$hours = $time_array['hours'];
1481
-		$time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60);
1481
+		$time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60);
1482 1482
 		$minutes = $time_array['minutes'];
1483
-		$time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1483
+		$time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60));  
1484 1484
 		
1485 1485
 		return $time_array;
1486 1486
 	}
@@ -1503,63 +1503,63 @@  discard block
 block discarded – undo
1503 1503
 			$temp_array['direction_degree'] = $direction;
1504 1504
 			$temp_array['direction_shortname'] = "N";
1505 1505
 			$temp_array['direction_fullname'] = "North";
1506
-		} elseif ($direction >= 22.5 && $direction < 45){
1506
+		} elseif ($direction >= 22.5 && $direction < 45) {
1507 1507
 			$temp_array['direction_degree'] = $direction;
1508 1508
 			$temp_array['direction_shortname'] = "NNE";
1509 1509
 			$temp_array['direction_fullname'] = "North-Northeast";
1510
-		} elseif ($direction >= 45 && $direction < 67.5){
1510
+		} elseif ($direction >= 45 && $direction < 67.5) {
1511 1511
 			$temp_array['direction_degree'] = $direction;
1512 1512
 			$temp_array['direction_shortname'] = "NE";
1513 1513
 			$temp_array['direction_fullname'] = "Northeast";
1514
-		} elseif ($direction >= 67.5 && $direction < 90){
1514
+		} elseif ($direction >= 67.5 && $direction < 90) {
1515 1515
 			$temp_array['direction_degree'] = $direction;
1516 1516
 			$temp_array['direction_shortname'] = "ENE";
1517 1517
 			$temp_array['direction_fullname'] = "East-Northeast";
1518
-		} elseif ($direction >= 90 && $direction < 112.5){
1518
+		} elseif ($direction >= 90 && $direction < 112.5) {
1519 1519
 			$temp_array['direction_degree'] = $direction;
1520 1520
 			$temp_array['direction_shortname'] = "E";
1521 1521
 			$temp_array['direction_fullname'] = "East";
1522
-		} elseif ($direction >= 112.5 && $direction < 135){
1522
+		} elseif ($direction >= 112.5 && $direction < 135) {
1523 1523
 			$temp_array['direction_degree'] = $direction;
1524 1524
 			$temp_array['direction_shortname'] = "ESE";
1525 1525
 			$temp_array['direction_fullname'] = "East-Southeast";
1526
-		} elseif ($direction >= 135 && $direction < 157.5){
1526
+		} elseif ($direction >= 135 && $direction < 157.5) {
1527 1527
 			$temp_array['direction_degree'] = $direction;
1528 1528
 			$temp_array['direction_shortname'] = "SE";
1529 1529
 			$temp_array['direction_fullname'] = "Southeast";
1530
-		} elseif ($direction >= 157.5 && $direction < 180){
1530
+		} elseif ($direction >= 157.5 && $direction < 180) {
1531 1531
 			$temp_array['direction_degree'] = $direction;
1532 1532
 			$temp_array['direction_shortname'] = "SSE";
1533 1533
 			$temp_array['direction_fullname'] = "South-Southeast";
1534
-		} elseif ($direction >= 180 && $direction < 202.5){
1534
+		} elseif ($direction >= 180 && $direction < 202.5) {
1535 1535
 			$temp_array['direction_degree'] = $direction;
1536 1536
 			$temp_array['direction_shortname'] = "S";
1537 1537
 			$temp_array['direction_fullname'] = "South";
1538
-		} elseif ($direction >= 202.5 && $direction < 225){
1538
+		} elseif ($direction >= 202.5 && $direction < 225) {
1539 1539
 			$temp_array['direction_degree'] = $direction;
1540 1540
 			$temp_array['direction_shortname'] = "SSW";
1541 1541
 			$temp_array['direction_fullname'] = "South-Southwest";
1542
-		} elseif ($direction >= 225 && $direction < 247.5){
1542
+		} elseif ($direction >= 225 && $direction < 247.5) {
1543 1543
 			$temp_array['direction_degree'] = $direction;
1544 1544
 			$temp_array['direction_shortname'] = "SW";
1545 1545
 			$temp_array['direction_fullname'] = "Southwest";
1546
-		} elseif ($direction >= 247.5 && $direction < 270){
1546
+		} elseif ($direction >= 247.5 && $direction < 270) {
1547 1547
 			$temp_array['direction_degree'] = $direction;
1548 1548
 			$temp_array['direction_shortname'] = "WSW";
1549 1549
 			$temp_array['direction_fullname'] = "West-Southwest";
1550
-		} elseif ($direction >= 270 && $direction < 292.5){
1550
+		} elseif ($direction >= 270 && $direction < 292.5) {
1551 1551
 			$temp_array['direction_degree'] = $direction;
1552 1552
 			$temp_array['direction_shortname'] = "W";
1553 1553
 			$temp_array['direction_fullname'] = "West";
1554
-		} elseif ($direction >= 292.5 && $direction < 315){
1554
+		} elseif ($direction >= 292.5 && $direction < 315) {
1555 1555
 			$temp_array['direction_degree'] = $direction;
1556 1556
 			$temp_array['direction_shortname'] = "WNW";
1557 1557
 			$temp_array['direction_fullname'] = "West-Northwest";
1558
-		} elseif ($direction >= 315 && $direction < 337.5){
1558
+		} elseif ($direction >= 315 && $direction < 337.5) {
1559 1559
 			$temp_array['direction_degree'] = $direction;
1560 1560
 			$temp_array['direction_shortname'] = "NW";
1561 1561
 			$temp_array['direction_fullname'] = "Northwest";
1562
-		} elseif ($direction >= 337.5 && $direction < 360){
1562
+		} elseif ($direction >= 337.5 && $direction < 360) {
1563 1563
 			$temp_array['direction_degree'] = $direction;
1564 1564
 			$temp_array['direction_shortname'] = "NNW";
1565 1565
 			$temp_array['direction_fullname'] = "North-Northwest";
@@ -1576,11 +1576,11 @@  discard block
 block discarded – undo
1576 1576
 	* @param Float $longitude longitute of the flight
1577 1577
 	* @return String the countrie
1578 1578
 	*/
1579
-	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1579
+	public function getCountryFromLatitudeLongitude($latitude, $longitude)
1580 1580
 	{
1581 1581
 		global $globalDBdriver, $globalDebug;
1582
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1583
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1582
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1583
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
1584 1584
 	
1585 1585
 		$Connection = new Connection($this->db);
1586 1586
 		if (!$Connection->tableExists('countries')) return '';
@@ -1620,7 +1620,7 @@  discard block
 block discarded – undo
1620 1620
 	public function getCountryFromISO2($iso2)
1621 1621
 	{
1622 1622
 		global $globalDBdriver, $globalDebug;
1623
-		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1623
+		$iso2 = filter_var($iso2, FILTER_SANITIZE_STRING);
1624 1624
 	
1625 1625
 		$Connection = new Connection($this->db);
1626 1626
 		if (!$Connection->tableExists('countries')) return '';
@@ -1649,11 +1649,11 @@  discard block
 block discarded – undo
1649 1649
 	* @return Array the vessel type list
1650 1650
 	*
1651 1651
 	*/
1652
-	public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1652
+	public function countAllTrackerTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '')
1653 1653
 	{
1654 1654
 		global $globalDBdriver;
1655
-		$filter_query = $this->getFilter($filters,true,true);
1656
-		$query  = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count 
1655
+		$filter_query = $this->getFilter($filters, true, true);
1656
+		$query = "SELECT tracker_output.type AS tracker_type, COUNT(tracker_output.type) AS tracker_type_count 
1657 1657
 		    FROM tracker_output ".$filter_query." tracker_output.type  <> ''";
1658 1658
 		if ($olderthanmonths > 0) {
1659 1659
 			if ($globalDBdriver == 'mysql') {
@@ -1673,28 +1673,28 @@  discard block
 block discarded – undo
1673 1673
 		if ($year != '') {
1674 1674
 			if ($globalDBdriver == 'mysql') {
1675 1675
 				$query .= " AND YEAR(tracker_output.date) = :year";
1676
-				$query_values = array_merge($query_values,array(':year' => $year));
1676
+				$query_values = array_merge($query_values, array(':year' => $year));
1677 1677
 			} else {
1678 1678
 				$query .= " AND EXTRACT(YEAR FROM tracker_output.date) = :year";
1679
-				$query_values = array_merge($query_values,array(':year' => $year));
1679
+				$query_values = array_merge($query_values, array(':year' => $year));
1680 1680
 			}
1681 1681
 		}
1682 1682
 		if ($month != '') {
1683 1683
 			if ($globalDBdriver == 'mysql') {
1684 1684
 				$query .= " AND MONTH(tracker_output.date) = :month";
1685
-				$query_values = array_merge($query_values,array(':month' => $month));
1685
+				$query_values = array_merge($query_values, array(':month' => $month));
1686 1686
 			} else {
1687 1687
 				$query .= " AND EXTRACT(MONTH FROM tracker_output.date) = :month";
1688
-				$query_values = array_merge($query_values,array(':month' => $month));
1688
+				$query_values = array_merge($query_values, array(':month' => $month));
1689 1689
 			}
1690 1690
 		}
1691 1691
 		if ($day != '') {
1692 1692
 			if ($globalDBdriver == 'mysql') {
1693 1693
 				$query .= " AND DAY(tracker_output.date) = :day";
1694
-				$query_values = array_merge($query_values,array(':day' => $day));
1694
+				$query_values = array_merge($query_values, array(':day' => $day));
1695 1695
 			} else {
1696 1696
 				$query .= " AND EXTRACT(DAY FROM tracker_output.date) = :day";
1697
-				$query_values = array_merge($query_values,array(':day' => $day));
1697
+				$query_values = array_merge($query_values, array(':day' => $day));
1698 1698
 			}
1699 1699
 		}
1700 1700
 		$query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC";
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 		$sth->execute($query_values);
1704 1704
 		$tracker_array = array();
1705 1705
 		$temp_array = array();
1706
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
1706
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1707 1707
 		{
1708 1708
 			$temp_array['tracker_type'] = $row['tracker_type'];
1709 1709
 			$temp_array['tracker_type_count'] = $row['tracker_type_count'];
@@ -1738,7 +1738,7 @@  discard block
 block discarded – undo
1738 1738
 		
1739 1739
 		$bitly_data = json_decode($bitly_data);
1740 1740
 		$bitly_url = '';
1741
-		if ($bitly_data->status_txt = "OK"){
1741
+		if ($bitly_data->status_txt = "OK") {
1742 1742
 			$bitly_url = $bitly_data->data->url;
1743 1743
 		}
1744 1744
 
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 
1749 1749
 	public function getOrderBy()
1750 1750
 	{
1751
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC"));
1751
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC"));
1752 1752
 		
1753 1753
 		return $orderby;
1754 1754
 		
Please login to merge, or discard this patch.
Braces   +160 added lines, -57 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
 	public function __construct($dbc = null) {
11 11
 		$Connection = new Connection($dbc);
12 12
 		$this->db = $Connection->db();
13
-		if ($this->db === null) die('Error: No DB connection.');
13
+		if ($this->db === null) {
14
+			die('Error: No DB connection.');
15
+		}
14 16
 	}
15 17
 
16 18
 	/**
@@ -32,7 +34,9 @@  discard block
 block discarded – undo
32 34
 		if (isset($filter[0]['source'])) {
33 35
 			$filters = array_merge($filters,$filter);
34 36
 		}
35
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
37
+		if (is_array($globalFilter)) {
38
+			$filter = array_merge($filter,$globalFilter);
39
+		}
36 40
 		$filter_query_join = '';
37 41
 		$filter_query_where = '';
38 42
 		foreach($filters as $flt) {
@@ -71,8 +75,11 @@  discard block
 block discarded – undo
71 75
 				$filter_query_where .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'";
72 76
 			}
73 77
 		}
74
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
75
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
78
+		if ($filter_query_where == '' && $where) {
79
+			$filter_query_where = ' WHERE';
80
+		} elseif ($filter_query_where != '' && $and) {
81
+			$filter_query_where .= ' AND';
82
+		}
76 83
 		if ($filter_query_where != '') {
77 84
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
78 85
 		}
@@ -126,26 +133,43 @@  discard block
 block discarded – undo
126 133
 				$temp_array['spotter_id'] = $row['spotter_archive_id'];
127 134
 			} elseif (isset($row['spotter_archive_output_id'])) {
128 135
 				$temp_array['spotter_id'] = $row['spotter_archive_output_id'];
129
-			*/} 
130
-			elseif (isset($row['trackerid'])) {
136
+			*/} elseif (isset($row['trackerid'])) {
131 137
 				$temp_array['trackerid'] = $row['trackerid'];
132 138
 			} else {
133 139
 				$temp_array['trackerid'] = '';
134 140
 			}
135
-			if (isset($row['famtrackid'])) $temp_array['famtrackid'] = $row['famtrackid'];
136
-			if (isset($row['type'])) $temp_array['type'] = $row['type'];
137
-			if (isset($row['comment'])) $temp_array['comment'] = $row['comment'];
141
+			if (isset($row['famtrackid'])) {
142
+				$temp_array['famtrackid'] = $row['famtrackid'];
143
+			}
144
+			if (isset($row['type'])) {
145
+				$temp_array['type'] = $row['type'];
146
+			}
147
+			if (isset($row['comment'])) {
148
+				$temp_array['comment'] = $row['comment'];
149
+			}
138 150
 			$temp_array['ident'] = $row['ident'];
139
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
140
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
141
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
142
-			if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude'];
151
+			if (isset($row['latitude'])) {
152
+				$temp_array['latitude'] = $row['latitude'];
153
+			}
154
+			if (isset($row['longitude'])) {
155
+				$temp_array['longitude'] = $row['longitude'];
156
+			}
157
+			if (isset($row['format_source'])) {
158
+				$temp_array['format_source'] = $row['format_source'];
159
+			}
160
+			if (isset($row['altitude'])) {
161
+				$temp_array['altitude'] = $row['altitude'];
162
+			}
143 163
 			if (isset($row['heading'])) {
144 164
 				$temp_array['heading'] = $row['heading'];
145 165
 				$heading_direction = $this->parseDirection($row['heading']);
146
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
166
+				if (isset($heading_direction[0]['direction_fullname'])) {
167
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
168
+				}
169
+			}
170
+			if (isset($row['ground_speed'])) {
171
+				$temp_array['ground_speed'] = $row['ground_speed'];
147 172
 			}
148
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
149 173
 			
150 174
 			if (isset($row['date'])) {
151 175
 				$dateArray = $this->parseDateString($row['date']);
@@ -188,13 +212,21 @@  discard block
 block discarded – undo
188 212
 			}
189 213
 			
190 214
 			$fromsource = NULL;
191
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
192
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
193
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
215
+			if (isset($row['source_name']) && $row['source_name'] != '') {
216
+				$temp_array['source_name'] = $row['source_name'];
217
+			}
218
+			if (isset($row['over_country']) && $row['over_country'] != '') {
219
+				$temp_array['over_country'] = $row['over_country'];
220
+			}
221
+			if (isset($row['distance']) && $row['distance'] != '') {
222
+				$temp_array['distance'] = $row['distance'];
223
+			}
194 224
 			$temp_array['query_number_rows'] = $num_rows;
195 225
 			$spotter_array[] = $temp_array;
196 226
 		}
197
-		if ($num_rows == 0) return array();
227
+		if ($num_rows == 0) {
228
+			return array();
229
+		}
198 230
 		$spotter_array[0]['query_number_rows'] = $num_rows;
199 231
 		return $spotter_array;
200 232
 	}	
@@ -225,8 +257,12 @@  discard block
 block discarded – undo
225 257
 			{
226 258
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
227 259
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
228
-			} else $limit_query = "";
229
-		} else $limit_query = "";
260
+			} else {
261
+				$limit_query = "";
262
+			}
263
+		} else {
264
+			$limit_query = "";
265
+		}
230 266
 		
231 267
 		if ($sort != "")
232 268
 		{
@@ -254,7 +290,9 @@  discard block
 block discarded – undo
254 290
 		global $global_query;
255 291
 		
256 292
 		date_default_timezone_set('UTC');
257
-		if ($id == '') return array();
293
+		if ($id == '') {
294
+			return array();
295
+		}
258 296
 		$additional_query = "tracker_output.famtrackid = :id";
259 297
 		$query_values = array(':id' => $id);
260 298
 		$query  = $global_query." WHERE ".$additional_query." ";
@@ -397,8 +435,11 @@  discard block
 block discarded – undo
397 435
 		$query .= " ORDER BY tracker_output.source_name ASC";
398 436
 
399 437
 		$sth = $this->db->prepare($query);
400
-		if (!empty($query_values)) $sth->execute($query_values);
401
-		else $sth->execute();
438
+		if (!empty($query_values)) {
439
+			$sth->execute($query_values);
440
+		} else {
441
+			$sth->execute();
442
+		}
402 443
 
403 444
 		$source_array = array();
404 445
 		$temp_array = array();
@@ -453,7 +494,9 @@  discard block
 block discarded – undo
453 494
 			date_default_timezone_set($globalTimezone);
454 495
 			$datetime = new DateTime();
455 496
 			$offset = $datetime->format('P');
456
-		} else $offset = '+00:00';
497
+		} else {
498
+			$offset = '+00:00';
499
+		}
457 500
 
458 501
 		if ($globalDBdriver == 'mysql') {
459 502
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date
@@ -609,7 +652,9 @@  discard block
 block discarded – undo
609 652
 			{
610 653
 				return false;
611 654
 			}
612
-		} else $altitude = 0;
655
+		} else {
656
+			$altitude = 0;
657
+		}
613 658
 		
614 659
 		if ($heading != "")
615 660
 		{
@@ -648,8 +693,12 @@  discard block
 block discarded – undo
648 693
             		$latitude = 0;
649 694
             		$longitude = 0;
650 695
             	}
651
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
652
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
696
+                if ($heading == '' || $Common->isInteger($heading) === false) {
697
+                	$heading = 0;
698
+                }
699
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
700
+                	$groundspeed = 0;
701
+                }
653 702
                 $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
654 703
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
655 704
 
@@ -758,7 +807,9 @@  discard block
 block discarded – undo
758 807
 		global $globalDBdriver, $globalArchive;
759 808
 		//$filter_query = $this->getFilter($filters,true,true);
760 809
 		$Connection= new Connection($this->db);
761
-		if (!$Connection->tableExists('countries')) return array();
810
+		if (!$Connection->tableExists('countries')) {
811
+			return array();
812
+		}
762 813
 		if (!isset($globalArchive) || $globalArchive !== TRUE) {
763 814
 			require_once('class.TrackerLive.php');
764 815
 			$TrackerLive = new TrackerLive($this->db);
@@ -801,7 +852,9 @@  discard block
 block discarded – undo
801 852
 			$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT famtrackid,over_country FROM tracker_archive".$filter_query.") l ON c.iso2 = l.over_country ";
802 853
 		}
803 854
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
804
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
855
+		if ($limit) {
856
+			$query .= " LIMIT 10 OFFSET 0";
857
+		}
805 858
       
806 859
 		
807 860
 		$sth = $this->db->prepare($query);
@@ -834,12 +887,18 @@  discard block
 block discarded – undo
834 887
 		$query  = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count 
835 888
                     FROM tracker_output".$filter_query." tracker_output.ident <> ''";
836 889
 		 if ($olderthanmonths > 0) {
837
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
838
-			else $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
890
+			if ($globalDBdriver == 'mysql') {
891
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
892
+			} else {
893
+				$query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
894
+			}
839 895
 		}
840 896
 		if ($sincedate != '') {
841
-			if ($globalDBdriver == 'mysql') $query .= " AND tracker_output.date > '".$sincedate."'";
842
-			else $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
897
+			if ($globalDBdriver == 'mysql') {
898
+				$query .= " AND tracker_output.date > '".$sincedate."'";
899
+			} else {
900
+				$query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
901
+			}
843 902
 		}
844 903
 		$query_values = array();
845 904
 		if ($year != '') {
@@ -870,7 +929,9 @@  discard block
 block discarded – undo
870 929
 			}
871 930
 		}
872 931
 		$query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC";
873
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
932
+		if ($limit) {
933
+			$query .= " LIMIT 10 OFFSET 0";
934
+		}
874 935
       		
875 936
 		$sth = $this->db->prepare($query);
876 937
 		$sth->execute($query_values);
@@ -905,7 +966,9 @@  discard block
 block discarded – undo
905 966
 			date_default_timezone_set($globalTimezone);
906 967
 			$datetime = new DateTime();
907 968
 			$offset = $datetime->format('P');
908
-		} else $offset = '+00:00';
969
+		} else {
970
+			$offset = '+00:00';
971
+		}
909 972
 
910 973
 		if ($globalDBdriver == 'mysql') {
911 974
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -955,7 +1018,9 @@  discard block
 block discarded – undo
955 1018
 			date_default_timezone_set($globalTimezone);
956 1019
 			$datetime = new DateTime();
957 1020
 			$offset = $datetime->format('P');
958
-		} else $offset = '+00:00';
1021
+		} else {
1022
+			$offset = '+00:00';
1023
+		}
959 1024
 		$filter_query = $this->getFilter($filters,true,true);
960 1025
 		if ($globalDBdriver == 'mysql') {
961 1026
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1001,7 +1066,9 @@  discard block
 block discarded – undo
1001 1066
 			date_default_timezone_set($globalTimezone);
1002 1067
 			$datetime = new DateTime();
1003 1068
 			$offset = $datetime->format('P');
1004
-		} else $offset = '+00:00';
1069
+		} else {
1070
+			$offset = '+00:00';
1071
+		}
1005 1072
 		$filter_query = $this->getFilter($filters,true,true);
1006 1073
 		if ($globalDBdriver == 'mysql') {
1007 1074
 			$query  = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1049,7 +1116,9 @@  discard block
 block discarded – undo
1049 1116
 			date_default_timezone_set($globalTimezone);
1050 1117
 			$datetime = new DateTime();
1051 1118
 			$offset = $datetime->format('P');
1052
-		} else $offset = '+00:00';
1119
+		} else {
1120
+			$offset = '+00:00';
1121
+		}
1053 1122
 
1054 1123
 		if ($globalDBdriver == 'mysql') {
1055 1124
 			$query  = "SELECT YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -1098,7 +1167,9 @@  discard block
 block discarded – undo
1098 1167
 			date_default_timezone_set($globalTimezone);
1099 1168
 			$datetime = new DateTime();
1100 1169
 			$offset = $datetime->format('P');
1101
-		} else $offset = '+00:00';
1170
+		} else {
1171
+			$offset = '+00:00';
1172
+		}
1102 1173
 		$filter_query = $this->getFilter($filters,true,true);
1103 1174
 		if ($globalDBdriver == 'mysql') {
1104 1175
 			$query  = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -1147,7 +1218,9 @@  discard block
 block discarded – undo
1147 1218
 			date_default_timezone_set($globalTimezone);
1148 1219
 			$datetime = new DateTime();
1149 1220
 			$offset = $datetime->format('P');
1150
-		} else $offset = '+00:00';
1221
+		} else {
1222
+			$offset = '+00:00';
1223
+		}
1151 1224
 
1152 1225
 		$orderby_sql = '';
1153 1226
 		if ($orderby == "hour")
@@ -1216,7 +1289,9 @@  discard block
 block discarded – undo
1216 1289
 			date_default_timezone_set($globalTimezone);
1217 1290
 			$datetime = new DateTime($date);
1218 1291
 			$offset = $datetime->format('P');
1219
-		} else $offset = '+00:00';
1292
+		} else {
1293
+			$offset = '+00:00';
1294
+		}
1220 1295
 
1221 1296
 		if ($globalDBdriver == 'mysql') {
1222 1297
 			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1264,7 +1339,9 @@  discard block
 block discarded – undo
1264 1339
 			date_default_timezone_set($globalTimezone);
1265 1340
 			$datetime = new DateTime();
1266 1341
 			$offset = $datetime->format('P');
1267
-		} else $offset = '+00:00';
1342
+		} else {
1343
+			$offset = '+00:00';
1344
+		}
1268 1345
 
1269 1346
 		if ($globalDBdriver == 'mysql') {
1270 1347
 			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1329,8 +1406,11 @@  discard block
 block discarded – undo
1329 1406
 				$query_values = array_merge($query_values,array(':month' => $month));
1330 1407
 			}
1331 1408
 		}
1332
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1333
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1409
+		if (empty($query_values)) {
1410
+			$queryi .= $this->getFilter($filters);
1411
+		} else {
1412
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
1413
+		}
1334 1414
 		
1335 1415
 		$sth = $this->db->prepare($queryi);
1336 1416
 		$sth->execute($query_values);
@@ -1367,8 +1447,11 @@  discard block
 block discarded – undo
1367 1447
 				$query_values = array_merge($query_values,array(':month' => $month));
1368 1448
 			}
1369 1449
 		}
1370
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1371
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1450
+		if (empty($query_values)) {
1451
+			$queryi .= $this->getFilter($filters);
1452
+		} else {
1453
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
1454
+		}
1372 1455
 		
1373 1456
 		$sth = $this->db->prepare($queryi);
1374 1457
 		$sth->execute($query_values);
@@ -1390,7 +1473,9 @@  discard block
 block discarded – undo
1390 1473
 			date_default_timezone_set($globalTimezone);
1391 1474
 			$datetime = new DateTime();
1392 1475
 			$offset = $datetime->format('P');
1393
-		} else $offset = '+00:00';
1476
+		} else {
1477
+			$offset = '+00:00';
1478
+		}
1394 1479
 
1395 1480
 		if ($globalDBdriver == 'mysql') {
1396 1481
 			$query  = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1494,7 +1579,9 @@  discard block
 block discarded – undo
1494 1579
 	*/
1495 1580
 	public function parseDirection($direction = 0)
1496 1581
 	{
1497
-		if ($direction == '') $direction = 0;
1582
+		if ($direction == '') {
1583
+			$direction = 0;
1584
+		}
1498 1585
 		$direction_array = array();
1499 1586
 		$temp_array = array();
1500 1587
 
@@ -1583,7 +1670,9 @@  discard block
 block discarded – undo
1583 1670
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1584 1671
 	
1585 1672
 		$Connection = new Connection($this->db);
1586
-		if (!$Connection->tableExists('countries')) return '';
1673
+		if (!$Connection->tableExists('countries')) {
1674
+			return '';
1675
+		}
1587 1676
 	
1588 1677
 		try {
1589 1678
 			/*
@@ -1603,9 +1692,13 @@  discard block
 block discarded – undo
1603 1692
 			$sth->closeCursor();
1604 1693
 			if (count($row) > 0) {
1605 1694
 				return $row;
1606
-			} else return '';
1695
+			} else {
1696
+				return '';
1697
+			}
1607 1698
 		} catch (PDOException $e) {
1608
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1699
+			if (isset($globalDebug) && $globalDebug) {
1700
+				echo 'Error : '.$e->getMessage()."\n";
1701
+			}
1609 1702
 			return '';
1610 1703
 		}
1611 1704
 	
@@ -1623,7 +1716,9 @@  discard block
 block discarded – undo
1623 1716
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1624 1717
 	
1625 1718
 		$Connection = new Connection($this->db);
1626
-		if (!$Connection->tableExists('countries')) return '';
1719
+		if (!$Connection->tableExists('countries')) {
1720
+			return '';
1721
+		}
1627 1722
 	
1628 1723
 		try {
1629 1724
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -1635,9 +1730,13 @@  discard block
 block discarded – undo
1635 1730
 			$sth->closeCursor();
1636 1731
 			if (count($row) > 0) {
1637 1732
 				return $row;
1638
-			} else return '';
1733
+			} else {
1734
+				return '';
1735
+			}
1639 1736
 		} catch (PDOException $e) {
1640
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1737
+			if (isset($globalDebug) && $globalDebug) {
1738
+				echo 'Error : '.$e->getMessage()."\n";
1739
+			}
1641 1740
 			return '';
1642 1741
 		}
1643 1742
 	
@@ -1698,7 +1797,9 @@  discard block
 block discarded – undo
1698 1797
 			}
1699 1798
 		}
1700 1799
 		$query .= " GROUP BY tracker_output.type ORDER BY tracker_type_count DESC";
1701
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
1800
+		if ($limit) {
1801
+			$query .= " LIMIT 10 OFFSET 0";
1802
+		}
1702 1803
 		$sth = $this->db->prepare($query);
1703 1804
 		$sth->execute($query_values);
1704 1805
 		$tracker_array = array();
@@ -1725,7 +1826,9 @@  discard block
 block discarded – undo
1725 1826
 	{
1726 1827
 		global $globalBitlyAccessToken;
1727 1828
 		
1728
-		if ($globalBitlyAccessToken == '') return $url;
1829
+		if ($globalBitlyAccessToken == '') {
1830
+			return $url;
1831
+		}
1729 1832
         
1730 1833
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
1731 1834
 		
Please login to merge, or discard this patch.
require/class.TrackerLive.php 4 patches
Doc Comments   +1 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -759,10 +759,6 @@  discard block
 block discarded – undo
759 759
 	*
760 760
 	* @param String $famtrackid the ID from flightaware
761 761
 	* @param String $ident the flight ident
762
-	* @param String $aircraft_icao the aircraft type
763
-	* @param String $departure_airport_icao the departure airport
764
-	* @param String $arrival_airport_icao the arrival airport
765
-	* @return String success or false
766 762
 	*
767 763
 	*/
768 764
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
Please login to merge, or discard this patch.
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 	}
88 88
 
89 89
 	/**
90
-	* Gets all the spotter information based on the latest data entry
91
-	*
92
-	* @return Array the spotter information
93
-	*
94
-	*/
90
+	 * Gets all the spotter information based on the latest data entry
91
+	 *
92
+	 * @return Array the spotter information
93
+	 *
94
+	 */
95 95
 	public function getLiveTrackerData($limit = '', $sort = '', $filter = array())
96 96
 	{
97 97
 		global $globalDBdriver, $globalLiveInterval;
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 	}
134 134
 
135 135
 	/**
136
-	* Gets Minimal Live Spotter data
137
-	*
138
-	* @return Array the spotter information
139
-	*
140
-	*/
136
+	 * Gets Minimal Live Spotter data
137
+	 *
138
+	 * @return Array the spotter information
139
+	 *
140
+	 */
141 141
 	public function getMinLiveTrackerData($filter = array())
142 142
 	{
143 143
 		global $globalDBdriver, $globalLiveInterval;
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 	/**
174
-	* Gets Minimal Live Spotter data since xx seconds
175
-	*
176
-	* @return Array the spotter information
177
-	*
178
-	*/
174
+	 * Gets Minimal Live Spotter data since xx seconds
175
+	 *
176
+	 * @return Array the spotter information
177
+	 *
178
+	 */
179 179
 	public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false)
180 180
 	{
181 181
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit;
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 	}
248 248
 
249 249
 	/**
250
-	* Gets number of latest data entry
251
-	*
252
-	* @return String number of entry
253
-	*
254
-	*/
250
+	 * Gets number of latest data entry
251
+	 *
252
+	 * @return String number of entry
253
+	 *
254
+	 */
255 255
 	public function getLiveTrackerCount($filter = array())
256 256
 	{
257 257
 		global $globalDBdriver, $globalLiveInterval;
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	}
277 277
 
278 278
 	/**
279
-	* Gets all the spotter information based on the latest data entry and coord
280
-	*
281
-	* @return Array the spotter information
282
-	*
283
-	*/
279
+	 * Gets all the spotter information based on the latest data entry and coord
280
+	 *
281
+	 * @return Array the spotter information
282
+	 *
283
+	 */
284 284
 	public function getLiveTrackerDatabyCoord($coord, $filter = array())
285 285
 	{
286 286
 		global $globalDBdriver, $globalLiveInterval;
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
 	}
305 305
 
306 306
 	/**
307
-	* Gets all the spotter information based on the latest data entry and coord
308
-	*
309
-	* @return Array the spotter information
310
-	*
311
-	*/
307
+	 * Gets all the spotter information based on the latest data entry and coord
308
+	 *
309
+	 * @return Array the spotter information
310
+	 *
311
+	 */
312 312
 	public function getMinLiveTrackerDatabyCoord($coord, $filter = array())
313 313
 	{
314 314
 		global $globalDBdriver, $globalLiveInterval;
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	}
336 336
 
337 337
 	/**
338
-	* Gets all the spotter information based on a user's latitude and longitude
339
-	*
340
-	* @return Array the spotter information
341
-	*
342
-	*/
338
+	 * Gets all the spotter information based on a user's latitude and longitude
339
+	 *
340
+	 * @return Array the spotter information
341
+	 *
342
+	 */
343 343
 	public function getLatestTrackerForLayar($lat, $lng, $radius, $interval)
344 344
 	{
345 345
 		$Tracker = new Tracker($this->db);
@@ -352,142 +352,142 @@  discard block
 block discarded – undo
352 352
 		if ($lng != '')
353 353
 		{
354 354
 			if (!is_numeric($lng))
355
-                        {
356
-                                return false;
357
-                        }
358
-                }
359
-
360
-                if ($radius != '')
361
-                {
362
-                        if (!is_numeric($radius))
363
-                        {
364
-                                return false;
365
-                        }
366
-                }
355
+						{
356
+								return false;
357
+						}
358
+				}
359
+
360
+				if ($radius != '')
361
+				{
362
+						if (!is_numeric($radius))
363
+						{
364
+								return false;
365
+						}
366
+				}
367 367
 		$additional_query = '';
368 368
 		if ($interval != '')
369
-                {
370
-                        if (!is_string($interval))
371
-                        {
372
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
373
-			        return false;
374
-                        } else {
375
-                if ($interval == '1m')
376
-                {
377
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
378
-                } else if ($interval == '15m'){
379
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
380
-                } 
381
-            }
382
-                } else {
383
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
384
-        }
385
-
386
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
369
+				{
370
+						if (!is_string($interval))
371
+						{
372
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
373
+					return false;
374
+						} else {
375
+				if ($interval == '1m')
376
+				{
377
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
378
+				} else if ($interval == '15m'){
379
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
380
+				} 
381
+			}
382
+				} else {
383
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
384
+		}
385
+
386
+				$query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
387 387
                    WHERE tracker_live.latitude <> '' 
388 388
                                    AND tracker_live.longitude <> '' 
389 389
                    ".$additional_query."
390 390
                    HAVING distance < :radius  
391 391
                                    ORDER BY distance";
392 392
 
393
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
393
+				$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
394 394
 
395
-                return $spotter_array;
396
-        }
395
+				return $spotter_array;
396
+		}
397 397
 
398 398
     
399
-        /**
400
-	* Gets all the spotter information based on a particular callsign
401
-	*
402
-	* @return Array the spotter information
403
-	*
404
-	*/
399
+		/**
400
+		 * Gets all the spotter information based on a particular callsign
401
+		 *
402
+		 * @return Array the spotter information
403
+		 *
404
+		 */
405 405
 	public function getLastLiveTrackerDataByIdent($ident)
406 406
 	{
407 407
 		$Tracker = new Tracker($this->db);
408 408
 		date_default_timezone_set('UTC');
409 409
 
410 410
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
411
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
411
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
412 412
 
413 413
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
414 414
 
415 415
 		return $spotter_array;
416 416
 	}
417 417
 
418
-        /**
419
-	* Gets all the spotter information based on a particular callsign
420
-	*
421
-	* @return Array the spotter information
422
-	*
423
-	*/
418
+		/**
419
+		 * Gets all the spotter information based on a particular callsign
420
+		 *
421
+		 * @return Array the spotter information
422
+		 *
423
+		 */
424 424
 	public function getDateLiveTrackerDataByIdent($ident,$date)
425 425
 	{
426 426
 		$Tracker = new Tracker($this->db);
427 427
 		date_default_timezone_set('UTC');
428 428
 
429 429
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
430
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
430
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
431 431
 
432
-                $date = date('c',$date);
432
+				$date = date('c',$date);
433 433
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
434 434
 
435 435
 		return $spotter_array;
436 436
 	}
437 437
 
438
-        /**
439
-	* Gets last spotter information based on a particular callsign
440
-	*
441
-	* @return Array the spotter information
442
-	*
443
-	*/
438
+		/**
439
+		 * Gets last spotter information based on a particular callsign
440
+		 *
441
+		 * @return Array the spotter information
442
+		 *
443
+		 */
444 444
 	public function getLastLiveTrackerDataById($id)
445 445
 	{
446 446
 		$Tracker = new Tracker($this->db);
447 447
 		date_default_timezone_set('UTC');
448 448
 
449 449
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
450
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
450
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
451 451
 
452 452
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
453 453
 
454 454
 		return $spotter_array;
455 455
 	}
456 456
 
457
-        /**
458
-	* Gets last spotter information based on a particular callsign
459
-	*
460
-	* @return Array the spotter information
461
-	*
462
-	*/
457
+		/**
458
+		 * Gets last spotter information based on a particular callsign
459
+		 *
460
+		 * @return Array the spotter information
461
+		 *
462
+		 */
463 463
 	public function getDateLiveTrackerDataById($id,$date)
464 464
 	{
465 465
 		$Tracker = new Tracker($this->db);
466 466
 		date_default_timezone_set('UTC');
467 467
 
468 468
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
469
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
470
-                $date = date('c',$date);
469
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
470
+				$date = date('c',$date);
471 471
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
472 472
 
473 473
 		return $spotter_array;
474 474
 	}
475 475
 
476
-        /**
477
-	* Gets altitude information based on a particular callsign
478
-	*
479
-	* @return Array the spotter information
480
-	*
481
-	*/
476
+		/**
477
+		 * Gets altitude information based on a particular callsign
478
+		 *
479
+		 * @return Array the spotter information
480
+		 *
481
+		 */
482 482
 	public function getAltitudeLiveTrackerDataByIdent($ident)
483 483
 	{
484 484
 
485 485
 		date_default_timezone_set('UTC');
486 486
 
487 487
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
488
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
488
+				$query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
489 489
 
490
-    		try {
490
+			try {
491 491
 			
492 492
 			$sth = $this->db->prepare($query);
493 493
 			$sth->execute(array(':ident' => $ident));
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
 		return $spotter_array;
501 501
 	}
502 502
 
503
-        /**
504
-	* Gets all the spotter information based on a particular id
505
-	*
506
-	* @return Array the spotter information
507
-	*
508
-	*/
503
+		/**
504
+		 * Gets all the spotter information based on a particular id
505
+		 *
506
+		 * @return Array the spotter information
507
+		 *
508
+		 */
509 509
 	public function getAllLiveTrackerDataById($id,$liveinterval = false)
510 510
 	{
511 511
 		global $globalDBdriver, $globalLiveInterval;
@@ -533,18 +533,18 @@  discard block
 block discarded – undo
533 533
 		return $spotter_array;
534 534
 	}
535 535
 
536
-        /**
537
-	* Gets all the spotter information based on a particular ident
538
-	*
539
-	* @return Array the spotter information
540
-	*
541
-	*/
536
+		/**
537
+		 * Gets all the spotter information based on a particular ident
538
+		 *
539
+		 * @return Array the spotter information
540
+		 *
541
+		 */
542 542
 	public function getAllLiveTrackerDataByIdent($ident)
543 543
 	{
544 544
 		date_default_timezone_set('UTC');
545 545
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
546 546
 		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
547
-    		try {
547
+			try {
548 548
 			
549 549
 			$sth = $this->db->prepare($query);
550 550
 			$sth->execute(array(':ident' => $ident));
@@ -558,23 +558,23 @@  discard block
 block discarded – undo
558 558
 
559 559
 
560 560
 	/**
561
-	* Deletes all info in the table
562
-	*
563
-	* @return String success or false
564
-	*
565
-	*/
561
+	 * Deletes all info in the table
562
+	 *
563
+	 * @return String success or false
564
+	 *
565
+	 */
566 566
 	public function deleteLiveTrackerData()
567 567
 	{
568 568
 		global $globalDBdriver;
569 569
 		if ($globalDBdriver == 'mysql') {
570 570
 			//$query  = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date";
571 571
 			$query  = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date';
572
-            		//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
572
+					//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
573 573
 		} else {
574 574
 			$query  = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date";
575 575
 		}
576 576
         
577
-    		try {
577
+			try {
578 578
 			
579 579
 			$sth = $this->db->prepare($query);
580 580
 			$sth->execute();
@@ -586,18 +586,18 @@  discard block
 block discarded – undo
586 586
 	}
587 587
 
588 588
 	/**
589
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
590
-	*
591
-	* @return String success or false
592
-	*
593
-	*/
589
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
590
+	 *
591
+	 * @return String success or false
592
+	 *
593
+	 */
594 594
 	public function deleteLiveTrackerDataNotUpdated()
595 595
 	{
596 596
 		global $globalDBdriver, $globalDebug;
597 597
 		if ($globalDBdriver == 'mysql') {
598 598
 			//$query = 'SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < tracker_live.date) LIMIT 800 OFFSET 0';
599
-    			$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
600
-    			try {
599
+				$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
600
+				try {
601 601
 				
602 602
 				$sth = $this->db->prepare($query);
603 603
 				$sth->execute();
@@ -605,8 +605,8 @@  discard block
 block discarded – undo
605 605
 				return "error";
606 606
 			}
607 607
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
608
-                        $i = 0;
609
-                        $j =0;
608
+						$i = 0;
609
+						$j =0;
610 610
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
611 611
 			foreach($all as $row)
612 612
 			{
@@ -614,20 +614,20 @@  discard block
 block discarded – undo
614 614
 				$j++;
615 615
 				if ($j == 30) {
616 616
 					if ($globalDebug) echo ".";
617
-				    	try {
617
+						try {
618 618
 						
619 619
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
620 620
 						$sth->execute();
621 621
 					} catch(PDOException $e) {
622 622
 						return "error";
623 623
 					}
624
-                                	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
625
-                                	$j = 0;
624
+									$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
625
+									$j = 0;
626 626
 				}
627 627
 				$query_delete .= "'".$row['famtrackid']."',";
628 628
 			}
629 629
 			if ($i > 0) {
630
-    				try {
630
+					try {
631 631
 					
632 632
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
633 633
 					$sth->execute();
@@ -638,9 +638,9 @@  discard block
 block discarded – undo
638 638
 			return "success";
639 639
 		} elseif ($globalDBdriver == 'pgsql') {
640 640
 			//$query = "SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < tracker_live.date) LIMIT 800 OFFSET 0";
641
-    			//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
642
-    			$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
643
-    			try {
641
+				//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
642
+				$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
643
+				try {
644 644
 				
645 645
 				$sth = $this->db->prepare($query);
646 646
 				$sth->execute();
@@ -684,17 +684,17 @@  discard block
 block discarded – undo
684 684
 	}
685 685
 
686 686
 	/**
687
-	* Deletes all info in the table for an ident
688
-	*
689
-	* @return String success or false
690
-	*
691
-	*/
687
+	 * Deletes all info in the table for an ident
688
+	 *
689
+	 * @return String success or false
690
+	 *
691
+	 */
692 692
 	public function deleteLiveTrackerDataByIdent($ident)
693 693
 	{
694 694
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
695 695
 		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
696 696
         
697
-    		try {
697
+			try {
698 698
 			
699 699
 			$sth = $this->db->prepare($query);
700 700
 			$sth->execute(array(':ident' => $ident));
@@ -706,17 +706,17 @@  discard block
 block discarded – undo
706 706
 	}
707 707
 
708 708
 	/**
709
-	* Deletes all info in the table for an id
710
-	*
711
-	* @return String success or false
712
-	*
713
-	*/
709
+	 * Deletes all info in the table for an id
710
+	 *
711
+	 * @return String success or false
712
+	 *
713
+	 */
714 714
 	public function deleteLiveTrackerDataById($id)
715 715
 	{
716 716
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
717 717
 		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
718 718
         
719
-    		try {
719
+			try {
720 720
 			
721 721
 			$sth = $this->db->prepare($query);
722 722
 			$sth->execute(array(':id' => $id));
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
 
730 730
 
731 731
 	/**
732
-	* Gets the aircraft ident within the last hour
733
-	*
734
-	* @return String the ident
735
-	*
736
-	*/
732
+	 * Gets the aircraft ident within the last hour
733
+	 *
734
+	 * @return String the ident
735
+	 *
736
+	 */
737 737
 	public function getIdentFromLastHour($ident)
738 738
 	{
739 739
 		global $globalDBdriver, $globalTimezone;
@@ -759,14 +759,14 @@  discard block
 block discarded – undo
759 759
 			$ident_result = $row['ident'];
760 760
 		}
761 761
 		return $ident_result;
762
-        }
762
+		}
763 763
 
764 764
 	/**
765
-	* Check recent aircraft
766
-	*
767
-	* @return String the ident
768
-	*
769
-	*/
765
+	 * Check recent aircraft
766
+	 *
767
+	 * @return String the ident
768
+	 *
769
+	 */
770 770
 	public function checkIdentRecent($ident)
771 771
 	{
772 772
 		global $globalDBdriver, $globalTimezone;
@@ -792,14 +792,14 @@  discard block
 block discarded – undo
792 792
 			$ident_result = $row['famtrackid'];
793 793
 		}
794 794
 		return $ident_result;
795
-        }
795
+		}
796 796
 
797 797
 	/**
798
-	* Check recent aircraft by id
799
-	*
800
-	* @return String the ident
801
-	*
802
-	*/
798
+	 * Check recent aircraft by id
799
+	 *
800
+	 * @return String the ident
801
+	 *
802
+	 */
803 803
 	public function checkIdRecent($id)
804 804
 	{
805 805
 		global $globalDBdriver, $globalTimezone;
@@ -825,19 +825,19 @@  discard block
 block discarded – undo
825 825
 			$ident_result = $row['famtrackid'];
826 826
 		}
827 827
 		return $ident_result;
828
-        }
828
+		}
829 829
 
830 830
 	/**
831
-	* Adds a new spotter data
832
-	*
833
-	* @param String $famtrackid the ID from flightaware
834
-	* @param String $ident the flight ident
835
-	* @param String $aircraft_icao the aircraft type
836
-	* @param String $departure_airport_icao the departure airport
837
-	* @param String $arrival_airport_icao the arrival airport
838
-	* @return String success or false
839
-	*
840
-	*/
831
+	 * Adds a new spotter data
832
+	 *
833
+	 * @param String $famtrackid the ID from flightaware
834
+	 * @param String $ident the flight ident
835
+	 * @param String $aircraft_icao the aircraft type
836
+	 * @param String $departure_airport_icao the departure airport
837
+	 * @param String $arrival_airport_icao the arrival airport
838
+	 * @return String success or false
839
+	 *
840
+	 */
841 841
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
842 842
 	{
843 843
 		global $globalURL, $globalArchive, $globalDebug;
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
911 911
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
912 912
 
913
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
914
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
913
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
914
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
915 915
             	
916 916
 		$query = '';
917 917
 		if ($globalArchive) {
@@ -926,18 +926,18 @@  discard block
 block discarded – undo
926 926
 			
927 927
 			$sth = $this->db->prepare($query);
928 928
 			$sth->execute($query_values);
929
-                } catch(PDOException $e) {
930
-                	return "error : ".$e->getMessage();
931
-                }
932
-                /*
929
+				} catch(PDOException $e) {
930
+					return "error : ".$e->getMessage();
931
+				}
932
+				/*
933 933
                 echo 'putinarchive : '.$putinarchive."\n";
934 934
                 echo 'noarchive : '.$noarchive."\n";
935 935
                 */
936 936
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
937
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
938
-		    $TrackerArchive = new TrackerArchive($this->db);
939
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
940
-		    if ($globalDebug) echo $result.')';
937
+			if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
938
+			$TrackerArchive = new TrackerArchive($this->db);
939
+			$result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
940
+			if ($globalDebug) echo $result.')';
941 941
 		}
942 942
 
943 943
 		return "success";
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
38 38
 				if (isset($flt['source'])) {
39
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
39
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
40 40
 				} else {
41
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
41
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
42 42
 				}
43 43
 			}
44 44
 		}
45 45
 		if (isset($filter['source']) && !empty($filter['source'])) {
46
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
46
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
47 47
 		}
48 48
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
49 49
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 					$filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'";
73 73
 				}
74 74
 			}
75
-			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
75
+			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
76 76
 		}
77 77
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
78
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
78
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
79 79
 		}
80 80
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
81 81
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
82 82
 		if ($filter_query_where != '') {
83
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
83
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
84 84
 		}
85 85
 		$filter_query = $filter_query_join.$filter_query_where;
86 86
 		return $filter_query;
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 		if ($limit != '')
104 104
 		{
105 105
 			$limit_array = explode(',', $limit);
106
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
107
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
106
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
107
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
108 108
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
109 109
 			{
110 110
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 		} else {
128 128
 			$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query;
129 129
 		}
130
-		$spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true);
130
+		$spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true);
131 131
 
132 132
 		return $spotter_array;
133 133
 	}
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		global $globalDBdriver, $globalLiveInterval;
144 144
 		date_default_timezone_set('UTC');
145 145
 
146
-		$filter_query = $this->getFilter($filter,true,true);
146
+		$filter_query = $this->getFilter($filter, true, true);
147 147
 
148 148
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
149 149
 		if ($globalDBdriver == 'mysql') {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		try {
162 162
 			$sth = $this->db->prepare($query);
163 163
 			$sth->execute();
164
-		} catch(PDOException $e) {
164
+		} catch (PDOException $e) {
165 165
 			echo $e->getMessage();
166 166
 			die;
167 167
 		}
@@ -176,25 +176,25 @@  discard block
 block discarded – undo
176 176
 	* @return Array the spotter information
177 177
 	*
178 178
 	*/
179
-	public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false)
179
+	public function getMinLastLiveTrackerData($coord, $filter = array(), $limit = false)
180 180
 	{
181 181
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit;
182 182
 		date_default_timezone_set('UTC');
183 183
 		$usecoord = false;
184 184
 		if (is_array($coord) && !empty($coord)) {
185
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
186
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
187
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
188
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
185
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
186
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
187
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
188
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
189 189
 			$usecoord = true;
190 190
 		}
191
-		$filter_query = $this->getFilter($filter,true,true);
191
+		$filter_query = $this->getFilter($filter, true, true);
192 192
 
193 193
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194 194
 		if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300';
195 195
 		if ($globalDBdriver == 'mysql') {
196 196
 			if (isset($globalArchive) && $globalArchive) {
197
-				$query  = "SELECT * FROM (
197
+				$query = "SELECT * FROM (
198 198
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
199 199
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid ";
200 200
 				if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 			}
217 217
 		} else {
218 218
 			if (isset($globalArchive) && $globalArchive) {
219
-				$query  = "SELECT * FROM (
219
+				$query = "SELECT * FROM (
220 220
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
221 221
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid ";
222 222
 				if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 		try {
241 241
 			$sth = $this->db->prepare($query);
242 242
 			$sth->execute();
243
-		} catch(PDOException $e) {
243
+		} catch (PDOException $e) {
244 244
 			echo $e->getMessage();
245 245
 			die;
246 246
 		}
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 	public function getLiveTrackerCount($filter = array())
258 258
 	{
259 259
 		global $globalDBdriver, $globalLiveInterval;
260
-		$filter_query = $this->getFilter($filter,true,true);
260
+		$filter_query = $this->getFilter($filter, true, true);
261 261
 
262 262
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
263 263
 		if ($globalDBdriver == 'mysql') {
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 		try {
269 269
 			$sth = $this->db->prepare($query);
270 270
 			$sth->execute();
271
-		} catch(PDOException $e) {
271
+		} catch (PDOException $e) {
272 272
 			echo $e->getMessage();
273 273
 			die;
274 274
 		}
@@ -291,10 +291,10 @@  discard block
 block discarded – undo
291 291
 		$filter_query = $this->getFilter($filter);
292 292
 
293 293
 		if (is_array($coord)) {
294
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
295
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
296
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
297
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
294
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
295
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
296
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
297
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
298 298
 		} else return array();
299 299
 		if ($globalDBdriver == 'mysql') {
300 300
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
@@ -319,17 +319,17 @@  discard block
 block discarded – undo
319 319
 		$filter_query = $this->getFilter($filter);
320 320
 
321 321
 		if (is_array($coord)) {
322
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
323
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
324
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
325
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
322
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
323
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
324
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
325
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
326 326
 		} else return array();
327 327
 		if ($globalDBdriver == 'mysql') {
328 328
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
329 329
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
330 330
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
331 331
 		} else {
332
-			$query  = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
332
+			$query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
333 333
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date l.latitude BETWEEN ".$minlat." AND ".$maxlat." AND l.longitude BETWEEN ".$minlong." AND ".$maxlong." GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query." tracker_live.latitude <> '0' AND tracker_live.longitude <> '0'";
334 334
 		}
335 335
 		$spotter_array = $Spotter->getDataFromDB($query);
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
                 if ($interval == '1m')
378 378
                 {
379 379
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
380
-                } else if ($interval == '15m'){
380
+                } else if ($interval == '15m') {
381 381
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
382 382
                 } 
383 383
             }
@@ -385,14 +385,14 @@  discard block
 block discarded – undo
385 385
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
386 386
         }
387 387
 
388
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
388
+                $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
389 389
                    WHERE tracker_live.latitude <> '' 
390 390
                                    AND tracker_live.longitude <> '' 
391 391
                    ".$additional_query."
392 392
                    HAVING distance < :radius  
393 393
                                    ORDER BY distance";
394 394
 
395
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
395
+                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
396 396
 
397 397
                 return $spotter_array;
398 398
         }
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
 		date_default_timezone_set('UTC');
411 411
 
412 412
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
413
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
413
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
414 414
 
415
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
415
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true);
416 416
 
417 417
 		return $spotter_array;
418 418
 	}
@@ -423,16 +423,16 @@  discard block
 block discarded – undo
423 423
 	* @return Array the spotter information
424 424
 	*
425 425
 	*/
426
-	public function getDateLiveTrackerDataByIdent($ident,$date)
426
+	public function getDateLiveTrackerDataByIdent($ident, $date)
427 427
 	{
428 428
 		$Tracker = new Tracker($this->db);
429 429
 		date_default_timezone_set('UTC');
430 430
 
431 431
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
432
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
432
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
433 433
 
434
-                $date = date('c',$date);
435
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
434
+                $date = date('c', $date);
435
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
436 436
 
437 437
 		return $spotter_array;
438 438
 	}
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
452
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
452
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
453 453
 
454
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
454
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
@@ -462,15 +462,15 @@  discard block
 block discarded – undo
462 462
 	* @return Array the spotter information
463 463
 	*
464 464
 	*/
465
-	public function getDateLiveTrackerDataById($id,$date)
465
+	public function getDateLiveTrackerDataById($id, $date)
466 466
 	{
467 467
 		$Tracker = new Tracker($this->db);
468 468
 		date_default_timezone_set('UTC');
469 469
 
470 470
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
471
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
472
-                $date = date('c',$date);
473
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
471
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
472
+                $date = date('c', $date);
473
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
474 474
 
475 475
 		return $spotter_array;
476 476
 	}
@@ -487,13 +487,13 @@  discard block
 block discarded – undo
487 487
 		date_default_timezone_set('UTC');
488 488
 
489 489
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
490
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
490
+                $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
491 491
 
492 492
     		try {
493 493
 			
494 494
 			$sth = $this->db->prepare($query);
495 495
 			$sth->execute(array(':ident' => $ident));
496
-		} catch(PDOException $e) {
496
+		} catch (PDOException $e) {
497 497
 			echo $e->getMessage();
498 498
 			die;
499 499
 		}
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	* @return Array the spotter information
509 509
 	*
510 510
 	*/
511
-	public function getAllLiveTrackerDataById($id,$liveinterval = false)
511
+	public function getAllLiveTrackerDataById($id, $liveinterval = false)
512 512
 	{
513 513
 		global $globalDBdriver, $globalLiveInterval;
514 514
 		date_default_timezone_set('UTC');
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
 		try {
528 528
 			$sth = $this->db->prepare($query);
529 529
 			$sth->execute(array(':id' => $id));
530
-		} catch(PDOException $e) {
530
+		} catch (PDOException $e) {
531 531
 			echo $e->getMessage();
532 532
 			die;
533 533
 		}
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
 	{
546 546
 		date_default_timezone_set('UTC');
547 547
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
548
-		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
548
+		$query = self::$global_query.' WHERE tracker_live.ident = :ident';
549 549
     		try {
550 550
 			
551 551
 			$sth = $this->db->prepare($query);
552 552
 			$sth->execute(array(':ident' => $ident));
553
-		} catch(PDOException $e) {
553
+		} catch (PDOException $e) {
554 554
 			echo $e->getMessage();
555 555
 			die;
556 556
 		}
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 			
581 581
 			$sth = $this->db->prepare($query);
582 582
 			$sth->execute();
583
-		} catch(PDOException $e) {
583
+		} catch (PDOException $e) {
584 584
 			return "error";
585 585
 		}
586 586
 
@@ -603,14 +603,14 @@  discard block
 block discarded – undo
603 603
 				
604 604
 				$sth = $this->db->prepare($query);
605 605
 				$sth->execute();
606
-			} catch(PDOException $e) {
606
+			} catch (PDOException $e) {
607 607
 				return "error";
608 608
 			}
609 609
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
610 610
                         $i = 0;
611
-                        $j =0;
611
+                        $j = 0;
612 612
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
613
-			foreach($all as $row)
613
+			foreach ($all as $row)
614 614
 			{
615 615
 				$i++;
616 616
 				$j++;
@@ -618,9 +618,9 @@  discard block
 block discarded – undo
618 618
 					if ($globalDebug) echo ".";
619 619
 				    	try {
620 620
 						
621
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
621
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
622 622
 						$sth->execute();
623
-					} catch(PDOException $e) {
623
+					} catch (PDOException $e) {
624 624
 						return "error";
625 625
 					}
626 626
                                 	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
@@ -631,9 +631,9 @@  discard block
 block discarded – undo
631 631
 			if ($i > 0) {
632 632
     				try {
633 633
 					
634
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
634
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
635 635
 					$sth->execute();
636
-				} catch(PDOException $e) {
636
+				} catch (PDOException $e) {
637 637
 					return "error";
638 638
 				}
639 639
 			}
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
 				
647 647
 				$sth = $this->db->prepare($query);
648 648
 				$sth->execute();
649
-			} catch(PDOException $e) {
649
+			} catch (PDOException $e) {
650 650
 				return "error";
651 651
 			}
652 652
 /*			$query_delete = "DELETE FROM tracker_live WHERE famtrackid IN (";
@@ -694,13 +694,13 @@  discard block
 block discarded – undo
694 694
 	public function deleteLiveTrackerDataByIdent($ident)
695 695
 	{
696 696
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
697
-		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
697
+		$query = 'DELETE FROM tracker_live WHERE ident = :ident';
698 698
         
699 699
     		try {
700 700
 			
701 701
 			$sth = $this->db->prepare($query);
702 702
 			$sth->execute(array(':ident' => $ident));
703
-		} catch(PDOException $e) {
703
+		} catch (PDOException $e) {
704 704
 			return "error";
705 705
 		}
706 706
 
@@ -716,13 +716,13 @@  discard block
 block discarded – undo
716 716
 	public function deleteLiveTrackerDataById($id)
717 717
 	{
718 718
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
719
-		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
719
+		$query = 'DELETE FROM tracker_live WHERE famtrackid = :id';
720 720
         
721 721
     		try {
722 722
 			
723 723
 			$sth = $this->db->prepare($query);
724 724
 			$sth->execute(array(':id' => $id));
725
-		} catch(PDOException $e) {
725
+		} catch (PDOException $e) {
726 726
 			return "error";
727 727
 		}
728 728
 
@@ -740,13 +740,13 @@  discard block
 block discarded – undo
740 740
 	{
741 741
 		global $globalDBdriver, $globalTimezone;
742 742
 		if ($globalDBdriver == 'mysql') {
743
-			$query  = 'SELECT tracker_live.ident FROM tracker_live 
743
+			$query = 'SELECT tracker_live.ident FROM tracker_live 
744 744
 				WHERE tracker_live.ident = :ident 
745 745
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
746 746
 				AND tracker_live.date < UTC_TIMESTAMP()';
747 747
 			$query_data = array(':ident' => $ident);
748 748
 		} else {
749
-			$query  = "SELECT tracker_live.ident FROM tracker_live 
749
+			$query = "SELECT tracker_live.ident FROM tracker_live 
750 750
 				WHERE tracker_live.ident = :ident 
751 751
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
752 752
 				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -755,8 +755,8 @@  discard block
 block discarded – undo
755 755
 		
756 756
 		$sth = $this->db->prepare($query);
757 757
 		$sth->execute($query_data);
758
-		$ident_result='';
759
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
758
+		$ident_result = '';
759
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
760 760
 		{
761 761
 			$ident_result = $row['ident'];
762 762
 		}
@@ -773,13 +773,13 @@  discard block
 block discarded – undo
773 773
 	{
774 774
 		global $globalDBdriver, $globalTimezone;
775 775
 		if ($globalDBdriver == 'mysql') {
776
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
776
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
777 777
 				WHERE tracker_live.ident = :ident 
778 778
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
779 779
 //				AND tracker_live.date < UTC_TIMESTAMP()";
780 780
 			$query_data = array(':ident' => $ident);
781 781
 		} else {
782
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
782
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
783 783
 				WHERE tracker_live.ident = :ident 
784 784
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
785 785
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -788,8 +788,8 @@  discard block
 block discarded – undo
788 788
 		
789 789
 		$sth = $this->db->prepare($query);
790 790
 		$sth->execute($query_data);
791
-		$ident_result='';
792
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
791
+		$ident_result = '';
792
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
793 793
 		{
794 794
 			$ident_result = $row['famtrackid'];
795 795
 		}
@@ -806,13 +806,13 @@  discard block
 block discarded – undo
806 806
 	{
807 807
 		global $globalDBdriver, $globalTimezone;
808 808
 		if ($globalDBdriver == 'mysql') {
809
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
809
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
810 810
 				WHERE tracker_live.famtrackid = :id 
811 811
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
812 812
 //				AND tracker_live.date < UTC_TIMESTAMP()";
813 813
 			$query_data = array(':id' => $id);
814 814
 		} else {
815
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
815
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
816 816
 				WHERE tracker_live.famtrackid = :id 
817 817
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
818 818
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -821,8 +821,8 @@  discard block
 block discarded – undo
821 821
 		
822 822
 		$sth = $this->db->prepare($query);
823 823
 		$sth->execute($query_data);
824
-		$ident_result='';
825
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
824
+		$ident_result = '';
825
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
826 826
 		{
827 827
 			$ident_result = $row['famtrackid'];
828 828
 		}
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 	* @return String success or false
841 841
 	*
842 842
 	*/
843
-	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
843
+	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '')
844 844
 	{
845 845
 		global $globalURL, $globalArchive, $globalDebug;
846 846
 		$Common = new Common();
@@ -899,21 +899,21 @@  discard block
 block discarded – undo
899 899
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
900 900
 
901 901
         
902
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
903
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
904
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
905
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
906
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
907
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
908
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
909
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
910
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
911
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
912
-		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
913
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
914
-
915
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
916
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
902
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
903
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
904
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
905
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
906
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
907
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
908
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
909
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
910
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
911
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
912
+		$comment = filter_var($comment, FILTER_SANITIZE_STRING);
913
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
914
+
915
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
916
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
917 917
             	
918 918
 		$query = '';
919 919
 		if ($globalArchive) {
@@ -923,12 +923,12 @@  discard block
 block discarded – undo
923 923
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
924 924
 		VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
925 925
 
926
-		$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type);
926
+		$query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type);
927 927
 		try {
928 928
 			
929 929
 			$sth = $this->db->prepare($query);
930 930
 			$sth->execute($query_values);
931
-                } catch(PDOException $e) {
931
+                } catch (PDOException $e) {
932 932
                 	return "error : ".$e->getMessage();
933 933
                 }
934 934
                 /*
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
939 939
 		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
940 940
 		    $TrackerArchive = new TrackerArchive($this->db);
941
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
941
+		    $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country);
942 942
 		    if ($globalDebug) echo $result.')';
943 943
 		}
944 944
 
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 
949 949
 	public function getOrderBy()
950 950
 	{
951
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
951
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
952 952
 		return $orderby;
953 953
 	}
954 954
 
Please login to merge, or discard this patch.
Braces   +110 added lines, -37 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection.');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection.');
13
+		}
12 14
 	}
13 15
 
14 16
 
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -77,8 +81,11 @@  discard block
 block discarded – undo
77 81
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
78 82
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
79 83
 		}
80
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
81
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
84
+		if ($filter_query_where == '' && $where) {
85
+			$filter_query_where = ' WHERE';
86
+		} elseif ($filter_query_where != '' && $and) {
87
+			$filter_query_where .= ' AND';
88
+		}
82 89
 		if ($filter_query_where != '') {
83 90
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
84 91
 		}
@@ -120,7 +127,9 @@  discard block
 block discarded – undo
120 127
 			}
121 128
 		}
122 129
 
123
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
130
+		if (!isset($globalLiveInterval)) {
131
+			$globalLiveInterval = '200';
132
+		}
124 133
 		if ($globalDBdriver == 'mysql') {
125 134
 			//$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate";
126 135
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -145,7 +154,9 @@  discard block
 block discarded – undo
145 154
 
146 155
 		$filter_query = $this->getFilter($filter,true,true);
147 156
 
148
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
157
+		if (!isset($globalLiveInterval)) {
158
+			$globalLiveInterval = '200';
159
+		}
149 160
 		if ($globalDBdriver == 'mysql') {
150 161
 			$query  = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
151 162
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0";
@@ -190,50 +201,74 @@  discard block
 block discarded – undo
190 201
 		}
191 202
 		$filter_query = $this->getFilter($filter,true,true);
192 203
 
193
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194
-		if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') $globalMap3DTrackersLimit = '300';
204
+		if (!isset($globalLiveInterval)) {
205
+			$globalLiveInterval = '200';
206
+		}
207
+		if (!isset($globalMap3DTrackersLimit) || $globalMap3DTrackersLimit == '') {
208
+			$globalMap3DTrackersLimit = '300';
209
+		}
195 210
 		if ($globalDBdriver == 'mysql') {
196 211
 			if (isset($globalArchive) && $globalArchive) {
197 212
 				$query  = "SELECT * FROM (
198 213
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
199 214
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid ";
200
-				if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
215
+				if ($usecoord) {
216
+					$query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
217
+				}
201 218
 				$query .= "UNION
202 219
 					SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
203 220
 					FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date ";
204
-				if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
221
+				if ($usecoord) {
222
+					$query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
223
+				}
205 224
 				$query .= ") AS tracker
206 225
 				    WHERE latitude <> '0' AND longitude <> '0' 
207 226
 				    ORDER BY famtrackid, date";
208
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
227
+				if ($limit) {
228
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
229
+				}
209 230
 			} else {
210 231
 				$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
211 232
 				    FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date ";
212
-				if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
233
+				if ($usecoord) {
234
+					$query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
235
+				}
213 236
 				$query .= "AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
214 237
 				    ORDER BY tracker_live.famtrackid, tracker_live.date";
215
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
238
+				if ($limit) {
239
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
240
+				}
216 241
 			}
217 242
 		} else {
218 243
 			if (isset($globalArchive) && $globalArchive) {
219 244
 				$query  = "SELECT * FROM (
220 245
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
221 246
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid ";
222
-				if ($usecoord) $query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
247
+				if ($usecoord) {
248
+					$query .= "AND tracker_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
249
+				}
223 250
 				$query .= "UNION
224 251
 					SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
225 252
 					FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date";
226
-				if ($usecoord) $query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
253
+				if ($usecoord) {
254
+					$query .= " AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
255
+				}
227 256
 				$query .= ") AS tracker
228 257
 				    WHERE latitude <> '0' AND longitude <> '0' 
229 258
 				    ORDER BY famtrackid, date";
230
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
259
+				if ($limit) {
260
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
261
+				}
231 262
 			} else {
232 263
 				$query  = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
233 264
 				    FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' ";
234
-				if ($usecoord) $query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
265
+				if ($usecoord) {
266
+					$query .= "AND tracker_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND tracker_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
267
+				}
235 268
 				$query .= "ORDER BY tracker_live.famtrackid, tracker_live.date";
236
-				if ($limit) $query .= " LIMIT ".$globalMap3DTrackersLimit;
269
+				if ($limit) {
270
+					$query .= " LIMIT ".$globalMap3DTrackersLimit;
271
+				}
237 272
 			}
238 273
 		}
239 274
 
@@ -259,7 +294,9 @@  discard block
 block discarded – undo
259 294
 		global $globalDBdriver, $globalLiveInterval;
260 295
 		$filter_query = $this->getFilter($filter,true,true);
261 296
 
262
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
297
+		if (!isset($globalLiveInterval)) {
298
+			$globalLiveInterval = '200';
299
+		}
263 300
 		if ($globalDBdriver == 'mysql') {
264 301
 			$query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
265 302
 		} else {
@@ -287,7 +324,9 @@  discard block
 block discarded – undo
287 324
 	{
288 325
 		global $globalDBdriver, $globalLiveInterval;
289 326
 		$Spotter = new Spotter($this->db);
290
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
327
+		if (!isset($globalLiveInterval)) {
328
+			$globalLiveInterval = '200';
329
+		}
291 330
 		$filter_query = $this->getFilter($filter);
292 331
 
293 332
 		if (is_array($coord)) {
@@ -295,7 +334,9 @@  discard block
 block discarded – undo
295 334
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
296 335
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
297 336
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
298
-		} else return array();
337
+		} else {
338
+			return array();
339
+		}
299 340
 		if ($globalDBdriver == 'mysql') {
300 341
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
301 342
 		} else {
@@ -315,7 +356,9 @@  discard block
 block discarded – undo
315 356
 	{
316 357
 		global $globalDBdriver, $globalLiveInterval;
317 358
 		$Spotter = new Spotter($this->db);
318
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
359
+		if (!isset($globalLiveInterval)) {
360
+			$globalLiveInterval = '200';
361
+		}
319 362
 		$filter_query = $this->getFilter($filter);
320 363
 
321 364
 		if (is_array($coord)) {
@@ -323,7 +366,9 @@  discard block
 block discarded – undo
323 366
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
324 367
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
325 368
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
326
-		} else return array();
369
+		} else {
370
+			return array();
371
+		}
327 372
 		if ($globalDBdriver == 'mysql') {
328 373
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
329 374
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
@@ -516,11 +561,15 @@  discard block
 block discarded – undo
516 561
 		//$query  = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date';
517 562
 		if ($globalDBdriver == 'mysql') {
518 563
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
519
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
564
+			if ($liveinterval) {
565
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
566
+			}
520 567
 			$query .= ' ORDER BY date';
521 568
 		} else {
522 569
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
523
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
570
+			if ($liveinterval) {
571
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
572
+			}
524 573
 			$query .= ' ORDER BY date';
525 574
 		}
526 575
 
@@ -615,7 +664,9 @@  discard block
 block discarded – undo
615 664
 				$i++;
616 665
 				$j++;
617 666
 				if ($j == 30) {
618
-					if ($globalDebug) echo ".";
667
+					if ($globalDebug) {
668
+						echo ".";
669
+					}
619 670
 				    	try {
620 671
 						
621 672
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -862,7 +913,9 @@  discard block
 block discarded – undo
862 913
 			{
863 914
 				return false;
864 915
 			}
865
-		} else return '';
916
+		} else {
917
+			return '';
918
+		}
866 919
 
867 920
 		if ($longitude != '')
868 921
 		{
@@ -870,7 +923,9 @@  discard block
 block discarded – undo
870 923
 			{
871 924
 				return false;
872 925
 			}
873
-		} else return '';
926
+		} else {
927
+			return '';
928
+		}
874 929
 
875 930
 		if ($altitude != '')
876 931
 		{
@@ -878,7 +933,9 @@  discard block
 block discarded – undo
878 933
 			{
879 934
 				return false;
880 935
 			}
881
-		} else $altitude = 0;
936
+		} else {
937
+			$altitude = 0;
938
+		}
882 939
 
883 940
 		if ($heading != '')
884 941
 		{
@@ -886,7 +943,9 @@  discard block
 block discarded – undo
886 943
 			{
887 944
 				return false;
888 945
 			}
889
-		} else $heading = 0;
946
+		} else {
947
+			$heading = 0;
948
+		}
890 949
 
891 950
 		if ($groundspeed != '')
892 951
 		{
@@ -894,9 +953,13 @@  discard block
 block discarded – undo
894 953
 			{
895 954
 				return false;
896 955
 			}
897
-		} else $groundspeed = 0;
956
+		} else {
957
+			$groundspeed = 0;
958
+		}
898 959
 		date_default_timezone_set('UTC');
899
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
960
+		if ($date == '') {
961
+			$date = date("Y-m-d H:i:s", time());
962
+		}
900 963
 
901 964
         
902 965
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -912,12 +975,18 @@  discard block
 block discarded – undo
912 975
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
913 976
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
914 977
 
915
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
916
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
978
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
979
+            		$groundspeed = 0;
980
+            	}
981
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
982
+            		$heading = 0;
983
+            	}
917 984
             	
918 985
 		$query = '';
919 986
 		if ($globalArchive) {
920
-			if ($globalDebug) echo '-- Delete previous data -- ';
987
+			if ($globalDebug) {
988
+				echo '-- Delete previous data -- ';
989
+			}
921 990
 			$query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;';
922 991
 		}
923 992
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
@@ -936,10 +1005,14 @@  discard block
 block discarded – undo
936 1005
                 echo 'noarchive : '.$noarchive."\n";
937 1006
                 */
938 1007
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
939
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
1008
+		    if ($globalDebug) {
1009
+		    	echo '(Add to Tracker archive '.$famtrackid.' : ';
1010
+		    }
940 1011
 		    $TrackerArchive = new TrackerArchive($this->db);
941 1012
 		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
942
-		    if ($globalDebug) echo $result.')';
1013
+		    if ($globalDebug) {
1014
+		    	echo $result.')';
1015
+		    }
943 1016
 		}
944 1017
 
945 1018
 		return "success";
Please login to merge, or discard this patch.
js/map-aircraft.2d.js.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 if (!isset($globalJsonCompress)) $compress = true;
7 7
 else $compress = $globalJsonCompress;
8 8
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
9
+if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
10
+if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
11 11
 ?>
12 12
 
13 13
 
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 	};
177 177
 	archive.update = function (props) {
178 178
 		if (typeof props != 'undefined') {
179
-			//this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
180
-			this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>';
179
+			//this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
180
+			this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>';
181 181
 		} else {
182
-			this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
182
+			this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
183 183
 		}
184 184
 
185 185
 	};
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 <?php
341 341
 		} else {
342 342
 ?>
343
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
343
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
344 344
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
345 345
 <?php
346 346
 		}
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 							/*
357 357
 							shadowUrl: iconURLShadowpath,
358 358
 							shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
359
-							shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
359
+							shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
360 360
 							*/
361 361
 						})
362 362
 					})
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 <?php
383 383
 		} else {
384 384
 ?>
385
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
385
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
386 386
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
387 387
 <?php
388 388
 		}
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 <?php
423 423
 		} else {
424 424
 ?>
425
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
425
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
426 426
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
427 427
 <?php
428 428
 		}
Please login to merge, or discard this patch.
Braces   +66 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,11 +3,18 @@  discard block
 block discarded – undo
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5 5
 // Compressed GeoJson is used if true
6
-if (!isset($globalJsonCompress)) $compress = true;
7
-else $compress = $globalJsonCompress;
6
+if (!isset($globalJsonCompress)) {
7
+	$compress = true;
8
+} else {
9
+	$compress = $globalJsonCompress;
10
+}
8 11
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
12
+if (isset($_GET['ident'])) {
13
+	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+}
15
+if (isset($_GET['flightaware_id'])) {
16
+	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
17
+}
11 18
 ?>
12 19
 
13 20
 
@@ -72,9 +79,12 @@  discard block
 block discarded – undo
72 79
 
73 80
 function update_airportsLayer() {
74 81
 <?php
75
-	if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
76
-	else $getZoom = '7';
77
-?>
82
+	if (isset($_COOKIE['AirportZoom'])) {
83
+		$getZoom = $_COOKIE['AirportZoom'];
84
+	} else {
85
+		$getZoom = '7';
86
+	}
87
+	?>
78 88
 	if (typeof airportsLayer != 'undefined') {
79 89
 		if (map.hasLayer(airportsLayer) == true) {
80 90
 			map.removeLayer(airportsLayer);
@@ -320,9 +330,13 @@  discard block
 block discarded – undo
320 330
 					if (callsign != ""){ markerLabel += callsign; }
321 331
 					if (departure_airport_code != "" && arrival_airport_code != "" && departure_airport_code != "NA" && arrival_airport_code != "NA"){ markerLabel += ' ( '+departure_airport_code+' - '+arrival_airport_code+' )'; }
322 332
 <?php
323
-	if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
324
-	elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
325
-	else $IconColor = '1a3151';
333
+	if (isset($_COOKIE['IconColor'])) {
334
+		$IconColor = $_COOKIE['IconColor'];
335
+	} elseif (isset($globalAircraftIconColor)) {
336
+		$IconColor = $globalAircraftIconColor;
337
+	} else {
338
+		$IconColor = '1a3151';
339
+	}
326 340
 	if (!isset($ident) && !isset($flightaware_id)) {
327 341
 ?>
328 342
 					//info_update(feature.properties.fc);
@@ -370,7 +384,12 @@  discard block
 block discarded – undo
370 384
 <?php
371 385
 		} else {
372 386
 ?>
373
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
387
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
388
+	print $archiveupdatetime*1000;
389
+} else {
390
+	print $globalMapRefresh*1000+20000;
391
+}
392
+?>+feature.properties.sqt*1000);
374 393
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
375 394
 <?php
376 395
 		}
@@ -419,7 +438,12 @@  discard block
 block discarded – undo
419 438
 <?php
420 439
 		} else {
421 440
 ?>
422
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
441
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
442
+	print $archiveupdatetime*1000;
443
+} else {
444
+	print $globalMapRefresh*1000+20000;
445
+}
446
+?>+feature.properties.sqt*1000);
423 447
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
424 448
 <?php
425 449
 		}
@@ -466,7 +490,12 @@  discard block
 block discarded – undo
466 490
 <?php
467 491
 		} else {
468 492
 ?>
469
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
493
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
494
+	print $archiveupdatetime*1000;
495
+} else {
496
+	print $globalMapRefresh*1000+20000;
497
+}
498
+?>+feature.properties.sqt*1000);
470 499
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
471 500
 <?php
472 501
 		}
@@ -820,13 +849,23 @@  discard block
 block discarded – undo
820 849
 	if (isset($archive) && $archive) {
821 850
 ?>
822 851
 	//then load it again every 30 seconds
823
-	//  var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
852
+	//  var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
853
+	print ($globalMapRefresh*1000)/2;
854
+} else {
855
+	print '15000';
856
+}
857
+?>);
824 858
 	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php print $archiveupdatetime*1000; ?>);
825 859
 <?php
826 860
 	} else {
827 861
 ?>
828 862
 	//then load it again every 30 seconds
829
-	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
863
+	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
864
+	print $globalMapRefresh*1000;
865
+} else {
866
+	print '30000';
867
+}
868
+?>);
830 869
 	var currentdate = new Date();
831 870
 	var currentyear = new Date().getFullYear();
832 871
 	var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0));
@@ -838,7 +877,12 @@  discard block
 block discarded – undo
838 877
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
839 878
 ?>
840 879
 	update_polarLayer();
841
-	setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
880
+	setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
881
+	print $globalMapRefresh*1000*2;
882
+} else {
883
+	print '60000';
884
+}
885
+?>);
842 886
 <?php
843 887
 		}
844 888
 ?>
@@ -853,7 +897,12 @@  discard block
 block discarded – undo
853 897
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
854 898
 ?>
855 899
 	update_atcLayer();
856
-	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
900
+	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
901
+	print $globalMapRefresh*1000*2;
902
+} else {
903
+	print '60000';
904
+}
905
+?>);
857 906
 <?php
858 907
 	}
859 908
 ?>
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 			}
517 517
                     }
518 518
 		    <?php
519
-            		} else {
520
-            	    ?>
519
+					} else {
520
+					?>
521 521
 		    if (map.getZoom() > 7) {
522 522
                 	var style = {
523 523
                     	    "color": "#1a3151",
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                 	layer_marine_data.addLayer(layer);
537 537
 		    }
538 538
 <?php
539
-            		}
539
+					}
540 540
 ?>
541 541
 				}
542 542
 			    }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8 8
 if (!isset($globalJsonCompress)) $compress = true;
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 
17 17
 <?php
18 18
 	if (isset($_GET['fammarine_id'])) {
19
-		$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
19
+		$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
20 20
 	}
21 21
 	if (isset($_GET['ident'])) {
22
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
22
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
23 23
 	}
24 24
 	if (!isset($ident) && !isset($fammarine_id)) {
25 25
 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 <?php
183 183
 		} else {
184 184
 ?>
185
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
185
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
186 186
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
187 187
 <?php
188 188
 		}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			    /*
199 199
 			    shadowUrl: iconURLShadowpath,
200 200
 			    shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
201
-			    shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
201
+			    shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
202 202
 			    */
203 203
 			})
204 204
 		    })
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 <?php
232 232
 		} else {
233 233
 ?>
234
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
234
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
235 235
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
236 236
 <?php
237 237
 		}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 <?php
280 280
 		} else {
281 281
 ?>
282
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
282
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
283 283
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
284 284
 <?php
285 285
 		}
Please login to merge, or discard this patch.
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 ?>
11 14
 
12 15
 
@@ -156,9 +159,13 @@  discard block
 block discarded – undo
156 159
 		    if (callsign != ""){ markerMarineLabel += callsign; }
157 160
 		    if (type != ""){ markerMarineLabel += ' - '+type; }
158 161
 <?php
159
-	if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor'];
160
-	elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor;
161
-	else $MarineIconColor = '1a3151';
162
+	if (isset($_COOKIE['MarineIconColor'])) {
163
+		$MarineIconColor = $_COOKIE['MarineIconColor'];
164
+	} elseif (isset($globalMarineIconColor)) {
165
+		$MarineIconColor = $globalMarineIconColor;
166
+	} else {
167
+		$MarineIconColor = '1a3151';
168
+	}
162 169
 	if (!isset($ident) && !isset($fammarine_id)) {
163 170
 ?>
164 171
 		    //info_marine_update(feature.properties.fc);
@@ -193,7 +200,12 @@  discard block
 block discarded – undo
193 200
 <?php
194 201
 		} else {
195 202
 ?>
196
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
203
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
204
+	print $archiveupdatetime*1000;
205
+} else {
206
+	print $globalMapRefresh*1000+20000;
207
+}
208
+?>+feature.properties.sqt*1000);
197 209
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
198 210
 <?php
199 211
 		}
@@ -249,7 +261,12 @@  discard block
 block discarded – undo
249 261
 <?php
250 262
 		} else {
251 263
 ?>
252
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
264
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
265
+	print $archiveupdatetime*1000;
266
+} else {
267
+	print $globalMapRefresh*1000+20000;
268
+}
269
+?>+feature.properties.sqt*1000);
253 270
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
254 271
 <?php
255 272
 		}
@@ -304,7 +321,12 @@  discard block
 block discarded – undo
304 321
 <?php
305 322
 		} else {
306 323
 ?>
307
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
324
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
325
+	print $archiveupdatetime*1000;
326
+} else {
327
+	print $globalMapRefresh*1000+20000;
328
+}
329
+?>+feature.properties.sqt*1000);
308 330
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
309 331
 <?php
310 332
 		}
@@ -594,14 +616,24 @@  discard block
 block discarded – undo
594 616
 	if (isset($archive) && $archive) {
595 617
 ?>
596 618
 //then load it again every 30 seconds
597
-//  var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
619
+//  var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
620
+	print ($globalMapRefresh*1000)/2;
621
+} else {
622
+	print '15000';
623
+}
624
+?>);
598 625
 reloadMarinePage = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php print $archiveupdatetime*1000; ?>);
599 626
 <?php
600 627
 	} else {
601 628
 ?>
602 629
 //then load it again every 30 seconds
603 630
 reloadMarinePage = setInterval(
604
-    function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
631
+    function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
632
+	print $globalMapRefresh*1000;
633
+} else {
634
+	print '30000';
635
+}
636
+?>);
605 637
 <?php
606 638
 	}
607 639
 ?>
Please login to merge, or discard this patch.
js/map-tracker.2d.js.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 			}
518 518
                     }
519 519
 		    <?php
520
-            		} else {
521
-            	    ?>
520
+					} else {
521
+					?>
522 522
 		    if (map.getZoom() > 7) {
523 523
                 	var style = {
524 524
                     	    "color": "#1a3151",
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
                 	layer_tracker_data.addLayer(layer);
538 538
 		    }
539 539
 <?php
540
-            		}
540
+					}
541 541
 ?>
542 542
 				}
543 543
 			    }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8 8
 if (!isset($globalJsonCompress)) $compress = true;
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 
18 18
 <?php
19 19
 	if (isset($_GET['famtrackid'])) {
20
-		$famtrackid = filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING);
20
+		$famtrackid = filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING);
21 21
 	}
22 22
 	if (isset($_GET['ident'])) {
23
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
23
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
24 24
 	}
25 25
 	if (!isset($ident) && !isset($famtrackid)) {
26 26
 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 <?php
183 183
 		} else {
184 184
 ?>
185
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
185
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
186 186
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
187 187
 <?php
188 188
 		}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			    /*
199 199
 			    shadowUrl: iconURLShadowpath,
200 200
 			    shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
201
-			    shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
201
+			    shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
202 202
 			    */
203 203
 			})
204 204
 		    })
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 <?php
232 232
 		} else {
233 233
 ?>
234
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
234
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
235 235
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
236 236
 <?php
237 237
 		}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 <?php
280 280
 		} else {
281 281
 ?>
282
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
282
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
283 283
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
284 284
 <?php
285 285
 		}
Please login to merge, or discard this patch.
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 ?>
11 14
 
12 15
 
@@ -157,9 +160,13 @@  discard block
 block discarded – undo
157 160
 		    if (callsign != ""){ markerTrackerLabel += callsign; }
158 161
 		    if (type != ""){ markerTrackerLabel += ' - '+type; }
159 162
 <?php
160
-	if (isset($_COOKIE['TrackerIconColor'])) $IconColor = $_COOKIE['TrackerIconColor'];
161
-	elseif (isset($globalTrackerIconColor)) $IconColor = $globalTrackerIconColor;
162
-	else $IconColor = '1a3151';
163
+	if (isset($_COOKIE['TrackerIconColor'])) {
164
+		$IconColor = $_COOKIE['TrackerIconColor'];
165
+	} elseif (isset($globalTrackerIconColor)) {
166
+		$IconColor = $globalTrackerIconColor;
167
+	} else {
168
+		$IconColor = '1a3151';
169
+	}
163 170
 	if (!isset($ident) && !isset($famtrackid)) {
164 171
 ?>
165 172
 		    //info_tracker_update(feature.properties.fc);
@@ -193,7 +200,12 @@  discard block
 block discarded – undo
193 200
 <?php
194 201
 		} else {
195 202
 ?>
196
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
203
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
204
+	print $archiveupdatetime*1000;
205
+} else {
206
+	print $globalMapRefresh*1000+20000;
207
+}
208
+?>+feature.properties.sqt*1000);
197 209
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
198 210
 <?php
199 211
 		}
@@ -249,7 +261,12 @@  discard block
 block discarded – undo
249 261
 <?php
250 262
 		} else {
251 263
 ?>
252
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
264
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
265
+	print $archiveupdatetime*1000;
266
+} else {
267
+	print $globalMapRefresh*1000+20000;
268
+}
269
+?>+feature.properties.sqt*1000);
253 270
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
254 271
 <?php
255 272
 		}
@@ -304,7 +321,12 @@  discard block
 block discarded – undo
304 321
 <?php
305 322
 		} else {
306 323
 ?>
307
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
324
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
325
+	print $archiveupdatetime*1000;
326
+} else {
327
+	print $globalMapRefresh*1000+20000;
328
+}
329
+?>+feature.properties.sqt*1000);
308 330
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
309 331
 <?php
310 332
 		}
@@ -595,14 +617,24 @@  discard block
 block discarded – undo
595 617
 	if (isset($archive) && $archive) {
596 618
 ?>
597 619
 //then load it again every 30 seconds
598
-//  var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
620
+//  var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
621
+	print ($globalMapRefresh*1000)/2;
622
+} else {
623
+	print '15000';
624
+}
625
+?>);
599 626
 reloadTrackerPage = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php print $archiveupdatetime*1000; ?>);
600 627
 <?php
601 628
 	} else {
602 629
 ?>
603 630
 //then load it again every 30 seconds
604 631
 reloadTrackerPage = setInterval(
605
-    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
632
+    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
633
+	print $globalMapRefresh*1000;
634
+} else {
635
+	print '30000';
636
+}
637
+?>);
606 638
 <?php
607 639
 	}
608 640
 ?>
Please login to merge, or discard this patch.
js/map-aircraft.3d.js.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -662,9 +662,9 @@
 block discarded – undo
662 662
 //	var timeline = new Cesium.Timeline(viewer);
663 663
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
664 664
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
665
-	//this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
666
-	$(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
667
-	//		this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
665
+	//this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
666
+	$(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
667
+	//		this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
668 668
 
669 669
 }
670 670
 
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -209,21 +209,21 @@  discard block
 block discarded – undo
209 209
 			var entityid = entity.id;
210 210
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
211 211
 			<?php 
212
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
212
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
213 213
 			?>
214 214
 			if (lastupdateentity != lastupdate) {
215 215
 				viewer.dataSources.get(dsn).entities.remove(entity);
216 216
 				czmlds.entities.removeById(entityid);
217 217
 			}
218 218
 			<?php
219
-			    } else {
219
+				} else {
220 220
 			?>
221 221
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
222 222
 				viewer.dataSources.get(dsn).entities.remove(entity);
223 223
 				czmlds.entities.removeById(entityid);
224 224
 			}
225 225
 			<?php
226
-			    }
226
+				}
227 227
 			?>
228 228
 		}
229 229
 	}
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
 	update_airportsLayer();
630 630
 }
631 631
 <?php
632
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
632
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
633 633
 ?>
634 634
 update_atcLayer();
635 635
 setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
636 636
 <?php
637
-    }
637
+	}
638 638
 ?>
639 639
 
640 640
 function iconColor(color) {
Please login to merge, or discard this patch.
Braces   +24 added lines, -4 removed lines patch added patch discarded remove patch
@@ -218,7 +218,12 @@  discard block
 block discarded – undo
218 218
 			<?php
219 219
 			    } else {
220 220
 			?>
221
-			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
221
+			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
222
+	print $globalMapRefresh*2000;
223
+} else {
224
+	print '60000';
225
+}
226
+?>)) {
222 227
 				viewer.dataSources.get(dsn).entities.remove(entity);
223 228
 				czmlds.entities.removeById(entityid);
224 229
 			}
@@ -502,7 +507,12 @@  discard block
 block discarded – undo
502 507
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
503 508
 ?>
504 509
 update_polarLayer();
505
-setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
510
+setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) {
511
+	print $globalMapRefresh*1000*2;
512
+} else {
513
+	print '60000';
514
+}
515
+?>);
506 516
 <?php
507 517
 		}
508 518
 ?>
@@ -613,7 +623,12 @@  discard block
 block discarded – undo
613 623
 				}
614 624
 			}
615 625
 		}
616
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
626
+	,<?php if (isset($globalMapRefresh)) {
627
+	print $globalMapRefresh*1000;
628
+} else {
629
+	print '30000';
630
+}
631
+?>);
617 632
 } else {
618 633
 	//var widget = new Cesium.CesiumWidget('archivebox');
619 634
 //	var timeline = new Cesium.Timeline(viewer);
@@ -632,7 +647,12 @@  discard block
 block discarded – undo
632 647
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
633 648
 ?>
634 649
 update_atcLayer();
635
-setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
650
+setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) {
651
+	print $globalMapRefresh*1000*2;
652
+} else {
653
+	print '60000';
654
+}
655
+?>);
636 656
 <?php
637 657
     }
638 658
 ?>
Please login to merge, or discard this patch.
marine-data.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
 
10 10
 $from_archive = false;
11 11
 if (isset($_GET['ident'])) {
12
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
13 13
 	if (isset($_GET['currenttime'])) {
14
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
14
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
15 15
 		$currenttime = round($currenttime/1000);
16
-		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident,$currenttime);
16
+		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident, $currenttime);
17 17
 		/*
18 18
 		if (empty($spotter_array)) {
19 19
 			$from_archive = true;
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 }
33 33
 if (isset($_GET['fammarine_id'])) {
34
-	$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
34
+	$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
35 35
 	if (isset($_GET['currenttime'])) {
36
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
36
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
37 37
 		$currenttime = round($currenttime/1000);
38
-		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id,$currenttime);
38
+		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id, $currenttime);
39 39
 		/*
40 40
 		if (empty($spotter_array)) {
41 41
 			$from_archive = true;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
65
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
66 66
 	} else $image = $spotter_item['image_thumbnail'];
67 67
 
68 68
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65 65
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
66
-	} else $image = $spotter_item['image_thumbnail'];
66
+	} else {
67
+		$image = $spotter_item['image_thumbnail'];
68
+	}
67 69
 
68 70
 }
69 71
 /* else {
Please login to merge, or discard this patch.