@@ -96,8 +96,11 @@ |
||
96 | 96 | } elseif (isset($_GET['marine'])) { |
97 | 97 | readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename); |
98 | 98 | } else { |
99 | - if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename); |
|
100 | - else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename); |
|
99 | + if ($color == 'FF0000') { |
|
100 | + readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename); |
|
101 | + } else { |
|
102 | + readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename); |
|
103 | + } |
|
101 | 104 | } |
102 | 105 | } |
103 | 106 | ?> |
104 | 107 | \ No newline at end of file |
@@ -63,7 +63,9 @@ |
||
63 | 63 | { |
64 | 64 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
65 | 65 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
66 | - } else $image = $spotter_item['image_thumbnail']; |
|
66 | + } else { |
|
67 | + $image = $spotter_item['image_thumbnail']; |
|
68 | + } |
|
67 | 69 | |
68 | 70 | } |
69 | 71 | /* else { |
@@ -31,7 +31,9 @@ discard block |
||
31 | 31 | if (isset($filter[0]['source'])) { |
32 | 32 | $filters = array_merge($filters,$filter); |
33 | 33 | } |
34 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
34 | + if (is_array($globalFilter)) { |
|
35 | + $filter = array_merge($filter,$globalFilter); |
|
36 | + } |
|
35 | 37 | $filter_query_join = ''; |
36 | 38 | $filter_query_where = ''; |
37 | 39 | foreach($filters as $flt) { |
@@ -70,8 +72,11 @@ discard block |
||
70 | 72 | $filter_query_where .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
71 | 73 | } |
72 | 74 | } |
73 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
74 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
75 | + if ($filter_query_where == '' && $where) { |
|
76 | + $filter_query_where = ' WHERE'; |
|
77 | + } elseif ($filter_query_where != '' && $and) { |
|
78 | + $filter_query_where .= ' AND'; |
|
79 | + } |
|
75 | 80 | if ($filter_query_where != '') { |
76 | 81 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
77 | 82 | } |
@@ -125,26 +130,43 @@ discard block |
||
125 | 130 | $temp_array['spotter_id'] = $row['spotter_archive_id']; |
126 | 131 | } elseif (isset($row['spotter_archive_output_id'])) { |
127 | 132 | $temp_array['spotter_id'] = $row['spotter_archive_output_id']; |
128 | - */} |
|
129 | - elseif (isset($row['trackerid'])) { |
|
133 | + */} elseif (isset($row['trackerid'])) { |
|
130 | 134 | $temp_array['trackerid'] = $row['trackerid']; |
131 | 135 | } else { |
132 | 136 | $temp_array['trackerid'] = ''; |
133 | 137 | } |
134 | - if (isset($row['famtrackid'])) $temp_array['famtrackid'] = $row['famtrackid']; |
|
135 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
136 | - if (isset($row['comment'])) $temp_array['comment'] = $row['comment']; |
|
138 | + if (isset($row['famtrackid'])) { |
|
139 | + $temp_array['famtrackid'] = $row['famtrackid']; |
|
140 | + } |
|
141 | + if (isset($row['type'])) { |
|
142 | + $temp_array['type'] = $row['type']; |
|
143 | + } |
|
144 | + if (isset($row['comment'])) { |
|
145 | + $temp_array['comment'] = $row['comment']; |
|
146 | + } |
|
137 | 147 | $temp_array['ident'] = $row['ident']; |
138 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
139 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
140 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
141 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
148 | + if (isset($row['latitude'])) { |
|
149 | + $temp_array['latitude'] = $row['latitude']; |
|
150 | + } |
|
151 | + if (isset($row['longitude'])) { |
|
152 | + $temp_array['longitude'] = $row['longitude']; |
|
153 | + } |
|
154 | + if (isset($row['format_source'])) { |
|
155 | + $temp_array['format_source'] = $row['format_source']; |
|
156 | + } |
|
157 | + if (isset($row['altitude'])) { |
|
158 | + $temp_array['altitude'] = $row['altitude']; |
|
159 | + } |
|
142 | 160 | if (isset($row['heading'])) { |
143 | 161 | $temp_array['heading'] = $row['heading']; |
144 | 162 | $heading_direction = $this->parseDirection($row['heading']); |
145 | - 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']; |
|
146 | 169 | } |
147 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
148 | 170 | |
149 | 171 | if (isset($row['date'])) { |
150 | 172 | $dateArray = $this->parseDateString($row['date']); |
@@ -187,13 +209,21 @@ discard block |
||
187 | 209 | } |
188 | 210 | |
189 | 211 | $fromsource = NULL; |
190 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
191 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
192 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
212 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
213 | + $temp_array['source_name'] = $row['source_name']; |
|
214 | + } |
|
215 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
216 | + $temp_array['over_country'] = $row['over_country']; |
|
217 | + } |
|
218 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
219 | + $temp_array['distance'] = $row['distance']; |
|
220 | + } |
|
193 | 221 | $temp_array['query_number_rows'] = $num_rows; |
194 | 222 | $spotter_array[] = $temp_array; |
195 | 223 | } |
196 | - if ($num_rows == 0) return array(); |
|
224 | + if ($num_rows == 0) { |
|
225 | + return array(); |
|
226 | + } |
|
197 | 227 | $spotter_array[0]['query_number_rows'] = $num_rows; |
198 | 228 | return $spotter_array; |
199 | 229 | } |
@@ -224,8 +254,12 @@ discard block |
||
224 | 254 | { |
225 | 255 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
226 | 256 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
227 | - } else $limit_query = ""; |
|
228 | - } else $limit_query = ""; |
|
257 | + } else { |
|
258 | + $limit_query = ""; |
|
259 | + } |
|
260 | + } else { |
|
261 | + $limit_query = ""; |
|
262 | + } |
|
229 | 263 | |
230 | 264 | if ($sort != "") |
231 | 265 | { |
@@ -253,7 +287,9 @@ discard block |
||
253 | 287 | global $global_query; |
254 | 288 | |
255 | 289 | date_default_timezone_set('UTC'); |
256 | - if ($id == '') return array(); |
|
290 | + if ($id == '') { |
|
291 | + return array(); |
|
292 | + } |
|
257 | 293 | $additional_query = "tracker_output.famtrackid = :id"; |
258 | 294 | $query_values = array(':id' => $id); |
259 | 295 | $query = $global_query." WHERE ".$additional_query." "; |
@@ -396,8 +432,11 @@ discard block |
||
396 | 432 | $query .= " ORDER BY tracker_output.source_name ASC"; |
397 | 433 | |
398 | 434 | $sth = $this->db->prepare($query); |
399 | - if (!empty($query_values)) $sth->execute($query_values); |
|
400 | - else $sth->execute(); |
|
435 | + if (!empty($query_values)) { |
|
436 | + $sth->execute($query_values); |
|
437 | + } else { |
|
438 | + $sth->execute(); |
|
439 | + } |
|
401 | 440 | |
402 | 441 | $source_array = array(); |
403 | 442 | $temp_array = array(); |
@@ -452,7 +491,9 @@ discard block |
||
452 | 491 | date_default_timezone_set($globalTimezone); |
453 | 492 | $datetime = new DateTime(); |
454 | 493 | $offset = $datetime->format('P'); |
455 | - } else $offset = '+00:00'; |
|
494 | + } else { |
|
495 | + $offset = '+00:00'; |
|
496 | + } |
|
456 | 497 | |
457 | 498 | if ($globalDBdriver == 'mysql') { |
458 | 499 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
@@ -608,7 +649,9 @@ discard block |
||
608 | 649 | { |
609 | 650 | return false; |
610 | 651 | } |
611 | - } else $altitude = 0; |
|
652 | + } else { |
|
653 | + $altitude = 0; |
|
654 | + } |
|
612 | 655 | |
613 | 656 | if ($heading != "") |
614 | 657 | { |
@@ -647,8 +690,12 @@ discard block |
||
647 | 690 | $latitude = 0; |
648 | 691 | $longitude = 0; |
649 | 692 | } |
650 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
651 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
693 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
694 | + $heading = 0; |
|
695 | + } |
|
696 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
697 | + $groundspeed = 0; |
|
698 | + } |
|
652 | 699 | $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
653 | 700 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
654 | 701 | |
@@ -813,12 +860,18 @@ discard block |
||
813 | 860 | $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
814 | 861 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
815 | 862 | if ($olderthanmonths > 0) { |
816 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
817 | - else $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
863 | + if ($globalDBdriver == 'mysql') { |
|
864 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
865 | + } else { |
|
866 | + $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
867 | + } |
|
818 | 868 | } |
819 | 869 | if ($sincedate != '') { |
820 | - if ($globalDBdriver == 'mysql') $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
821 | - else $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
870 | + if ($globalDBdriver == 'mysql') { |
|
871 | + $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
872 | + } else { |
|
873 | + $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
874 | + } |
|
822 | 875 | } |
823 | 876 | $query_values = array(); |
824 | 877 | if ($year != '') { |
@@ -849,7 +902,9 @@ discard block |
||
849 | 902 | } |
850 | 903 | } |
851 | 904 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
852 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
905 | + if ($limit) { |
|
906 | + $query .= " LIMIT 10 OFFSET 0"; |
|
907 | + } |
|
853 | 908 | |
854 | 909 | $sth = $this->db->prepare($query); |
855 | 910 | $sth->execute($query_values); |
@@ -884,7 +939,9 @@ discard block |
||
884 | 939 | date_default_timezone_set($globalTimezone); |
885 | 940 | $datetime = new DateTime(); |
886 | 941 | $offset = $datetime->format('P'); |
887 | - } else $offset = '+00:00'; |
|
942 | + } else { |
|
943 | + $offset = '+00:00'; |
|
944 | + } |
|
888 | 945 | |
889 | 946 | if ($globalDBdriver == 'mysql') { |
890 | 947 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -934,7 +991,9 @@ discard block |
||
934 | 991 | date_default_timezone_set($globalTimezone); |
935 | 992 | $datetime = new DateTime(); |
936 | 993 | $offset = $datetime->format('P'); |
937 | - } else $offset = '+00:00'; |
|
994 | + } else { |
|
995 | + $offset = '+00:00'; |
|
996 | + } |
|
938 | 997 | $filter_query = $this->getFilter($filters,true,true); |
939 | 998 | if ($globalDBdriver == 'mysql') { |
940 | 999 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -980,7 +1039,9 @@ discard block |
||
980 | 1039 | date_default_timezone_set($globalTimezone); |
981 | 1040 | $datetime = new DateTime(); |
982 | 1041 | $offset = $datetime->format('P'); |
983 | - } else $offset = '+00:00'; |
|
1042 | + } else { |
|
1043 | + $offset = '+00:00'; |
|
1044 | + } |
|
984 | 1045 | $filter_query = $this->getFilter($filters,true,true); |
985 | 1046 | if ($globalDBdriver == 'mysql') { |
986 | 1047 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1028,7 +1089,9 @@ discard block |
||
1028 | 1089 | date_default_timezone_set($globalTimezone); |
1029 | 1090 | $datetime = new DateTime(); |
1030 | 1091 | $offset = $datetime->format('P'); |
1031 | - } else $offset = '+00:00'; |
|
1092 | + } else { |
|
1093 | + $offset = '+00:00'; |
|
1094 | + } |
|
1032 | 1095 | |
1033 | 1096 | if ($globalDBdriver == 'mysql') { |
1034 | 1097 | $query = "SELECT YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1077,7 +1140,9 @@ discard block |
||
1077 | 1140 | date_default_timezone_set($globalTimezone); |
1078 | 1141 | $datetime = new DateTime(); |
1079 | 1142 | $offset = $datetime->format('P'); |
1080 | - } else $offset = '+00:00'; |
|
1143 | + } else { |
|
1144 | + $offset = '+00:00'; |
|
1145 | + } |
|
1081 | 1146 | $filter_query = $this->getFilter($filters,true,true); |
1082 | 1147 | if ($globalDBdriver == 'mysql') { |
1083 | 1148 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -1126,7 +1191,9 @@ discard block |
||
1126 | 1191 | date_default_timezone_set($globalTimezone); |
1127 | 1192 | $datetime = new DateTime(); |
1128 | 1193 | $offset = $datetime->format('P'); |
1129 | - } else $offset = '+00:00'; |
|
1194 | + } else { |
|
1195 | + $offset = '+00:00'; |
|
1196 | + } |
|
1130 | 1197 | |
1131 | 1198 | $orderby_sql = ''; |
1132 | 1199 | if ($orderby == "hour") |
@@ -1195,7 +1262,9 @@ discard block |
||
1195 | 1262 | date_default_timezone_set($globalTimezone); |
1196 | 1263 | $datetime = new DateTime($date); |
1197 | 1264 | $offset = $datetime->format('P'); |
1198 | - } else $offset = '+00:00'; |
|
1265 | + } else { |
|
1266 | + $offset = '+00:00'; |
|
1267 | + } |
|
1199 | 1268 | |
1200 | 1269 | if ($globalDBdriver == 'mysql') { |
1201 | 1270 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1243,7 +1312,9 @@ discard block |
||
1243 | 1312 | date_default_timezone_set($globalTimezone); |
1244 | 1313 | $datetime = new DateTime(); |
1245 | 1314 | $offset = $datetime->format('P'); |
1246 | - } else $offset = '+00:00'; |
|
1315 | + } else { |
|
1316 | + $offset = '+00:00'; |
|
1317 | + } |
|
1247 | 1318 | |
1248 | 1319 | if ($globalDBdriver == 'mysql') { |
1249 | 1320 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1307,8 +1378,11 @@ discard block |
||
1307 | 1378 | $query_values = array_merge($query_values,array(':month' => $month)); |
1308 | 1379 | } |
1309 | 1380 | } |
1310 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1311 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1381 | + if (empty($query_values)) { |
|
1382 | + $queryi .= $this->getFilter($filters); |
|
1383 | + } else { |
|
1384 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1385 | + } |
|
1312 | 1386 | |
1313 | 1387 | $sth = $this->db->prepare($queryi); |
1314 | 1388 | $sth->execute($query_values); |
@@ -1330,7 +1404,9 @@ discard block |
||
1330 | 1404 | date_default_timezone_set($globalTimezone); |
1331 | 1405 | $datetime = new DateTime(); |
1332 | 1406 | $offset = $datetime->format('P'); |
1333 | - } else $offset = '+00:00'; |
|
1407 | + } else { |
|
1408 | + $offset = '+00:00'; |
|
1409 | + } |
|
1334 | 1410 | |
1335 | 1411 | if ($globalDBdriver == 'mysql') { |
1336 | 1412 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1434,7 +1510,9 @@ discard block |
||
1434 | 1510 | */ |
1435 | 1511 | public function parseDirection($direction = 0) |
1436 | 1512 | { |
1437 | - if ($direction == '') $direction = 0; |
|
1513 | + if ($direction == '') { |
|
1514 | + $direction = 0; |
|
1515 | + } |
|
1438 | 1516 | $direction_array = array(); |
1439 | 1517 | $temp_array = array(); |
1440 | 1518 | |
@@ -1523,7 +1601,9 @@ discard block |
||
1523 | 1601 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1524 | 1602 | |
1525 | 1603 | $Connection = new Connection($this->db); |
1526 | - if (!$Connection->tableExists('countries')) return ''; |
|
1604 | + if (!$Connection->tableExists('countries')) { |
|
1605 | + return ''; |
|
1606 | + } |
|
1527 | 1607 | |
1528 | 1608 | try { |
1529 | 1609 | /* |
@@ -1543,9 +1623,13 @@ discard block |
||
1543 | 1623 | $sth->closeCursor(); |
1544 | 1624 | if (count($row) > 0) { |
1545 | 1625 | return $row; |
1546 | - } else return ''; |
|
1626 | + } else { |
|
1627 | + return ''; |
|
1628 | + } |
|
1547 | 1629 | } catch (PDOException $e) { |
1548 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1630 | + if (isset($globalDebug) && $globalDebug) { |
|
1631 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1632 | + } |
|
1549 | 1633 | return ''; |
1550 | 1634 | } |
1551 | 1635 | |
@@ -1563,7 +1647,9 @@ discard block |
||
1563 | 1647 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
1564 | 1648 | |
1565 | 1649 | $Connection = new Connection($this->db); |
1566 | - if (!$Connection->tableExists('countries')) return ''; |
|
1650 | + if (!$Connection->tableExists('countries')) { |
|
1651 | + return ''; |
|
1652 | + } |
|
1567 | 1653 | |
1568 | 1654 | try { |
1569 | 1655 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1575,9 +1661,13 @@ discard block |
||
1575 | 1661 | $sth->closeCursor(); |
1576 | 1662 | if (count($row) > 0) { |
1577 | 1663 | return $row; |
1578 | - } else return ''; |
|
1664 | + } else { |
|
1665 | + return ''; |
|
1666 | + } |
|
1579 | 1667 | } catch (PDOException $e) { |
1580 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1668 | + if (isset($globalDebug) && $globalDebug) { |
|
1669 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1670 | + } |
|
1581 | 1671 | return ''; |
1582 | 1672 | } |
1583 | 1673 | |
@@ -1595,7 +1685,9 @@ discard block |
||
1595 | 1685 | { |
1596 | 1686 | global $globalBitlyAccessToken; |
1597 | 1687 | |
1598 | - if ($globalBitlyAccessToken == '') return $url; |
|
1688 | + if ($globalBitlyAccessToken == '') { |
|
1689 | + return $url; |
|
1690 | + } |
|
1599 | 1691 | |
1600 | 1692 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
1601 | 1693 |
@@ -63,7 +63,9 @@ |
||
63 | 63 | { |
64 | 64 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
65 | 65 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
66 | - } else $image = $spotter_item['image_thumbnail']; |
|
66 | + } else { |
|
67 | + $image = $spotter_item['image_thumbnail']; |
|
68 | + } |
|
67 | 69 | |
68 | 70 | } |
69 | 71 | /* else { |
@@ -37,8 +37,11 @@ discard block |
||
37 | 37 | } else { |
38 | 38 | curl_setopt($ch, CURLOPT_USERAGENT, $useragent); |
39 | 39 | } |
40 | - if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
41 | - else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
40 | + if ($timeout == '') { |
|
41 | + curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
42 | + } else { |
|
43 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
44 | + } |
|
42 | 45 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
43 | 46 | if ($type == 'post') { |
44 | 47 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
@@ -85,8 +88,9 @@ discard block |
||
85 | 88 | private function curlResponseHeaderCallback($ch, $headerLine) { |
86 | 89 | //global $cookies; |
87 | 90 | $cookies = array(); |
88 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
89 | - $cookies[] = $cookie; |
|
91 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
92 | + $cookies[] = $cookie; |
|
93 | + } |
|
90 | 94 | return strlen($headerLine); // Needed by curl |
91 | 95 | } |
92 | 96 | |
@@ -97,11 +101,15 @@ discard block |
||
97 | 101 | curl_setopt($ch, CURLOPT_URL, $url); |
98 | 102 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
99 | 103 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
100 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
104 | + if ($referer != '') { |
|
105 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
106 | + } |
|
101 | 107 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
102 | 108 | curl_setopt($ch, CURLOPT_FILE, $fp); |
103 | 109 | curl_exec($ch); |
104 | - if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch); |
|
110 | + if (curl_errno($ch) && $globalDebug) { |
|
111 | + echo 'Download error: '.curl_error($ch); |
|
112 | + } |
|
105 | 113 | curl_close($ch); |
106 | 114 | fclose($fp); |
107 | 115 | } |
@@ -112,10 +120,16 @@ discard block |
||
112 | 120 | * @return Array array of the tables in HTML page |
113 | 121 | */ |
114 | 122 | public function table2array($data) { |
115 | - if (!is_string($data)) return array(); |
|
116 | - if ($data == '') return array(); |
|
123 | + if (!is_string($data)) { |
|
124 | + return array(); |
|
125 | + } |
|
126 | + if ($data == '') { |
|
127 | + return array(); |
|
128 | + } |
|
117 | 129 | $html = str_get_html($data); |
118 | - if ($html === false) return array(); |
|
130 | + if ($html === false) { |
|
131 | + return array(); |
|
132 | + } |
|
119 | 133 | $tabledata=array(); |
120 | 134 | foreach($html->find('tr') as $element) |
121 | 135 | { |
@@ -150,7 +164,9 @@ discard block |
||
150 | 164 | */ |
151 | 165 | public function text2array($data) { |
152 | 166 | $html = str_get_html($data); |
153 | - if ($html === false) return array(); |
|
167 | + if ($html === false) { |
|
168 | + return array(); |
|
169 | + } |
|
154 | 170 | $tabledata=array(); |
155 | 171 | foreach($html->find('p') as $element) |
156 | 172 | { |
@@ -171,7 +187,9 @@ discard block |
||
171 | 187 | * @return Float Distance in $unit |
172 | 188 | */ |
173 | 189 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
174 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
190 | + if ($lat == $latc && $lon == $lonc) { |
|
191 | + return 0; |
|
192 | + } |
|
175 | 193 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
176 | 194 | if ($unit == "km") { |
177 | 195 | return round($dist * 1.609344); |
@@ -195,10 +213,16 @@ discard block |
||
195 | 213 | public function withinThreshold ($timeDifference, $distance) { |
196 | 214 | $x = abs($timeDifference); |
197 | 215 | $d = abs($distance); |
198 | - if ($x == 0 || $d == 0) return true; |
|
216 | + if ($x == 0 || $d == 0) { |
|
217 | + return true; |
|
218 | + } |
|
199 | 219 | // may be due to Internet jitter; distance is realistic |
200 | - if ($x < 0.7 && $d < 2000) return true; |
|
201 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
220 | + if ($x < 0.7 && $d < 2000) { |
|
221 | + return true; |
|
222 | + } else { |
|
223 | + return $d/$x < 1500*0.27778; |
|
224 | + } |
|
225 | + // 1500 km/h max |
|
202 | 226 | } |
203 | 227 | |
204 | 228 | |
@@ -226,11 +250,17 @@ discard block |
||
226 | 250 | |
227 | 251 | public function convertDM($coord,$latlong) { |
228 | 252 | if ($latlong == 'latitude') { |
229 | - if ($coord < 0) $NSEW = 'S'; |
|
230 | - else $NSEW = 'N'; |
|
253 | + if ($coord < 0) { |
|
254 | + $NSEW = 'S'; |
|
255 | + } else { |
|
256 | + $NSEW = 'N'; |
|
257 | + } |
|
231 | 258 | } elseif ($latlong == 'longitude') { |
232 | - if ($coord < 0) $NSEW = 'W'; |
|
233 | - else $NSEW = 'E'; |
|
259 | + if ($coord < 0) { |
|
260 | + $NSEW = 'W'; |
|
261 | + } else { |
|
262 | + $NSEW = 'E'; |
|
263 | + } |
|
234 | 264 | } |
235 | 265 | $coord = abs($coord); |
236 | 266 | $deg = floor($coord); |
@@ -273,7 +303,9 @@ discard block |
||
273 | 303 | public function hex2str($hex) { |
274 | 304 | $str = ''; |
275 | 305 | $hexln = strlen($hex); |
276 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
306 | + for($i=0;$i<$hexln;$i+=2) { |
|
307 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
308 | + } |
|
277 | 309 | return $str; |
278 | 310 | } |
279 | 311 | |
@@ -301,8 +333,11 @@ discard block |
||
301 | 333 | $b = $lat2 - $lat1; |
302 | 334 | $c = -($a*$lat1+$b*$lon1); |
303 | 335 | $d = $a*$lat3+$b*$lon3+$c; |
304 | - if ($d > -$approx && $d < $approx) return true; |
|
305 | - else return false; |
|
336 | + if ($d > -$approx && $d < $approx) { |
|
337 | + return true; |
|
338 | + } else { |
|
339 | + return false; |
|
340 | + } |
|
306 | 341 | } |
307 | 342 | |
308 | 343 | public function array_merge_noappend() { |
@@ -361,7 +396,9 @@ discard block |
||
361 | 396 | return $result; |
362 | 397 | } |
363 | 398 | $handle = @opendir('./locale'); |
364 | - if ($handle === false) return $result; |
|
399 | + if ($handle === false) { |
|
400 | + return $result; |
|
401 | + } |
|
365 | 402 | while (false !== ($file = readdir($handle))) { |
366 | 403 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
367 | 404 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -428,8 +465,9 @@ discard block |
||
428 | 465 | $error = false; |
429 | 466 | if ($fp_out = gzopen($dest, $mode)) { |
430 | 467 | if ($fp_in = fopen($source,'rb')) { |
431 | - while (!feof($fp_in)) |
|
432 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
468 | + while (!feof($fp_in)) { |
|
469 | + gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
470 | + } |
|
433 | 471 | fclose($fp_in); |
434 | 472 | } else { |
435 | 473 | $error = true; |
@@ -438,14 +476,17 @@ discard block |
||
438 | 476 | } else { |
439 | 477 | $error = true; |
440 | 478 | } |
441 | - if ($error) |
|
442 | - return false; |
|
443 | - else |
|
444 | - return $dest; |
|
479 | + if ($error) { |
|
480 | + return false; |
|
481 | + } else { |
|
482 | + return $dest; |
|
483 | + } |
|
445 | 484 | } |
446 | 485 | |
447 | 486 | public function remove_accents($string) { |
448 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
487 | + if ( !preg_match('/[\x80-\xff]/', $string) ) { |
|
488 | + return $string; |
|
489 | + } |
|
449 | 490 | $chars = array( |
450 | 491 | // Decompositions for Latin-1 Supplement |
451 | 492 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -569,7 +610,9 @@ discard block |
||
569 | 610 | $ip = gethostbyname($host); |
570 | 611 | $s = socket_create(AF_INET, SOCK_STREAM, 0); |
571 | 612 | $r = @socket_connect($s, $ip, $port); |
572 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
613 | + if (!socket_set_nonblock($s)) { |
|
614 | + echo "Unable to set nonblock on socket\n"; |
|
615 | + } |
|
573 | 616 | if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
574 | 617 | return $s; |
575 | 618 | } |
@@ -1,6 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | require_once(dirname(__FILE__).'/require/settings.php'); |
3 | 3 | $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
4 | -if ($date == '') $date = date('Y-m-d'); |
|
4 | +if ($date == '') { |
|
5 | + $date = date('Y-m-d'); |
|
6 | +} |
|
5 | 7 | header('Location: '.$globalURL.'/accident/'.$date); |
6 | 8 | ?> |
7 | 9 | \ No newline at end of file |
@@ -5,7 +5,9 @@ |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Route by Waypoint"); |
7 | 7 | require_once('header.php'); |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | include('statistics-sub-menu.php'); |
10 | 12 | |
11 | 13 | print '<div class="info"> |
@@ -5,7 +5,9 @@ |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Route by Airport"); |
7 | 7 | require_once('header.php'); |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | include('statistics-sub-menu.php'); |
10 | 12 | |
11 | 13 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -6,11 +6,15 @@ discard block |
||
6 | 6 | $beginpage = microtime(true); |
7 | 7 | $Stats = new Stats(); |
8 | 8 | |
9 | -if (!isset($filter_name)) $filter_name = ''; |
|
9 | +if (!isset($filter_name)) { |
|
10 | + $filter_name = ''; |
|
11 | +} |
|
10 | 12 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
11 | 13 | if ($airline_icao == '' && isset($globalFilter)) { |
12 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
13 | -} |
|
14 | + if (isset($globalFilter['airline'])) { |
|
15 | + $airline_icao = $globalFilter['airline'][0]; |
|
16 | + } |
|
17 | + } |
|
14 | 18 | if ($airline_icao != '' && $airline_icao != 'all') { |
15 | 19 | $Spotter = new Spotter(); |
16 | 20 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -41,14 +45,21 @@ discard block |
||
41 | 45 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script> |
42 | 46 | <div class="column"> |
43 | 47 | <div class="info"> |
44 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
48 | + <h1><?php if (isset($airline_name)) { |
|
49 | + echo _("Statistics for ").$airline_name; |
|
50 | +} else { |
|
51 | + echo _("Statistics"); |
|
52 | +} |
|
53 | +?></h1> |
|
45 | 54 | <?php |
46 | 55 | $last_update = $Stats->getLastStatsUpdate(); |
47 | 56 | //if (isset($last_update[0]['value'])) print '<!-- Last update : '.$last_update[0]['value'].' -->'; |
48 | 57 | if (isset($last_update[0]['value'])) { |
49 | 58 | date_default_timezone_set('UTC'); |
50 | 59 | $lastupdate = strtotime($last_update[0]['value']); |
51 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
60 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
61 | + date_default_timezone_set($globalTimezone); |
|
62 | + } |
|
52 | 63 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
53 | 64 | } |
54 | 65 | ?> |
@@ -100,8 +111,9 @@ discard block |
||
100 | 111 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
101 | 112 | <?php |
102 | 113 | $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
103 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
104 | - else { |
|
114 | + if (count($aircraft_array) == 0) { |
|
115 | + print _("No data available"); |
|
116 | + } else { |
|
105 | 117 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
106 | 118 | $aircraft_data = ''; |
107 | 119 | foreach($aircraft_array as $aircraft_item) |
@@ -123,11 +135,17 @@ discard block |
||
123 | 135 | <?php |
124 | 136 | if ($year != '' && $month != '') { |
125 | 137 | ?> |
126 | - <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"); ?>»</a> |
|
138 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
139 | + echo '/'.$airline_icao; |
|
140 | +} |
|
141 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
127 | 142 | <?php |
128 | 143 | } else { |
129 | 144 | ?> |
130 | - <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"); ?>»</a> |
|
145 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
146 | + echo '/'.$airline_icao; |
|
147 | +} |
|
148 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
131 | 149 | <?php |
132 | 150 | } |
133 | 151 | ?> |
@@ -158,11 +176,15 @@ discard block |
||
158 | 176 | print '</script>'; |
159 | 177 | if ($year != '' && $month != '') { |
160 | 178 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
161 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
179 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
180 | + echo '/'.$airline_icao; |
|
181 | + } |
|
162 | 182 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
163 | 183 | } else { |
164 | 184 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
165 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
185 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
186 | + echo '/'.$airline_icao; |
|
187 | + } |
|
166 | 188 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
167 | 189 | } |
168 | 190 | print '</div>'; |
@@ -186,8 +208,9 @@ discard block |
||
186 | 208 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
187 | 209 | <?php |
188 | 210 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
189 | - if (count($pilot_array) == 0) print _("No data available"); |
|
190 | - else { |
|
211 | + if (count($pilot_array) == 0) { |
|
212 | + print _("No data available"); |
|
213 | + } else { |
|
191 | 214 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
192 | 215 | $pilot_data = ''; |
193 | 216 | foreach($pilot_array as $pilot_item) |
@@ -206,7 +229,9 @@ discard block |
||
206 | 229 | } |
207 | 230 | print '<div class="more">'; |
208 | 231 | print '<a href="'.$globalURL.'/statistics/pilot'; |
209 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
232 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
233 | + echo '/'.$airline_icao; |
|
234 | + } |
|
210 | 235 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
211 | 236 | print '</div>'; |
212 | 237 | ?> |
@@ -220,8 +245,9 @@ discard block |
||
220 | 245 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
221 | 246 | <?php |
222 | 247 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
223 | - if (count($owner_array) == 0) print _("No data available"); |
|
224 | - else { |
|
248 | + if (count($owner_array) == 0) { |
|
249 | + print _("No data available"); |
|
250 | + } else { |
|
225 | 251 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
226 | 252 | $owner_data = ''; |
227 | 253 | foreach($owner_array as $owner_item) |
@@ -240,7 +266,10 @@ discard block |
||
240 | 266 | } |
241 | 267 | ?> |
242 | 268 | <div class="more"> |
243 | - <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"); ?>»</a> |
|
269 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
270 | + echo '/'.$airline_icao; |
|
271 | +} |
|
272 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
244 | 273 | </div> |
245 | 274 | </div> |
246 | 275 | |
@@ -253,8 +282,9 @@ discard block |
||
253 | 282 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
254 | 283 | <?php |
255 | 284 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
256 | - if (count($flightover_array) == 0) print _("No data available"); |
|
257 | - else { |
|
285 | + if (count($flightover_array) == 0) { |
|
286 | + print _("No data available"); |
|
287 | + } else { |
|
258 | 288 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
259 | 289 | print 'var series = ['; |
260 | 290 | $flightover_data = ''; |
@@ -297,7 +327,10 @@ discard block |
||
297 | 327 | } |
298 | 328 | ?> |
299 | 329 | <div class="more"> |
300 | - <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"); ?>»</a> |
|
330 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
331 | + echo '/'.$airline_icao; |
|
332 | +} |
|
333 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
301 | 334 | </div> |
302 | 335 | </div> |
303 | 336 | <?php |
@@ -364,7 +397,9 @@ discard block |
||
364 | 397 | print '</script>'; |
365 | 398 | |
366 | 399 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
367 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
400 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
401 | + echo '/'.$airline_icao; |
|
402 | + } |
|
368 | 403 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
369 | 404 | } |
370 | 405 | ?> |
@@ -427,7 +462,9 @@ discard block |
||
427 | 462 | |
428 | 463 | |
429 | 464 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
430 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
465 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
466 | + echo '/'.$airline_icao; |
|
467 | + } |
|
431 | 468 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
432 | 469 | } |
433 | 470 | ?> |
@@ -442,8 +479,9 @@ discard block |
||
442 | 479 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
443 | 480 | <?php |
444 | 481 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
445 | - if (count($year_array) == 0) print _("No data available"); |
|
446 | - else { |
|
482 | + if (count($year_array) == 0) { |
|
483 | + print _("No data available"); |
|
484 | + } else { |
|
447 | 485 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
448 | 486 | $year_data = ''; |
449 | 487 | $year_cnt = ''; |
@@ -463,7 +501,10 @@ discard block |
||
463 | 501 | } |
464 | 502 | ?> |
465 | 503 | <div class="more"> |
466 | - <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"); ?>»</a> |
|
504 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
505 | + echo '/'.$airline_icao; |
|
506 | +} |
|
507 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
467 | 508 | </div> |
468 | 509 | </div> |
469 | 510 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -471,8 +512,9 @@ discard block |
||
471 | 512 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
472 | 513 | <?php |
473 | 514 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
474 | - if (count($month_array) == 0) print _("No data available"); |
|
475 | - else { |
|
515 | + if (count($month_array) == 0) { |
|
516 | + print _("No data available"); |
|
517 | + } else { |
|
476 | 518 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
477 | 519 | $month_data = ''; |
478 | 520 | $month_cnt = ''; |
@@ -493,7 +535,10 @@ discard block |
||
493 | 535 | } |
494 | 536 | ?> |
495 | 537 | <div class="more"> |
496 | - <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"); ?>»</a> |
|
538 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
539 | + echo '/'.$airline_icao; |
|
540 | +} |
|
541 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
497 | 542 | </div> |
498 | 543 | </div> |
499 | 544 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -502,8 +547,9 @@ discard block |
||
502 | 547 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
503 | 548 | <?php |
504 | 549 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
505 | - if (empty($date_array)) print _("No data available"); |
|
506 | - else { |
|
550 | + if (empty($date_array)) { |
|
551 | + print _("No data available"); |
|
552 | + } else { |
|
507 | 553 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
508 | 554 | $date_data = ''; |
509 | 555 | $date_cnt = ''; |
@@ -524,7 +570,10 @@ discard block |
||
524 | 570 | } |
525 | 571 | ?> |
526 | 572 | <div class="more"> |
527 | - <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"); ?>»</a> |
|
573 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
574 | + echo '/'.$airline_icao; |
|
575 | +} |
|
576 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
528 | 577 | </div> |
529 | 578 | </div> |
530 | 579 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -532,8 +581,9 @@ discard block |
||
532 | 581 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
533 | 582 | <?php |
534 | 583 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
535 | - if (empty($hour_array)) print _("No data available"); |
|
536 | - else { |
|
584 | + if (empty($hour_array)) { |
|
585 | + print _("No data available"); |
|
586 | + } else { |
|
537 | 587 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
538 | 588 | $hour_data = ''; |
539 | 589 | $hour_cnt = ''; |
@@ -554,7 +604,10 @@ discard block |
||
554 | 604 | } |
555 | 605 | ?> |
556 | 606 | <div class="more"> |
557 | - <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"); ?>»</a> |
|
607 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
608 | + echo '/'.$airline_icao; |
|
609 | +} |
|
610 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
558 | 611 | </div> |
559 | 612 | </div> |
560 | 613 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -571,8 +624,9 @@ discard block |
||
571 | 624 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
572 | 625 | <?php |
573 | 626 | $year_array = $Stats->countFatalitiesByYear(); |
574 | - if (count($year_array) == 0) print _("No data available"); |
|
575 | - else { |
|
627 | + if (count($year_array) == 0) { |
|
628 | + print _("No data available"); |
|
629 | + } else { |
|
576 | 630 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
577 | 631 | $year_data = ''; |
578 | 632 | $year_cnt = ''; |
@@ -603,8 +657,9 @@ discard block |
||
603 | 657 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
604 | 658 | <?php |
605 | 659 | $year_array = $Stats->countFatalitiesLast12Months(); |
606 | - if (count($year_array) == 0) print _("No data available"); |
|
607 | - else { |
|
660 | + if (count($year_array) == 0) { |
|
661 | + print _("No data available"); |
|
662 | + } else { |
|
608 | 663 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
609 | 664 | $year_data = ''; |
610 | 665 | $year_cnt = ''; |
@@ -664,8 +719,11 @@ discard block |
||
664 | 719 | $distance = $distance; |
665 | 720 | $unit = 'km'; |
666 | 721 | } |
667 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
668 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
722 | + if (!isset($polar_data)) { |
|
723 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
724 | + } else { |
|
725 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
726 | + } |
|
669 | 727 | } |
670 | 728 | ?> |
671 | 729 | <div class="col-md-6"> |
@@ -717,8 +775,11 @@ discard block |
||
717 | 775 | foreach ($msg as $eachmsg) { |
718 | 776 | //$eachmsg = $msg[0]; |
719 | 777 | $data = $eachmsg['source_data']; |
720 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
721 | - else $max = 500; |
|
778 | + if ($data > 500) { |
|
779 | + $max = (round(($data+100)/100))*100; |
|
780 | + } else { |
|
781 | + $max = 500; |
|
782 | + } |
|
722 | 783 | ?> |
723 | 784 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
724 | 785 | <script> |