@@ -29,7 +29,9 @@ discard block |
||
| 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) { |
@@ -76,8 +78,11 @@ discard block |
||
| 76 | 78 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 77 | 79 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 78 | 80 | } |
| 79 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 80 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 81 | + if ($filter_query_where == '' && $where) { |
|
| 82 | + $filter_query_where = ' WHERE'; |
|
| 83 | + } elseif ($filter_query_where != '' && $and) { |
|
| 84 | + $filter_query_where .= ' AND'; |
|
| 85 | + } |
|
| 81 | 86 | if ($filter_query_where != '') { |
| 82 | 87 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 83 | 88 | } |
@@ -118,9 +123,13 @@ discard block |
||
| 118 | 123 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 119 | 124 | } |
| 120 | 125 | } |
| 121 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
| 126 | + if ($orderby_query == '') { |
|
| 127 | + $orderby_query= ' ORDER BY date DESC'; |
|
| 128 | + } |
|
| 122 | 129 | |
| 123 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 130 | + if (!isset($globalLiveInterval)) { |
|
| 131 | + $globalLiveInterval = '200'; |
|
| 132 | + } |
|
| 124 | 133 | if ($globalDBdriver == 'mysql') { |
| 125 | 134 | //$query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate"; |
| 126 | 135 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -145,7 +154,9 @@ discard block |
||
| 145 | 154 | |
| 146 | 155 | $filter_query = $this->getFilter($filter,true,true); |
| 147 | 156 | |
| 148 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 157 | + if (!isset($globalLiveInterval)) { |
|
| 158 | + $globalLiveInterval = '200'; |
|
| 159 | + } |
|
| 149 | 160 | if ($globalDBdriver == 'mysql') { |
| 150 | 161 | $query = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 151 | 162 | FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0"; |
@@ -179,7 +190,9 @@ discard block |
||
| 179 | 190 | |
| 180 | 191 | $filter_query = $this->getFilter($filter,true,true); |
| 181 | 192 | |
| 182 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 193 | + if (!isset($globalLiveInterval)) { |
|
| 194 | + $globalLiveInterval = '200'; |
|
| 195 | + } |
|
| 183 | 196 | if ($globalDBdriver == 'mysql') { |
| 184 | 197 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 185 | 198 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
@@ -212,7 +225,9 @@ discard block |
||
| 212 | 225 | global $globalDBdriver, $globalLiveInterval; |
| 213 | 226 | $filter_query = $this->getFilter($filter,true,true); |
| 214 | 227 | |
| 215 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 228 | + if (!isset($globalLiveInterval)) { |
|
| 229 | + $globalLiveInterval = '200'; |
|
| 230 | + } |
|
| 216 | 231 | if ($globalDBdriver == 'mysql') { |
| 217 | 232 | $query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
| 218 | 233 | } else { |
@@ -240,7 +255,9 @@ discard block |
||
| 240 | 255 | { |
| 241 | 256 | global $globalDBdriver, $globalLiveInterval; |
| 242 | 257 | $Spotter = new Spotter($this->db); |
| 243 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 258 | + if (!isset($globalLiveInterval)) { |
|
| 259 | + $globalLiveInterval = '200'; |
|
| 260 | + } |
|
| 244 | 261 | $filter_query = $this->getFilter($filter); |
| 245 | 262 | |
| 246 | 263 | if (is_array($coord)) { |
@@ -248,7 +265,9 @@ discard block |
||
| 248 | 265 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 249 | 266 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 250 | 267 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 251 | - } else return array(); |
|
| 268 | + } else { |
|
| 269 | + return array(); |
|
| 270 | + } |
|
| 252 | 271 | if ($globalDBdriver == 'mysql') { |
| 253 | 272 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query; |
| 254 | 273 | } else { |
@@ -268,7 +287,9 @@ discard block |
||
| 268 | 287 | { |
| 269 | 288 | global $globalDBdriver, $globalLiveInterval; |
| 270 | 289 | $Spotter = new Spotter($this->db); |
| 271 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 290 | + if (!isset($globalLiveInterval)) { |
|
| 291 | + $globalLiveInterval = '200'; |
|
| 292 | + } |
|
| 272 | 293 | $filter_query = $this->getFilter($filter); |
| 273 | 294 | |
| 274 | 295 | if (is_array($coord)) { |
@@ -276,7 +297,9 @@ discard block |
||
| 276 | 297 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 277 | 298 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 278 | 299 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 279 | - } else return array(); |
|
| 300 | + } else { |
|
| 301 | + return array(); |
|
| 302 | + } |
|
| 280 | 303 | if ($globalDBdriver == 'mysql') { |
| 281 | 304 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
| 282 | 305 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
@@ -444,11 +467,15 @@ discard block |
||
| 444 | 467 | //$query = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date'; |
| 445 | 468 | if ($globalDBdriver == 'mysql') { |
| 446 | 469 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 447 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 470 | + if ($liveinterval) { |
|
| 471 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 472 | + } |
|
| 448 | 473 | $query .= ' ORDER BY date'; |
| 449 | 474 | } else { |
| 450 | 475 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 451 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 476 | + if ($liveinterval) { |
|
| 477 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 478 | + } |
|
| 452 | 479 | $query .= ' ORDER BY date'; |
| 453 | 480 | } |
| 454 | 481 | |
@@ -543,7 +570,9 @@ discard block |
||
| 543 | 570 | $i++; |
| 544 | 571 | $j++; |
| 545 | 572 | if ($j == 30) { |
| 546 | - if ($globalDebug) echo "."; |
|
| 573 | + if ($globalDebug) { |
|
| 574 | + echo "."; |
|
| 575 | + } |
|
| 547 | 576 | try { |
| 548 | 577 | |
| 549 | 578 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -823,7 +852,9 @@ discard block |
||
| 823 | 852 | { |
| 824 | 853 | return false; |
| 825 | 854 | } |
| 826 | - } else return ''; |
|
| 855 | + } else { |
|
| 856 | + return ''; |
|
| 857 | + } |
|
| 827 | 858 | |
| 828 | 859 | if ($longitude != '') |
| 829 | 860 | { |
@@ -831,7 +862,9 @@ discard block |
||
| 831 | 862 | { |
| 832 | 863 | return false; |
| 833 | 864 | } |
| 834 | - } else return ''; |
|
| 865 | + } else { |
|
| 866 | + return ''; |
|
| 867 | + } |
|
| 835 | 868 | |
| 836 | 869 | |
| 837 | 870 | if ($heading != '') |
@@ -840,7 +873,9 @@ discard block |
||
| 840 | 873 | { |
| 841 | 874 | return false; |
| 842 | 875 | } |
| 843 | - } else $heading = 0; |
|
| 876 | + } else { |
|
| 877 | + $heading = 0; |
|
| 878 | + } |
|
| 844 | 879 | |
| 845 | 880 | if ($groundspeed != '') |
| 846 | 881 | { |
@@ -848,9 +883,13 @@ discard block |
||
| 848 | 883 | { |
| 849 | 884 | return false; |
| 850 | 885 | } |
| 851 | - } else $groundspeed = 0; |
|
| 886 | + } else { |
|
| 887 | + $groundspeed = 0; |
|
| 888 | + } |
|
| 852 | 889 | date_default_timezone_set('UTC'); |
| 853 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 890 | + if ($date == '') { |
|
| 891 | + $date = date("Y-m-d H:i:s", time()); |
|
| 892 | + } |
|
| 854 | 893 | |
| 855 | 894 | |
| 856 | 895 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -871,12 +910,20 @@ discard block |
||
| 871 | 910 | $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
| 872 | 911 | |
| 873 | 912 | |
| 874 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 875 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 876 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 913 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 914 | + $groundspeed = 0; |
|
| 915 | + } |
|
| 916 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 917 | + $heading = 0; |
|
| 918 | + } |
|
| 919 | + if ($arrival_date == '') { |
|
| 920 | + $arrival_date = NULL; |
|
| 921 | + } |
|
| 877 | 922 | $query = ''; |
| 878 | 923 | if ($globalArchive) { |
| 879 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 924 | + if ($globalDebug) { |
|
| 925 | + echo '-- Delete previous data -- '; |
|
| 926 | + } |
|
| 880 | 927 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
| 881 | 928 | } |
| 882 | 929 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) |
@@ -891,10 +938,14 @@ discard block |
||
| 891 | 938 | } |
| 892 | 939 | |
| 893 | 940 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 894 | - if ($globalDebug) echo '(Add to Marine archive : '; |
|
| 941 | + if ($globalDebug) { |
|
| 942 | + echo '(Add to Marine archive : '; |
|
| 943 | + } |
|
| 895 | 944 | $MarineArchive = new MarineArchive($this->db); |
| 896 | 945 | $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country); |
| 897 | - if ($globalDebug) echo $result.')'; |
|
| 946 | + if ($globalDebug) { |
|
| 947 | + echo $result.')'; |
|
| 948 | + } |
|
| 898 | 949 | } |
| 899 | 950 | return "success"; |
| 900 | 951 | } |
@@ -35,7 +35,9 @@ discard block |
||
| 35 | 35 | $temp += 1; |
| 36 | 36 | $flat = (float)($temp / (60.0 * 10000.0)); |
| 37 | 37 | $flat *= -1.0; |
| 38 | - } else $flat = (float)($temp / (60.0 * 10000.0)); |
|
| 38 | + } else { |
|
| 39 | + $flat = (float)($temp / (60.0 * 10000.0)); |
|
| 40 | + } |
|
| 39 | 41 | return $flat; // float |
| 40 | 42 | } |
| 41 | 43 | |
@@ -47,7 +49,9 @@ discard block |
||
| 47 | 49 | $temp += 1; |
| 48 | 50 | $flon = (float)($temp / (60.0 * 10000.0)); |
| 49 | 51 | $flon *= -1.0; |
| 50 | - } else $flon = (float)($temp / (60.0 * 10000.0)); |
|
| 52 | + } else { |
|
| 53 | + $flon = (float)($temp / (60.0 * 10000.0)); |
|
| 54 | + } |
|
| 51 | 55 | return $flon; |
| 52 | 56 | } |
| 53 | 57 | |
@@ -70,10 +74,8 @@ discard block |
||
| 70 | 74 | */ |
| 71 | 75 | private function asciidec_2_8bit($ascii) { |
| 72 | 76 | //only process in the following range: 48-87, 96-119 |
| 73 | - if ($ascii < 48) { } |
|
| 74 | - else { |
|
| 75 | - if($ascii>119) { } |
|
| 76 | - else { |
|
| 77 | + if ($ascii < 48) { } else { |
|
| 78 | + if($ascii>119) { } else { |
|
| 77 | 79 | if ($ascii>87 && $ascii<96) ; |
| 78 | 80 | else { |
| 79 | 81 | $ascii=$ascii+40; |
@@ -175,7 +177,9 @@ discard block |
||
| 175 | 177 | $ro->lon = $this->make_lonf(bindec(substr($_aisdata,57,28))); |
| 176 | 178 | $ro->lat = $this->make_latf(bindec(substr($_aisdata,85,27))); |
| 177 | 179 | $ro->heading = bindec(substr($_aisdata,124,9)); |
| 178 | - if ($ro->heading == 511) $ro->heading = ''; |
|
| 180 | + if ($ro->heading == 511) { |
|
| 181 | + $ro->heading = ''; |
|
| 182 | + } |
|
| 179 | 183 | $ro->cls = 2; // class B |
| 180 | 184 | } else if ($ro->id == 19) { |
| 181 | 185 | $ro->cog = bindec(substr($_aisdata,112,12))/10; |
@@ -185,7 +189,9 @@ discard block |
||
| 185 | 189 | $ro->name = $this->binchar($_aisdata,143,120); |
| 186 | 190 | $ro->cls = 2; // class B |
| 187 | 191 | $ro->heading = bindec(substr($_aisdata,124,9)); |
| 188 | - if ($ro->heading == 511) $ro->heading = ''; |
|
| 192 | + if ($ro->heading == 511) { |
|
| 193 | + $ro->heading = ''; |
|
| 194 | + } |
|
| 189 | 195 | $ro->typeid = bindec(substr($_aisdata,263,8)); |
| 190 | 196 | $ro->type = $this->getShipType($ro->typeid); |
| 191 | 197 | //$ro->to_bow = bindec(substr($_aisdata,271,9)); |
@@ -216,9 +222,13 @@ discard block |
||
| 216 | 222 | $ro->cls = 2; // class B |
| 217 | 223 | } else if ($ro->id == 27) { |
| 218 | 224 | $ro->cog = bindec(substr($_aisdata,85,9)); |
| 219 | - if ($ro->cog == 511) $ro->cog = 0.0; |
|
| 225 | + if ($ro->cog == 511) { |
|
| 226 | + $ro->cog = 0.0; |
|
| 227 | + } |
|
| 220 | 228 | $ro->sog = bindec(substr($_aisdata,79,6)); |
| 221 | - if ($ro->sog == 63) $ro->sog = 0.0; |
|
| 229 | + if ($ro->sog == 63) { |
|
| 230 | + $ro->sog = 0.0; |
|
| 231 | + } |
|
| 222 | 232 | $ro->lon = $this->make_lonf(bindec(substr($_aisdata,44,18))*10); |
| 223 | 233 | $ro->lat = $this->make_latf(bindec(substr($_aisdata,62,17))*10); |
| 224 | 234 | $ro->cls = 1; // class A |
@@ -267,88 +277,171 @@ discard block |
||
| 267 | 277 | } |
| 268 | 278 | |
| 269 | 279 | public function getShipType($code) { |
| 270 | - if ($code == 0) return 'Not available (default)'; |
|
| 271 | - elseif ($code >= 1 && $code <= 19) return 'Reserved for future use'; |
|
| 272 | - elseif ($code == 20) return 'Wing in ground (WIG), all ships of this type'; |
|
| 273 | - elseif ($code == 21) return 'Wing in ground (WIG), Hazardous category A'; |
|
| 274 | - elseif ($code == 22) return 'Wing in ground (WIG), Hazardous category B'; |
|
| 275 | - elseif ($code == 23) return 'Wing in ground (WIG), Hazardous category C'; |
|
| 276 | - elseif ($code == 24) return 'Wing in ground (WIG), Hazardous category D'; |
|
| 277 | - elseif ($code == 25) return 'Wing in ground (WIG), Reserved for future use'; |
|
| 278 | - elseif ($code == 26) return 'Wing in ground (WIG), Reserved for future use'; |
|
| 279 | - elseif ($code == 27) return 'Wing in ground (WIG), Reserved for future use'; |
|
| 280 | - elseif ($code == 28) return 'Wing in ground (WIG), Reserved for future use'; |
|
| 281 | - elseif ($code == 29) return 'Wing in ground (WIG), Reserved for future use'; |
|
| 282 | - elseif ($code == 30) return 'Fishing'; |
|
| 283 | - elseif ($code == 31) return 'Towing'; |
|
| 284 | - elseif ($code == 32) return 'Towing: length exceeds 200m or breadth exceeds 25m'; |
|
| 285 | - elseif ($code == 33) return 'Dredging or underwater ops'; |
|
| 286 | - elseif ($code == 34) return 'Diving ops'; |
|
| 287 | - elseif ($code == 35) return 'Military ops'; |
|
| 288 | - elseif ($code == 36) return 'Sailing'; |
|
| 289 | - elseif ($code == 37) return 'Pleasure Craft'; |
|
| 290 | - elseif ($code == 38) return 'Reserved'; |
|
| 291 | - elseif ($code == 39) return 'Reserved'; |
|
| 292 | - elseif ($code == 40) return 'High speed craft (HSC), all ships of this type'; |
|
| 293 | - elseif ($code == 41) return 'High speed craft (HSC), Hazardous category A'; |
|
| 294 | - elseif ($code == 42) return 'High speed craft (HSC), Hazardous category B'; |
|
| 295 | - elseif ($code == 43) return 'High speed craft (HSC), Hazardous category C'; |
|
| 296 | - elseif ($code == 44) return 'High speed craft (HSC), Hazardous category D'; |
|
| 297 | - elseif ($code == 45) return 'High speed craft (HSC), Reserved for future use'; |
|
| 298 | - elseif ($code == 46) return 'High speed craft (HSC), Reserved for future use'; |
|
| 299 | - elseif ($code == 47) return 'High speed craft (HSC), Reserved for future use'; |
|
| 300 | - elseif ($code == 48) return 'High speed craft (HSC), Reserved for future use'; |
|
| 301 | - elseif ($code == 49) return 'High speed craft (HSC), No additional information'; |
|
| 302 | - elseif ($code == 50) return 'Pilot Vessel'; |
|
| 303 | - elseif ($code == 51) return 'Search and Rescue vessel'; |
|
| 304 | - elseif ($code == 52) return 'Tug'; |
|
| 305 | - elseif ($code == 53) return 'Port Tender'; |
|
| 306 | - elseif ($code == 54) return 'Anti-pollution equipment'; |
|
| 307 | - elseif ($code == 55) return 'Law Enforcement'; |
|
| 308 | - elseif ($code == 56) return 'Spare - Local Vessel'; |
|
| 309 | - elseif ($code == 57) return 'Spare - Local Vessel'; |
|
| 310 | - elseif ($code == 58) return 'Medical Transport'; |
|
| 311 | - elseif ($code == 59) return 'Noncombatant ship according to RR Resolution No. 18'; |
|
| 312 | - elseif ($code == 60) return 'Passenger, all ships of this type'; |
|
| 313 | - elseif ($code == 61) return 'Passenger, Hazardous category A'; |
|
| 314 | - elseif ($code == 62) return 'Passenger, Hazardous category B'; |
|
| 315 | - elseif ($code == 63) return 'Passenger, Hazardous category C'; |
|
| 316 | - elseif ($code == 64) return 'Passenger, Hazardous category D'; |
|
| 317 | - elseif ($code == 65) return 'Passenger, Reserved for future use'; |
|
| 318 | - elseif ($code == 66) return 'Passenger, Reserved for future use'; |
|
| 319 | - elseif ($code == 67) return 'Passenger, Reserved for future use'; |
|
| 320 | - elseif ($code == 68) return 'Passenger, Reserved for future use'; |
|
| 321 | - elseif ($code == 69) return 'Passenger, No additional information'; |
|
| 322 | - elseif ($code == 70) return 'Cargo, all ships of this type'; |
|
| 323 | - elseif ($code == 71) return 'Cargo, Hazardous category A'; |
|
| 324 | - elseif ($code == 72) return 'Cargo, Hazardous category B'; |
|
| 325 | - elseif ($code == 73) return 'Cargo, Hazardous category C'; |
|
| 326 | - elseif ($code == 74) return 'Cargo, Hazardous category D'; |
|
| 327 | - elseif ($code == 75) return 'Cargo, Reserved for future use'; |
|
| 328 | - elseif ($code == 76) return 'Cargo, Reserved for future use'; |
|
| 329 | - elseif ($code == 77) return 'Cargo, Reserved for future use'; |
|
| 330 | - elseif ($code == 78) return 'Cargo, Reserved for future use'; |
|
| 331 | - elseif ($code == 79) return 'Cargo, No additional information'; |
|
| 332 | - elseif ($code == 80) return 'Tanker, all ships of this type'; |
|
| 333 | - elseif ($code == 81) return 'Tanker, Hazardous category A'; |
|
| 334 | - elseif ($code == 82) return 'Tanker, Hazardous category B'; |
|
| 335 | - elseif ($code == 83) return 'Tanker, Hazardous category C'; |
|
| 336 | - elseif ($code == 84) return 'Tanker, Hazardous category D'; |
|
| 337 | - elseif ($code == 85) return 'Tanker, Reserved for future use'; |
|
| 338 | - elseif ($code == 86) return 'Tanker, Reserved for future use'; |
|
| 339 | - elseif ($code == 87) return 'Tanker, Reserved for future use'; |
|
| 340 | - elseif ($code == 88) return 'Tanker, Reserved for future use'; |
|
| 341 | - elseif ($code == 89) return 'Tanker, No additional information'; |
|
| 342 | - elseif ($code == 90) return 'Other Type, all ships of this type'; |
|
| 343 | - elseif ($code == 91) return 'Other Type, Hazardous category A'; |
|
| 344 | - elseif ($code == 92) return 'Other Type, Hazardous category B'; |
|
| 345 | - elseif ($code == 93) return 'Other Type, Hazardous category C'; |
|
| 346 | - elseif ($code == 94) return 'Other Type, Hazardous category D'; |
|
| 347 | - elseif ($code == 95) return 'Other Type, Reserved for future use'; |
|
| 348 | - elseif ($code == 96) return 'Other Type, Reserved for future use'; |
|
| 349 | - elseif ($code == 97) return 'Other Type, Reserved for future use'; |
|
| 350 | - elseif ($code == 98) return 'Other Type, Reserved for future use'; |
|
| 351 | - elseif ($code == 99) return 'Other Type, no additional information'; |
|
| 280 | + if ($code == 0) { |
|
| 281 | + return 'Not available (default)'; |
|
| 282 | + } elseif ($code >= 1 && $code <= 19) { |
|
| 283 | + return 'Reserved for future use'; |
|
| 284 | + } elseif ($code == 20) { |
|
| 285 | + return 'Wing in ground (WIG), all ships of this type'; |
|
| 286 | + } elseif ($code == 21) { |
|
| 287 | + return 'Wing in ground (WIG), Hazardous category A'; |
|
| 288 | + } elseif ($code == 22) { |
|
| 289 | + return 'Wing in ground (WIG), Hazardous category B'; |
|
| 290 | + } elseif ($code == 23) { |
|
| 291 | + return 'Wing in ground (WIG), Hazardous category C'; |
|
| 292 | + } elseif ($code == 24) { |
|
| 293 | + return 'Wing in ground (WIG), Hazardous category D'; |
|
| 294 | + } elseif ($code == 25) { |
|
| 295 | + return 'Wing in ground (WIG), Reserved for future use'; |
|
| 296 | + } elseif ($code == 26) { |
|
| 297 | + return 'Wing in ground (WIG), Reserved for future use'; |
|
| 298 | + } elseif ($code == 27) { |
|
| 299 | + return 'Wing in ground (WIG), Reserved for future use'; |
|
| 300 | + } elseif ($code == 28) { |
|
| 301 | + return 'Wing in ground (WIG), Reserved for future use'; |
|
| 302 | + } elseif ($code == 29) { |
|
| 303 | + return 'Wing in ground (WIG), Reserved for future use'; |
|
| 304 | + } elseif ($code == 30) { |
|
| 305 | + return 'Fishing'; |
|
| 306 | + } elseif ($code == 31) { |
|
| 307 | + return 'Towing'; |
|
| 308 | + } elseif ($code == 32) { |
|
| 309 | + return 'Towing: length exceeds 200m or breadth exceeds 25m'; |
|
| 310 | + } elseif ($code == 33) { |
|
| 311 | + return 'Dredging or underwater ops'; |
|
| 312 | + } elseif ($code == 34) { |
|
| 313 | + return 'Diving ops'; |
|
| 314 | + } elseif ($code == 35) { |
|
| 315 | + return 'Military ops'; |
|
| 316 | + } elseif ($code == 36) { |
|
| 317 | + return 'Sailing'; |
|
| 318 | + } elseif ($code == 37) { |
|
| 319 | + return 'Pleasure Craft'; |
|
| 320 | + } elseif ($code == 38) { |
|
| 321 | + return 'Reserved'; |
|
| 322 | + } elseif ($code == 39) { |
|
| 323 | + return 'Reserved'; |
|
| 324 | + } elseif ($code == 40) { |
|
| 325 | + return 'High speed craft (HSC), all ships of this type'; |
|
| 326 | + } elseif ($code == 41) { |
|
| 327 | + return 'High speed craft (HSC), Hazardous category A'; |
|
| 328 | + } elseif ($code == 42) { |
|
| 329 | + return 'High speed craft (HSC), Hazardous category B'; |
|
| 330 | + } elseif ($code == 43) { |
|
| 331 | + return 'High speed craft (HSC), Hazardous category C'; |
|
| 332 | + } elseif ($code == 44) { |
|
| 333 | + return 'High speed craft (HSC), Hazardous category D'; |
|
| 334 | + } elseif ($code == 45) { |
|
| 335 | + return 'High speed craft (HSC), Reserved for future use'; |
|
| 336 | + } elseif ($code == 46) { |
|
| 337 | + return 'High speed craft (HSC), Reserved for future use'; |
|
| 338 | + } elseif ($code == 47) { |
|
| 339 | + return 'High speed craft (HSC), Reserved for future use'; |
|
| 340 | + } elseif ($code == 48) { |
|
| 341 | + return 'High speed craft (HSC), Reserved for future use'; |
|
| 342 | + } elseif ($code == 49) { |
|
| 343 | + return 'High speed craft (HSC), No additional information'; |
|
| 344 | + } elseif ($code == 50) { |
|
| 345 | + return 'Pilot Vessel'; |
|
| 346 | + } elseif ($code == 51) { |
|
| 347 | + return 'Search and Rescue vessel'; |
|
| 348 | + } elseif ($code == 52) { |
|
| 349 | + return 'Tug'; |
|
| 350 | + } elseif ($code == 53) { |
|
| 351 | + return 'Port Tender'; |
|
| 352 | + } elseif ($code == 54) { |
|
| 353 | + return 'Anti-pollution equipment'; |
|
| 354 | + } elseif ($code == 55) { |
|
| 355 | + return 'Law Enforcement'; |
|
| 356 | + } elseif ($code == 56) { |
|
| 357 | + return 'Spare - Local Vessel'; |
|
| 358 | + } elseif ($code == 57) { |
|
| 359 | + return 'Spare - Local Vessel'; |
|
| 360 | + } elseif ($code == 58) { |
|
| 361 | + return 'Medical Transport'; |
|
| 362 | + } elseif ($code == 59) { |
|
| 363 | + return 'Noncombatant ship according to RR Resolution No. 18'; |
|
| 364 | + } elseif ($code == 60) { |
|
| 365 | + return 'Passenger, all ships of this type'; |
|
| 366 | + } elseif ($code == 61) { |
|
| 367 | + return 'Passenger, Hazardous category A'; |
|
| 368 | + } elseif ($code == 62) { |
|
| 369 | + return 'Passenger, Hazardous category B'; |
|
| 370 | + } elseif ($code == 63) { |
|
| 371 | + return 'Passenger, Hazardous category C'; |
|
| 372 | + } elseif ($code == 64) { |
|
| 373 | + return 'Passenger, Hazardous category D'; |
|
| 374 | + } elseif ($code == 65) { |
|
| 375 | + return 'Passenger, Reserved for future use'; |
|
| 376 | + } elseif ($code == 66) { |
|
| 377 | + return 'Passenger, Reserved for future use'; |
|
| 378 | + } elseif ($code == 67) { |
|
| 379 | + return 'Passenger, Reserved for future use'; |
|
| 380 | + } elseif ($code == 68) { |
|
| 381 | + return 'Passenger, Reserved for future use'; |
|
| 382 | + } elseif ($code == 69) { |
|
| 383 | + return 'Passenger, No additional information'; |
|
| 384 | + } elseif ($code == 70) { |
|
| 385 | + return 'Cargo, all ships of this type'; |
|
| 386 | + } elseif ($code == 71) { |
|
| 387 | + return 'Cargo, Hazardous category A'; |
|
| 388 | + } elseif ($code == 72) { |
|
| 389 | + return 'Cargo, Hazardous category B'; |
|
| 390 | + } elseif ($code == 73) { |
|
| 391 | + return 'Cargo, Hazardous category C'; |
|
| 392 | + } elseif ($code == 74) { |
|
| 393 | + return 'Cargo, Hazardous category D'; |
|
| 394 | + } elseif ($code == 75) { |
|
| 395 | + return 'Cargo, Reserved for future use'; |
|
| 396 | + } elseif ($code == 76) { |
|
| 397 | + return 'Cargo, Reserved for future use'; |
|
| 398 | + } elseif ($code == 77) { |
|
| 399 | + return 'Cargo, Reserved for future use'; |
|
| 400 | + } elseif ($code == 78) { |
|
| 401 | + return 'Cargo, Reserved for future use'; |
|
| 402 | + } elseif ($code == 79) { |
|
| 403 | + return 'Cargo, No additional information'; |
|
| 404 | + } elseif ($code == 80) { |
|
| 405 | + return 'Tanker, all ships of this type'; |
|
| 406 | + } elseif ($code == 81) { |
|
| 407 | + return 'Tanker, Hazardous category A'; |
|
| 408 | + } elseif ($code == 82) { |
|
| 409 | + return 'Tanker, Hazardous category B'; |
|
| 410 | + } elseif ($code == 83) { |
|
| 411 | + return 'Tanker, Hazardous category C'; |
|
| 412 | + } elseif ($code == 84) { |
|
| 413 | + return 'Tanker, Hazardous category D'; |
|
| 414 | + } elseif ($code == 85) { |
|
| 415 | + return 'Tanker, Reserved for future use'; |
|
| 416 | + } elseif ($code == 86) { |
|
| 417 | + return 'Tanker, Reserved for future use'; |
|
| 418 | + } elseif ($code == 87) { |
|
| 419 | + return 'Tanker, Reserved for future use'; |
|
| 420 | + } elseif ($code == 88) { |
|
| 421 | + return 'Tanker, Reserved for future use'; |
|
| 422 | + } elseif ($code == 89) { |
|
| 423 | + return 'Tanker, No additional information'; |
|
| 424 | + } elseif ($code == 90) { |
|
| 425 | + return 'Other Type, all ships of this type'; |
|
| 426 | + } elseif ($code == 91) { |
|
| 427 | + return 'Other Type, Hazardous category A'; |
|
| 428 | + } elseif ($code == 92) { |
|
| 429 | + return 'Other Type, Hazardous category B'; |
|
| 430 | + } elseif ($code == 93) { |
|
| 431 | + return 'Other Type, Hazardous category C'; |
|
| 432 | + } elseif ($code == 94) { |
|
| 433 | + return 'Other Type, Hazardous category D'; |
|
| 434 | + } elseif ($code == 95) { |
|
| 435 | + return 'Other Type, Reserved for future use'; |
|
| 436 | + } elseif ($code == 96) { |
|
| 437 | + return 'Other Type, Reserved for future use'; |
|
| 438 | + } elseif ($code == 97) { |
|
| 439 | + return 'Other Type, Reserved for future use'; |
|
| 440 | + } elseif ($code == 98) { |
|
| 441 | + return 'Other Type, Reserved for future use'; |
|
| 442 | + } elseif ($code == 99) { |
|
| 443 | + return 'Other Type, no additional information'; |
|
| 444 | + } |
|
| 352 | 445 | } |
| 353 | 446 | |
| 354 | 447 | public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) { |
@@ -386,19 +479,34 @@ discard block |
||
| 386 | 479 | // assume 1st ! is valid |
| 387 | 480 | // find * ensure that it is at correct position |
| 388 | 481 | $end = strrpos ( $rawdata , '*' ); |
| 389 | - if ($end === FALSE) return -1; // check for NULLS!!! |
|
| 482 | + if ($end === FALSE) { |
|
| 483 | + return -1; |
|
| 484 | + } |
|
| 485 | + // check for NULLS!!! |
|
| 390 | 486 | $cs = substr( $rawdata, $end + 1 ); |
| 391 | - if ( strlen($cs) != 2 ) return -1; // correct cs length |
|
| 487 | + if ( strlen($cs) != 2 ) { |
|
| 488 | + return -1; |
|
| 489 | + } |
|
| 490 | + // correct cs length |
|
| 392 | 491 | $dcs = (int)hexdec( $cs ); |
| 393 | - for ( $alias=1; $alias<$end; $alias++) $chksum ^= ord( $rawdata[$alias] ); // perform XOR for NMEA checksum |
|
| 492 | + for ( $alias=1; $alias<$end; $alias++) { |
|
| 493 | + $chksum ^= ord( $rawdata[$alias] ); |
|
| 494 | + } |
|
| 495 | + // perform XOR for NMEA checksum |
|
| 394 | 496 | if ( $chksum == $dcs ) { // NMEA checksum pass |
| 395 | 497 | $pcs = explode(',', $rawdata); |
| 396 | 498 | // !AI??? identifier |
| 397 | 499 | $num_seq = (int)$pcs[1]; // number of sequences |
| 398 | 500 | $seq = (int)$pcs[2]; // get sequence |
| 399 | 501 | // get msg sequence id |
| 400 | - if ($pcs[3] == '') $msg_sid = -1; // non-multipart message, set to -1 |
|
| 401 | - else $msg_sid = (int)$pcs[3]; // multipart message |
|
| 502 | + if ($pcs[3] == '') { |
|
| 503 | + $msg_sid = -1; |
|
| 504 | + } |
|
| 505 | + // non-multipart message, set to -1 |
|
| 506 | + else { |
|
| 507 | + $msg_sid = (int)$pcs[3]; |
|
| 508 | + } |
|
| 509 | + // multipart message |
|
| 402 | 510 | $ais_ch = $pcs[4]; // get AIS channel |
| 403 | 511 | // message sequence checking |
| 404 | 512 | if ($num_seq < 1 || $num_seq > 9) { |
@@ -459,10 +567,18 @@ discard block |
||
| 459 | 567 | //DEBUG echo "[$start $end $tst]\n"; |
| 460 | 568 | $result = $this->process_ais_raw( $tst, "" ); |
| 461 | 569 | $last_pos = $end + 1; |
| 462 | - } else break; |
|
| 570 | + } else { |
|
| 571 | + break; |
|
| 572 | + } |
|
| 573 | + } |
|
| 574 | + if ($last_pos > 0) { |
|
| 575 | + $cbuf = substr($cbuf, $last_pos); |
|
| 576 | + } |
|
| 577 | + // move... |
|
| 578 | + if (strlen($cbuf) > 1024) { |
|
| 579 | + $cbuf = ""; |
|
| 463 | 580 | } |
| 464 | - if ($last_pos > 0) $cbuf = substr($cbuf, $last_pos); // move... |
|
| 465 | - if (strlen($cbuf) > 1024) $cbuf = ""; // prevent overflow simple mode... |
|
| 581 | + // prevent overflow simple mode... |
|
| 466 | 582 | return $result; |
| 467 | 583 | } |
| 468 | 584 | |
@@ -482,7 +598,9 @@ discard block |
||
| 482 | 598 | if ($lat<0.0) { |
| 483 | 599 | $lat = -$lat; |
| 484 | 600 | $neg=true; |
| 485 | - } else $neg=false; |
|
| 601 | + } else { |
|
| 602 | + $neg=false; |
|
| 603 | + } |
|
| 486 | 604 | $latd = 0x00000000; |
| 487 | 605 | $latd = intval ($lat * 600000.0); |
| 488 | 606 | if ($neg==true) { |
@@ -498,7 +616,9 @@ discard block |
||
| 498 | 616 | if ($lon<0.0) { |
| 499 | 617 | $lon = -$lon; |
| 500 | 618 | $neg=true; |
| 501 | - } else $neg=false; |
|
| 619 | + } else { |
|
| 620 | + $neg=false; |
|
| 621 | + } |
|
| 502 | 622 | $lond = 0x00000000; |
| 503 | 623 | $lond = intval ($lon * 600000.0); |
| 504 | 624 | if ($neg==true) { |
@@ -511,9 +631,14 @@ discard block |
||
| 511 | 631 | |
| 512 | 632 | private function char2bin($name, $max_len) { |
| 513 | 633 | $len = strlen($name); |
| 514 | - if ($len > $max_len) $name = substr($name,0,$max_len); |
|
| 515 | - if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len) * 6); |
|
| 516 | - else $pad = ''; |
|
| 634 | + if ($len > $max_len) { |
|
| 635 | + $name = substr($name,0,$max_len); |
|
| 636 | + } |
|
| 637 | + if ($len < $max_len) { |
|
| 638 | + $pad = str_repeat('0', ($max_len - $len) * 6); |
|
| 639 | + } else { |
|
| 640 | + $pad = ''; |
|
| 641 | + } |
|
| 517 | 642 | $rv = ''; |
| 518 | 643 | $ais_chars = array( |
| 519 | 644 | '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9, |
@@ -526,9 +651,12 @@ discard block |
||
| 526 | 651 | ); |
| 527 | 652 | // " |
| 528 | 653 | $_a = str_split($name); |
| 529 | - if ($_a) foreach ($_a as $_1) { |
|
| 654 | + if ($_a) { |
|
| 655 | + foreach ($_a as $_1) { |
|
| 530 | 656 | if (isset($ais_chars[$_1])) $dec = $ais_chars[$_1]; |
| 531 | - else $dec = 0; |
|
| 657 | + } else { |
|
| 658 | + $dec = 0; |
|
| 659 | + } |
|
| 532 | 660 | $bin = str_pad(decbin( $dec ), 6, '0', STR_PAD_LEFT); |
| 533 | 661 | $rv .= $bin; |
| 534 | 662 | //echo "$_1 $dec ($bin)<br/>"; |
@@ -540,7 +668,9 @@ discard block |
||
| 540 | 668 | $len_bit = strlen($_enc); |
| 541 | 669 | $rem6 = $len_bit % 6; |
| 542 | 670 | $pad6_len = 0; |
| 543 | - if ($rem6) $pad6_len = 6 - $rem6; |
|
| 671 | + if ($rem6) { |
|
| 672 | + $pad6_len = 6 - $rem6; |
|
| 673 | + } |
|
| 544 | 674 | //echo $pad6_len.'<br>'; |
| 545 | 675 | $_enc .= str_repeat("0", $pad6_len); // pad the text... |
| 546 | 676 | $len_enc = strlen($_enc) / 6; |
@@ -549,8 +679,11 @@ discard block |
||
| 549 | 679 | for ($i=0; $i<$len_enc; $i++) { |
| 550 | 680 | $offset = $i * 6; |
| 551 | 681 | $dec = bindec(substr($_enc,$offset,6)); |
| 552 | - if ($dec < 40) $dec += 48; |
|
| 553 | - else $dec += 56; |
|
| 682 | + if ($dec < 40) { |
|
| 683 | + $dec += 48; |
|
| 684 | + } else { |
|
| 685 | + $dec += 56; |
|
| 686 | + } |
|
| 554 | 687 | //echo chr($dec)." $dec<br/>"; |
| 555 | 688 | $itu .= chr($dec); |
| 556 | 689 | } |
@@ -563,25 +696,41 @@ discard block |
||
| 563 | 696 | } |
| 564 | 697 | $hex_arr = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); |
| 565 | 698 | $lsb = $chksum & 0x0F; |
| 566 | - if ($lsb >=0 && $lsb <= 15 ) $lsbc = $hex_arr[$lsb]; |
|
| 567 | - else $lsbc = '0'; |
|
| 699 | + if ($lsb >=0 && $lsb <= 15 ) { |
|
| 700 | + $lsbc = $hex_arr[$lsb]; |
|
| 701 | + } else { |
|
| 702 | + $lsbc = '0'; |
|
| 703 | + } |
|
| 568 | 704 | $msb = (($chksum & 0xF0) >> 4) & 0x0F; |
| 569 | - if ($msb >=0 && $msb <= 15 ) $msbc = $hex_arr[$msb]; |
|
| 570 | - else $msbc = '0'; |
|
| 705 | + if ($msb >=0 && $msb <= 15 ) { |
|
| 706 | + $msbc = $hex_arr[$msb]; |
|
| 707 | + } else { |
|
| 708 | + $msbc = '0'; |
|
| 709 | + } |
|
| 571 | 710 | $itu = '!'.$itu."*{$msbc}{$lsbc}\r\n"; |
| 572 | 711 | return $itu; |
| 573 | 712 | } |
| 574 | 713 | |
| 575 | 714 | public function parse($buffer) { |
| 576 | 715 | $data = $this->process_ais_buf($buffer); |
| 577 | - if (!is_object($data)) return array(); |
|
| 578 | - if ($data->lon != 0) $result['longitude'] = $data->lon; |
|
| 579 | - if ($data->lat != 0) $result['latitude'] = $data->lat; |
|
| 716 | + if (!is_object($data)) { |
|
| 717 | + return array(); |
|
| 718 | + } |
|
| 719 | + if ($data->lon != 0) { |
|
| 720 | + $result['longitude'] = $data->lon; |
|
| 721 | + } |
|
| 722 | + if ($data->lat != 0) { |
|
| 723 | + $result['latitude'] = $data->lat; |
|
| 724 | + } |
|
| 580 | 725 | $result['ident'] = trim($data->name); |
| 581 | 726 | $result['timestamp'] = $data->ts; |
| 582 | 727 | $result['mmsi'] = $data->mmsi; |
| 583 | - if ($data->sog != -1.0) $result['speed'] = $data->sog; |
|
| 584 | - if ($data->cog != 0) $result['heading'] = $data->cog; |
|
| 728 | + if ($data->sog != -1.0) { |
|
| 729 | + $result['speed'] = $data->sog; |
|
| 730 | + } |
|
| 731 | + if ($data->cog != 0) { |
|
| 732 | + $result['heading'] = $data->cog; |
|
| 733 | + } |
|
| 585 | 734 | /* |
| 586 | 735 | $ro->cls = 0; // AIS class undefined, also indicate unparsed msg |
| 587 | 736 | $ro->id = bindec(substr($_aisdata,0,6)); |
@@ -591,15 +740,25 @@ discard block |
||
| 591 | 740 | |
| 592 | 741 | public function mmsitype($mmsi) { |
| 593 | 742 | if (strlen($mmsi) == 9) { |
| 594 | - if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS'; |
|
| 595 | - elseif (substr($mmsi,0,3) == '972') return 'MOB (Man Overboard) device'; |
|
| 596 | - elseif (substr($mmsi,0,3) == '970') return 'AIS SART (Search and Rescue Transmitter)'; |
|
| 597 | - elseif (substr($mmsi,0,3) == '111') return 'SAR (Search and Rescue) aircraft'; |
|
| 598 | - elseif (substr($mmsi,0,2) == '98') return 'Auxiliary craft associated with a parent ship'; |
|
| 599 | - elseif (substr($mmsi,0,2) == '99') return 'Aids to Navigation'; |
|
| 600 | - elseif (substr($mmsi,0,2) == '00') return 'Coastal stations'; |
|
| 601 | - elseif (substr($mmsi,0,1) == '0') return 'Group of ships'; |
|
| 602 | - else return 'Ship'; |
|
| 743 | + if (substr($mmsi,0,3) == '974') { |
|
| 744 | + return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS'; |
|
| 745 | + } elseif (substr($mmsi,0,3) == '972') { |
|
| 746 | + return 'MOB (Man Overboard) device'; |
|
| 747 | + } elseif (substr($mmsi,0,3) == '970') { |
|
| 748 | + return 'AIS SART (Search and Rescue Transmitter)'; |
|
| 749 | + } elseif (substr($mmsi,0,3) == '111') { |
|
| 750 | + return 'SAR (Search and Rescue) aircraft'; |
|
| 751 | + } elseif (substr($mmsi,0,2) == '98') { |
|
| 752 | + return 'Auxiliary craft associated with a parent ship'; |
|
| 753 | + } elseif (substr($mmsi,0,2) == '99') { |
|
| 754 | + return 'Aids to Navigation'; |
|
| 755 | + } elseif (substr($mmsi,0,2) == '00') { |
|
| 756 | + return 'Coastal stations'; |
|
| 757 | + } elseif (substr($mmsi,0,1) == '0') { |
|
| 758 | + return 'Group of ships'; |
|
| 759 | + } else { |
|
| 760 | + return 'Ship'; |
|
| 761 | + } |
|
| 603 | 762 | } |
| 604 | 763 | |
| 605 | 764 | |
@@ -616,32 +775,61 @@ discard block |
||
| 616 | 775 | //if ($globalDebug) echo '==== Line format not supported : '.$buffer."\n"; |
| 617 | 776 | return array(); |
| 618 | 777 | } |
| 619 | - if ($data->lon != 0) $result['longitude'] = $data->lon; |
|
| 620 | - if ($data->lat != 0) $result['latitude'] = $data->lat; |
|
| 778 | + if ($data->lon != 0) { |
|
| 779 | + $result['longitude'] = $data->lon; |
|
| 780 | + } |
|
| 781 | + if ($data->lat != 0) { |
|
| 782 | + $result['latitude'] = $data->lat; |
|
| 783 | + } |
|
| 621 | 784 | $result['ident'] = trim(str_replace('@','',$data->name)); |
| 622 | 785 | $result['timestamp'] = $data->ts; |
| 623 | 786 | $result['mmsi'] = $data->mmsi; |
| 624 | - if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') $result['mmsi'] = '3'.$result['mmsi']; |
|
| 787 | + if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') { |
|
| 788 | + $result['mmsi'] = '3'.$result['mmsi']; |
|
| 789 | + } |
|
| 625 | 790 | $result['mmsi_type'] = $this->mmsitype($result['mmsi']); |
| 626 | - if ($data->sog != -1.0) $result['speed'] = $data->sog; |
|
| 627 | - if ($data->heading !== '') $result['heading'] = $data->heading; |
|
| 628 | - elseif ($data->cog != 0) $result['heading'] = $data->cog; |
|
| 629 | - if ($data->status != '') $result['status'] = $data->status; |
|
| 630 | - if ($data->statusid !== '') $result['statusid'] = $data->statusid; |
|
| 631 | - if ($data->type !== '') $result['type'] = $data->type; |
|
| 632 | - if ($data->typeid !== '') $result['typeid'] = $data->typeid; |
|
| 633 | - if ($data->imo !== '') $result['imo'] = $data->imo; |
|
| 634 | - if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@','',$data->callsign)); |
|
| 791 | + if ($data->sog != -1.0) { |
|
| 792 | + $result['speed'] = $data->sog; |
|
| 793 | + } |
|
| 794 | + if ($data->heading !== '') { |
|
| 795 | + $result['heading'] = $data->heading; |
|
| 796 | + } elseif ($data->cog != 0) { |
|
| 797 | + $result['heading'] = $data->cog; |
|
| 798 | + } |
|
| 799 | + if ($data->status != '') { |
|
| 800 | + $result['status'] = $data->status; |
|
| 801 | + } |
|
| 802 | + if ($data->statusid !== '') { |
|
| 803 | + $result['statusid'] = $data->statusid; |
|
| 804 | + } |
|
| 805 | + if ($data->type !== '') { |
|
| 806 | + $result['type'] = $data->type; |
|
| 807 | + } |
|
| 808 | + if ($data->typeid !== '') { |
|
| 809 | + $result['typeid'] = $data->typeid; |
|
| 810 | + } |
|
| 811 | + if ($data->imo !== '') { |
|
| 812 | + $result['imo'] = $data->imo; |
|
| 813 | + } |
|
| 814 | + if ($data->callsign !== '') { |
|
| 815 | + $result['callsign'] = trim(str_replace('@','',$data->callsign)); |
|
| 816 | + } |
|
| 635 | 817 | if (is_numeric($data->eta_month) && $data->eta_month != 0 && is_numeric($data->eta_day) && $data->eta_day != 0 && $data->eta_hour !== '' && $data->eta_minute !== '') { |
| 636 | 818 | $eta_ts = strtotime(date('Y').'-'.sprintf("%02d",$data->eta_month).'-'.sprintf("%02d",$data->eta_day).' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00'); |
| 637 | - if ($eta_ts != '') $result['eta_ts'] = $eta_ts; |
|
| 819 | + if ($eta_ts != '') { |
|
| 820 | + $result['eta_ts'] = $eta_ts; |
|
| 821 | + } |
|
| 638 | 822 | } elseif (is_numeric($data->eta_hour) && is_numeric($data->eta_minute)) { |
| 639 | 823 | $eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00'); |
| 640 | - if ($eta_ts != '') $result['eta_ts'] = $eta_ts; |
|
| 824 | + if ($eta_ts != '') { |
|
| 825 | + $result['eta_ts'] = $eta_ts; |
|
| 826 | + } |
|
| 641 | 827 | } |
| 642 | 828 | if ($data->destination != '') { |
| 643 | 829 | $dest = trim(str_replace('@','',$data->destination)); |
| 644 | - if ($dest != '') $result['destination'] = $dest; |
|
| 830 | + if ($dest != '') { |
|
| 831 | + $result['destination'] = $dest; |
|
| 832 | + } |
|
| 645 | 833 | } |
| 646 | 834 | $result['all'] = (array) $data; |
| 647 | 835 | /* |
@@ -23,7 +23,9 @@ discard block |
||
| 23 | 23 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
| 24 | 24 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 25 | 25 | $reg = $registration; |
| 26 | - if ($reg == '' && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao; |
|
| 26 | + if ($reg == '' && $aircraft_icao != '') { |
|
| 27 | + $reg = $aircraft_icao.$airline_icao; |
|
| 28 | + } |
|
| 27 | 29 | $reg = trim($reg); |
| 28 | 30 | $query = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration |
| 29 | 31 | FROM spotter_image |
@@ -31,9 +33,13 @@ discard block |
||
| 31 | 33 | $sth = $this->db->prepare($query); |
| 32 | 34 | $sth->execute(array(':registration' => $reg)); |
| 33 | 35 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 34 | - if (!empty($result)) return $result; |
|
| 35 | - elseif ($registration != '') return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 36 | - else return array(); |
|
| 36 | + if (!empty($result)) { |
|
| 37 | + return $result; |
|
| 38 | + } elseif ($registration != '') { |
|
| 39 | + return $this->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 40 | + } else { |
|
| 41 | + return array(); |
|
| 42 | + } |
|
| 37 | 43 | } |
| 38 | 44 | |
| 39 | 45 | /** |
@@ -76,8 +82,11 @@ discard block |
||
| 76 | 82 | public function getExifCopyright($url) { |
| 77 | 83 | $exif = exif_read_data($url); |
| 78 | 84 | $copyright = ''; |
| 79 | - if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright']; |
|
| 80 | - elseif (isset($exif['copyright'])) $copyright = $exif['copyright']; |
|
| 85 | + if (isset($exif['COMPUTED']['copyright'])) { |
|
| 86 | + $copyright = $exif['COMPUTED']['copyright']; |
|
| 87 | + } elseif (isset($exif['copyright'])) { |
|
| 88 | + $copyright = $exif['copyright']; |
|
| 89 | + } |
|
| 81 | 90 | if ($copyright != '') { |
| 82 | 91 | $copyright = str_replace('Copyright ','',$copyright); |
| 83 | 92 | $copyright = str_replace('© ','',$copyright); |
@@ -95,17 +104,27 @@ discard block |
||
| 95 | 104 | public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '') |
| 96 | 105 | { |
| 97 | 106 | global $globalDebug,$globalAircraftImageFetch; |
| 98 | - if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return ''; |
|
| 107 | + if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) { |
|
| 108 | + return ''; |
|
| 109 | + } |
|
| 99 | 110 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
| 100 | 111 | $registration = trim($registration); |
| 101 | 112 | //getting the aircraft image |
| 102 | - if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...'; |
|
| 103 | - elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
|
| 104 | - elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
|
| 113 | + if ($globalDebug && $registration != '') { |
|
| 114 | + echo 'Try to find an aircraft image for '.$registration.'...'; |
|
| 115 | + } elseif ($globalDebug && $aircraft_icao != '') { |
|
| 116 | + echo 'Try to find an aircraft image for '.$aircraft_icao.'...'; |
|
| 117 | + } elseif ($globalDebug && $airline_icao != '') { |
|
| 118 | + echo 'Try to find an aircraft image for '.$airline_icao.'...'; |
|
| 119 | + } |
|
| 105 | 120 | $image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao); |
| 106 | - if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao; |
|
| 121 | + if ($registration == '' && $aircraft_icao != '') { |
|
| 122 | + $registration = $aircraft_icao.$airline_icao; |
|
| 123 | + } |
|
| 107 | 124 | if ($image_url['original'] != '') { |
| 108 | - if ($globalDebug) echo 'Found !'."\n"; |
|
| 125 | + if ($globalDebug) { |
|
| 126 | + echo 'Found !'."\n"; |
|
| 127 | + } |
|
| 109 | 128 | $query = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
| 110 | 129 | try { |
| 111 | 130 | $sth = $this->db->prepare($query); |
@@ -114,7 +133,9 @@ discard block |
||
| 114 | 133 | echo $e->getMessage()."\n"; |
| 115 | 134 | return "error"; |
| 116 | 135 | } |
| 117 | - } elseif ($globalDebug) echo "Not found :'(\n"; |
|
| 136 | + } elseif ($globalDebug) { |
|
| 137 | + echo "Not found :'(\n"; |
|
| 138 | + } |
|
| 118 | 139 | return "success"; |
| 119 | 140 | } |
| 120 | 141 | |
@@ -127,7 +148,9 @@ discard block |
||
| 127 | 148 | public function addMarineImage($mmsi,$imo = '',$name = '') |
| 128 | 149 | { |
| 129 | 150 | global $globalDebug,$globalMarineImageFetch; |
| 130 | - if (isset($globalMarineImageFetch) && !$globalMarineImageFetch) return ''; |
|
| 151 | + if (isset($globalMarineImageFetch) && !$globalMarineImageFetch) { |
|
| 152 | + return ''; |
|
| 153 | + } |
|
| 131 | 154 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
| 132 | 155 | $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
| 133 | 156 | $name = filter_var($name,FILTER_SANITIZE_STRING); |
@@ -137,16 +160,22 @@ discard block |
||
| 137 | 160 | $identity = $Marine->getIdentity($mmsi); |
| 138 | 161 | if (isset($identity[0]['mmsi'])) { |
| 139 | 162 | $imo = $identity[0]['imo']; |
| 140 | - if ($identity[0]['ship_name'] != '') $name = $identity[0]['ship_name']; |
|
| 163 | + if ($identity[0]['ship_name'] != '') { |
|
| 164 | + $name = $identity[0]['ship_name']; |
|
| 165 | + } |
|
| 141 | 166 | } |
| 142 | 167 | } |
| 143 | 168 | unset($Marine); |
| 144 | 169 | |
| 145 | 170 | //getting the aircraft image |
| 146 | - if ($globalDebug && $name != '') echo 'Try to find an vessel image for '.$name.'...'; |
|
| 171 | + if ($globalDebug && $name != '') { |
|
| 172 | + echo 'Try to find an vessel image for '.$name.'...'; |
|
| 173 | + } |
|
| 147 | 174 | $image_url = $this->findMarineImage($mmsi,$imo,$name); |
| 148 | 175 | if ($image_url['original'] != '') { |
| 149 | - if ($globalDebug) echo 'Found !'."\n"; |
|
| 176 | + if ($globalDebug) { |
|
| 177 | + echo 'Found !'."\n"; |
|
| 178 | + } |
|
| 150 | 179 | $query = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)"; |
| 151 | 180 | try { |
| 152 | 181 | $sth = $this->db->prepare($query); |
@@ -155,7 +184,9 @@ discard block |
||
| 155 | 184 | echo $e->getMessage()."\n"; |
| 156 | 185 | return "error"; |
| 157 | 186 | } |
| 158 | - } elseif ($globalDebug) echo "Not found :'(\n"; |
|
| 187 | + } elseif ($globalDebug) { |
|
| 188 | + echo "Not found :'(\n"; |
|
| 189 | + } |
|
| 159 | 190 | return "success"; |
| 160 | 191 | } |
| 161 | 192 | |
@@ -170,41 +201,85 @@ discard block |
||
| 170 | 201 | { |
| 171 | 202 | global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA; |
| 172 | 203 | $Spotter = new Spotter($this->db); |
| 173 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 204 | + if (!isset($globalIVAO)) { |
|
| 205 | + $globalIVAO = FALSE; |
|
| 206 | + } |
|
| 174 | 207 | $aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING); |
| 175 | 208 | if ($aircraft_registration != '' && (!isset($globalVA) || $globalVA !== TRUE)) { |
| 176 | - if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 209 | + if (strpos($aircraft_registration,'/') !== false) { |
|
| 210 | + return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
|
| 211 | + } |
|
| 177 | 212 | $aircraft_registration = urlencode(trim($aircraft_registration)); |
| 178 | 213 | $aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration); |
| 179 | - if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name']; |
|
| 180 | - else $aircraft_name = ''; |
|
| 181 | - if (isset($aircraft_info[0]['aircraft_icao'])) $aircraft_name = $aircraft_info[0]['aircraft_icao']; |
|
| 182 | - else $aircraft_icao = ''; |
|
| 183 | - if (isset($aircraft_info[0]['airline_icao'])) $airline_icao = $aircraft_info[0]['airline_icao']; |
|
| 184 | - else $airline_icao = ''; |
|
| 214 | + if (isset($aircraft_info[0]['aircraft_name'])) { |
|
| 215 | + $aircraft_name = $aircraft_info[0]['aircraft_name']; |
|
| 216 | + } else { |
|
| 217 | + $aircraft_name = ''; |
|
| 218 | + } |
|
| 219 | + if (isset($aircraft_info[0]['aircraft_icao'])) { |
|
| 220 | + $aircraft_name = $aircraft_info[0]['aircraft_icao']; |
|
| 221 | + } else { |
|
| 222 | + $aircraft_icao = ''; |
|
| 223 | + } |
|
| 224 | + if (isset($aircraft_info[0]['airline_icao'])) { |
|
| 225 | + $airline_icao = $aircraft_info[0]['airline_icao']; |
|
| 226 | + } else { |
|
| 227 | + $airline_icao = ''; |
|
| 228 | + } |
|
| 185 | 229 | } elseif ($aircraft_icao != '') { |
| 186 | 230 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
| 187 | - if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type']; |
|
| 188 | - else $aircraft_name = ''; |
|
| 231 | + if (isset($aircraft_info[0]['type'])) { |
|
| 232 | + $aircraft_name = $aircraft_info[0]['type']; |
|
| 233 | + } else { |
|
| 234 | + $aircraft_name = ''; |
|
| 235 | + } |
|
| 189 | 236 | $aircraft_registration = $aircraft_icao; |
| 190 | - } else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
| 237 | + } else { |
|
| 238 | + return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
| 239 | + } |
|
| 191 | 240 | unset($Spotter); |
| 192 | - if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 241 | + if (!isset($globalAircraftImageSources)) { |
|
| 242 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 243 | + } |
|
| 193 | 244 | foreach ($globalAircraftImageSources as $source) { |
| 194 | 245 | $source = strtolower($source); |
| 195 | - if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
| 196 | - if ($source == 'planespotters' && !$globalIVAO) $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
| 197 | - if ($source == 'flickr') $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
| 198 | - if ($source == 'bing') $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
| 199 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
| 200 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
| 201 | - if ($source == 'jetphotos' && !$globalIVAO) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
| 202 | - if ($source == 'planepictures' && !$globalIVAO) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
| 203 | - if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name); |
|
| 204 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
| 205 | - if (isset($images_array) && $images_array['original'] != '') return $images_array; |
|
| 206 | - } |
|
| 207 | - if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao); |
|
| 246 | + if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') { |
|
| 247 | + $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao); |
|
| 248 | + } |
|
| 249 | + if ($source == 'planespotters' && !$globalIVAO) { |
|
| 250 | + $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name); |
|
| 251 | + } |
|
| 252 | + if ($source == 'flickr') { |
|
| 253 | + $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name); |
|
| 254 | + } |
|
| 255 | + if ($source == 'bing') { |
|
| 256 | + $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name); |
|
| 257 | + } |
|
| 258 | + if ($source == 'deviantart') { |
|
| 259 | + $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name); |
|
| 260 | + } |
|
| 261 | + if ($source == 'wikimedia') { |
|
| 262 | + $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name); |
|
| 263 | + } |
|
| 264 | + if ($source == 'jetphotos' && !$globalIVAO) { |
|
| 265 | + $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name); |
|
| 266 | + } |
|
| 267 | + if ($source == 'planepictures' && !$globalIVAO) { |
|
| 268 | + $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name); |
|
| 269 | + } |
|
| 270 | + if ($source == 'airportdata' && !$globalIVAO) { |
|
| 271 | + $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name); |
|
| 272 | + } |
|
| 273 | + if ($source == 'customsources') { |
|
| 274 | + $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name); |
|
| 275 | + } |
|
| 276 | + if (isset($images_array) && $images_array['original'] != '') { |
|
| 277 | + return $images_array; |
|
| 278 | + } |
|
| 279 | + } |
|
| 280 | + if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) { |
|
| 281 | + return $this->findAircraftImage($aircraft_icao); |
|
| 282 | + } |
|
| 208 | 283 | return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
| 209 | 284 | } |
| 210 | 285 | |
@@ -224,7 +299,9 @@ discard block |
||
| 224 | 299 | //$imo = filter_var($imo,FILTER_SANITIZE_STRING); |
| 225 | 300 | $name = filter_var($name,FILTER_SANITIZE_STRING); |
| 226 | 301 | $name = trim($name); |
| 227 | - if (strlen($name) < 4) return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
| 302 | + if (strlen($name) < 4) { |
|
| 303 | + return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => ''); |
|
| 304 | + } |
|
| 228 | 305 | /* |
| 229 | 306 | $Marine = new Marine($this->db); |
| 230 | 307 | if ($imo == '' || $name == '') { |
@@ -236,15 +313,29 @@ discard block |
||
| 236 | 313 | } |
| 237 | 314 | unset($Marine); |
| 238 | 315 | */ |
| 239 | - if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
| 316 | + if (!isset($globalMarineImageSources)) { |
|
| 317 | + $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing'); |
|
| 318 | + } |
|
| 240 | 319 | foreach ($globalMarineImageSources as $source) { |
| 241 | 320 | $source = strtolower($source); |
| 242 | - if ($source == 'flickr') $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
| 243 | - if ($source == 'bing') $images_array = $this->fromBing('marine',$mmsi,$name); |
|
| 244 | - if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
| 245 | - if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
| 246 | - if ($source == 'customsources') $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
| 247 | - if (isset($images_array) && $images_array['original'] != '') return $images_array; |
|
| 321 | + if ($source == 'flickr') { |
|
| 322 | + $images_array = $this->fromFlickr('marine',$mmsi,$name); |
|
| 323 | + } |
|
| 324 | + if ($source == 'bing') { |
|
| 325 | + $images_array = $this->fromBing('marine',$mmsi,$name); |
|
| 326 | + } |
|
| 327 | + if ($source == 'deviantart') { |
|
| 328 | + $images_array = $this->fromDeviantart('marine',$mmsi,$name); |
|
| 329 | + } |
|
| 330 | + if ($source == 'wikimedia') { |
|
| 331 | + $images_array = $this->fromWikimedia('marine',$mmsi,$name); |
|
| 332 | + } |
|
| 333 | + if ($source == 'customsources') { |
|
| 334 | + $images_array = $this->fromCustomSource('marine',$mmsi,$name); |
|
| 335 | + } |
|
| 336 | + if (isset($images_array) && $images_array['original'] != '') { |
|
| 337 | + return $images_array; |
|
| 338 | + } |
|
| 248 | 339 | } |
| 249 | 340 | return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => ''); |
| 250 | 341 | } |
@@ -407,11 +498,17 @@ discard block |
||
| 407 | 498 | public function fromFlickr($type,$registration,$name='') { |
| 408 | 499 | $Common = new Common(); |
| 409 | 500 | if ($type == 'aircraft') { |
| 410 | - if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
|
| 411 | - else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',aircraft'; |
|
| 501 | + if ($name != '') { |
|
| 502 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name); |
|
| 503 | + } else { |
|
| 504 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',aircraft'; |
|
| 505 | + } |
|
| 412 | 506 | } elseif ($type == 'marine') { |
| 413 | - if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags=ship,'.urlencode($name); |
|
| 414 | - else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',ship'; |
|
| 507 | + if ($name != '') { |
|
| 508 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags=ship,'.urlencode($name); |
|
| 509 | + } else { |
|
| 510 | + $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',ship'; |
|
| 511 | + } |
|
| 415 | 512 | } |
| 416 | 513 | $data = $Common->getData($url); |
| 417 | 514 | if ($xml = simplexml_load_string($data)) { |
@@ -456,13 +553,21 @@ discard block |
||
| 456 | 553 | public function fromBing($type,$aircraft_registration,$aircraft_name='') { |
| 457 | 554 | global $globalImageBingKey; |
| 458 | 555 | $Common = new Common(); |
| 459 | - if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false; |
|
| 556 | + if (!isset($globalImageBingKey) || $globalImageBingKey == '') { |
|
| 557 | + return false; |
|
| 558 | + } |
|
| 460 | 559 | if ($type == 'aircraft') { |
| 461 | - if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27'; |
|
| 462 | - else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27'; |
|
| 560 | + if ($aircraft_name != '') { |
|
| 561 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27'; |
|
| 562 | + } else { |
|
| 563 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27'; |
|
| 564 | + } |
|
| 463 | 565 | } elseif ($type == 'marine') { |
| 464 | - if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
|
| 465 | - else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
|
| 566 | + if ($aircraft_name != '') { |
|
| 567 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27'; |
|
| 568 | + } else { |
|
| 569 | + $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27'; |
|
| 570 | + } |
|
| 466 | 571 | } |
| 467 | 572 | $headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey)); |
| 468 | 573 | $data = $Common->getData($url,'get','',$headers); |
@@ -518,17 +623,25 @@ discard block |
||
| 518 | 623 | public function fromWikimedia($type,$registration,$name='') { |
| 519 | 624 | $Common = new Common(); |
| 520 | 625 | if ($type == 'aircraft') { |
| 521 | - if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
|
| 522 | - else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft'; |
|
| 626 | + if ($name != '') { |
|
| 627 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name); |
|
| 628 | + } else { |
|
| 629 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft'; |
|
| 630 | + } |
|
| 523 | 631 | } elseif ($type == 'marine') { |
| 524 | - if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'%20ship"'; |
|
| 525 | - else return false; |
|
| 632 | + if ($name != '') { |
|
| 633 | + $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'%20ship"'; |
|
| 634 | + } else { |
|
| 635 | + return false; |
|
| 636 | + } |
|
| 526 | 637 | } |
| 527 | 638 | $data = $Common->getData($url); |
| 528 | 639 | $result = json_decode($data); |
| 529 | 640 | if (isset($result->query->search[0]->title)) { |
| 530 | 641 | $fileo = $result->query->search[0]->title; |
| 531 | - if (substr($fileo,-3) == 'pdf') return false; |
|
| 642 | + if (substr($fileo,-3) == 'pdf') { |
|
| 643 | + return false; |
|
| 644 | + } |
|
| 532 | 645 | $file = urlencode($fileo); |
| 533 | 646 | $url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file; |
| 534 | 647 | $data2 = $Common->getData($url2); |
@@ -599,18 +712,27 @@ discard block |
||
| 599 | 712 | $image_url = array(); |
| 600 | 713 | $image_url['thumbnail'] = $url_thumbnail; |
| 601 | 714 | $image_url['original'] = $url; |
| 602 | - if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
|
| 603 | - else $exifCopyright = ''; |
|
| 604 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
| 605 | - elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
|
| 606 | - else $image_url['copyright'] = $source['source_website']; |
|
| 715 | + if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) { |
|
| 716 | + $exifCopyright = $this->getExifCopyright($url); |
|
| 717 | + } else { |
|
| 718 | + $exifCopyright = ''; |
|
| 719 | + } |
|
| 720 | + if ($exifCopyright != '') { |
|
| 721 | + $image_url['copyright'] = $exifCopyright; |
|
| 722 | + } elseif (isset($source['copyright'])) { |
|
| 723 | + $image_url['copyright'] = $source['copyright']; |
|
| 724 | + } else { |
|
| 725 | + $image_url['copyright'] = $source['source_website']; |
|
| 726 | + } |
|
| 607 | 727 | $image_url['source_website'] = $source['source_website']; |
| 608 | 728 | $image_url['source'] = $source['source']; |
| 609 | 729 | return $image_url; |
| 610 | 730 | } |
| 611 | 731 | } |
| 612 | 732 | return false; |
| 613 | - } else return false; |
|
| 733 | + } else { |
|
| 734 | + return false; |
|
| 735 | + } |
|
| 614 | 736 | if (!empty($globalMarineImageCustomSources) && $type == 'marine') { |
| 615 | 737 | $customsources = array(); |
| 616 | 738 | if (!isset($globalMarineImageCustomSources[0])) { |
@@ -635,18 +757,27 @@ discard block |
||
| 635 | 757 | $image_url = array(); |
| 636 | 758 | $image_url['thumbnail'] = $url_thumbnail; |
| 637 | 759 | $image_url['original'] = $url; |
| 638 | - if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url); |
|
| 639 | - else $exifCopyright = ''; |
|
| 640 | - if ($exifCopyright != '') $image_url['copyright'] = $exifCopyright; |
|
| 641 | - elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright']; |
|
| 642 | - else $image_url['copyright'] = $source['source_website']; |
|
| 760 | + if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) { |
|
| 761 | + $exifCopyright = $this->getExifCopyright($url); |
|
| 762 | + } else { |
|
| 763 | + $exifCopyright = ''; |
|
| 764 | + } |
|
| 765 | + if ($exifCopyright != '') { |
|
| 766 | + $image_url['copyright'] = $exifCopyright; |
|
| 767 | + } elseif (isset($source['copyright'])) { |
|
| 768 | + $image_url['copyright'] = $source['copyright']; |
|
| 769 | + } else { |
|
| 770 | + $image_url['copyright'] = $source['source_website']; |
|
| 771 | + } |
|
| 643 | 772 | $image_url['source_website'] = $source['source_website']; |
| 644 | 773 | $image_url['source'] = $source['source']; |
| 645 | 774 | return $image_url; |
| 646 | 775 | } |
| 647 | 776 | } |
| 648 | 777 | return false; |
| 649 | - } else return false; |
|
| 778 | + } else { |
|
| 779 | + return false; |
|
| 780 | + } |
|
| 650 | 781 | } |
| 651 | 782 | } |
| 652 | 783 | |
@@ -1,13 +1,20 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__).'/require/settings.php'); |
| 3 | 3 | $ident = ''; |
| 4 | -if (isset($_POST['ident'])) $ident = filter_input(INPUT_POST,'ident',FILTER_SANITIZE_STRING); |
|
| 5 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 4 | +if (isset($_POST['ident'])) { |
|
| 5 | + $ident = filter_input(INPUT_POST,'ident',FILTER_SANITIZE_STRING); |
|
| 6 | +} |
|
| 7 | +if (isset($_GET['ident'])) { |
|
| 8 | + $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 9 | +} |
|
| 6 | 10 | if ($ident != '') |
| 7 | 11 | { |
| 8 | - if (isset($_GET['marine'])) header('Location: '.$globalURL.'/marine/ident/'.$ident); |
|
| 9 | - else header('Location: '.$globalURL.'/ident/'.$ident); |
|
| 10 | -} else { |
|
| 12 | + if (isset($_GET['marine'])) { |
|
| 13 | + header('Location: '.$globalURL.'/marine/ident/'.$ident); |
|
| 14 | + } else { |
|
| 15 | + header('Location: '.$globalURL.'/ident/'.$ident); |
|
| 16 | + } |
|
| 17 | + } else { |
|
| 11 | 18 | header('Location: '.$globalURL); |
| 12 | 19 | } |
| 13 | 20 | ?> |
| 14 | 21 | \ No newline at end of file |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $limit_start = 0; |
| 32 | 32 | $limit_end = 25; |
| 33 | 33 | $absolute_difference = 25; |
| 34 | -} else { |
|
| 34 | +} else { |
|
| 35 | 35 | $limit_explode = explode(",", $_GET['limit']); |
| 36 | 36 | $limit_start = $limit_explode[0]; |
| 37 | 37 | $limit_end = $limit_explode[1]; |
@@ -50,20 +50,32 @@ discard block |
||
| 50 | 50 | print '</div>'; |
| 51 | 51 | |
| 52 | 52 | print '<div class="table column">'; |
| 53 | -if ($type == 'aircraft') print '<p>'._("The table below shows the detailed information of all current flights.").'</p>'; |
|
| 54 | -elseif ($type == 'marine') print '<p>'._("The table below shows the detailed information of all current vessels.").'</p>'; |
|
| 55 | -elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all current trackers.").'</p>'; |
|
| 53 | +if ($type == 'aircraft') { |
|
| 54 | + print '<p>'._("The table below shows the detailed information of all current flights.").'</p>'; |
|
| 55 | +} elseif ($type == 'marine') { |
|
| 56 | + print '<p>'._("The table below shows the detailed information of all current vessels.").'</p>'; |
|
| 57 | +} elseif ($type == 'tracker') { |
|
| 58 | + print '<p>'._("The table below shows the detailed information of all current trackers.").'</p>'; |
|
| 59 | +} |
|
| 56 | 60 | |
| 57 | 61 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
| 58 | 62 | if ($sort != '') { |
| 59 | - if ($type == 'aircraft') $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference, $sort); |
|
| 60 | - elseif ($type == 'marine') $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference, $sort); |
|
| 61 | - elseif ($type == 'tracker') $spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference, $sort); |
|
| 62 | -} else { |
|
| 63 | - if ($type == 'aircraft') $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference); |
|
| 64 | - elseif ($type == 'marine') $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference); |
|
| 65 | - elseif ($type == 'tracker') $spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference); |
|
| 66 | -} |
|
| 63 | + if ($type == 'aircraft') { |
|
| 64 | + $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference, $sort); |
|
| 65 | + } elseif ($type == 'marine') { |
|
| 66 | + $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference, $sort); |
|
| 67 | + } elseif ($type == 'tracker') { |
|
| 68 | + $spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference, $sort); |
|
| 69 | + } |
|
| 70 | + } else { |
|
| 71 | + if ($type == 'aircraft') { |
|
| 72 | + $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference); |
|
| 73 | + } elseif ($type == 'marine') { |
|
| 74 | + $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference); |
|
| 75 | + } elseif ($type == 'tracker') { |
|
| 76 | + $spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference); |
|
| 77 | + } |
|
| 78 | + } |
|
| 67 | 79 | |
| 68 | 80 | if (!empty($spotter_array)) |
| 69 | 81 | { |
@@ -1,11 +1,20 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__).'/require/settings.php'); |
| 3 | 3 | $type = 'aircraft'; |
| 4 | -if (isset($_GET['marine'])) $type = 'marine'; |
|
| 5 | -elseif (isset($_GET['tracker'])) $type = 'tracker'; |
|
| 4 | +if (isset($_GET['marine'])) { |
|
| 5 | + $type = 'marine'; |
|
| 6 | +} elseif (isset($_GET['tracker'])) { |
|
| 7 | + $type = 'tracker'; |
|
| 8 | +} |
|
| 6 | 9 | $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING); |
| 7 | -if ($date == '') $date = date('Y-m-d'); |
|
| 8 | -if ($type == 'marine') header('Location: '.$globalURL.'/marine/date/'.$date); |
|
| 9 | -elseif ($type == 'tracker') header('Location: '.$globalURL.'/tracker/date/'.$date); |
|
| 10 | -else header('Location: '.$globalURL.'/date/'.$date); |
|
| 10 | +if ($date == '') { |
|
| 11 | + $date = date('Y-m-d'); |
|
| 12 | +} |
|
| 13 | +if ($type == 'marine') { |
|
| 14 | + header('Location: '.$globalURL.'/marine/date/'.$date); |
|
| 15 | +} elseif ($type == 'tracker') { |
|
| 16 | + header('Location: '.$globalURL.'/tracker/date/'.$date); |
|
| 17 | +} else { |
|
| 18 | + header('Location: '.$globalURL.'/date/'.$date); |
|
| 19 | +} |
|
| 11 | 20 | ?> |
| 12 | 21 | \ No newline at end of file |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $limit_start = 0; |
| 30 | 30 | $limit_end = 25; |
| 31 | 31 | $absolute_difference = 25; |
| 32 | - } else { |
|
| 32 | + } else { |
|
| 33 | 33 | $limit_explode = explode(",", $_GET['limit']); |
| 34 | 34 | $limit_start = $limit_explode[0]; |
| 35 | 35 | $limit_end = $limit_explode[1]; |
@@ -46,21 +46,33 @@ discard block |
||
| 46 | 46 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
| 47 | 47 | if ($sort != '') |
| 48 | 48 | { |
| 49 | - if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 50 | - elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 51 | - else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 49 | + if ($type == 'marine') { |
|
| 50 | + $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 51 | + } elseif ($type == 'tracker') { |
|
| 52 | + $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 53 | + } else { |
|
| 54 | + $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort); |
|
| 55 | + } |
|
| 52 | 56 | } else { |
| 53 | - if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 54 | - elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 55 | - else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 57 | + if ($type == 'marine') { |
|
| 58 | + $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 59 | + } elseif ($type == 'tracker') { |
|
| 60 | + $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 61 | + } else { |
|
| 62 | + $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference); |
|
| 63 | + } |
|
| 56 | 64 | } |
| 57 | 65 | |
| 58 | 66 | if (!empty($spotter_array)) |
| 59 | 67 | { |
| 60 | 68 | date_default_timezone_set($globalTimezone); |
| 61 | - if ($type == 'marine') $title = sprintf(_("Detailed View for vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 62 | - elseif ($type == 'tracker') $title = sprintf(_("Detailed View for trackers from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 63 | - else $title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 69 | + if ($type == 'marine') { |
|
| 70 | + $title = sprintf(_("Detailed View for vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 71 | + } elseif ($type == 'tracker') { |
|
| 72 | + $title = sprintf(_("Detailed View for trackers from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 73 | + } else { |
|
| 74 | + $title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 75 | + } |
|
| 64 | 76 | |
| 65 | 77 | require_once('header.php'); |
| 66 | 78 | print '<div class="select-item">'; |
@@ -78,15 +90,24 @@ discard block |
||
| 78 | 90 | print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>'; |
| 79 | 91 | print '<br />'; |
| 80 | 92 | print '<div class="info column">'; |
| 81 | - if ($type == 'marine') print '<h1>'.sprintf(_("Vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 82 | - else print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 93 | + if ($type == 'marine') { |
|
| 94 | + print '<h1>'.sprintf(_("Vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 95 | + } else { |
|
| 96 | + print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 97 | + } |
|
| 83 | 98 | print '</div>'; |
| 84 | 99 | |
| 85 | - if ($type == 'aircraft') include('date-sub-menu.php'); |
|
| 100 | + if ($type == 'aircraft') { |
|
| 101 | + include('date-sub-menu.php'); |
|
| 102 | + } |
|
| 86 | 103 | print '<div class="table column">'; |
| 87 | - if ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 88 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 89 | - else print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 104 | + if ($type == 'marine') { |
|
| 105 | + print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 106 | + } elseif ($type == 'tracker') { |
|
| 107 | + print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 108 | + } else { |
|
| 109 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 110 | + } |
|
| 90 | 111 | |
| 91 | 112 | include('table-output.php'); |
| 92 | 113 | print '<div class="pagination">'; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | $limit_start = 0; |
| 29 | 29 | $limit_end = 25; |
| 30 | 30 | $absolute_difference = 25; |
| 31 | -} else { |
|
| 31 | +} else { |
|
| 32 | 32 | $limit_explode = explode(",", $_GET['limit']); |
| 33 | 33 | $limit_start = $limit_explode[0]; |
| 34 | 34 | $limit_end = $limit_explode[1]; |
@@ -47,9 +47,13 @@ discard block |
||
| 47 | 47 | print '<h1>'._("Latest Activity").'</h1>'; |
| 48 | 48 | print '</div>'; |
| 49 | 49 | print '<div class="table column">'; |
| 50 | -if ($type == 'marine') print '<p>'._("The table below shows the detailed information of all recent vessels.").'</p>'; |
|
| 51 | -elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
|
| 52 | -else print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
|
| 50 | +if ($type == 'marine') { |
|
| 51 | + print '<p>'._("The table below shows the detailed information of all recent vessels.").'</p>'; |
|
| 52 | +} elseif ($type == 'tracker') { |
|
| 53 | + print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
|
| 54 | +} else { |
|
| 55 | + print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
|
| 56 | +} |
|
| 53 | 57 | |
| 54 | 58 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
| 55 | 59 | $sql_begin = microtime(true); |
@@ -7,7 +7,9 @@ discard block |
||
| 7 | 7 | $showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
| 8 | 8 | $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
| 9 | 9 | |
| 10 | -if (!isset($type)) $type = 'aircraft'; |
|
| 10 | +if (!isset($type)) { |
|
| 11 | + $type = 'aircraft'; |
|
| 12 | +} |
|
| 11 | 13 | |
| 12 | 14 | if (!isset($_GET['sort'])) |
| 13 | 15 | { |
@@ -440,7 +442,9 @@ discard block |
||
| 440 | 442 | if (isset($globalTimezone)) |
| 441 | 443 | { |
| 442 | 444 | date_default_timezone_set($globalTimezone); |
| 443 | - } else date_default_timezone_set('UTC'); |
|
| 445 | + } else { |
|
| 446 | + date_default_timezone_set('UTC'); |
|
| 447 | + } |
|
| 444 | 448 | if ($showSpecial === true) |
| 445 | 449 | { |
| 446 | 450 | print '<tr class="special">'."\n"; |
@@ -455,7 +459,9 @@ discard block |
||
| 455 | 459 | print '<tr class="active">'; |
| 456 | 460 | } elseif (isset($spotter_item['spotted_registration'])) { |
| 457 | 461 | print '<tr class="info">'; |
| 458 | - } else print '<tr>'; |
|
| 462 | + } else { |
|
| 463 | + print '<tr>'; |
|
| 464 | + } |
|
| 459 | 465 | } |
| 460 | 466 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive" || strtolower($current_page) == "currently" || strtolower($current_page) == "accident-latest" || strtolower($current_page) == "incident-latest" || strtolower($current_page) == "accident-detailed" || strtolower($current_page) == "incident-detailed") { |
| 461 | 467 | if ($type == 'aircraft') { |
@@ -463,8 +469,9 @@ discard block |
||
| 463 | 469 | { |
| 464 | 470 | print '<td class="aircraft_thumbnail">'."\n"; |
| 465 | 471 | if ($spotter_item['image_source'] == 'planespotters') { |
| 466 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
| 467 | - else { |
|
| 472 | + if ($spotter_item['image_source_website'] != '') { |
|
| 473 | + $image_src = $spotter_item['image_source_website']; |
|
| 474 | + } else { |
|
| 468 | 475 | $planespotter_url_array = explode("_", $spotter_item['image']); |
| 469 | 476 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
| 470 | 477 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -477,7 +484,9 @@ discard block |
||
| 477 | 484 | } else { |
| 478 | 485 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 479 | 486 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 480 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 487 | + } else { |
|
| 488 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 489 | + } |
|
| 481 | 490 | if (isset($spotter_item['airline_name'])) { |
| 482 | 491 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 483 | 492 | } else { |
@@ -496,7 +505,9 @@ discard block |
||
| 496 | 505 | print '<td class="aircraft_thumbnail">'."\n"; |
| 497 | 506 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 498 | 507 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 499 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 508 | + } else { |
|
| 509 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 510 | + } |
|
| 500 | 511 | if (isset($spotter_item['airline_name'])) { |
| 501 | 512 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 502 | 513 | } else { |
@@ -514,7 +525,9 @@ discard block |
||
| 514 | 525 | print '<td class="aircraft_thumbnail">'."\n"; |
| 515 | 526 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 516 | 527 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 517 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 528 | + } else { |
|
| 529 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 530 | + } |
|
| 518 | 531 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 519 | 532 | print '</td>'."\n"; |
| 520 | 533 | } else { |
@@ -565,8 +578,9 @@ discard block |
||
| 565 | 578 | print '<td class="aircraft_thumbnail">'."\n"; |
| 566 | 579 | //print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
| 567 | 580 | if ($spotter_item['image_source'] == 'planespotters') { |
| 568 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
| 569 | - else { |
|
| 581 | + if ($spotter_item['image_source_website'] != '') { |
|
| 582 | + $image_src = $spotter_item['image_source_website']; |
|
| 583 | + } else { |
|
| 570 | 584 | $planespotter_url_array = explode("_", $spotter_array[0]['image']); |
| 571 | 585 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
| 572 | 586 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -583,7 +597,9 @@ discard block |
||
| 583 | 597 | } else { |
| 584 | 598 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 585 | 599 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 586 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 600 | + } else { |
|
| 601 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 602 | + } |
|
| 587 | 603 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 588 | 604 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 589 | 605 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
@@ -616,7 +632,9 @@ discard block |
||
| 616 | 632 | print '<td class="aircraft_thumbnail">'."\n"; |
| 617 | 633 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 618 | 634 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 619 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 635 | + } else { |
|
| 636 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 637 | + } |
|
| 620 | 638 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 621 | 639 | print '</td>'."\n"; |
| 622 | 640 | } else { |
@@ -630,7 +648,9 @@ discard block |
||
| 630 | 648 | print '<td class="aircraft_thumbnail">'."\n"; |
| 631 | 649 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 632 | 650 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 633 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 651 | + } else { |
|
| 652 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 653 | + } |
|
| 634 | 654 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 635 | 655 | print '</td>'."\n"; |
| 636 | 656 | } else { |
@@ -783,15 +803,21 @@ discard block |
||
| 783 | 803 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
| 784 | 804 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 785 | 805 | $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
| 786 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 806 | + } else { |
|
| 807 | + $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 808 | + } |
|
| 787 | 809 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 788 | 810 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
| 789 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 811 | + } else { |
|
| 812 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 813 | + } |
|
| 790 | 814 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
| 791 | 815 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
| 792 | 816 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 793 | 817 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
| 794 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 818 | + } else { |
|
| 819 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 820 | + } |
|
| 795 | 821 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
| 796 | 822 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
| 797 | 823 | if ($spotter_item['departure_airport_time'] > 2460) { |
@@ -813,7 +839,9 @@ discard block |
||
| 813 | 839 | $longitude = $spotter_item['longitude']; |
| 814 | 840 | } |
| 815 | 841 | $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
| 816 | - } else $distance = ''; |
|
| 842 | + } else { |
|
| 843 | + $distance = ''; |
|
| 844 | + } |
|
| 817 | 845 | if ($distance != '') { |
| 818 | 846 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 819 | 847 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -840,7 +868,9 @@ discard block |
||
| 840 | 868 | } else { |
| 841 | 869 | if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) { |
| 842 | 870 | print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n"; |
| 843 | - if (!isset($Spotter)) $Spotter = new Spotter(); |
|
| 871 | + if (!isset($Spotter)) { |
|
| 872 | + $Spotter = new Spotter(); |
|
| 873 | + } |
|
| 844 | 874 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']); |
| 845 | 875 | print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n"; |
| 846 | 876 | print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n"; |
@@ -856,20 +886,28 @@ discard block |
||
| 856 | 886 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
| 857 | 887 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 858 | 888 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
| 859 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 889 | + } else { |
|
| 890 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 891 | + } |
|
| 860 | 892 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 861 | 893 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
| 862 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 894 | + } else { |
|
| 895 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 896 | + } |
|
| 863 | 897 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
| 864 | 898 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
| 865 | 899 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 866 | 900 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
| 867 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 901 | + } else { |
|
| 902 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 903 | + } |
|
| 868 | 904 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
| 869 | 905 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
| 870 | 906 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 871 | 907 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
| 872 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 908 | + } else { |
|
| 909 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 910 | + } |
|
| 873 | 911 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
| 874 | 912 | } |
| 875 | 913 | if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
@@ -882,7 +920,9 @@ discard block |
||
| 882 | 920 | $longitude = $spotter_item['longitude']; |
| 883 | 921 | } |
| 884 | 922 | $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
| 885 | - } else $distance = ''; |
|
| 923 | + } else { |
|
| 924 | + $distance = ''; |
|
| 925 | + } |
|
| 886 | 926 | if ($distance != '') { |
| 887 | 927 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 888 | 928 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |