Completed
Push — master ( 7bb360...c01d59 )
by Yannick
22:07
created
require/class.Marine.php 1 patch
Indentation   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
 	}
12 12
 
13 13
 	/**
14
-	* Get SQL query part for filter used
15
-	* @param Array $filter the filter
16
-	* @return Array the SQL part
17
-	*/
14
+	 * Get SQL query part for filter used
15
+	 * @param Array $filter the filter
16
+	 * @return Array the SQL part
17
+	 */
18 18
 	
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 	}
79 79
 
80 80
 	/**
81
-	* Executes the SQL statements to get the spotter information
82
-	*
83
-	* @param String $query the SQL query
84
-	* @param Array $params parameter of the query
85
-	* @param String $limitQuery the limit query
86
-	* @return Array the spotter information
87
-	*
88
-	*/
81
+	 * Executes the SQL statements to get the spotter information
82
+	 *
83
+	 * @param String $query the SQL query
84
+	 * @param Array $params parameter of the query
85
+	 * @param String $limitQuery the limit query
86
+	 * @return Array the spotter information
87
+	 *
88
+	 */
89 89
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
90 90
 	{
91 91
 		date_default_timezone_set('UTC');
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	
214 214
 	
215 215
 	/**
216
-	* Gets all the spotter information based on the latest data entry
217
-	*
218
-	* @return Array the spotter information
219
-	*
220
-	*/
216
+	 * Gets all the spotter information based on the latest data entry
217
+	 *
218
+	 * @return Array the spotter information
219
+	 *
220
+	 */
221 221
 	public function getLatestMarineData($limit = '', $sort = '', $filter = array())
222 222
 	{
223 223
 		global $global_query;
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	}
267 267
 
268 268
 	/**
269
-	* Gets all the spotter information based on the callsign
270
-	*
271
-	* @return Array the spotter information
272
-	*
273
-	*/
269
+	 * Gets all the spotter information based on the callsign
270
+	 *
271
+	 * @return Array the spotter information
272
+	 *
273
+	 */
274 274
 	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
275 275
 	{
276 276
 		global $global_query;
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
 
382 382
 
383 383
 	/**
384
-	* Gets all source name
385
-	*
386
-	* @param String type format of source
387
-	* @return Array list of source name
388
-	*
389
-	*/
384
+	 * Gets all source name
385
+	 *
386
+	 * @param String type format of source
387
+	 * @return Array list of source name
388
+	 *
389
+	 */
390 390
 	public function getAllSourceName($type = '',$filters = array())
391 391
 	{
392 392
 		$filter_query = $this->getFilter($filters,true,true);
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 
417 417
 
418 418
 	/**
419
-	* Gets a list of all idents/callsigns
420
-	*
421
-	* @return Array list of ident/callsign names
422
-	*
423
-	*/
419
+	 * Gets a list of all idents/callsigns
420
+	 *
421
+	 * @return Array list of ident/callsign names
422
+	 *
423
+	 */
424 424
 	public function getAllIdents($filters = array())
425 425
 	{
426 426
 		$filter_query = $this->getFilter($filters,true,true);
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
 	}
445 445
 
446 446
 	/**
447
-	* Gets all info from a mmsi
448
-	*
449
-	* @return Array list of mmsi info
450
-	*
451
-	*/
447
+	 * Gets all info from a mmsi
448
+	 *
449
+	 * @return Array list of mmsi info
450
+	 *
451
+	 */
452 452
 	public function getIdentity($mmsi)
453 453
 	{
454 454
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -505,18 +505,18 @@  discard block
 block discarded – undo
505 505
 	
506 506
 	
507 507
 	/**
508
-	* Update ident tracker data
509
-	*
510
-	* @param String $fammarine_id the ID
511
-	* @param String $ident the marine ident
512
-	* @return String success or false
513
-	*
514
-	*/	
508
+	 * Update ident tracker data
509
+	 *
510
+	 * @param String $fammarine_id the ID
511
+	 * @param String $ident the marine ident
512
+	 * @return String success or false
513
+	 *
514
+	 */	
515 515
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
516 516
 	{
517 517
 
518 518
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
519
-                $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
519
+				$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
520 520
 
521 521
 		try {
522 522
 			$sth = $this->db->prepare($query);
@@ -530,19 +530,19 @@  discard block
 block discarded – undo
530 530
 	}
531 531
 
532 532
 	/**
533
-	* Update Status data
534
-	*
535
-	* @param String $fammarine_id the ID
536
-	* @param String $status_id the marine status id
537
-	* @param String $status the marine status
538
-	* @return String success or false
539
-	*
540
-	*/	
533
+	 * Update Status data
534
+	 *
535
+	 * @param String $fammarine_id the ID
536
+	 * @param String $status_id the marine status id
537
+	 * @param String $status the marine status
538
+	 * @return String success or false
539
+	 *
540
+	 */	
541 541
 	public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '')
542 542
 	{
543 543
 
544 544
 		$query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id';
545
-                $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
545
+				$query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
546 546
 
547 547
 		try {
548 548
 			$sth = $this->db->prepare($query);
@@ -555,17 +555,17 @@  discard block
 block discarded – undo
555 555
 
556 556
 	}
557 557
 	/**
558
-	* Update latest marine data
559
-	*
560
-	* @param String $fammarine_id the ID
561
-	* @param String $ident the marine ident
562
-	* @return String success or false
563
-	*
564
-	*/	
558
+	 * Update latest marine data
559
+	 *
560
+	 * @param String $fammarine_id the ID
561
+	 * @param String $ident the marine ident
562
+	 * @return String success or false
563
+	 *
564
+	 */	
565 565
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
566 566
 	{
567 567
 		$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';
568
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
568
+				$query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
569 569
 
570 570
 		try {
571 571
 			$sth = $this->db->prepare($query);
@@ -579,30 +579,30 @@  discard block
 block discarded – undo
579 579
 	}
580 580
 
581 581
 	/**
582
-	* Adds a new spotter data
583
-	*
584
-	* @param String $fammarine_id the ID
585
-	* @param String $ident the marine ident
586
-	* @param String $departure_airport_icao the departure airport
587
-	* @param String $arrival_airport_icao the arrival airport
588
-	* @param String $latitude latitude of flight
589
-	* @param String $longitude latitude of flight
590
-	* @param String $waypoints waypoints of flight
591
-	* @param String $heading heading of flight
592
-	* @param String $groundspeed speed of flight
593
-	* @param String $date date of flight
594
-	* @param String $departure_airport_time departure time of flight
595
-	* @param String $arrival_airport_time arrival time of flight
596
-	* @param String $squawk squawk code of flight
597
-	* @param String $route_stop route stop of flight
598
-	* @param String $highlight highlight or not
599
-	* @param String $ModeS ModesS code of flight
600
-	* @param String $registration registration code of flight
601
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
602
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
603
-	* @param String $verticalrate vertival rate of flight
604
-	* @return String success or false
605
-	*/
582
+	 * Adds a new spotter data
583
+	 *
584
+	 * @param String $fammarine_id the ID
585
+	 * @param String $ident the marine ident
586
+	 * @param String $departure_airport_icao the departure airport
587
+	 * @param String $arrival_airport_icao the arrival airport
588
+	 * @param String $latitude latitude of flight
589
+	 * @param String $longitude latitude of flight
590
+	 * @param String $waypoints waypoints of flight
591
+	 * @param String $heading heading of flight
592
+	 * @param String $groundspeed speed of flight
593
+	 * @param String $date date of flight
594
+	 * @param String $departure_airport_time departure time of flight
595
+	 * @param String $arrival_airport_time arrival time of flight
596
+	 * @param String $squawk squawk code of flight
597
+	 * @param String $route_stop route stop of flight
598
+	 * @param String $highlight highlight or not
599
+	 * @param String $ModeS ModesS code of flight
600
+	 * @param String $registration registration code of flight
601
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
602
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
603
+	 * @param String $verticalrate vertival rate of flight
604
+	 * @return String success or false
605
+	 */
606 606
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '')
607 607
 	{
608 608
 		global $globalURL, $globalMarineImageFetch;
@@ -699,13 +699,13 @@  discard block
 block discarded – undo
699 699
 			unset($Image);
700 700
 		}
701 701
 		
702
-                if ($latitude == '' && $longitude == '') {
703
-            		$latitude = 0;
704
-            		$longitude = 0;
705
-            	}
706
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
707
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
708
-                if ($arrival_date == '') $arrival_date = NULL;
702
+				if ($latitude == '' && $longitude == '') {
703
+					$latitude = 0;
704
+					$longitude = 0;
705
+				}
706
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
707
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
708
+				if ($arrival_date == '') $arrival_date = NULL;
709 709
 		$query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) 
710 710
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)";
711 711
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 			$sth->execute($query_values);
717 717
 			$this->db = null;
718 718
 		} catch (PDOException $e) {
719
-		    return "error : ".$e->getMessage();
719
+			return "error : ".$e->getMessage();
720 720
 		}
721 721
 		
722 722
 		return "success";
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 	
726 726
   
727 727
 	/**
728
-	* Gets the aircraft ident within the last hour
729
-	*
730
-	* @return String the ident
731
-	*
732
-	*/
728
+	 * Gets the aircraft ident within the last hour
729
+	 *
730
+	 * @return String the ident
731
+	 *
732
+	 */
733 733
 	public function getIdentFromLastHour($ident)
734 734
 	{
735 735
 		global $globalDBdriver, $globalTimezone;
@@ -745,11 +745,11 @@  discard block
 block discarded – undo
745 745
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
746 746
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
747 747
 			$query_data = array(':ident' => $ident);
748
-    		}
748
+			}
749 749
 		
750 750
 		$sth = $this->db->prepare($query);
751 751
 		$sth->execute($query_data);
752
-    		$ident_result='';
752
+			$ident_result='';
753 753
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
754 754
 		{
755 755
 			$ident_result = $row['ident'];
@@ -760,11 +760,11 @@  discard block
 block discarded – undo
760 760
 	
761 761
 	
762 762
 	/**
763
-	* Gets the aircraft data from the last 20 seconds
764
-	*
765
-	* @return Array the spotter data
766
-	*
767
-	*/
763
+	 * Gets the aircraft data from the last 20 seconds
764
+	 *
765
+	 * @return Array the spotter data
766
+	 *
767
+	 */
768 768
 	public function getRealTimeData($q = '')
769 769
 	{
770 770
 		global $globalDBdriver;
@@ -802,11 +802,11 @@  discard block
 block discarded – undo
802 802
 	
803 803
 
804 804
 	/**
805
-	* Gets all number of flight over countries
806
-	*
807
-	* @return Array the airline country list
808
-	*
809
-	*/
805
+	 * Gets all number of flight over countries
806
+	 *
807
+	 * @return Array the airline country list
808
+	 *
809
+	 */
810 810
 
811 811
 	public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
812 812
 	{
@@ -879,11 +879,11 @@  discard block
 block discarded – undo
879 879
 	
880 880
 	
881 881
 	/**
882
-	* Gets all callsigns that have flown over
883
-	*
884
-	* @return Array the callsign list
885
-	*
886
-	*/
882
+	 * Gets all callsigns that have flown over
883
+	 *
884
+	 * @return Array the callsign list
885
+	 *
886
+	 */
887 887
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
888 888
 	{
889 889
 		global $globalDBdriver;
@@ -950,11 +950,11 @@  discard block
 block discarded – undo
950 950
 
951 951
 
952 952
 	/**
953
-	* Counts all dates
954
-	*
955
-	* @return Array the date list
956
-	*
957
-	*/
953
+	 * Counts all dates
954
+	 *
955
+	 * @return Array the date list
956
+	 *
957
+	 */
958 958
 	public function countAllDates($filters = array())
959 959
 	{
960 960
 		global $globalTimezone, $globalDBdriver;
@@ -1000,11 +1000,11 @@  discard block
 block discarded – undo
1000 1000
 	
1001 1001
 	
1002 1002
 	/**
1003
-	* Counts all dates during the last 7 days
1004
-	*
1005
-	* @return Array the date list
1006
-	*
1007
-	*/
1003
+	 * Counts all dates during the last 7 days
1004
+	 *
1005
+	 * @return Array the date list
1006
+	 *
1007
+	 */
1008 1008
 	public function countAllDatesLast7Days($filters = array())
1009 1009
 	{
1010 1010
 		global $globalTimezone, $globalDBdriver;
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 			$query .= " GROUP BY date_name 
1027 1027
 								ORDER BY date_name ASC";
1028 1028
 			$query_data = array(':offset' => $offset);
1029
-    		}
1029
+			}
1030 1030
 		
1031 1031
 		$sth = $this->db->prepare($query);
1032 1032
 		$sth->execute($query_data);
@@ -1046,11 +1046,11 @@  discard block
 block discarded – undo
1046 1046
 	}
1047 1047
 
1048 1048
 	/**
1049
-	* Counts all dates during the last month
1050
-	*
1051
-	* @return Array the date list
1052
-	*
1053
-	*/
1049
+	 * Counts all dates during the last month
1050
+	 *
1051
+	 * @return Array the date list
1052
+	 *
1053
+	 */
1054 1054
 	public function countAllDatesLastMonth($filters = array())
1055 1055
 	{
1056 1056
 		global $globalTimezone, $globalDBdriver;
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
 			$query .= " GROUP BY date_name 
1073 1073
 								ORDER BY date_name ASC";
1074 1074
 			$query_data = array(':offset' => $offset);
1075
-    		}
1075
+			}
1076 1076
 		
1077 1077
 		$sth = $this->db->prepare($query);
1078 1078
 		$sth->execute($query_data);
@@ -1094,11 +1094,11 @@  discard block
 block discarded – undo
1094 1094
 
1095 1095
 
1096 1096
 	/**
1097
-	* Counts all month
1098
-	*
1099
-	* @return Array the month list
1100
-	*
1101
-	*/
1097
+	 * Counts all month
1098
+	 *
1099
+	 * @return Array the month list
1100
+	 *
1101
+	 */
1102 1102
 	public function countAllMonths($filters = array())
1103 1103
 	{
1104 1104
 		global $globalTimezone, $globalDBdriver;
@@ -1143,11 +1143,11 @@  discard block
 block discarded – undo
1143 1143
 	
1144 1144
 
1145 1145
 	/**
1146
-	* Counts all dates during the last year
1147
-	*
1148
-	* @return Array the date list
1149
-	*
1150
-	*/
1146
+	 * Counts all dates during the last year
1147
+	 *
1148
+	 * @return Array the date list
1149
+	 *
1150
+	 */
1151 1151
 	public function countAllMonthsLastYear($filters)
1152 1152
 	{
1153 1153
 		global $globalTimezone, $globalDBdriver;
@@ -1169,7 +1169,7 @@  discard block
 block discarded – undo
1169 1169
 			$query .= " GROUP BY year_name, month_name
1170 1170
 								ORDER BY year_name, month_name ASC";
1171 1171
 			$query_data = array(':offset' => $offset);
1172
-    		}
1172
+			}
1173 1173
 		
1174 1174
 		$sth = $this->db->prepare($query);
1175 1175
 		$sth->execute($query_data);
@@ -1192,11 +1192,11 @@  discard block
 block discarded – undo
1192 1192
 	
1193 1193
 	
1194 1194
 	/**
1195
-	* Counts all hours
1196
-	*
1197
-	* @return Array the hour list
1198
-	*
1199
-	*/
1195
+	 * Counts all hours
1196
+	 *
1197
+	 * @return Array the hour list
1198
+	 *
1199
+	 */
1200 1200
 	public function countAllHours($orderby,$filters = array())
1201 1201
 	{
1202 1202
 		global $globalTimezone, $globalDBdriver;
@@ -1259,11 +1259,11 @@  discard block
 block discarded – undo
1259 1259
 	
1260 1260
 	
1261 1261
 	/**
1262
-	* Counts all hours by date
1263
-	*
1264
-	* @return Array the hour list
1265
-	*
1266
-	*/
1262
+	 * Counts all hours by date
1263
+	 *
1264
+	 * @return Array the hour list
1265
+	 *
1266
+	 */
1267 1267
 	public function countAllHoursByDate($date, $filters = array())
1268 1268
 	{
1269 1269
 		global $globalTimezone, $globalDBdriver;
@@ -1307,11 +1307,11 @@  discard block
 block discarded – undo
1307 1307
 	
1308 1308
 	
1309 1309
 	/**
1310
-	* Counts all hours by a ident/callsign
1311
-	*
1312
-	* @return Array the hour list
1313
-	*
1314
-	*/
1310
+	 * Counts all hours by a ident/callsign
1311
+	 *
1312
+	 * @return Array the hour list
1313
+	 *
1314
+	 */
1315 1315
 	public function countAllHoursByIdent($ident, $filters = array())
1316 1316
 	{
1317 1317
 		global $globalTimezone, $globalDBdriver;
@@ -1356,11 +1356,11 @@  discard block
 block discarded – undo
1356 1356
 	
1357 1357
 	
1358 1358
 	/**
1359
-	* Counts all flights that have flown over
1360
-	*
1361
-	* @return Integer the number of flights
1362
-	*
1363
-	*/
1359
+	 * Counts all flights that have flown over
1360
+	 *
1361
+	 * @return Integer the number of flights
1362
+	 *
1363
+	 */
1364 1364
 	public function countOverallMarine($filters = array(),$year = '',$month = '')
1365 1365
 	{
1366 1366
 		global $globalDBdriver;
@@ -1396,11 +1396,11 @@  discard block
 block discarded – undo
1396 1396
 	
1397 1397
   
1398 1398
 	/**
1399
-	* Counts all hours of today
1400
-	*
1401
-	* @return Array the hour list
1402
-	*
1403
-	*/
1399
+	 * Counts all hours of today
1400
+	 *
1401
+	 * @return Array the hour list
1402
+	 *
1403
+	 */
1404 1404
 	public function countAllHoursFromToday($filters = array())
1405 1405
 	{
1406 1406
 		global $globalTimezone, $globalDBdriver;
@@ -1440,12 +1440,12 @@  discard block
 block discarded – undo
1440 1440
 	}
1441 1441
     
1442 1442
     
1443
-     /**
1444
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1445
-	*
1446
-	* @return Integer the Barrie Spotter ID
1443
+	 /**
1444
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1445
+	  *
1446
+	  * @return Integer the Barrie Spotter ID
1447 1447
 q	*
1448
-	*/
1448
+	  */
1449 1449
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1450 1450
 	{
1451 1451
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1466,13 +1466,13 @@  discard block
 block discarded – undo
1466 1466
   
1467 1467
  
1468 1468
 	/**
1469
-	* Parses a date string
1470
-	*
1471
-	* @param String $dateString the date string
1472
-	* @param String $timezone the timezone of a user
1473
-	* @return Array the time information
1474
-	*
1475
-	*/
1469
+	 * Parses a date string
1470
+	 *
1471
+	 * @param String $dateString the date string
1472
+	 * @param String $timezone the timezone of a user
1473
+	 * @return Array the time information
1474
+	 *
1475
+	 */
1476 1476
 	public function parseDateString($dateString, $timezone = '')
1477 1477
 	{
1478 1478
 		$time_array = array();
@@ -1505,12 +1505,12 @@  discard block
 block discarded – undo
1505 1505
 	}
1506 1506
 	
1507 1507
 	/**
1508
-	* Parses the direction degrees to working
1509
-	*
1510
-	* @param Float $direction the direction in degrees
1511
-	* @return Array the direction information
1512
-	*
1513
-	*/
1508
+	 * Parses the direction degrees to working
1509
+	 *
1510
+	 * @param Float $direction the direction in degrees
1511
+	 * @return Array the direction information
1512
+	 *
1513
+	 */
1514 1514
 	public function parseDirection($direction = 0)
1515 1515
 	{
1516 1516
 		if ($direction == '') $direction = 0;
@@ -1589,12 +1589,12 @@  discard block
 block discarded – undo
1589 1589
 	
1590 1590
 	
1591 1591
 	/**
1592
-	* Gets Country from latitude/longitude
1593
-	*
1594
-	* @param Float $latitude latitute of the flight
1595
-	* @param Float $longitude longitute of the flight
1596
-	* @return String the countrie
1597
-	*/
1592
+	 * Gets Country from latitude/longitude
1593
+	 *
1594
+	 * @param Float $latitude latitute of the flight
1595
+	 * @param Float $longitude longitute of the flight
1596
+	 * @return String the countrie
1597
+	 */
1598 1598
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1599 1599
 	{
1600 1600
 		global $globalDBdriver, $globalDebug;
@@ -1631,11 +1631,11 @@  discard block
 block discarded – undo
1631 1631
 	}
1632 1632
 
1633 1633
 	/**
1634
-	* Gets Country from iso2
1635
-	*
1636
-	* @param String $iso2 ISO2 country code
1637
-	* @return String the countrie
1638
-	*/
1634
+	 * Gets Country from iso2
1635
+	 *
1636
+	 * @param String $iso2 ISO2 country code
1637
+	 * @return String the countrie
1638
+	 */
1639 1639
 	public function getCountryFromISO2($iso2)
1640 1640
 	{
1641 1641
 		global $globalDBdriver, $globalDebug;
@@ -1664,12 +1664,12 @@  discard block
 block discarded – undo
1664 1664
 
1665 1665
 	
1666 1666
 	/**
1667
-	* Gets the short url from bit.ly
1668
-	*
1669
-	* @param String $url the full url
1670
-	* @return String the bit.ly url
1671
-	*
1672
-	*/
1667
+	 * Gets the short url from bit.ly
1668
+	 *
1669
+	 * @param String $url the full url
1670
+	 * @return String the bit.ly url
1671
+	 *
1672
+	 */
1673 1673
 	public function getBitlyURL($url)
1674 1674
 	{
1675 1675
 		global $globalBitlyAccessToken;
@@ -1696,11 +1696,11 @@  discard block
 block discarded – undo
1696 1696
 
1697 1697
 	
1698 1698
 	/**
1699
-	* Gets all vessels types that have flown over
1700
-	*
1701
-	* @return Array the vessel type list
1702
-	*
1703
-	*/
1699
+	 * Gets all vessels types that have flown over
1700
+	 *
1701
+	 * @return Array the vessel type list
1702
+	 *
1703
+	 */
1704 1704
 	public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1705 1705
 	{
1706 1706
 		global $globalDBdriver;
Please login to merge, or discard this patch.
statistics.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -81,23 +81,23 @@  discard block
 block discarded – undo
81 81
         <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span>
82 82
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
83 83
 	<?php
84
-	    if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
84
+		if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
85 85
 	?>
86 86
     	    <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span>
87 87
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
88 88
         <?php
89
-    	    } else {
90
-    	?>
89
+			} else {
90
+		?>
91 91
     	    <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span>
92 92
 	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
93 93
     	<?php
94
-    	    }
95
-    	?>
94
+			}
95
+		?>
96 96
         <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span>
97 97
         <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
98 98
         <?php
99
-    		if ($airline_icao == '') {
100
-    	?>
99
+			if ($airline_icao == '') {
100
+		?>
101 101
         <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span>
102 102
 	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
103 103
 	<?php
@@ -136,38 +136,38 @@  discard block
 block discarded – undo
136 136
             <div class="col-md-6">
137 137
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
138 138
                  <?php
139
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
140
-		    if (count($aircraft_array) == 0) print _("No data available");
141
-		    else {
142
-                    print '<div id="chart1" class="chart" width="100%"></div><script>';
143
-                    $aircraft_data = '';
144
-                    foreach($aircraft_array as $aircraft_item)
145
-                    {
146
-                        $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
147
-                    }
148
-                    $aircraft_data = substr($aircraft_data, 0, -1);
149
-		    print 'var series = ['.$aircraft_data.'];';
150
-		    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
151
-		    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
152
-		    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
153
-                    print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
154
-                    print 'dataset';
155
-                    print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
156
-                    print '</script>';
157
-                  }
158
-                  ?>
139
+				  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
140
+			if (count($aircraft_array) == 0) print _("No data available");
141
+			else {
142
+					print '<div id="chart1" class="chart" width="100%"></div><script>';
143
+					$aircraft_data = '';
144
+					foreach($aircraft_array as $aircraft_item)
145
+					{
146
+						$aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
147
+					}
148
+					$aircraft_data = substr($aircraft_data, 0, -1);
149
+			print 'var series = ['.$aircraft_data.'];';
150
+			print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
151
+			print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
152
+			print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
153
+					print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
154
+					print 'dataset';
155
+					print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
156
+					print '</script>';
157
+				  }
158
+				  ?>
159 159
                 <div class="more">
160 160
             	    <?php
161
-            		if ($year != '' && $month != '') {
162
-            	    ?>
161
+					if ($year != '' && $month != '') {
162
+					?>
163 163
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
164 164
             	    <?php
165
-            		} else {
166
-            	    ?>
165
+					} else {
166
+					?>
167 167
             	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
168 168
             	    <?php
169
-            		}
170
-            	    ?>
169
+					}
170
+					?>
171 171
                 </div>
172 172
             </div>
173 173
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -220,29 +220,29 @@  discard block
 block discarded – undo
220 220
             <div class="col-md-6">
221 221
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
222 222
                  <?php
223
-                  $marine_array = $Marine->countAllMarineTypes();
224
-		    if (count($marine_array) == 0) print _("No data available");
225
-		    else {
226
-                    print '<div id="chart1" class="chart" width="100%"></div><script>';
227
-                    $marine_data = '';
228
-                    foreach($marine_array as $marine_item)
229
-                    {
230
-                        $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
231
-                    }
232
-                    $marine_data = substr($marine_data, 0, -1);
233
-		    print 'var series = ['.$marine_data.'];';
234
-		    print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
235
-		    print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
236
-		    print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
237
-                    print 'var marinetype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
238
-                    print 'dataset';
239
-                    print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
240
-                    print '</script>';
241
-                  }
242
-                  ?>
223
+				  $marine_array = $Marine->countAllMarineTypes();
224
+			if (count($marine_array) == 0) print _("No data available");
225
+			else {
226
+					print '<div id="chart1" class="chart" width="100%"></div><script>';
227
+					$marine_data = '';
228
+					foreach($marine_array as $marine_item)
229
+					{
230
+						$marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],';
231
+					}
232
+					$marine_data = substr($marine_data, 0, -1);
233
+			print 'var series = ['.$marine_data.'];';
234
+			print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);';
235
+			print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);';
236
+			print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});';
237
+					print 'var marinetype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":';
238
+					print 'dataset';
239
+					print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});';
240
+					print '</script>';
241
+				  }
242
+				  ?>
243 243
                 <div class="more">
244 244
             	    <?php
245
-            	    /*
245
+					/*
246 246
             		if ($year != '' && $month != '') {
247 247
             	    ?>
248 248
             	    <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
             	    <?php
254 254
             		}
255 255
             		*/
256
-            	    ?>
256
+					?>
257 257
                 </div>
258 258
             </div>
259 259
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
Please login to merge, or discard this patch.