@@ -13,7 +13,7 @@ |
||
| 13 | 13 | $limit_start = 0; |
| 14 | 14 | $limit_end = 25; |
| 15 | 15 | $absolute_difference = 25; |
| 16 | - } else { |
|
| 16 | + } else { |
|
| 17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
| 18 | 18 | $limit_start = $limit_explode[0]; |
| 19 | 19 | $limit_end = $limit_explode[1]; |
@@ -23,7 +23,9 @@ |
||
| 23 | 23 | print '<fieldset class="form-group">'; |
| 24 | 24 | print '<label for="notam_message">'._("NOTAM Message").'</label>'; |
| 25 | 25 | print '<textarea class="form-control" name="notam_message" id="notam_message" rows="5">'; |
| 26 | -if ($message != '') print $message; |
|
| 26 | +if ($message != '') { |
|
| 27 | + print $message; |
|
| 28 | +} |
|
| 27 | 29 | print '</textarea>'; |
| 28 | 30 | print '</fieldset>'; |
| 29 | 31 | print '<button type="submit" class="btn btn-primary">Submit</button>'; |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | $limit_start = 0; |
| 19 | 19 | $limit_end = 25; |
| 20 | 20 | $absolute_difference = 25; |
| 21 | -} else { |
|
| 21 | +} else { |
|
| 22 | 22 | $limit_explode = explode(",", $_GET['limit']); |
| 23 | 23 | $limit_start = $limit_explode[0]; |
| 24 | 24 | $limit_end = $limit_explode[1]; |
@@ -15,8 +15,12 @@ discard block |
||
| 15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | - } else $sql_date = ''; |
|
| 19 | -} else $sql_date = ''; |
|
| 18 | + } else { |
|
| 19 | + $sql_date = ''; |
|
| 20 | + } |
|
| 21 | + } else { |
|
| 22 | + $sql_date = ''; |
|
| 23 | +} |
|
| 20 | 24 | |
| 21 | 25 | if (isset($_GET['highest_altitude'])) { |
| 22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
| 30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 31 | 35 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
| 32 | 36 | $sql_altitude = $start_altitude; |
| 33 | - } else $sql_altitude = ''; |
|
| 34 | -} else $sql_altitude = ''; |
|
| 37 | + } else { |
|
| 38 | + $sql_altitude = ''; |
|
| 39 | + } |
|
| 40 | + } else { |
|
| 41 | + $sql_altitude = ''; |
|
| 42 | +} |
|
| 35 | 43 | |
| 36 | 44 | //calculuation for the pagination |
| 37 | 45 | if(!isset($_GET['limit'])) |
@@ -49,7 +57,7 @@ discard block |
||
| 49 | 57 | $limit_end = $_GET['number_results']; |
| 50 | 58 | $absolute_difference = $_GET['number_results']; |
| 51 | 59 | } |
| 52 | -} else { |
|
| 60 | +} else { |
|
| 53 | 61 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | 62 | $limit_start = $limit_explode[0]; |
| 55 | 63 | $limit_end = $limit_explode[1]; |
@@ -67,8 +75,11 @@ discard block |
||
| 67 | 75 | |
| 68 | 76 | header("Content-type: text/yaml"); |
| 69 | 77 | |
| 70 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 71 | -else $sort = ''; |
|
| 78 | +if (isset($_GET['sort'])) { |
|
| 79 | + $sort = $_GET['sort']; |
|
| 80 | +} else { |
|
| 81 | + $sort = ''; |
|
| 82 | +} |
|
| 72 | 83 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 73 | 84 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
| 74 | 85 | $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
@@ -12,7 +12,9 @@ |
||
| 12 | 12 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
| 13 | 13 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
| 14 | 14 | $spotter_array = $Spotter->getSpotterDataByRoute($_GET['departure_airport'], $_GET['arrival_airport'], "0,1", $sort); |
| 15 | -} else $spotter_array = array(); |
|
| 15 | +} else { |
|
| 16 | + $spotter_array = array(); |
|
| 17 | +} |
|
| 16 | 18 | |
| 17 | 19 | if (!empty($spotter_array)) |
| 18 | 20 | { |
@@ -36,8 +36,12 @@ |
||
| 36 | 36 | if (!empty($spotter_array)) { |
| 37 | 37 | include('table-output.php'); |
| 38 | 38 | print '<div class="pagination">'; |
| 39 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$_GET['sort'].'">«'._("Previous Page").'</a>'; |
|
| 40 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$_GET['sort'].'">'._("Next Page").'»</a>'; |
|
| 39 | + if ($limit_previous_1 >= 0) { |
|
| 40 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$_GET['sort'].'">«'._("Previous Page").'</a>'; |
|
| 41 | + } |
|
| 42 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
| 43 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$_GET['sort'].'">'._("Next Page").'»</a>'; |
|
| 44 | + } |
|
| 41 | 45 | print '</div>'; |
| 42 | 46 | } |
| 43 | 47 | print '</div>'; |
@@ -35,7 +35,9 @@ |
||
| 35 | 35 | $first = ''; |
| 36 | 36 | foreach($data as $value => $key) { |
| 37 | 37 | $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key); |
| 38 | - if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
| 38 | + if ($first == '') { |
|
| 39 | + $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
| 40 | + } |
|
| 39 | 41 | $output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],'; |
| 40 | 42 | } |
| 41 | 43 | $output .= $first; |
@@ -27,8 +27,11 @@ discard block |
||
| 27 | 27 | } else { |
| 28 | 28 | curl_setopt($ch, CURLOPT_USERAGENT, $useragent); |
| 29 | 29 | } |
| 30 | - if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
| 31 | - else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
| 30 | + if ($timeout == '') { |
|
| 31 | + curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
| 32 | + } else { |
|
| 33 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
| 34 | + } |
|
| 32 | 35 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
| 33 | 36 | if ($type == 'post') { |
| 34 | 37 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
@@ -73,8 +76,9 @@ discard block |
||
| 73 | 76 | |
| 74 | 77 | private function curlResponseHeaderCallback($ch, $headerLine) { |
| 75 | 78 | global $cookies; |
| 76 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
| 77 | - $cookies[] = $cookie; |
|
| 79 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
| 80 | + $cookies[] = $cookie; |
|
| 81 | + } |
|
| 78 | 82 | return strlen($headerLine); // Needed by curl |
| 79 | 83 | } |
| 80 | 84 | |
@@ -84,10 +88,16 @@ discard block |
||
| 84 | 88 | * @return Array array of the tables in HTML page |
| 85 | 89 | */ |
| 86 | 90 | public function table2array($data) { |
| 87 | - if (!is_string($data)) return array(); |
|
| 88 | - if ($data == '') return array(); |
|
| 91 | + if (!is_string($data)) { |
|
| 92 | + return array(); |
|
| 93 | + } |
|
| 94 | + if ($data == '') { |
|
| 95 | + return array(); |
|
| 96 | + } |
|
| 89 | 97 | $html = str_get_html($data); |
| 90 | - if ($html === false) return array(); |
|
| 98 | + if ($html === false) { |
|
| 99 | + return array(); |
|
| 100 | + } |
|
| 91 | 101 | $tabledata=array(); |
| 92 | 102 | foreach($html->find('tr') as $element) |
| 93 | 103 | { |
@@ -122,7 +132,9 @@ discard block |
||
| 122 | 132 | */ |
| 123 | 133 | public function text2array($data) { |
| 124 | 134 | $html = str_get_html($data); |
| 125 | - if ($html === false) return array(); |
|
| 135 | + if ($html === false) { |
|
| 136 | + return array(); |
|
| 137 | + } |
|
| 126 | 138 | $tabledata=array(); |
| 127 | 139 | foreach($html->find('p') as $element) |
| 128 | 140 | { |
@@ -143,7 +155,9 @@ discard block |
||
| 143 | 155 | * @return Float Distance in $unit |
| 144 | 156 | */ |
| 145 | 157 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
| 146 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
| 158 | + if ($lat == $latc && $lon == $lonc) { |
|
| 159 | + return 0; |
|
| 160 | + } |
|
| 147 | 161 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
| 148 | 162 | if ($unit == "km") { |
| 149 | 163 | return round($dist * 1.609344); |
@@ -167,10 +181,16 @@ discard block |
||
| 167 | 181 | public function withinThreshold ($timeDifference, $distance) { |
| 168 | 182 | $x = abs($timeDifference); |
| 169 | 183 | $d = abs($distance); |
| 170 | - if ($x == 0 || $d == 0) return true; |
|
| 184 | + if ($x == 0 || $d == 0) { |
|
| 185 | + return true; |
|
| 186 | + } |
|
| 171 | 187 | // may be due to Internet jitter; distance is realistic |
| 172 | - if ($x < 0.7 && $d < 2000) return true; |
|
| 173 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
| 188 | + if ($x < 0.7 && $d < 2000) { |
|
| 189 | + return true; |
|
| 190 | + } else { |
|
| 191 | + return $d/$x < 1500*0.27778; |
|
| 192 | + } |
|
| 193 | + // 1500 km/h max |
|
| 174 | 194 | } |
| 175 | 195 | |
| 176 | 196 | |
@@ -230,7 +250,9 @@ discard block |
||
| 230 | 250 | public function hex2str($hex) { |
| 231 | 251 | $str = ''; |
| 232 | 252 | $hexln = strlen($hex); |
| 233 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
| 253 | + for($i=0;$i<$hexln;$i+=2) { |
|
| 254 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
| 255 | + } |
|
| 234 | 256 | return $str; |
| 235 | 257 | } |
| 236 | 258 | |
@@ -258,8 +280,11 @@ discard block |
||
| 258 | 280 | $b = $lat2 - $lat1; |
| 259 | 281 | $c = -($a*$lat1+$b*$lon1); |
| 260 | 282 | $d = $a*$lat3+$b*$lon3+$c; |
| 261 | - if ($d > -$approx && $d < $approx) return true; |
|
| 262 | - else return false; |
|
| 283 | + if ($d > -$approx && $d < $approx) { |
|
| 284 | + return true; |
|
| 285 | + } else { |
|
| 286 | + return false; |
|
| 287 | + } |
|
| 263 | 288 | } |
| 264 | 289 | |
| 265 | 290 | public function array_merge_noappend() { |
@@ -285,7 +310,9 @@ discard block |
||
| 285 | 310 | return $result; |
| 286 | 311 | } |
| 287 | 312 | $handle = @opendir('./locale'); |
| 288 | - if ($handle === false) return $result; |
|
| 313 | + if ($handle === false) { |
|
| 314 | + return $result; |
|
| 315 | + } |
|
| 289 | 316 | while (false !== ($file = readdir($handle))) { |
| 290 | 317 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
| 291 | 318 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -18,21 +18,40 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | header('Content-Type: text/javascript'); |
| 20 | 20 | |
| 21 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 22 | -else $compress = $globalJsonCompress; |
|
| 21 | +if (!isset($globalJsonCompress)) { |
|
| 22 | + $compress = true; |
|
| 23 | +} else { |
|
| 24 | + $compress = $globalJsonCompress; |
|
| 25 | +} |
|
| 23 | 26 | |
| 24 | 27 | $from_archive = false; |
| 25 | 28 | $min = false; |
| 26 | 29 | $allhistory = false; |
| 27 | 30 | $filter['source'] = array(); |
| 28 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 29 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 30 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 31 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 32 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 33 | -if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 34 | -if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 35 | -if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') $filter['airlinestype'] = $_COOKIE['airlinestype']; |
|
| 31 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') { |
|
| 32 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 33 | +} |
|
| 34 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') { |
|
| 35 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 36 | +} |
|
| 37 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') { |
|
| 38 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 39 | +} |
|
| 40 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') { |
|
| 41 | + $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 42 | +} |
|
| 43 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') { |
|
| 44 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 45 | +} |
|
| 46 | +if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') { |
|
| 47 | + $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 48 | +} |
|
| 49 | +if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') { |
|
| 50 | + $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 51 | +} |
|
| 52 | +if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') { |
|
| 53 | + $filter['airlinestype'] = $_COOKIE['airlinestype']; |
|
| 54 | +} |
|
| 36 | 55 | |
| 37 | 56 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 38 | 57 | $min = true; |
@@ -83,8 +102,12 @@ discard block |
||
| 83 | 102 | } else { |
| 84 | 103 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 85 | 104 | } |
| 86 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 87 | -} else $flightcnt = 0; |
|
| 105 | + if ($flightcnt == '') { |
|
| 106 | + $flightcnt = 0; |
|
| 107 | + } |
|
| 108 | + } else { |
|
| 109 | + $flightcnt = 0; |
|
| 110 | +} |
|
| 88 | 111 | |
| 89 | 112 | $sqltime = round(microtime(true)-$begintime,2); |
| 90 | 113 | |
@@ -93,8 +116,11 @@ discard block |
||
| 93 | 116 | |
| 94 | 117 | $output = '{'; |
| 95 | 118 | $output .= '"type": "FeatureCollection",'; |
| 96 | - if ($min) $output .= '"minimal": "true",'; |
|
| 97 | - else $output .= '"minimal": "false",'; |
|
| 119 | + if ($min) { |
|
| 120 | + $output .= '"minimal": "true",'; |
|
| 121 | + } else { |
|
| 122 | + $output .= '"minimal": "false",'; |
|
| 123 | + } |
|
| 98 | 124 | $output .= '"fc": "'.$flightcnt.'",'; |
| 99 | 125 | $output .= '"sqt": "'.$sqltime.'",'; |
| 100 | 126 | |
@@ -131,11 +157,16 @@ discard block |
||
| 131 | 157 | //$output .= '"sqt": "'.$sqltime.'",'; |
| 132 | 158 | $output .= '"id": "'.$spotter_item['flightaware_id'].'",'; |
| 133 | 159 | $output .= '"properties": {'; |
| 134 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 135 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 160 | + if ($compress) { |
|
| 161 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 162 | + } else { |
|
| 163 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 164 | + } |
|
| 136 | 165 | $output .= '"fc": "'.$flightcnt.'",'; |
| 137 | 166 | $output .= '"sqt": "'.$sqltime.'",'; |
| 138 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 167 | + if (isset($begindate)) { |
|
| 168 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 169 | + } |
|
| 139 | 170 | |
| 140 | 171 | /* |
| 141 | 172 | if ($min) $output .= '"minimal": "true",'; |
@@ -143,13 +174,21 @@ discard block |
||
| 143 | 174 | */ |
| 144 | 175 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 145 | 176 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 146 | - if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
| 147 | - else $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
| 177 | + if ($compress) { |
|
| 178 | + $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
| 179 | + } else { |
|
| 180 | + $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
| 181 | + } |
|
| 148 | 182 | } else { |
| 149 | - if ($compress) $output .= '"c": "NA",'; |
|
| 150 | - else $output .= '"callsign": "NA",'; |
|
| 183 | + if ($compress) { |
|
| 184 | + $output .= '"c": "NA",'; |
|
| 185 | + } else { |
|
| 186 | + $output .= '"callsign": "NA",'; |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + if (isset($spotter_item['registration'])) { |
|
| 190 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 151 | 191 | } |
| 152 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 153 | 192 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 154 | 193 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 155 | 194 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -162,20 +201,31 @@ discard block |
||
| 162 | 201 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
| 163 | 202 | } |
| 164 | 203 | if (!isset($spotter_item['aircraft_shadow'])) { |
| 165 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 166 | - else { |
|
| 204 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 205 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 206 | + } else { |
|
| 167 | 207 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 168 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 169 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 170 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 208 | + if (count($aircraft_info) > 0) { |
|
| 209 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 210 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 211 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 212 | + } else { |
|
| 213 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 214 | + } |
|
| 171 | 215 | } |
| 172 | 216 | } |
| 173 | 217 | if ($spotter_item['aircraft_shadow'] == '') { |
| 174 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 175 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 218 | + if ($compress) { |
|
| 219 | + $output .= '"as": "default.png",'; |
|
| 220 | + } else { |
|
| 221 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 222 | + } |
|
| 176 | 223 | } else { |
| 177 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 178 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 224 | + if ($compress) { |
|
| 225 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 226 | + } else { |
|
| 227 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 228 | + } |
|
| 179 | 229 | } |
| 180 | 230 | if (isset($spotter_item['airline_name'])) { |
| 181 | 231 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -183,8 +233,11 @@ discard block |
||
| 183 | 233 | $output .= '"airline_name": "NA",'; |
| 184 | 234 | } |
| 185 | 235 | if (isset($spotter_item['departure_airport'])) { |
| 186 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 187 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 236 | + if ($compress) { |
|
| 237 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 238 | + } else { |
|
| 239 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 240 | + } |
|
| 188 | 241 | } |
| 189 | 242 | if (isset($spotter_item['departure_airport_city'])) { |
| 190 | 243 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -196,8 +249,11 @@ discard block |
||
| 196 | 249 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
| 197 | 250 | } |
| 198 | 251 | if (isset($spotter_item['arrival_airport'])) { |
| 199 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 200 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 252 | + if ($compress) { |
|
| 253 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 254 | + } else { |
|
| 255 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 256 | + } |
|
| 201 | 257 | } |
| 202 | 258 | if (isset($spotter_item['arrival_airport_city'])) { |
| 203 | 259 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -215,18 +271,29 @@ discard block |
||
| 215 | 271 | $output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",'; |
| 216 | 272 | } |
| 217 | 273 | |
| 218 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 219 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 220 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 221 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 274 | + if ($compress) { |
|
| 275 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 276 | + } else { |
|
| 277 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 278 | + } |
|
| 279 | + if ($compress) { |
|
| 280 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 281 | + } else { |
|
| 282 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 283 | + } |
|
| 222 | 284 | |
| 223 | - if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
| 224 | - else $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
| 285 | + if (isset($archivespeed)) { |
|
| 286 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
| 287 | + } else { |
|
| 288 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
| 289 | + } |
|
| 225 | 290 | //$output .= '"nextlatitude": "'.$nextcoord['latitude'].'",'; |
| 226 | 291 | //$output .= '"nextlongitude": "'.$nextcoord['longitude'].'",'; |
| 227 | 292 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 228 | 293 | |
| 229 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
| 294 | + if (!$min) { |
|
| 295 | + $output .= '"image": "'.$image.'",'; |
|
| 296 | + } |
|
| 230 | 297 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 231 | 298 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
| 232 | 299 | } |
@@ -234,8 +301,11 @@ discard block |
||
| 234 | 301 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
| 235 | 302 | } |
| 236 | 303 | if (isset($spotter_item['squawk'])) { |
| 237 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 238 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 304 | + if ($compress) { |
|
| 305 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 306 | + } else { |
|
| 307 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 308 | + } |
|
| 239 | 309 | } |
| 240 | 310 | if (isset($spotter_item['squawk_usage'])) { |
| 241 | 311 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -253,8 +323,11 @@ discard block |
||
| 253 | 323 | $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
| 254 | 324 | } |
| 255 | 325 | // type when not aircraft ? |
| 256 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 257 | - else $output .= '"type": "aircraft"'; |
|
| 326 | + if ($compress) { |
|
| 327 | + $output .= '"t": "aircraft"'; |
|
| 328 | + } else { |
|
| 329 | + $output .= '"type": "aircraft"'; |
|
| 330 | + } |
|
| 258 | 331 | $output .= '},'; |
| 259 | 332 | $output .= '"geometry": {'; |
| 260 | 333 | $output .= '"type": "Point",'; |
@@ -321,7 +394,9 @@ discard block |
||
| 321 | 394 | //if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id'])))) { |
| 322 | 395 | //if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id']))) || (isset($_GET['history']) && $_GET['history'] == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) { |
| 323 | 396 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
| 324 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
| 397 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
| 398 | + $history = $_COOKIE['history']; |
|
| 399 | + } |
|
| 325 | 400 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
| 326 | 401 | || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
| 327 | 402 | || (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) { |
@@ -346,8 +421,11 @@ discard block |
||
| 346 | 421 | $output_history .= ']}},'; |
| 347 | 422 | $output .= $output_history; |
| 348 | 423 | } |
| 349 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 350 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 424 | + if ($compress) { |
|
| 425 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 426 | + } else { |
|
| 427 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 428 | + } |
|
| 351 | 429 | } |
| 352 | 430 | $output_history .= '['; |
| 353 | 431 | $output_history .= $spotter_history['longitude'].', '; |
@@ -397,7 +475,9 @@ discard block |
||
| 397 | 475 | $output .= ']'; |
| 398 | 476 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 399 | 477 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 400 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 478 | + if (isset($begindate)) { |
|
| 479 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 480 | + } |
|
| 401 | 481 | $output .= '"fc": "'.$j.'"'; |
| 402 | 482 | } else { |
| 403 | 483 | $output .= '"features": '; |