Completed
Push — master ( 7bb360...c01d59 )
by Yannick
22:07
created
require/class.Marine.php 2 patches
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.
Braces   +165 added lines, -59 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 		if (isset($filter[0]['source'])) {
30 30
 			$filters = array_merge($filters,$filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
33 35
 		$filter_query_join = '';
34 36
 		$filter_query_where = '';
35 37
 		foreach($filters as $flt) {
@@ -68,8 +70,11 @@  discard block
 block discarded – undo
68 70
 				$filter_query_where .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'";
69 71
 			}
70 72
 		}
71
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
72
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
73
+		if ($filter_query_where == '' && $where) {
74
+			$filter_query_where = ' WHERE';
75
+		} elseif ($filter_query_where != '' && $and) {
76
+			$filter_query_where .= ' AND';
77
+		}
73 78
 		if ($filter_query_where != '') {
74 79
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
75 80
 		}
@@ -123,32 +128,54 @@  discard block
 block discarded – undo
123 128
 				$temp_array['spotter_id'] = $row['spotter_archive_id'];
124 129
 			} elseif (isset($row['spotter_archive_output_id'])) {
125 130
 				$temp_array['spotter_id'] = $row['spotter_archive_output_id'];
126
-			*/} 
127
-			elseif (isset($row['marineid'])) {
131
+			*/} elseif (isset($row['marineid'])) {
128 132
 				$temp_array['marine_id'] = $row['marineid'];
129 133
 			} else {
130 134
 				$temp_array['marine_id'] = '';
131 135
 			}
132
-			if (isset($row['fammarine_id'])) $temp_array['fammarine_id'] = $row['fammarine_id'];
133
-			if (isset($row['mmsi'])) $temp_array['mmsi'] = $row['mmsi'];
134
-			if (isset($row['type'])) $temp_array['type'] = $row['type'];
135
-			if (isset($row['type_id'])) $temp_array['type_id'] = $row['type_id'];
136
-			if (isset($row['ident'])) $temp_array['ident'] = $row['ident'];
137
-			if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude'];
138
-			if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude'];
139
-			if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source'];
136
+			if (isset($row['fammarine_id'])) {
137
+				$temp_array['fammarine_id'] = $row['fammarine_id'];
138
+			}
139
+			if (isset($row['mmsi'])) {
140
+				$temp_array['mmsi'] = $row['mmsi'];
141
+			}
142
+			if (isset($row['type'])) {
143
+				$temp_array['type'] = $row['type'];
144
+			}
145
+			if (isset($row['type_id'])) {
146
+				$temp_array['type_id'] = $row['type_id'];
147
+			}
148
+			if (isset($row['ident'])) {
149
+				$temp_array['ident'] = $row['ident'];
150
+			}
151
+			if (isset($row['latitude'])) {
152
+				$temp_array['latitude'] = $row['latitude'];
153
+			}
154
+			if (isset($row['longitude'])) {
155
+				$temp_array['longitude'] = $row['longitude'];
156
+			}
157
+			if (isset($row['format_source'])) {
158
+				$temp_array['format_source'] = $row['format_source'];
159
+			}
140 160
 			if (isset($row['heading'])) {
141 161
 				$temp_array['heading'] = $row['heading'];
142 162
 				$heading_direction = $this->parseDirection($row['heading']);
143
-				if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
163
+				if (isset($heading_direction[0]['direction_fullname'])) {
164
+					$temp_array['heading_name'] = $heading_direction[0]['direction_fullname'];
165
+				}
166
+			}
167
+			if (isset($row['ground_speed'])) {
168
+				$temp_array['ground_speed'] = $row['ground_speed'];
144 169
 			}
145
-			if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed'];
146 170
 
147 171
 			if($temp_array['mmsi'] != "")
148 172
 			{
149 173
 				$Image = new Image($this->db);
150
-				if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']);
151
-				else $image_array = $Image->getMarineImage($temp_array['mmsi']);
174
+				if (isset($temp_array['ident']) && $temp_array['ident'] != '') {
175
+					$image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']);
176
+				} else {
177
+					$image_array = $Image->getMarineImage($temp_array['mmsi']);
178
+				}
152 179
 				unset($Image);
153 180
 				if (count($image_array) > 0) {
154 181
 					$temp_array['image'] = $image_array[0]['image'];
@@ -200,13 +227,21 @@  discard block
 block discarded – undo
200 227
 			}
201 228
 			
202 229
 			$fromsource = NULL;
203
-			if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name'];
204
-			if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country'];
205
-			if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance'];
230
+			if (isset($row['source_name']) && $row['source_name'] != '') {
231
+				$temp_array['source_name'] = $row['source_name'];
232
+			}
233
+			if (isset($row['over_country']) && $row['over_country'] != '') {
234
+				$temp_array['over_country'] = $row['over_country'];
235
+			}
236
+			if (isset($row['distance']) && $row['distance'] != '') {
237
+				$temp_array['distance'] = $row['distance'];
238
+			}
206 239
 			$temp_array['query_number_rows'] = $num_rows;
207 240
 			$spotter_array[] = $temp_array;
208 241
 		}
209
-		if ($num_rows == 0) return array();
242
+		if ($num_rows == 0) {
243
+			return array();
244
+		}
210 245
 		$spotter_array[0]['query_number_rows'] = $num_rows;
211 246
 		return $spotter_array;
212 247
 	}	
@@ -232,8 +267,12 @@  discard block
 block discarded – undo
232 267
 			{
233 268
 				//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
234 269
 				$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
235
-			} else $limit_query = "";
236
-		} else $limit_query = "";
270
+			} else {
271
+				$limit_query = "";
272
+			}
273
+		} else {
274
+			$limit_query = "";
275
+		}
237 276
 		if ($sort != "")
238 277
 		{
239 278
 			$search_orderby_array = $this->getOrderBy();
@@ -257,7 +296,9 @@  discard block
 block discarded – undo
257 296
 		global $global_query;
258 297
 		
259 298
 		date_default_timezone_set('UTC');
260
-		if ($id == '') return array();
299
+		if ($id == '') {
300
+			return array();
301
+		}
261 302
 		$additional_query = "marine_output.fammarine_id = :id";
262 303
 		$query_values = array(':id' => $id);
263 304
 		$query  = $global_query." WHERE ".$additional_query." ";
@@ -400,8 +441,11 @@  discard block
 block discarded – undo
400 441
 		$query .= " ORDER BY marine_output.source_name ASC";
401 442
 
402 443
 		$sth = $this->db->prepare($query);
403
-		if (!empty($query_values)) $sth->execute($query_values);
404
-		else $sth->execute();
444
+		if (!empty($query_values)) {
445
+			$sth->execute($query_values);
446
+		} else {
447
+			$sth->execute();
448
+		}
405 449
 
406 450
 		$source_array = array();
407 451
 		$temp_array = array();
@@ -456,8 +500,11 @@  discard block
 block discarded – undo
456 500
 		$sth = $this->db->prepare($query);
457 501
 		$sth->execute(array(':mmsi' => $mmsi));
458 502
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
459
-		if (isset($result[0])) return $result[0];
460
-		else return array();
503
+		if (isset($result[0])) {
504
+			return $result[0];
505
+		} else {
506
+			return array();
507
+		}
461 508
 	}
462 509
 
463 510
 	/*
@@ -473,7 +520,9 @@  discard block
 block discarded – undo
473 520
 			date_default_timezone_set($globalTimezone);
474 521
 			$datetime = new DateTime();
475 522
 			$offset = $datetime->format('P');
476
-		} else $offset = '+00:00';
523
+		} else {
524
+			$offset = '+00:00';
525
+		}
477 526
 
478 527
 		if ($globalDBdriver == 'mysql') {
479 528
 			$query  = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date
@@ -703,9 +752,15 @@  discard block
 block discarded – undo
703 752
             		$latitude = 0;
704 753
             		$longitude = 0;
705 754
             	}
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;
755
+                if ($heading == '' || $Common->isInteger($heading) === false) {
756
+                	$heading = 0;
757
+                }
758
+                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) {
759
+                	$groundspeed = 0;
760
+                }
761
+                if ($arrival_date == '') {
762
+                	$arrival_date = NULL;
763
+                }
709 764
 		$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 765
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)";
711 766
 
@@ -813,7 +868,9 @@  discard block
 block discarded – undo
813 868
 		global $globalDBdriver, $globalArchive;
814 869
 		//$filter_query = $this->getFilter($filters,true,true);
815 870
 		$Connection= new Connection($this->db);
816
-		if (!$Connection->tableExists('countries')) return array();
871
+		if (!$Connection->tableExists('countries')) {
872
+			return array();
873
+		}
817 874
 		require_once('class.SpotterLive.php');
818 875
 		if (!isset($globalArchive) || $globalArchive !== TRUE) {
819 876
 			$MarineLive = new MarineLive();
@@ -857,7 +914,9 @@  discard block
 block discarded – undo
857 914
 			$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT fammarine_id,over_country FROM marine_archive".$filter_query.") l ON c.iso2 = l.over_country ";
858 915
 		}
859 916
 		$query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC";
860
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
917
+		if ($limit) {
918
+			$query .= " LIMIT 10 OFFSET 0";
919
+		}
861 920
 
862 921
 		$sth = $this->db->prepare($query);
863 922
 		$sth->execute();
@@ -891,12 +950,18 @@  discard block
 block discarded – undo
891 950
 		$query  = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count 
892 951
                     FROM marine_output".$filter_query." marine_output.ident <> ''";
893 952
 		 if ($olderthanmonths > 0) {
894
-			if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
895
-			else $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
953
+			if ($globalDBdriver == 'mysql') {
954
+				$query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)';
955
+			} else {
956
+				$query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
957
+			}
896 958
 		}
897 959
 		if ($sincedate != '') {
898
-			if ($globalDBdriver == 'mysql') $query .= " AND marine_output.date > '".$sincedate."'";
899
-			else $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
960
+			if ($globalDBdriver == 'mysql') {
961
+				$query .= " AND marine_output.date > '".$sincedate."'";
962
+			} else {
963
+				$query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)";
964
+			}
900 965
 		}
901 966
 		$query_values = array();
902 967
 		if ($year != '') {
@@ -927,7 +992,9 @@  discard block
 block discarded – undo
927 992
 			}
928 993
 		}
929 994
 		$query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC";
930
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
995
+		if ($limit) {
996
+			$query .= " LIMIT 10 OFFSET 0";
997
+		}
931 998
       		
932 999
 		$sth = $this->db->prepare($query);
933 1000
 		$sth->execute($query_values);
@@ -962,7 +1029,9 @@  discard block
 block discarded – undo
962 1029
 			date_default_timezone_set($globalTimezone);
963 1030
 			$datetime = new DateTime();
964 1031
 			$offset = $datetime->format('P');
965
-		} else $offset = '+00:00';
1032
+		} else {
1033
+			$offset = '+00:00';
1034
+		}
966 1035
 
967 1036
 		if ($globalDBdriver == 'mysql') {
968 1037
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1012,7 +1081,9 @@  discard block
 block discarded – undo
1012 1081
 			date_default_timezone_set($globalTimezone);
1013 1082
 			$datetime = new DateTime();
1014 1083
 			$offset = $datetime->format('P');
1015
-		} else $offset = '+00:00';
1084
+		} else {
1085
+			$offset = '+00:00';
1086
+		}
1016 1087
 		$filter_query = $this->getFilter($filters,true,true);
1017 1088
 		if ($globalDBdriver == 'mysql') {
1018 1089
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1058,7 +1129,9 @@  discard block
 block discarded – undo
1058 1129
 			date_default_timezone_set($globalTimezone);
1059 1130
 			$datetime = new DateTime();
1060 1131
 			$offset = $datetime->format('P');
1061
-		} else $offset = '+00:00';
1132
+		} else {
1133
+			$offset = '+00:00';
1134
+		}
1062 1135
 		$filter_query = $this->getFilter($filters,true,true);
1063 1136
 		if ($globalDBdriver == 'mysql') {
1064 1137
 			$query  = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count
@@ -1106,7 +1179,9 @@  discard block
 block discarded – undo
1106 1179
 			date_default_timezone_set($globalTimezone);
1107 1180
 			$datetime = new DateTime();
1108 1181
 			$offset = $datetime->format('P');
1109
-		} else $offset = '+00:00';
1182
+		} else {
1183
+			$offset = '+00:00';
1184
+		}
1110 1185
 
1111 1186
 		if ($globalDBdriver == 'mysql') {
1112 1187
 			$query  = "SELECT YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count
@@ -1155,7 +1230,9 @@  discard block
 block discarded – undo
1155 1230
 			date_default_timezone_set($globalTimezone);
1156 1231
 			$datetime = new DateTime();
1157 1232
 			$offset = $datetime->format('P');
1158
-		} else $offset = '+00:00';
1233
+		} else {
1234
+			$offset = '+00:00';
1235
+		}
1159 1236
 		$filter_query = $this->getFilter($filters,true,true);
1160 1237
 		if ($globalDBdriver == 'mysql') {
1161 1238
 			$query  = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count
@@ -1204,7 +1281,9 @@  discard block
 block discarded – undo
1204 1281
 			date_default_timezone_set($globalTimezone);
1205 1282
 			$datetime = new DateTime();
1206 1283
 			$offset = $datetime->format('P');
1207
-		} else $offset = '+00:00';
1284
+		} else {
1285
+			$offset = '+00:00';
1286
+		}
1208 1287
 
1209 1288
 		$orderby_sql = '';
1210 1289
 		if ($orderby == "hour")
@@ -1273,7 +1352,9 @@  discard block
 block discarded – undo
1273 1352
 			date_default_timezone_set($globalTimezone);
1274 1353
 			$datetime = new DateTime($date);
1275 1354
 			$offset = $datetime->format('P');
1276
-		} else $offset = '+00:00';
1355
+		} else {
1356
+			$offset = '+00:00';
1357
+		}
1277 1358
 
1278 1359
 		if ($globalDBdriver == 'mysql') {
1279 1360
 			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1321,7 +1402,9 @@  discard block
 block discarded – undo
1321 1402
 			date_default_timezone_set($globalTimezone);
1322 1403
 			$datetime = new DateTime();
1323 1404
 			$offset = $datetime->format('P');
1324
-		} else $offset = '+00:00';
1405
+		} else {
1406
+			$offset = '+00:00';
1407
+		}
1325 1408
 
1326 1409
 		if ($globalDBdriver == 'mysql') {
1327 1410
 			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1386,8 +1469,11 @@  discard block
 block discarded – undo
1386 1469
 				$query_values = array_merge($query_values,array(':month' => $month));
1387 1470
 			}
1388 1471
 		}
1389
-		if (empty($query_values)) $queryi .= $this->getFilter($filters);
1390
-		else $queryi .= $this->getFilter($filters,true,true).substr($query,4);
1472
+		if (empty($query_values)) {
1473
+			$queryi .= $this->getFilter($filters);
1474
+		} else {
1475
+			$queryi .= $this->getFilter($filters,true,true).substr($query,4);
1476
+		}
1391 1477
 		
1392 1478
 		$sth = $this->db->prepare($queryi);
1393 1479
 		$sth->execute($query_values);
@@ -1409,7 +1495,9 @@  discard block
 block discarded – undo
1409 1495
 			date_default_timezone_set($globalTimezone);
1410 1496
 			$datetime = new DateTime();
1411 1497
 			$offset = $datetime->format('P');
1412
-		} else $offset = '+00:00';
1498
+		} else {
1499
+			$offset = '+00:00';
1500
+		}
1413 1501
 
1414 1502
 		if ($globalDBdriver == 'mysql') {
1415 1503
 			$query  = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count
@@ -1513,7 +1601,9 @@  discard block
 block discarded – undo
1513 1601
 	*/
1514 1602
 	public function parseDirection($direction = 0)
1515 1603
 	{
1516
-		if ($direction == '') $direction = 0;
1604
+		if ($direction == '') {
1605
+			$direction = 0;
1606
+		}
1517 1607
 		$direction_array = array();
1518 1608
 		$temp_array = array();
1519 1609
 
@@ -1602,7 +1692,9 @@  discard block
 block discarded – undo
1602 1692
 		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1603 1693
 	
1604 1694
 		$Connection = new Connection($this->db);
1605
-		if (!$Connection->tableExists('countries')) return '';
1695
+		if (!$Connection->tableExists('countries')) {
1696
+			return '';
1697
+		}
1606 1698
 	
1607 1699
 		try {
1608 1700
 			/*
@@ -1622,9 +1714,13 @@  discard block
 block discarded – undo
1622 1714
 			$sth->closeCursor();
1623 1715
 			if (count($row) > 0) {
1624 1716
 				return $row;
1625
-			} else return '';
1717
+			} else {
1718
+				return '';
1719
+			}
1626 1720
 		} catch (PDOException $e) {
1627
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1721
+			if (isset($globalDebug) && $globalDebug) {
1722
+				echo 'Error : '.$e->getMessage()."\n";
1723
+			}
1628 1724
 			return '';
1629 1725
 		}
1630 1726
 	
@@ -1642,7 +1738,9 @@  discard block
 block discarded – undo
1642 1738
 		$iso2 = filter_var($iso2,FILTER_SANITIZE_STRING);
1643 1739
 	
1644 1740
 		$Connection = new Connection($this->db);
1645
-		if (!$Connection->tableExists('countries')) return '';
1741
+		if (!$Connection->tableExists('countries')) {
1742
+			return '';
1743
+		}
1646 1744
 	
1647 1745
 		try {
1648 1746
 			$query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1";
@@ -1654,9 +1752,13 @@  discard block
 block discarded – undo
1654 1752
 			$sth->closeCursor();
1655 1753
 			if (count($row) > 0) {
1656 1754
 				return $row;
1657
-			} else return '';
1755
+			} else {
1756
+				return '';
1757
+			}
1658 1758
 		} catch (PDOException $e) {
1659
-			if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n";
1759
+			if (isset($globalDebug) && $globalDebug) {
1760
+				echo 'Error : '.$e->getMessage()."\n";
1761
+			}
1660 1762
 			return '';
1661 1763
 		}
1662 1764
 	
@@ -1674,7 +1776,9 @@  discard block
 block discarded – undo
1674 1776
 	{
1675 1777
 		global $globalBitlyAccessToken;
1676 1778
 		
1677
-		if ($globalBitlyAccessToken == '') return $url;
1779
+		if ($globalBitlyAccessToken == '') {
1780
+			return $url;
1781
+		}
1678 1782
         
1679 1783
 		$google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url;
1680 1784
 		
@@ -1750,7 +1854,9 @@  discard block
 block discarded – undo
1750 1854
 			}
1751 1855
 		}
1752 1856
 		$query .= " GROUP BY marine_output.type ORDER BY marine_type_count DESC";
1753
-		if ($limit) $query .= " LIMIT 10 OFFSET 0";
1857
+		if ($limit) {
1858
+			$query .= " LIMIT 10 OFFSET 0";
1859
+		}
1754 1860
 		$sth = $this->db->prepare($query);
1755 1861
 		$sth->execute($query_values);
1756 1862
 		$marine_array = array();
Please login to merge, or discard this patch.
require/class.TrackerArchive.php 1 patch
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		if (isset($filter[0]['source'])) {
27 27
 			$filters = array_merge($filters,$filter);
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -72,8 +74,11 @@  discard block
 block discarded – undo
72 74
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
73 75
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74 76
 		}
75
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
76
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
77
+		if ($filter_query_where == '' && $where) {
78
+			$filter_query_where = ' WHERE';
79
+		} elseif ($filter_query_where != '' && $and) {
80
+			$filter_query_where .= ' AND';
81
+		}
77 82
 		if ($filter_query_where != '') {
78 83
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
79 84
 		}
@@ -87,9 +92,14 @@  discard block
 block discarded – undo
87 92
 		if ($over_country == '') {
88 93
 			$Tracker = new Tracker($this->db);
89 94
 			$data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude);
90
-			if (!empty($data_country)) $country = $data_country['iso2'];
91
-			else $country = '';
92
-		} else $country = $over_country;
95
+			if (!empty($data_country)) {
96
+				$country = $data_country['iso2'];
97
+			} else {
98
+				$country = '';
99
+			}
100
+		} else {
101
+			$country = $over_country;
102
+		}
93 103
 		// Route is not added in tracker_archive
94 104
 		$query  = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
95 105
 		    VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
@@ -588,7 +598,9 @@  discard block
 block discarded – undo
588 598
 		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
589 599
 		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
590 600
 		    $translate = $Translation->ident2icao($q_item);
591
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
601
+		    if ($translate != $q_item) {
602
+		    	$additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
603
+		    }
592 604
 		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
593 605
 		    $additional_query .= ")";
594 606
 		}
@@ -806,7 +818,9 @@  discard block
 block discarded – undo
806 818
 		date_default_timezone_set($globalTimezone);
807 819
 		$datetime = new DateTime();
808 820
 		$offset = $datetime->format('P');
809
-	    } else $offset = '+00:00';
821
+	    } else {
822
+	    	$offset = '+00:00';
823
+	    }
810 824
 
811 825
 
812 826
 	    if ($date_array[1] != "")
@@ -1082,9 +1096,13 @@  discard block
 block discarded – undo
1082 1096
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1083 1097
 			}
1084 1098
 		}
1085
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1099
+                if ($sincedate != '') {
1100
+                	$query .= "AND date > '".$sincedate."' ";
1101
+                }
1086 1102
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1087
-	if ($limit) $query .= " LIMIT 0,10";
1103
+	if ($limit) {
1104
+		$query .= " LIMIT 0,10";
1105
+	}
1088 1106
       
1089 1107
 	
1090 1108
 	$sth = $this->db->prepare($query);
@@ -1128,9 +1146,13 @@  discard block
 block discarded – undo
1128 1146
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1129 1147
 			}
1130 1148
 		}
1131
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1149
+                if ($sincedate != '') {
1150
+                	$query .= "AND s.date > '".$sincedate."' ";
1151
+                }
1132 1152
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1133
-	if ($limit) $query .= " LIMIT 0,10";
1153
+	if ($limit) {
1154
+		$query .= " LIMIT 0,10";
1155
+	}
1134 1156
       
1135 1157
 	
1136 1158
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
require/class.MarineArchive.php 1 patch
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		if (isset($filter[0]['source'])) {
27 27
 			$filters = array_merge($filters,$filter);
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -72,8 +74,11 @@  discard block
 block discarded – undo
72 74
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
73 75
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74 76
 		}
75
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
76
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
77
+		if ($filter_query_where == '' && $where) {
78
+			$filter_query_where = ' WHERE';
79
+		} elseif ($filter_query_where != '' && $and) {
80
+			$filter_query_where .= ' AND';
81
+		}
77 82
 		if ($filter_query_where != '') {
78 83
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
79 84
 		}
@@ -88,9 +93,14 @@  discard block
 block discarded – undo
88 93
 		if ($over_country == '') {
89 94
 			$Marine = new Marine($this->db);
90 95
 			$data_country = $Marine->getCountryFromLatitudeLongitude($latitude,$longitude);
91
-			if (!empty($data_country)) $country = $data_country['iso2'];
92
-			else $country = '';
93
-		} else $country = $over_country;
96
+			if (!empty($data_country)) {
97
+				$country = $data_country['iso2'];
98
+			} else {
99
+				$country = '';
100
+			}
101
+		} else {
102
+			$country = $over_country;
103
+		}
94 104
 		
95 105
 		//$country = $over_country;
96 106
 		// Route is not added in marine_archive
@@ -593,7 +603,9 @@  discard block
 block discarded – undo
593 603
 		    $additional_query .= "(marine_archive_output.pilot_name like '%".$q_item."%') OR ";
594 604
 		    $additional_query .= "(marine_archive_output.ident like '%".$q_item."%') OR ";
595 605
 		    $translate = $Translation->ident2icao($q_item);
596
-		    if ($translate != $q_item) $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR ";
606
+		    if ($translate != $q_item) {
607
+		    	$additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR ";
608
+		    }
597 609
 		    $additional_query .= "(marine_archive_output.highlight like '%".$q_item."%')";
598 610
 		    $additional_query .= ")";
599 611
 		}
@@ -811,7 +823,9 @@  discard block
 block discarded – undo
811 823
 		date_default_timezone_set($globalTimezone);
812 824
 		$datetime = new DateTime();
813 825
 		$offset = $datetime->format('P');
814
-	    } else $offset = '+00:00';
826
+	    } else {
827
+	    	$offset = '+00:00';
828
+	    }
815 829
 
816 830
 
817 831
 	    if ($date_array[1] != "")
@@ -1087,9 +1101,13 @@  discard block
 block discarded – undo
1087 1101
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1088 1102
 			}
1089 1103
 		}
1090
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1104
+                if ($sincedate != '') {
1105
+                	$query .= "AND date > '".$sincedate."' ";
1106
+                }
1091 1107
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1092
-	if ($limit) $query .= " LIMIT 0,10";
1108
+	if ($limit) {
1109
+		$query .= " LIMIT 0,10";
1110
+	}
1093 1111
       
1094 1112
 	
1095 1113
 	$sth = $this->db->prepare($query);
@@ -1133,9 +1151,13 @@  discard block
 block discarded – undo
1133 1151
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1134 1152
 			}
1135 1153
 		}
1136
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1154
+                if ($sincedate != '') {
1155
+                	$query .= "AND s.date > '".$sincedate."' ";
1156
+                }
1137 1157
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1138
-	if ($limit) $query .= " LIMIT 0,10";
1158
+	if ($limit) {
1159
+		$query .= " LIMIT 0,10";
1160
+	}
1139 1161
       
1140 1162
 	
1141 1163
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
statistics.php 2 patches
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.
Braces   +142 added lines, -60 removed lines patch added patch discarded remove patch
@@ -18,11 +18,15 @@  discard block
 block discarded – undo
18 18
 	require_once('require/class.Spotter.php');
19 19
 }
20 20
 
21
-if (!isset($filter_name)) $filter_name = '';
21
+if (!isset($filter_name)) {
22
+	$filter_name = '';
23
+}
22 24
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
23 25
 if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) {
24
-	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25
-}
26
+	if (isset($globalFilter['airline'])) {
27
+		$airline_icao = $globalFilter['airline'][0];
28
+	}
29
+	}
26 30
 if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') {
27 31
 	$Spotter = new Spotter();
28 32
 	$airline_info = $Spotter->getAllAirlineInfo($airline_icao);
@@ -53,7 +57,12 @@  discard block
 block discarded – undo
53 57
 <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script>
54 58
 <div class="column">
55 59
     <div class="info">
56
-            <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1>
60
+            <h1><?php if (isset($airline_name)) {
61
+	echo _("Statistics for ").$airline_name;
62
+} else {
63
+	echo _("Statistics");
64
+}
65
+?></h1>
57 66
 <?php 
58 67
 	if ($type == 'aircraft') {
59 68
 		$last_update = $Stats->getLastStatsUpdate();
@@ -61,7 +70,9 @@  discard block
 block discarded – undo
61 70
 		if (isset($last_update[0]['value'])) {
62 71
 			date_default_timezone_set('UTC');
63 72
 			$lastupdate = strtotime($last_update[0]['value']);
64
-			if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
73
+			if (isset($globalTimezone) && $globalTimezone != '') {
74
+				date_default_timezone_set($globalTimezone);
75
+			}
65 76
 			print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
66 77
 		}
67 78
 	}
@@ -137,8 +148,9 @@  discard block
 block discarded – undo
137 148
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
138 149
                  <?php
139 150
                   $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month);
140
-		    if (count($aircraft_array) == 0) print _("No data available");
141
-		    else {
151
+		    if (count($aircraft_array) == 0) {
152
+		    	print _("No data available");
153
+		    } else {
142 154
                     print '<div id="chart1" class="chart" width="100%"></div><script>';
143 155
                     $aircraft_data = '';
144 156
                     foreach($aircraft_array as $aircraft_item)
@@ -160,11 +172,17 @@  discard block
 block discarded – undo
160 172
             	    <?php
161 173
             		if ($year != '' && $month != '') {
162 174
             	    ?>
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>
175
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
176
+	echo '/'.$airline_icao;
177
+}
178
+?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
164 179
             	    <?php
165 180
             		} else {
166 181
             	    ?>
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>
182
+            	    <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
183
+	echo '/'.$airline_icao;
184
+}
185
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
168 186
             	    <?php
169 187
             		}
170 188
             	    ?>
@@ -195,11 +213,15 @@  discard block
 block discarded – undo
195 213
 				print '</script>';
196 214
 				if ($year != '' && $month != '') {
197 215
 					print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
198
-					if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
216
+					if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
217
+						echo '/'.$airline_icao;
218
+					}
199 219
 					print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
200 220
 				} else {
201 221
 					print '<div class="more"><a href="'.$globalURL.'/statistics/airline';
202
-					if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
222
+					if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
223
+						echo '/'.$airline_icao;
224
+					}
203 225
 					print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
204 226
 				}
205 227
 				print '</div>';
@@ -221,8 +243,9 @@  discard block
 block discarded – undo
221 243
                 <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2>
222 244
                  <?php
223 245
                   $marine_array = $Marine->countAllMarineTypes();
224
-		    if (count($marine_array) == 0) print _("No data available");
225
-		    else {
246
+		    if (count($marine_array) == 0) {
247
+		    	print _("No data available");
248
+		    } else {
226 249
                     print '<div id="chart1" class="chart" width="100%"></div><script>';
227 250
                     $marine_data = '';
228 251
                     foreach($marine_array as $marine_item)
@@ -277,8 +300,9 @@  discard block
 block discarded – undo
277 300
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
278 301
 <?php
279 302
 			$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month);
280
-			if (count($pilot_array) == 0) print _("No data available");
281
-			else {
303
+			if (count($pilot_array) == 0) {
304
+				print _("No data available");
305
+			} else {
282 306
 				print '<div id="chart7" class="chart" width="100%"></div><script>';
283 307
 				$pilot_data = '';
284 308
 				foreach($pilot_array as $pilot_item)
@@ -297,7 +321,9 @@  discard block
 block discarded – undo
297 321
 			}
298 322
 			print '<div class="more">';
299 323
 			print '<a href="'.$globalURL.'/statistics/pilot'; 
300
-			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
324
+			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
325
+				echo '/'.$airline_icao;
326
+			}
301 327
 			print'" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a>';
302 328
 			print '</div>';
303 329
 ?>
@@ -311,8 +337,9 @@  discard block
 block discarded – undo
311 337
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
312 338
 <?php
313 339
 			$owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month);
314
-			if (count($owner_array) == 0) print _("No data available");
315
-			else {
340
+			if (count($owner_array) == 0) {
341
+				print _("No data available");
342
+			} else {
316 343
 				print '<div id="chart7" class="chart" width="100%"></div><script>';
317 344
 				$owner_data = '';
318 345
 				foreach($owner_array as $owner_item)
@@ -331,7 +358,10 @@  discard block
 block discarded – undo
331 358
 			}
332 359
 ?>
333 360
                 <div class="more">
334
-                    <a href="<?php print $globalURL; ?>/statistics/owner<?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>
361
+                    <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
362
+	echo '/'.$airline_icao;
363
+}
364
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
335 365
                 </div>
336 366
             </div>
337 367
         
@@ -344,8 +374,9 @@  discard block
 block discarded – undo
344 374
                 <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
345 375
 <?php
346 376
 	 //$flightover_array = $Stats->countAllFlightOverCountries();
347
-			if (count($flightover_array) == 0) print _("No data available");
348
-			else {
377
+			if (count($flightover_array) == 0) {
378
+				print _("No data available");
379
+			} else {
349 380
 				print '<div id="chart10" class="chart" width="100%"></div><script>';
350 381
 				print 'var series = [';
351 382
 				$flightover_data = '';
@@ -388,7 +419,10 @@  discard block
 block discarded – undo
388 419
 			}
389 420
 ?>
390 421
                 <div class="more">
391
-                    <a href="<?php print $globalURL; ?>/statistics/country<?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>
422
+                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
423
+	echo '/'.$airline_icao;
424
+}
425
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
392 426
                 </div>
393 427
             </div>
394 428
 <?php
@@ -410,8 +444,9 @@  discard block
 block discarded – undo
410 444
 	<div class="col-md-6">
411 445
             <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2>
412 446
 <?php
413
-		if (count($flightover_array) == 0) print _("No data available");
414
-		else {
447
+		if (count($flightover_array) == 0) {
448
+			print _("No data available");
449
+		} else {
415 450
 			print '<div id="chart10" class="chart" width="100%"></div><script>';
416 451
 			print 'var series = [';
417 452
 			$flightover_data = '';
@@ -455,7 +490,10 @@  discard block
 block discarded – undo
455 490
 ?>
456 491
                 <!--
457 492
                 <div class="more">
458
-                    <a href="<?php print $globalURL; ?>/statistics/country<?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>
493
+                    <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
494
+	echo '/'.$airline_icao;
495
+}
496
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
459 497
                 </div>
460 498
                 -->
461 499
             </div>
@@ -523,7 +561,9 @@  discard block
 block discarded – undo
523 561
 			});";
524 562
 			print '</script>';
525 563
 			print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; 
526
-			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
564
+			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
565
+				echo '/'.$airline_icao;
566
+			}
527 567
 			print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
528 568
 		}
529 569
 ?>
@@ -585,7 +625,9 @@  discard block
 block discarded – undo
585 625
 			});";
586 626
 			print '</script>';
587 627
 			print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival';
588
-			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao;
628
+			if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
629
+				echo '/'.$airline_icao;
630
+			}
589 631
 			print '" class="btn btn-default btn" role="button">'._("See full statistic").'&raquo;</a></div>';
590 632
 		}
591 633
 ?>
@@ -606,8 +648,9 @@  discard block
 block discarded – undo
606 648
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
607 649
 <?php
608 650
 			$year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
609
-			if (count($year_array) == 0) print _("No data available");
610
-			else {
651
+			if (count($year_array) == 0) {
652
+				print _("No data available");
653
+			} else {
611 654
 				print '<div id="chart8" class="chart" width="100%"></div><script>';
612 655
 				$year_data = '';
613 656
 				$year_cnt = '';
@@ -627,7 +670,10 @@  discard block
 block discarded – undo
627 670
 			}
628 671
 ?>
629 672
                 <div class="more">
630
-                    <a href="<?php print $globalURL; ?>/statistics/year<?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>
673
+                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
674
+	echo '/'.$airline_icao;
675
+}
676
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
631 677
                 </div>
632 678
             </div>
633 679
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -635,8 +681,9 @@  discard block
 block discarded – undo
635 681
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
636 682
 <?php
637 683
 			$month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
638
-			if (count($month_array) == 0) print _("No data available");
639
-			else {
684
+			if (count($month_array) == 0) {
685
+				print _("No data available");
686
+			} else {
640 687
 				print '<div id="chart9" class="chart" width="100%"></div><script>';
641 688
 				$month_data = '';
642 689
 				$month_cnt = '';
@@ -656,7 +703,10 @@  discard block
 block discarded – undo
656 703
 			}
657 704
 ?>
658 705
                 <div class="more">
659
-                    <a href="<?php print $globalURL; ?>/statistics/month<?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>
706
+                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
707
+	echo '/'.$airline_icao;
708
+}
709
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
660 710
                 </div>
661 711
             </div>
662 712
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -665,8 +715,9 @@  discard block
 block discarded – undo
665 715
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
666 716
 <?php
667 717
 			$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
668
-			if (empty($date_array)) print _("No data available");
669
-			else {
718
+			if (empty($date_array)) {
719
+				print _("No data available");
720
+			} else {
670 721
 				print '<div id="chart5" class="chart" width="100%"></div><script>';
671 722
 				$date_data = '';
672 723
 				$date_cnt = '';
@@ -686,7 +737,10 @@  discard block
 block discarded – undo
686 737
 			}
687 738
 ?>
688 739
                 <div class="more">
689
-                    <a href="<?php print $globalURL; ?>/statistics/date<?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>
740
+                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
741
+	echo '/'.$airline_icao;
742
+}
743
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
690 744
                 </div>
691 745
             </div>
692 746
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -694,8 +748,9 @@  discard block
 block discarded – undo
694 748
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
695 749
 <?php
696 750
 			$hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
697
-			if (empty($hour_array)) print _("No data available");
698
-			else {
751
+			if (empty($hour_array)) {
752
+				print _("No data available");
753
+			} else {
699 754
 				print '<div id="chart6" class="chart" width="100%"></div><script>';
700 755
 				$hour_data = '';
701 756
 				$hour_cnt = '';
@@ -715,7 +770,10 @@  discard block
 block discarded – undo
715 770
 			}
716 771
 ?>
717 772
                 <div class="more">
718
-                    <a href="<?php print $globalURL; ?>/statistics/time<?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>
773
+                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
774
+	echo '/'.$airline_icao;
775
+}
776
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
719 777
                 </div>
720 778
             </div>
721 779
     <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
@@ -737,8 +795,9 @@  discard block
 block discarded – undo
737 795
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
738 796
 <?php
739 797
 			$year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name);
740
-			if (count($year_array) == 0) print _("No data available");
741
-			else {
798
+			if (count($year_array) == 0) {
799
+				print _("No data available");
800
+			} else {
742 801
 				print '<div id="chart8" class="chart" width="100%"></div><script>';
743 802
 				$year_data = '';
744 803
 				$year_cnt = '';
@@ -759,7 +818,10 @@  discard block
 block discarded – undo
759 818
 ?>
760 819
 	    <!--
761 820
                 <div class="more">
762
-                    <a href="<?php print $globalURL; ?>/statistics/year<?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>
821
+                    <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
822
+	echo '/'.$airline_icao;
823
+}
824
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
763 825
                 </div>
764 826
                 -->
765 827
             </div>
@@ -769,8 +831,9 @@  discard block
 block discarded – undo
769 831
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
770 832
 <?php
771 833
 			$month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name);
772
-			if (count($month_array) == 0) print _("No data available");
773
-			else {
834
+			if (count($month_array) == 0) {
835
+				print _("No data available");
836
+			} else {
774 837
 				print '<div id="chart9" class="chart" width="100%"></div><script>';
775 838
 				$month_data = '';
776 839
 				$month_cnt = '';
@@ -791,7 +854,10 @@  discard block
 block discarded – undo
791 854
 ?>
792 855
                <!--
793 856
                 <div class="more">
794
-                    <a href="<?php print $globalURL; ?>/statistics/month<?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>
857
+                    <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
858
+	echo '/'.$airline_icao;
859
+}
860
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
795 861
                 </div>
796 862
                 -->
797 863
                 
@@ -802,8 +868,9 @@  discard block
 block discarded – undo
802 868
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
803 869
 <?php
804 870
 			$date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name);
805
-			if (empty($date_array)) print _("No data available");
806
-			else {
871
+			if (empty($date_array)) {
872
+				print _("No data available");
873
+			} else {
807 874
 				print '<div id="chart5" class="chart" width="100%"></div><script>';
808 875
 				$date_data = '';
809 876
 				$date_cnt = '';
@@ -824,7 +891,10 @@  discard block
 block discarded – undo
824 891
 ?>
825 892
                 <!--
826 893
                 <div class="more">
827
-                    <a href="<?php print $globalURL; ?>/statistics/date<?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>
894
+                    <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
895
+	echo '/'.$airline_icao;
896
+}
897
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
828 898
                 </div>
829 899
                 -->
830 900
             </div>
@@ -833,8 +903,9 @@  discard block
 block discarded – undo
833 903
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
834 904
 <?php
835 905
 			$hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name);
836
-			if (empty($hour_array)) print _("No data available");
837
-			else {
906
+			if (empty($hour_array)) {
907
+				print _("No data available");
908
+			} else {
838 909
 				print '<div id="chart6" class="chart" width="100%"></div><script>';
839 910
 				$hour_data = '';
840 911
 				$hour_cnt = '';
@@ -855,7 +926,10 @@  discard block
 block discarded – undo
855 926
 ?>
856 927
                 <!--
857 928
                 <div class="more">
858
-                    <a href="<?php print $globalURL; ?>/statistics/time<?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>
929
+                    <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
930
+	echo '/'.$airline_icao;
931
+}
932
+?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
859 933
                 </div>
860 934
                 -->
861 935
             </div>
@@ -878,8 +952,9 @@  discard block
 block discarded – undo
878 952
                 <h2><?php echo _("Fatalities by Years"); ?></h2>
879 953
 <?php
880 954
 			$year_array = $Stats->countFatalitiesByYear();
881
-			if (count($year_array) == 0) print _("No data available");
882
-			else {
955
+			if (count($year_array) == 0) {
956
+				print _("No data available");
957
+			} else {
883 958
 				print '<div id="chart32" class="chart" width="100%"></div><script>';
884 959
 				$year_data = '';
885 960
 				$year_cnt = '';
@@ -909,8 +984,9 @@  discard block
 block discarded – undo
909 984
                 <h2><?php echo _("Fatalities last 12 Months"); ?></h2>
910 985
 <?php
911 986
 			$year_array = $Stats->countFatalitiesLast12Months();
912
-			if (count($year_array) == 0) print _("No data available");
913
-			else {
987
+			if (count($year_array) == 0) {
988
+				print _("No data available");
989
+			} else {
914 990
 				print '<div id="chart33" class="chart" width="100%"></div><script>';
915 991
 				$year_data = '';
916 992
 				$year_cnt = '';
@@ -975,8 +1051,11 @@  discard block
 block discarded – undo
975 1051
 							$distance = $distance;
976 1052
 							$unit = 'km';
977 1053
 						}
978
-						if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
979
-						else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1054
+						if (!isset($polar_data)) {
1055
+							$polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1056
+						} else {
1057
+							$polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}';
1058
+						}
980 1059
 					}
981 1060
 ?>
982 1061
             <div class="col-md-6">
@@ -1028,9 +1107,12 @@  discard block
 block discarded – undo
1028 1107
 				foreach ($msg as $eachmsg) {
1029 1108
 					//$eachmsg = $msg[0];
1030 1109
 					$data = $eachmsg['source_data'];
1031
-					if ($data > 500) $max = (round(($data+100)/100))*100;
1032
-					else $max = 500;
1033
-?>
1110
+					if ($data > 500) {
1111
+						$max = (round(($data+100)/100))*100;
1112
+					} else {
1113
+						$max = 500;
1114
+					}
1115
+					?>
1034 1116
         	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
1035 1117
         	<script>
1036 1118
 		      var g = new JustGage({
Please login to merge, or discard this patch.