Completed
Push — master ( cc50d0...0f8c33 )
by Yannick
09:46
created
require/class.AIS.php 2 patches
Doc Comments   +22 added lines patch added patch discarded remove patch
@@ -68,6 +68,10 @@  discard block
 block discarded – undo
68 68
        't', 'u', 'v', 'w' // 119
69 69
     ); // char 64
70 70
     */
71
+
72
+	/**
73
+	 * @param integer $ascii
74
+	 */
71 75
 	private function asciidec_2_8bit($ascii) {
72 76
 		//only process in the following range: 48-87, 96-119
73 77
 		if ($ascii < 48) { }
@@ -93,6 +97,10 @@  discard block
 block discarded – undo
93 97
 		return(substr($bin, -6)); 
94 98
 	}
95 99
 
100
+	/**
101
+	 * @param integer $_start
102
+	 * @param integer $_size
103
+	 */
96 104
 	private function binchar($_str, $_start, $_size) {
97 105
 		//  ' ' --- '?', // 0x20 - 0x3F
98 106
 		//  '@' --- '_', // 0x40 - 0x5F
@@ -117,6 +125,10 @@  discard block
 block discarded – undo
117 125
 	}
118 126
 
119 127
 	// function for decoding the AIS Message ITU Payload
128
+
129
+	/**
130
+	 * @param string $_aisdata
131
+	 */
120 132
 	private function decode_ais($_aisdata) {
121 133
 		$ro = new stdClass(); // return object
122 134
 		$ro->cls = 0; // AIS class undefined, also indicate unparsed msg
@@ -202,6 +214,12 @@  discard block
 block discarded – undo
202 214
 		}
203 215
 	}
204 216
 
217
+	/**
218
+	 * @param string $_itu
219
+	 * @param integer $_len
220
+	 * @param integer $_filler
221
+	 * @param string $aux
222
+	 */
205 223
 	public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) {
206 224
 		global $port; // tcpip port...
207 225
 		
@@ -221,6 +239,10 @@  discard block
 block discarded – undo
221 239
 
222 240
 	// char* - AIS \r terminated string
223 241
 	// TCP based streams which send messages in full can use this instead of calling process_ais_buf
242
+
243
+	/**
244
+	 * @param string $rawdata
245
+	 */
224 246
 	public function process_ais_raw($rawdata, $aux = '') { // return int
225 247
 		static $num_seq; // 1 to 9
226 248
 		static $seq; // 1 to 9
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 		return ($dec);
58 58
 	}
59 59
 	
60
-    /*
60
+	/*
61 61
     $ais_map64 = array(
62 62
        '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', // 48
63 63
        ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C',
@@ -97,13 +97,13 @@  discard block
 block discarded – undo
97 97
 		//  ' ' --- '?', // 0x20 - 0x3F
98 98
 		//  '@' --- '_', // 0x40 - 0x5F
99 99
 		$ais_chars = array(
100
-		    '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
101
-		    'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
102
-		    'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']',
103
-		    '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'',
104
-		    '(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
105
-		    '2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
106
-		    '<', '=', '>', '?'
100
+			'@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
101
+			'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
102
+			'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']',
103
+			'^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'',
104
+			'(', ')', '*', '+', ',', '-', '.', '/', '0', '1',
105
+			'2', '3', '4', '5', '6', '7', '8', '9', ':', ';',
106
+			'<', '=', '>', '?'
107 107
 		);
108 108
 		$rv = '';
109 109
 		if ($_size % 6 == 0) {
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 				}
270 270
 				if ($num_seq > 1) { // for multipart messages
271 271
 					if ($cmsg_sid != $msg_sid // different msg_sid
272
-					    || $msg_sid == -1 // invalid initial msg_sid
273
-					    || ($seq - $pseq) != 1 // not insequence
272
+						|| $msg_sid == -1 // invalid initial msg_sid
273
+						|| ($seq - $pseq) != 1 // not insequence
274 274
 					) {  // invalid for multipart message
275 275
 						$msg_sid = -1;
276 276
 						$cmsg_sid = -1;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 				$itu = $itu.$pcs[5]; // get itu message
284 284
 				$filler += (int)$pcs[6][0]; // get filler
285 285
 				if ($num_seq == 1 // valid single message
286
-				    || $num_seq == $pseq // valid multi-part message
286
+					|| $num_seq == $pseq // valid multi-part message
287 287
 				) {
288 288
 					if ($num_seq != 1) { // test
289 289
 						//echo $rawdata;
@@ -366,13 +366,13 @@  discard block
 block discarded – undo
366 366
 		else $pad = '';
367 367
 		$rv = '';
368 368
 		$ais_chars = array(
369
-		    '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
370
-		    'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19,
371
-		    'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29,
372
-		    '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39,
373
-		    '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49,
374
-		    '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59,
375
-		    '<'=>60, '='=>61, '>'=>62, '?'=>63
369
+			'@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9,
370
+			'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19,
371
+			'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29,
372
+			'^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39,
373
+			'('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49,
374
+			'2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59,
375
+			'<'=>60, '='=>61, '>'=>62, '?'=>63
376 376
 		);
377 377
 		$_a = str_split($name);
378 378
 		if ($_a) foreach ($_a as $_1) {
Please login to merge, or discard this patch.
require/class.Connection.php 2 patches
Doc Comments   +20 added lines patch added patch discarded remove patch
@@ -6,6 +6,9 @@  discard block
 block discarded – undo
6 6
 	public $dbs = array();
7 7
 	public $latest_schema = 37;
8 8
 	
9
+	/**
10
+	 * @param string $dbname
11
+	 */
9 12
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10 13
 	    global $globalDBdriver;
11 14
 	    if ($dbc === null) {
@@ -132,6 +135,9 @@  discard block
 block discarded – undo
132 135
 		return true;
133 136
 	}
134 137
 
138
+	/**
139
+	 * @param string $table
140
+	 */
135 141
 	public function tableExists($table)
136 142
 	{
137 143
 		global $globalDBdriver, $globalDBname;
@@ -181,6 +187,11 @@  discard block
 block discarded – undo
181 187
 	/*
182 188
 	* Check if index exist
183 189
 	*/
190
+
191
+	/**
192
+	 * @param string $table
193
+	 * @param string $index
194
+	 */
184 195
 	public function indexExists($table,$index)
185 196
 	{
186 197
 		global $globalDBdriver, $globalDBname;
@@ -223,6 +234,10 @@  discard block
 block discarded – undo
223 234
 		return $columns;
224 235
 	}
225 236
 
237
+	/**
238
+	 * @param string $table
239
+	 * @param string $column
240
+	 */
226 241
 	public function getColumnType($table,$column) {
227 242
 		$select = $this->db->query('SELECT '.$column.' FROM '.$table);
228 243
 		$tomet = $select->getColumnMeta(0);
@@ -233,6 +248,11 @@  discard block
 block discarded – undo
233 248
 	* Check if a column name exist in a table
234 249
 	* @return Boolean column exist or not
235 250
 	*/
251
+
252
+	/**
253
+	 * @param string $table
254
+	 * @param string $name
255
+	 */
236 256
 	public function checkColumnName($table,$name)
237 257
 	{
238 258
 		global $globalDBdriver, $globalDBname;
Please login to merge, or discard this patch.
Indentation   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
 	public $latest_schema = 37;
8 8
 	
9 9
 	public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) {
10
-	    global $globalDBdriver;
11
-	    if ($dbc === null) {
10
+		global $globalDBdriver;
11
+		if ($dbc === null) {
12 12
 		if ($this->db === null && $dbname === null) {
13
-		    if ($user === null && $pass === null) {
13
+			if ($user === null && $pass === null) {
14 14
 			$this->createDBConnection();
15
-		    } else {
15
+			} else {
16 16
 			$this->createDBConnection(null,$user,$pass);
17
-		    }
17
+			}
18 18
 		} else {
19
-		    $this->createDBConnection($dbname);
19
+			$this->createDBConnection($dbname);
20 20
 		}
21
-	    } elseif ($dbname === null || $dbname === 'default') {
21
+		} elseif ($dbname === null || $dbname === 'default') {
22 22
 		$this->db = $dbc;
23 23
 		if ($this->connectionExists() === false) {
24 24
 			/*
@@ -28,10 +28,10 @@  discard block
 block discarded – undo
28 28
 			*/
29 29
 			$this->createDBConnection();
30 30
 		}
31
-	    } else {
31
+		} else {
32 32
 		//$this->connectionExists();
33 33
 		$this->dbs[$dbname] = $dbc;
34
-	    }
34
+		}
35 35
 	}
36 36
 
37 37
 	public function db() {
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	}
48 48
 
49 49
 	/**
50
-	* Creates the database connection
51
-	*
52
-	* @return Boolean of the database connection
53
-	*
54
-	*/
50
+	 * Creates the database connection
51
+	 *
52
+	 * @return Boolean of the database connection
53
+	 *
54
+	 */
55 55
 
56 56
 	public function createDBConnection($DBname = null, $user = null, $pass = null)
57 57
 	{
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 			return false;
149 149
 		}
150 150
 		if($results->rowCount()>0) {
151
-		    return true; 
151
+			return true; 
152 152
 		}
153 153
 		else return false;
154 154
 	}
@@ -165,14 +165,14 @@  discard block
 block discarded – undo
165 165
 				$sum = $sum->fetchColumn(0);
166 166
 			} else $sum = 0;
167 167
 			if (intval($sum) !== 2) {
168
-			     return false;
168
+				 return false;
169 169
 			}
170 170
 			
171 171
 		} catch(PDOException $e) {
172 172
 			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
173
-            			throw $e;
174
-	                }
175
-	                //echo 'error ! '.$e->getMessage();
173
+						throw $e;
174
+					}
175
+					//echo 'error ! '.$e->getMessage();
176 176
 			return false;
177 177
 		}
178 178
 		return true; 
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
 		$version = 0;
277 277
 		if ($this->tableExists('aircraft')) {
278 278
 			if (!$this->tableExists('config')) {
279
-	    			$version = '1';
280
-	    			return $version;
279
+					$version = '1';
280
+					return $version;
281 281
 			} else {
282 282
 				$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
283 283
 				try {
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
 	* @return Boolean if latest version or not
299 299
 	*/
300 300
 	public function latest() {
301
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
302
-	    else return false;
301
+		if ($this->check_schema_version() == $this->latest_schema) return true;
302
+		else return false;
303 303
 	}
304 304
 
305 305
 }
Please login to merge, or discard this patch.
require/class.Marine.php 2 patches
Doc Comments   +2 added lines, -31 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) {
@@ -502,9 +502,6 @@  discard block
 block discarded – undo
502 502
 	/**
503 503
 	* Update ident spotter data
504 504
 	*
505
-	* @param String $flightaware_id the ID from flightaware
506
-	* @param String $ident the flight ident
507
-	* @return String success or false
508 505
 	*
509 506
 	*/	
510 507
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
@@ -526,10 +523,6 @@  discard block
 block discarded – undo
526 523
 	/**
527 524
 	* Update latest spotter data
528 525
 	*
529
-	* @param String $flightaware_id the ID from flightaware
530
-	* @param String $ident the flight ident
531
-	* @param String $arrival_airport_icao the arrival airport
532
-	* @return String success or false
533 526
 	*
534 527
 	*/	
535 528
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
@@ -551,28 +544,6 @@  discard block
 block discarded – undo
551 544
 	/**
552 545
 	* Adds a new spotter data
553 546
 	*
554
-	* @param String $flightaware_id the ID from flightaware
555
-	* @param String $ident the flight ident
556
-	* @param String $aircraft_icao the aircraft type
557
-	* @param String $departure_airport_icao the departure airport
558
-	* @param String $arrival_airport_icao the arrival airport
559
-	* @param String $latitude latitude of flight
560
-	* @param String $longitude latitude of flight
561
-	* @param String $waypoints waypoints of flight
562
-	* @param String $heading heading of flight
563
-	* @param String $groundspeed speed of flight
564
-	* @param String $date date of flight
565
-	* @param String $departure_airport_time departure time of flight
566
-	* @param String $arrival_airport_time arrival time of flight
567
-	* @param String $squawk squawk code of flight
568
-	* @param String $route_stop route stop of flight
569
-	* @param String $highlight highlight or not
570
-	* @param String $ModeS ModesS code of flight
571
-	* @param String $registration registration code of flight
572
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
573
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
574
-	* @param String $verticalrate vertival rate of flight
575
-	* @return String success or false
576 547
 	*/
577 548
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$status = '',$format_source = '', $source_name = '')
578 549
 	{
@@ -1442,7 +1413,7 @@  discard block
 block discarded – undo
1442 1413
 	/**
1443 1414
 	* Parses the direction degrees to working
1444 1415
 	*
1445
-	* @param Float $direction the direction in degrees
1416
+	* @param integer $direction the direction in degrees
1446 1417
 	* @return Array the direction information
1447 1418
 	*
1448 1419
 	*/
Please login to merge, or discard this patch.
Indentation   +199 added lines, -199 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');
@@ -199,11 +199,11 @@  discard block
 block discarded – undo
199 199
 	
200 200
 	
201 201
 	/**
202
-	* Gets all the spotter information based on the latest data entry
203
-	*
204
-	* @return Array the spotter information
205
-	*
206
-	*/
202
+	 * Gets all the spotter information based on the latest data entry
203
+	 *
204
+	 * @return Array the spotter information
205
+	 *
206
+	 */
207 207
 	public function getLatestMarineData($limit = '', $sort = '', $filter = array())
208 208
 	{
209 209
 		global $global_query;
@@ -261,11 +261,11 @@  discard block
 block discarded – undo
261 261
 	}
262 262
 
263 263
 	/**
264
-	* Gets all the spotter information based on the callsign
265
-	*
266
-	* @return Array the spotter information
267
-	*
268
-	*/
264
+	 * Gets all the spotter information based on the callsign
265
+	 *
266
+	 * @return Array the spotter information
267
+	 *
268
+	 */
269 269
 	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
270 270
 	{
271 271
 		global $global_query;
@@ -376,12 +376,12 @@  discard block
 block discarded – undo
376 376
 
377 377
 
378 378
 	/**
379
-	* Gets all source name
380
-	*
381
-	* @param String type format of source
382
-	* @return Array list of source name
383
-	*
384
-	*/
379
+	 * Gets all source name
380
+	 *
381
+	 * @param String type format of source
382
+	 * @return Array list of source name
383
+	 *
384
+	 */
385 385
 	public function getAllSourceName($type = '',$filters = array())
386 386
 	{
387 387
 		$filter_query = $this->getFilter($filters,true,true);
@@ -411,11 +411,11 @@  discard block
 block discarded – undo
411 411
 
412 412
 
413 413
 	/**
414
-	* Gets a list of all idents/callsigns
415
-	*
416
-	* @return Array list of ident/callsign names
417
-	*
418
-	*/
414
+	 * Gets a list of all idents/callsigns
415
+	 *
416
+	 * @return Array list of ident/callsign names
417
+	 *
418
+	 */
419 419
 	public function getAllIdents($filters = array())
420 420
 	{
421 421
 		$filter_query = $this->getFilter($filters,true,true);
@@ -439,11 +439,11 @@  discard block
 block discarded – undo
439 439
 	}
440 440
 
441 441
 	/**
442
-	* Gets all info from a mmsi
443
-	*
444
-	* @return Array list of mmsi info
445
-	*
446
-	*/
442
+	 * Gets all info from a mmsi
443
+	 *
444
+	 * @return Array list of mmsi info
445
+	 *
446
+	 */
447 447
 	public function getIdentity($mmsi)
448 448
 	{
449 449
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -500,18 +500,18 @@  discard block
 block discarded – undo
500 500
 	
501 501
 	
502 502
 	/**
503
-	* Update ident spotter data
504
-	*
505
-	* @param String $flightaware_id the ID from flightaware
506
-	* @param String $ident the flight ident
507
-	* @return String success or false
508
-	*
509
-	*/	
503
+	 * Update ident spotter data
504
+	 *
505
+	 * @param String $flightaware_id the ID from flightaware
506
+	 * @param String $ident the flight ident
507
+	 * @return String success or false
508
+	 *
509
+	 */	
510 510
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
511 511
 	{
512 512
 
513 513
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
514
-                $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
514
+				$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
515 515
 
516 516
 		try {
517 517
 			$sth = $this->db->prepare($query);
@@ -524,18 +524,18 @@  discard block
 block discarded – undo
524 524
 
525 525
 	}
526 526
 	/**
527
-	* Update latest spotter data
528
-	*
529
-	* @param String $flightaware_id the ID from flightaware
530
-	* @param String $ident the flight ident
531
-	* @param String $arrival_airport_icao the arrival airport
532
-	* @return String success or false
533
-	*
534
-	*/	
527
+	 * Update latest spotter data
528
+	 *
529
+	 * @param String $flightaware_id the ID from flightaware
530
+	 * @param String $ident the flight ident
531
+	 * @param String $arrival_airport_icao the arrival airport
532
+	 * @return String success or false
533
+	 *
534
+	 */	
535 535
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
536 536
 	{
537 537
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id';
538
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
538
+				$query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
539 539
 
540 540
 		try {
541 541
 			$sth = $this->db->prepare($query);
@@ -549,31 +549,31 @@  discard block
 block discarded – undo
549 549
 	}
550 550
 
551 551
 	/**
552
-	* Adds a new spotter data
553
-	*
554
-	* @param String $flightaware_id the ID from flightaware
555
-	* @param String $ident the flight ident
556
-	* @param String $aircraft_icao the aircraft type
557
-	* @param String $departure_airport_icao the departure airport
558
-	* @param String $arrival_airport_icao the arrival airport
559
-	* @param String $latitude latitude of flight
560
-	* @param String $longitude latitude of flight
561
-	* @param String $waypoints waypoints of flight
562
-	* @param String $heading heading of flight
563
-	* @param String $groundspeed speed of flight
564
-	* @param String $date date of flight
565
-	* @param String $departure_airport_time departure time of flight
566
-	* @param String $arrival_airport_time arrival time of flight
567
-	* @param String $squawk squawk code of flight
568
-	* @param String $route_stop route stop of flight
569
-	* @param String $highlight highlight or not
570
-	* @param String $ModeS ModesS code of flight
571
-	* @param String $registration registration code of flight
572
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
573
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
574
-	* @param String $verticalrate vertival rate of flight
575
-	* @return String success or false
576
-	*/
552
+	 * Adds a new spotter data
553
+	 *
554
+	 * @param String $flightaware_id the ID from flightaware
555
+	 * @param String $ident the flight ident
556
+	 * @param String $aircraft_icao the aircraft type
557
+	 * @param String $departure_airport_icao the departure airport
558
+	 * @param String $arrival_airport_icao the arrival airport
559
+	 * @param String $latitude latitude of flight
560
+	 * @param String $longitude latitude of flight
561
+	 * @param String $waypoints waypoints of flight
562
+	 * @param String $heading heading of flight
563
+	 * @param String $groundspeed speed of flight
564
+	 * @param String $date date of flight
565
+	 * @param String $departure_airport_time departure time of flight
566
+	 * @param String $arrival_airport_time arrival time of flight
567
+	 * @param String $squawk squawk code of flight
568
+	 * @param String $route_stop route stop of flight
569
+	 * @param String $highlight highlight or not
570
+	 * @param String $ModeS ModesS code of flight
571
+	 * @param String $registration registration code of flight
572
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
573
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
574
+	 * @param String $verticalrate vertival rate of flight
575
+	 * @return String success or false
576
+	 */
577 577
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$status = '',$format_source = '', $source_name = '')
578 578
 	{
579 579
 		global $globalURL;
@@ -657,16 +657,16 @@  discard block
 block discarded – undo
657 657
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
658 658
 		$status = filter_var($status,FILTER_SANITIZE_STRING);
659 659
 	
660
-                if ($latitude == '' && $longitude == '') {
661
-            		$latitude = 0;
662
-            		$longitude = 0;
663
-            	}
664
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
665
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
666
-                $query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status) 
660
+				if ($latitude == '' && $longitude == '') {
661
+					$latitude = 0;
662
+					$longitude = 0;
663
+				}
664
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
665
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
666
+				$query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status) 
667 667
                 VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status)";
668 668
 
669
-                $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':status' => $status);
669
+				$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':status' => $status);
670 670
 
671 671
 		try {
672 672
 		        
@@ -674,7 +674,7 @@  discard block
 block discarded – undo
674 674
 			$sth->execute($query_values);
675 675
 			$this->db = null;
676 676
 		} catch (PDOException $e) {
677
-		    return "error : ".$e->getMessage();
677
+			return "error : ".$e->getMessage();
678 678
 		}
679 679
 		
680 680
 		return "success";
@@ -683,11 +683,11 @@  discard block
 block discarded – undo
683 683
 	
684 684
   
685 685
 	/**
686
-	* Gets the aircraft ident within the last hour
687
-	*
688
-	* @return String the ident
689
-	*
690
-	*/
686
+	 * Gets the aircraft ident within the last hour
687
+	 *
688
+	 * @return String the ident
689
+	 *
690
+	 */
691 691
 	public function getIdentFromLastHour($ident)
692 692
 	{
693 693
 		global $globalDBdriver, $globalTimezone;
@@ -703,11 +703,11 @@  discard block
 block discarded – undo
703 703
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
704 704
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
705 705
 			$query_data = array(':ident' => $ident);
706
-    		}
706
+			}
707 707
 		
708 708
 		$sth = $this->db->prepare($query);
709 709
 		$sth->execute($query_data);
710
-    		$ident_result='';
710
+			$ident_result='';
711 711
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
712 712
 		{
713 713
 			$ident_result = $row['ident'];
@@ -718,11 +718,11 @@  discard block
 block discarded – undo
718 718
 	
719 719
 	
720 720
 	/**
721
-	* Gets the aircraft data from the last 20 seconds
722
-	*
723
-	* @return Array the spotter data
724
-	*
725
-	*/
721
+	 * Gets the aircraft data from the last 20 seconds
722
+	 *
723
+	 * @return Array the spotter data
724
+	 *
725
+	 */
726 726
 	public function getRealTimeData($q = '')
727 727
 	{
728 728
 		global $globalDBdriver;
@@ -760,11 +760,11 @@  discard block
 block discarded – undo
760 760
 	
761 761
 
762 762
 	/**
763
-	* Gets all number of flight over countries
764
-	*
765
-	* @return Array the airline country list
766
-	*
767
-	*/
763
+	 * Gets all number of flight over countries
764
+	 *
765
+	 * @return Array the airline country list
766
+	 *
767
+	 */
768 768
 /*
769 769
 	public function countAllTrackedOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
770 770
 	{
@@ -815,11 +815,11 @@  discard block
 block discarded – undo
815 815
 	
816 816
 	
817 817
 	/**
818
-	* Gets all callsigns that have flown over
819
-	*
820
-	* @return Array the callsign list
821
-	*
822
-	*/
818
+	 * Gets all callsigns that have flown over
819
+	 *
820
+	 * @return Array the callsign list
821
+	 *
822
+	 */
823 823
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
824 824
 	{
825 825
 		global $globalDBdriver;
@@ -886,11 +886,11 @@  discard block
 block discarded – undo
886 886
 
887 887
 
888 888
 	/**
889
-	* Counts all dates
890
-	*
891
-	* @return Array the date list
892
-	*
893
-	*/
889
+	 * Counts all dates
890
+	 *
891
+	 * @return Array the date list
892
+	 *
893
+	 */
894 894
 	public function countAllDates($filters = array())
895 895
 	{
896 896
 		global $globalTimezone, $globalDBdriver;
@@ -936,11 +936,11 @@  discard block
 block discarded – undo
936 936
 	
937 937
 	
938 938
 	/**
939
-	* Counts all dates during the last 7 days
940
-	*
941
-	* @return Array the date list
942
-	*
943
-	*/
939
+	 * Counts all dates during the last 7 days
940
+	 *
941
+	 * @return Array the date list
942
+	 *
943
+	 */
944 944
 	public function countAllDatesLast7Days($filters = array())
945 945
 	{
946 946
 		global $globalTimezone, $globalDBdriver;
@@ -962,7 +962,7 @@  discard block
 block discarded – undo
962 962
 			$query .= " GROUP BY date_name 
963 963
 								ORDER BY date_name ASC";
964 964
 			$query_data = array(':offset' => $offset);
965
-    		}
965
+			}
966 966
 		
967 967
 		$sth = $this->db->prepare($query);
968 968
 		$sth->execute($query_data);
@@ -982,11 +982,11 @@  discard block
 block discarded – undo
982 982
 	}
983 983
 
984 984
 	/**
985
-	* Counts all dates during the last month
986
-	*
987
-	* @return Array the date list
988
-	*
989
-	*/
985
+	 * Counts all dates during the last month
986
+	 *
987
+	 * @return Array the date list
988
+	 *
989
+	 */
990 990
 	public function countAllDatesLastMonth($filters = array())
991 991
 	{
992 992
 		global $globalTimezone, $globalDBdriver;
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
 			$query .= " GROUP BY date_name 
1009 1009
 								ORDER BY date_name ASC";
1010 1010
 			$query_data = array(':offset' => $offset);
1011
-    		}
1011
+			}
1012 1012
 		
1013 1013
 		$sth = $this->db->prepare($query);
1014 1014
 		$sth->execute($query_data);
@@ -1030,11 +1030,11 @@  discard block
 block discarded – undo
1030 1030
 
1031 1031
 
1032 1032
 	/**
1033
-	* Counts all month
1034
-	*
1035
-	* @return Array the month list
1036
-	*
1037
-	*/
1033
+	 * Counts all month
1034
+	 *
1035
+	 * @return Array the month list
1036
+	 *
1037
+	 */
1038 1038
 	public function countAllMonths($filters = array())
1039 1039
 	{
1040 1040
 		global $globalTimezone, $globalDBdriver;
@@ -1079,11 +1079,11 @@  discard block
 block discarded – undo
1079 1079
 	
1080 1080
 
1081 1081
 	/**
1082
-	* Counts all dates during the last year
1083
-	*
1084
-	* @return Array the date list
1085
-	*
1086
-	*/
1082
+	 * Counts all dates during the last year
1083
+	 *
1084
+	 * @return Array the date list
1085
+	 *
1086
+	 */
1087 1087
 	public function countAllMonthsLastYear($filters)
1088 1088
 	{
1089 1089
 		global $globalTimezone, $globalDBdriver;
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 			$query .= " GROUP BY year_name, month_name
1106 1106
 								ORDER BY year_name, month_name ASC";
1107 1107
 			$query_data = array(':offset' => $offset);
1108
-    		}
1108
+			}
1109 1109
 		
1110 1110
 		$sth = $this->db->prepare($query);
1111 1111
 		$sth->execute($query_data);
@@ -1128,11 +1128,11 @@  discard block
 block discarded – undo
1128 1128
 	
1129 1129
 	
1130 1130
 	/**
1131
-	* Counts all hours
1132
-	*
1133
-	* @return Array the hour list
1134
-	*
1135
-	*/
1131
+	 * Counts all hours
1132
+	 *
1133
+	 * @return Array the hour list
1134
+	 *
1135
+	 */
1136 1136
 	public function countAllHours($orderby,$filters = array())
1137 1137
 	{
1138 1138
 		global $globalTimezone, $globalDBdriver;
@@ -1195,11 +1195,11 @@  discard block
 block discarded – undo
1195 1195
 	
1196 1196
 	
1197 1197
 	/**
1198
-	* Counts all hours by date
1199
-	*
1200
-	* @return Array the hour list
1201
-	*
1202
-	*/
1198
+	 * Counts all hours by date
1199
+	 *
1200
+	 * @return Array the hour list
1201
+	 *
1202
+	 */
1203 1203
 	public function countAllHoursByDate($date, $filters = array())
1204 1204
 	{
1205 1205
 		global $globalTimezone, $globalDBdriver;
@@ -1243,11 +1243,11 @@  discard block
 block discarded – undo
1243 1243
 	
1244 1244
 	
1245 1245
 	/**
1246
-	* Counts all hours by a ident/callsign
1247
-	*
1248
-	* @return Array the hour list
1249
-	*
1250
-	*/
1246
+	 * Counts all hours by a ident/callsign
1247
+	 *
1248
+	 * @return Array the hour list
1249
+	 *
1250
+	 */
1251 1251
 	public function countAllHoursByIdent($ident, $filters = array())
1252 1252
 	{
1253 1253
 		global $globalTimezone, $globalDBdriver;
@@ -1292,11 +1292,11 @@  discard block
 block discarded – undo
1292 1292
 	
1293 1293
 	
1294 1294
 	/**
1295
-	* Counts all flights that have flown over
1296
-	*
1297
-	* @return Integer the number of flights
1298
-	*
1299
-	*/
1295
+	 * Counts all flights that have flown over
1296
+	 *
1297
+	 * @return Integer the number of flights
1298
+	 *
1299
+	 */
1300 1300
 	public function countOverallTracked($filters = array(),$year = '',$month = '')
1301 1301
 	{
1302 1302
 		global $globalDBdriver;
@@ -1331,11 +1331,11 @@  discard block
 block discarded – undo
1331 1331
 	
1332 1332
   
1333 1333
 	/**
1334
-	* Counts all hours of today
1335
-	*
1336
-	* @return Array the hour list
1337
-	*
1338
-	*/
1334
+	 * Counts all hours of today
1335
+	 *
1336
+	 * @return Array the hour list
1337
+	 *
1338
+	 */
1339 1339
 	public function countAllHoursFromToday($filters = array())
1340 1340
 	{
1341 1341
 		global $globalTimezone, $globalDBdriver;
@@ -1375,12 +1375,12 @@  discard block
 block discarded – undo
1375 1375
 	}
1376 1376
     
1377 1377
     
1378
-     /**
1379
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1380
-	*
1381
-	* @return Integer the Barrie Spotter ID
1378
+	 /**
1379
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1380
+	  *
1381
+	  * @return Integer the Barrie Spotter ID
1382 1382
 q	*
1383
-	*/
1383
+	  */
1384 1384
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1385 1385
 	{
1386 1386
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1401,13 +1401,13 @@  discard block
 block discarded – undo
1401 1401
   
1402 1402
  
1403 1403
 	/**
1404
-	* Parses a date string
1405
-	*
1406
-	* @param String $dateString the date string
1407
-	* @param String $timezone the timezone of a user
1408
-	* @return Array the time information
1409
-	*
1410
-	*/
1404
+	 * Parses a date string
1405
+	 *
1406
+	 * @param String $dateString the date string
1407
+	 * @param String $timezone the timezone of a user
1408
+	 * @return Array the time information
1409
+	 *
1410
+	 */
1411 1411
 	public function parseDateString($dateString, $timezone = '')
1412 1412
 	{
1413 1413
 		$time_array = array();
@@ -1440,12 +1440,12 @@  discard block
 block discarded – undo
1440 1440
 	}
1441 1441
 	
1442 1442
 	/**
1443
-	* Parses the direction degrees to working
1444
-	*
1445
-	* @param Float $direction the direction in degrees
1446
-	* @return Array the direction information
1447
-	*
1448
-	*/
1443
+	 * Parses the direction degrees to working
1444
+	 *
1445
+	 * @param Float $direction the direction in degrees
1446
+	 * @return Array the direction information
1447
+	 *
1448
+	 */
1449 1449
 	public function parseDirection($direction = 0)
1450 1450
 	{
1451 1451
 		if ($direction == '') $direction = 0;
@@ -1524,12 +1524,12 @@  discard block
 block discarded – undo
1524 1524
 	
1525 1525
 	
1526 1526
 	/**
1527
-	* Gets Country from latitude/longitude
1528
-	*
1529
-	* @param Float $latitude latitute of the flight
1530
-	* @param Float $longitude longitute of the flight
1531
-	* @return String the countrie
1532
-	*/
1527
+	 * Gets Country from latitude/longitude
1528
+	 *
1529
+	 * @param Float $latitude latitute of the flight
1530
+	 * @param Float $longitude longitute of the flight
1531
+	 * @return String the countrie
1532
+	 */
1533 1533
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1534 1534
 	{
1535 1535
 		global $globalDBdriver, $globalDebug;
@@ -1566,11 +1566,11 @@  discard block
 block discarded – undo
1566 1566
 	}
1567 1567
 
1568 1568
 	/**
1569
-	* Gets Country from iso2
1570
-	*
1571
-	* @param String $iso2 ISO2 country code
1572
-	* @return String the countrie
1573
-	*/
1569
+	 * Gets Country from iso2
1570
+	 *
1571
+	 * @param String $iso2 ISO2 country code
1572
+	 * @return String the countrie
1573
+	 */
1574 1574
 	public function getCountryFromISO2($iso2)
1575 1575
 	{
1576 1576
 		global $globalDBdriver, $globalDebug;
@@ -1599,12 +1599,12 @@  discard block
 block discarded – undo
1599 1599
 
1600 1600
 	
1601 1601
 	/**
1602
-	* Gets the short url from bit.ly
1603
-	*
1604
-	* @param String $url the full url
1605
-	* @return String the bit.ly url
1606
-	*
1607
-	*/
1602
+	 * Gets the short url from bit.ly
1603
+	 *
1604
+	 * @param String $url the full url
1605
+	 * @return String the bit.ly url
1606
+	 *
1607
+	 */
1608 1608
 	public function getBitlyURL($url)
1609 1609
 	{
1610 1610
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.
require/class.MarineLive.php 2 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;
@@ -762,10 +762,6 @@  discard block
 block discarded – undo
762 762
 	*
763 763
 	* @param String $fammarine_id the ID from flightaware
764 764
 	* @param String $ident the flight ident
765
-	* @param String $aircraft_icao the aircraft type
766
-	* @param String $departure_airport_icao the departure airport
767
-	* @param String $arrival_airport_icao the arrival airport
768
-	* @return String success or false
769 765
 	*
770 766
 	*/
771 767
 	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$status = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
Please login to merge, or discard this patch.
Indentation   +186 added lines, -186 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 	/**
89
-	* Gets all the spotter information based on the latest data entry
90
-	*
91
-	* @return Array the spotter information
92
-	*
93
-	*/
89
+	 * Gets all the spotter information based on the latest data entry
90
+	 *
91
+	 * @return Array the spotter information
92
+	 *
93
+	 */
94 94
 	public function getLiveMarineData($limit = '', $sort = '', $filter = array())
95 95
 	{
96 96
 		global $globalDBdriver, $globalLiveInterval;
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	}
133 133
 
134 134
 	/**
135
-	* Gets Minimal Live Spotter data
136
-	*
137
-	* @return Array the spotter information
138
-	*
139
-	*/
135
+	 * Gets Minimal Live Spotter data
136
+	 *
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getMinLiveMarineData($filter = array())
141 141
 	{
142 142
 		global $globalDBdriver, $globalLiveInterval;
@@ -166,11 +166,11 @@  discard block
 block discarded – undo
166 166
 	}
167 167
 
168 168
 	/**
169
-	* Gets Minimal Live Spotter data since xx seconds
170
-	*
171
-	* @return Array the spotter information
172
-	*
173
-	*/
169
+	 * Gets Minimal Live Spotter data since xx seconds
170
+	 *
171
+	 * @return Array the spotter information
172
+	 *
173
+	 */
174 174
 	public function getMinLastLiveMarineData($filter = array())
175 175
 	{
176 176
 		global $globalDBdriver, $globalLiveInterval;
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
 			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
184 184
 			FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
185 185
 			ORDER BY marine_live.fammarine_id, marine_live.date";
186
-                } else {
186
+				} else {
187 187
 			$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
188 188
 			FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
189 189
 			ORDER BY marine_live.fammarine_id, marine_live.date";
190 190
 		}
191 191
 
192
-    		try {
192
+			try {
193 193
 			$sth = $this->db->prepare($query);
194 194
 			$sth->execute();
195 195
 		} catch(PDOException $e) {
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 	}
202 202
 
203 203
 	/**
204
-	* Gets number of latest data entry
205
-	*
206
-	* @return String number of entry
207
-	*
208
-	*/
204
+	 * Gets number of latest data entry
205
+	 *
206
+	 * @return String number of entry
207
+	 *
208
+	 */
209 209
 	public function getLiveMarineCount($filter = array())
210 210
 	{
211 211
 		global $globalDBdriver, $globalLiveInterval;
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 
232 232
 	/**
233
-	* Gets all the spotter information based on the latest data entry and coord
234
-	*
235
-	* @return Array the spotter information
236
-	*
237
-	*/
233
+	 * Gets all the spotter information based on the latest data entry and coord
234
+	 *
235
+	 * @return Array the spotter information
236
+	 *
237
+	 */
238 238
 	public function getLiveMarineDatabyCoord($coord, $filter = array())
239 239
 	{
240 240
 		global $globalDBdriver, $globalLiveInterval;
@@ -258,11 +258,11 @@  discard block
 block discarded – undo
258 258
 	}
259 259
 
260 260
 	/**
261
-	* Gets all the spotter information based on a user's latitude and longitude
262
-	*
263
-	* @return Array the spotter information
264
-	*
265
-	*/
261
+	 * Gets all the spotter information based on a user's latitude and longitude
262
+	 *
263
+	 * @return Array the spotter information
264
+	 *
265
+	 */
266 266
 	public function getLatestMarineForLayar($lat, $lng, $radius, $interval)
267 267
 	{
268 268
 		$Marine = new Marine($this->db);
@@ -275,134 +275,134 @@  discard block
 block discarded – undo
275 275
 		if ($lng != '')
276 276
 		{
277 277
 			if (!is_numeric($lng))
278
-                        {
279
-                                return false;
280
-                        }
281
-                }
282
-
283
-                if ($radius != '')
284
-                {
285
-                        if (!is_numeric($radius))
286
-                        {
287
-                                return false;
288
-                        }
289
-                }
278
+						{
279
+								return false;
280
+						}
281
+				}
282
+
283
+				if ($radius != '')
284
+				{
285
+						if (!is_numeric($radius))
286
+						{
287
+								return false;
288
+						}
289
+				}
290 290
 		$additional_query = '';
291 291
 		if ($interval != '')
292
-                {
293
-                        if (!is_string($interval))
294
-                        {
295
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
296
-			        return false;
297
-                        } else {
298
-                if ($interval == '1m')
299
-                {
300
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
301
-                } else if ($interval == '15m'){
302
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
303
-                } 
304
-            }
305
-                } else {
306
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
307
-        }
308
-
309
-                $query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
292
+				{
293
+						if (!is_string($interval))
294
+						{
295
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
296
+					return false;
297
+						} else {
298
+				if ($interval == '1m')
299
+				{
300
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
301
+				} else if ($interval == '15m'){
302
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
303
+				} 
304
+			}
305
+				} else {
306
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
307
+		}
308
+
309
+				$query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
310 310
                    WHERE marine_live.latitude <> '' 
311 311
                                    AND marine_live.longitude <> '' 
312 312
                    ".$additional_query."
313 313
                    HAVING distance < :radius  
314 314
                                    ORDER BY distance";
315 315
 
316
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
316
+				$spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
317 317
 
318
-                return $spotter_array;
319
-        }
318
+				return $spotter_array;
319
+		}
320 320
 
321 321
     
322
-        /**
323
-	* Gets all the spotter information based on a particular callsign
324
-	*
325
-	* @return Array the spotter information
326
-	*
327
-	*/
322
+		/**
323
+		 * Gets all the spotter information based on a particular callsign
324
+		 *
325
+		 * @return Array the spotter information
326
+		 *
327
+		 */
328 328
 	public function getLastLiveMarineDataByIdent($ident)
329 329
 	{
330 330
 		$Marine = new Marine($this->db);
331 331
 		date_default_timezone_set('UTC');
332 332
 
333 333
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
334
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
334
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
335 335
 
336 336
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
337 337
 
338 338
 		return $spotter_array;
339 339
 	}
340 340
 
341
-        /**
342
-	* Gets all the spotter information based on a particular callsign
343
-	*
344
-	* @return Array the spotter information
345
-	*
346
-	*/
341
+		/**
342
+		 * Gets all the spotter information based on a particular callsign
343
+		 *
344
+		 * @return Array the spotter information
345
+		 *
346
+		 */
347 347
 	public function getDateLiveMarineDataByIdent($ident,$date)
348 348
 	{
349 349
 		$Marine = new Marine($this->db);
350 350
 		date_default_timezone_set('UTC');
351 351
 
352 352
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
353
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
353
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
354 354
 
355
-                $date = date('c',$date);
355
+				$date = date('c',$date);
356 356
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
357 357
 
358 358
 		return $spotter_array;
359 359
 	}
360 360
 
361
-        /**
362
-	* Gets last spotter information based on a particular callsign
363
-	*
364
-	* @return Array the spotter information
365
-	*
366
-	*/
361
+		/**
362
+		 * Gets last spotter information based on a particular callsign
363
+		 *
364
+		 * @return Array the spotter information
365
+		 *
366
+		 */
367 367
 	public function getLastLiveMarineDataById($id)
368 368
 	{
369 369
 		$Marine = new Marine($this->db);
370 370
 		date_default_timezone_set('UTC');
371 371
 
372 372
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
373
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
373
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
374 374
 
375 375
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
376 376
 
377 377
 		return $spotter_array;
378 378
 	}
379 379
 
380
-        /**
381
-	* Gets last spotter information based on a particular callsign
382
-	*
383
-	* @return Array the spotter information
384
-	*
385
-	*/
380
+		/**
381
+		 * Gets last spotter information based on a particular callsign
382
+		 *
383
+		 * @return Array the spotter information
384
+		 *
385
+		 */
386 386
 	public function getDateLiveMarineDataById($id,$date)
387 387
 	{
388 388
 		$Marine = new Marine($this->db);
389 389
 		date_default_timezone_set('UTC');
390 390
 
391 391
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
392
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
393
-                $date = date('c',$date);
392
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
393
+				$date = date('c',$date);
394 394
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
395 395
 
396 396
 		return $spotter_array;
397 397
 	}
398 398
 
399 399
 
400
-        /**
401
-	* Gets all the spotter information based on a particular id
402
-	*
403
-	* @return Array the spotter information
404
-	*
405
-	*/
400
+		/**
401
+		 * Gets all the spotter information based on a particular id
402
+		 *
403
+		 * @return Array the spotter information
404
+		 *
405
+		 */
406 406
 	public function getAllLiveMarineDataById($id,$liveinterval = false)
407 407
 	{
408 408
 		global $globalDBdriver, $globalLiveInterval;
@@ -430,18 +430,18 @@  discard block
 block discarded – undo
430 430
 		return $spotter_array;
431 431
 	}
432 432
 
433
-        /**
434
-	* Gets all the spotter information based on a particular ident
435
-	*
436
-	* @return Array the spotter information
437
-	*
438
-	*/
433
+		/**
434
+		 * Gets all the spotter information based on a particular ident
435
+		 *
436
+		 * @return Array the spotter information
437
+		 *
438
+		 */
439 439
 	public function getAllLiveMarineDataByIdent($ident)
440 440
 	{
441 441
 		date_default_timezone_set('UTC');
442 442
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
443 443
 		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
444
-    		try {
444
+			try {
445 445
 			
446 446
 			$sth = $this->db->prepare($query);
447 447
 			$sth->execute(array(':ident' => $ident));
@@ -455,23 +455,23 @@  discard block
 block discarded – undo
455 455
 
456 456
 
457 457
 	/**
458
-	* Deletes all info in the table
459
-	*
460
-	* @return String success or false
461
-	*
462
-	*/
458
+	 * Deletes all info in the table
459
+	 *
460
+	 * @return String success or false
461
+	 *
462
+	 */
463 463
 	public function deleteLiveMarineData()
464 464
 	{
465 465
 		global $globalDBdriver;
466 466
 		if ($globalDBdriver == 'mysql') {
467 467
 			//$query  = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date";
468 468
 			$query  = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date';
469
-            		//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
469
+					//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
470 470
 		} else {
471 471
 			$query  = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date";
472 472
 		}
473 473
         
474
-    		try {
474
+			try {
475 475
 			
476 476
 			$sth = $this->db->prepare($query);
477 477
 			$sth->execute();
@@ -483,18 +483,18 @@  discard block
 block discarded – undo
483 483
 	}
484 484
 
485 485
 	/**
486
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
487
-	*
488
-	* @return String success or false
489
-	*
490
-	*/
486
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
487
+	 *
488
+	 * @return String success or false
489
+	 *
490
+	 */
491 491
 	public function deleteLiveMarineDataNotUpdated()
492 492
 	{
493 493
 		global $globalDBdriver, $globalDebug;
494 494
 		if ($globalDBdriver == 'mysql') {
495 495
 			//$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0';
496
-    			$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
497
-    			try {
496
+				$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
497
+				try {
498 498
 				
499 499
 				$sth = $this->db->prepare($query);
500 500
 				$sth->execute();
@@ -502,8 +502,8 @@  discard block
 block discarded – undo
502 502
 				return "error";
503 503
 			}
504 504
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
505
-                        $i = 0;
506
-                        $j =0;
505
+						$i = 0;
506
+						$j =0;
507 507
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
508 508
 			foreach($all as $row)
509 509
 			{
@@ -511,20 +511,20 @@  discard block
 block discarded – undo
511 511
 				$j++;
512 512
 				if ($j == 30) {
513 513
 					if ($globalDebug) echo ".";
514
-				    	try {
514
+						try {
515 515
 						
516 516
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
517 517
 						$sth->execute();
518 518
 					} catch(PDOException $e) {
519 519
 						return "error";
520 520
 					}
521
-                                	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
522
-                                	$j = 0;
521
+									$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
522
+									$j = 0;
523 523
 				}
524 524
 				$query_delete .= "'".$row['fammarine_id']."',";
525 525
 			}
526 526
 			if ($i > 0) {
527
-    				try {
527
+					try {
528 528
 					
529 529
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
530 530
 					$sth->execute();
@@ -535,9 +535,9 @@  discard block
 block discarded – undo
535 535
 			return "success";
536 536
 		} elseif ($globalDBdriver == 'pgsql') {
537 537
 			//$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0";
538
-    			//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
539
-    			$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
540
-    			try {
538
+				//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
539
+				$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
540
+				try {
541 541
 				
542 542
 				$sth = $this->db->prepare($query);
543 543
 				$sth->execute();
@@ -581,17 +581,17 @@  discard block
 block discarded – undo
581 581
 	}
582 582
 
583 583
 	/**
584
-	* Deletes all info in the table for an ident
585
-	*
586
-	* @return String success or false
587
-	*
588
-	*/
584
+	 * Deletes all info in the table for an ident
585
+	 *
586
+	 * @return String success or false
587
+	 *
588
+	 */
589 589
 	public function deleteLiveMarineDataByIdent($ident)
590 590
 	{
591 591
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
592 592
 		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
593 593
         
594
-    		try {
594
+			try {
595 595
 			
596 596
 			$sth = $this->db->prepare($query);
597 597
 			$sth->execute(array(':ident' => $ident));
@@ -603,17 +603,17 @@  discard block
 block discarded – undo
603 603
 	}
604 604
 
605 605
 	/**
606
-	* Deletes all info in the table for an id
607
-	*
608
-	* @return String success or false
609
-	*
610
-	*/
606
+	 * Deletes all info in the table for an id
607
+	 *
608
+	 * @return String success or false
609
+	 *
610
+	 */
611 611
 	public function deleteLiveMarineDataById($id)
612 612
 	{
613 613
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
614 614
 		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
615 615
         
616
-    		try {
616
+			try {
617 617
 			
618 618
 			$sth = $this->db->prepare($query);
619 619
 			$sth->execute(array(':id' => $id));
@@ -626,11 +626,11 @@  discard block
 block discarded – undo
626 626
 
627 627
 
628 628
 	/**
629
-	* Gets the aircraft ident within the last hour
630
-	*
631
-	* @return String the ident
632
-	*
633
-	*/
629
+	 * Gets the aircraft ident within the last hour
630
+	 *
631
+	 * @return String the ident
632
+	 *
633
+	 */
634 634
 	public function getIdentFromLastHour($ident)
635 635
 	{
636 636
 		global $globalDBdriver, $globalTimezone;
@@ -656,14 +656,14 @@  discard block
 block discarded – undo
656 656
 			$ident_result = $row['ident'];
657 657
 		}
658 658
 		return $ident_result;
659
-        }
659
+		}
660 660
 
661 661
 	/**
662
-	* Check recent aircraft
663
-	*
664
-	* @return String the ident
665
-	*
666
-	*/
662
+	 * Check recent aircraft
663
+	 *
664
+	 * @return String the ident
665
+	 *
666
+	 */
667 667
 	public function checkIdentRecent($ident)
668 668
 	{
669 669
 		global $globalDBdriver, $globalTimezone;
@@ -689,14 +689,14 @@  discard block
 block discarded – undo
689 689
 			$ident_result = $row['fammarine_id'];
690 690
 		}
691 691
 		return $ident_result;
692
-        }
692
+		}
693 693
 
694 694
 	/**
695
-	* Check recent aircraft by id
696
-	*
697
-	* @return String the ident
698
-	*
699
-	*/
695
+	 * Check recent aircraft by id
696
+	 *
697
+	 * @return String the ident
698
+	 *
699
+	 */
700 700
 	public function checkIdRecent($id)
701 701
 	{
702 702
 		global $globalDBdriver, $globalTimezone;
@@ -722,14 +722,14 @@  discard block
 block discarded – undo
722 722
 			$ident_result = $row['fammarine_id'];
723 723
 		}
724 724
 		return $ident_result;
725
-        }
725
+		}
726 726
 
727 727
 	/**
728
-	* Check recent aircraft by mmsi
729
-	*
730
-	* @return String the ident
731
-	*
732
-	*/
728
+	 * Check recent aircraft by mmsi
729
+	 *
730
+	 * @return String the ident
731
+	 *
732
+	 */
733 733
 	public function checkMMSIRecent($mmsi)
734 734
 	{
735 735
 		global $globalDBdriver, $globalTimezone;
@@ -755,19 +755,19 @@  discard block
 block discarded – undo
755 755
 			$ident_result = $row['fammarine_id'];
756 756
 		}
757 757
 		return $ident_result;
758
-        }
758
+		}
759 759
 
760 760
 	/**
761
-	* Adds a new spotter data
762
-	*
763
-	* @param String $fammarine_id the ID from flightaware
764
-	* @param String $ident the flight ident
765
-	* @param String $aircraft_icao the aircraft type
766
-	* @param String $departure_airport_icao the departure airport
767
-	* @param String $arrival_airport_icao the arrival airport
768
-	* @return String success or false
769
-	*
770
-	*/
761
+	 * Adds a new spotter data
762
+	 *
763
+	 * @param String $fammarine_id the ID from flightaware
764
+	 * @param String $ident the flight ident
765
+	 * @param String $aircraft_icao the aircraft type
766
+	 * @param String $departure_airport_icao the departure airport
767
+	 * @param String $arrival_airport_icao the arrival airport
768
+	 * @return String success or false
769
+	 *
770
+	 */
771 771
 	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$status = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
772 772
 	{
773 773
 		global $globalURL, $globalArchive, $globalDebug;
@@ -833,8 +833,8 @@  discard block
 block discarded – undo
833 833
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
834 834
 		$status = filter_var($status,FILTER_SANITIZE_STRING);
835 835
 
836
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
837
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
836
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
837
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
838 838
             	
839 839
 		$query  = 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status) 
840 840
 		VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:status)';
@@ -844,9 +844,9 @@  discard block
 block discarded – undo
844 844
 			
845 845
 			$sth = $this->db->prepare($query);
846 846
 			$sth->execute($query_values);
847
-                } catch(PDOException $e) {
848
-                	return "error : ".$e->getMessage();
849
-                }
847
+				} catch(PDOException $e) {
848
+					return "error : ".$e->getMessage();
849
+				}
850 850
 		/*
851 851
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
852 852
 		    if ($globalDebug) echo '(Add to SBS archive : ';
Please login to merge, or discard this patch.
require/class.Tracker.php 2 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   +195 added lines, -195 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 countAllTrackedOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
756 756
 	{
@@ -801,11 +801,11 @@  discard block
 block discarded – undo
801 801
 	
802 802
 	
803 803
 	/**
804
-	* Gets all callsigns that have flown over
805
-	*
806
-	* @return Array the callsign list
807
-	*
808
-	*/
804
+	 * Gets all callsigns that have flown over
805
+	 *
806
+	 * @return Array the callsign list
807
+	 *
808
+	 */
809 809
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
810 810
 	{
811 811
 		global $globalDBdriver;
@@ -872,11 +872,11 @@  discard block
 block discarded – undo
872 872
 
873 873
 
874 874
 	/**
875
-	* Counts all dates
876
-	*
877
-	* @return Array the date list
878
-	*
879
-	*/
875
+	 * Counts all dates
876
+	 *
877
+	 * @return Array the date list
878
+	 *
879
+	 */
880 880
 	public function countAllDates($filters = array())
881 881
 	{
882 882
 		global $globalTimezone, $globalDBdriver;
@@ -922,11 +922,11 @@  discard block
 block discarded – undo
922 922
 	
923 923
 	
924 924
 	/**
925
-	* Counts all dates during the last 7 days
926
-	*
927
-	* @return Array the date list
928
-	*
929
-	*/
925
+	 * Counts all dates during the last 7 days
926
+	 *
927
+	 * @return Array the date list
928
+	 *
929
+	 */
930 930
 	public function countAllDatesLast7Days($filters = array())
931 931
 	{
932 932
 		global $globalTimezone, $globalDBdriver;
@@ -948,7 +948,7 @@  discard block
 block discarded – undo
948 948
 			$query .= " GROUP BY date_name 
949 949
 								ORDER BY date_name ASC";
950 950
 			$query_data = array(':offset' => $offset);
951
-    		}
951
+			}
952 952
 		
953 953
 		$sth = $this->db->prepare($query);
954 954
 		$sth->execute($query_data);
@@ -968,11 +968,11 @@  discard block
 block discarded – undo
968 968
 	}
969 969
 
970 970
 	/**
971
-	* Counts all dates during the last month
972
-	*
973
-	* @return Array the date list
974
-	*
975
-	*/
971
+	 * Counts all dates during the last month
972
+	 *
973
+	 * @return Array the date list
974
+	 *
975
+	 */
976 976
 	public function countAllDatesLastMonth($filters = array())
977 977
 	{
978 978
 		global $globalTimezone, $globalDBdriver;
@@ -994,7 +994,7 @@  discard block
 block discarded – undo
994 994
 			$query .= " GROUP BY date_name 
995 995
 								ORDER BY date_name ASC";
996 996
 			$query_data = array(':offset' => $offset);
997
-    		}
997
+			}
998 998
 		
999 999
 		$sth = $this->db->prepare($query);
1000 1000
 		$sth->execute($query_data);
@@ -1016,11 +1016,11 @@  discard block
 block discarded – undo
1016 1016
 
1017 1017
 
1018 1018
 	/**
1019
-	* Counts all month
1020
-	*
1021
-	* @return Array the month list
1022
-	*
1023
-	*/
1019
+	 * Counts all month
1020
+	 *
1021
+	 * @return Array the month list
1022
+	 *
1023
+	 */
1024 1024
 	public function countAllMonths($filters = array())
1025 1025
 	{
1026 1026
 		global $globalTimezone, $globalDBdriver;
@@ -1065,11 +1065,11 @@  discard block
 block discarded – undo
1065 1065
 	
1066 1066
 
1067 1067
 	/**
1068
-	* Counts all dates during the last year
1069
-	*
1070
-	* @return Array the date list
1071
-	*
1072
-	*/
1068
+	 * Counts all dates during the last year
1069
+	 *
1070
+	 * @return Array the date list
1071
+	 *
1072
+	 */
1073 1073
 	public function countAllMonthsLastYear($filters)
1074 1074
 	{
1075 1075
 		global $globalTimezone, $globalDBdriver;
@@ -1091,7 +1091,7 @@  discard block
 block discarded – undo
1091 1091
 			$query .= " GROUP BY year_name, month_name
1092 1092
 								ORDER BY year_name, month_name ASC";
1093 1093
 			$query_data = array(':offset' => $offset);
1094
-    		}
1094
+			}
1095 1095
 		
1096 1096
 		$sth = $this->db->prepare($query);
1097 1097
 		$sth->execute($query_data);
@@ -1114,11 +1114,11 @@  discard block
 block discarded – undo
1114 1114
 	
1115 1115
 	
1116 1116
 	/**
1117
-	* Counts all hours
1118
-	*
1119
-	* @return Array the hour list
1120
-	*
1121
-	*/
1117
+	 * Counts all hours
1118
+	 *
1119
+	 * @return Array the hour list
1120
+	 *
1121
+	 */
1122 1122
 	public function countAllHours($orderby,$filters = array())
1123 1123
 	{
1124 1124
 		global $globalTimezone, $globalDBdriver;
@@ -1181,11 +1181,11 @@  discard block
 block discarded – undo
1181 1181
 	
1182 1182
 	
1183 1183
 	/**
1184
-	* Counts all hours by date
1185
-	*
1186
-	* @return Array the hour list
1187
-	*
1188
-	*/
1184
+	 * Counts all hours by date
1185
+	 *
1186
+	 * @return Array the hour list
1187
+	 *
1188
+	 */
1189 1189
 	public function countAllHoursByDate($date, $filters = array())
1190 1190
 	{
1191 1191
 		global $globalTimezone, $globalDBdriver;
@@ -1229,11 +1229,11 @@  discard block
 block discarded – undo
1229 1229
 	
1230 1230
 	
1231 1231
 	/**
1232
-	* Counts all hours by a ident/callsign
1233
-	*
1234
-	* @return Array the hour list
1235
-	*
1236
-	*/
1232
+	 * Counts all hours by a ident/callsign
1233
+	 *
1234
+	 * @return Array the hour list
1235
+	 *
1236
+	 */
1237 1237
 	public function countAllHoursByIdent($ident, $filters = array())
1238 1238
 	{
1239 1239
 		global $globalTimezone, $globalDBdriver;
@@ -1278,11 +1278,11 @@  discard block
 block discarded – undo
1278 1278
 	
1279 1279
 	
1280 1280
 	/**
1281
-	* Counts all flights that have flown over
1282
-	*
1283
-	* @return Integer the number of flights
1284
-	*
1285
-	*/
1281
+	 * Counts all flights that have flown over
1282
+	 *
1283
+	 * @return Integer the number of flights
1284
+	 *
1285
+	 */
1286 1286
 	public function countOverallTracked($filters = array(),$year = '',$month = '')
1287 1287
 	{
1288 1288
 		global $globalDBdriver;
@@ -1317,11 +1317,11 @@  discard block
 block discarded – undo
1317 1317
 	
1318 1318
   
1319 1319
 	/**
1320
-	* Counts all hours of today
1321
-	*
1322
-	* @return Array the hour list
1323
-	*
1324
-	*/
1320
+	 * Counts all hours of today
1321
+	 *
1322
+	 * @return Array the hour list
1323
+	 *
1324
+	 */
1325 1325
 	public function countAllHoursFromToday($filters = array())
1326 1326
 	{
1327 1327
 		global $globalTimezone, $globalDBdriver;
@@ -1361,12 +1361,12 @@  discard block
 block discarded – undo
1361 1361
 	}
1362 1362
     
1363 1363
     
1364
-     /**
1365
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1366
-	*
1367
-	* @return Integer the Barrie Spotter ID
1364
+	 /**
1365
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1366
+	  *
1367
+	  * @return Integer the Barrie Spotter ID
1368 1368
 q	*
1369
-	*/
1369
+	  */
1370 1370
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1371 1371
 	{
1372 1372
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -1387,13 +1387,13 @@  discard block
 block discarded – undo
1387 1387
   
1388 1388
  
1389 1389
 	/**
1390
-	* Parses a date string
1391
-	*
1392
-	* @param String $dateString the date string
1393
-	* @param String $timezone the timezone of a user
1394
-	* @return Array the time information
1395
-	*
1396
-	*/
1390
+	 * Parses a date string
1391
+	 *
1392
+	 * @param String $dateString the date string
1393
+	 * @param String $timezone the timezone of a user
1394
+	 * @return Array the time information
1395
+	 *
1396
+	 */
1397 1397
 	public function parseDateString($dateString, $timezone = '')
1398 1398
 	{
1399 1399
 		$time_array = array();
@@ -1426,12 +1426,12 @@  discard block
 block discarded – undo
1426 1426
 	}
1427 1427
 	
1428 1428
 	/**
1429
-	* Parses the direction degrees to working
1430
-	*
1431
-	* @param Float $direction the direction in degrees
1432
-	* @return Array the direction information
1433
-	*
1434
-	*/
1429
+	 * Parses the direction degrees to working
1430
+	 *
1431
+	 * @param Float $direction the direction in degrees
1432
+	 * @return Array the direction information
1433
+	 *
1434
+	 */
1435 1435
 	public function parseDirection($direction = 0)
1436 1436
 	{
1437 1437
 		if ($direction == '') $direction = 0;
@@ -1510,12 +1510,12 @@  discard block
 block discarded – undo
1510 1510
 	
1511 1511
 	
1512 1512
 	/**
1513
-	* Gets Country from latitude/longitude
1514
-	*
1515
-	* @param Float $latitude latitute of the flight
1516
-	* @param Float $longitude longitute of the flight
1517
-	* @return String the countrie
1518
-	*/
1513
+	 * Gets Country from latitude/longitude
1514
+	 *
1515
+	 * @param Float $latitude latitute of the flight
1516
+	 * @param Float $longitude longitute of the flight
1517
+	 * @return String the countrie
1518
+	 */
1519 1519
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1520 1520
 	{
1521 1521
 		global $globalDBdriver, $globalDebug;
@@ -1552,11 +1552,11 @@  discard block
 block discarded – undo
1552 1552
 	}
1553 1553
 
1554 1554
 	/**
1555
-	* Gets Country from iso2
1556
-	*
1557
-	* @param String $iso2 ISO2 country code
1558
-	* @return String the countrie
1559
-	*/
1555
+	 * Gets Country from iso2
1556
+	 *
1557
+	 * @param String $iso2 ISO2 country code
1558
+	 * @return String the countrie
1559
+	 */
1560 1560
 	public function getCountryFromISO2($iso2)
1561 1561
 	{
1562 1562
 		global $globalDBdriver, $globalDebug;
@@ -1585,12 +1585,12 @@  discard block
 block discarded – undo
1585 1585
 
1586 1586
 	
1587 1587
 	/**
1588
-	* Gets the short url from bit.ly
1589
-	*
1590
-	* @param String $url the full url
1591
-	* @return String the bit.ly url
1592
-	*
1593
-	*/
1588
+	 * Gets the short url from bit.ly
1589
+	 *
1590
+	 * @param String $url the full url
1591
+	 * @return String the bit.ly url
1592
+	 *
1593
+	 */
1594 1594
 	public function getBitlyURL($url)
1595 1595
 	{
1596 1596
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.
require/class.TrackerLive.php 2 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   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 	/**
89
-	* Gets all the spotter information based on the latest data entry
90
-	*
91
-	* @return Array the spotter information
92
-	*
93
-	*/
89
+	 * Gets all the spotter information based on the latest data entry
90
+	 *
91
+	 * @return Array the spotter information
92
+	 *
93
+	 */
94 94
 	public function getLiveTrackerData($limit = '', $sort = '', $filter = array())
95 95
 	{
96 96
 		global $globalDBdriver, $globalLiveInterval;
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	}
133 133
 
134 134
 	/**
135
-	* Gets Minimal Live Spotter data
136
-	*
137
-	* @return Array the spotter information
138
-	*
139
-	*/
135
+	 * Gets Minimal Live Spotter data
136
+	 *
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getMinLiveTrackerData($filter = array())
141 141
 	{
142 142
 		global $globalDBdriver, $globalLiveInterval;
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	/**
173
-	* Gets Minimal Live Spotter data since xx seconds
174
-	*
175
-	* @return Array the spotter information
176
-	*
177
-	*/
173
+	 * Gets Minimal Live Spotter data since xx seconds
174
+	 *
175
+	 * @return Array the spotter information
176
+	 *
177
+	 */
178 178
 	public function getMinLastLiveTrackerData($filter = array())
179 179
 	{
180 180
 		global $globalDBdriver, $globalLiveInterval;
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 			$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 
188 188
 			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' 
189 189
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
190
-                } else {
190
+				} else {
191 191
 			$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 
192 192
 			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' 
193 193
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
194 194
 		}
195 195
 
196
-    		try {
196
+			try {
197 197
 			$sth = $this->db->prepare($query);
198 198
 			$sth->execute();
199 199
 		} catch(PDOException $e) {
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 	}
206 206
 
207 207
 	/**
208
-	* Gets number of latest data entry
209
-	*
210
-	* @return String number of entry
211
-	*
212
-	*/
208
+	 * Gets number of latest data entry
209
+	 *
210
+	 * @return String number of entry
211
+	 *
212
+	 */
213 213
 	public function getLiveTrackerCount($filter = array())
214 214
 	{
215 215
 		global $globalDBdriver, $globalLiveInterval;
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 
236 236
 	/**
237
-	* Gets all the spotter information based on the latest data entry and coord
238
-	*
239
-	* @return Array the spotter information
240
-	*
241
-	*/
237
+	 * Gets all the spotter information based on the latest data entry and coord
238
+	 *
239
+	 * @return Array the spotter information
240
+	 *
241
+	 */
242 242
 	public function getLiveTrackerDatabyCoord($coord, $filter = array())
243 243
 	{
244 244
 		global $globalDBdriver, $globalLiveInterval;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	/**
265
-	* Gets all the spotter information based on a user's latitude and longitude
266
-	*
267
-	* @return Array the spotter information
268
-	*
269
-	*/
265
+	 * Gets all the spotter information based on a user's latitude and longitude
266
+	 *
267
+	 * @return Array the spotter information
268
+	 *
269
+	 */
270 270
 	public function getLatestTrackerForLayar($lat, $lng, $radius, $interval)
271 271
 	{
272 272
 		$Tracker = new Tracker($this->db);
@@ -279,142 +279,142 @@  discard block
 block discarded – undo
279 279
 		if ($lng != '')
280 280
 		{
281 281
 			if (!is_numeric($lng))
282
-                        {
283
-                                return false;
284
-                        }
285
-                }
286
-
287
-                if ($radius != '')
288
-                {
289
-                        if (!is_numeric($radius))
290
-                        {
291
-                                return false;
292
-                        }
293
-                }
282
+						{
283
+								return false;
284
+						}
285
+				}
286
+
287
+				if ($radius != '')
288
+				{
289
+						if (!is_numeric($radius))
290
+						{
291
+								return false;
292
+						}
293
+				}
294 294
 		$additional_query = '';
295 295
 		if ($interval != '')
296
-                {
297
-                        if (!is_string($interval))
298
-                        {
299
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
300
-			        return false;
301
-                        } else {
302
-                if ($interval == '1m')
303
-                {
304
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
305
-                } else if ($interval == '15m'){
306
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
307
-                } 
308
-            }
309
-                } else {
310
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
311
-        }
312
-
313
-                $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 
296
+				{
297
+						if (!is_string($interval))
298
+						{
299
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
300
+					return false;
301
+						} else {
302
+				if ($interval == '1m')
303
+				{
304
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
305
+				} else if ($interval == '15m'){
306
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
307
+				} 
308
+			}
309
+				} else {
310
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
311
+		}
312
+
313
+				$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 
314 314
                    WHERE tracker_live.latitude <> '' 
315 315
                                    AND tracker_live.longitude <> '' 
316 316
                    ".$additional_query."
317 317
                    HAVING distance < :radius  
318 318
                                    ORDER BY distance";
319 319
 
320
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
320
+				$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
321 321
 
322
-                return $spotter_array;
323
-        }
322
+				return $spotter_array;
323
+		}
324 324
 
325 325
     
326
-        /**
327
-	* Gets all the spotter information based on a particular callsign
328
-	*
329
-	* @return Array the spotter information
330
-	*
331
-	*/
326
+		/**
327
+		 * Gets all the spotter information based on a particular callsign
328
+		 *
329
+		 * @return Array the spotter information
330
+		 *
331
+		 */
332 332
 	public function getLastLiveTrackerDataByIdent($ident)
333 333
 	{
334 334
 		$Tracker = new Tracker($this->db);
335 335
 		date_default_timezone_set('UTC');
336 336
 
337 337
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
338
-                $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';
338
+				$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';
339 339
 
340 340
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
341 341
 
342 342
 		return $spotter_array;
343 343
 	}
344 344
 
345
-        /**
346
-	* Gets all the spotter information based on a particular callsign
347
-	*
348
-	* @return Array the spotter information
349
-	*
350
-	*/
345
+		/**
346
+		 * Gets all the spotter information based on a particular callsign
347
+		 *
348
+		 * @return Array the spotter information
349
+		 *
350
+		 */
351 351
 	public function getDateLiveTrackerDataByIdent($ident,$date)
352 352
 	{
353 353
 		$Tracker = new Tracker($this->db);
354 354
 		date_default_timezone_set('UTC');
355 355
 
356 356
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
357
-                $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';
357
+				$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';
358 358
 
359
-                $date = date('c',$date);
359
+				$date = date('c',$date);
360 360
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
361 361
 
362 362
 		return $spotter_array;
363 363
 	}
364 364
 
365
-        /**
366
-	* Gets last spotter information based on a particular callsign
367
-	*
368
-	* @return Array the spotter information
369
-	*
370
-	*/
365
+		/**
366
+		 * Gets last spotter information based on a particular callsign
367
+		 *
368
+		 * @return Array the spotter information
369
+		 *
370
+		 */
371 371
 	public function getLastLiveTrackerDataById($id)
372 372
 	{
373 373
 		$Tracker = new Tracker($this->db);
374 374
 		date_default_timezone_set('UTC');
375 375
 
376 376
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
377
-                $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';
377
+				$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';
378 378
 
379 379
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
380 380
 
381 381
 		return $spotter_array;
382 382
 	}
383 383
 
384
-        /**
385
-	* Gets last spotter information based on a particular callsign
386
-	*
387
-	* @return Array the spotter information
388
-	*
389
-	*/
384
+		/**
385
+		 * Gets last spotter information based on a particular callsign
386
+		 *
387
+		 * @return Array the spotter information
388
+		 *
389
+		 */
390 390
 	public function getDateLiveTrackerDataById($id,$date)
391 391
 	{
392 392
 		$Tracker = new Tracker($this->db);
393 393
 		date_default_timezone_set('UTC');
394 394
 
395 395
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
396
-                $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';
397
-                $date = date('c',$date);
396
+				$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';
397
+				$date = date('c',$date);
398 398
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
399 399
 
400 400
 		return $spotter_array;
401 401
 	}
402 402
 
403
-        /**
404
-	* Gets altitude information based on a particular callsign
405
-	*
406
-	* @return Array the spotter information
407
-	*
408
-	*/
403
+		/**
404
+		 * Gets altitude information based on a particular callsign
405
+		 *
406
+		 * @return Array the spotter information
407
+		 *
408
+		 */
409 409
 	public function getAltitudeLiveTrackerDataByIdent($ident)
410 410
 	{
411 411
 
412 412
 		date_default_timezone_set('UTC');
413 413
 
414 414
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
415
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
415
+				$query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
416 416
 
417
-    		try {
417
+			try {
418 418
 			
419 419
 			$sth = $this->db->prepare($query);
420 420
 			$sth->execute(array(':ident' => $ident));
@@ -427,12 +427,12 @@  discard block
 block discarded – undo
427 427
 		return $spotter_array;
428 428
 	}
429 429
 
430
-        /**
431
-	* Gets all the spotter information based on a particular id
432
-	*
433
-	* @return Array the spotter information
434
-	*
435
-	*/
430
+		/**
431
+		 * Gets all the spotter information based on a particular id
432
+		 *
433
+		 * @return Array the spotter information
434
+		 *
435
+		 */
436 436
 	public function getAllLiveTrackerDataById($id,$liveinterval = false)
437 437
 	{
438 438
 		global $globalDBdriver, $globalLiveInterval;
@@ -460,18 +460,18 @@  discard block
 block discarded – undo
460 460
 		return $spotter_array;
461 461
 	}
462 462
 
463
-        /**
464
-	* Gets all the spotter information based on a particular ident
465
-	*
466
-	* @return Array the spotter information
467
-	*
468
-	*/
463
+		/**
464
+		 * Gets all the spotter information based on a particular ident
465
+		 *
466
+		 * @return Array the spotter information
467
+		 *
468
+		 */
469 469
 	public function getAllLiveTrackerDataByIdent($ident)
470 470
 	{
471 471
 		date_default_timezone_set('UTC');
472 472
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
473 473
 		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
474
-    		try {
474
+			try {
475 475
 			
476 476
 			$sth = $this->db->prepare($query);
477 477
 			$sth->execute(array(':ident' => $ident));
@@ -485,23 +485,23 @@  discard block
 block discarded – undo
485 485
 
486 486
 
487 487
 	/**
488
-	* Deletes all info in the table
489
-	*
490
-	* @return String success or false
491
-	*
492
-	*/
488
+	 * Deletes all info in the table
489
+	 *
490
+	 * @return String success or false
491
+	 *
492
+	 */
493 493
 	public function deleteLiveTrackerData()
494 494
 	{
495 495
 		global $globalDBdriver;
496 496
 		if ($globalDBdriver == 'mysql') {
497 497
 			//$query  = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date";
498 498
 			$query  = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date';
499
-            		//$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)";
499
+					//$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)";
500 500
 		} else {
501 501
 			$query  = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date";
502 502
 		}
503 503
         
504
-    		try {
504
+			try {
505 505
 			
506 506
 			$sth = $this->db->prepare($query);
507 507
 			$sth->execute();
@@ -513,18 +513,18 @@  discard block
 block discarded – undo
513 513
 	}
514 514
 
515 515
 	/**
516
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
517
-	*
518
-	* @return String success or false
519
-	*
520
-	*/
516
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
517
+	 *
518
+	 * @return String success or false
519
+	 *
520
+	 */
521 521
 	public function deleteLiveTrackerDataNotUpdated()
522 522
 	{
523 523
 		global $globalDBdriver, $globalDebug;
524 524
 		if ($globalDBdriver == 'mysql') {
525 525
 			//$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';
526
-    			$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";
527
-    			try {
526
+				$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";
527
+				try {
528 528
 				
529 529
 				$sth = $this->db->prepare($query);
530 530
 				$sth->execute();
@@ -532,8 +532,8 @@  discard block
 block discarded – undo
532 532
 				return "error";
533 533
 			}
534 534
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
535
-                        $i = 0;
536
-                        $j =0;
535
+						$i = 0;
536
+						$j =0;
537 537
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
538 538
 			foreach($all as $row)
539 539
 			{
@@ -541,20 +541,20 @@  discard block
 block discarded – undo
541 541
 				$j++;
542 542
 				if ($j == 30) {
543 543
 					if ($globalDebug) echo ".";
544
-				    	try {
544
+						try {
545 545
 						
546 546
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
547 547
 						$sth->execute();
548 548
 					} catch(PDOException $e) {
549 549
 						return "error";
550 550
 					}
551
-                                	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
552
-                                	$j = 0;
551
+									$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
552
+									$j = 0;
553 553
 				}
554 554
 				$query_delete .= "'".$row['famtrackid']."',";
555 555
 			}
556 556
 			if ($i > 0) {
557
-    				try {
557
+					try {
558 558
 					
559 559
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
560 560
 					$sth->execute();
@@ -565,9 +565,9 @@  discard block
 block discarded – undo
565 565
 			return "success";
566 566
 		} elseif ($globalDBdriver == 'pgsql') {
567 567
 			//$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";
568
-    			//$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";
569
-    			$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)";
570
-    			try {
568
+				//$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";
569
+				$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)";
570
+				try {
571 571
 				
572 572
 				$sth = $this->db->prepare($query);
573 573
 				$sth->execute();
@@ -611,17 +611,17 @@  discard block
 block discarded – undo
611 611
 	}
612 612
 
613 613
 	/**
614
-	* Deletes all info in the table for an ident
615
-	*
616
-	* @return String success or false
617
-	*
618
-	*/
614
+	 * Deletes all info in the table for an ident
615
+	 *
616
+	 * @return String success or false
617
+	 *
618
+	 */
619 619
 	public function deleteLiveTrackerDataByIdent($ident)
620 620
 	{
621 621
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
622 622
 		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
623 623
         
624
-    		try {
624
+			try {
625 625
 			
626 626
 			$sth = $this->db->prepare($query);
627 627
 			$sth->execute(array(':ident' => $ident));
@@ -633,17 +633,17 @@  discard block
 block discarded – undo
633 633
 	}
634 634
 
635 635
 	/**
636
-	* Deletes all info in the table for an id
637
-	*
638
-	* @return String success or false
639
-	*
640
-	*/
636
+	 * Deletes all info in the table for an id
637
+	 *
638
+	 * @return String success or false
639
+	 *
640
+	 */
641 641
 	public function deleteLiveTrackerDataById($id)
642 642
 	{
643 643
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
644 644
 		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
645 645
         
646
-    		try {
646
+			try {
647 647
 			
648 648
 			$sth = $this->db->prepare($query);
649 649
 			$sth->execute(array(':id' => $id));
@@ -656,11 +656,11 @@  discard block
 block discarded – undo
656 656
 
657 657
 
658 658
 	/**
659
-	* Gets the aircraft ident within the last hour
660
-	*
661
-	* @return String the ident
662
-	*
663
-	*/
659
+	 * Gets the aircraft ident within the last hour
660
+	 *
661
+	 * @return String the ident
662
+	 *
663
+	 */
664 664
 	public function getIdentFromLastHour($ident)
665 665
 	{
666 666
 		global $globalDBdriver, $globalTimezone;
@@ -686,14 +686,14 @@  discard block
 block discarded – undo
686 686
 			$ident_result = $row['ident'];
687 687
 		}
688 688
 		return $ident_result;
689
-        }
689
+		}
690 690
 
691 691
 	/**
692
-	* Check recent aircraft
693
-	*
694
-	* @return String the ident
695
-	*
696
-	*/
692
+	 * Check recent aircraft
693
+	 *
694
+	 * @return String the ident
695
+	 *
696
+	 */
697 697
 	public function checkIdentRecent($ident)
698 698
 	{
699 699
 		global $globalDBdriver, $globalTimezone;
@@ -719,14 +719,14 @@  discard block
 block discarded – undo
719 719
 			$ident_result = $row['famtrackid'];
720 720
 		}
721 721
 		return $ident_result;
722
-        }
722
+		}
723 723
 
724 724
 	/**
725
-	* Check recent aircraft by id
726
-	*
727
-	* @return String the ident
728
-	*
729
-	*/
725
+	 * Check recent aircraft by id
726
+	 *
727
+	 * @return String the ident
728
+	 *
729
+	 */
730 730
 	public function checkIdRecent($id)
731 731
 	{
732 732
 		global $globalDBdriver, $globalTimezone;
@@ -752,19 +752,19 @@  discard block
 block discarded – undo
752 752
 			$ident_result = $row['famtrackid'];
753 753
 		}
754 754
 		return $ident_result;
755
-        }
755
+		}
756 756
 
757 757
 	/**
758
-	* Adds a new spotter data
759
-	*
760
-	* @param String $famtrackid the ID from flightaware
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
-	*
767
-	*/
758
+	 * Adds a new spotter data
759
+	 *
760
+	 * @param String $famtrackid the ID from flightaware
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
+	 *
767
+	 */
768 768
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
769 769
 	{
770 770
 		global $globalURL, $globalArchive, $globalDebug;
@@ -837,8 +837,8 @@  discard block
 block discarded – undo
837 837
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
838 838
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
839 839
 
840
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
841
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
840
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
841
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
842 842
             	
843 843
 		$query  = 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
844 844
 		VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
@@ -848,9 +848,9 @@  discard block
 block discarded – undo
848 848
 			
849 849
 			$sth = $this->db->prepare($query);
850 850
 			$sth->execute($query_values);
851
-                } catch(PDOException $e) {
852
-                	return "error : ".$e->getMessage();
853
-                }
851
+				} catch(PDOException $e) {
852
+					return "error : ".$e->getMessage();
853
+				}
854 854
 		/*
855 855
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
856 856
 		    if ($globalDebug) echo '(Add to SBS archive : ';
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 1 patch
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.
js/map-tracker.2d.js.php 1 patch
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.
js/map.2d.js.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -352,10 +352,10 @@  discard block
 block discarded – undo
352 352
 	});
353 353
 update_locationsLayer();
354 354
 <?php
355
-    // Add support for custom json via $globalMapJson
356
-    if (isset($globalMapJson) && is_array($globalMapJson)) {
355
+	// Add support for custom json via $globalMapJson
356
+	if (isset($globalMapJson) && is_array($globalMapJson)) {
357 357
 	foreach ($globalMapJson as $json) {
358
-	    if (isset($json['url'])) {
358
+		if (isset($json['url'])) {
359 359
 ?>
360 360
 update_genLayer('<?php print $json['url']; ?>');
361 361
 <?php
@@ -364,9 +364,9 @@  discard block
 block discarded – undo
364 364
 setInterval(function(){update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>);
365 365
 <?php
366 366
 		}
367
-	    }
367
+		}
368
+	}
368 369
 	}
369
-    }
370 370
 
371 371
 ?>
372 372
 //adds the bootstrap tooltip to the map icons
Please login to merge, or discard this patch.