@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $limit_start = 0; |
| 15 | 15 | $limit_end = 25; |
| 16 | 16 | $absolute_difference = 25; |
| 17 | - } else { |
|
| 17 | + } else { |
|
| 18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
| 19 | 19 | $limit_start = $limit_explode[0]; |
| 20 | 20 | $limit_end = $limit_explode[1]; |
@@ -38,7 +38,9 @@ discard block |
||
| 38 | 38 | { |
| 39 | 39 | if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) { |
| 40 | 40 | $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
| 41 | - } else $title = ''; |
|
| 41 | + } else { |
|
| 42 | + $title = ''; |
|
| 43 | + } |
|
| 42 | 44 | require_once('header.php'); |
| 43 | 45 | |
| 44 | 46 | print '<div class="select-item">'; |
@@ -47,7 +49,9 @@ discard block |
||
| 47 | 49 | print '<option></option>'; |
| 48 | 50 | $Stats = new Stats(); |
| 49 | 51 | $airline_names = $Stats->getAllAirlineNames(); |
| 50 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
| 52 | + if (empty($airline_names)) { |
|
| 53 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
| 54 | + } |
|
| 51 | 55 | foreach($airline_names as $airline_name) |
| 52 | 56 | { |
| 53 | 57 | if($_GET['airline'] == $airline_name['airline_icao']) |
@@ -76,10 +80,16 @@ discard block |
||
| 76 | 80 | print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['airline_name'].'</div>'; |
| 77 | 81 | print '<div><span class="label">'._("Country").'</span>'.$spotter_array[0]['airline_country'].'</div>'; |
| 78 | 82 | print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['airline_icao'].'</div>'; |
| 79 | - if (isset($spotter_array[0]['airline_iata'])) print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>'; |
|
| 80 | - if (isset($spotter_array[0]['airline_callsign'])) print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; |
|
| 83 | + if (isset($spotter_array[0]['airline_iata'])) { |
|
| 84 | + print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>'; |
|
| 85 | + } |
|
| 86 | + if (isset($spotter_array[0]['airline_callsign'])) { |
|
| 87 | + print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; |
|
| 88 | + } |
|
| 81 | 89 | print '<div><span class="label">'._("Type").'</span>'.ucwords($spotter_array[0]['airline_type']).'</div>'; |
| 82 | - if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>'; |
|
| 90 | + if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) { |
|
| 91 | + print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>'; |
|
| 92 | + } |
|
| 83 | 93 | print '</div>'; |
| 84 | 94 | } else { |
| 85 | 95 | print '<div class="alert alert-warning">'._("This special airline profile shows all flights that do <u>not</u> have a airline associated with them.").'</div>'; |
@@ -4,17 +4,17 @@ discard block |
||
| 4 | 4 | require_once('require/class.Stats.php'); |
| 5 | 5 | require_once('require/class.Language.php'); |
| 6 | 6 | |
| 7 | -if (!isset($_GET['airline'])){ |
|
| 7 | +if (!isset($_GET['airline'])) { |
|
| 8 | 8 | header('Location: '.$globalURL.'/airline'); |
| 9 | -} else{ |
|
| 9 | +} else { |
|
| 10 | 10 | $Spotter = new Spotter(); |
| 11 | 11 | //calculuation for the pagination |
| 12 | - if(!isset($_GET['limit']) || $_GET['limit'] == "") |
|
| 12 | + if (!isset($_GET['limit']) || $_GET['limit'] == "") |
|
| 13 | 13 | { |
| 14 | 14 | $limit_start = 0; |
| 15 | 15 | $limit_end = 25; |
| 16 | 16 | $absolute_difference = 25; |
| 17 | - } else { |
|
| 17 | + } else { |
|
| 18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
| 19 | 19 | $limit_start = $limit_explode[0]; |
| 20 | 20 | $limit_end = $limit_explode[1]; |
@@ -28,16 +28,16 @@ discard block |
||
| 28 | 28 | $limit_previous_1 = $limit_start - $absolute_difference; |
| 29 | 29 | $limit_previous_2 = $limit_end - $absolute_difference; |
| 30 | 30 | |
| 31 | - $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 31 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 32 | 32 | $page_url = $globalURL.'/airline/'.$airline; |
| 33 | 33 | |
| 34 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 35 | - $spotter_array = $Spotter->getSpotterDataByAirline($_GET['airline'],$limit_start.",".$absolute_difference, $sort); |
|
| 34 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 35 | + $spotter_array = $Spotter->getSpotterDataByAirline($_GET['airline'], $limit_start.",".$absolute_difference, $sort); |
|
| 36 | 36 | |
| 37 | 37 | if (!empty($spotter_array)) |
| 38 | 38 | { |
| 39 | 39 | if (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) { |
| 40 | - $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
| 40 | + $title = sprintf(_("Detailed View for %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
| 41 | 41 | } else $title = ''; |
| 42 | 42 | require_once('header.php'); |
| 43 | 43 | |
@@ -48,9 +48,9 @@ discard block |
||
| 48 | 48 | $Stats = new Stats(); |
| 49 | 49 | $airline_names = $Stats->getAllAirlineNames(); |
| 50 | 50 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
| 51 | - foreach($airline_names as $airline_name) |
|
| 51 | + foreach ($airline_names as $airline_name) |
|
| 52 | 52 | { |
| 53 | - if($_GET['airline'] == $airline_name['airline_icao']) |
|
| 53 | + if ($_GET['airline'] == $airline_name['airline_icao']) |
|
| 54 | 54 | { |
| 55 | 55 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
| 56 | 56 | } else { |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | include('airline-sub-menu.php'); |
| 89 | 89 | print '<div class="table column">'; |
| 90 | 90 | if (isset($spotter_array[0]['airline_name'])) { |
| 91 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
| 91 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | include('table-output.php'); |
@@ -79,6 +79,10 @@ discard block |
||
| 79 | 79 | return strlen($headerLine); // Needed by curl |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | + /** |
|
| 83 | + * @param string $url |
|
| 84 | + * @param string $file |
|
| 85 | + */ |
|
| 82 | 86 | public static function download($url, $file, $referer = '') { |
| 83 | 87 | global $globalDebug; |
| 84 | 88 | $fp = fopen($file, 'w'); |
@@ -179,7 +183,7 @@ discard block |
||
| 179 | 183 | * Check is distance realistic |
| 180 | 184 | * @param int $timeDifference the time between the reception of both messages |
| 181 | 185 | * @param float $distance distance covered |
| 182 | - * @return whether distance is realistic |
|
| 186 | + * @return boolean distance is realistic |
|
| 183 | 187 | */ |
| 184 | 188 | public function withinThreshold ($timeDifference, $distance) { |
| 185 | 189 | $x = abs($timeDifference); |
@@ -202,6 +206,9 @@ discard block |
||
| 202 | 206 | } |
| 203 | 207 | |
| 204 | 208 | |
| 209 | + /** |
|
| 210 | + * @param string $latlong |
|
| 211 | + */ |
|
| 205 | 212 | public function convertDec($dms,$latlong) { |
| 206 | 213 | if ($latlong == 'latitude') { |
| 207 | 214 | $deg = substr($dms, 0, 2); |
@@ -303,7 +310,7 @@ discard block |
||
| 303 | 310 | /** |
| 304 | 311 | * Returns list of available locales |
| 305 | 312 | * |
| 306 | - * @return array |
|
| 313 | + * @return string[] |
|
| 307 | 314 | */ |
| 308 | 315 | public function listLocaleDir() |
| 309 | 316 | { |
@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | //protected $cookies = array(); |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | - * Get data from form result |
|
| 10 | - * @param String $url form URL |
|
| 11 | - * @param String $type type of submit form method (get or post) |
|
| 12 | - * @param String|Array $data values form post method |
|
| 13 | - * @param Array $headers header to submit with the form |
|
| 14 | - * @return String the result |
|
| 15 | - */ |
|
| 9 | + * Get data from form result |
|
| 10 | + * @param String $url form URL |
|
| 11 | + * @param String $type type of submit form method (get or post) |
|
| 12 | + * @param String|Array $data values form post method |
|
| 13 | + * @param Array $headers header to submit with the form |
|
| 14 | + * @return String the result |
|
| 15 | + */ |
|
| 16 | 16 | public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') { |
| 17 | 17 | $ch = curl_init(); |
| 18 | 18 | curl_setopt($ch, CURLOPT_URL, $url); |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
| 68 | 68 | } |
| 69 | 69 | } else { |
| 70 | - return $result; |
|
| 70 | + return $result; |
|
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | - * Convert a HTML table to an array |
|
| 100 | - * @param String $data HTML page |
|
| 101 | - * @return Array array of the tables in HTML page |
|
| 102 | - */ |
|
| 99 | + * Convert a HTML table to an array |
|
| 100 | + * @param String $data HTML page |
|
| 101 | + * @return Array array of the tables in HTML page |
|
| 102 | + */ |
|
| 103 | 103 | public function table2array($data) { |
| 104 | 104 | if (!is_string($data)) return array(); |
| 105 | 105 | if ($data == '') return array(); |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | /** |
| 136 | - * Convert <p> part of a HTML page to an array |
|
| 137 | - * @param String $data HTML page |
|
| 138 | - * @return Array array of the <p> in HTML page |
|
| 139 | - */ |
|
| 136 | + * Convert <p> part of a HTML page to an array |
|
| 137 | + * @param String $data HTML page |
|
| 138 | + * @return Array array of the <p> in HTML page |
|
| 139 | + */ |
|
| 140 | 140 | public function text2array($data) { |
| 141 | 141 | $html = str_get_html($data); |
| 142 | 142 | if ($html === false) return array(); |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /** |
| 154 | - * Give distance between 2 coordonnates |
|
| 155 | - * @param Float $lat latitude of first point |
|
| 156 | - * @param Float $lon longitude of first point |
|
| 157 | - * @param Float $latc latitude of second point |
|
| 158 | - * @param Float $lonc longitude of second point |
|
| 159 | - * @param String $unit km else no unit used |
|
| 160 | - * @return Float Distance in $unit |
|
| 161 | - */ |
|
| 154 | + * Give distance between 2 coordonnates |
|
| 155 | + * @param Float $lat latitude of first point |
|
| 156 | + * @param Float $lon longitude of first point |
|
| 157 | + * @param Float $latc latitude of second point |
|
| 158 | + * @param Float $lonc longitude of second point |
|
| 159 | + * @param String $unit km else no unit used |
|
| 160 | + * @return Float Distance in $unit |
|
| 161 | + */ |
|
| 162 | 162 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
| 163 | 163 | if ($lat == $latc && $lon == $lonc) return 0; |
| 164 | 164 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | /** |
| 179 | - * Check is distance realistic |
|
| 180 | - * @param int $timeDifference the time between the reception of both messages |
|
| 181 | - * @param float $distance distance covered |
|
| 182 | - * @return whether distance is realistic |
|
| 183 | - */ |
|
| 179 | + * Check is distance realistic |
|
| 180 | + * @param int $timeDifference the time between the reception of both messages |
|
| 181 | + * @param float $distance distance covered |
|
| 182 | + * @return whether distance is realistic |
|
| 183 | + */ |
|
| 184 | 184 | public function withinThreshold ($timeDifference, $distance) { |
| 185 | 185 | $x = abs($timeDifference); |
| 186 | 186 | $d = abs($distance); |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | public function isInteger($input){ |
| 201 | - return(ctype_digit(strval($input))); |
|
| 201 | + return(ctype_digit(strval($input))); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -214,11 +214,11 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | - * Copy folder contents |
|
| 218 | - * @param string $source Source path |
|
| 219 | - * @param string $dest Destination path |
|
| 220 | - * @return bool Returns true on success, false on failure |
|
| 221 | - */ |
|
| 217 | + * Copy folder contents |
|
| 218 | + * @param string $source Source path |
|
| 219 | + * @param string $dest Destination path |
|
| 220 | + * @return bool Returns true on success, false on failure |
|
| 221 | + */ |
|
| 222 | 222 | public function xcopy($source, $dest) |
| 223 | 223 | { |
| 224 | 224 | $files = glob($source.'*.*'); |
@@ -230,20 +230,20 @@ discard block |
||
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | /** |
| 233 | - * Check if an url exist |
|
| 234 | - * @param String $url url to check |
|
| 235 | - * @return bool Return true on succes false on failure |
|
| 236 | - */ |
|
| 233 | + * Check if an url exist |
|
| 234 | + * @param String $url url to check |
|
| 235 | + * @return bool Return true on succes false on failure |
|
| 236 | + */ |
|
| 237 | 237 | public function urlexist($url){ |
| 238 | 238 | $headers=get_headers($url); |
| 239 | 239 | return stripos($headers[0],"200 OK")?true:false; |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
| 243 | - * Convert hexa to string |
|
| 244 | - * @param String $hex data in hexa |
|
| 245 | - * @return String Return result |
|
| 246 | - */ |
|
| 243 | + * Convert hexa to string |
|
| 244 | + * @param String $hex data in hexa |
|
| 245 | + * @return String Return result |
|
| 246 | + */ |
|
| 247 | 247 | public function hex2str($hex) { |
| 248 | 248 | $str = ''; |
| 249 | 249 | $hexln = strlen($hex); |
@@ -301,9 +301,9 @@ discard block |
||
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
| 304 | - * Returns list of available locales |
|
| 305 | - * |
|
| 306 | - * @return array |
|
| 304 | + * Returns list of available locales |
|
| 305 | + * |
|
| 306 | + * @return array |
|
| 307 | 307 | */ |
| 308 | 308 | public function listLocaleDir() |
| 309 | 309 | { |
@@ -398,100 +398,100 @@ discard block |
||
| 398 | 398 | public function remove_accents($string) { |
| 399 | 399 | if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
| 400 | 400 | $chars = array( |
| 401 | - // Decompositions for Latin-1 Supplement |
|
| 402 | - chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
|
| 403 | - chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', |
|
| 404 | - chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', |
|
| 405 | - chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', |
|
| 406 | - chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', |
|
| 407 | - chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', |
|
| 408 | - chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', |
|
| 409 | - chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', |
|
| 410 | - chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', |
|
| 411 | - chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', |
|
| 412 | - chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', |
|
| 413 | - chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', |
|
| 414 | - chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', |
|
| 415 | - chr(195).chr(159) => 's', chr(195).chr(160) => 'a', |
|
| 416 | - chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', |
|
| 417 | - chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', |
|
| 418 | - chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', |
|
| 419 | - chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', |
|
| 420 | - chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', |
|
| 421 | - chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', |
|
| 422 | - chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', |
|
| 423 | - chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', |
|
| 424 | - chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', |
|
| 425 | - chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', |
|
| 426 | - chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', |
|
| 427 | - chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', |
|
| 428 | - chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', |
|
| 429 | - chr(195).chr(191) => 'y', |
|
| 430 | - // Decompositions for Latin Extended-A |
|
| 431 | - chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', |
|
| 432 | - chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', |
|
| 433 | - chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', |
|
| 434 | - chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', |
|
| 435 | - chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', |
|
| 436 | - chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', |
|
| 437 | - chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', |
|
| 438 | - chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', |
|
| 439 | - chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', |
|
| 440 | - chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', |
|
| 441 | - chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', |
|
| 442 | - chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', |
|
| 443 | - chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', |
|
| 444 | - chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', |
|
| 445 | - chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', |
|
| 446 | - chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', |
|
| 447 | - chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', |
|
| 448 | - chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', |
|
| 449 | - chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', |
|
| 450 | - chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', |
|
| 451 | - chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', |
|
| 452 | - chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', |
|
| 453 | - chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
|
| 454 | - chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
|
| 455 | - chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
|
| 456 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
| 457 | - chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
|
| 458 | - chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
|
| 459 | - chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
|
| 460 | - chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', |
|
| 461 | - chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', |
|
| 462 | - chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', |
|
| 463 | - chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', |
|
| 464 | - chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', |
|
| 465 | - chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', |
|
| 466 | - chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', |
|
| 467 | - chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', |
|
| 468 | - chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', |
|
| 469 | - chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
|
| 470 | - chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
|
| 471 | - chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
|
| 472 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
| 473 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
| 474 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
| 475 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
| 476 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
| 477 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
| 478 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
| 479 | - chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
|
| 480 | - chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
|
| 481 | - chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
|
| 482 | - chr(197).chr(166) => 'T', chr(197).chr(167) => 't', |
|
| 483 | - chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', |
|
| 484 | - chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', |
|
| 485 | - chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', |
|
| 486 | - chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', |
|
| 487 | - chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', |
|
| 488 | - chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', |
|
| 489 | - chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', |
|
| 490 | - chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', |
|
| 491 | - chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', |
|
| 492 | - chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', |
|
| 493 | - chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', |
|
| 494 | - chr(197).chr(190) => 'z', chr(197).chr(191) => 's' |
|
| 401 | + // Decompositions for Latin-1 Supplement |
|
| 402 | + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
|
| 403 | + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', |
|
| 404 | + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', |
|
| 405 | + chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', |
|
| 406 | + chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', |
|
| 407 | + chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', |
|
| 408 | + chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', |
|
| 409 | + chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', |
|
| 410 | + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', |
|
| 411 | + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', |
|
| 412 | + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', |
|
| 413 | + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', |
|
| 414 | + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', |
|
| 415 | + chr(195).chr(159) => 's', chr(195).chr(160) => 'a', |
|
| 416 | + chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', |
|
| 417 | + chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', |
|
| 418 | + chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', |
|
| 419 | + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', |
|
| 420 | + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', |
|
| 421 | + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', |
|
| 422 | + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', |
|
| 423 | + chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', |
|
| 424 | + chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', |
|
| 425 | + chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', |
|
| 426 | + chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', |
|
| 427 | + chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', |
|
| 428 | + chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', |
|
| 429 | + chr(195).chr(191) => 'y', |
|
| 430 | + // Decompositions for Latin Extended-A |
|
| 431 | + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', |
|
| 432 | + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', |
|
| 433 | + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', |
|
| 434 | + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', |
|
| 435 | + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', |
|
| 436 | + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', |
|
| 437 | + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', |
|
| 438 | + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', |
|
| 439 | + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', |
|
| 440 | + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', |
|
| 441 | + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', |
|
| 442 | + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', |
|
| 443 | + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', |
|
| 444 | + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', |
|
| 445 | + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', |
|
| 446 | + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', |
|
| 447 | + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', |
|
| 448 | + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', |
|
| 449 | + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', |
|
| 450 | + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', |
|
| 451 | + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', |
|
| 452 | + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', |
|
| 453 | + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
|
| 454 | + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
|
| 455 | + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
|
| 456 | + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
| 457 | + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
|
| 458 | + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
|
| 459 | + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
|
| 460 | + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', |
|
| 461 | + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', |
|
| 462 | + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', |
|
| 463 | + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', |
|
| 464 | + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', |
|
| 465 | + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', |
|
| 466 | + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', |
|
| 467 | + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', |
|
| 468 | + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', |
|
| 469 | + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
|
| 470 | + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
|
| 471 | + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
|
| 472 | + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
| 473 | + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
| 474 | + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
| 475 | + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
| 476 | + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
| 477 | + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
| 478 | + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
| 479 | + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
|
| 480 | + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
|
| 481 | + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
|
| 482 | + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', |
|
| 483 | + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', |
|
| 484 | + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', |
|
| 485 | + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', |
|
| 486 | + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', |
|
| 487 | + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', |
|
| 488 | + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', |
|
| 489 | + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', |
|
| 490 | + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', |
|
| 491 | + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', |
|
| 492 | + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', |
|
| 493 | + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', |
|
| 494 | + chr(197).chr(190) => 'z', chr(197).chr(191) => 's' |
|
| 495 | 495 | ); |
| 496 | 496 | $string = strtr($string, $chars); |
| 497 | 497 | return $string; |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | * @param Array $headers header to submit with the form |
| 14 | 14 | * @return String the result |
| 15 | 15 | */ |
| 16 | - public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') { |
|
| 16 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') { |
|
| 17 | 17 | $ch = curl_init(); |
| 18 | 18 | curl_setopt($ch, CURLOPT_URL, $url); |
| 19 | 19 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
| 20 | 20 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 21 | 21 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
| 22 | - curl_setopt($ch,CURLOPT_ENCODING , "gzip"); |
|
| 22 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
| 23 | 23 | //curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
| 24 | 24 | // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0'); |
| 25 | 25 | if ($useragent == '') { |
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
| 31 | 31 | else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
| 32 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
|
| 32 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback")); |
|
| 33 | 33 | if ($type == 'post') { |
| 34 | 34 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
| 35 | 35 | if (is_array($data)) { |
| 36 | 36 | curl_setopt($ch, CURLOPT_POST, count($data)); |
| 37 | 37 | $data_string = ''; |
| 38 | - foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
| 38 | + foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
| 39 | 39 | rtrim($data_string, '&'); |
| 40 | 40 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
| 41 | 41 | } else { |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | if ($cookie != '') { |
| 49 | 49 | if (is_array($cookie)) { |
| 50 | - curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';')); |
|
| 50 | + curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';')); |
|
| 51 | 51 | } else { |
| 52 | 52 | curl_setopt($ch, CURLOPT_COOKIE, $cookie); |
| 53 | 53 | } |
@@ -58,13 +58,13 @@ discard block |
||
| 58 | 58 | $result = curl_exec($ch); |
| 59 | 59 | $info = curl_getinfo($ch); |
| 60 | 60 | curl_close($ch); |
| 61 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
| 61 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
| 62 | 62 | echo "Cloudflare Detected\n"; |
| 63 | 63 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
| 64 | 64 | $useragent = UAgent::random(); |
| 65 | 65 | cloudflare::useUserAgent($useragent); |
| 66 | 66 | if ($clearanceCookie = cloudflare::bypass($url)) { |
| 67 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
| 67 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
| 68 | 68 | } |
| 69 | 69 | } else { |
| 70 | 70 | return $result; |
@@ -105,27 +105,27 @@ discard block |
||
| 105 | 105 | if ($data == '') return array(); |
| 106 | 106 | $html = str_get_html($data); |
| 107 | 107 | if ($html === false) return array(); |
| 108 | - $tabledata=array(); |
|
| 109 | - foreach($html->find('tr') as $element) |
|
| 108 | + $tabledata = array(); |
|
| 109 | + foreach ($html->find('tr') as $element) |
|
| 110 | 110 | { |
| 111 | 111 | $td = array(); |
| 112 | - foreach( $element->find('th') as $row) |
|
| 112 | + foreach ($element->find('th') as $row) |
|
| 113 | 113 | { |
| 114 | 114 | $td [] = trim($row->plaintext); |
| 115 | 115 | } |
| 116 | - $td=array_filter($td); |
|
| 116 | + $td = array_filter($td); |
|
| 117 | 117 | $tabledata[] = $td; |
| 118 | 118 | |
| 119 | 119 | $td = array(); |
| 120 | 120 | $tdi = array(); |
| 121 | - foreach( $element->find('td') as $row) |
|
| 121 | + foreach ($element->find('td') as $row) |
|
| 122 | 122 | { |
| 123 | 123 | $td [] = trim($row->plaintext); |
| 124 | 124 | $tdi [] = trim($row->innertext); |
| 125 | 125 | } |
| 126 | - $td=array_filter($td); |
|
| 127 | - $tdi=array_filter($tdi); |
|
| 128 | - $tabledata[]=array_merge($td,$tdi); |
|
| 126 | + $td = array_filter($td); |
|
| 127 | + $tdi = array_filter($tdi); |
|
| 128 | + $tabledata[] = array_merge($td, $tdi); |
|
| 129 | 129 | } |
| 130 | 130 | $html->clear(); |
| 131 | 131 | unset($html); |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | public function text2array($data) { |
| 141 | 141 | $html = str_get_html($data); |
| 142 | 142 | if ($html === false) return array(); |
| 143 | - $tabledata=array(); |
|
| 144 | - foreach($html->find('p') as $element) |
|
| 143 | + $tabledata = array(); |
|
| 144 | + foreach ($html->find('p') as $element) |
|
| 145 | 145 | { |
| 146 | 146 | $tabledata [] = trim($element->plaintext); |
| 147 | 147 | } |
@@ -161,11 +161,11 @@ discard block |
||
| 161 | 161 | */ |
| 162 | 162 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
| 163 | 163 | if ($lat == $latc && $lon == $lonc) return 0; |
| 164 | - $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; |
|
| 164 | + $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; |
|
| 165 | 165 | if ($unit == "km") { |
| 166 | - return round($dist * 1.609344); |
|
| 166 | + return round($dist*1.609344); |
|
| 167 | 167 | } elseif ($unit == "m") { |
| 168 | - return round($dist * 1.609344 * 1000); |
|
| 168 | + return round($dist*1.609344*1000); |
|
| 169 | 169 | } elseif ($unit == "mile" || $unit == "mi") { |
| 170 | 170 | return round($dist); |
| 171 | 171 | } elseif ($unit == "nm") { |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | * @param float $distance distance covered |
| 182 | 182 | * @return whether distance is realistic |
| 183 | 183 | */ |
| 184 | - public function withinThreshold ($timeDifference, $distance) { |
|
| 184 | + public function withinThreshold($timeDifference, $distance) { |
|
| 185 | 185 | $x = abs($timeDifference); |
| 186 | 186 | $d = abs($distance); |
| 187 | 187 | if ($x == 0 || $d == 0) return true; |
@@ -197,12 +197,12 @@ discard block |
||
| 197 | 197 | return ($array !== array_values($array)); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - public function isInteger($input){ |
|
| 200 | + public function isInteger($input) { |
|
| 201 | 201 | return(ctype_digit(strval($input))); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
| 205 | - public function convertDec($dms,$latlong) { |
|
| 205 | + public function convertDec($dms, $latlong) { |
|
| 206 | 206 | if ($latlong == 'latitude') { |
| 207 | 207 | $deg = substr($dms, 0, 2); |
| 208 | 208 | $min = substr($dms, 2, 4); |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | $deg = substr($dms, 0, 3); |
| 211 | 211 | $min = substr($dms, 3, 5); |
| 212 | 212 | } |
| 213 | - return $deg+(($min*60)/3600); |
|
| 213 | + return $deg + (($min*60)/3600); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
@@ -222,8 +222,8 @@ discard block |
||
| 222 | 222 | public function xcopy($source, $dest) |
| 223 | 223 | { |
| 224 | 224 | $files = glob($source.'*.*'); |
| 225 | - foreach($files as $file){ |
|
| 226 | - $file_to_go = str_replace($source,$dest,$file); |
|
| 225 | + foreach ($files as $file) { |
|
| 226 | + $file_to_go = str_replace($source, $dest, $file); |
|
| 227 | 227 | copy($file, $file_to_go); |
| 228 | 228 | } |
| 229 | 229 | return true; |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | * @param String $url url to check |
| 235 | 235 | * @return bool Return true on succes false on failure |
| 236 | 236 | */ |
| 237 | - public function urlexist($url){ |
|
| 238 | - $headers=get_headers($url); |
|
| 239 | - return stripos($headers[0],"200 OK")?true:false; |
|
| 237 | + public function urlexist($url) { |
|
| 238 | + $headers = get_headers($url); |
|
| 239 | + return stripos($headers[0], "200 OK") ? true : false; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | /** |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | public function hex2str($hex) { |
| 248 | 248 | $str = ''; |
| 249 | 249 | $hexln = strlen($hex); |
| 250 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
| 250 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
| 251 | 251 | return $str; |
| 252 | 252 | } |
| 253 | 253 | |
@@ -256,33 +256,33 @@ discard block |
||
| 256 | 256 | //difference in longitudinal coordinates |
| 257 | 257 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
| 258 | 258 | //difference in the phi of latitudinal coordinates |
| 259 | - $dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4)); |
|
| 259 | + $dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4)); |
|
| 260 | 260 | //we need to recalculate $dLon if it is greater than pi |
| 261 | - if(abs($dLon) > pi()) { |
|
| 262 | - if($dLon > 0) { |
|
| 263 | - $dLon = (2 * pi() - $dLon) * -1; |
|
| 261 | + if (abs($dLon) > pi()) { |
|
| 262 | + if ($dLon > 0) { |
|
| 263 | + $dLon = (2*pi() - $dLon)*-1; |
|
| 264 | 264 | } else { |
| 265 | - $dLon = 2 * pi() + $dLon; |
|
| 265 | + $dLon = 2*pi() + $dLon; |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | //return the angle, normalized |
| 269 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
| 269 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.1) { |
|
| 272 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.1) { |
|
| 273 | 273 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
| 274 | - $a = -($lon2-$lon1); |
|
| 274 | + $a = -($lon2 - $lon1); |
|
| 275 | 275 | $b = $lat2 - $lat1; |
| 276 | - $c = -($a*$lat1+$b*$lon1); |
|
| 277 | - $d = $a*$lat3+$b*$lon3+$c; |
|
| 276 | + $c = -($a*$lat1 + $b*$lon1); |
|
| 277 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
| 278 | 278 | if ($d > -$approx && $d < $approx) return true; |
| 279 | 279 | else return false; |
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | public function array_merge_noappend() { |
| 283 | 283 | $output = array(); |
| 284 | - foreach(func_get_args() as $array) { |
|
| 285 | - foreach($array as $key => $value) { |
|
| 284 | + foreach (func_get_args() as $array) { |
|
| 285 | + foreach ($array as $key => $value) { |
|
| 286 | 286 | $output[$key] = isset($output[$key]) ? |
| 287 | 287 | array_merge($output[$key], $value) : $value; |
| 288 | 288 | } |
@@ -323,34 +323,34 @@ discard block |
||
| 323 | 323 | return $result; |
| 324 | 324 | } |
| 325 | 325 | |
| 326 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){ |
|
| 326 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) { |
|
| 327 | 327 | global $globalMapRefresh; |
| 328 | 328 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
| 329 | 329 | $r = 6378; |
| 330 | 330 | $latitude = deg2rad($latitude); |
| 331 | 331 | $longitude = deg2rad($longitude); |
| 332 | 332 | $bearing = deg2rad($heading); |
| 333 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
| 334 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
| 335 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
| 333 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
| 334 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
| 335 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
| 338 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
| 339 | 339 | // distance in meter |
| 340 | 340 | $R = 6378.14; |
| 341 | - $latitude1 = $latitude * (M_PI/180); |
|
| 342 | - $longitude1 = $longitude * (M_PI/180); |
|
| 343 | - $brng = $bearing * (M_PI/180); |
|
| 341 | + $latitude1 = $latitude*(M_PI/180); |
|
| 342 | + $longitude1 = $longitude*(M_PI/180); |
|
| 343 | + $brng = $bearing*(M_PI/180); |
|
| 344 | 344 | $d = $distance; |
| 345 | 345 | |
| 346 | 346 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
| 347 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
| 347 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
| 348 | 348 | |
| 349 | - $latitude2 = $latitude2 * (180/M_PI); |
|
| 350 | - $longitude2 = $longitude2 * (180/M_PI); |
|
| 349 | + $latitude2 = $latitude2*(180/M_PI); |
|
| 350 | + $longitude2 = $longitude2*(180/M_PI); |
|
| 351 | 351 | |
| 352 | - $flat = round ($latitude2,6); |
|
| 353 | - $flong = round ($longitude2,6); |
|
| 352 | + $flat = round($latitude2, 6); |
|
| 353 | + $flong = round($longitude2, 6); |
|
| 354 | 354 | /* |
| 355 | 355 | $dx = $distance*cos($bearing); |
| 356 | 356 | $dy = $distance*sin($bearing); |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | $flong = $longitude + $dlong; |
| 360 | 360 | $flat = $latitude + $dlat; |
| 361 | 361 | */ |
| 362 | - return array('latitude' => $flat,'longitude' => $flong); |
|
| 362 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
| 363 | 363 | } |
| 364 | 364 | |
| 365 | 365 | /** |
@@ -373,14 +373,14 @@ discard block |
||
| 373 | 373 | * @param integer $level GZIP compression level (default: 9) |
| 374 | 374 | * @return string New filename (with .gz appended) if success, or false if operation fails |
| 375 | 375 | */ |
| 376 | - public function gzCompressFile($source, $level = 9){ |
|
| 377 | - $dest = $source . '.gz'; |
|
| 378 | - $mode = 'wb' . $level; |
|
| 376 | + public function gzCompressFile($source, $level = 9) { |
|
| 377 | + $dest = $source.'.gz'; |
|
| 378 | + $mode = 'wb'.$level; |
|
| 379 | 379 | $error = false; |
| 380 | 380 | if ($fp_out = gzopen($dest, $mode)) { |
| 381 | - if ($fp_in = fopen($source,'rb')) { |
|
| 381 | + if ($fp_in = fopen($source, 'rb')) { |
|
| 382 | 382 | while (!feof($fp_in)) |
| 383 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
| 383 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
| 384 | 384 | fclose($fp_in); |
| 385 | 385 | } else { |
| 386 | 386 | $error = true; |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | public function remove_accents($string) { |
| 399 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
| 399 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
| 400 | 400 | $chars = array( |
| 401 | 401 | // Decompositions for Latin-1 Supplement |
| 402 | 402 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
| 454 | 454 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
| 455 | 455 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
| 456 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
| 456 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
| 457 | 457 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
| 458 | 458 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
| 459 | 459 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -469,13 +469,13 @@ discard block |
||
| 469 | 469 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
| 470 | 470 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
| 471 | 471 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
| 472 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
| 473 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
| 474 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
| 475 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
| 476 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
| 477 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
| 478 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
| 472 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
| 473 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
| 474 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
| 475 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
| 476 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
| 477 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
| 478 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
| 479 | 479 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
| 480 | 480 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
| 481 | 481 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
@@ -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"); |
@@ -74,8 +77,9 @@ discard block |
||
| 74 | 77 | private function curlResponseHeaderCallback($ch, $headerLine) { |
| 75 | 78 | //global $cookies; |
| 76 | 79 | $cookies = array(); |
| 77 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
| 78 | - $cookies[] = $cookie; |
|
| 80 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
| 81 | + $cookies[] = $cookie; |
|
| 82 | + } |
|
| 79 | 83 | return strlen($headerLine); // Needed by curl |
| 80 | 84 | } |
| 81 | 85 | |
@@ -86,11 +90,15 @@ discard block |
||
| 86 | 90 | curl_setopt($ch, CURLOPT_URL, $url); |
| 87 | 91 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 88 | 92 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 89 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 93 | + if ($referer != '') { |
|
| 94 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 95 | + } |
|
| 90 | 96 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
| 91 | 97 | curl_setopt($ch, CURLOPT_FILE, $fp); |
| 92 | 98 | curl_exec($ch); |
| 93 | - if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch); |
|
| 99 | + if (curl_errno($ch) && $globalDebug) { |
|
| 100 | + echo 'Download error: '.curl_error($ch); |
|
| 101 | + } |
|
| 94 | 102 | curl_close($ch); |
| 95 | 103 | fclose($fp); |
| 96 | 104 | } |
@@ -101,10 +109,16 @@ discard block |
||
| 101 | 109 | * @return Array array of the tables in HTML page |
| 102 | 110 | */ |
| 103 | 111 | public function table2array($data) { |
| 104 | - if (!is_string($data)) return array(); |
|
| 105 | - if ($data == '') return array(); |
|
| 112 | + if (!is_string($data)) { |
|
| 113 | + return array(); |
|
| 114 | + } |
|
| 115 | + if ($data == '') { |
|
| 116 | + return array(); |
|
| 117 | + } |
|
| 106 | 118 | $html = str_get_html($data); |
| 107 | - if ($html === false) return array(); |
|
| 119 | + if ($html === false) { |
|
| 120 | + return array(); |
|
| 121 | + } |
|
| 108 | 122 | $tabledata=array(); |
| 109 | 123 | foreach($html->find('tr') as $element) |
| 110 | 124 | { |
@@ -139,7 +153,9 @@ discard block |
||
| 139 | 153 | */ |
| 140 | 154 | public function text2array($data) { |
| 141 | 155 | $html = str_get_html($data); |
| 142 | - if ($html === false) return array(); |
|
| 156 | + if ($html === false) { |
|
| 157 | + return array(); |
|
| 158 | + } |
|
| 143 | 159 | $tabledata=array(); |
| 144 | 160 | foreach($html->find('p') as $element) |
| 145 | 161 | { |
@@ -160,7 +176,9 @@ discard block |
||
| 160 | 176 | * @return Float Distance in $unit |
| 161 | 177 | */ |
| 162 | 178 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
| 163 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
| 179 | + if ($lat == $latc && $lon == $lonc) { |
|
| 180 | + return 0; |
|
| 181 | + } |
|
| 164 | 182 | $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; |
| 165 | 183 | if ($unit == "km") { |
| 166 | 184 | return round($dist * 1.609344); |
@@ -184,10 +202,16 @@ discard block |
||
| 184 | 202 | public function withinThreshold ($timeDifference, $distance) { |
| 185 | 203 | $x = abs($timeDifference); |
| 186 | 204 | $d = abs($distance); |
| 187 | - if ($x == 0 || $d == 0) return true; |
|
| 205 | + if ($x == 0 || $d == 0) { |
|
| 206 | + return true; |
|
| 207 | + } |
|
| 188 | 208 | // may be due to Internet jitter; distance is realistic |
| 189 | - if ($x < 0.7 && $d < 2000) return true; |
|
| 190 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
| 209 | + if ($x < 0.7 && $d < 2000) { |
|
| 210 | + return true; |
|
| 211 | + } else { |
|
| 212 | + return $d/$x < 1500*0.27778; |
|
| 213 | + } |
|
| 214 | + // 1500 km/h max |
|
| 191 | 215 | } |
| 192 | 216 | |
| 193 | 217 | |
@@ -247,7 +271,9 @@ discard block |
||
| 247 | 271 | public function hex2str($hex) { |
| 248 | 272 | $str = ''; |
| 249 | 273 | $hexln = strlen($hex); |
| 250 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
| 274 | + for($i=0;$i<$hexln;$i+=2) { |
|
| 275 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
| 276 | + } |
|
| 251 | 277 | return $str; |
| 252 | 278 | } |
| 253 | 279 | |
@@ -275,8 +301,11 @@ discard block |
||
| 275 | 301 | $b = $lat2 - $lat1; |
| 276 | 302 | $c = -($a*$lat1+$b*$lon1); |
| 277 | 303 | $d = $a*$lat3+$b*$lon3+$c; |
| 278 | - if ($d > -$approx && $d < $approx) return true; |
|
| 279 | - else return false; |
|
| 304 | + if ($d > -$approx && $d < $approx) { |
|
| 305 | + return true; |
|
| 306 | + } else { |
|
| 307 | + return false; |
|
| 308 | + } |
|
| 280 | 309 | } |
| 281 | 310 | |
| 282 | 311 | public function array_merge_noappend() { |
@@ -312,7 +341,9 @@ discard block |
||
| 312 | 341 | return $result; |
| 313 | 342 | } |
| 314 | 343 | $handle = @opendir('./locale'); |
| 315 | - if ($handle === false) return $result; |
|
| 344 | + if ($handle === false) { |
|
| 345 | + return $result; |
|
| 346 | + } |
|
| 316 | 347 | while (false !== ($file = readdir($handle))) { |
| 317 | 348 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
| 318 | 349 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -379,8 +410,9 @@ discard block |
||
| 379 | 410 | $error = false; |
| 380 | 411 | if ($fp_out = gzopen($dest, $mode)) { |
| 381 | 412 | if ($fp_in = fopen($source,'rb')) { |
| 382 | - while (!feof($fp_in)) |
|
| 383 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
| 413 | + while (!feof($fp_in)) { |
|
| 414 | + gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
| 415 | + } |
|
| 384 | 416 | fclose($fp_in); |
| 385 | 417 | } else { |
| 386 | 418 | $error = true; |
@@ -389,14 +421,17 @@ discard block |
||
| 389 | 421 | } else { |
| 390 | 422 | $error = true; |
| 391 | 423 | } |
| 392 | - if ($error) |
|
| 393 | - return false; |
|
| 394 | - else |
|
| 395 | - return $dest; |
|
| 424 | + if ($error) { |
|
| 425 | + return false; |
|
| 426 | + } else { |
|
| 427 | + return $dest; |
|
| 428 | + } |
|
| 396 | 429 | } |
| 397 | 430 | |
| 398 | 431 | public function remove_accents($string) { |
| 399 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
| 432 | + if ( !preg_match('/[\x80-\xff]/', $string) ) { |
|
| 433 | + return $string; |
|
| 434 | + } |
|
| 400 | 435 | $chars = array( |
| 401 | 436 | // Decompositions for Latin-1 Supplement |
| 402 | 437 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * Get SQL query part for filter used |
| 17 | 17 | * @param Array $filter the filter |
| 18 | - * @return Array the SQL part |
|
| 18 | + * @return string the SQL part |
|
| 19 | 19 | */ |
| 20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
@@ -8717,6 +8717,7 @@ discard block |
||
| 8717 | 8717 | /** |
| 8718 | 8718 | * Counts all hours |
| 8719 | 8719 | * |
| 8720 | + * @param string $orderby |
|
| 8720 | 8721 | * @return Array the hour list |
| 8721 | 8722 | * |
| 8722 | 8723 | */ |
@@ -8782,6 +8783,7 @@ discard block |
||
| 8782 | 8783 | /** |
| 8783 | 8784 | * Counts all hours |
| 8784 | 8785 | * |
| 8786 | + * @param string $orderby |
|
| 8785 | 8787 | * @return Array the hour list |
| 8786 | 8788 | * |
| 8787 | 8789 | */ |
@@ -9594,7 +9596,7 @@ discard block |
||
| 9594 | 9596 | /** |
| 9595 | 9597 | * Parses the direction degrees to working |
| 9596 | 9598 | * |
| 9597 | - * @param Float $direction the direction in degrees |
|
| 9599 | + * @param integer $direction the direction in degrees |
|
| 9598 | 9600 | * @return Array the direction information |
| 9599 | 9601 | * |
| 9600 | 9602 | */ |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * Get SQL query part for filter used |
|
| 59 | - * @param Array $filter the filter |
|
| 60 | - * @return Array the SQL part |
|
| 61 | - */ |
|
| 58 | + * Get SQL query part for filter used |
|
| 59 | + * @param Array $filter the filter |
|
| 60 | + * @return Array the SQL part |
|
| 61 | + */ |
|
| 62 | 62 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 63 | 63 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 64 | 64 | $filters = array(); |
@@ -129,14 +129,14 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | /** |
| 132 | - * Executes the SQL statements to get the spotter information |
|
| 133 | - * |
|
| 134 | - * @param String $query the SQL query |
|
| 135 | - * @param Array $params parameter of the query |
|
| 136 | - * @param String $limitQuery the limit query |
|
| 137 | - * @return Array the spotter information |
|
| 138 | - * |
|
| 139 | - */ |
|
| 132 | + * Executes the SQL statements to get the spotter information |
|
| 133 | + * |
|
| 134 | + * @param String $query the SQL query |
|
| 135 | + * @param Array $params parameter of the query |
|
| 136 | + * @param String $limitQuery the limit query |
|
| 137 | + * @return Array the spotter information |
|
| 138 | + * |
|
| 139 | + */ |
|
| 140 | 140 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 141 | 141 | { |
| 142 | 142 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
@@ -303,11 +303,11 @@ discard block |
||
| 303 | 303 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 304 | 304 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 305 | 305 | } else $temp_array['aircraft_shadow'] = 'default.png'; |
| 306 | - } else { |
|
| 307 | - $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 306 | + } else { |
|
| 307 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 308 | 308 | $temp_array['aircraft_name'] = 'N/A'; |
| 309 | 309 | $temp_array['aircraft_manufacturer'] = 'N/A'; |
| 310 | - } |
|
| 310 | + } |
|
| 311 | 311 | } |
| 312 | 312 | $fromsource = NULL; |
| 313 | 313 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
@@ -503,11 +503,11 @@ discard block |
||
| 503 | 503 | |
| 504 | 504 | |
| 505 | 505 | /** |
| 506 | - * Gets all the spotter information |
|
| 507 | - * |
|
| 508 | - * @return Array the spotter information |
|
| 509 | - * |
|
| 510 | - */ |
|
| 506 | + * Gets all the spotter information |
|
| 507 | + * |
|
| 508 | + * @return Array the spotter information |
|
| 509 | + * |
|
| 510 | + */ |
|
| 511 | 511 | public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
| 512 | 512 | { |
| 513 | 513 | global $globalTimezone, $globalDBdriver; |
@@ -854,11 +854,11 @@ discard block |
||
| 854 | 854 | |
| 855 | 855 | |
| 856 | 856 | /** |
| 857 | - * Gets all the spotter information based on the latest data entry |
|
| 858 | - * |
|
| 859 | - * @return Array the spotter information |
|
| 860 | - * |
|
| 861 | - */ |
|
| 857 | + * Gets all the spotter information based on the latest data entry |
|
| 858 | + * |
|
| 859 | + * @return Array the spotter information |
|
| 860 | + * |
|
| 861 | + */ |
|
| 862 | 862 | public function getLatestSpotterData($limit = '', $sort = '', $filter = array()) |
| 863 | 863 | { |
| 864 | 864 | global $global_query; |
@@ -897,12 +897,12 @@ discard block |
||
| 897 | 897 | } |
| 898 | 898 | |
| 899 | 899 | |
| 900 | - /** |
|
| 901 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 902 | - * |
|
| 903 | - * @return Array the spotter information |
|
| 904 | - * |
|
| 905 | - */ |
|
| 900 | + /** |
|
| 901 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 902 | + * |
|
| 903 | + * @return Array the spotter information |
|
| 904 | + * |
|
| 905 | + */ |
|
| 906 | 906 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 907 | 907 | { |
| 908 | 908 | date_default_timezone_set('UTC'); |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | return false; |
| 931 | 931 | } |
| 932 | 932 | } |
| 933 | - $additional_query = ''; |
|
| 933 | + $additional_query = ''; |
|
| 934 | 934 | if ($interval != "") |
| 935 | 935 | { |
| 936 | 936 | if (!is_string($interval)) |
@@ -970,12 +970,12 @@ discard block |
||
| 970 | 970 | } |
| 971 | 971 | |
| 972 | 972 | |
| 973 | - /** |
|
| 974 | - * Gets all the spotter information sorted by the newest aircraft type |
|
| 975 | - * |
|
| 976 | - * @return Array the spotter information |
|
| 977 | - * |
|
| 978 | - */ |
|
| 973 | + /** |
|
| 974 | + * Gets all the spotter information sorted by the newest aircraft type |
|
| 975 | + * |
|
| 976 | + * @return Array the spotter information |
|
| 977 | + * |
|
| 978 | + */ |
|
| 979 | 979 | public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
| 980 | 980 | { |
| 981 | 981 | global $global_query; |
@@ -1016,11 +1016,11 @@ discard block |
||
| 1016 | 1016 | |
| 1017 | 1017 | |
| 1018 | 1018 | /** |
| 1019 | - * Gets all the spotter information sorted by the newest aircraft registration |
|
| 1020 | - * |
|
| 1021 | - * @return Array the spotter information |
|
| 1022 | - * |
|
| 1023 | - */ |
|
| 1019 | + * Gets all the spotter information sorted by the newest aircraft registration |
|
| 1020 | + * |
|
| 1021 | + * @return Array the spotter information |
|
| 1022 | + * |
|
| 1023 | + */ |
|
| 1024 | 1024 | public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array()) |
| 1025 | 1025 | { |
| 1026 | 1026 | global $global_query; |
@@ -1060,11 +1060,11 @@ discard block |
||
| 1060 | 1060 | |
| 1061 | 1061 | |
| 1062 | 1062 | /** |
| 1063 | - * Gets all the spotter information sorted by the newest airline |
|
| 1064 | - * |
|
| 1065 | - * @return Array the spotter information |
|
| 1066 | - * |
|
| 1067 | - */ |
|
| 1063 | + * Gets all the spotter information sorted by the newest airline |
|
| 1064 | + * |
|
| 1065 | + * @return Array the spotter information |
|
| 1066 | + * |
|
| 1067 | + */ |
|
| 1068 | 1068 | public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
| 1069 | 1069 | { |
| 1070 | 1070 | global $global_query; |
@@ -1103,12 +1103,12 @@ discard block |
||
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | 1105 | |
| 1106 | - /** |
|
| 1107 | - * Gets all the spotter information sorted by the newest departure airport |
|
| 1108 | - * |
|
| 1109 | - * @return Array the spotter information |
|
| 1110 | - * |
|
| 1111 | - */ |
|
| 1106 | + /** |
|
| 1107 | + * Gets all the spotter information sorted by the newest departure airport |
|
| 1108 | + * |
|
| 1109 | + * @return Array the spotter information |
|
| 1110 | + * |
|
| 1111 | + */ |
|
| 1112 | 1112 | public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array()) |
| 1113 | 1113 | { |
| 1114 | 1114 | global $global_query; |
@@ -1150,11 +1150,11 @@ discard block |
||
| 1150 | 1150 | |
| 1151 | 1151 | |
| 1152 | 1152 | /** |
| 1153 | - * Gets all the spotter information sorted by the newest arrival airport |
|
| 1154 | - * |
|
| 1155 | - * @return Array the spotter information |
|
| 1156 | - * |
|
| 1157 | - */ |
|
| 1153 | + * Gets all the spotter information sorted by the newest arrival airport |
|
| 1154 | + * |
|
| 1155 | + * @return Array the spotter information |
|
| 1156 | + * |
|
| 1157 | + */ |
|
| 1158 | 1158 | public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array()) |
| 1159 | 1159 | { |
| 1160 | 1160 | global $global_query; |
@@ -1193,11 +1193,11 @@ discard block |
||
| 1193 | 1193 | |
| 1194 | 1194 | |
| 1195 | 1195 | /** |
| 1196 | - * Gets all the spotter information based on the spotter id |
|
| 1197 | - * |
|
| 1198 | - * @return Array the spotter information |
|
| 1199 | - * |
|
| 1200 | - */ |
|
| 1196 | + * Gets all the spotter information based on the spotter id |
|
| 1197 | + * |
|
| 1198 | + * @return Array the spotter information |
|
| 1199 | + * |
|
| 1200 | + */ |
|
| 1201 | 1201 | public function getSpotterDataByID($id = '') |
| 1202 | 1202 | { |
| 1203 | 1203 | global $global_query; |
@@ -1219,11 +1219,11 @@ discard block |
||
| 1219 | 1219 | |
| 1220 | 1220 | |
| 1221 | 1221 | /** |
| 1222 | - * Gets all the spotter information based on the callsign |
|
| 1223 | - * |
|
| 1224 | - * @return Array the spotter information |
|
| 1225 | - * |
|
| 1226 | - */ |
|
| 1222 | + * Gets all the spotter information based on the callsign |
|
| 1223 | + * |
|
| 1224 | + * @return Array the spotter information |
|
| 1225 | + * |
|
| 1226 | + */ |
|
| 1227 | 1227 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
| 1228 | 1228 | { |
| 1229 | 1229 | global $global_query; |
@@ -1274,11 +1274,11 @@ discard block |
||
| 1274 | 1274 | } |
| 1275 | 1275 | |
| 1276 | 1276 | /** |
| 1277 | - * Gets all the spotter information based on the owner |
|
| 1278 | - * |
|
| 1279 | - * @return Array the spotter information |
|
| 1280 | - * |
|
| 1281 | - */ |
|
| 1277 | + * Gets all the spotter information based on the owner |
|
| 1278 | + * |
|
| 1279 | + * @return Array the spotter information |
|
| 1280 | + * |
|
| 1281 | + */ |
|
| 1282 | 1282 | public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '') |
| 1283 | 1283 | { |
| 1284 | 1284 | global $global_query; |
@@ -1329,11 +1329,11 @@ discard block |
||
| 1329 | 1329 | } |
| 1330 | 1330 | |
| 1331 | 1331 | /** |
| 1332 | - * Gets all the spotter information based on the pilot |
|
| 1333 | - * |
|
| 1334 | - * @return Array the spotter information |
|
| 1335 | - * |
|
| 1336 | - */ |
|
| 1332 | + * Gets all the spotter information based on the pilot |
|
| 1333 | + * |
|
| 1334 | + * @return Array the spotter information |
|
| 1335 | + * |
|
| 1336 | + */ |
|
| 1337 | 1337 | public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '') |
| 1338 | 1338 | { |
| 1339 | 1339 | global $global_query; |
@@ -1381,11 +1381,11 @@ discard block |
||
| 1381 | 1381 | |
| 1382 | 1382 | |
| 1383 | 1383 | /** |
| 1384 | - * Gets all the spotter information based on the aircraft type |
|
| 1385 | - * |
|
| 1386 | - * @return Array the spotter information |
|
| 1387 | - * |
|
| 1388 | - */ |
|
| 1384 | + * Gets all the spotter information based on the aircraft type |
|
| 1385 | + * |
|
| 1386 | + * @return Array the spotter information |
|
| 1387 | + * |
|
| 1388 | + */ |
|
| 1389 | 1389 | public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array()) |
| 1390 | 1390 | { |
| 1391 | 1391 | global $global_query; |
@@ -1439,11 +1439,11 @@ discard block |
||
| 1439 | 1439 | |
| 1440 | 1440 | |
| 1441 | 1441 | /** |
| 1442 | - * Gets all the spotter information based on the aircraft registration |
|
| 1443 | - * |
|
| 1444 | - * @return Array the spotter information |
|
| 1445 | - * |
|
| 1446 | - */ |
|
| 1442 | + * Gets all the spotter information based on the aircraft registration |
|
| 1443 | + * |
|
| 1444 | + * @return Array the spotter information |
|
| 1445 | + * |
|
| 1446 | + */ |
|
| 1447 | 1447 | public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array()) |
| 1448 | 1448 | { |
| 1449 | 1449 | global $global_query; |
@@ -1500,11 +1500,11 @@ discard block |
||
| 1500 | 1500 | |
| 1501 | 1501 | |
| 1502 | 1502 | /** |
| 1503 | - * Gets all the spotter information based on the airline |
|
| 1504 | - * |
|
| 1505 | - * @return Array the spotter information |
|
| 1506 | - * |
|
| 1507 | - */ |
|
| 1503 | + * Gets all the spotter information based on the airline |
|
| 1504 | + * |
|
| 1505 | + * @return Array the spotter information |
|
| 1506 | + * |
|
| 1507 | + */ |
|
| 1508 | 1508 | public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
| 1509 | 1509 | { |
| 1510 | 1510 | global $global_query; |
@@ -1557,11 +1557,11 @@ discard block |
||
| 1557 | 1557 | |
| 1558 | 1558 | |
| 1559 | 1559 | /** |
| 1560 | - * Gets all the spotter information based on the airport |
|
| 1561 | - * |
|
| 1562 | - * @return Array the spotter information |
|
| 1563 | - * |
|
| 1564 | - */ |
|
| 1560 | + * Gets all the spotter information based on the airport |
|
| 1561 | + * |
|
| 1562 | + * @return Array the spotter information |
|
| 1563 | + * |
|
| 1564 | + */ |
|
| 1565 | 1565 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
| 1566 | 1566 | { |
| 1567 | 1567 | global $global_query; |
@@ -1615,11 +1615,11 @@ discard block |
||
| 1615 | 1615 | |
| 1616 | 1616 | |
| 1617 | 1617 | /** |
| 1618 | - * Gets all the spotter information based on the date |
|
| 1619 | - * |
|
| 1620 | - * @return Array the spotter information |
|
| 1621 | - * |
|
| 1622 | - */ |
|
| 1618 | + * Gets all the spotter information based on the date |
|
| 1619 | + * |
|
| 1620 | + * @return Array the spotter information |
|
| 1621 | + * |
|
| 1622 | + */ |
|
| 1623 | 1623 | public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
| 1624 | 1624 | { |
| 1625 | 1625 | global $global_query, $globalTimezone, $globalDBdriver; |
@@ -1683,11 +1683,11 @@ discard block |
||
| 1683 | 1683 | |
| 1684 | 1684 | |
| 1685 | 1685 | /** |
| 1686 | - * Gets all the spotter information based on the country name |
|
| 1687 | - * |
|
| 1688 | - * @return Array the spotter information |
|
| 1689 | - * |
|
| 1690 | - */ |
|
| 1686 | + * Gets all the spotter information based on the country name |
|
| 1687 | + * |
|
| 1688 | + * @return Array the spotter information |
|
| 1689 | + * |
|
| 1690 | + */ |
|
| 1691 | 1691 | public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
| 1692 | 1692 | { |
| 1693 | 1693 | global $global_query; |
@@ -1741,11 +1741,11 @@ discard block |
||
| 1741 | 1741 | |
| 1742 | 1742 | |
| 1743 | 1743 | /** |
| 1744 | - * Gets all the spotter information based on the manufacturer name |
|
| 1745 | - * |
|
| 1746 | - * @return Array the spotter information |
|
| 1747 | - * |
|
| 1748 | - */ |
|
| 1744 | + * Gets all the spotter information based on the manufacturer name |
|
| 1745 | + * |
|
| 1746 | + * @return Array the spotter information |
|
| 1747 | + * |
|
| 1748 | + */ |
|
| 1749 | 1749 | public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array()) |
| 1750 | 1750 | { |
| 1751 | 1751 | global $global_query; |
@@ -1801,13 +1801,13 @@ discard block |
||
| 1801 | 1801 | |
| 1802 | 1802 | |
| 1803 | 1803 | /** |
| 1804 | - * Gets a list of all aircraft that take a route |
|
| 1805 | - * |
|
| 1806 | - * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1807 | - * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1808 | - * @return Array the spotter information |
|
| 1809 | - * |
|
| 1810 | - */ |
|
| 1804 | + * Gets a list of all aircraft that take a route |
|
| 1805 | + * |
|
| 1806 | + * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1807 | + * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1808 | + * @return Array the spotter information |
|
| 1809 | + * |
|
| 1810 | + */ |
|
| 1811 | 1811 | public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array()) |
| 1812 | 1812 | { |
| 1813 | 1813 | global $global_query; |
@@ -1876,11 +1876,11 @@ discard block |
||
| 1876 | 1876 | |
| 1877 | 1877 | |
| 1878 | 1878 | /** |
| 1879 | - * Gets all the spotter information based on the special column in the table |
|
| 1880 | - * |
|
| 1881 | - * @return Array the spotter information |
|
| 1882 | - * |
|
| 1883 | - */ |
|
| 1879 | + * Gets all the spotter information based on the special column in the table |
|
| 1880 | + * |
|
| 1881 | + * @return Array the spotter information |
|
| 1882 | + * |
|
| 1883 | + */ |
|
| 1884 | 1884 | public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array()) |
| 1885 | 1885 | { |
| 1886 | 1886 | global $global_query; |
@@ -1919,11 +1919,11 @@ discard block |
||
| 1919 | 1919 | } |
| 1920 | 1920 | |
| 1921 | 1921 | /** |
| 1922 | - * Gets all the highlight based on a aircraft registration |
|
| 1923 | - * |
|
| 1924 | - * @return String the highlight text |
|
| 1925 | - * |
|
| 1926 | - */ |
|
| 1922 | + * Gets all the highlight based on a aircraft registration |
|
| 1923 | + * |
|
| 1924 | + * @return String the highlight text |
|
| 1925 | + * |
|
| 1926 | + */ |
|
| 1927 | 1927 | public function getHighlightByRegistration($registration,$filter = array()) |
| 1928 | 1928 | { |
| 1929 | 1929 | global $global_query; |
@@ -1945,13 +1945,13 @@ discard block |
||
| 1945 | 1945 | |
| 1946 | 1946 | |
| 1947 | 1947 | /** |
| 1948 | - * Gets the squawk usage from squawk code |
|
| 1949 | - * |
|
| 1950 | - * @param String $squawk squawk code |
|
| 1951 | - * @param String $country country |
|
| 1952 | - * @return String usage |
|
| 1953 | - * |
|
| 1954 | - */ |
|
| 1948 | + * Gets the squawk usage from squawk code |
|
| 1949 | + * |
|
| 1950 | + * @param String $squawk squawk code |
|
| 1951 | + * @param String $country country |
|
| 1952 | + * @return String usage |
|
| 1953 | + * |
|
| 1954 | + */ |
|
| 1955 | 1955 | public function getSquawkUsage($squawk = '',$country = 'FR') |
| 1956 | 1956 | { |
| 1957 | 1957 | |
@@ -1972,12 +1972,12 @@ discard block |
||
| 1972 | 1972 | } |
| 1973 | 1973 | |
| 1974 | 1974 | /** |
| 1975 | - * Gets the airport icao from the iata |
|
| 1976 | - * |
|
| 1977 | - * @param String $airport_iata the iata code of the airport |
|
| 1978 | - * @return String airport iata |
|
| 1979 | - * |
|
| 1980 | - */ |
|
| 1975 | + * Gets the airport icao from the iata |
|
| 1976 | + * |
|
| 1977 | + * @param String $airport_iata the iata code of the airport |
|
| 1978 | + * @return String airport iata |
|
| 1979 | + * |
|
| 1980 | + */ |
|
| 1981 | 1981 | public function getAirportIcao($airport_iata = '') |
| 1982 | 1982 | { |
| 1983 | 1983 | |
@@ -1997,14 +1997,14 @@ discard block |
||
| 1997 | 1997 | } |
| 1998 | 1998 | |
| 1999 | 1999 | /** |
| 2000 | - * Gets the airport distance |
|
| 2001 | - * |
|
| 2002 | - * @param String $airport_icao the icao code of the airport |
|
| 2003 | - * @param Float $latitude the latitude |
|
| 2004 | - * @param Float $longitude the longitude |
|
| 2005 | - * @return Float distance to the airport |
|
| 2006 | - * |
|
| 2007 | - */ |
|
| 2000 | + * Gets the airport distance |
|
| 2001 | + * |
|
| 2002 | + * @param String $airport_icao the icao code of the airport |
|
| 2003 | + * @param Float $latitude the latitude |
|
| 2004 | + * @param Float $longitude the longitude |
|
| 2005 | + * @return Float distance to the airport |
|
| 2006 | + * |
|
| 2007 | + */ |
|
| 2008 | 2008 | public function getAirportDistance($airport_icao,$latitude,$longitude) |
| 2009 | 2009 | { |
| 2010 | 2010 | |
@@ -2025,12 +2025,12 @@ discard block |
||
| 2025 | 2025 | } |
| 2026 | 2026 | |
| 2027 | 2027 | /** |
| 2028 | - * Gets the airport info based on the icao |
|
| 2029 | - * |
|
| 2030 | - * @param String $airport the icao code of the airport |
|
| 2031 | - * @return Array airport information |
|
| 2032 | - * |
|
| 2033 | - */ |
|
| 2028 | + * Gets the airport info based on the icao |
|
| 2029 | + * |
|
| 2030 | + * @param String $airport the icao code of the airport |
|
| 2031 | + * @return Array airport information |
|
| 2032 | + * |
|
| 2033 | + */ |
|
| 2034 | 2034 | public function getAllAirportInfo($airport = '') |
| 2035 | 2035 | { |
| 2036 | 2036 | |
@@ -2076,12 +2076,12 @@ discard block |
||
| 2076 | 2076 | } |
| 2077 | 2077 | |
| 2078 | 2078 | /** |
| 2079 | - * Gets the airport info based on the country |
|
| 2080 | - * |
|
| 2081 | - * @param Array $countries Airports countries |
|
| 2082 | - * @return Array airport information |
|
| 2083 | - * |
|
| 2084 | - */ |
|
| 2079 | + * Gets the airport info based on the country |
|
| 2080 | + * |
|
| 2081 | + * @param Array $countries Airports countries |
|
| 2082 | + * @return Array airport information |
|
| 2083 | + * |
|
| 2084 | + */ |
|
| 2085 | 2085 | public function getAllAirportInfobyCountry($countries) |
| 2086 | 2086 | { |
| 2087 | 2087 | $lst_countries = ''; |
@@ -2119,12 +2119,12 @@ discard block |
||
| 2119 | 2119 | } |
| 2120 | 2120 | |
| 2121 | 2121 | /** |
| 2122 | - * Gets airports info based on the coord |
|
| 2123 | - * |
|
| 2124 | - * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 2125 | - * @return Array airport information |
|
| 2126 | - * |
|
| 2127 | - */ |
|
| 2122 | + * Gets airports info based on the coord |
|
| 2123 | + * |
|
| 2124 | + * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 2125 | + * @return Array airport information |
|
| 2126 | + * |
|
| 2127 | + */ |
|
| 2128 | 2128 | public function getAllAirportInfobyCoord($coord) |
| 2129 | 2129 | { |
| 2130 | 2130 | global $globalDBdriver; |
@@ -2155,12 +2155,12 @@ discard block |
||
| 2155 | 2155 | } |
| 2156 | 2156 | |
| 2157 | 2157 | /** |
| 2158 | - * Gets waypoints info based on the coord |
|
| 2159 | - * |
|
| 2160 | - * @param Array $coord waypoints coord |
|
| 2161 | - * @return Array airport information |
|
| 2162 | - * |
|
| 2163 | - */ |
|
| 2158 | + * Gets waypoints info based on the coord |
|
| 2159 | + * |
|
| 2160 | + * @param Array $coord waypoints coord |
|
| 2161 | + * @return Array airport information |
|
| 2162 | + * |
|
| 2163 | + */ |
|
| 2164 | 2164 | public function getAllWaypointsInfobyCoord($coord) |
| 2165 | 2165 | { |
| 2166 | 2166 | if (is_array($coord)) { |
@@ -2194,12 +2194,12 @@ discard block |
||
| 2194 | 2194 | |
| 2195 | 2195 | |
| 2196 | 2196 | /** |
| 2197 | - * Gets the airline info based on the icao code or iata code |
|
| 2198 | - * |
|
| 2199 | - * @param String $airline_icao the iata code of the airport |
|
| 2200 | - * @return Array airport information |
|
| 2201 | - * |
|
| 2202 | - */ |
|
| 2197 | + * Gets the airline info based on the icao code or iata code |
|
| 2198 | + * |
|
| 2199 | + * @param String $airline_icao the iata code of the airport |
|
| 2200 | + * @return Array airport information |
|
| 2201 | + * |
|
| 2202 | + */ |
|
| 2203 | 2203 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2204 | 2204 | { |
| 2205 | 2205 | global $globalUseRealAirlines; |
@@ -2230,7 +2230,7 @@ discard block |
||
| 2230 | 2230 | } else { |
| 2231 | 2231 | $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
| 2232 | 2232 | } |
| 2233 | - /* |
|
| 2233 | + /* |
|
| 2234 | 2234 | $airline_array = array(); |
| 2235 | 2235 | $temp_array = array(); |
| 2236 | 2236 | |
@@ -2263,12 +2263,12 @@ discard block |
||
| 2263 | 2263 | } |
| 2264 | 2264 | |
| 2265 | 2265 | /** |
| 2266 | - * Gets the airline info based on the airline name |
|
| 2267 | - * |
|
| 2268 | - * @param String $airline_name the name of the airline |
|
| 2269 | - * @return Array airline information |
|
| 2270 | - * |
|
| 2271 | - */ |
|
| 2266 | + * Gets the airline info based on the airline name |
|
| 2267 | + * |
|
| 2268 | + * @param String $airline_name the name of the airline |
|
| 2269 | + * @return Array airline information |
|
| 2270 | + * |
|
| 2271 | + */ |
|
| 2272 | 2272 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2273 | 2273 | { |
| 2274 | 2274 | global $globalUseRealAirlines; |
@@ -2296,12 +2296,12 @@ discard block |
||
| 2296 | 2296 | |
| 2297 | 2297 | |
| 2298 | 2298 | /** |
| 2299 | - * Gets the aircraft info based on the aircraft type |
|
| 2300 | - * |
|
| 2301 | - * @param String $aircraft_type the aircraft type |
|
| 2302 | - * @return Array aircraft information |
|
| 2303 | - * |
|
| 2304 | - */ |
|
| 2299 | + * Gets the aircraft info based on the aircraft type |
|
| 2300 | + * |
|
| 2301 | + * @param String $aircraft_type the aircraft type |
|
| 2302 | + * @return Array aircraft information |
|
| 2303 | + * |
|
| 2304 | + */ |
|
| 2305 | 2305 | public function getAllAircraftInfo($aircraft_type) |
| 2306 | 2306 | { |
| 2307 | 2307 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2333,12 +2333,12 @@ discard block |
||
| 2333 | 2333 | } |
| 2334 | 2334 | |
| 2335 | 2335 | /** |
| 2336 | - * Gets the aircraft icao based on the aircraft name/type |
|
| 2337 | - * |
|
| 2338 | - * @param String $aircraft_type the aircraft type |
|
| 2339 | - * @return String aircraft information |
|
| 2340 | - * |
|
| 2341 | - */ |
|
| 2336 | + * Gets the aircraft icao based on the aircraft name/type |
|
| 2337 | + * |
|
| 2338 | + * @param String $aircraft_type the aircraft type |
|
| 2339 | + * @return String aircraft information |
|
| 2340 | + * |
|
| 2341 | + */ |
|
| 2342 | 2342 | public function getAircraftIcao($aircraft_type) |
| 2343 | 2343 | { |
| 2344 | 2344 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2363,12 +2363,12 @@ discard block |
||
| 2363 | 2363 | } |
| 2364 | 2364 | |
| 2365 | 2365 | /** |
| 2366 | - * Gets the aircraft info based on the aircraft modes |
|
| 2367 | - * |
|
| 2368 | - * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2369 | - * @return String aircraft type |
|
| 2370 | - * |
|
| 2371 | - */ |
|
| 2366 | + * Gets the aircraft info based on the aircraft modes |
|
| 2367 | + * |
|
| 2368 | + * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2369 | + * @return String aircraft type |
|
| 2370 | + * |
|
| 2371 | + */ |
|
| 2372 | 2372 | public function getAllAircraftType($aircraft_modes) |
| 2373 | 2373 | { |
| 2374 | 2374 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -2388,12 +2388,12 @@ discard block |
||
| 2388 | 2388 | } |
| 2389 | 2389 | |
| 2390 | 2390 | /** |
| 2391 | - * Gets the aircraft info based on the aircraft registration |
|
| 2392 | - * |
|
| 2393 | - * @param String $registration the aircraft registration |
|
| 2394 | - * @return String aircraft type |
|
| 2395 | - * |
|
| 2396 | - */ |
|
| 2391 | + * Gets the aircraft info based on the aircraft registration |
|
| 2392 | + * |
|
| 2393 | + * @param String $registration the aircraft registration |
|
| 2394 | + * @return String aircraft type |
|
| 2395 | + * |
|
| 2396 | + */ |
|
| 2397 | 2397 | public function getAllAircraftTypeByRegistration($registration) |
| 2398 | 2398 | { |
| 2399 | 2399 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2411,12 +2411,12 @@ discard block |
||
| 2411 | 2411 | } |
| 2412 | 2412 | |
| 2413 | 2413 | /** |
| 2414 | - * Gets the spotter_id and flightaware_id based on the aircraft registration |
|
| 2415 | - * |
|
| 2416 | - * @param String $registration the aircraft registration |
|
| 2417 | - * @return Array spotter_id and flightaware_id |
|
| 2418 | - * |
|
| 2419 | - */ |
|
| 2414 | + * Gets the spotter_id and flightaware_id based on the aircraft registration |
|
| 2415 | + * |
|
| 2416 | + * @param String $registration the aircraft registration |
|
| 2417 | + * @return Array spotter_id and flightaware_id |
|
| 2418 | + * |
|
| 2419 | + */ |
|
| 2420 | 2420 | public function getAllIDByRegistration($registration) |
| 2421 | 2421 | { |
| 2422 | 2422 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2435,12 +2435,12 @@ discard block |
||
| 2435 | 2435 | } |
| 2436 | 2436 | |
| 2437 | 2437 | /** |
| 2438 | - * Gets correct aircraft operator code |
|
| 2439 | - * |
|
| 2440 | - * @param String $operator the aircraft operator code (callsign) |
|
| 2441 | - * @return String aircraft operator code |
|
| 2442 | - * |
|
| 2443 | - */ |
|
| 2438 | + * Gets correct aircraft operator code |
|
| 2439 | + * |
|
| 2440 | + * @param String $operator the aircraft operator code (callsign) |
|
| 2441 | + * @return String aircraft operator code |
|
| 2442 | + * |
|
| 2443 | + */ |
|
| 2444 | 2444 | public function getOperator($operator) |
| 2445 | 2445 | { |
| 2446 | 2446 | $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
@@ -2457,16 +2457,16 @@ discard block |
||
| 2457 | 2457 | } |
| 2458 | 2458 | |
| 2459 | 2459 | /** |
| 2460 | - * Gets the aircraft route based on the aircraft callsign |
|
| 2461 | - * |
|
| 2462 | - * @param String $callsign the aircraft callsign |
|
| 2463 | - * @return Array aircraft type |
|
| 2464 | - * |
|
| 2465 | - */ |
|
| 2460 | + * Gets the aircraft route based on the aircraft callsign |
|
| 2461 | + * |
|
| 2462 | + * @param String $callsign the aircraft callsign |
|
| 2463 | + * @return Array aircraft type |
|
| 2464 | + * |
|
| 2465 | + */ |
|
| 2466 | 2466 | public function getRouteInfo($callsign) |
| 2467 | 2467 | { |
| 2468 | 2468 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2469 | - if ($callsign == '') return array(); |
|
| 2469 | + if ($callsign == '') return array(); |
|
| 2470 | 2470 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
| 2471 | 2471 | |
| 2472 | 2472 | $sth = $this->db->prepare($query); |
@@ -2480,12 +2480,12 @@ discard block |
||
| 2480 | 2480 | } |
| 2481 | 2481 | |
| 2482 | 2482 | /** |
| 2483 | - * Gets the aircraft info based on the aircraft registration |
|
| 2484 | - * |
|
| 2485 | - * @param String $registration the aircraft registration |
|
| 2486 | - * @return Array aircraft information |
|
| 2487 | - * |
|
| 2488 | - */ |
|
| 2483 | + * Gets the aircraft info based on the aircraft registration |
|
| 2484 | + * |
|
| 2485 | + * @param String $registration the aircraft registration |
|
| 2486 | + * @return Array aircraft information |
|
| 2487 | + * |
|
| 2488 | + */ |
|
| 2489 | 2489 | public function getAircraftInfoByRegistration($registration) |
| 2490 | 2490 | { |
| 2491 | 2491 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2512,12 +2512,12 @@ discard block |
||
| 2512 | 2512 | } |
| 2513 | 2513 | |
| 2514 | 2514 | /** |
| 2515 | - * Gets the aircraft owner & base based on the aircraft registration |
|
| 2516 | - * |
|
| 2517 | - * @param String $registration the aircraft registration |
|
| 2518 | - * @return Array aircraft information |
|
| 2519 | - * |
|
| 2520 | - */ |
|
| 2515 | + * Gets the aircraft owner & base based on the aircraft registration |
|
| 2516 | + * |
|
| 2517 | + * @param String $registration the aircraft registration |
|
| 2518 | + * @return Array aircraft information |
|
| 2519 | + * |
|
| 2520 | + */ |
|
| 2521 | 2521 | public function getAircraftOwnerByRegistration($registration) |
| 2522 | 2522 | { |
| 2523 | 2523 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2534,11 +2534,11 @@ discard block |
||
| 2534 | 2534 | |
| 2535 | 2535 | |
| 2536 | 2536 | /** |
| 2537 | - * Gets all flights (but with only little info) |
|
| 2538 | - * |
|
| 2539 | - * @return Array basic flight information |
|
| 2540 | - * |
|
| 2541 | - */ |
|
| 2537 | + * Gets all flights (but with only little info) |
|
| 2538 | + * |
|
| 2539 | + * @return Array basic flight information |
|
| 2540 | + * |
|
| 2541 | + */ |
|
| 2542 | 2542 | public function getAllFlightsforSitemap() |
| 2543 | 2543 | { |
| 2544 | 2544 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
@@ -2546,7 +2546,7 @@ discard block |
||
| 2546 | 2546 | |
| 2547 | 2547 | $sth = $this->db->prepare($query); |
| 2548 | 2548 | $sth->execute(); |
| 2549 | - /* |
|
| 2549 | + /* |
|
| 2550 | 2550 | $flight_array = array(); |
| 2551 | 2551 | $temp_array = array(); |
| 2552 | 2552 | |
@@ -2568,11 +2568,11 @@ discard block |
||
| 2568 | 2568 | } |
| 2569 | 2569 | |
| 2570 | 2570 | /** |
| 2571 | - * Gets a list of all aircraft manufacturers |
|
| 2572 | - * |
|
| 2573 | - * @return Array list of aircraft types |
|
| 2574 | - * |
|
| 2575 | - */ |
|
| 2571 | + * Gets a list of all aircraft manufacturers |
|
| 2572 | + * |
|
| 2573 | + * @return Array list of aircraft types |
|
| 2574 | + * |
|
| 2575 | + */ |
|
| 2576 | 2576 | public function getAllManufacturers() |
| 2577 | 2577 | { |
| 2578 | 2578 | /* |
@@ -2601,11 +2601,11 @@ discard block |
||
| 2601 | 2601 | |
| 2602 | 2602 | |
| 2603 | 2603 | /** |
| 2604 | - * Gets a list of all aircraft types |
|
| 2605 | - * |
|
| 2606 | - * @return Array list of aircraft types |
|
| 2607 | - * |
|
| 2608 | - */ |
|
| 2604 | + * Gets a list of all aircraft types |
|
| 2605 | + * |
|
| 2606 | + * @return Array list of aircraft types |
|
| 2607 | + * |
|
| 2608 | + */ |
|
| 2609 | 2609 | public function getAllAircraftTypes($filters = array()) |
| 2610 | 2610 | { |
| 2611 | 2611 | /* |
@@ -2640,11 +2640,11 @@ discard block |
||
| 2640 | 2640 | |
| 2641 | 2641 | |
| 2642 | 2642 | /** |
| 2643 | - * Gets a list of all aircraft registrations |
|
| 2644 | - * |
|
| 2645 | - * @return Array list of aircraft registrations |
|
| 2646 | - * |
|
| 2647 | - */ |
|
| 2643 | + * Gets a list of all aircraft registrations |
|
| 2644 | + * |
|
| 2645 | + * @return Array list of aircraft registrations |
|
| 2646 | + * |
|
| 2647 | + */ |
|
| 2648 | 2648 | public function getAllAircraftRegistrations($filters = array()) |
| 2649 | 2649 | { |
| 2650 | 2650 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2669,12 +2669,12 @@ discard block |
||
| 2669 | 2669 | } |
| 2670 | 2670 | |
| 2671 | 2671 | /** |
| 2672 | - * Gets all source name |
|
| 2673 | - * |
|
| 2674 | - * @param String type format of source |
|
| 2675 | - * @return Array list of source name |
|
| 2676 | - * |
|
| 2677 | - */ |
|
| 2672 | + * Gets all source name |
|
| 2673 | + * |
|
| 2674 | + * @param String type format of source |
|
| 2675 | + * @return Array list of source name |
|
| 2676 | + * |
|
| 2677 | + */ |
|
| 2678 | 2678 | public function getAllSourceName($type = '',$filters = array()) |
| 2679 | 2679 | { |
| 2680 | 2680 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2705,11 +2705,11 @@ discard block |
||
| 2705 | 2705 | |
| 2706 | 2706 | |
| 2707 | 2707 | /** |
| 2708 | - * Gets a list of all airline names |
|
| 2709 | - * |
|
| 2710 | - * @return Array list of airline names |
|
| 2711 | - * |
|
| 2712 | - */ |
|
| 2708 | + * Gets a list of all airline names |
|
| 2709 | + * |
|
| 2710 | + * @return Array list of airline names |
|
| 2711 | + * |
|
| 2712 | + */ |
|
| 2713 | 2713 | public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
| 2714 | 2714 | { |
| 2715 | 2715 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2758,11 +2758,11 @@ discard block |
||
| 2758 | 2758 | } |
| 2759 | 2759 | |
| 2760 | 2760 | /** |
| 2761 | - * Gets a list of all alliance names |
|
| 2762 | - * |
|
| 2763 | - * @return Array list of alliance names |
|
| 2764 | - * |
|
| 2765 | - */ |
|
| 2761 | + * Gets a list of all alliance names |
|
| 2762 | + * |
|
| 2763 | + * @return Array list of alliance names |
|
| 2764 | + * |
|
| 2765 | + */ |
|
| 2766 | 2766 | public function getAllAllianceNames($forsource = NULL,$filters = array()) |
| 2767 | 2767 | { |
| 2768 | 2768 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2787,11 +2787,11 @@ discard block |
||
| 2787 | 2787 | } |
| 2788 | 2788 | |
| 2789 | 2789 | /** |
| 2790 | - * Gets a list of all airline countries |
|
| 2791 | - * |
|
| 2792 | - * @return Array list of airline countries |
|
| 2793 | - * |
|
| 2794 | - */ |
|
| 2790 | + * Gets a list of all airline countries |
|
| 2791 | + * |
|
| 2792 | + * @return Array list of airline countries |
|
| 2793 | + * |
|
| 2794 | + */ |
|
| 2795 | 2795 | public function getAllAirlineCountries($filters = array()) |
| 2796 | 2796 | { |
| 2797 | 2797 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2819,11 +2819,11 @@ discard block |
||
| 2819 | 2819 | |
| 2820 | 2820 | |
| 2821 | 2821 | /** |
| 2822 | - * Gets a list of all departure & arrival names |
|
| 2823 | - * |
|
| 2824 | - * @return Array list of airport names |
|
| 2825 | - * |
|
| 2826 | - */ |
|
| 2822 | + * Gets a list of all departure & arrival names |
|
| 2823 | + * |
|
| 2824 | + * @return Array list of airport names |
|
| 2825 | + * |
|
| 2826 | + */ |
|
| 2827 | 2827 | public function getAllAirportNames($filters = array()) |
| 2828 | 2828 | { |
| 2829 | 2829 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2871,11 +2871,11 @@ discard block |
||
| 2871 | 2871 | } |
| 2872 | 2872 | |
| 2873 | 2873 | /** |
| 2874 | - * Gets a list of all owner names |
|
| 2875 | - * |
|
| 2876 | - * @return Array list of owner names |
|
| 2877 | - * |
|
| 2878 | - */ |
|
| 2874 | + * Gets a list of all owner names |
|
| 2875 | + * |
|
| 2876 | + * @return Array list of owner names |
|
| 2877 | + * |
|
| 2878 | + */ |
|
| 2879 | 2879 | public function getAllOwnerNames($filters = array()) |
| 2880 | 2880 | { |
| 2881 | 2881 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2889,11 +2889,11 @@ discard block |
||
| 2889 | 2889 | } |
| 2890 | 2890 | |
| 2891 | 2891 | /** |
| 2892 | - * Gets a list of all pilot names and pilot ids |
|
| 2893 | - * |
|
| 2894 | - * @return Array list of pilot names and pilot ids |
|
| 2895 | - * |
|
| 2896 | - */ |
|
| 2892 | + * Gets a list of all pilot names and pilot ids |
|
| 2893 | + * |
|
| 2894 | + * @return Array list of pilot names and pilot ids |
|
| 2895 | + * |
|
| 2896 | + */ |
|
| 2897 | 2897 | public function getAllPilotNames($filters = array()) |
| 2898 | 2898 | { |
| 2899 | 2899 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2908,11 +2908,11 @@ discard block |
||
| 2908 | 2908 | |
| 2909 | 2909 | |
| 2910 | 2910 | /** |
| 2911 | - * Gets a list of all departure & arrival airport countries |
|
| 2912 | - * |
|
| 2913 | - * @return Array list of airport countries |
|
| 2914 | - * |
|
| 2915 | - */ |
|
| 2911 | + * Gets a list of all departure & arrival airport countries |
|
| 2912 | + * |
|
| 2913 | + * @return Array list of airport countries |
|
| 2914 | + * |
|
| 2915 | + */ |
|
| 2916 | 2916 | public function getAllAirportCountries($filters = array()) |
| 2917 | 2917 | { |
| 2918 | 2918 | $airport_array = array(); |
@@ -2960,11 +2960,11 @@ discard block |
||
| 2960 | 2960 | |
| 2961 | 2961 | |
| 2962 | 2962 | /** |
| 2963 | - * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2964 | - * |
|
| 2965 | - * @return Array list of countries |
|
| 2966 | - * |
|
| 2967 | - */ |
|
| 2963 | + * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2964 | + * |
|
| 2965 | + * @return Array list of countries |
|
| 2966 | + * |
|
| 2967 | + */ |
|
| 2968 | 2968 | public function getAllCountries($filters = array()) |
| 2969 | 2969 | { |
| 2970 | 2970 | $Connection= new Connection($this->db); |
@@ -3041,11 +3041,11 @@ discard block |
||
| 3041 | 3041 | |
| 3042 | 3042 | |
| 3043 | 3043 | /** |
| 3044 | - * Gets a list of all idents/callsigns |
|
| 3045 | - * |
|
| 3046 | - * @return Array list of ident/callsign names |
|
| 3047 | - * |
|
| 3048 | - */ |
|
| 3044 | + * Gets a list of all idents/callsigns |
|
| 3045 | + * |
|
| 3046 | + * @return Array list of ident/callsign names |
|
| 3047 | + * |
|
| 3048 | + */ |
|
| 3049 | 3049 | public function getAllIdents($filters = array()) |
| 3050 | 3050 | { |
| 3051 | 3051 | $filter_query = $this->getFilter($filters,true,true); |
@@ -3069,9 +3069,9 @@ discard block |
||
| 3069 | 3069 | } |
| 3070 | 3070 | |
| 3071 | 3071 | /** |
| 3072 | - * Get a list of flights from airport since 7 days |
|
| 3073 | - * @return Array number, icao, name and city of airports |
|
| 3074 | - */ |
|
| 3072 | + * Get a list of flights from airport since 7 days |
|
| 3073 | + * @return Array number, icao, name and city of airports |
|
| 3074 | + */ |
|
| 3075 | 3075 | |
| 3076 | 3076 | public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
| 3077 | 3077 | global $globalTimezone, $globalDBdriver; |
@@ -3102,9 +3102,9 @@ discard block |
||
| 3102 | 3102 | } |
| 3103 | 3103 | |
| 3104 | 3104 | /** |
| 3105 | - * Get a list of flights from airport since 7 days |
|
| 3106 | - * @return Array number, icao, name and city of airports |
|
| 3107 | - */ |
|
| 3105 | + * Get a list of flights from airport since 7 days |
|
| 3106 | + * @return Array number, icao, name and city of airports |
|
| 3107 | + */ |
|
| 3108 | 3108 | |
| 3109 | 3109 | public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') { |
| 3110 | 3110 | global $globalTimezone, $globalDBdriver; |
@@ -3134,9 +3134,9 @@ discard block |
||
| 3134 | 3134 | } |
| 3135 | 3135 | |
| 3136 | 3136 | /** |
| 3137 | - * Get a list of flights from detected airport since 7 days |
|
| 3138 | - * @return Array number, icao, name and city of airports |
|
| 3139 | - */ |
|
| 3137 | + * Get a list of flights from detected airport since 7 days |
|
| 3138 | + * @return Array number, icao, name and city of airports |
|
| 3139 | + */ |
|
| 3140 | 3140 | |
| 3141 | 3141 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 3142 | 3142 | global $globalTimezone, $globalDBdriver; |
@@ -3174,9 +3174,9 @@ discard block |
||
| 3174 | 3174 | } |
| 3175 | 3175 | |
| 3176 | 3176 | /** |
| 3177 | - * Get a list of flights from detected airport since 7 days |
|
| 3178 | - * @return Array number, icao, name and city of airports |
|
| 3179 | - */ |
|
| 3177 | + * Get a list of flights from detected airport since 7 days |
|
| 3178 | + * @return Array number, icao, name and city of airports |
|
| 3179 | + */ |
|
| 3180 | 3180 | |
| 3181 | 3181 | public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') { |
| 3182 | 3182 | global $globalTimezone, $globalDBdriver; |
@@ -3218,9 +3218,9 @@ discard block |
||
| 3218 | 3218 | |
| 3219 | 3219 | |
| 3220 | 3220 | /** |
| 3221 | - * Get a list of flights to airport since 7 days |
|
| 3222 | - * @return Array number, icao, name and city of airports |
|
| 3223 | - */ |
|
| 3221 | + * Get a list of flights to airport since 7 days |
|
| 3222 | + * @return Array number, icao, name and city of airports |
|
| 3223 | + */ |
|
| 3224 | 3224 | |
| 3225 | 3225 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 3226 | 3226 | global $globalTimezone, $globalDBdriver; |
@@ -3253,9 +3253,9 @@ discard block |
||
| 3253 | 3253 | |
| 3254 | 3254 | |
| 3255 | 3255 | /** |
| 3256 | - * Get a list of flights detected to airport since 7 days |
|
| 3257 | - * @return Array number, icao, name and city of airports |
|
| 3258 | - */ |
|
| 3256 | + * Get a list of flights detected to airport since 7 days |
|
| 3257 | + * @return Array number, icao, name and city of airports |
|
| 3258 | + */ |
|
| 3259 | 3259 | |
| 3260 | 3260 | public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
| 3261 | 3261 | global $globalTimezone, $globalDBdriver; |
@@ -3296,9 +3296,9 @@ discard block |
||
| 3296 | 3296 | |
| 3297 | 3297 | |
| 3298 | 3298 | /** |
| 3299 | - * Get a list of flights to airport since 7 days |
|
| 3300 | - * @return Array number, icao, name and city of airports |
|
| 3301 | - */ |
|
| 3299 | + * Get a list of flights to airport since 7 days |
|
| 3300 | + * @return Array number, icao, name and city of airports |
|
| 3301 | + */ |
|
| 3302 | 3302 | |
| 3303 | 3303 | public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') { |
| 3304 | 3304 | global $globalTimezone, $globalDBdriver; |
@@ -3330,9 +3330,9 @@ discard block |
||
| 3330 | 3330 | |
| 3331 | 3331 | |
| 3332 | 3332 | /** |
| 3333 | - * Get a list of flights detected to airport since 7 days |
|
| 3334 | - * @return Array number, icao, name and city of airports |
|
| 3335 | - */ |
|
| 3333 | + * Get a list of flights detected to airport since 7 days |
|
| 3334 | + * @return Array number, icao, name and city of airports |
|
| 3335 | + */ |
|
| 3336 | 3336 | |
| 3337 | 3337 | public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') { |
| 3338 | 3338 | global $globalTimezone, $globalDBdriver; |
@@ -3376,11 +3376,11 @@ discard block |
||
| 3376 | 3376 | |
| 3377 | 3377 | |
| 3378 | 3378 | /** |
| 3379 | - * Gets a list of all dates |
|
| 3380 | - * |
|
| 3381 | - * @return Array list of date names |
|
| 3382 | - * |
|
| 3383 | - */ |
|
| 3379 | + * Gets a list of all dates |
|
| 3380 | + * |
|
| 3381 | + * @return Array list of date names |
|
| 3382 | + * |
|
| 3383 | + */ |
|
| 3384 | 3384 | public function getAllDates() |
| 3385 | 3385 | { |
| 3386 | 3386 | global $globalTimezone, $globalDBdriver; |
@@ -3421,11 +3421,11 @@ discard block |
||
| 3421 | 3421 | |
| 3422 | 3422 | |
| 3423 | 3423 | /** |
| 3424 | - * Gets all route combinations |
|
| 3425 | - * |
|
| 3426 | - * @return Array the route list |
|
| 3427 | - * |
|
| 3428 | - */ |
|
| 3424 | + * Gets all route combinations |
|
| 3425 | + * |
|
| 3426 | + * @return Array the route list |
|
| 3427 | + * |
|
| 3428 | + */ |
|
| 3429 | 3429 | public function getAllRoutes() |
| 3430 | 3430 | { |
| 3431 | 3431 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
@@ -3451,13 +3451,13 @@ discard block |
||
| 3451 | 3451 | } |
| 3452 | 3452 | |
| 3453 | 3453 | /** |
| 3454 | - * Update ident spotter data |
|
| 3455 | - * |
|
| 3456 | - * @param String $flightaware_id the ID from flightaware |
|
| 3457 | - * @param String $ident the flight ident |
|
| 3458 | - * @return String success or false |
|
| 3459 | - * |
|
| 3460 | - */ |
|
| 3454 | + * Update ident spotter data |
|
| 3455 | + * |
|
| 3456 | + * @param String $flightaware_id the ID from flightaware |
|
| 3457 | + * @param String $ident the flight ident |
|
| 3458 | + * @return String success or false |
|
| 3459 | + * |
|
| 3460 | + */ |
|
| 3461 | 3461 | public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
| 3462 | 3462 | { |
| 3463 | 3463 | if (!is_numeric(substr($ident, 0, 3))) |
@@ -3478,14 +3478,14 @@ discard block |
||
| 3478 | 3478 | } else { |
| 3479 | 3479 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3480 | 3480 | } |
| 3481 | - $airline_name = $airline_array[0]['name']; |
|
| 3482 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3483 | - $airline_country = $airline_array[0]['country']; |
|
| 3484 | - $airline_type = $airline_array[0]['type']; |
|
| 3481 | + $airline_name = $airline_array[0]['name']; |
|
| 3482 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3483 | + $airline_country = $airline_array[0]['country']; |
|
| 3484 | + $airline_type = $airline_array[0]['type']; |
|
| 3485 | 3485 | |
| 3486 | 3486 | |
| 3487 | 3487 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
| 3488 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3488 | + $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3489 | 3489 | |
| 3490 | 3490 | try { |
| 3491 | 3491 | $sth = $this->db->prepare($query); |
@@ -3498,19 +3498,19 @@ discard block |
||
| 3498 | 3498 | |
| 3499 | 3499 | } |
| 3500 | 3500 | /** |
| 3501 | - * Update latest spotter data |
|
| 3502 | - * |
|
| 3503 | - * @param String $flightaware_id the ID from flightaware |
|
| 3504 | - * @param String $ident the flight ident |
|
| 3505 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3506 | - * @return String success or false |
|
| 3507 | - * |
|
| 3508 | - */ |
|
| 3501 | + * Update latest spotter data |
|
| 3502 | + * |
|
| 3503 | + * @param String $flightaware_id the ID from flightaware |
|
| 3504 | + * @param String $ident the flight ident |
|
| 3505 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3506 | + * @return String success or false |
|
| 3507 | + * |
|
| 3508 | + */ |
|
| 3509 | 3509 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3510 | 3510 | { |
| 3511 | 3511 | if ($groundspeed == '') $groundspeed = NULL; |
| 3512 | 3512 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3513 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3513 | + $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3514 | 3514 | |
| 3515 | 3515 | try { |
| 3516 | 3516 | $sth = $this->db->prepare($query); |
@@ -3524,32 +3524,32 @@ discard block |
||
| 3524 | 3524 | } |
| 3525 | 3525 | |
| 3526 | 3526 | /** |
| 3527 | - * Adds a new spotter data |
|
| 3528 | - * |
|
| 3529 | - * @param String $flightaware_id the ID from flightaware |
|
| 3530 | - * @param String $ident the flight ident |
|
| 3531 | - * @param String $aircraft_icao the aircraft type |
|
| 3532 | - * @param String $departure_airport_icao the departure airport |
|
| 3533 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3534 | - * @param String $latitude latitude of flight |
|
| 3535 | - * @param String $longitude latitude of flight |
|
| 3536 | - * @param String $waypoints waypoints of flight |
|
| 3537 | - * @param String $altitude altitude of flight |
|
| 3538 | - * @param String $heading heading of flight |
|
| 3539 | - * @param String $groundspeed speed of flight |
|
| 3540 | - * @param String $date date of flight |
|
| 3541 | - * @param String $departure_airport_time departure time of flight |
|
| 3542 | - * @param String $arrival_airport_time arrival time of flight |
|
| 3543 | - * @param String $squawk squawk code of flight |
|
| 3544 | - * @param String $route_stop route stop of flight |
|
| 3545 | - * @param String $highlight highlight or not |
|
| 3546 | - * @param String $ModeS ModesS code of flight |
|
| 3547 | - * @param String $registration registration code of flight |
|
| 3548 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3549 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3550 | - * @param String $verticalrate vertival rate of flight |
|
| 3551 | - * @return String success or false |
|
| 3552 | - */ |
|
| 3527 | + * Adds a new spotter data |
|
| 3528 | + * |
|
| 3529 | + * @param String $flightaware_id the ID from flightaware |
|
| 3530 | + * @param String $ident the flight ident |
|
| 3531 | + * @param String $aircraft_icao the aircraft type |
|
| 3532 | + * @param String $departure_airport_icao the departure airport |
|
| 3533 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3534 | + * @param String $latitude latitude of flight |
|
| 3535 | + * @param String $longitude latitude of flight |
|
| 3536 | + * @param String $waypoints waypoints of flight |
|
| 3537 | + * @param String $altitude altitude of flight |
|
| 3538 | + * @param String $heading heading of flight |
|
| 3539 | + * @param String $groundspeed speed of flight |
|
| 3540 | + * @param String $date date of flight |
|
| 3541 | + * @param String $departure_airport_time departure time of flight |
|
| 3542 | + * @param String $arrival_airport_time arrival time of flight |
|
| 3543 | + * @param String $squawk squawk code of flight |
|
| 3544 | + * @param String $route_stop route stop of flight |
|
| 3545 | + * @param String $highlight highlight or not |
|
| 3546 | + * @param String $ModeS ModesS code of flight |
|
| 3547 | + * @param String $registration registration code of flight |
|
| 3548 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3549 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3550 | + * @param String $verticalrate vertival rate of flight |
|
| 3551 | + * @return String success or false |
|
| 3552 | + */ |
|
| 3553 | 3553 | public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
| 3554 | 3554 | { |
| 3555 | 3555 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
@@ -3764,8 +3764,8 @@ discard block |
||
| 3764 | 3764 | |
| 3765 | 3765 | if ($globalIVAO && $aircraft_icao != '') |
| 3766 | 3766 | { |
| 3767 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3768 | - else $airline_icao = ''; |
|
| 3767 | + if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3768 | + else $airline_icao = ''; |
|
| 3769 | 3769 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3770 | 3770 | if (!isset($image_array[0]['registration'])) |
| 3771 | 3771 | { |
@@ -3796,53 +3796,53 @@ discard block |
||
| 3796 | 3796 | |
| 3797 | 3797 | if (count($airline_array) == 0) |
| 3798 | 3798 | { |
| 3799 | - $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3800 | - } |
|
| 3801 | - if (count($aircraft_array) == 0) |
|
| 3802 | - { |
|
| 3803 | - $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3804 | - } |
|
| 3805 | - if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
| 3806 | - { |
|
| 3807 | - $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3808 | - } |
|
| 3809 | - if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
| 3810 | - { |
|
| 3811 | - $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3812 | - } |
|
| 3813 | - if ($registration == '') $registration = 'NA'; |
|
| 3814 | - if ($latitude == '' && $longitude == '') { |
|
| 3815 | - $latitude = 0; |
|
| 3816 | - $longitude = 0; |
|
| 3817 | - } |
|
| 3818 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3819 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3820 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3821 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3822 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3823 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3799 | + $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3800 | + } |
|
| 3801 | + if (count($aircraft_array) == 0) |
|
| 3802 | + { |
|
| 3803 | + $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3804 | + } |
|
| 3805 | + if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
| 3806 | + { |
|
| 3807 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3808 | + } |
|
| 3809 | + if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
| 3810 | + { |
|
| 3811 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3812 | + } |
|
| 3813 | + if ($registration == '') $registration = 'NA'; |
|
| 3814 | + if ($latitude == '' && $longitude == '') { |
|
| 3815 | + $latitude = 0; |
|
| 3816 | + $longitude = 0; |
|
| 3817 | + } |
|
| 3818 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3819 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3820 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3821 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3822 | + if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3823 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3824 | 3824 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3825 | 3825 | |
| 3826 | - $airline_name = $airline_array[0]['name']; |
|
| 3827 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3828 | - $airline_country = $airline_array[0]['country']; |
|
| 3829 | - $airline_type = $airline_array[0]['type']; |
|
| 3826 | + $airline_name = $airline_array[0]['name']; |
|
| 3827 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3828 | + $airline_country = $airline_array[0]['country']; |
|
| 3829 | + $airline_type = $airline_array[0]['type']; |
|
| 3830 | 3830 | if ($airline_type == '') { |
| 3831 | 3831 | $timeelapsed = microtime(true); |
| 3832 | 3832 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3833 | 3833 | if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 3834 | 3834 | } |
| 3835 | 3835 | if ($airline_type == null) $airline_type = ''; |
| 3836 | - $aircraft_type = $aircraft_array[0]['type']; |
|
| 3837 | - $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3838 | - $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3839 | - $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3840 | - $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3836 | + $aircraft_type = $aircraft_array[0]['type']; |
|
| 3837 | + $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3838 | + $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3839 | + $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3840 | + $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3841 | 3841 | |
| 3842 | - $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3843 | - $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3844 | - $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3845 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3842 | + $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3843 | + $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3844 | + $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3845 | + $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3846 | 3846 | |
| 3847 | 3847 | try { |
| 3848 | 3848 | |
@@ -3850,7 +3850,7 @@ discard block |
||
| 3850 | 3850 | $sth->execute($query_values); |
| 3851 | 3851 | $this->db = null; |
| 3852 | 3852 | } catch (PDOException $e) { |
| 3853 | - return "error : ".$e->getMessage(); |
|
| 3853 | + return "error : ".$e->getMessage(); |
|
| 3854 | 3854 | } |
| 3855 | 3855 | |
| 3856 | 3856 | return "success"; |
@@ -3859,11 +3859,11 @@ discard block |
||
| 3859 | 3859 | |
| 3860 | 3860 | |
| 3861 | 3861 | /** |
| 3862 | - * Gets the aircraft ident within the last hour |
|
| 3863 | - * |
|
| 3864 | - * @return String the ident |
|
| 3865 | - * |
|
| 3866 | - */ |
|
| 3862 | + * Gets the aircraft ident within the last hour |
|
| 3863 | + * |
|
| 3864 | + * @return String the ident |
|
| 3865 | + * |
|
| 3866 | + */ |
|
| 3867 | 3867 | public function getIdentFromLastHour($ident) |
| 3868 | 3868 | { |
| 3869 | 3869 | global $globalDBdriver, $globalTimezone; |
@@ -3879,11 +3879,11 @@ discard block |
||
| 3879 | 3879 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3880 | 3880 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
| 3881 | 3881 | $query_data = array(':ident' => $ident); |
| 3882 | - } |
|
| 3882 | + } |
|
| 3883 | 3883 | |
| 3884 | 3884 | $sth = $this->db->prepare($query); |
| 3885 | 3885 | $sth->execute($query_data); |
| 3886 | - $ident_result=''; |
|
| 3886 | + $ident_result=''; |
|
| 3887 | 3887 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 3888 | 3888 | { |
| 3889 | 3889 | $ident_result = $row['ident']; |
@@ -3894,11 +3894,11 @@ discard block |
||
| 3894 | 3894 | |
| 3895 | 3895 | |
| 3896 | 3896 | /** |
| 3897 | - * Gets the aircraft data from the last 20 seconds |
|
| 3898 | - * |
|
| 3899 | - * @return Array the spotter data |
|
| 3900 | - * |
|
| 3901 | - */ |
|
| 3897 | + * Gets the aircraft data from the last 20 seconds |
|
| 3898 | + * |
|
| 3899 | + * @return Array the spotter data |
|
| 3900 | + * |
|
| 3901 | + */ |
|
| 3902 | 3902 | public function getRealTimeData($q = '') |
| 3903 | 3903 | { |
| 3904 | 3904 | global $globalDBdriver; |
@@ -3942,11 +3942,11 @@ discard block |
||
| 3942 | 3942 | |
| 3943 | 3943 | |
| 3944 | 3944 | /** |
| 3945 | - * Gets all airlines that have flown over |
|
| 3946 | - * |
|
| 3947 | - * @return Array the airline list |
|
| 3948 | - * |
|
| 3949 | - */ |
|
| 3945 | + * Gets all airlines that have flown over |
|
| 3946 | + * |
|
| 3947 | + * @return Array the airline list |
|
| 3948 | + * |
|
| 3949 | + */ |
|
| 3950 | 3950 | public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '') |
| 3951 | 3951 | { |
| 3952 | 3952 | global $globalDBdriver; |
@@ -3960,7 +3960,7 @@ discard block |
||
| 3960 | 3960 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 3961 | 3961 | } |
| 3962 | 3962 | } |
| 3963 | - if ($sincedate != '') { |
|
| 3963 | + if ($sincedate != '') { |
|
| 3964 | 3964 | if ($globalDBdriver == 'mysql') { |
| 3965 | 3965 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 3966 | 3966 | } else { |
@@ -4014,26 +4014,26 @@ discard block |
||
| 4014 | 4014 | } |
| 4015 | 4015 | |
| 4016 | 4016 | /** |
| 4017 | - * Gets all pilots that have flown over |
|
| 4018 | - * |
|
| 4019 | - * @return Array the pilots list |
|
| 4020 | - * |
|
| 4021 | - */ |
|
| 4017 | + * Gets all pilots that have flown over |
|
| 4018 | + * |
|
| 4019 | + * @return Array the pilots list |
|
| 4020 | + * |
|
| 4021 | + */ |
|
| 4022 | 4022 | public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '') |
| 4023 | 4023 | { |
| 4024 | 4024 | global $globalDBdriver; |
| 4025 | 4025 | $filter_query = $this->getFilter($filters,true,true); |
| 4026 | 4026 | $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
| 4027 | 4027 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
| 4028 | - if ($olderthanmonths > 0) { |
|
| 4029 | - if ($globalDBdriver == 'mysql') { |
|
| 4028 | + if ($olderthanmonths > 0) { |
|
| 4029 | + if ($globalDBdriver == 'mysql') { |
|
| 4030 | 4030 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 4031 | 4031 | } else { |
| 4032 | 4032 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4033 | 4033 | } |
| 4034 | 4034 | } |
| 4035 | - if ($sincedate != '') { |
|
| 4036 | - if ($globalDBdriver == 'mysql') { |
|
| 4035 | + if ($sincedate != '') { |
|
| 4036 | + if ($globalDBdriver == 'mysql') { |
|
| 4037 | 4037 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 4038 | 4038 | } else { |
| 4039 | 4039 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4088,25 +4088,25 @@ discard block |
||
| 4088 | 4088 | } |
| 4089 | 4089 | |
| 4090 | 4090 | /** |
| 4091 | - * Gets all pilots that have flown over |
|
| 4092 | - * |
|
| 4093 | - * @return Array the pilots list |
|
| 4094 | - * |
|
| 4095 | - */ |
|
| 4091 | + * Gets all pilots that have flown over |
|
| 4092 | + * |
|
| 4093 | + * @return Array the pilots list |
|
| 4094 | + * |
|
| 4095 | + */ |
|
| 4096 | 4096 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 4097 | 4097 | { |
| 4098 | 4098 | global $globalDBdriver; |
| 4099 | 4099 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
| 4100 | 4100 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 4101 | - if ($olderthanmonths > 0) { |
|
| 4102 | - if ($globalDBdriver == 'mysql') { |
|
| 4101 | + if ($olderthanmonths > 0) { |
|
| 4102 | + if ($globalDBdriver == 'mysql') { |
|
| 4103 | 4103 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4104 | 4104 | } else { |
| 4105 | 4105 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 4106 | 4106 | } |
| 4107 | 4107 | } |
| 4108 | - if ($sincedate != '') { |
|
| 4109 | - if ($globalDBdriver == 'mysql') { |
|
| 4108 | + if ($sincedate != '') { |
|
| 4109 | + if ($globalDBdriver == 'mysql') { |
|
| 4110 | 4110 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 4111 | 4111 | } else { |
| 4112 | 4112 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4135,26 +4135,26 @@ discard block |
||
| 4135 | 4135 | } |
| 4136 | 4136 | |
| 4137 | 4137 | /** |
| 4138 | - * Gets all owner that have flown over |
|
| 4139 | - * |
|
| 4140 | - * @return Array the pilots list |
|
| 4141 | - * |
|
| 4142 | - */ |
|
| 4138 | + * Gets all owner that have flown over |
|
| 4139 | + * |
|
| 4140 | + * @return Array the pilots list |
|
| 4141 | + * |
|
| 4142 | + */ |
|
| 4143 | 4143 | public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 4144 | 4144 | { |
| 4145 | 4145 | global $globalDBdriver; |
| 4146 | 4146 | $filter_query = $this->getFilter($filters,true,true); |
| 4147 | 4147 | $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 4148 | 4148 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL"; |
| 4149 | - if ($olderthanmonths > 0) { |
|
| 4150 | - if ($globalDBdriver == 'mysql') { |
|
| 4149 | + if ($olderthanmonths > 0) { |
|
| 4150 | + if ($globalDBdriver == 'mysql') { |
|
| 4151 | 4151 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 4152 | 4152 | } else { |
| 4153 | 4153 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4154 | 4154 | } |
| 4155 | 4155 | } |
| 4156 | - if ($sincedate != '') { |
|
| 4157 | - if ($globalDBdriver == 'mysql') { |
|
| 4156 | + if ($sincedate != '') { |
|
| 4157 | + if ($globalDBdriver == 'mysql') { |
|
| 4158 | 4158 | $query .= " AND spotter_output.date > '".$sincedate."' "; |
| 4159 | 4159 | } else { |
| 4160 | 4160 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4205,26 +4205,26 @@ discard block |
||
| 4205 | 4205 | } |
| 4206 | 4206 | |
| 4207 | 4207 | /** |
| 4208 | - * Gets all owner that have flown over |
|
| 4209 | - * |
|
| 4210 | - * @return Array the pilots list |
|
| 4211 | - * |
|
| 4212 | - */ |
|
| 4208 | + * Gets all owner that have flown over |
|
| 4209 | + * |
|
| 4210 | + * @return Array the pilots list |
|
| 4211 | + * |
|
| 4212 | + */ |
|
| 4213 | 4213 | public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 4214 | 4214 | { |
| 4215 | 4215 | global $globalDBdriver; |
| 4216 | 4216 | $filter_query = $this->getFilter($filters,true,true); |
| 4217 | 4217 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 4218 | 4218 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 4219 | - if ($olderthanmonths > 0) { |
|
| 4220 | - if ($globalDBdriver == 'mysql') { |
|
| 4219 | + if ($olderthanmonths > 0) { |
|
| 4220 | + if ($globalDBdriver == 'mysql') { |
|
| 4221 | 4221 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4222 | 4222 | } else { |
| 4223 | 4223 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 4224 | 4224 | } |
| 4225 | 4225 | } |
| 4226 | - if ($sincedate != '') { |
|
| 4227 | - if ($globalDBdriver == 'mysql') { |
|
| 4226 | + if ($sincedate != '') { |
|
| 4227 | + if ($globalDBdriver == 'mysql') { |
|
| 4228 | 4228 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 4229 | 4229 | } else { |
| 4230 | 4230 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4251,11 +4251,11 @@ discard block |
||
| 4251 | 4251 | } |
| 4252 | 4252 | |
| 4253 | 4253 | /** |
| 4254 | - * Gets all airlines that have flown over by aircraft |
|
| 4255 | - * |
|
| 4256 | - * @return Array the airline list |
|
| 4257 | - * |
|
| 4258 | - */ |
|
| 4254 | + * Gets all airlines that have flown over by aircraft |
|
| 4255 | + * |
|
| 4256 | + * @return Array the airline list |
|
| 4257 | + * |
|
| 4258 | + */ |
|
| 4259 | 4259 | public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
| 4260 | 4260 | { |
| 4261 | 4261 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4287,11 +4287,11 @@ discard block |
||
| 4287 | 4287 | |
| 4288 | 4288 | |
| 4289 | 4289 | /** |
| 4290 | - * Gets all airline countries that have flown over by aircraft |
|
| 4291 | - * |
|
| 4292 | - * @return Array the airline country list |
|
| 4293 | - * |
|
| 4294 | - */ |
|
| 4290 | + * Gets all airline countries that have flown over by aircraft |
|
| 4291 | + * |
|
| 4292 | + * @return Array the airline country list |
|
| 4293 | + * |
|
| 4294 | + */ |
|
| 4295 | 4295 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
| 4296 | 4296 | { |
| 4297 | 4297 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4323,11 +4323,11 @@ discard block |
||
| 4323 | 4323 | |
| 4324 | 4324 | |
| 4325 | 4325 | /** |
| 4326 | - * Gets all airlines that have flown over by airport |
|
| 4327 | - * |
|
| 4328 | - * @return Array the airline list |
|
| 4329 | - * |
|
| 4330 | - */ |
|
| 4326 | + * Gets all airlines that have flown over by airport |
|
| 4327 | + * |
|
| 4328 | + * @return Array the airline list |
|
| 4329 | + * |
|
| 4330 | + */ |
|
| 4331 | 4331 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
| 4332 | 4332 | { |
| 4333 | 4333 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4358,11 +4358,11 @@ discard block |
||
| 4358 | 4358 | |
| 4359 | 4359 | |
| 4360 | 4360 | /** |
| 4361 | - * Gets all airline countries that have flown over by airport icao |
|
| 4362 | - * |
|
| 4363 | - * @return Array the airline country list |
|
| 4364 | - * |
|
| 4365 | - */ |
|
| 4361 | + * Gets all airline countries that have flown over by airport icao |
|
| 4362 | + * |
|
| 4363 | + * @return Array the airline country list |
|
| 4364 | + * |
|
| 4365 | + */ |
|
| 4366 | 4366 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
| 4367 | 4367 | { |
| 4368 | 4368 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4392,11 +4392,11 @@ discard block |
||
| 4392 | 4392 | |
| 4393 | 4393 | |
| 4394 | 4394 | /** |
| 4395 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4396 | - * |
|
| 4397 | - * @return Array the airline list |
|
| 4398 | - * |
|
| 4399 | - */ |
|
| 4395 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4396 | + * |
|
| 4397 | + * @return Array the airline list |
|
| 4398 | + * |
|
| 4399 | + */ |
|
| 4400 | 4400 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4401 | 4401 | { |
| 4402 | 4402 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4427,11 +4427,11 @@ discard block |
||
| 4427 | 4427 | |
| 4428 | 4428 | |
| 4429 | 4429 | /** |
| 4430 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4431 | - * |
|
| 4432 | - * @return Array the airline country list |
|
| 4433 | - * |
|
| 4434 | - */ |
|
| 4430 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4431 | + * |
|
| 4432 | + * @return Array the airline country list |
|
| 4433 | + * |
|
| 4434 | + */ |
|
| 4435 | 4435 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4436 | 4436 | { |
| 4437 | 4437 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4460,11 +4460,11 @@ discard block |
||
| 4460 | 4460 | |
| 4461 | 4461 | |
| 4462 | 4462 | /** |
| 4463 | - * Gets all airlines that have flown over by date |
|
| 4464 | - * |
|
| 4465 | - * @return Array the airline list |
|
| 4466 | - * |
|
| 4467 | - */ |
|
| 4463 | + * Gets all airlines that have flown over by date |
|
| 4464 | + * |
|
| 4465 | + * @return Array the airline list |
|
| 4466 | + * |
|
| 4467 | + */ |
|
| 4468 | 4468 | public function countAllAirlinesByDate($date,$filters = array()) |
| 4469 | 4469 | { |
| 4470 | 4470 | global $globalTimezone, $globalDBdriver; |
@@ -4508,11 +4508,11 @@ discard block |
||
| 4508 | 4508 | |
| 4509 | 4509 | |
| 4510 | 4510 | /** |
| 4511 | - * Gets all airline countries that have flown over by date |
|
| 4512 | - * |
|
| 4513 | - * @return Array the airline country list |
|
| 4514 | - * |
|
| 4515 | - */ |
|
| 4511 | + * Gets all airline countries that have flown over by date |
|
| 4512 | + * |
|
| 4513 | + * @return Array the airline country list |
|
| 4514 | + * |
|
| 4515 | + */ |
|
| 4516 | 4516 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
| 4517 | 4517 | { |
| 4518 | 4518 | global $globalTimezone, $globalDBdriver; |
@@ -4555,11 +4555,11 @@ discard block |
||
| 4555 | 4555 | |
| 4556 | 4556 | |
| 4557 | 4557 | /** |
| 4558 | - * Gets all airlines that have flown over by ident/callsign |
|
| 4559 | - * |
|
| 4560 | - * @return Array the airline list |
|
| 4561 | - * |
|
| 4562 | - */ |
|
| 4558 | + * Gets all airlines that have flown over by ident/callsign |
|
| 4559 | + * |
|
| 4560 | + * @return Array the airline list |
|
| 4561 | + * |
|
| 4562 | + */ |
|
| 4563 | 4563 | public function countAllAirlinesByIdent($ident,$filters = array()) |
| 4564 | 4564 | { |
| 4565 | 4565 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4576,11 +4576,11 @@ discard block |
||
| 4576 | 4576 | } |
| 4577 | 4577 | |
| 4578 | 4578 | /** |
| 4579 | - * Gets all airlines by owner |
|
| 4580 | - * |
|
| 4581 | - * @return Array the airline list |
|
| 4582 | - * |
|
| 4583 | - */ |
|
| 4579 | + * Gets all airlines by owner |
|
| 4580 | + * |
|
| 4581 | + * @return Array the airline list |
|
| 4582 | + * |
|
| 4583 | + */ |
|
| 4584 | 4584 | public function countAllAirlinesByOwner($owner,$filters = array()) |
| 4585 | 4585 | { |
| 4586 | 4586 | $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
@@ -4597,11 +4597,11 @@ discard block |
||
| 4597 | 4597 | } |
| 4598 | 4598 | |
| 4599 | 4599 | /** |
| 4600 | - * Gets flight duration by owner |
|
| 4601 | - * |
|
| 4602 | - * @return String Duration of all flights |
|
| 4603 | - * |
|
| 4604 | - */ |
|
| 4600 | + * Gets flight duration by owner |
|
| 4601 | + * |
|
| 4602 | + * @return String Duration of all flights |
|
| 4603 | + * |
|
| 4604 | + */ |
|
| 4605 | 4605 | public function getFlightDurationByOwner($owner,$filters = array()) |
| 4606 | 4606 | { |
| 4607 | 4607 | $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
@@ -4616,11 +4616,11 @@ discard block |
||
| 4616 | 4616 | } |
| 4617 | 4617 | |
| 4618 | 4618 | /** |
| 4619 | - * Gets flight duration by pilot |
|
| 4620 | - * |
|
| 4621 | - * @return String Duration of all flights |
|
| 4622 | - * |
|
| 4623 | - */ |
|
| 4619 | + * Gets flight duration by pilot |
|
| 4620 | + * |
|
| 4621 | + * @return String Duration of all flights |
|
| 4622 | + * |
|
| 4623 | + */ |
|
| 4624 | 4624 | public function getFlightDurationByPilot($pilot,$filters = array()) |
| 4625 | 4625 | { |
| 4626 | 4626 | $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
@@ -4635,11 +4635,11 @@ discard block |
||
| 4635 | 4635 | } |
| 4636 | 4636 | |
| 4637 | 4637 | /** |
| 4638 | - * Gets all airlines used by pilot |
|
| 4639 | - * |
|
| 4640 | - * @return Array the airline list |
|
| 4641 | - * |
|
| 4642 | - */ |
|
| 4638 | + * Gets all airlines used by pilot |
|
| 4639 | + * |
|
| 4640 | + * @return Array the airline list |
|
| 4641 | + * |
|
| 4642 | + */ |
|
| 4643 | 4643 | public function countAllAirlinesByPilot($pilot,$filters = array()) |
| 4644 | 4644 | { |
| 4645 | 4645 | $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
@@ -4656,11 +4656,11 @@ discard block |
||
| 4656 | 4656 | } |
| 4657 | 4657 | |
| 4658 | 4658 | /** |
| 4659 | - * Gets all airlines that have flown over by route |
|
| 4660 | - * |
|
| 4661 | - * @return Array the airline list |
|
| 4662 | - * |
|
| 4663 | - */ |
|
| 4659 | + * Gets all airlines that have flown over by route |
|
| 4660 | + * |
|
| 4661 | + * @return Array the airline list |
|
| 4662 | + * |
|
| 4663 | + */ |
|
| 4664 | 4664 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 4665 | 4665 | { |
| 4666 | 4666 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4692,11 +4692,11 @@ discard block |
||
| 4692 | 4692 | } |
| 4693 | 4693 | |
| 4694 | 4694 | /** |
| 4695 | - * Gets all airline countries that have flown over by route |
|
| 4696 | - * |
|
| 4697 | - * @return Array the airline country list |
|
| 4698 | - * |
|
| 4699 | - */ |
|
| 4695 | + * Gets all airline countries that have flown over by route |
|
| 4696 | + * |
|
| 4697 | + * @return Array the airline country list |
|
| 4698 | + * |
|
| 4699 | + */ |
|
| 4700 | 4700 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
| 4701 | 4701 | { |
| 4702 | 4702 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4728,11 +4728,11 @@ discard block |
||
| 4728 | 4728 | |
| 4729 | 4729 | |
| 4730 | 4730 | /** |
| 4731 | - * Gets all airlines that have flown over by country |
|
| 4732 | - * |
|
| 4733 | - * @return Array the airline list |
|
| 4734 | - * |
|
| 4735 | - */ |
|
| 4731 | + * Gets all airlines that have flown over by country |
|
| 4732 | + * |
|
| 4733 | + * @return Array the airline list |
|
| 4734 | + * |
|
| 4735 | + */ |
|
| 4736 | 4736 | public function countAllAirlinesByCountry($country,$filters = array()) |
| 4737 | 4737 | { |
| 4738 | 4738 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4762,11 +4762,11 @@ discard block |
||
| 4762 | 4762 | |
| 4763 | 4763 | |
| 4764 | 4764 | /** |
| 4765 | - * Gets all airline countries that have flown over by country |
|
| 4766 | - * |
|
| 4767 | - * @return Array the airline country list |
|
| 4768 | - * |
|
| 4769 | - */ |
|
| 4765 | + * Gets all airline countries that have flown over by country |
|
| 4766 | + * |
|
| 4767 | + * @return Array the airline country list |
|
| 4768 | + * |
|
| 4769 | + */ |
|
| 4770 | 4770 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
| 4771 | 4771 | { |
| 4772 | 4772 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4795,11 +4795,11 @@ discard block |
||
| 4795 | 4795 | |
| 4796 | 4796 | |
| 4797 | 4797 | /** |
| 4798 | - * Gets all airlines countries |
|
| 4799 | - * |
|
| 4800 | - * @return Array the airline country list |
|
| 4801 | - * |
|
| 4802 | - */ |
|
| 4798 | + * Gets all airlines countries |
|
| 4799 | + * |
|
| 4800 | + * @return Array the airline country list |
|
| 4801 | + * |
|
| 4802 | + */ |
|
| 4803 | 4803 | public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
| 4804 | 4804 | { |
| 4805 | 4805 | global $globalDBdriver; |
@@ -4854,11 +4854,11 @@ discard block |
||
| 4854 | 4854 | } |
| 4855 | 4855 | |
| 4856 | 4856 | /** |
| 4857 | - * Gets all number of flight over countries |
|
| 4858 | - * |
|
| 4859 | - * @return Array the airline country list |
|
| 4860 | - * |
|
| 4861 | - */ |
|
| 4857 | + * Gets all number of flight over countries |
|
| 4858 | + * |
|
| 4859 | + * @return Array the airline country list |
|
| 4860 | + * |
|
| 4861 | + */ |
|
| 4862 | 4862 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4863 | 4863 | { |
| 4864 | 4864 | global $globalDBdriver; |
@@ -4880,15 +4880,15 @@ discard block |
||
| 4880 | 4880 | $SpotterLive = new SpotterLive(); |
| 4881 | 4881 | $filter_query = $SpotterLive->getFilter($filters,true,true); |
| 4882 | 4882 | $filter_query .= ' over_country IS NOT NULL'; |
| 4883 | - if ($olderthanmonths > 0) { |
|
| 4883 | + if ($olderthanmonths > 0) { |
|
| 4884 | 4884 | if ($globalDBdriver == 'mysql') { |
| 4885 | 4885 | $filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4886 | 4886 | } else { |
| 4887 | 4887 | $filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4888 | 4888 | } |
| 4889 | 4889 | } |
| 4890 | - if ($sincedate != '') { |
|
| 4891 | - if ($globalDBdriver == 'mysql') { |
|
| 4890 | + if ($sincedate != '') { |
|
| 4891 | + if ($globalDBdriver == 'mysql') { |
|
| 4892 | 4892 | $filter_query .= " AND spotter_live.date > '".$sincedate."' "; |
| 4893 | 4893 | } else { |
| 4894 | 4894 | $filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4918,11 +4918,11 @@ discard block |
||
| 4918 | 4918 | |
| 4919 | 4919 | |
| 4920 | 4920 | /** |
| 4921 | - * Gets all aircraft types that have flown over |
|
| 4922 | - * |
|
| 4923 | - * @return Array the aircraft list |
|
| 4924 | - * |
|
| 4925 | - */ |
|
| 4921 | + * Gets all aircraft types that have flown over |
|
| 4922 | + * |
|
| 4923 | + * @return Array the aircraft list |
|
| 4924 | + * |
|
| 4925 | + */ |
|
| 4926 | 4926 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 4927 | 4927 | { |
| 4928 | 4928 | global $globalDBdriver; |
@@ -4992,11 +4992,11 @@ discard block |
||
| 4992 | 4992 | } |
| 4993 | 4993 | |
| 4994 | 4994 | /** |
| 4995 | - * Gets all aircraft types that have flown over by airline |
|
| 4996 | - * |
|
| 4997 | - * @return Array the aircraft list |
|
| 4998 | - * |
|
| 4999 | - */ |
|
| 4995 | + * Gets all aircraft types that have flown over by airline |
|
| 4996 | + * |
|
| 4997 | + * @return Array the aircraft list |
|
| 4998 | + * |
|
| 4999 | + */ |
|
| 5000 | 5000 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '') |
| 5001 | 5001 | { |
| 5002 | 5002 | global $globalDBdriver; |
@@ -5067,11 +5067,11 @@ discard block |
||
| 5067 | 5067 | } |
| 5068 | 5068 | |
| 5069 | 5069 | /** |
| 5070 | - * Gets all aircraft types that have flown over by months |
|
| 5071 | - * |
|
| 5072 | - * @return Array the aircraft list |
|
| 5073 | - * |
|
| 5074 | - */ |
|
| 5070 | + * Gets all aircraft types that have flown over by months |
|
| 5071 | + * |
|
| 5072 | + * @return Array the aircraft list |
|
| 5073 | + * |
|
| 5074 | + */ |
|
| 5075 | 5075 | public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5076 | 5076 | { |
| 5077 | 5077 | global $globalDBdriver; |
@@ -5115,11 +5115,11 @@ discard block |
||
| 5115 | 5115 | |
| 5116 | 5116 | |
| 5117 | 5117 | /** |
| 5118 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
| 5119 | - * |
|
| 5120 | - * @return Array the aircraft list |
|
| 5121 | - * |
|
| 5122 | - */ |
|
| 5118 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
| 5119 | + * |
|
| 5120 | + * @return Array the aircraft list |
|
| 5121 | + * |
|
| 5122 | + */ |
|
| 5123 | 5123 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
| 5124 | 5124 | { |
| 5125 | 5125 | $Image = new Image($this->db); |
@@ -5158,11 +5158,11 @@ discard block |
||
| 5158 | 5158 | |
| 5159 | 5159 | |
| 5160 | 5160 | /** |
| 5161 | - * Gets all aircraft types that have flown over by airline icao |
|
| 5162 | - * |
|
| 5163 | - * @return Array the aircraft list |
|
| 5164 | - * |
|
| 5165 | - */ |
|
| 5161 | + * Gets all aircraft types that have flown over by airline icao |
|
| 5162 | + * |
|
| 5163 | + * @return Array the aircraft list |
|
| 5164 | + * |
|
| 5165 | + */ |
|
| 5166 | 5166 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
| 5167 | 5167 | { |
| 5168 | 5168 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5191,11 +5191,11 @@ discard block |
||
| 5191 | 5191 | |
| 5192 | 5192 | |
| 5193 | 5193 | /** |
| 5194 | - * Gets all aircraft registration that have flown over by airline icao |
|
| 5195 | - * |
|
| 5196 | - * @return Array the aircraft list |
|
| 5197 | - * |
|
| 5198 | - */ |
|
| 5194 | + * Gets all aircraft registration that have flown over by airline icao |
|
| 5195 | + * |
|
| 5196 | + * @return Array the aircraft list |
|
| 5197 | + * |
|
| 5198 | + */ |
|
| 5199 | 5199 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
| 5200 | 5200 | { |
| 5201 | 5201 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5233,11 +5233,11 @@ discard block |
||
| 5233 | 5233 | |
| 5234 | 5234 | |
| 5235 | 5235 | /** |
| 5236 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 5237 | - * |
|
| 5238 | - * @return Array the aircraft list |
|
| 5239 | - * |
|
| 5240 | - */ |
|
| 5236 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 5237 | + * |
|
| 5238 | + * @return Array the aircraft list |
|
| 5239 | + * |
|
| 5240 | + */ |
|
| 5241 | 5241 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
| 5242 | 5242 | { |
| 5243 | 5243 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5265,11 +5265,11 @@ discard block |
||
| 5265 | 5265 | |
| 5266 | 5266 | |
| 5267 | 5267 | /** |
| 5268 | - * Gets all aircraft types that have flown over by airline icao |
|
| 5269 | - * |
|
| 5270 | - * @return Array the aircraft list |
|
| 5271 | - * |
|
| 5272 | - */ |
|
| 5268 | + * Gets all aircraft types that have flown over by airline icao |
|
| 5269 | + * |
|
| 5270 | + * @return Array the aircraft list |
|
| 5271 | + * |
|
| 5272 | + */ |
|
| 5273 | 5273 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
| 5274 | 5274 | { |
| 5275 | 5275 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5298,11 +5298,11 @@ discard block |
||
| 5298 | 5298 | |
| 5299 | 5299 | |
| 5300 | 5300 | /** |
| 5301 | - * Gets all aircraft registration that have flown over by airport icao |
|
| 5302 | - * |
|
| 5303 | - * @return Array the aircraft list |
|
| 5304 | - * |
|
| 5305 | - */ |
|
| 5301 | + * Gets all aircraft registration that have flown over by airport icao |
|
| 5302 | + * |
|
| 5303 | + * @return Array the aircraft list |
|
| 5304 | + * |
|
| 5305 | + */ |
|
| 5306 | 5306 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
| 5307 | 5307 | { |
| 5308 | 5308 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5339,11 +5339,11 @@ discard block |
||
| 5339 | 5339 | |
| 5340 | 5340 | |
| 5341 | 5341 | /** |
| 5342 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 5343 | - * |
|
| 5344 | - * @return Array the aircraft list |
|
| 5345 | - * |
|
| 5346 | - */ |
|
| 5342 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 5343 | + * |
|
| 5344 | + * @return Array the aircraft list |
|
| 5345 | + * |
|
| 5346 | + */ |
|
| 5347 | 5347 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
| 5348 | 5348 | { |
| 5349 | 5349 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5369,11 +5369,11 @@ discard block |
||
| 5369 | 5369 | } |
| 5370 | 5370 | |
| 5371 | 5371 | /** |
| 5372 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 5373 | - * |
|
| 5374 | - * @return Array the aircraft list |
|
| 5375 | - * |
|
| 5376 | - */ |
|
| 5372 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 5373 | + * |
|
| 5374 | + * @return Array the aircraft list |
|
| 5375 | + * |
|
| 5376 | + */ |
|
| 5377 | 5377 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 5378 | 5378 | { |
| 5379 | 5379 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5400,11 +5400,11 @@ discard block |
||
| 5400 | 5400 | |
| 5401 | 5401 | |
| 5402 | 5402 | /** |
| 5403 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5404 | - * |
|
| 5405 | - * @return Array the aircraft list |
|
| 5406 | - * |
|
| 5407 | - */ |
|
| 5403 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5404 | + * |
|
| 5405 | + * @return Array the aircraft list |
|
| 5406 | + * |
|
| 5407 | + */ |
|
| 5408 | 5408 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 5409 | 5409 | { |
| 5410 | 5410 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5440,11 +5440,11 @@ discard block |
||
| 5440 | 5440 | } |
| 5441 | 5441 | |
| 5442 | 5442 | /** |
| 5443 | - * Gets all aircraft types that have flown over by date |
|
| 5444 | - * |
|
| 5445 | - * @return Array the aircraft list |
|
| 5446 | - * |
|
| 5447 | - */ |
|
| 5443 | + * Gets all aircraft types that have flown over by date |
|
| 5444 | + * |
|
| 5445 | + * @return Array the aircraft list |
|
| 5446 | + * |
|
| 5447 | + */ |
|
| 5448 | 5448 | public function countAllAircraftTypesByDate($date,$filters = array()) |
| 5449 | 5449 | { |
| 5450 | 5450 | global $globalTimezone, $globalDBdriver; |
@@ -5486,11 +5486,11 @@ discard block |
||
| 5486 | 5486 | |
| 5487 | 5487 | |
| 5488 | 5488 | /** |
| 5489 | - * Gets all aircraft registration that have flown over by date |
|
| 5490 | - * |
|
| 5491 | - * @return Array the aircraft list |
|
| 5492 | - * |
|
| 5493 | - */ |
|
| 5489 | + * Gets all aircraft registration that have flown over by date |
|
| 5490 | + * |
|
| 5491 | + * @return Array the aircraft list |
|
| 5492 | + * |
|
| 5493 | + */ |
|
| 5494 | 5494 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
| 5495 | 5495 | { |
| 5496 | 5496 | global $globalTimezone, $globalDBdriver; |
@@ -5541,11 +5541,11 @@ discard block |
||
| 5541 | 5541 | |
| 5542 | 5542 | |
| 5543 | 5543 | /** |
| 5544 | - * Gets all aircraft manufacturer that have flown over by date |
|
| 5545 | - * |
|
| 5546 | - * @return Array the aircraft manufacturer list |
|
| 5547 | - * |
|
| 5548 | - */ |
|
| 5544 | + * Gets all aircraft manufacturer that have flown over by date |
|
| 5545 | + * |
|
| 5546 | + * @return Array the aircraft manufacturer list |
|
| 5547 | + * |
|
| 5548 | + */ |
|
| 5549 | 5549 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
| 5550 | 5550 | { |
| 5551 | 5551 | global $globalTimezone, $globalDBdriver; |
@@ -5587,11 +5587,11 @@ discard block |
||
| 5587 | 5587 | |
| 5588 | 5588 | |
| 5589 | 5589 | /** |
| 5590 | - * Gets all aircraft types that have flown over by ident/callsign |
|
| 5591 | - * |
|
| 5592 | - * @return Array the aircraft list |
|
| 5593 | - * |
|
| 5594 | - */ |
|
| 5590 | + * Gets all aircraft types that have flown over by ident/callsign |
|
| 5591 | + * |
|
| 5592 | + * @return Array the aircraft list |
|
| 5593 | + * |
|
| 5594 | + */ |
|
| 5595 | 5595 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
| 5596 | 5596 | { |
| 5597 | 5597 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5619,11 +5619,11 @@ discard block |
||
| 5619 | 5619 | } |
| 5620 | 5620 | |
| 5621 | 5621 | /** |
| 5622 | - * Gets all aircraft types that have flown over by pilot |
|
| 5623 | - * |
|
| 5624 | - * @return Array the aircraft list |
|
| 5625 | - * |
|
| 5626 | - */ |
|
| 5622 | + * Gets all aircraft types that have flown over by pilot |
|
| 5623 | + * |
|
| 5624 | + * @return Array the aircraft list |
|
| 5625 | + * |
|
| 5626 | + */ |
|
| 5627 | 5627 | public function countAllAircraftTypesByPilot($pilot,$filters = array()) |
| 5628 | 5628 | { |
| 5629 | 5629 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5639,11 +5639,11 @@ discard block |
||
| 5639 | 5639 | } |
| 5640 | 5640 | |
| 5641 | 5641 | /** |
| 5642 | - * Gets all aircraft types that have flown over by owner |
|
| 5643 | - * |
|
| 5644 | - * @return Array the aircraft list |
|
| 5645 | - * |
|
| 5646 | - */ |
|
| 5642 | + * Gets all aircraft types that have flown over by owner |
|
| 5643 | + * |
|
| 5644 | + * @return Array the aircraft list |
|
| 5645 | + * |
|
| 5646 | + */ |
|
| 5647 | 5647 | public function countAllAircraftTypesByOwner($owner,$filters = array()) |
| 5648 | 5648 | { |
| 5649 | 5649 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5659,11 +5659,11 @@ discard block |
||
| 5659 | 5659 | } |
| 5660 | 5660 | |
| 5661 | 5661 | /** |
| 5662 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5663 | - * |
|
| 5664 | - * @return Array the aircraft list |
|
| 5665 | - * |
|
| 5666 | - */ |
|
| 5662 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5663 | + * |
|
| 5664 | + * @return Array the aircraft list |
|
| 5665 | + * |
|
| 5666 | + */ |
|
| 5667 | 5667 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
| 5668 | 5668 | { |
| 5669 | 5669 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5702,11 +5702,11 @@ discard block |
||
| 5702 | 5702 | } |
| 5703 | 5703 | |
| 5704 | 5704 | /** |
| 5705 | - * Gets all aircraft registration that have flown over by owner |
|
| 5706 | - * |
|
| 5707 | - * @return Array the aircraft list |
|
| 5708 | - * |
|
| 5709 | - */ |
|
| 5705 | + * Gets all aircraft registration that have flown over by owner |
|
| 5706 | + * |
|
| 5707 | + * @return Array the aircraft list |
|
| 5708 | + * |
|
| 5709 | + */ |
|
| 5710 | 5710 | public function countAllAircraftRegistrationByOwner($owner,$filters = array()) |
| 5711 | 5711 | { |
| 5712 | 5712 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5746,11 +5746,11 @@ discard block |
||
| 5746 | 5746 | } |
| 5747 | 5747 | |
| 5748 | 5748 | /** |
| 5749 | - * Gets all aircraft registration that have flown over by pilot |
|
| 5750 | - * |
|
| 5751 | - * @return Array the aircraft list |
|
| 5752 | - * |
|
| 5753 | - */ |
|
| 5749 | + * Gets all aircraft registration that have flown over by pilot |
|
| 5750 | + * |
|
| 5751 | + * @return Array the aircraft list |
|
| 5752 | + * |
|
| 5753 | + */ |
|
| 5754 | 5754 | public function countAllAircraftRegistrationByPilot($pilot,$filters = array()) |
| 5755 | 5755 | { |
| 5756 | 5756 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5791,11 +5791,11 @@ discard block |
||
| 5791 | 5791 | |
| 5792 | 5792 | |
| 5793 | 5793 | /** |
| 5794 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 5795 | - * |
|
| 5796 | - * @return Array the aircraft manufacturer list |
|
| 5797 | - * |
|
| 5798 | - */ |
|
| 5794 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 5795 | + * |
|
| 5796 | + * @return Array the aircraft manufacturer list |
|
| 5797 | + * |
|
| 5798 | + */ |
|
| 5799 | 5799 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
| 5800 | 5800 | { |
| 5801 | 5801 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5820,11 +5820,11 @@ discard block |
||
| 5820 | 5820 | } |
| 5821 | 5821 | |
| 5822 | 5822 | /** |
| 5823 | - * Gets all aircraft manufacturer that have flown over by owner |
|
| 5824 | - * |
|
| 5825 | - * @return Array the aircraft manufacturer list |
|
| 5826 | - * |
|
| 5827 | - */ |
|
| 5823 | + * Gets all aircraft manufacturer that have flown over by owner |
|
| 5824 | + * |
|
| 5825 | + * @return Array the aircraft manufacturer list |
|
| 5826 | + * |
|
| 5827 | + */ |
|
| 5828 | 5828 | public function countAllAircraftManufacturerByOwner($owner,$filters = array()) |
| 5829 | 5829 | { |
| 5830 | 5830 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5841,11 +5841,11 @@ discard block |
||
| 5841 | 5841 | } |
| 5842 | 5842 | |
| 5843 | 5843 | /** |
| 5844 | - * Gets all aircraft manufacturer that have flown over by pilot |
|
| 5845 | - * |
|
| 5846 | - * @return Array the aircraft manufacturer list |
|
| 5847 | - * |
|
| 5848 | - */ |
|
| 5844 | + * Gets all aircraft manufacturer that have flown over by pilot |
|
| 5845 | + * |
|
| 5846 | + * @return Array the aircraft manufacturer list |
|
| 5847 | + * |
|
| 5848 | + */ |
|
| 5849 | 5849 | public function countAllAircraftManufacturerByPilot($pilot,$filters = array()) |
| 5850 | 5850 | { |
| 5851 | 5851 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5863,11 +5863,11 @@ discard block |
||
| 5863 | 5863 | |
| 5864 | 5864 | |
| 5865 | 5865 | /** |
| 5866 | - * Gets all aircraft types that have flown over by route |
|
| 5867 | - * |
|
| 5868 | - * @return Array the aircraft list |
|
| 5869 | - * |
|
| 5870 | - */ |
|
| 5866 | + * Gets all aircraft types that have flown over by route |
|
| 5867 | + * |
|
| 5868 | + * @return Array the aircraft list |
|
| 5869 | + * |
|
| 5870 | + */ |
|
| 5871 | 5871 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5872 | 5872 | { |
| 5873 | 5873 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5896,11 +5896,11 @@ discard block |
||
| 5896 | 5896 | } |
| 5897 | 5897 | |
| 5898 | 5898 | /** |
| 5899 | - * Gets all aircraft registration that have flown over by route |
|
| 5900 | - * |
|
| 5901 | - * @return Array the aircraft list |
|
| 5902 | - * |
|
| 5903 | - */ |
|
| 5899 | + * Gets all aircraft registration that have flown over by route |
|
| 5900 | + * |
|
| 5901 | + * @return Array the aircraft list |
|
| 5902 | + * |
|
| 5903 | + */ |
|
| 5904 | 5904 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5905 | 5905 | { |
| 5906 | 5906 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5942,11 +5942,11 @@ discard block |
||
| 5942 | 5942 | |
| 5943 | 5943 | |
| 5944 | 5944 | /** |
| 5945 | - * Gets all aircraft manufacturer that have flown over by route |
|
| 5946 | - * |
|
| 5947 | - * @return Array the aircraft manufacturer list |
|
| 5948 | - * |
|
| 5949 | - */ |
|
| 5945 | + * Gets all aircraft manufacturer that have flown over by route |
|
| 5946 | + * |
|
| 5947 | + * @return Array the aircraft manufacturer list |
|
| 5948 | + * |
|
| 5949 | + */ |
|
| 5950 | 5950 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 5951 | 5951 | { |
| 5952 | 5952 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5980,11 +5980,11 @@ discard block |
||
| 5980 | 5980 | |
| 5981 | 5981 | |
| 5982 | 5982 | /** |
| 5983 | - * Gets all aircraft types that have flown over by country |
|
| 5984 | - * |
|
| 5985 | - * @return Array the aircraft list |
|
| 5986 | - * |
|
| 5987 | - */ |
|
| 5983 | + * Gets all aircraft types that have flown over by country |
|
| 5984 | + * |
|
| 5985 | + * @return Array the aircraft list |
|
| 5986 | + * |
|
| 5987 | + */ |
|
| 5988 | 5988 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
| 5989 | 5989 | { |
| 5990 | 5990 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6015,11 +6015,11 @@ discard block |
||
| 6015 | 6015 | |
| 6016 | 6016 | |
| 6017 | 6017 | /** |
| 6018 | - * Gets all aircraft registration that have flown over by country |
|
| 6019 | - * |
|
| 6020 | - * @return Array the aircraft list |
|
| 6021 | - * |
|
| 6022 | - */ |
|
| 6018 | + * Gets all aircraft registration that have flown over by country |
|
| 6019 | + * |
|
| 6020 | + * @return Array the aircraft list |
|
| 6021 | + * |
|
| 6022 | + */ |
|
| 6023 | 6023 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
| 6024 | 6024 | { |
| 6025 | 6025 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6059,11 +6059,11 @@ discard block |
||
| 6059 | 6059 | |
| 6060 | 6060 | |
| 6061 | 6061 | /** |
| 6062 | - * Gets all aircraft manufacturer that have flown over by country |
|
| 6063 | - * |
|
| 6064 | - * @return Array the aircraft manufacturer list |
|
| 6065 | - * |
|
| 6066 | - */ |
|
| 6062 | + * Gets all aircraft manufacturer that have flown over by country |
|
| 6063 | + * |
|
| 6064 | + * @return Array the aircraft manufacturer list |
|
| 6065 | + * |
|
| 6066 | + */ |
|
| 6067 | 6067 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
| 6068 | 6068 | { |
| 6069 | 6069 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6094,18 +6094,18 @@ discard block |
||
| 6094 | 6094 | |
| 6095 | 6095 | |
| 6096 | 6096 | /** |
| 6097 | - * Gets all aircraft manufacturers that have flown over |
|
| 6098 | - * |
|
| 6099 | - * @return Array the aircraft list |
|
| 6100 | - * |
|
| 6101 | - */ |
|
| 6097 | + * Gets all aircraft manufacturers that have flown over |
|
| 6098 | + * |
|
| 6099 | + * @return Array the aircraft list |
|
| 6100 | + * |
|
| 6101 | + */ |
|
| 6102 | 6102 | public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '') |
| 6103 | 6103 | { |
| 6104 | 6104 | global $globalDBdriver; |
| 6105 | 6105 | $filter_query = $this->getFilter($filters,true,true); |
| 6106 | 6106 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
| 6107 | 6107 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 6108 | - $query_values = array(); |
|
| 6108 | + $query_values = array(); |
|
| 6109 | 6109 | if ($year != '') { |
| 6110 | 6110 | if ($globalDBdriver == 'mysql') { |
| 6111 | 6111 | $query .= " AND YEAR(spotter_output.date) = :year"; |
@@ -6158,11 +6158,11 @@ discard block |
||
| 6158 | 6158 | |
| 6159 | 6159 | |
| 6160 | 6160 | /** |
| 6161 | - * Gets all aircraft registrations that have flown over |
|
| 6162 | - * |
|
| 6163 | - * @return Array the aircraft list |
|
| 6164 | - * |
|
| 6165 | - */ |
|
| 6161 | + * Gets all aircraft registrations that have flown over |
|
| 6162 | + * |
|
| 6163 | + * @return Array the aircraft list |
|
| 6164 | + * |
|
| 6165 | + */ |
|
| 6166 | 6166 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 6167 | 6167 | { |
| 6168 | 6168 | global $globalDBdriver; |
@@ -6170,15 +6170,15 @@ discard block |
||
| 6170 | 6170 | $filter_query = $this->getFilter($filters,true,true); |
| 6171 | 6171 | $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 6172 | 6172 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 6173 | - if ($olderthanmonths > 0) { |
|
| 6174 | - if ($globalDBdriver == 'mysql') { |
|
| 6173 | + if ($olderthanmonths > 0) { |
|
| 6174 | + if ($globalDBdriver == 'mysql') { |
|
| 6175 | 6175 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6176 | 6176 | } else { |
| 6177 | 6177 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6178 | 6178 | } |
| 6179 | 6179 | } |
| 6180 | - if ($sincedate != '') { |
|
| 6181 | - if ($globalDBdriver == 'mysql') { |
|
| 6180 | + if ($sincedate != '') { |
|
| 6181 | + if ($globalDBdriver == 'mysql') { |
|
| 6182 | 6182 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6183 | 6183 | } else { |
| 6184 | 6184 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6243,11 +6243,11 @@ discard block |
||
| 6243 | 6243 | |
| 6244 | 6244 | |
| 6245 | 6245 | /** |
| 6246 | - * Gets all aircraft registrations that have flown over |
|
| 6247 | - * |
|
| 6248 | - * @return Array the aircraft list |
|
| 6249 | - * |
|
| 6250 | - */ |
|
| 6246 | + * Gets all aircraft registrations that have flown over |
|
| 6247 | + * |
|
| 6248 | + * @return Array the aircraft list |
|
| 6249 | + * |
|
| 6250 | + */ |
|
| 6251 | 6251 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 6252 | 6252 | { |
| 6253 | 6253 | global $globalDBdriver; |
@@ -6255,15 +6255,15 @@ discard block |
||
| 6255 | 6255 | $Image = new Image($this->db); |
| 6256 | 6256 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 6257 | 6257 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 6258 | - if ($olderthanmonths > 0) { |
|
| 6259 | - if ($globalDBdriver == 'mysql') { |
|
| 6258 | + if ($olderthanmonths > 0) { |
|
| 6259 | + if ($globalDBdriver == 'mysql') { |
|
| 6260 | 6260 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6261 | 6261 | } else { |
| 6262 | 6262 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6263 | 6263 | } |
| 6264 | 6264 | } |
| 6265 | - if ($sincedate != '') { |
|
| 6266 | - if ($globalDBdriver == 'mysql') { |
|
| 6265 | + if ($sincedate != '') { |
|
| 6266 | + if ($globalDBdriver == 'mysql') { |
|
| 6267 | 6267 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6268 | 6268 | } else { |
| 6269 | 6269 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6272,7 +6272,7 @@ discard block |
||
| 6272 | 6272 | |
| 6273 | 6273 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6274 | 6274 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6275 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 6275 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 6276 | 6276 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6277 | 6277 | |
| 6278 | 6278 | $sth = $this->db->prepare($query); |
@@ -6304,26 +6304,26 @@ discard block |
||
| 6304 | 6304 | |
| 6305 | 6305 | |
| 6306 | 6306 | /** |
| 6307 | - * Gets all departure airports of the airplanes that have flown over |
|
| 6308 | - * |
|
| 6309 | - * @return Array the airport list |
|
| 6310 | - * |
|
| 6311 | - */ |
|
| 6307 | + * Gets all departure airports of the airplanes that have flown over |
|
| 6308 | + * |
|
| 6309 | + * @return Array the airport list |
|
| 6310 | + * |
|
| 6311 | + */ |
|
| 6312 | 6312 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 6313 | 6313 | { |
| 6314 | 6314 | global $globalDBdriver; |
| 6315 | 6315 | $filter_query = $this->getFilter($filters,true,true); |
| 6316 | 6316 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6317 | 6317 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 6318 | - if ($olderthanmonths > 0) { |
|
| 6319 | - if ($globalDBdriver == 'mysql') { |
|
| 6318 | + if ($olderthanmonths > 0) { |
|
| 6319 | + if ($globalDBdriver == 'mysql') { |
|
| 6320 | 6320 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6321 | 6321 | } else { |
| 6322 | 6322 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6323 | 6323 | } |
| 6324 | - } |
|
| 6325 | - if ($sincedate != '') { |
|
| 6326 | - if ($globalDBdriver == 'mysql') { |
|
| 6324 | + } |
|
| 6325 | + if ($sincedate != '') { |
|
| 6326 | + if ($globalDBdriver == 'mysql') { |
|
| 6327 | 6327 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6328 | 6328 | } else { |
| 6329 | 6329 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6357,7 +6357,7 @@ discard block |
||
| 6357 | 6357 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6358 | 6358 | } |
| 6359 | 6359 | } |
| 6360 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6360 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6361 | 6361 | ORDER BY airport_departure_icao_count DESC"; |
| 6362 | 6362 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6363 | 6363 | |
@@ -6380,35 +6380,35 @@ discard block |
||
| 6380 | 6380 | } |
| 6381 | 6381 | |
| 6382 | 6382 | /** |
| 6383 | - * Gets all departure airports of the airplanes that have flown over |
|
| 6384 | - * |
|
| 6385 | - * @return Array the airport list |
|
| 6386 | - * |
|
| 6387 | - */ |
|
| 6383 | + * Gets all departure airports of the airplanes that have flown over |
|
| 6384 | + * |
|
| 6385 | + * @return Array the airport list |
|
| 6386 | + * |
|
| 6387 | + */ |
|
| 6388 | 6388 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 6389 | 6389 | { |
| 6390 | 6390 | global $globalDBdriver; |
| 6391 | 6391 | $filter_query = $this->getFilter($filters,true,true); |
| 6392 | 6392 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6393 | 6393 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' "; |
| 6394 | - if ($olderthanmonths > 0) { |
|
| 6395 | - if ($globalDBdriver == 'mysql') { |
|
| 6394 | + if ($olderthanmonths > 0) { |
|
| 6395 | + if ($globalDBdriver == 'mysql') { |
|
| 6396 | 6396 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6397 | 6397 | } else { |
| 6398 | 6398 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6399 | 6399 | } |
| 6400 | - } |
|
| 6401 | - if ($sincedate != '') { |
|
| 6402 | - if ($globalDBdriver == 'mysql') { |
|
| 6400 | + } |
|
| 6401 | + if ($sincedate != '') { |
|
| 6402 | + if ($globalDBdriver == 'mysql') { |
|
| 6403 | 6403 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6404 | 6404 | } else { |
| 6405 | 6405 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6406 | 6406 | } |
| 6407 | 6407 | } |
| 6408 | 6408 | |
| 6409 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6410 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6411 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6409 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6410 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6411 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6412 | 6412 | ORDER BY airport_departure_icao_count DESC"; |
| 6413 | 6413 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6414 | 6414 | |
@@ -6433,26 +6433,26 @@ discard block |
||
| 6433 | 6433 | } |
| 6434 | 6434 | |
| 6435 | 6435 | /** |
| 6436 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 6437 | - * |
|
| 6438 | - * @return Array the airport list |
|
| 6439 | - * |
|
| 6440 | - */ |
|
| 6436 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 6437 | + * |
|
| 6438 | + * @return Array the airport list |
|
| 6439 | + * |
|
| 6440 | + */ |
|
| 6441 | 6441 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 6442 | 6442 | { |
| 6443 | 6443 | global $globalDBdriver; |
| 6444 | 6444 | $filter_query = $this->getFilter($filters,true,true); |
| 6445 | 6445 | $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
| 6446 | 6446 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
| 6447 | - if ($olderthanmonths > 0) { |
|
| 6448 | - if ($globalDBdriver == 'mysql') { |
|
| 6447 | + if ($olderthanmonths > 0) { |
|
| 6448 | + if ($globalDBdriver == 'mysql') { |
|
| 6449 | 6449 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6450 | 6450 | } else { |
| 6451 | 6451 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6452 | 6452 | } |
| 6453 | - } |
|
| 6454 | - if ($sincedate != '') { |
|
| 6455 | - if ($globalDBdriver == 'mysql') { |
|
| 6453 | + } |
|
| 6454 | + if ($sincedate != '') { |
|
| 6455 | + if ($globalDBdriver == 'mysql') { |
|
| 6456 | 6456 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6457 | 6457 | } else { |
| 6458 | 6458 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6486,10 +6486,10 @@ discard block |
||
| 6486 | 6486 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6487 | 6487 | } |
| 6488 | 6488 | } |
| 6489 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6489 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6490 | 6490 | ORDER BY airport_departure_icao_count DESC"; |
| 6491 | 6491 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6492 | - //echo $query; |
|
| 6492 | + //echo $query; |
|
| 6493 | 6493 | $sth = $this->db->prepare($query); |
| 6494 | 6494 | $sth->execute($query_values); |
| 6495 | 6495 | |
@@ -6510,35 +6510,35 @@ discard block |
||
| 6510 | 6510 | } |
| 6511 | 6511 | |
| 6512 | 6512 | /** |
| 6513 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 6514 | - * |
|
| 6515 | - * @return Array the airport list |
|
| 6516 | - * |
|
| 6517 | - */ |
|
| 6513 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 6514 | + * |
|
| 6515 | + * @return Array the airport list |
|
| 6516 | + * |
|
| 6517 | + */ |
|
| 6518 | 6518 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 6519 | 6519 | { |
| 6520 | 6520 | global $globalDBdriver; |
| 6521 | 6521 | $filter_query = $this->getFilter($filters,true,true); |
| 6522 | 6522 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
| 6523 | 6523 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
| 6524 | - if ($olderthanmonths > 0) { |
|
| 6525 | - if ($globalDBdriver == 'mysql') { |
|
| 6524 | + if ($olderthanmonths > 0) { |
|
| 6525 | + if ($globalDBdriver == 'mysql') { |
|
| 6526 | 6526 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6527 | 6527 | } else { |
| 6528 | 6528 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6529 | 6529 | } |
| 6530 | - } |
|
| 6531 | - if ($sincedate != '') { |
|
| 6532 | - if ($globalDBdriver == 'mysql') { |
|
| 6530 | + } |
|
| 6531 | + if ($sincedate != '') { |
|
| 6532 | + if ($globalDBdriver == 'mysql') { |
|
| 6533 | 6533 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6534 | 6534 | } else { |
| 6535 | 6535 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
| 6536 | 6536 | } |
| 6537 | 6537 | } |
| 6538 | 6538 | |
| 6539 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6540 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6541 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6539 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6540 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6541 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6542 | 6542 | ORDER BY airport_departure_icao_count DESC"; |
| 6543 | 6543 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6544 | 6544 | |
@@ -6563,11 +6563,11 @@ discard block |
||
| 6563 | 6563 | } |
| 6564 | 6564 | |
| 6565 | 6565 | /** |
| 6566 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 6567 | - * |
|
| 6568 | - * @return Array the airport list |
|
| 6569 | - * |
|
| 6570 | - */ |
|
| 6566 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 6567 | + * |
|
| 6568 | + * @return Array the airport list |
|
| 6569 | + * |
|
| 6570 | + */ |
|
| 6571 | 6571 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
| 6572 | 6572 | { |
| 6573 | 6573 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6601,11 +6601,11 @@ discard block |
||
| 6601 | 6601 | |
| 6602 | 6602 | |
| 6603 | 6603 | /** |
| 6604 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 6605 | - * |
|
| 6606 | - * @return Array the airport list |
|
| 6607 | - * |
|
| 6608 | - */ |
|
| 6604 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 6605 | + * |
|
| 6606 | + * @return Array the airport list |
|
| 6607 | + * |
|
| 6608 | + */ |
|
| 6609 | 6609 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
| 6610 | 6610 | { |
| 6611 | 6611 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6636,11 +6636,11 @@ discard block |
||
| 6636 | 6636 | |
| 6637 | 6637 | |
| 6638 | 6638 | /** |
| 6639 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 6640 | - * |
|
| 6641 | - * @return Array the airport list |
|
| 6642 | - * |
|
| 6643 | - */ |
|
| 6639 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 6640 | + * |
|
| 6641 | + * @return Array the airport list |
|
| 6642 | + * |
|
| 6643 | + */ |
|
| 6644 | 6644 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
| 6645 | 6645 | { |
| 6646 | 6646 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6673,11 +6673,11 @@ discard block |
||
| 6673 | 6673 | |
| 6674 | 6674 | |
| 6675 | 6675 | /** |
| 6676 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6677 | - * |
|
| 6678 | - * @return Array the airport list |
|
| 6679 | - * |
|
| 6680 | - */ |
|
| 6676 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6677 | + * |
|
| 6678 | + * @return Array the airport list |
|
| 6679 | + * |
|
| 6680 | + */ |
|
| 6681 | 6681 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 6682 | 6682 | { |
| 6683 | 6683 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6707,11 +6707,11 @@ discard block |
||
| 6707 | 6707 | |
| 6708 | 6708 | |
| 6709 | 6709 | /** |
| 6710 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 6711 | - * |
|
| 6712 | - * @return Array the airport list |
|
| 6713 | - * |
|
| 6714 | - */ |
|
| 6710 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 6711 | + * |
|
| 6712 | + * @return Array the airport list |
|
| 6713 | + * |
|
| 6714 | + */ |
|
| 6715 | 6715 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
| 6716 | 6716 | { |
| 6717 | 6717 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6744,11 +6744,11 @@ discard block |
||
| 6744 | 6744 | |
| 6745 | 6745 | |
| 6746 | 6746 | /** |
| 6747 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6748 | - * |
|
| 6749 | - * @return Array the airport list |
|
| 6750 | - * |
|
| 6751 | - */ |
|
| 6747 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 6748 | + * |
|
| 6749 | + * @return Array the airport list |
|
| 6750 | + * |
|
| 6751 | + */ |
|
| 6752 | 6752 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
| 6753 | 6753 | { |
| 6754 | 6754 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6778,11 +6778,11 @@ discard block |
||
| 6778 | 6778 | |
| 6779 | 6779 | |
| 6780 | 6780 | /** |
| 6781 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 6782 | - * |
|
| 6783 | - * @return Array the airport list |
|
| 6784 | - * |
|
| 6785 | - */ |
|
| 6781 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 6782 | + * |
|
| 6783 | + * @return Array the airport list |
|
| 6784 | + * |
|
| 6785 | + */ |
|
| 6786 | 6786 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
| 6787 | 6787 | { |
| 6788 | 6788 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6815,11 +6815,11 @@ discard block |
||
| 6815 | 6815 | |
| 6816 | 6816 | |
| 6817 | 6817 | /** |
| 6818 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 6819 | - * |
|
| 6820 | - * @return Array the airport list |
|
| 6821 | - * |
|
| 6822 | - */ |
|
| 6818 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 6819 | + * |
|
| 6820 | + * @return Array the airport list |
|
| 6821 | + * |
|
| 6822 | + */ |
|
| 6823 | 6823 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
| 6824 | 6824 | { |
| 6825 | 6825 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6850,11 +6850,11 @@ discard block |
||
| 6850 | 6850 | |
| 6851 | 6851 | |
| 6852 | 6852 | /** |
| 6853 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6854 | - * |
|
| 6855 | - * @return Array the airport list |
|
| 6856 | - * |
|
| 6857 | - */ |
|
| 6853 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6854 | + * |
|
| 6855 | + * @return Array the airport list |
|
| 6856 | + * |
|
| 6857 | + */ |
|
| 6858 | 6858 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6859 | 6859 | { |
| 6860 | 6860 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6887,11 +6887,11 @@ discard block |
||
| 6887 | 6887 | |
| 6888 | 6888 | |
| 6889 | 6889 | /** |
| 6890 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6891 | - * |
|
| 6892 | - * @return Array the airport list |
|
| 6893 | - * |
|
| 6894 | - */ |
|
| 6890 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 6891 | + * |
|
| 6892 | + * @return Array the airport list |
|
| 6893 | + * |
|
| 6894 | + */ |
|
| 6895 | 6895 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 6896 | 6896 | { |
| 6897 | 6897 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6921,11 +6921,11 @@ discard block |
||
| 6921 | 6921 | |
| 6922 | 6922 | |
| 6923 | 6923 | /** |
| 6924 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 6925 | - * |
|
| 6926 | - * @return Array the airport list |
|
| 6927 | - * |
|
| 6928 | - */ |
|
| 6924 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 6925 | + * |
|
| 6926 | + * @return Array the airport list |
|
| 6927 | + * |
|
| 6928 | + */ |
|
| 6929 | 6929 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
| 6930 | 6930 | { |
| 6931 | 6931 | global $globalTimezone, $globalDBdriver; |
@@ -6971,11 +6971,11 @@ discard block |
||
| 6971 | 6971 | |
| 6972 | 6972 | |
| 6973 | 6973 | /** |
| 6974 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 6975 | - * |
|
| 6976 | - * @return Array the airport list |
|
| 6977 | - * |
|
| 6978 | - */ |
|
| 6974 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 6975 | + * |
|
| 6976 | + * @return Array the airport list |
|
| 6977 | + * |
|
| 6978 | + */ |
|
| 6979 | 6979 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
| 6980 | 6980 | { |
| 6981 | 6981 | global $globalTimezone, $globalDBdriver; |
@@ -7018,11 +7018,11 @@ discard block |
||
| 7018 | 7018 | |
| 7019 | 7019 | |
| 7020 | 7020 | /** |
| 7021 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 7022 | - * |
|
| 7023 | - * @return Array the airport list |
|
| 7024 | - * |
|
| 7025 | - */ |
|
| 7021 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 7022 | + * |
|
| 7023 | + * @return Array the airport list |
|
| 7024 | + * |
|
| 7025 | + */ |
|
| 7026 | 7026 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
| 7027 | 7027 | { |
| 7028 | 7028 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7054,11 +7054,11 @@ discard block |
||
| 7054 | 7054 | } |
| 7055 | 7055 | |
| 7056 | 7056 | /** |
| 7057 | - * Gets all departure airports of the airplanes that have flown over based on a owner |
|
| 7058 | - * |
|
| 7059 | - * @return Array the airport list |
|
| 7060 | - * |
|
| 7061 | - */ |
|
| 7057 | + * Gets all departure airports of the airplanes that have flown over based on a owner |
|
| 7058 | + * |
|
| 7059 | + * @return Array the airport list |
|
| 7060 | + * |
|
| 7061 | + */ |
|
| 7062 | 7062 | public function countAllDepartureAirportsByOwner($owner,$filters = array()) |
| 7063 | 7063 | { |
| 7064 | 7064 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7090,11 +7090,11 @@ discard block |
||
| 7090 | 7090 | } |
| 7091 | 7091 | |
| 7092 | 7092 | /** |
| 7093 | - * Gets all departure airports of the airplanes that have flown over based on a pilot |
|
| 7094 | - * |
|
| 7095 | - * @return Array the airport list |
|
| 7096 | - * |
|
| 7097 | - */ |
|
| 7093 | + * Gets all departure airports of the airplanes that have flown over based on a pilot |
|
| 7094 | + * |
|
| 7095 | + * @return Array the airport list |
|
| 7096 | + * |
|
| 7097 | + */ |
|
| 7098 | 7098 | public function countAllDepartureAirportsByPilot($pilot,$filters = array()) |
| 7099 | 7099 | { |
| 7100 | 7100 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7127,11 +7127,11 @@ discard block |
||
| 7127 | 7127 | |
| 7128 | 7128 | |
| 7129 | 7129 | /** |
| 7130 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7131 | - * |
|
| 7132 | - * @return Array the airport list |
|
| 7133 | - * |
|
| 7134 | - */ |
|
| 7130 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7131 | + * |
|
| 7132 | + * @return Array the airport list |
|
| 7133 | + * |
|
| 7134 | + */ |
|
| 7135 | 7135 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
| 7136 | 7136 | { |
| 7137 | 7137 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7160,11 +7160,11 @@ discard block |
||
| 7160 | 7160 | } |
| 7161 | 7161 | |
| 7162 | 7162 | /** |
| 7163 | - * Gets all departure airports by country of the airplanes that have flown over based on owner |
|
| 7164 | - * |
|
| 7165 | - * @return Array the airport list |
|
| 7166 | - * |
|
| 7167 | - */ |
|
| 7163 | + * Gets all departure airports by country of the airplanes that have flown over based on owner |
|
| 7164 | + * |
|
| 7165 | + * @return Array the airport list |
|
| 7166 | + * |
|
| 7167 | + */ |
|
| 7168 | 7168 | public function countAllDepartureAirportCountriesByOwner($owner,$filters = array()) |
| 7169 | 7169 | { |
| 7170 | 7170 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7180,11 +7180,11 @@ discard block |
||
| 7180 | 7180 | } |
| 7181 | 7181 | |
| 7182 | 7182 | /** |
| 7183 | - * Gets all departure airports by country of the airplanes that have flown over based on pilot |
|
| 7184 | - * |
|
| 7185 | - * @return Array the airport list |
|
| 7186 | - * |
|
| 7187 | - */ |
|
| 7183 | + * Gets all departure airports by country of the airplanes that have flown over based on pilot |
|
| 7184 | + * |
|
| 7185 | + * @return Array the airport list |
|
| 7186 | + * |
|
| 7187 | + */ |
|
| 7188 | 7188 | public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array()) |
| 7189 | 7189 | { |
| 7190 | 7190 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7202,11 +7202,11 @@ discard block |
||
| 7202 | 7202 | |
| 7203 | 7203 | |
| 7204 | 7204 | /** |
| 7205 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 7206 | - * |
|
| 7207 | - * @return Array the airport list |
|
| 7208 | - * |
|
| 7209 | - */ |
|
| 7205 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 7206 | + * |
|
| 7207 | + * @return Array the airport list |
|
| 7208 | + * |
|
| 7209 | + */ |
|
| 7210 | 7210 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
| 7211 | 7211 | { |
| 7212 | 7212 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7240,11 +7240,11 @@ discard block |
||
| 7240 | 7240 | |
| 7241 | 7241 | |
| 7242 | 7242 | /** |
| 7243 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7244 | - * |
|
| 7245 | - * @return Array the airport list |
|
| 7246 | - * |
|
| 7247 | - */ |
|
| 7243 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7244 | + * |
|
| 7245 | + * @return Array the airport list |
|
| 7246 | + * |
|
| 7247 | + */ |
|
| 7248 | 7248 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
| 7249 | 7249 | { |
| 7250 | 7250 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7274,31 +7274,31 @@ discard block |
||
| 7274 | 7274 | |
| 7275 | 7275 | |
| 7276 | 7276 | /** |
| 7277 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 7278 | - * |
|
| 7279 | - * @param Boolean $limit Limit result to 10 or not |
|
| 7280 | - * @param Integer $olderthanmonths Only show result older than x months |
|
| 7281 | - * @param String $sincedate Only show result since x date |
|
| 7282 | - * @param Boolean $icaoaskey Show result by ICAO |
|
| 7283 | - * @param Array $filters Filter used here |
|
| 7284 | - * @return Array the airport list |
|
| 7285 | - * |
|
| 7286 | - */ |
|
| 7277 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 7278 | + * |
|
| 7279 | + * @param Boolean $limit Limit result to 10 or not |
|
| 7280 | + * @param Integer $olderthanmonths Only show result older than x months |
|
| 7281 | + * @param String $sincedate Only show result since x date |
|
| 7282 | + * @param Boolean $icaoaskey Show result by ICAO |
|
| 7283 | + * @param Array $filters Filter used here |
|
| 7284 | + * @return Array the airport list |
|
| 7285 | + * |
|
| 7286 | + */ |
|
| 7287 | 7287 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
| 7288 | 7288 | { |
| 7289 | 7289 | global $globalDBdriver; |
| 7290 | 7290 | $filter_query = $this->getFilter($filters,true,true); |
| 7291 | 7291 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7292 | 7292 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 7293 | - if ($olderthanmonths > 0) { |
|
| 7294 | - if ($globalDBdriver == 'mysql') { |
|
| 7293 | + if ($olderthanmonths > 0) { |
|
| 7294 | + if ($globalDBdriver == 'mysql') { |
|
| 7295 | 7295 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 7296 | 7296 | } else { |
| 7297 | 7297 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 7298 | 7298 | } |
| 7299 | 7299 | } |
| 7300 | - if ($sincedate != '') { |
|
| 7301 | - if ($globalDBdriver == 'mysql') { |
|
| 7300 | + if ($sincedate != '') { |
|
| 7301 | + if ($globalDBdriver == 'mysql') { |
|
| 7302 | 7302 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 7303 | 7303 | } else { |
| 7304 | 7304 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -7332,7 +7332,7 @@ discard block |
||
| 7332 | 7332 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 7333 | 7333 | } |
| 7334 | 7334 | } |
| 7335 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7335 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7336 | 7336 | ORDER BY airport_arrival_icao_count DESC"; |
| 7337 | 7337 | if ($limit) $query .= " LIMIT 10"; |
| 7338 | 7338 | |
@@ -7361,35 +7361,35 @@ discard block |
||
| 7361 | 7361 | } |
| 7362 | 7362 | |
| 7363 | 7363 | /** |
| 7364 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 7365 | - * |
|
| 7366 | - * @return Array the airport list |
|
| 7367 | - * |
|
| 7368 | - */ |
|
| 7364 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 7365 | + * |
|
| 7366 | + * @return Array the airport list |
|
| 7367 | + * |
|
| 7368 | + */ |
|
| 7369 | 7369 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 7370 | 7370 | { |
| 7371 | 7371 | global $globalDBdriver; |
| 7372 | 7372 | $filter_query = $this->getFilter($filters,true,true); |
| 7373 | 7373 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7374 | 7374 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' "; |
| 7375 | - if ($olderthanmonths > 0) { |
|
| 7376 | - if ($globalDBdriver == 'mysql') { |
|
| 7375 | + if ($olderthanmonths > 0) { |
|
| 7376 | + if ($globalDBdriver == 'mysql') { |
|
| 7377 | 7377 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 7378 | 7378 | } else { |
| 7379 | 7379 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 7380 | 7380 | } |
| 7381 | 7381 | } |
| 7382 | - if ($sincedate != '') { |
|
| 7383 | - if ($globalDBdriver == 'mysql') { |
|
| 7382 | + if ($sincedate != '') { |
|
| 7383 | + if ($globalDBdriver == 'mysql') { |
|
| 7384 | 7384 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 7385 | 7385 | } else { |
| 7386 | 7386 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 7387 | 7387 | } |
| 7388 | 7388 | } |
| 7389 | 7389 | |
| 7390 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7391 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7392 | - $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7390 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7391 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7392 | + $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7393 | 7393 | ORDER BY airport_arrival_icao_count DESC"; |
| 7394 | 7394 | if ($limit) $query .= " LIMIT 10"; |
| 7395 | 7395 | |
@@ -7420,26 +7420,26 @@ discard block |
||
| 7420 | 7420 | |
| 7421 | 7421 | |
| 7422 | 7422 | /** |
| 7423 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7424 | - * |
|
| 7425 | - * @return Array the airport list |
|
| 7426 | - * |
|
| 7427 | - */ |
|
| 7423 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7424 | + * |
|
| 7425 | + * @return Array the airport list |
|
| 7426 | + * |
|
| 7427 | + */ |
|
| 7428 | 7428 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
| 7429 | 7429 | { |
| 7430 | 7430 | global $globalDBdriver; |
| 7431 | 7431 | $filter_query = $this->getFilter($filters,true,true); |
| 7432 | 7432 | $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
| 7433 | 7433 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
| 7434 | - if ($olderthanmonths > 0) { |
|
| 7435 | - if ($globalDBdriver == 'mysql') { |
|
| 7434 | + if ($olderthanmonths > 0) { |
|
| 7435 | + if ($globalDBdriver == 'mysql') { |
|
| 7436 | 7436 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 7437 | 7437 | } else { |
| 7438 | 7438 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 7439 | 7439 | } |
| 7440 | 7440 | } |
| 7441 | - if ($sincedate != '') { |
|
| 7442 | - if ($globalDBdriver == 'mysql') { |
|
| 7441 | + if ($sincedate != '') { |
|
| 7442 | + if ($globalDBdriver == 'mysql') { |
|
| 7443 | 7443 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 7444 | 7444 | } else { |
| 7445 | 7445 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -7473,7 +7473,7 @@ discard block |
||
| 7473 | 7473 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 7474 | 7474 | } |
| 7475 | 7475 | } |
| 7476 | - $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7476 | + $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7477 | 7477 | ORDER BY airport_arrival_icao_count DESC"; |
| 7478 | 7478 | if ($limit) $query .= " LIMIT 10"; |
| 7479 | 7479 | |
@@ -7501,35 +7501,35 @@ discard block |
||
| 7501 | 7501 | } |
| 7502 | 7502 | |
| 7503 | 7503 | /** |
| 7504 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7505 | - * |
|
| 7506 | - * @return Array the airport list |
|
| 7507 | - * |
|
| 7508 | - */ |
|
| 7504 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7505 | + * |
|
| 7506 | + * @return Array the airport list |
|
| 7507 | + * |
|
| 7508 | + */ |
|
| 7509 | 7509 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 7510 | 7510 | { |
| 7511 | 7511 | global $globalDBdriver; |
| 7512 | 7512 | $filter_query = $this->getFilter($filters,true,true); |
| 7513 | 7513 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
| 7514 | 7514 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
| 7515 | - if ($olderthanmonths > 0) { |
|
| 7516 | - if ($globalDBdriver == 'mysql') { |
|
| 7515 | + if ($olderthanmonths > 0) { |
|
| 7516 | + if ($globalDBdriver == 'mysql') { |
|
| 7517 | 7517 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 7518 | 7518 | } else { |
| 7519 | 7519 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 7520 | 7520 | } |
| 7521 | 7521 | } |
| 7522 | - if ($sincedate != '') { |
|
| 7523 | - if ($globalDBdriver == 'mysql') { |
|
| 7522 | + if ($sincedate != '') { |
|
| 7523 | + if ($globalDBdriver == 'mysql') { |
|
| 7524 | 7524 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 7525 | 7525 | } else { |
| 7526 | 7526 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 7527 | 7527 | } |
| 7528 | 7528 | } |
| 7529 | 7529 | |
| 7530 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7531 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7532 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7530 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7531 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7532 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7533 | 7533 | ORDER BY airport_arrival_icao_count DESC"; |
| 7534 | 7534 | if ($limit) $query .= " LIMIT 10"; |
| 7535 | 7535 | |
@@ -7559,11 +7559,11 @@ discard block |
||
| 7559 | 7559 | } |
| 7560 | 7560 | |
| 7561 | 7561 | /** |
| 7562 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 7563 | - * |
|
| 7564 | - * @return Array the airport list |
|
| 7565 | - * |
|
| 7566 | - */ |
|
| 7562 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 7563 | + * |
|
| 7564 | + * @return Array the airport list |
|
| 7565 | + * |
|
| 7566 | + */ |
|
| 7567 | 7567 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 7568 | 7568 | { |
| 7569 | 7569 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7595,11 +7595,11 @@ discard block |
||
| 7595 | 7595 | |
| 7596 | 7596 | |
| 7597 | 7597 | /** |
| 7598 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 7599 | - * |
|
| 7600 | - * @return Array the airport list |
|
| 7601 | - * |
|
| 7602 | - */ |
|
| 7598 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 7599 | + * |
|
| 7600 | + * @return Array the airport list |
|
| 7601 | + * |
|
| 7602 | + */ |
|
| 7603 | 7603 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
| 7604 | 7604 | { |
| 7605 | 7605 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7630,11 +7630,11 @@ discard block |
||
| 7630 | 7630 | |
| 7631 | 7631 | |
| 7632 | 7632 | /** |
| 7633 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 7634 | - * |
|
| 7635 | - * @return Array the airport list |
|
| 7636 | - * |
|
| 7637 | - */ |
|
| 7633 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 7634 | + * |
|
| 7635 | + * @return Array the airport list |
|
| 7636 | + * |
|
| 7637 | + */ |
|
| 7638 | 7638 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
| 7639 | 7639 | { |
| 7640 | 7640 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7668,11 +7668,11 @@ discard block |
||
| 7668 | 7668 | |
| 7669 | 7669 | |
| 7670 | 7670 | /** |
| 7671 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7672 | - * |
|
| 7673 | - * @return Array the airport list |
|
| 7674 | - * |
|
| 7675 | - */ |
|
| 7671 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7672 | + * |
|
| 7673 | + * @return Array the airport list |
|
| 7674 | + * |
|
| 7675 | + */ |
|
| 7676 | 7676 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 7677 | 7677 | { |
| 7678 | 7678 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7702,11 +7702,11 @@ discard block |
||
| 7702 | 7702 | |
| 7703 | 7703 | |
| 7704 | 7704 | /** |
| 7705 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 7706 | - * |
|
| 7707 | - * @return Array the airport list |
|
| 7708 | - * |
|
| 7709 | - */ |
|
| 7705 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 7706 | + * |
|
| 7707 | + * @return Array the airport list |
|
| 7708 | + * |
|
| 7709 | + */ |
|
| 7710 | 7710 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
| 7711 | 7711 | { |
| 7712 | 7712 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7740,11 +7740,11 @@ discard block |
||
| 7740 | 7740 | |
| 7741 | 7741 | |
| 7742 | 7742 | /** |
| 7743 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 7744 | - * |
|
| 7745 | - * @return Array the airport list |
|
| 7746 | - * |
|
| 7747 | - */ |
|
| 7743 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 7744 | + * |
|
| 7745 | + * @return Array the airport list |
|
| 7746 | + * |
|
| 7747 | + */ |
|
| 7748 | 7748 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
| 7749 | 7749 | { |
| 7750 | 7750 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7775,11 +7775,11 @@ discard block |
||
| 7775 | 7775 | |
| 7776 | 7776 | |
| 7777 | 7777 | /** |
| 7778 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 7779 | - * |
|
| 7780 | - * @return Array the airport list |
|
| 7781 | - * |
|
| 7782 | - */ |
|
| 7778 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 7779 | + * |
|
| 7780 | + * @return Array the airport list |
|
| 7781 | + * |
|
| 7782 | + */ |
|
| 7783 | 7783 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
| 7784 | 7784 | { |
| 7785 | 7785 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7812,11 +7812,11 @@ discard block |
||
| 7812 | 7812 | |
| 7813 | 7813 | |
| 7814 | 7814 | /** |
| 7815 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 7816 | - * |
|
| 7817 | - * @return Array the airport list |
|
| 7818 | - * |
|
| 7819 | - */ |
|
| 7815 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 7816 | + * |
|
| 7817 | + * @return Array the airport list |
|
| 7818 | + * |
|
| 7819 | + */ |
|
| 7820 | 7820 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
| 7821 | 7821 | { |
| 7822 | 7822 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7846,11 +7846,11 @@ discard block |
||
| 7846 | 7846 | |
| 7847 | 7847 | |
| 7848 | 7848 | /** |
| 7849 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7850 | - * |
|
| 7851 | - * @return Array the airport list |
|
| 7852 | - * |
|
| 7853 | - */ |
|
| 7849 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7850 | + * |
|
| 7851 | + * @return Array the airport list |
|
| 7852 | + * |
|
| 7853 | + */ |
|
| 7854 | 7854 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7855 | 7855 | { |
| 7856 | 7856 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7884,11 +7884,11 @@ discard block |
||
| 7884 | 7884 | |
| 7885 | 7885 | |
| 7886 | 7886 | /** |
| 7887 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7888 | - * |
|
| 7889 | - * @return Array the airport list |
|
| 7890 | - * |
|
| 7891 | - */ |
|
| 7887 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 7888 | + * |
|
| 7889 | + * @return Array the airport list |
|
| 7890 | + * |
|
| 7891 | + */ |
|
| 7892 | 7892 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7893 | 7893 | { |
| 7894 | 7894 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7919,11 +7919,11 @@ discard block |
||
| 7919 | 7919 | |
| 7920 | 7920 | |
| 7921 | 7921 | /** |
| 7922 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 7923 | - * |
|
| 7924 | - * @return Array the airport list |
|
| 7925 | - * |
|
| 7926 | - */ |
|
| 7922 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 7923 | + * |
|
| 7924 | + * @return Array the airport list |
|
| 7925 | + * |
|
| 7926 | + */ |
|
| 7927 | 7927 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
| 7928 | 7928 | { |
| 7929 | 7929 | global $globalTimezone, $globalDBdriver; |
@@ -7969,11 +7969,11 @@ discard block |
||
| 7969 | 7969 | |
| 7970 | 7970 | |
| 7971 | 7971 | /** |
| 7972 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 7973 | - * |
|
| 7974 | - * @return Array the airport list |
|
| 7975 | - * |
|
| 7976 | - */ |
|
| 7972 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 7973 | + * |
|
| 7974 | + * @return Array the airport list |
|
| 7975 | + * |
|
| 7976 | + */ |
|
| 7977 | 7977 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 7978 | 7978 | { |
| 7979 | 7979 | global $globalTimezone, $globalDBdriver; |
@@ -8016,11 +8016,11 @@ discard block |
||
| 8016 | 8016 | |
| 8017 | 8017 | |
| 8018 | 8018 | /** |
| 8019 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 8020 | - * |
|
| 8021 | - * @return Array the airport list |
|
| 8022 | - * |
|
| 8023 | - */ |
|
| 8019 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 8020 | + * |
|
| 8021 | + * @return Array the airport list |
|
| 8022 | + * |
|
| 8023 | + */ |
|
| 8024 | 8024 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
| 8025 | 8025 | { |
| 8026 | 8026 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8052,11 +8052,11 @@ discard block |
||
| 8052 | 8052 | } |
| 8053 | 8053 | |
| 8054 | 8054 | /** |
| 8055 | - * Gets all arrival airports of the airplanes that have flown over based on a owner |
|
| 8056 | - * |
|
| 8057 | - * @return Array the airport list |
|
| 8058 | - * |
|
| 8059 | - */ |
|
| 8055 | + * Gets all arrival airports of the airplanes that have flown over based on a owner |
|
| 8056 | + * |
|
| 8057 | + * @return Array the airport list |
|
| 8058 | + * |
|
| 8059 | + */ |
|
| 8060 | 8060 | public function countAllArrivalAirportsByOwner($owner,$filters = array()) |
| 8061 | 8061 | { |
| 8062 | 8062 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8087,11 +8087,11 @@ discard block |
||
| 8087 | 8087 | } |
| 8088 | 8088 | |
| 8089 | 8089 | /** |
| 8090 | - * Gets all arrival airports of the airplanes that have flown over based on a pilot |
|
| 8091 | - * |
|
| 8092 | - * @return Array the airport list |
|
| 8093 | - * |
|
| 8094 | - */ |
|
| 8090 | + * Gets all arrival airports of the airplanes that have flown over based on a pilot |
|
| 8091 | + * |
|
| 8092 | + * @return Array the airport list |
|
| 8093 | + * |
|
| 8094 | + */ |
|
| 8095 | 8095 | public function countAllArrivalAirportsByPilot($pilot,$filters = array()) |
| 8096 | 8096 | { |
| 8097 | 8097 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8122,11 +8122,11 @@ discard block |
||
| 8122 | 8122 | } |
| 8123 | 8123 | |
| 8124 | 8124 | /** |
| 8125 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 8126 | - * |
|
| 8127 | - * @return Array the airport list |
|
| 8128 | - * |
|
| 8129 | - */ |
|
| 8125 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 8126 | + * |
|
| 8127 | + * @return Array the airport list |
|
| 8128 | + * |
|
| 8129 | + */ |
|
| 8130 | 8130 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 8131 | 8131 | { |
| 8132 | 8132 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8155,11 +8155,11 @@ discard block |
||
| 8155 | 8155 | } |
| 8156 | 8156 | |
| 8157 | 8157 | /** |
| 8158 | - * Gets all arrival airports by country of the airplanes that have flown over based on a owner |
|
| 8159 | - * |
|
| 8160 | - * @return Array the airport list |
|
| 8161 | - * |
|
| 8162 | - */ |
|
| 8158 | + * Gets all arrival airports by country of the airplanes that have flown over based on a owner |
|
| 8159 | + * |
|
| 8160 | + * @return Array the airport list |
|
| 8161 | + * |
|
| 8162 | + */ |
|
| 8163 | 8163 | public function countAllArrivalAirportCountriesByOwner($owner, $filters = array()) |
| 8164 | 8164 | { |
| 8165 | 8165 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8175,11 +8175,11 @@ discard block |
||
| 8175 | 8175 | } |
| 8176 | 8176 | |
| 8177 | 8177 | /** |
| 8178 | - * Gets all arrival airports by country of the airplanes that have flown over based on a pilot |
|
| 8179 | - * |
|
| 8180 | - * @return Array the airport list |
|
| 8181 | - * |
|
| 8182 | - */ |
|
| 8178 | + * Gets all arrival airports by country of the airplanes that have flown over based on a pilot |
|
| 8179 | + * |
|
| 8180 | + * @return Array the airport list |
|
| 8181 | + * |
|
| 8182 | + */ |
|
| 8183 | 8183 | public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array()) |
| 8184 | 8184 | { |
| 8185 | 8185 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8197,11 +8197,11 @@ discard block |
||
| 8197 | 8197 | |
| 8198 | 8198 | |
| 8199 | 8199 | /** |
| 8200 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 8201 | - * |
|
| 8202 | - * @return Array the airport list |
|
| 8203 | - * |
|
| 8204 | - */ |
|
| 8200 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 8201 | + * |
|
| 8202 | + * @return Array the airport list |
|
| 8203 | + * |
|
| 8204 | + */ |
|
| 8205 | 8205 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
| 8206 | 8206 | { |
| 8207 | 8207 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8234,11 +8234,11 @@ discard block |
||
| 8234 | 8234 | |
| 8235 | 8235 | |
| 8236 | 8236 | /** |
| 8237 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 8238 | - * |
|
| 8239 | - * @return Array the airport list |
|
| 8240 | - * |
|
| 8241 | - */ |
|
| 8237 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 8238 | + * |
|
| 8239 | + * @return Array the airport list |
|
| 8240 | + * |
|
| 8241 | + */ |
|
| 8242 | 8242 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
| 8243 | 8243 | { |
| 8244 | 8244 | global $globalDBdriver; |
@@ -8270,11 +8270,11 @@ discard block |
||
| 8270 | 8270 | |
| 8271 | 8271 | |
| 8272 | 8272 | /** |
| 8273 | - * Counts all airport departure countries |
|
| 8274 | - * |
|
| 8275 | - * @return Array the airport departure list |
|
| 8276 | - * |
|
| 8277 | - */ |
|
| 8273 | + * Counts all airport departure countries |
|
| 8274 | + * |
|
| 8275 | + * @return Array the airport departure list |
|
| 8276 | + * |
|
| 8277 | + */ |
|
| 8278 | 8278 | public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '') |
| 8279 | 8279 | { |
| 8280 | 8280 | global $globalDBdriver; |
@@ -8333,11 +8333,11 @@ discard block |
||
| 8333 | 8333 | |
| 8334 | 8334 | |
| 8335 | 8335 | /** |
| 8336 | - * Counts all airport arrival countries |
|
| 8337 | - * |
|
| 8338 | - * @return Array the airport arrival list |
|
| 8339 | - * |
|
| 8340 | - */ |
|
| 8336 | + * Counts all airport arrival countries |
|
| 8337 | + * |
|
| 8338 | + * @return Array the airport arrival list |
|
| 8339 | + * |
|
| 8340 | + */ |
|
| 8341 | 8341 | public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
| 8342 | 8342 | { |
| 8343 | 8343 | global $globalDBdriver; |
@@ -8399,11 +8399,11 @@ discard block |
||
| 8399 | 8399 | |
| 8400 | 8400 | |
| 8401 | 8401 | /** |
| 8402 | - * Gets all route combinations |
|
| 8403 | - * |
|
| 8404 | - * @return Array the route list |
|
| 8405 | - * |
|
| 8406 | - */ |
|
| 8402 | + * Gets all route combinations |
|
| 8403 | + * |
|
| 8404 | + * @return Array the route list |
|
| 8405 | + * |
|
| 8406 | + */ |
|
| 8407 | 8407 | public function countAllRoutes($filters = array()) |
| 8408 | 8408 | { |
| 8409 | 8409 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8442,11 +8442,11 @@ discard block |
||
| 8442 | 8442 | |
| 8443 | 8443 | |
| 8444 | 8444 | /** |
| 8445 | - * Gets all route combinations based on an aircraft |
|
| 8446 | - * |
|
| 8447 | - * @return Array the route list |
|
| 8448 | - * |
|
| 8449 | - */ |
|
| 8445 | + * Gets all route combinations based on an aircraft |
|
| 8446 | + * |
|
| 8447 | + * @return Array the route list |
|
| 8448 | + * |
|
| 8449 | + */ |
|
| 8450 | 8450 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
| 8451 | 8451 | { |
| 8452 | 8452 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8482,11 +8482,11 @@ discard block |
||
| 8482 | 8482 | |
| 8483 | 8483 | |
| 8484 | 8484 | /** |
| 8485 | - * Gets all route combinations based on an aircraft registration |
|
| 8486 | - * |
|
| 8487 | - * @return Array the route list |
|
| 8488 | - * |
|
| 8489 | - */ |
|
| 8485 | + * Gets all route combinations based on an aircraft registration |
|
| 8486 | + * |
|
| 8487 | + * @return Array the route list |
|
| 8488 | + * |
|
| 8489 | + */ |
|
| 8490 | 8490 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 8491 | 8491 | { |
| 8492 | 8492 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8524,11 +8524,11 @@ discard block |
||
| 8524 | 8524 | |
| 8525 | 8525 | |
| 8526 | 8526 | /** |
| 8527 | - * Gets all route combinations based on an airline |
|
| 8528 | - * |
|
| 8529 | - * @return Array the route list |
|
| 8530 | - * |
|
| 8531 | - */ |
|
| 8527 | + * Gets all route combinations based on an airline |
|
| 8528 | + * |
|
| 8529 | + * @return Array the route list |
|
| 8530 | + * |
|
| 8531 | + */ |
|
| 8532 | 8532 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 8533 | 8533 | { |
| 8534 | 8534 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8566,11 +8566,11 @@ discard block |
||
| 8566 | 8566 | |
| 8567 | 8567 | |
| 8568 | 8568 | /** |
| 8569 | - * Gets all route combinations based on an airport |
|
| 8570 | - * |
|
| 8571 | - * @return Array the route list |
|
| 8572 | - * |
|
| 8573 | - */ |
|
| 8569 | + * Gets all route combinations based on an airport |
|
| 8570 | + * |
|
| 8571 | + * @return Array the route list |
|
| 8572 | + * |
|
| 8573 | + */ |
|
| 8574 | 8574 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 8575 | 8575 | { |
| 8576 | 8576 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8607,11 +8607,11 @@ discard block |
||
| 8607 | 8607 | |
| 8608 | 8608 | |
| 8609 | 8609 | /** |
| 8610 | - * Gets all route combinations based on an country |
|
| 8611 | - * |
|
| 8612 | - * @return Array the route list |
|
| 8613 | - * |
|
| 8614 | - */ |
|
| 8610 | + * Gets all route combinations based on an country |
|
| 8611 | + * |
|
| 8612 | + * @return Array the route list |
|
| 8613 | + * |
|
| 8614 | + */ |
|
| 8615 | 8615 | public function countAllRoutesByCountry($country, $filters = array()) |
| 8616 | 8616 | { |
| 8617 | 8617 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8647,11 +8647,11 @@ discard block |
||
| 8647 | 8647 | |
| 8648 | 8648 | |
| 8649 | 8649 | /** |
| 8650 | - * Gets all route combinations based on an date |
|
| 8651 | - * |
|
| 8652 | - * @return Array the route list |
|
| 8653 | - * |
|
| 8654 | - */ |
|
| 8650 | + * Gets all route combinations based on an date |
|
| 8651 | + * |
|
| 8652 | + * @return Array the route list |
|
| 8653 | + * |
|
| 8654 | + */ |
|
| 8655 | 8655 | public function countAllRoutesByDate($date, $filters = array()) |
| 8656 | 8656 | { |
| 8657 | 8657 | global $globalTimezone, $globalDBdriver; |
@@ -8701,11 +8701,11 @@ discard block |
||
| 8701 | 8701 | |
| 8702 | 8702 | |
| 8703 | 8703 | /** |
| 8704 | - * Gets all route combinations based on an ident/callsign |
|
| 8705 | - * |
|
| 8706 | - * @return Array the route list |
|
| 8707 | - * |
|
| 8708 | - */ |
|
| 8704 | + * Gets all route combinations based on an ident/callsign |
|
| 8705 | + * |
|
| 8706 | + * @return Array the route list |
|
| 8707 | + * |
|
| 8708 | + */ |
|
| 8709 | 8709 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 8710 | 8710 | { |
| 8711 | 8711 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8741,11 +8741,11 @@ discard block |
||
| 8741 | 8741 | } |
| 8742 | 8742 | |
| 8743 | 8743 | /** |
| 8744 | - * Gets all route combinations based on an owner |
|
| 8745 | - * |
|
| 8746 | - * @return Array the route list |
|
| 8747 | - * |
|
| 8748 | - */ |
|
| 8744 | + * Gets all route combinations based on an owner |
|
| 8745 | + * |
|
| 8746 | + * @return Array the route list |
|
| 8747 | + * |
|
| 8748 | + */ |
|
| 8749 | 8749 | public function countAllRoutesByOwner($owner,$filters = array()) |
| 8750 | 8750 | { |
| 8751 | 8751 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8781,11 +8781,11 @@ discard block |
||
| 8781 | 8781 | } |
| 8782 | 8782 | |
| 8783 | 8783 | /** |
| 8784 | - * Gets all route combinations based on a pilot |
|
| 8785 | - * |
|
| 8786 | - * @return Array the route list |
|
| 8787 | - * |
|
| 8788 | - */ |
|
| 8784 | + * Gets all route combinations based on a pilot |
|
| 8785 | + * |
|
| 8786 | + * @return Array the route list |
|
| 8787 | + * |
|
| 8788 | + */ |
|
| 8789 | 8789 | public function countAllRoutesByPilot($pilot,$filters = array()) |
| 8790 | 8790 | { |
| 8791 | 8791 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8822,11 +8822,11 @@ discard block |
||
| 8822 | 8822 | |
| 8823 | 8823 | |
| 8824 | 8824 | /** |
| 8825 | - * Gets all route combinations based on an manufacturer |
|
| 8826 | - * |
|
| 8827 | - * @return Array the route list |
|
| 8828 | - * |
|
| 8829 | - */ |
|
| 8825 | + * Gets all route combinations based on an manufacturer |
|
| 8826 | + * |
|
| 8827 | + * @return Array the route list |
|
| 8828 | + * |
|
| 8829 | + */ |
|
| 8830 | 8830 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 8831 | 8831 | { |
| 8832 | 8832 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8864,11 +8864,11 @@ discard block |
||
| 8864 | 8864 | |
| 8865 | 8865 | |
| 8866 | 8866 | /** |
| 8867 | - * Gets all route combinations with waypoints |
|
| 8868 | - * |
|
| 8869 | - * @return Array the route list |
|
| 8870 | - * |
|
| 8871 | - */ |
|
| 8867 | + * Gets all route combinations with waypoints |
|
| 8868 | + * |
|
| 8869 | + * @return Array the route list |
|
| 8870 | + * |
|
| 8871 | + */ |
|
| 8872 | 8872 | public function countAllRoutesWithWaypoints($filters = array()) |
| 8873 | 8873 | { |
| 8874 | 8874 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8905,11 +8905,11 @@ discard block |
||
| 8905 | 8905 | } |
| 8906 | 8906 | |
| 8907 | 8907 | /** |
| 8908 | - * Gets all callsigns that have flown over |
|
| 8909 | - * |
|
| 8910 | - * @return Array the callsign list |
|
| 8911 | - * |
|
| 8912 | - */ |
|
| 8908 | + * Gets all callsigns that have flown over |
|
| 8909 | + * |
|
| 8910 | + * @return Array the callsign list |
|
| 8911 | + * |
|
| 8912 | + */ |
|
| 8913 | 8913 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 8914 | 8914 | { |
| 8915 | 8915 | global $globalDBdriver; |
@@ -8975,11 +8975,11 @@ discard block |
||
| 8975 | 8975 | } |
| 8976 | 8976 | |
| 8977 | 8977 | /** |
| 8978 | - * Gets all callsigns that have flown over |
|
| 8979 | - * |
|
| 8980 | - * @return Array the callsign list |
|
| 8981 | - * |
|
| 8982 | - */ |
|
| 8978 | + * Gets all callsigns that have flown over |
|
| 8979 | + * |
|
| 8980 | + * @return Array the callsign list |
|
| 8981 | + * |
|
| 8982 | + */ |
|
| 8983 | 8983 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 8984 | 8984 | { |
| 8985 | 8985 | global $globalDBdriver; |
@@ -9020,11 +9020,11 @@ discard block |
||
| 9020 | 9020 | |
| 9021 | 9021 | |
| 9022 | 9022 | /** |
| 9023 | - * Counts all dates |
|
| 9024 | - * |
|
| 9025 | - * @return Array the date list |
|
| 9026 | - * |
|
| 9027 | - */ |
|
| 9023 | + * Counts all dates |
|
| 9024 | + * |
|
| 9025 | + * @return Array the date list |
|
| 9026 | + * |
|
| 9027 | + */ |
|
| 9028 | 9028 | public function countAllDates($filters = array()) |
| 9029 | 9029 | { |
| 9030 | 9030 | global $globalTimezone, $globalDBdriver; |
@@ -9069,11 +9069,11 @@ discard block |
||
| 9069 | 9069 | } |
| 9070 | 9070 | |
| 9071 | 9071 | /** |
| 9072 | - * Counts all dates |
|
| 9073 | - * |
|
| 9074 | - * @return Array the date list |
|
| 9075 | - * |
|
| 9076 | - */ |
|
| 9072 | + * Counts all dates |
|
| 9073 | + * |
|
| 9074 | + * @return Array the date list |
|
| 9075 | + * |
|
| 9076 | + */ |
|
| 9077 | 9077 | public function countAllDatesByAirlines($filters = array()) |
| 9078 | 9078 | { |
| 9079 | 9079 | global $globalTimezone, $globalDBdriver; |
@@ -9118,11 +9118,11 @@ discard block |
||
| 9118 | 9118 | } |
| 9119 | 9119 | |
| 9120 | 9120 | /** |
| 9121 | - * Counts all dates during the last 7 days |
|
| 9122 | - * |
|
| 9123 | - * @return Array the date list |
|
| 9124 | - * |
|
| 9125 | - */ |
|
| 9121 | + * Counts all dates during the last 7 days |
|
| 9122 | + * |
|
| 9123 | + * @return Array the date list |
|
| 9124 | + * |
|
| 9125 | + */ |
|
| 9126 | 9126 | public function countAllDatesLast7Days($filters = array()) |
| 9127 | 9127 | { |
| 9128 | 9128 | global $globalTimezone, $globalDBdriver; |
@@ -9144,7 +9144,7 @@ discard block |
||
| 9144 | 9144 | $query .= " GROUP BY date_name |
| 9145 | 9145 | ORDER BY date_name ASC"; |
| 9146 | 9146 | $query_data = array(':offset' => $offset); |
| 9147 | - } |
|
| 9147 | + } |
|
| 9148 | 9148 | |
| 9149 | 9149 | $sth = $this->db->prepare($query); |
| 9150 | 9150 | $sth->execute($query_data); |
@@ -9164,11 +9164,11 @@ discard block |
||
| 9164 | 9164 | } |
| 9165 | 9165 | |
| 9166 | 9166 | /** |
| 9167 | - * Counts all dates during the last month |
|
| 9168 | - * |
|
| 9169 | - * @return Array the date list |
|
| 9170 | - * |
|
| 9171 | - */ |
|
| 9167 | + * Counts all dates during the last month |
|
| 9168 | + * |
|
| 9169 | + * @return Array the date list |
|
| 9170 | + * |
|
| 9171 | + */ |
|
| 9172 | 9172 | public function countAllDatesLastMonth($filters = array()) |
| 9173 | 9173 | { |
| 9174 | 9174 | global $globalTimezone, $globalDBdriver; |
@@ -9190,7 +9190,7 @@ discard block |
||
| 9190 | 9190 | $query .= " GROUP BY date_name |
| 9191 | 9191 | ORDER BY date_name ASC"; |
| 9192 | 9192 | $query_data = array(':offset' => $offset); |
| 9193 | - } |
|
| 9193 | + } |
|
| 9194 | 9194 | |
| 9195 | 9195 | $sth = $this->db->prepare($query); |
| 9196 | 9196 | $sth->execute($query_data); |
@@ -9211,11 +9211,11 @@ discard block |
||
| 9211 | 9211 | |
| 9212 | 9212 | |
| 9213 | 9213 | /** |
| 9214 | - * Counts all dates during the last month |
|
| 9215 | - * |
|
| 9216 | - * @return Array the date list |
|
| 9217 | - * |
|
| 9218 | - */ |
|
| 9214 | + * Counts all dates during the last month |
|
| 9215 | + * |
|
| 9216 | + * @return Array the date list |
|
| 9217 | + * |
|
| 9218 | + */ |
|
| 9219 | 9219 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 9220 | 9220 | { |
| 9221 | 9221 | global $globalTimezone, $globalDBdriver; |
@@ -9238,7 +9238,7 @@ discard block |
||
| 9238 | 9238 | GROUP BY spotter_output.airline_icao, date_name |
| 9239 | 9239 | ORDER BY date_name ASC"; |
| 9240 | 9240 | $query_data = array(':offset' => $offset); |
| 9241 | - } |
|
| 9241 | + } |
|
| 9242 | 9242 | |
| 9243 | 9243 | $sth = $this->db->prepare($query); |
| 9244 | 9244 | $sth->execute($query_data); |
@@ -9260,11 +9260,11 @@ discard block |
||
| 9260 | 9260 | |
| 9261 | 9261 | |
| 9262 | 9262 | /** |
| 9263 | - * Counts all month |
|
| 9264 | - * |
|
| 9265 | - * @return Array the month list |
|
| 9266 | - * |
|
| 9267 | - */ |
|
| 9263 | + * Counts all month |
|
| 9264 | + * |
|
| 9265 | + * @return Array the month list |
|
| 9266 | + * |
|
| 9267 | + */ |
|
| 9268 | 9268 | public function countAllMonths($filters = array()) |
| 9269 | 9269 | { |
| 9270 | 9270 | global $globalTimezone, $globalDBdriver; |
@@ -9306,11 +9306,11 @@ discard block |
||
| 9306 | 9306 | } |
| 9307 | 9307 | |
| 9308 | 9308 | /** |
| 9309 | - * Counts all month |
|
| 9310 | - * |
|
| 9311 | - * @return Array the month list |
|
| 9312 | - * |
|
| 9313 | - */ |
|
| 9309 | + * Counts all month |
|
| 9310 | + * |
|
| 9311 | + * @return Array the month list |
|
| 9312 | + * |
|
| 9313 | + */ |
|
| 9314 | 9314 | public function countAllMonthsByAirlines($filters = array()) |
| 9315 | 9315 | { |
| 9316 | 9316 | global $globalTimezone, $globalDBdriver; |
@@ -9355,11 +9355,11 @@ discard block |
||
| 9355 | 9355 | } |
| 9356 | 9356 | |
| 9357 | 9357 | /** |
| 9358 | - * Counts all military month |
|
| 9359 | - * |
|
| 9360 | - * @return Array the month list |
|
| 9361 | - * |
|
| 9362 | - */ |
|
| 9358 | + * Counts all military month |
|
| 9359 | + * |
|
| 9360 | + * @return Array the month list |
|
| 9361 | + * |
|
| 9362 | + */ |
|
| 9363 | 9363 | public function countAllMilitaryMonths($filters = array()) |
| 9364 | 9364 | { |
| 9365 | 9365 | global $globalTimezone, $globalDBdriver; |
@@ -9400,11 +9400,11 @@ discard block |
||
| 9400 | 9400 | } |
| 9401 | 9401 | |
| 9402 | 9402 | /** |
| 9403 | - * Counts all month owners |
|
| 9404 | - * |
|
| 9405 | - * @return Array the month list |
|
| 9406 | - * |
|
| 9407 | - */ |
|
| 9403 | + * Counts all month owners |
|
| 9404 | + * |
|
| 9405 | + * @return Array the month list |
|
| 9406 | + * |
|
| 9407 | + */ |
|
| 9408 | 9408 | public function countAllMonthsOwners($filters = array()) |
| 9409 | 9409 | { |
| 9410 | 9410 | global $globalTimezone, $globalDBdriver; |
@@ -9446,11 +9446,11 @@ discard block |
||
| 9446 | 9446 | } |
| 9447 | 9447 | |
| 9448 | 9448 | /** |
| 9449 | - * Counts all month owners |
|
| 9450 | - * |
|
| 9451 | - * @return Array the month list |
|
| 9452 | - * |
|
| 9453 | - */ |
|
| 9449 | + * Counts all month owners |
|
| 9450 | + * |
|
| 9451 | + * @return Array the month list |
|
| 9452 | + * |
|
| 9453 | + */ |
|
| 9454 | 9454 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 9455 | 9455 | { |
| 9456 | 9456 | global $globalTimezone, $globalDBdriver; |
@@ -9493,11 +9493,11 @@ discard block |
||
| 9493 | 9493 | } |
| 9494 | 9494 | |
| 9495 | 9495 | /** |
| 9496 | - * Counts all month pilot |
|
| 9497 | - * |
|
| 9498 | - * @return Array the month list |
|
| 9499 | - * |
|
| 9500 | - */ |
|
| 9496 | + * Counts all month pilot |
|
| 9497 | + * |
|
| 9498 | + * @return Array the month list |
|
| 9499 | + * |
|
| 9500 | + */ |
|
| 9501 | 9501 | public function countAllMonthsPilots($filters = array()) |
| 9502 | 9502 | { |
| 9503 | 9503 | global $globalTimezone, $globalDBdriver; |
@@ -9539,11 +9539,11 @@ discard block |
||
| 9539 | 9539 | } |
| 9540 | 9540 | |
| 9541 | 9541 | /** |
| 9542 | - * Counts all month pilot |
|
| 9543 | - * |
|
| 9544 | - * @return Array the month list |
|
| 9545 | - * |
|
| 9546 | - */ |
|
| 9542 | + * Counts all month pilot |
|
| 9543 | + * |
|
| 9544 | + * @return Array the month list |
|
| 9545 | + * |
|
| 9546 | + */ |
|
| 9547 | 9547 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 9548 | 9548 | { |
| 9549 | 9549 | global $globalTimezone, $globalDBdriver; |
@@ -9586,11 +9586,11 @@ discard block |
||
| 9586 | 9586 | } |
| 9587 | 9587 | |
| 9588 | 9588 | /** |
| 9589 | - * Counts all month airline |
|
| 9590 | - * |
|
| 9591 | - * @return Array the month list |
|
| 9592 | - * |
|
| 9593 | - */ |
|
| 9589 | + * Counts all month airline |
|
| 9590 | + * |
|
| 9591 | + * @return Array the month list |
|
| 9592 | + * |
|
| 9593 | + */ |
|
| 9594 | 9594 | public function countAllMonthsAirlines($filters = array()) |
| 9595 | 9595 | { |
| 9596 | 9596 | global $globalTimezone, $globalDBdriver; |
@@ -9632,11 +9632,11 @@ discard block |
||
| 9632 | 9632 | } |
| 9633 | 9633 | |
| 9634 | 9634 | /** |
| 9635 | - * Counts all month aircraft |
|
| 9636 | - * |
|
| 9637 | - * @return Array the month list |
|
| 9638 | - * |
|
| 9639 | - */ |
|
| 9635 | + * Counts all month aircraft |
|
| 9636 | + * |
|
| 9637 | + * @return Array the month list |
|
| 9638 | + * |
|
| 9639 | + */ |
|
| 9640 | 9640 | public function countAllMonthsAircrafts($filters = array()) |
| 9641 | 9641 | { |
| 9642 | 9642 | global $globalTimezone, $globalDBdriver; |
@@ -9679,11 +9679,11 @@ discard block |
||
| 9679 | 9679 | |
| 9680 | 9680 | |
| 9681 | 9681 | /** |
| 9682 | - * Counts all month aircraft |
|
| 9683 | - * |
|
| 9684 | - * @return Array the month list |
|
| 9685 | - * |
|
| 9686 | - */ |
|
| 9682 | + * Counts all month aircraft |
|
| 9683 | + * |
|
| 9684 | + * @return Array the month list |
|
| 9685 | + * |
|
| 9686 | + */ |
|
| 9687 | 9687 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 9688 | 9688 | { |
| 9689 | 9689 | global $globalTimezone, $globalDBdriver; |
@@ -9726,11 +9726,11 @@ discard block |
||
| 9726 | 9726 | } |
| 9727 | 9727 | |
| 9728 | 9728 | /** |
| 9729 | - * Counts all month real arrival |
|
| 9730 | - * |
|
| 9731 | - * @return Array the month list |
|
| 9732 | - * |
|
| 9733 | - */ |
|
| 9729 | + * Counts all month real arrival |
|
| 9730 | + * |
|
| 9731 | + * @return Array the month list |
|
| 9732 | + * |
|
| 9733 | + */ |
|
| 9734 | 9734 | public function countAllMonthsRealArrivals($filters = array()) |
| 9735 | 9735 | { |
| 9736 | 9736 | global $globalTimezone, $globalDBdriver; |
@@ -9773,11 +9773,11 @@ discard block |
||
| 9773 | 9773 | |
| 9774 | 9774 | |
| 9775 | 9775 | /** |
| 9776 | - * Counts all month real arrival |
|
| 9777 | - * |
|
| 9778 | - * @return Array the month list |
|
| 9779 | - * |
|
| 9780 | - */ |
|
| 9776 | + * Counts all month real arrival |
|
| 9777 | + * |
|
| 9778 | + * @return Array the month list |
|
| 9779 | + * |
|
| 9780 | + */ |
|
| 9781 | 9781 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 9782 | 9782 | { |
| 9783 | 9783 | global $globalTimezone, $globalDBdriver; |
@@ -9821,11 +9821,11 @@ discard block |
||
| 9821 | 9821 | |
| 9822 | 9822 | |
| 9823 | 9823 | /** |
| 9824 | - * Counts all dates during the last year |
|
| 9825 | - * |
|
| 9826 | - * @return Array the date list |
|
| 9827 | - * |
|
| 9828 | - */ |
|
| 9824 | + * Counts all dates during the last year |
|
| 9825 | + * |
|
| 9826 | + * @return Array the date list |
|
| 9827 | + * |
|
| 9828 | + */ |
|
| 9829 | 9829 | public function countAllMonthsLastYear($filters) |
| 9830 | 9830 | { |
| 9831 | 9831 | global $globalTimezone, $globalDBdriver; |
@@ -9847,7 +9847,7 @@ discard block |
||
| 9847 | 9847 | $query .= " GROUP BY year_name, month_name |
| 9848 | 9848 | ORDER BY year_name, month_name ASC"; |
| 9849 | 9849 | $query_data = array(':offset' => $offset); |
| 9850 | - } |
|
| 9850 | + } |
|
| 9851 | 9851 | |
| 9852 | 9852 | $sth = $this->db->prepare($query); |
| 9853 | 9853 | $sth->execute($query_data); |
@@ -9870,11 +9870,11 @@ discard block |
||
| 9870 | 9870 | |
| 9871 | 9871 | |
| 9872 | 9872 | /** |
| 9873 | - * Counts all hours |
|
| 9874 | - * |
|
| 9875 | - * @return Array the hour list |
|
| 9876 | - * |
|
| 9877 | - */ |
|
| 9873 | + * Counts all hours |
|
| 9874 | + * |
|
| 9875 | + * @return Array the hour list |
|
| 9876 | + * |
|
| 9877 | + */ |
|
| 9878 | 9878 | public function countAllHours($orderby,$filters = array()) |
| 9879 | 9879 | { |
| 9880 | 9880 | global $globalTimezone, $globalDBdriver; |
@@ -9935,11 +9935,11 @@ discard block |
||
| 9935 | 9935 | } |
| 9936 | 9936 | |
| 9937 | 9937 | /** |
| 9938 | - * Counts all hours |
|
| 9939 | - * |
|
| 9940 | - * @return Array the hour list |
|
| 9941 | - * |
|
| 9942 | - */ |
|
| 9938 | + * Counts all hours |
|
| 9939 | + * |
|
| 9940 | + * @return Array the hour list |
|
| 9941 | + * |
|
| 9942 | + */ |
|
| 9943 | 9943 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 9944 | 9944 | { |
| 9945 | 9945 | global $globalTimezone, $globalDBdriver; |
@@ -10002,11 +10002,11 @@ discard block |
||
| 10002 | 10002 | |
| 10003 | 10003 | |
| 10004 | 10004 | /** |
| 10005 | - * Counts all hours by airline |
|
| 10006 | - * |
|
| 10007 | - * @return Array the hour list |
|
| 10008 | - * |
|
| 10009 | - */ |
|
| 10005 | + * Counts all hours by airline |
|
| 10006 | + * |
|
| 10007 | + * @return Array the hour list |
|
| 10008 | + * |
|
| 10009 | + */ |
|
| 10010 | 10010 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 10011 | 10011 | { |
| 10012 | 10012 | global $globalTimezone, $globalDBdriver; |
@@ -10052,11 +10052,11 @@ discard block |
||
| 10052 | 10052 | |
| 10053 | 10053 | |
| 10054 | 10054 | /** |
| 10055 | - * Counts all hours by aircraft |
|
| 10056 | - * |
|
| 10057 | - * @return Array the hour list |
|
| 10058 | - * |
|
| 10059 | - */ |
|
| 10055 | + * Counts all hours by aircraft |
|
| 10056 | + * |
|
| 10057 | + * @return Array the hour list |
|
| 10058 | + * |
|
| 10059 | + */ |
|
| 10060 | 10060 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 10061 | 10061 | { |
| 10062 | 10062 | global $globalTimezone, $globalDBdriver; |
@@ -10099,11 +10099,11 @@ discard block |
||
| 10099 | 10099 | |
| 10100 | 10100 | |
| 10101 | 10101 | /** |
| 10102 | - * Counts all hours by aircraft registration |
|
| 10103 | - * |
|
| 10104 | - * @return Array the hour list |
|
| 10105 | - * |
|
| 10106 | - */ |
|
| 10102 | + * Counts all hours by aircraft registration |
|
| 10103 | + * |
|
| 10104 | + * @return Array the hour list |
|
| 10105 | + * |
|
| 10106 | + */ |
|
| 10107 | 10107 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 10108 | 10108 | { |
| 10109 | 10109 | global $globalTimezone, $globalDBdriver; |
@@ -10146,11 +10146,11 @@ discard block |
||
| 10146 | 10146 | |
| 10147 | 10147 | |
| 10148 | 10148 | /** |
| 10149 | - * Counts all hours by airport |
|
| 10150 | - * |
|
| 10151 | - * @return Array the hour list |
|
| 10152 | - * |
|
| 10153 | - */ |
|
| 10149 | + * Counts all hours by airport |
|
| 10150 | + * |
|
| 10151 | + * @return Array the hour list |
|
| 10152 | + * |
|
| 10153 | + */ |
|
| 10154 | 10154 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 10155 | 10155 | { |
| 10156 | 10156 | global $globalTimezone, $globalDBdriver; |
@@ -10194,11 +10194,11 @@ discard block |
||
| 10194 | 10194 | |
| 10195 | 10195 | |
| 10196 | 10196 | /** |
| 10197 | - * Counts all hours by manufacturer |
|
| 10198 | - * |
|
| 10199 | - * @return Array the hour list |
|
| 10200 | - * |
|
| 10201 | - */ |
|
| 10197 | + * Counts all hours by manufacturer |
|
| 10198 | + * |
|
| 10199 | + * @return Array the hour list |
|
| 10200 | + * |
|
| 10201 | + */ |
|
| 10202 | 10202 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
| 10203 | 10203 | { |
| 10204 | 10204 | global $globalTimezone, $globalDBdriver; |
@@ -10242,11 +10242,11 @@ discard block |
||
| 10242 | 10242 | |
| 10243 | 10243 | |
| 10244 | 10244 | /** |
| 10245 | - * Counts all hours by date |
|
| 10246 | - * |
|
| 10247 | - * @return Array the hour list |
|
| 10248 | - * |
|
| 10249 | - */ |
|
| 10245 | + * Counts all hours by date |
|
| 10246 | + * |
|
| 10247 | + * @return Array the hour list |
|
| 10248 | + * |
|
| 10249 | + */ |
|
| 10250 | 10250 | public function countAllHoursByDate($date, $filters = array()) |
| 10251 | 10251 | { |
| 10252 | 10252 | global $globalTimezone, $globalDBdriver; |
@@ -10290,11 +10290,11 @@ discard block |
||
| 10290 | 10290 | |
| 10291 | 10291 | |
| 10292 | 10292 | /** |
| 10293 | - * Counts all hours by a ident/callsign |
|
| 10294 | - * |
|
| 10295 | - * @return Array the hour list |
|
| 10296 | - * |
|
| 10297 | - */ |
|
| 10293 | + * Counts all hours by a ident/callsign |
|
| 10294 | + * |
|
| 10295 | + * @return Array the hour list |
|
| 10296 | + * |
|
| 10297 | + */ |
|
| 10298 | 10298 | public function countAllHoursByIdent($ident, $filters = array()) |
| 10299 | 10299 | { |
| 10300 | 10300 | global $globalTimezone, $globalDBdriver; |
@@ -10337,11 +10337,11 @@ discard block |
||
| 10337 | 10337 | } |
| 10338 | 10338 | |
| 10339 | 10339 | /** |
| 10340 | - * Counts all hours by a owner |
|
| 10341 | - * |
|
| 10342 | - * @return Array the hour list |
|
| 10343 | - * |
|
| 10344 | - */ |
|
| 10340 | + * Counts all hours by a owner |
|
| 10341 | + * |
|
| 10342 | + * @return Array the hour list |
|
| 10343 | + * |
|
| 10344 | + */ |
|
| 10345 | 10345 | public function countAllHoursByOwner($owner, $filters = array()) |
| 10346 | 10346 | { |
| 10347 | 10347 | global $globalTimezone, $globalDBdriver; |
@@ -10384,11 +10384,11 @@ discard block |
||
| 10384 | 10384 | } |
| 10385 | 10385 | |
| 10386 | 10386 | /** |
| 10387 | - * Counts all hours by a pilot |
|
| 10388 | - * |
|
| 10389 | - * @return Array the hour list |
|
| 10390 | - * |
|
| 10391 | - */ |
|
| 10387 | + * Counts all hours by a pilot |
|
| 10388 | + * |
|
| 10389 | + * @return Array the hour list |
|
| 10390 | + * |
|
| 10391 | + */ |
|
| 10392 | 10392 | public function countAllHoursByPilot($pilot, $filters = array()) |
| 10393 | 10393 | { |
| 10394 | 10394 | global $globalTimezone, $globalDBdriver; |
@@ -10433,11 +10433,11 @@ discard block |
||
| 10433 | 10433 | |
| 10434 | 10434 | |
| 10435 | 10435 | /** |
| 10436 | - * Counts all hours by route |
|
| 10437 | - * |
|
| 10438 | - * @return Array the hour list |
|
| 10439 | - * |
|
| 10440 | - */ |
|
| 10436 | + * Counts all hours by route |
|
| 10437 | + * |
|
| 10438 | + * @return Array the hour list |
|
| 10439 | + * |
|
| 10440 | + */ |
|
| 10441 | 10441 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
| 10442 | 10442 | { |
| 10443 | 10443 | global $globalTimezone, $globalDBdriver; |
@@ -10481,11 +10481,11 @@ discard block |
||
| 10481 | 10481 | |
| 10482 | 10482 | |
| 10483 | 10483 | /** |
| 10484 | - * Counts all hours by country |
|
| 10485 | - * |
|
| 10486 | - * @return Array the hour list |
|
| 10487 | - * |
|
| 10488 | - */ |
|
| 10484 | + * Counts all hours by country |
|
| 10485 | + * |
|
| 10486 | + * @return Array the hour list |
|
| 10487 | + * |
|
| 10488 | + */ |
|
| 10489 | 10489 | public function countAllHoursByCountry($country, $filters = array()) |
| 10490 | 10490 | { |
| 10491 | 10491 | global $globalTimezone, $globalDBdriver; |
@@ -10530,11 +10530,11 @@ discard block |
||
| 10530 | 10530 | |
| 10531 | 10531 | |
| 10532 | 10532 | /** |
| 10533 | - * Counts all aircraft that have flown over |
|
| 10534 | - * |
|
| 10535 | - * @return Integer the number of aircrafts |
|
| 10536 | - * |
|
| 10537 | - */ |
|
| 10533 | + * Counts all aircraft that have flown over |
|
| 10534 | + * |
|
| 10535 | + * @return Integer the number of aircrafts |
|
| 10536 | + * |
|
| 10537 | + */ |
|
| 10538 | 10538 | public function countOverallAircrafts($filters = array(),$year = '',$month = '') |
| 10539 | 10539 | { |
| 10540 | 10540 | global $globalDBdriver; |
@@ -10567,11 +10567,11 @@ discard block |
||
| 10567 | 10567 | } |
| 10568 | 10568 | |
| 10569 | 10569 | /** |
| 10570 | - * Counts all flight that really arrival |
|
| 10571 | - * |
|
| 10572 | - * @return Integer the number of aircrafts |
|
| 10573 | - * |
|
| 10574 | - */ |
|
| 10570 | + * Counts all flight that really arrival |
|
| 10571 | + * |
|
| 10572 | + * @return Integer the number of aircrafts |
|
| 10573 | + * |
|
| 10574 | + */ |
|
| 10575 | 10575 | public function countOverallArrival($filters = array(),$year = '',$month = '') |
| 10576 | 10576 | { |
| 10577 | 10577 | global $globalDBdriver; |
@@ -10604,11 +10604,11 @@ discard block |
||
| 10604 | 10604 | } |
| 10605 | 10605 | |
| 10606 | 10606 | /** |
| 10607 | - * Counts all pilots that have flown over |
|
| 10608 | - * |
|
| 10609 | - * @return Integer the number of pilots |
|
| 10610 | - * |
|
| 10611 | - */ |
|
| 10607 | + * Counts all pilots that have flown over |
|
| 10608 | + * |
|
| 10609 | + * @return Integer the number of pilots |
|
| 10610 | + * |
|
| 10611 | + */ |
|
| 10612 | 10612 | public function countOverallPilots($filters = array(),$year = '',$month = '') |
| 10613 | 10613 | { |
| 10614 | 10614 | global $globalDBdriver; |
@@ -10640,11 +10640,11 @@ discard block |
||
| 10640 | 10640 | } |
| 10641 | 10641 | |
| 10642 | 10642 | /** |
| 10643 | - * Counts all owners that have flown over |
|
| 10644 | - * |
|
| 10645 | - * @return Integer the number of owners |
|
| 10646 | - * |
|
| 10647 | - */ |
|
| 10643 | + * Counts all owners that have flown over |
|
| 10644 | + * |
|
| 10645 | + * @return Integer the number of owners |
|
| 10646 | + * |
|
| 10647 | + */ |
|
| 10648 | 10648 | public function countOverallOwners($filters = array(),$year = '',$month = '') |
| 10649 | 10649 | { |
| 10650 | 10650 | global $globalDBdriver; |
@@ -10677,11 +10677,11 @@ discard block |
||
| 10677 | 10677 | |
| 10678 | 10678 | |
| 10679 | 10679 | /** |
| 10680 | - * Counts all flights that have flown over |
|
| 10681 | - * |
|
| 10682 | - * @return Integer the number of flights |
|
| 10683 | - * |
|
| 10684 | - */ |
|
| 10680 | + * Counts all flights that have flown over |
|
| 10681 | + * |
|
| 10682 | + * @return Integer the number of flights |
|
| 10683 | + * |
|
| 10684 | + */ |
|
| 10685 | 10685 | public function countOverallFlights($filters = array(),$year = '',$month = '') |
| 10686 | 10686 | { |
| 10687 | 10687 | global $globalDBdriver; |
@@ -10716,11 +10716,11 @@ discard block |
||
| 10716 | 10716 | } |
| 10717 | 10717 | |
| 10718 | 10718 | /** |
| 10719 | - * Counts all military flights that have flown over |
|
| 10720 | - * |
|
| 10721 | - * @return Integer the number of flights |
|
| 10722 | - * |
|
| 10723 | - */ |
|
| 10719 | + * Counts all military flights that have flown over |
|
| 10720 | + * |
|
| 10721 | + * @return Integer the number of flights |
|
| 10722 | + * |
|
| 10723 | + */ |
|
| 10724 | 10724 | public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '') |
| 10725 | 10725 | { |
| 10726 | 10726 | global $globalDBdriver; |
@@ -10755,11 +10755,11 @@ discard block |
||
| 10755 | 10755 | |
| 10756 | 10756 | |
| 10757 | 10757 | /** |
| 10758 | - * Counts all airlines that have flown over |
|
| 10759 | - * |
|
| 10760 | - * @return Integer the number of airlines |
|
| 10761 | - * |
|
| 10762 | - */ |
|
| 10758 | + * Counts all airlines that have flown over |
|
| 10759 | + * |
|
| 10760 | + * @return Integer the number of airlines |
|
| 10761 | + * |
|
| 10762 | + */ |
|
| 10763 | 10763 | public function countOverallAirlines($filters = array(),$year = '',$month = '') |
| 10764 | 10764 | { |
| 10765 | 10765 | global $globalDBdriver; |
@@ -10786,8 +10786,8 @@ discard block |
||
| 10786 | 10786 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 10787 | 10787 | } |
| 10788 | 10788 | } |
| 10789 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 10790 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10789 | + if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 10790 | + else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10791 | 10791 | |
| 10792 | 10792 | |
| 10793 | 10793 | $sth = $this->db->prepare($queryi); |
@@ -10797,11 +10797,11 @@ discard block |
||
| 10797 | 10797 | |
| 10798 | 10798 | |
| 10799 | 10799 | /** |
| 10800 | - * Counts all hours of today |
|
| 10801 | - * |
|
| 10802 | - * @return Array the hour list |
|
| 10803 | - * |
|
| 10804 | - */ |
|
| 10800 | + * Counts all hours of today |
|
| 10801 | + * |
|
| 10802 | + * @return Array the hour list |
|
| 10803 | + * |
|
| 10804 | + */ |
|
| 10805 | 10805 | public function countAllHoursFromToday($filters = array()) |
| 10806 | 10806 | { |
| 10807 | 10807 | global $globalTimezone, $globalDBdriver; |
@@ -10841,11 +10841,11 @@ discard block |
||
| 10841 | 10841 | } |
| 10842 | 10842 | |
| 10843 | 10843 | /** |
| 10844 | - * Gets all the spotter information based on calculated upcoming flights |
|
| 10845 | - * |
|
| 10846 | - * @return Array the spotter information |
|
| 10847 | - * |
|
| 10848 | - */ |
|
| 10844 | + * Gets all the spotter information based on calculated upcoming flights |
|
| 10845 | + * |
|
| 10846 | + * @return Array the spotter information |
|
| 10847 | + * |
|
| 10848 | + */ |
|
| 10849 | 10849 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 10850 | 10850 | { |
| 10851 | 10851 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -10920,12 +10920,12 @@ discard block |
||
| 10920 | 10920 | } |
| 10921 | 10921 | |
| 10922 | 10922 | |
| 10923 | - /** |
|
| 10924 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 10925 | - * |
|
| 10926 | - * @return Integer the Barrie Spotter ID |
|
| 10923 | + /** |
|
| 10924 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 10925 | + * |
|
| 10926 | + * @return Integer the Barrie Spotter ID |
|
| 10927 | 10927 | q * |
| 10928 | - */ |
|
| 10928 | + */ |
|
| 10929 | 10929 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 10930 | 10930 | { |
| 10931 | 10931 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -10946,13 +10946,13 @@ discard block |
||
| 10946 | 10946 | |
| 10947 | 10947 | |
| 10948 | 10948 | /** |
| 10949 | - * Parses a date string |
|
| 10950 | - * |
|
| 10951 | - * @param String $dateString the date string |
|
| 10952 | - * @param String $timezone the timezone of a user |
|
| 10953 | - * @return Array the time information |
|
| 10954 | - * |
|
| 10955 | - */ |
|
| 10949 | + * Parses a date string |
|
| 10950 | + * |
|
| 10951 | + * @param String $dateString the date string |
|
| 10952 | + * @param String $timezone the timezone of a user |
|
| 10953 | + * @return Array the time information |
|
| 10954 | + * |
|
| 10955 | + */ |
|
| 10956 | 10956 | public function parseDateString($dateString, $timezone = '') |
| 10957 | 10957 | { |
| 10958 | 10958 | $time_array = array(); |
@@ -10988,12 +10988,12 @@ discard block |
||
| 10988 | 10988 | |
| 10989 | 10989 | |
| 10990 | 10990 | /** |
| 10991 | - * Parses the direction degrees to working |
|
| 10992 | - * |
|
| 10993 | - * @param Float $direction the direction in degrees |
|
| 10994 | - * @return Array the direction information |
|
| 10995 | - * |
|
| 10996 | - */ |
|
| 10991 | + * Parses the direction degrees to working |
|
| 10992 | + * |
|
| 10993 | + * @param Float $direction the direction in degrees |
|
| 10994 | + * @return Array the direction information |
|
| 10995 | + * |
|
| 10996 | + */ |
|
| 10997 | 10997 | public function parseDirection($direction = 0) |
| 10998 | 10998 | { |
| 10999 | 10999 | if ($direction == '') $direction = 0; |
@@ -11072,12 +11072,12 @@ discard block |
||
| 11072 | 11072 | |
| 11073 | 11073 | |
| 11074 | 11074 | /** |
| 11075 | - * Gets the aircraft registration |
|
| 11076 | - * |
|
| 11077 | - * @param String $flightaware_id the flight aware id |
|
| 11078 | - * @return String the aircraft registration |
|
| 11079 | - * |
|
| 11080 | - */ |
|
| 11075 | + * Gets the aircraft registration |
|
| 11076 | + * |
|
| 11077 | + * @param String $flightaware_id the flight aware id |
|
| 11078 | + * @return String the aircraft registration |
|
| 11079 | + * |
|
| 11080 | + */ |
|
| 11081 | 11081 | |
| 11082 | 11082 | public function getAircraftRegistration($flightaware_id) |
| 11083 | 11083 | { |
@@ -11106,12 +11106,12 @@ discard block |
||
| 11106 | 11106 | |
| 11107 | 11107 | |
| 11108 | 11108 | /** |
| 11109 | - * Gets the aircraft registration from ModeS |
|
| 11110 | - * |
|
| 11111 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 11112 | - * @return String the aircraft registration |
|
| 11113 | - * |
|
| 11114 | - */ |
|
| 11109 | + * Gets the aircraft registration from ModeS |
|
| 11110 | + * |
|
| 11111 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 11112 | + * @return String the aircraft registration |
|
| 11113 | + * |
|
| 11114 | + */ |
|
| 11115 | 11115 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 11116 | 11116 | { |
| 11117 | 11117 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -11124,19 +11124,19 @@ discard block |
||
| 11124 | 11124 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11125 | 11125 | $sth->closeCursor(); |
| 11126 | 11126 | if (count($row) > 0) { |
| 11127 | - //return $row['Registration']; |
|
| 11128 | - return $row['registration']; |
|
| 11127 | + //return $row['Registration']; |
|
| 11128 | + return $row['registration']; |
|
| 11129 | 11129 | } else return ''; |
| 11130 | 11130 | |
| 11131 | 11131 | } |
| 11132 | 11132 | |
| 11133 | 11133 | /** |
| 11134 | - * Gets the aircraft type from ModeS |
|
| 11135 | - * |
|
| 11136 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 11137 | - * @return String the aircraft type |
|
| 11138 | - * |
|
| 11139 | - */ |
|
| 11134 | + * Gets the aircraft type from ModeS |
|
| 11135 | + * |
|
| 11136 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 11137 | + * @return String the aircraft type |
|
| 11138 | + * |
|
| 11139 | + */ |
|
| 11140 | 11140 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 11141 | 11141 | { |
| 11142 | 11142 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -11149,19 +11149,19 @@ discard block |
||
| 11149 | 11149 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11150 | 11150 | $sth->closeCursor(); |
| 11151 | 11151 | if (count($row) > 0) { |
| 11152 | - if ($row['type_flight'] == null) return ''; |
|
| 11153 | - else return $row['type_flight']; |
|
| 11152 | + if ($row['type_flight'] == null) return ''; |
|
| 11153 | + else return $row['type_flight']; |
|
| 11154 | 11154 | } else return ''; |
| 11155 | 11155 | |
| 11156 | 11156 | } |
| 11157 | 11157 | |
| 11158 | 11158 | /** |
| 11159 | - * Gets Country from latitude/longitude |
|
| 11160 | - * |
|
| 11161 | - * @param Float $latitude latitute of the flight |
|
| 11162 | - * @param Float $longitude longitute of the flight |
|
| 11163 | - * @return String the countrie |
|
| 11164 | - */ |
|
| 11159 | + * Gets Country from latitude/longitude |
|
| 11160 | + * |
|
| 11161 | + * @param Float $latitude latitute of the flight |
|
| 11162 | + * @param Float $longitude longitute of the flight |
|
| 11163 | + * @return String the countrie |
|
| 11164 | + */ |
|
| 11165 | 11165 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 11166 | 11166 | { |
| 11167 | 11167 | global $globalDBdriver, $globalDebug; |
@@ -11198,11 +11198,11 @@ discard block |
||
| 11198 | 11198 | } |
| 11199 | 11199 | |
| 11200 | 11200 | /** |
| 11201 | - * Gets Country from iso2 |
|
| 11202 | - * |
|
| 11203 | - * @param String $iso2 ISO2 country code |
|
| 11204 | - * @return String the countrie |
|
| 11205 | - */ |
|
| 11201 | + * Gets Country from iso2 |
|
| 11202 | + * |
|
| 11203 | + * @param String $iso2 ISO2 country code |
|
| 11204 | + * @return String the countrie |
|
| 11205 | + */ |
|
| 11206 | 11206 | public function getCountryFromISO2($iso2) |
| 11207 | 11207 | { |
| 11208 | 11208 | global $globalDBdriver, $globalDebug; |
@@ -11230,12 +11230,12 @@ discard block |
||
| 11230 | 11230 | } |
| 11231 | 11231 | |
| 11232 | 11232 | /** |
| 11233 | - * converts the registration code using the country prefix |
|
| 11234 | - * |
|
| 11235 | - * @param String $registration the aircraft registration |
|
| 11236 | - * @return String the aircraft registration |
|
| 11237 | - * |
|
| 11238 | - */ |
|
| 11233 | + * converts the registration code using the country prefix |
|
| 11234 | + * |
|
| 11235 | + * @param String $registration the aircraft registration |
|
| 11236 | + * @return String the aircraft registration |
|
| 11237 | + * |
|
| 11238 | + */ |
|
| 11239 | 11239 | public function convertAircraftRegistration($registration) |
| 11240 | 11240 | { |
| 11241 | 11241 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11287,12 +11287,12 @@ discard block |
||
| 11287 | 11287 | } |
| 11288 | 11288 | |
| 11289 | 11289 | /** |
| 11290 | - * Country from the registration code |
|
| 11291 | - * |
|
| 11292 | - * @param String $registration the aircraft registration |
|
| 11293 | - * @return String the country |
|
| 11294 | - * |
|
| 11295 | - */ |
|
| 11290 | + * Country from the registration code |
|
| 11291 | + * |
|
| 11292 | + * @param String $registration the aircraft registration |
|
| 11293 | + * @return String the country |
|
| 11294 | + * |
|
| 11295 | + */ |
|
| 11296 | 11296 | public function countryFromAircraftRegistration($registration) |
| 11297 | 11297 | { |
| 11298 | 11298 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11311,8 +11311,8 @@ discard block |
||
| 11311 | 11311 | $country = $row['country']; |
| 11312 | 11312 | } |
| 11313 | 11313 | } else { |
| 11314 | - $registration_1 = substr($registration, 0, 1); |
|
| 11315 | - $registration_2 = substr($registration, 0, 2); |
|
| 11314 | + $registration_1 = substr($registration, 0, 1); |
|
| 11315 | + $registration_2 = substr($registration, 0, 2); |
|
| 11316 | 11316 | |
| 11317 | 11317 | $country = ''; |
| 11318 | 11318 | //first get the prefix based on two characters |
@@ -11348,12 +11348,12 @@ discard block |
||
| 11348 | 11348 | } |
| 11349 | 11349 | |
| 11350 | 11350 | /** |
| 11351 | - * Registration prefix from the registration code |
|
| 11352 | - * |
|
| 11353 | - * @param String $registration the aircraft registration |
|
| 11354 | - * @return String the registration prefix |
|
| 11355 | - * |
|
| 11356 | - */ |
|
| 11351 | + * Registration prefix from the registration code |
|
| 11352 | + * |
|
| 11353 | + * @param String $registration the aircraft registration |
|
| 11354 | + * @return String the registration prefix |
|
| 11355 | + * |
|
| 11356 | + */ |
|
| 11357 | 11357 | public function registrationPrefixFromAircraftRegistration($registration) |
| 11358 | 11358 | { |
| 11359 | 11359 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11372,8 +11372,8 @@ discard block |
||
| 11372 | 11372 | //$country = $row['country']; |
| 11373 | 11373 | } |
| 11374 | 11374 | } else { |
| 11375 | - $registration_1 = substr($registration, 0, 1); |
|
| 11376 | - $registration_2 = substr($registration, 0, 2); |
|
| 11375 | + $registration_1 = substr($registration, 0, 1); |
|
| 11376 | + $registration_2 = substr($registration, 0, 2); |
|
| 11377 | 11377 | |
| 11378 | 11378 | //first get the prefix based on two characters |
| 11379 | 11379 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
@@ -11409,12 +11409,12 @@ discard block |
||
| 11409 | 11409 | |
| 11410 | 11410 | |
| 11411 | 11411 | /** |
| 11412 | - * Country from the registration code |
|
| 11413 | - * |
|
| 11414 | - * @param String $registration the aircraft registration |
|
| 11415 | - * @return String the country |
|
| 11416 | - * |
|
| 11417 | - */ |
|
| 11412 | + * Country from the registration code |
|
| 11413 | + * |
|
| 11414 | + * @param String $registration the aircraft registration |
|
| 11415 | + * @return String the country |
|
| 11416 | + * |
|
| 11417 | + */ |
|
| 11418 | 11418 | public function countryFromAircraftRegistrationCode($registration) |
| 11419 | 11419 | { |
| 11420 | 11420 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11431,11 +11431,11 @@ discard block |
||
| 11431 | 11431 | } |
| 11432 | 11432 | |
| 11433 | 11433 | /** |
| 11434 | - * Set a new highlight value for a flight |
|
| 11435 | - * |
|
| 11436 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 11437 | - * @param String $highlight New highlight value |
|
| 11438 | - */ |
|
| 11434 | + * Set a new highlight value for a flight |
|
| 11435 | + * |
|
| 11436 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 11437 | + * @param String $highlight New highlight value |
|
| 11438 | + */ |
|
| 11439 | 11439 | public function setHighlightFlight($flightaware_id,$highlight) { |
| 11440 | 11440 | |
| 11441 | 11441 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -11444,12 +11444,12 @@ discard block |
||
| 11444 | 11444 | } |
| 11445 | 11445 | |
| 11446 | 11446 | /** |
| 11447 | - * Set a new highlight value for a flight by Registration |
|
| 11448 | - * |
|
| 11449 | - * @param String $registration Registration of the aircraft |
|
| 11450 | - * @param String $date Date of spotted aircraft |
|
| 11451 | - * @param String $highlight New highlight value |
|
| 11452 | - */ |
|
| 11447 | + * Set a new highlight value for a flight by Registration |
|
| 11448 | + * |
|
| 11449 | + * @param String $registration Registration of the aircraft |
|
| 11450 | + * @param String $date Date of spotted aircraft |
|
| 11451 | + * @param String $highlight New highlight value |
|
| 11452 | + */ |
|
| 11453 | 11453 | public function setHighlightFlightByRegistration($registration,$highlight, $date = '') { |
| 11454 | 11454 | if ($date == '') { |
| 11455 | 11455 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)"; |
@@ -11463,12 +11463,12 @@ discard block |
||
| 11463 | 11463 | } |
| 11464 | 11464 | |
| 11465 | 11465 | /** |
| 11466 | - * Gets the short url from bit.ly |
|
| 11467 | - * |
|
| 11468 | - * @param String $url the full url |
|
| 11469 | - * @return String the bit.ly url |
|
| 11470 | - * |
|
| 11471 | - */ |
|
| 11466 | + * Gets the short url from bit.ly |
|
| 11467 | + * |
|
| 11468 | + * @param String $url the full url |
|
| 11469 | + * @return String the bit.ly url |
|
| 11470 | + * |
|
| 11471 | + */ |
|
| 11472 | 11472 | public function getBitlyURL($url) |
| 11473 | 11473 | { |
| 11474 | 11474 | global $globalBitlyAccessToken; |
@@ -11757,11 +11757,11 @@ discard block |
||
| 11757 | 11757 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 11758 | 11758 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 11759 | 11759 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 11760 | - } else { |
|
| 11760 | + } else { |
|
| 11761 | 11761 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
| 11762 | 11762 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 11763 | 11763 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 11764 | - } |
|
| 11764 | + } |
|
| 11765 | 11765 | $sth = $this->db->prepare($query); |
| 11766 | 11766 | $sth->execute(); |
| 11767 | 11767 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -69,7 +69,9 @@ discard block |
||
| 69 | 69 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 72 | + if (is_array($globalFilter)) { |
|
| 73 | + $filter = array_merge($filter,$globalFilter); |
|
| 74 | + } |
|
| 73 | 75 | $filter_query_join = ''; |
| 74 | 76 | $filter_query_where = ''; |
| 75 | 77 | foreach($filters as $flt) { |
@@ -122,8 +124,11 @@ discard block |
||
| 122 | 124 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 123 | 125 | } |
| 124 | 126 | } |
| 125 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 126 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 127 | + if ($filter_query_where == '' && $where) { |
|
| 128 | + $filter_query_where = ' WHERE'; |
|
| 129 | + } elseif ($filter_query_where != '' && $and) { |
|
| 130 | + $filter_query_where .= ' AND'; |
|
| 131 | + } |
|
| 127 | 132 | $filter_query = $filter_query_join.$filter_query_where; |
| 128 | 133 | return $filter_query; |
| 129 | 134 | } |
@@ -143,10 +148,18 @@ discard block |
||
| 143 | 148 | $Image = new Image($this->db); |
| 144 | 149 | $Schedule = new Schedule($this->db); |
| 145 | 150 | $ACARS = new ACARS($this->db); |
| 146 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 147 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 148 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 149 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 151 | + if (!isset($globalIVAO)) { |
|
| 152 | + $globalIVAO = FALSE; |
|
| 153 | + } |
|
| 154 | + if (!isset($globalVATSIM)) { |
|
| 155 | + $globalVATSIM = FALSE; |
|
| 156 | + } |
|
| 157 | + if (!isset($globalphpVMS)) { |
|
| 158 | + $globalphpVMS = FALSE; |
|
| 159 | + } |
|
| 160 | + if (!isset($globalVAM)) { |
|
| 161 | + $globalVAM = FALSE; |
|
| 162 | + } |
|
| 150 | 163 | date_default_timezone_set('UTC'); |
| 151 | 164 | |
| 152 | 165 | if (!is_string($query)) |
@@ -193,21 +206,35 @@ discard block |
||
| 193 | 206 | } else { |
| 194 | 207 | $temp_array['spotter_id'] = ''; |
| 195 | 208 | } |
| 196 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 197 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
| 209 | + if (isset($row['flightaware_id'])) { |
|
| 210 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
| 211 | + } |
|
| 212 | + if (isset($row['modes'])) { |
|
| 213 | + $temp_array['modes'] = $row['modes']; |
|
| 214 | + } |
|
| 198 | 215 | $temp_array['ident'] = $row['ident']; |
| 199 | 216 | if (isset($row['registration']) && $row['registration'] != '') { |
| 200 | 217 | $temp_array['registration'] = $row['registration']; |
| 201 | 218 | } elseif (isset($temp_array['modes'])) { |
| 202 | 219 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
| 203 | - } else $temp_array['registration'] = ''; |
|
| 204 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 220 | + } else { |
|
| 221 | + $temp_array['registration'] = ''; |
|
| 222 | + } |
|
| 223 | + if (isset($row['aircraft_icao'])) { |
|
| 224 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
| 225 | + } |
|
| 205 | 226 | |
| 206 | 227 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
| 207 | 228 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
| 208 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 209 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
| 210 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
| 229 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
| 230 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
| 231 | + } |
|
| 232 | + if (isset($row['latitude'])) { |
|
| 233 | + $temp_array['latitude'] = $row['latitude']; |
|
| 234 | + } |
|
| 235 | + if (isset($row['longitude'])) { |
|
| 236 | + $temp_array['longitude'] = $row['longitude']; |
|
| 237 | + } |
|
| 211 | 238 | /* |
| 212 | 239 | if (Connection->tableExists('countries')) { |
| 213 | 240 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -217,8 +244,12 @@ discard block |
||
| 217 | 244 | } |
| 218 | 245 | } |
| 219 | 246 | */ |
| 220 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
| 221 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
| 247 | + if (isset($row['waypoints'])) { |
|
| 248 | + $temp_array['waypoints'] = $row['waypoints']; |
|
| 249 | + } |
|
| 250 | + if (isset($row['format_source'])) { |
|
| 251 | + $temp_array['format_source'] = $row['format_source']; |
|
| 252 | + } |
|
| 222 | 253 | if (isset($row['route_stop']) && $row['route_stop'] != '') { |
| 223 | 254 | $temp_array['route_stop'] = $row['route_stop']; |
| 224 | 255 | $allroute = explode(' ',$row['route_stop']); |
@@ -234,13 +265,19 @@ discard block |
||
| 234 | 265 | } |
| 235 | 266 | } |
| 236 | 267 | } |
| 237 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
| 268 | + if (isset($row['altitude'])) { |
|
| 269 | + $temp_array['altitude'] = $row['altitude']; |
|
| 270 | + } |
|
| 238 | 271 | if (isset($row['heading'])) { |
| 239 | 272 | $temp_array['heading'] = $row['heading']; |
| 240 | 273 | $heading_direction = $this->parseDirection($row['heading']); |
| 241 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 274 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
| 275 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + if (isset($row['ground_speed'])) { |
|
| 279 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 242 | 280 | } |
| 243 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
| 244 | 281 | $temp_array['image'] = ""; |
| 245 | 282 | $temp_array['image_thumbnail'] = ""; |
| 246 | 283 | $temp_array['image_source'] = ""; |
@@ -248,7 +285,9 @@ discard block |
||
| 248 | 285 | |
| 249 | 286 | if (isset($row['highlight'])) { |
| 250 | 287 | $temp_array['highlight'] = $row['highlight']; |
| 251 | - } else $temp_array['highlight'] = ''; |
|
| 288 | + } else { |
|
| 289 | + $temp_array['highlight'] = ''; |
|
| 290 | + } |
|
| 252 | 291 | |
| 253 | 292 | if (isset($row['date'])) { |
| 254 | 293 | $dateArray = $this->parseDateString($row['date']); |
@@ -302,7 +341,9 @@ discard block |
||
| 302 | 341 | |
| 303 | 342 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 304 | 343 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 305 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 344 | + } else { |
|
| 345 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 346 | + } |
|
| 306 | 347 | } else { |
| 307 | 348 | $temp_array['aircraft_shadow'] = 'default.png'; |
| 308 | 349 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -310,11 +351,17 @@ discard block |
||
| 310 | 351 | } |
| 311 | 352 | } |
| 312 | 353 | $fromsource = NULL; |
| 313 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 314 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 315 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 316 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 317 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 354 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 355 | + $fromsource = $globalAirlinesSource; |
|
| 356 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 357 | + $fromsource = 'vatsim'; |
|
| 358 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 359 | + $fromsource = 'ivao'; |
|
| 360 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 361 | + $fromsource = 'vatsim'; |
|
| 362 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 363 | + $fromsource = 'ivao'; |
|
| 364 | + } |
|
| 318 | 365 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 319 | 366 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 320 | 367 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -337,12 +384,18 @@ discard block |
||
| 337 | 384 | } |
| 338 | 385 | } else { |
| 339 | 386 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 340 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 341 | - else $temp_array['airline_iata'] = 'N/A'; |
|
| 387 | + if (isset($row['airline_iata'])) { |
|
| 388 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
| 389 | + } else { |
|
| 390 | + $temp_array['airline_iata'] = 'N/A'; |
|
| 391 | + } |
|
| 342 | 392 | $temp_array['airline_name'] = $row['airline_name']; |
| 343 | 393 | $temp_array['airline_country'] = $row['airline_country']; |
| 344 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 345 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
| 394 | + if (isset($row['airline_callsign'])) { |
|
| 395 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
| 396 | + } else { |
|
| 397 | + $temp_array['airline_callsign'] = 'N/A'; |
|
| 398 | + } |
|
| 346 | 399 | $temp_array['airline_type'] = $row['airline_type']; |
| 347 | 400 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
| 348 | 401 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -369,7 +422,9 @@ discard block |
||
| 369 | 422 | } |
| 370 | 423 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
| 371 | 424 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
| 372 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 425 | + if ($owner_info['owner'] != '') { |
|
| 426 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
| 427 | + } |
|
| 373 | 428 | $temp_array['aircraft_base'] = $owner_info['base']; |
| 374 | 429 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 375 | 430 | } |
@@ -377,9 +432,14 @@ discard block |
||
| 377 | 432 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
| 378 | 433 | { |
| 379 | 434 | if ($globalIVAO) { |
| 380 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 381 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 382 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 435 | + if (isset($temp_array['airline_icao'])) { |
|
| 436 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 437 | + } else { |
|
| 438 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 439 | + } |
|
| 440 | + } else { |
|
| 441 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
| 442 | + } |
|
| 383 | 443 | if (count($image_array) > 0) { |
| 384 | 444 | $temp_array['image'] = $image_array[0]['image']; |
| 385 | 445 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -431,7 +491,9 @@ discard block |
||
| 431 | 491 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
| 432 | 492 | if ($row['departure_airport_icao'] != '') { |
| 433 | 493 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
| 434 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 494 | + if (!isset($departure_airport_array[0]['name'])) { |
|
| 495 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 496 | + } |
|
| 435 | 497 | /* |
| 436 | 498 | } elseif ($row['departure_airport_name'] != '') { |
| 437 | 499 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -439,7 +501,9 @@ discard block |
||
| 439 | 501 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 440 | 502 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
| 441 | 503 | */ |
| 442 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 504 | + } else { |
|
| 505 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 506 | + } |
|
| 443 | 507 | if (isset($departure_airport_array[0]['name'])) { |
| 444 | 508 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
| 445 | 509 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -459,8 +523,12 @@ discard block |
||
| 459 | 523 | |
| 460 | 524 | if ($row['arrival_airport_icao'] != '') { |
| 461 | 525 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
| 462 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 463 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 526 | + if (count($arrival_airport_array) == 0) { |
|
| 527 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 528 | + } |
|
| 529 | + } else { |
|
| 530 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 531 | + } |
|
| 464 | 532 | if (isset($arrival_airport_array[0]['name'])) { |
| 465 | 533 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
| 466 | 534 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -476,27 +544,45 @@ discard block |
||
| 476 | 544 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 477 | 545 | } |
| 478 | 546 | */ |
| 479 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 480 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 481 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
| 482 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
| 483 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
| 547 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
| 548 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
| 549 | + } |
|
| 550 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
| 551 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
| 552 | + } |
|
| 553 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
| 554 | + $temp_array['source_name'] = $row['source_name']; |
|
| 555 | + } |
|
| 556 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
| 557 | + $temp_array['over_country'] = $row['over_country']; |
|
| 558 | + } |
|
| 559 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
| 560 | + $temp_array['distance'] = $row['distance']; |
|
| 561 | + } |
|
| 484 | 562 | if (isset($row['squawk'])) { |
| 485 | 563 | $temp_array['squawk'] = $row['squawk']; |
| 486 | 564 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 487 | 565 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
| 488 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 566 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 567 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 568 | + } |
|
| 489 | 569 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 490 | 570 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
| 491 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 492 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 571 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
| 572 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 573 | + } |
|
| 574 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
| 575 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 576 | + } |
|
| 493 | 577 | } |
| 494 | 578 | |
| 495 | 579 | $temp_array['query_number_rows'] = $num_rows; |
| 496 | 580 | |
| 497 | 581 | $spotter_array[] = $temp_array; |
| 498 | 582 | } |
| 499 | - if ($num_rows == 0) return array(); |
|
| 583 | + if ($num_rows == 0) { |
|
| 584 | + return array(); |
|
| 585 | + } |
|
| 500 | 586 | $spotter_array[0]['query_number_rows'] = $num_rows; |
| 501 | 587 | return $spotter_array; |
| 502 | 588 | } |
@@ -529,7 +615,9 @@ discard block |
||
| 529 | 615 | foreach ($q_array as $q_item){ |
| 530 | 616 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
| 531 | 617 | $additional_query .= " AND ("; |
| 532 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 618 | + if (is_int($q_item)) { |
|
| 619 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
| 620 | + } |
|
| 533 | 621 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 534 | 622 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
| 535 | 623 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -550,7 +638,9 @@ discard block |
||
| 550 | 638 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
| 551 | 639 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
| 552 | 640 | $translate = $Translation->ident2icao($q_item); |
| 553 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 641 | + if ($translate != $q_item) { |
|
| 642 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
| 643 | + } |
|
| 554 | 644 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
| 555 | 645 | $additional_query .= ")"; |
| 556 | 646 | } |
@@ -777,7 +867,9 @@ discard block |
||
| 777 | 867 | date_default_timezone_set($globalTimezone); |
| 778 | 868 | $datetime = new DateTime(); |
| 779 | 869 | $offset = $datetime->format('P'); |
| 780 | - } else $offset = '+00:00'; |
|
| 870 | + } else { |
|
| 871 | + $offset = '+00:00'; |
|
| 872 | + } |
|
| 781 | 873 | |
| 782 | 874 | if ($date_array[1] != "") |
| 783 | 875 | { |
@@ -809,8 +901,12 @@ discard block |
||
| 809 | 901 | { |
| 810 | 902 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 811 | 903 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 812 | - } else $limit_query = ""; |
|
| 813 | - } else $limit_query = ""; |
|
| 904 | + } else { |
|
| 905 | + $limit_query = ""; |
|
| 906 | + } |
|
| 907 | + } else { |
|
| 908 | + $limit_query = ""; |
|
| 909 | + } |
|
| 814 | 910 | |
| 815 | 911 | |
| 816 | 912 | if ($sort != "") |
@@ -878,8 +974,12 @@ discard block |
||
| 878 | 974 | { |
| 879 | 975 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 880 | 976 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 881 | - } else $limit_query = ""; |
|
| 882 | - } else $limit_query = ""; |
|
| 977 | + } else { |
|
| 978 | + $limit_query = ""; |
|
| 979 | + } |
|
| 980 | + } else { |
|
| 981 | + $limit_query = ""; |
|
| 982 | + } |
|
| 883 | 983 | |
| 884 | 984 | if ($sort != "") |
| 885 | 985 | { |
@@ -1203,7 +1303,9 @@ discard block |
||
| 1203 | 1303 | global $global_query; |
| 1204 | 1304 | |
| 1205 | 1305 | date_default_timezone_set('UTC'); |
| 1206 | - if ($id == '') return array(); |
|
| 1306 | + if ($id == '') { |
|
| 1307 | + return array(); |
|
| 1308 | + } |
|
| 1207 | 1309 | $additional_query = "spotter_output.spotter_id = :id"; |
| 1208 | 1310 | $query_values = array(':id' => $id); |
| 1209 | 1311 | |
@@ -1940,7 +2042,9 @@ discard block |
||
| 1940 | 2042 | { |
| 1941 | 2043 | $highlight = $row['highlight']; |
| 1942 | 2044 | } |
| 1943 | - if (isset($highlight)) return $highlight; |
|
| 2045 | + if (isset($highlight)) { |
|
| 2046 | + return $highlight; |
|
| 2047 | + } |
|
| 1944 | 2048 | } |
| 1945 | 2049 | |
| 1946 | 2050 | |
@@ -1968,7 +2072,9 @@ discard block |
||
| 1968 | 2072 | $sth->closeCursor(); |
| 1969 | 2073 | if (count($row) > 0) { |
| 1970 | 2074 | return $row['usage']; |
| 1971 | - } else return ''; |
|
| 2075 | + } else { |
|
| 2076 | + return ''; |
|
| 2077 | + } |
|
| 1972 | 2078 | } |
| 1973 | 2079 | |
| 1974 | 2080 | /** |
@@ -1993,7 +2099,9 @@ discard block |
||
| 1993 | 2099 | $sth->closeCursor(); |
| 1994 | 2100 | if (count($row) > 0) { |
| 1995 | 2101 | return $row['icao']; |
| 1996 | - } else return ''; |
|
| 2102 | + } else { |
|
| 2103 | + return ''; |
|
| 2104 | + } |
|
| 1997 | 2105 | } |
| 1998 | 2106 | |
| 1999 | 2107 | /** |
@@ -2021,7 +2129,9 @@ discard block |
||
| 2021 | 2129 | $airport_longitude = $row['longitude']; |
| 2022 | 2130 | $Common = new Common(); |
| 2023 | 2131 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
| 2024 | - } else return ''; |
|
| 2132 | + } else { |
|
| 2133 | + return ''; |
|
| 2134 | + } |
|
| 2025 | 2135 | } |
| 2026 | 2136 | |
| 2027 | 2137 | /** |
@@ -2133,7 +2243,9 @@ discard block |
||
| 2133 | 2243 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2134 | 2244 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2135 | 2245 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2136 | - } else return array(); |
|
| 2246 | + } else { |
|
| 2247 | + return array(); |
|
| 2248 | + } |
|
| 2137 | 2249 | if ($globalDBdriver == 'mysql') { |
| 2138 | 2250 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
| 2139 | 2251 | } else { |
@@ -2168,7 +2280,9 @@ discard block |
||
| 2168 | 2280 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2169 | 2281 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2170 | 2282 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 2171 | - } else return array(); |
|
| 2283 | + } else { |
|
| 2284 | + return array(); |
|
| 2285 | + } |
|
| 2172 | 2286 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2173 | 2287 | $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 2174 | 2288 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2203,7 +2317,9 @@ discard block |
||
| 2203 | 2317 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2204 | 2318 | { |
| 2205 | 2319 | global $globalUseRealAirlines; |
| 2206 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2320 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2321 | + $fromsource = NULL; |
|
| 2322 | + } |
|
| 2207 | 2323 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
| 2208 | 2324 | if ($airline_icao == 'NA') { |
| 2209 | 2325 | $airline_array = array(); |
@@ -2272,7 +2388,9 @@ discard block |
||
| 2272 | 2388 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2273 | 2389 | { |
| 2274 | 2390 | global $globalUseRealAirlines; |
| 2275 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
| 2391 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
| 2392 | + $fromsource = NULL; |
|
| 2393 | + } |
|
| 2276 | 2394 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
| 2277 | 2395 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
| 2278 | 2396 | $sth = $this->db->prepare($query); |
@@ -2288,7 +2406,9 @@ discard block |
||
| 2288 | 2406 | $sth->execute(array(':fromsource' => $fromsource)); |
| 2289 | 2407 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2290 | 2408 | $sth->closeCursor(); |
| 2291 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2409 | + if ($row['nb'] == 0) { |
|
| 2410 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
| 2411 | + } |
|
| 2292 | 2412 | } |
| 2293 | 2413 | return $result; |
| 2294 | 2414 | } |
@@ -2351,15 +2471,20 @@ discard block |
||
| 2351 | 2471 | 'A320-211' => 'A320', |
| 2352 | 2472 | '747-8i' => 'B748', |
| 2353 | 2473 | 'A380' => 'A388'); |
| 2354 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
| 2474 | + if (isset($all_aircraft[$aircraft_type])) { |
|
| 2475 | + return $all_aircraft[$aircraft_type]; |
|
| 2476 | + } |
|
| 2355 | 2477 | |
| 2356 | 2478 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
| 2357 | 2479 | $aircraft_type = strtoupper($aircraft_type); |
| 2358 | 2480 | $sth = $this->db->prepare($query); |
| 2359 | 2481 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
| 2360 | 2482 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2361 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
| 2362 | - else return ''; |
|
| 2483 | + if (isset($result[0]['icao'])) { |
|
| 2484 | + return $result[0]['icao']; |
|
| 2485 | + } else { |
|
| 2486 | + return ''; |
|
| 2487 | + } |
|
| 2363 | 2488 | } |
| 2364 | 2489 | |
| 2365 | 2490 | /** |
@@ -2382,9 +2507,13 @@ discard block |
||
| 2382 | 2507 | $sth->closeCursor(); |
| 2383 | 2508 | if (isset($row['icaotypecode'])) { |
| 2384 | 2509 | $icao = $row['icaotypecode']; |
| 2385 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2510 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
| 2511 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
| 2512 | + } |
|
| 2386 | 2513 | return $icao; |
| 2387 | - } else return ''; |
|
| 2514 | + } else { |
|
| 2515 | + return ''; |
|
| 2516 | + } |
|
| 2388 | 2517 | } |
| 2389 | 2518 | |
| 2390 | 2519 | /** |
@@ -2407,7 +2536,9 @@ discard block |
||
| 2407 | 2536 | $sth->closeCursor(); |
| 2408 | 2537 | if (isset($row['icaotypecode'])) { |
| 2409 | 2538 | return $row['icaotypecode']; |
| 2410 | - } else return ''; |
|
| 2539 | + } else { |
|
| 2540 | + return ''; |
|
| 2541 | + } |
|
| 2411 | 2542 | } |
| 2412 | 2543 | |
| 2413 | 2544 | /** |
@@ -2453,7 +2584,9 @@ discard block |
||
| 2453 | 2584 | $sth->closeCursor(); |
| 2454 | 2585 | if (isset($row['operator_correct'])) { |
| 2455 | 2586 | return $row['operator_correct']; |
| 2456 | - } else return $operator; |
|
| 2587 | + } else { |
|
| 2588 | + return $operator; |
|
| 2589 | + } |
|
| 2457 | 2590 | } |
| 2458 | 2591 | |
| 2459 | 2592 | /** |
@@ -2466,7 +2599,9 @@ discard block |
||
| 2466 | 2599 | public function getRouteInfo($callsign) |
| 2467 | 2600 | { |
| 2468 | 2601 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2469 | - if ($callsign == '') return array(); |
|
| 2602 | + if ($callsign == '') { |
|
| 2603 | + return array(); |
|
| 2604 | + } |
|
| 2470 | 2605 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
| 2471 | 2606 | |
| 2472 | 2607 | $sth = $this->db->prepare($query); |
@@ -2476,7 +2611,9 @@ discard block |
||
| 2476 | 2611 | $sth->closeCursor(); |
| 2477 | 2612 | if (count($row) > 0) { |
| 2478 | 2613 | return $row; |
| 2479 | - } else return array(); |
|
| 2614 | + } else { |
|
| 2615 | + return array(); |
|
| 2616 | + } |
|
| 2480 | 2617 | } |
| 2481 | 2618 | |
| 2482 | 2619 | /** |
@@ -2529,7 +2666,9 @@ discard block |
||
| 2529 | 2666 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 2530 | 2667 | $sth->closeCursor(); |
| 2531 | 2668 | return $result; |
| 2532 | - } else return array(); |
|
| 2669 | + } else { |
|
| 2670 | + return array(); |
|
| 2671 | + } |
|
| 2533 | 2672 | } |
| 2534 | 2673 | |
| 2535 | 2674 | |
@@ -2688,8 +2827,11 @@ discard block |
||
| 2688 | 2827 | $query .= " ORDER BY spotter_output.source_name ASC"; |
| 2689 | 2828 | |
| 2690 | 2829 | $sth = $this->db->prepare($query); |
| 2691 | - if (!empty($query_values)) $sth->execute($query_values); |
|
| 2692 | - else $sth->execute(); |
|
| 2830 | + if (!empty($query_values)) { |
|
| 2831 | + $sth->execute($query_values); |
|
| 2832 | + } else { |
|
| 2833 | + $sth->execute(); |
|
| 2834 | + } |
|
| 2693 | 2835 | |
| 2694 | 2836 | $source_array = array(); |
| 2695 | 2837 | $temp_array = array(); |
@@ -2722,9 +2864,13 @@ discard block |
||
| 2722 | 2864 | WHERE spotter_output.airline_icao <> '' |
| 2723 | 2865 | ORDER BY spotter_output.airline_name ASC"; |
| 2724 | 2866 | */ |
| 2725 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2726 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2727 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2867 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2868 | + $forsource = $globalAirlinesSource; |
|
| 2869 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2870 | + $forsource = 'vatsim'; |
|
| 2871 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2872 | + $forsource = 'ivao'; |
|
| 2873 | + } |
|
| 2728 | 2874 | if ($forsource === NULL) { |
| 2729 | 2875 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
| 2730 | 2876 | $query_data = array(); |
@@ -2767,9 +2913,13 @@ discard block |
||
| 2767 | 2913 | { |
| 2768 | 2914 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
| 2769 | 2915 | $filter_query = $this->getFilter($filters,true,true); |
| 2770 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
| 2771 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
| 2772 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
| 2916 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 2917 | + $forsource = $globalAirlinesSource; |
|
| 2918 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 2919 | + $forsource = 'vatsim'; |
|
| 2920 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 2921 | + $forsource = 'ivao'; |
|
| 2922 | + } |
|
| 2773 | 2923 | if ($forsource === NULL) { |
| 2774 | 2924 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
| 2775 | 2925 | $query_data = array(); |
@@ -3080,7 +3230,9 @@ discard block |
||
| 3080 | 3230 | date_default_timezone_set($globalTimezone); |
| 3081 | 3231 | $datetime = new DateTime(); |
| 3082 | 3232 | $offset = $datetime->format('P'); |
| 3083 | - } else $offset = '+00:00'; |
|
| 3233 | + } else { |
|
| 3234 | + $offset = '+00:00'; |
|
| 3235 | + } |
|
| 3084 | 3236 | if ($airport_icao == '') { |
| 3085 | 3237 | if ($globalDBdriver == 'mysql') { |
| 3086 | 3238 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3112,7 +3264,9 @@ discard block |
||
| 3112 | 3264 | date_default_timezone_set($globalTimezone); |
| 3113 | 3265 | $datetime = new DateTime(); |
| 3114 | 3266 | $offset = $datetime->format('P'); |
| 3115 | - } else $offset = '+00:00'; |
|
| 3267 | + } else { |
|
| 3268 | + $offset = '+00:00'; |
|
| 3269 | + } |
|
| 3116 | 3270 | if ($airport_icao == '') { |
| 3117 | 3271 | if ($globalDBdriver == 'mysql') { |
| 3118 | 3272 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3145,7 +3299,9 @@ discard block |
||
| 3145 | 3299 | date_default_timezone_set($globalTimezone); |
| 3146 | 3300 | $datetime = new DateTime(); |
| 3147 | 3301 | $offset = $datetime->format('P'); |
| 3148 | - } else $offset = '+00:00'; |
|
| 3302 | + } else { |
|
| 3303 | + $offset = '+00:00'; |
|
| 3304 | + } |
|
| 3149 | 3305 | if ($airport_icao == '') { |
| 3150 | 3306 | if ($globalDBdriver == 'mysql') { |
| 3151 | 3307 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3184,7 +3340,9 @@ discard block |
||
| 3184 | 3340 | date_default_timezone_set($globalTimezone); |
| 3185 | 3341 | $datetime = new DateTime(); |
| 3186 | 3342 | $offset = $datetime->format('P'); |
| 3187 | - } else $offset = '+00:00'; |
|
| 3343 | + } else { |
|
| 3344 | + $offset = '+00:00'; |
|
| 3345 | + } |
|
| 3188 | 3346 | if ($airport_icao == '') { |
| 3189 | 3347 | if ($globalDBdriver == 'mysql') { |
| 3190 | 3348 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3229,7 +3387,9 @@ discard block |
||
| 3229 | 3387 | date_default_timezone_set($globalTimezone); |
| 3230 | 3388 | $datetime = new DateTime(); |
| 3231 | 3389 | $offset = $datetime->format('P'); |
| 3232 | - } else $offset = '+00:00'; |
|
| 3390 | + } else { |
|
| 3391 | + $offset = '+00:00'; |
|
| 3392 | + } |
|
| 3233 | 3393 | if ($airport_icao == '') { |
| 3234 | 3394 | if ($globalDBdriver == 'mysql') { |
| 3235 | 3395 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3264,7 +3424,9 @@ discard block |
||
| 3264 | 3424 | date_default_timezone_set($globalTimezone); |
| 3265 | 3425 | $datetime = new DateTime(); |
| 3266 | 3426 | $offset = $datetime->format('P'); |
| 3267 | - } else $offset = '+00:00'; |
|
| 3427 | + } else { |
|
| 3428 | + $offset = '+00:00'; |
|
| 3429 | + } |
|
| 3268 | 3430 | if ($airport_icao == '') { |
| 3269 | 3431 | if ($globalDBdriver == 'mysql') { |
| 3270 | 3432 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3306,7 +3468,9 @@ discard block |
||
| 3306 | 3468 | date_default_timezone_set($globalTimezone); |
| 3307 | 3469 | $datetime = new DateTime(); |
| 3308 | 3470 | $offset = $datetime->format('P'); |
| 3309 | - } else $offset = '+00:00'; |
|
| 3471 | + } else { |
|
| 3472 | + $offset = '+00:00'; |
|
| 3473 | + } |
|
| 3310 | 3474 | if ($airport_icao == '') { |
| 3311 | 3475 | if ($globalDBdriver == 'mysql') { |
| 3312 | 3476 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3340,7 +3504,9 @@ discard block |
||
| 3340 | 3504 | date_default_timezone_set($globalTimezone); |
| 3341 | 3505 | $datetime = new DateTime(); |
| 3342 | 3506 | $offset = $datetime->format('P'); |
| 3343 | - } else $offset = '+00:00'; |
|
| 3507 | + } else { |
|
| 3508 | + $offset = '+00:00'; |
|
| 3509 | + } |
|
| 3344 | 3510 | if ($airport_icao == '') { |
| 3345 | 3511 | if ($globalDBdriver == 'mysql') { |
| 3346 | 3512 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3388,7 +3554,9 @@ discard block |
||
| 3388 | 3554 | date_default_timezone_set($globalTimezone); |
| 3389 | 3555 | $datetime = new DateTime(); |
| 3390 | 3556 | $offset = $datetime->format('P'); |
| 3391 | - } else $offset = '+00:00'; |
|
| 3557 | + } else { |
|
| 3558 | + $offset = '+00:00'; |
|
| 3559 | + } |
|
| 3392 | 3560 | |
| 3393 | 3561 | if ($globalDBdriver == 'mysql') { |
| 3394 | 3562 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3508,7 +3676,9 @@ discard block |
||
| 3508 | 3676 | */ |
| 3509 | 3677 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3510 | 3678 | { |
| 3511 | - if ($groundspeed == '') $groundspeed = NULL; |
|
| 3679 | + if ($groundspeed == '') { |
|
| 3680 | + $groundspeed = NULL; |
|
| 3681 | + } |
|
| 3512 | 3682 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3513 | 3683 | $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
| 3514 | 3684 | |
@@ -3558,10 +3728,18 @@ discard block |
||
| 3558 | 3728 | $Image = new Image($this->db); |
| 3559 | 3729 | $Common = new Common(); |
| 3560 | 3730 | |
| 3561 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
| 3562 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
| 3563 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
| 3564 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
| 3731 | + if (!isset($globalIVAO)) { |
|
| 3732 | + $globalIVAO = FALSE; |
|
| 3733 | + } |
|
| 3734 | + if (!isset($globalVATSIM)) { |
|
| 3735 | + $globalVATSIM = FALSE; |
|
| 3736 | + } |
|
| 3737 | + if (!isset($globalphpVMS)) { |
|
| 3738 | + $globalphpVMS = FALSE; |
|
| 3739 | + } |
|
| 3740 | + if (!isset($globalVAM)) { |
|
| 3741 | + $globalVAM = FALSE; |
|
| 3742 | + } |
|
| 3565 | 3743 | date_default_timezone_set('UTC'); |
| 3566 | 3744 | |
| 3567 | 3745 | //getting the registration |
@@ -3574,23 +3752,33 @@ discard block |
||
| 3574 | 3752 | if ($ModeS != '') { |
| 3575 | 3753 | $timeelapsed = microtime(true); |
| 3576 | 3754 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3577 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3755 | + if ($globalDebugTimeElapsed) { |
|
| 3756 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3757 | + } |
|
| 3578 | 3758 | } else { |
| 3579 | 3759 | $myhex = explode('-',$flightaware_id); |
| 3580 | 3760 | if (count($myhex) > 0) { |
| 3581 | 3761 | $timeelapsed = microtime(true); |
| 3582 | 3762 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3583 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3763 | + if ($globalDebugTimeElapsed) { |
|
| 3764 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3765 | + } |
|
| 3584 | 3766 | } |
| 3585 | 3767 | } |
| 3586 | 3768 | } |
| 3587 | 3769 | } |
| 3588 | 3770 | $fromsource = NULL; |
| 3589 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 3590 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 3591 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
| 3592 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 3593 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 3771 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 3772 | + $fromsource = $globalAirlinesSource; |
|
| 3773 | + } elseif ($format_source == 'vatsimtxt') { |
|
| 3774 | + $fromsource = 'vatsim'; |
|
| 3775 | + } elseif ($format_source == 'whazzup') { |
|
| 3776 | + $fromsource = 'ivao'; |
|
| 3777 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 3778 | + $fromsource = 'vatsim'; |
|
| 3779 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 3780 | + $fromsource = 'ivao'; |
|
| 3781 | + } |
|
| 3594 | 3782 | //getting the airline information |
| 3595 | 3783 | if ($ident != "") |
| 3596 | 3784 | { |
@@ -3614,15 +3802,21 @@ discard block |
||
| 3614 | 3802 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
| 3615 | 3803 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3616 | 3804 | } |
| 3617 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3805 | + if ($globalDebugTimeElapsed) { |
|
| 3806 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3807 | + } |
|
| 3618 | 3808 | |
| 3619 | 3809 | } else { |
| 3620 | 3810 | $timeelapsed = microtime(true); |
| 3621 | 3811 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3622 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3812 | + if ($globalDebugTimeElapsed) { |
|
| 3813 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3814 | + } |
|
| 3623 | 3815 | } |
| 3624 | 3816 | } |
| 3625 | - } else $airline_array = array(); |
|
| 3817 | + } else { |
|
| 3818 | + $airline_array = array(); |
|
| 3819 | + } |
|
| 3626 | 3820 | |
| 3627 | 3821 | //getting the aircraft information |
| 3628 | 3822 | $aircraft_array = array(); |
@@ -3636,27 +3830,37 @@ discard block |
||
| 3636 | 3830 | { |
| 3637 | 3831 | $timeelapsed = microtime(true); |
| 3638 | 3832 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3639 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3833 | + if ($globalDebugTimeElapsed) { |
|
| 3834 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3835 | + } |
|
| 3640 | 3836 | } else { |
| 3641 | 3837 | $timeelapsed = microtime(true); |
| 3642 | 3838 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3643 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3839 | + if ($globalDebugTimeElapsed) { |
|
| 3840 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3841 | + } |
|
| 3644 | 3842 | } |
| 3645 | 3843 | } |
| 3646 | 3844 | } else { |
| 3647 | 3845 | if ($ModeS != '') { |
| 3648 | 3846 | $timeelapsed = microtime(true); |
| 3649 | 3847 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3650 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3848 | + if ($globalDebugTimeElapsed) { |
|
| 3849 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3850 | + } |
|
| 3651 | 3851 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3652 | 3852 | { |
| 3653 | 3853 | $timeelapsed = microtime(true); |
| 3654 | 3854 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3655 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3855 | + if ($globalDebugTimeElapsed) { |
|
| 3856 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3857 | + } |
|
| 3656 | 3858 | } else { |
| 3657 | 3859 | $timeelapsed = microtime(true); |
| 3658 | 3860 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3659 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3861 | + if ($globalDebugTimeElapsed) { |
|
| 3862 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3863 | + } |
|
| 3660 | 3864 | } |
| 3661 | 3865 | } |
| 3662 | 3866 | } |
@@ -3672,7 +3876,9 @@ discard block |
||
| 3672 | 3876 | } else { |
| 3673 | 3877 | $timeelapsed = microtime(true); |
| 3674 | 3878 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3675 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3879 | + if ($globalDebugTimeElapsed) { |
|
| 3880 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3881 | + } |
|
| 3676 | 3882 | } |
| 3677 | 3883 | } |
| 3678 | 3884 | |
@@ -3687,7 +3893,9 @@ discard block |
||
| 3687 | 3893 | } else { |
| 3688 | 3894 | $timeelapsed = microtime(true); |
| 3689 | 3895 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3690 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3896 | + if ($globalDebugTimeElapsed) { |
|
| 3897 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3898 | + } |
|
| 3691 | 3899 | } |
| 3692 | 3900 | } |
| 3693 | 3901 | |
@@ -3721,7 +3929,9 @@ discard block |
||
| 3721 | 3929 | { |
| 3722 | 3930 | return false; |
| 3723 | 3931 | } |
| 3724 | - } else $altitude = 0; |
|
| 3932 | + } else { |
|
| 3933 | + $altitude = 0; |
|
| 3934 | + } |
|
| 3725 | 3935 | |
| 3726 | 3936 | if ($heading != "") |
| 3727 | 3937 | { |
@@ -3750,7 +3960,9 @@ discard block |
||
| 3750 | 3960 | { |
| 3751 | 3961 | $timeelapsed = microtime(true); |
| 3752 | 3962 | $image_array = $Image->getSpotterImage($registration); |
| 3753 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3963 | + if ($globalDebugTimeElapsed) { |
|
| 3964 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3965 | + } |
|
| 3754 | 3966 | if (!isset($image_array[0]['registration'])) |
| 3755 | 3967 | { |
| 3756 | 3968 | //echo "Add image !!!! \n"; |
@@ -3758,14 +3970,21 @@ discard block |
||
| 3758 | 3970 | } |
| 3759 | 3971 | $timeelapsed = microtime(true); |
| 3760 | 3972 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3761 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3762 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3973 | + if ($globalDebugTimeElapsed) { |
|
| 3974 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3975 | + } |
|
| 3976 | + if ($owner_info['owner'] != '') { |
|
| 3977 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
| 3978 | + } |
|
| 3763 | 3979 | } |
| 3764 | 3980 | |
| 3765 | 3981 | if ($globalIVAO && $aircraft_icao != '') |
| 3766 | 3982 | { |
| 3767 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3768 | - else $airline_icao = ''; |
|
| 3983 | + if (isset($airline_array[0]['icao'])) { |
|
| 3984 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3985 | + } else { |
|
| 3986 | + $airline_icao = ''; |
|
| 3987 | + } |
|
| 3769 | 3988 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3770 | 3989 | if (!isset($image_array[0]['registration'])) |
| 3771 | 3990 | { |
@@ -3810,16 +4029,28 @@ discard block |
||
| 3810 | 4029 | { |
| 3811 | 4030 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
| 3812 | 4031 | } |
| 3813 | - if ($registration == '') $registration = 'NA'; |
|
| 4032 | + if ($registration == '') { |
|
| 4033 | + $registration = 'NA'; |
|
| 4034 | + } |
|
| 3814 | 4035 | if ($latitude == '' && $longitude == '') { |
| 3815 | 4036 | $latitude = 0; |
| 3816 | 4037 | $longitude = 0; |
| 3817 | 4038 | } |
| 3818 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3819 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3820 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3821 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3822 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 4039 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
| 4040 | + $squawk = NULL; |
|
| 4041 | + } |
|
| 4042 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
| 4043 | + $verticalrate = NULL; |
|
| 4044 | + } |
|
| 4045 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
| 4046 | + $heading = 0; |
|
| 4047 | + } |
|
| 4048 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
| 4049 | + $groundspeed = 0; |
|
| 4050 | + } |
|
| 4051 | + if (!isset($aircraft_owner)) { |
|
| 4052 | + $aircraft_owner = NULL; |
|
| 4053 | + } |
|
| 3823 | 4054 | $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
| 3824 | 4055 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3825 | 4056 | |
@@ -3830,9 +4061,13 @@ discard block |
||
| 3830 | 4061 | if ($airline_type == '') { |
| 3831 | 4062 | $timeelapsed = microtime(true); |
| 3832 | 4063 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3833 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4064 | + if ($globalDebugTimeElapsed) { |
|
| 4065 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 4066 | + } |
|
| 4067 | + } |
|
| 4068 | + if ($airline_type == null) { |
|
| 4069 | + $airline_type = ''; |
|
| 3834 | 4070 | } |
| 3835 | - if ($airline_type == null) $airline_type = ''; |
|
| 3836 | 4071 | $aircraft_type = $aircraft_array[0]['type']; |
| 3837 | 4072 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
| 3838 | 4073 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -3996,7 +4231,9 @@ discard block |
||
| 3996 | 4231 | } |
| 3997 | 4232 | } |
| 3998 | 4233 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
| 3999 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4234 | + if ($limit) { |
|
| 4235 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4236 | + } |
|
| 4000 | 4237 | |
| 4001 | 4238 | $sth = $this->db->prepare($query); |
| 4002 | 4239 | $sth->execute($query_values); |
@@ -4069,7 +4306,9 @@ discard block |
||
| 4069 | 4306 | } |
| 4070 | 4307 | |
| 4071 | 4308 | $query .= " GROUP BY spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4072 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4309 | + if ($limit) { |
|
| 4310 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4311 | + } |
|
| 4073 | 4312 | |
| 4074 | 4313 | |
| 4075 | 4314 | $sth = $this->db->prepare($query); |
@@ -4113,7 +4352,9 @@ discard block |
||
| 4113 | 4352 | } |
| 4114 | 4353 | } |
| 4115 | 4354 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
| 4116 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4355 | + if ($limit) { |
|
| 4356 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4357 | + } |
|
| 4117 | 4358 | |
| 4118 | 4359 | |
| 4119 | 4360 | $sth = $this->db->prepare($query); |
@@ -4189,7 +4430,9 @@ discard block |
||
| 4189 | 4430 | } |
| 4190 | 4431 | } |
| 4191 | 4432 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4192 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4433 | + if ($limit) { |
|
| 4434 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4435 | + } |
|
| 4193 | 4436 | |
| 4194 | 4437 | $sth = $this->db->prepare($query); |
| 4195 | 4438 | $sth->execute($query_values); |
@@ -4231,7 +4474,9 @@ discard block |
||
| 4231 | 4474 | } |
| 4232 | 4475 | } |
| 4233 | 4476 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
| 4234 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 4477 | + if ($limit) { |
|
| 4478 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 4479 | + } |
|
| 4235 | 4480 | |
| 4236 | 4481 | |
| 4237 | 4482 | $sth = $this->db->prepare($query); |
@@ -4474,7 +4719,9 @@ discard block |
||
| 4474 | 4719 | date_default_timezone_set($globalTimezone); |
| 4475 | 4720 | $datetime = new DateTime($date); |
| 4476 | 4721 | $offset = $datetime->format('P'); |
| 4477 | - } else $offset = '+00:00'; |
|
| 4722 | + } else { |
|
| 4723 | + $offset = '+00:00'; |
|
| 4724 | + } |
|
| 4478 | 4725 | |
| 4479 | 4726 | if ($globalDBdriver == 'mysql') { |
| 4480 | 4727 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4522,7 +4769,9 @@ discard block |
||
| 4522 | 4769 | date_default_timezone_set($globalTimezone); |
| 4523 | 4770 | $datetime = new DateTime($date); |
| 4524 | 4771 | $offset = $datetime->format('P'); |
| 4525 | - } else $offset = '+00:00'; |
|
| 4772 | + } else { |
|
| 4773 | + $offset = '+00:00'; |
|
| 4774 | + } |
|
| 4526 | 4775 | |
| 4527 | 4776 | if ($globalDBdriver == 'mysql') { |
| 4528 | 4777 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4611,8 +4860,11 @@ discard block |
||
| 4611 | 4860 | $sth = $this->db->prepare($query); |
| 4612 | 4861 | $sth->execute(array(':owner' => $owner)); |
| 4613 | 4862 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4614 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4615 | - else return $result[0]['duration']; |
|
| 4863 | + if (is_int($result[0]['duration'])) { |
|
| 4864 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 4865 | + } else { |
|
| 4866 | + return $result[0]['duration']; |
|
| 4867 | + } |
|
| 4616 | 4868 | } |
| 4617 | 4869 | |
| 4618 | 4870 | /** |
@@ -4630,8 +4882,11 @@ discard block |
||
| 4630 | 4882 | $sth = $this->db->prepare($query); |
| 4631 | 4883 | $sth->execute(array(':pilot' => $pilot)); |
| 4632 | 4884 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4633 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4634 | - else return $result[0]['duration']; |
|
| 4885 | + if (is_int($result[0]['duration'])) { |
|
| 4886 | + return gmdate('H:i:s',$result[0]['duration']); |
|
| 4887 | + } else { |
|
| 4888 | + return $result[0]['duration']; |
|
| 4889 | + } |
|
| 4635 | 4890 | } |
| 4636 | 4891 | |
| 4637 | 4892 | /** |
@@ -4836,7 +5091,9 @@ discard block |
||
| 4836 | 5091 | } |
| 4837 | 5092 | $query .= " GROUP BY spotter_output.airline_country |
| 4838 | 5093 | ORDER BY airline_country_count DESC"; |
| 4839 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5094 | + if ($limit) { |
|
| 5095 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5096 | + } |
|
| 4840 | 5097 | |
| 4841 | 5098 | $sth = $this->db->prepare($query); |
| 4842 | 5099 | $sth->execute($query_values); |
@@ -4864,7 +5121,9 @@ discard block |
||
| 4864 | 5121 | global $globalDBdriver; |
| 4865 | 5122 | //$filter_query = $this->getFilter($filters,true,true); |
| 4866 | 5123 | $Connection= new Connection($this->db); |
| 4867 | - if (!$Connection->tableExists('countries')) return array(); |
|
| 5124 | + if (!$Connection->tableExists('countries')) { |
|
| 5125 | + return array(); |
|
| 5126 | + } |
|
| 4868 | 5127 | /* |
| 4869 | 5128 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
| 4870 | 5129 | FROM countries c, spotter_output s |
@@ -4896,7 +5155,9 @@ discard block |
||
| 4896 | 5155 | } |
| 4897 | 5156 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
| 4898 | 5157 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
| 4899 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5158 | + if ($limit) { |
|
| 5159 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5160 | + } |
|
| 4900 | 5161 | |
| 4901 | 5162 | |
| 4902 | 5163 | $sth = $this->db->prepare($query); |
@@ -4973,7 +5234,9 @@ discard block |
||
| 4973 | 5234 | } |
| 4974 | 5235 | |
| 4975 | 5236 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 4976 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5237 | + if ($limit) { |
|
| 5238 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5239 | + } |
|
| 4977 | 5240 | |
| 4978 | 5241 | $sth = $this->db->prepare($query); |
| 4979 | 5242 | $sth->execute($query_values); |
@@ -5047,7 +5310,9 @@ discard block |
||
| 5047 | 5310 | } |
| 5048 | 5311 | |
| 5049 | 5312 | $query .= " GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5050 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5313 | + if ($limit) { |
|
| 5314 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5315 | + } |
|
| 5051 | 5316 | |
| 5052 | 5317 | $sth = $this->db->prepare($query); |
| 5053 | 5318 | $sth->execute($query_values); |
@@ -5094,7 +5359,9 @@ discard block |
||
| 5094 | 5359 | } |
| 5095 | 5360 | |
| 5096 | 5361 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
| 5097 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 5362 | + if ($limit) { |
|
| 5363 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 5364 | + } |
|
| 5098 | 5365 | |
| 5099 | 5366 | $sth = $this->db->prepare($query); |
| 5100 | 5367 | $sth->execute(); |
@@ -5147,7 +5414,9 @@ discard block |
||
| 5147 | 5414 | if($row['registration'] != "") |
| 5148 | 5415 | { |
| 5149 | 5416 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5150 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5417 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5418 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5419 | + } |
|
| 5151 | 5420 | } |
| 5152 | 5421 | $temp_array['registration_count'] = $row['registration_count']; |
| 5153 | 5422 | |
@@ -5222,7 +5491,9 @@ discard block |
||
| 5222 | 5491 | if($row['registration'] != "") |
| 5223 | 5492 | { |
| 5224 | 5493 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5225 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5494 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5495 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5496 | + } |
|
| 5226 | 5497 | } |
| 5227 | 5498 | $temp_array['registration_count'] = $row['registration_count']; |
| 5228 | 5499 | |
@@ -5329,7 +5600,9 @@ discard block |
||
| 5329 | 5600 | if($row['registration'] != "") |
| 5330 | 5601 | { |
| 5331 | 5602 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5332 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5603 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5604 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5605 | + } |
|
| 5333 | 5606 | } |
| 5334 | 5607 | $temp_array['registration_count'] = $row['registration_count']; |
| 5335 | 5608 | $aircraft_array[] = $temp_array; |
@@ -5454,7 +5727,9 @@ discard block |
||
| 5454 | 5727 | date_default_timezone_set($globalTimezone); |
| 5455 | 5728 | $datetime = new DateTime($date); |
| 5456 | 5729 | $offset = $datetime->format('P'); |
| 5457 | - } else $offset = '+00:00'; |
|
| 5730 | + } else { |
|
| 5731 | + $offset = '+00:00'; |
|
| 5732 | + } |
|
| 5458 | 5733 | |
| 5459 | 5734 | if ($globalDBdriver == 'mysql') { |
| 5460 | 5735 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5501,7 +5776,9 @@ discard block |
||
| 5501 | 5776 | date_default_timezone_set($globalTimezone); |
| 5502 | 5777 | $datetime = new DateTime($date); |
| 5503 | 5778 | $offset = $datetime->format('P'); |
| 5504 | - } else $offset = '+00:00'; |
|
| 5779 | + } else { |
|
| 5780 | + $offset = '+00:00'; |
|
| 5781 | + } |
|
| 5505 | 5782 | |
| 5506 | 5783 | if ($globalDBdriver == 'mysql') { |
| 5507 | 5784 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
@@ -5530,7 +5807,9 @@ discard block |
||
| 5530 | 5807 | if($row['registration'] != "") |
| 5531 | 5808 | { |
| 5532 | 5809 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5533 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5810 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5811 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5812 | + } |
|
| 5534 | 5813 | } |
| 5535 | 5814 | $temp_array['registration_count'] = $row['registration_count']; |
| 5536 | 5815 | |
@@ -5555,7 +5834,9 @@ discard block |
||
| 5555 | 5834 | date_default_timezone_set($globalTimezone); |
| 5556 | 5835 | $datetime = new DateTime($date); |
| 5557 | 5836 | $offset = $datetime->format('P'); |
| 5558 | - } else $offset = '+00:00'; |
|
| 5837 | + } else { |
|
| 5838 | + $offset = '+00:00'; |
|
| 5839 | + } |
|
| 5559 | 5840 | |
| 5560 | 5841 | if ($globalDBdriver == 'mysql') { |
| 5561 | 5842 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5692,8 +5973,11 @@ discard block |
||
| 5692 | 5973 | if($row['registration'] != "") |
| 5693 | 5974 | { |
| 5694 | 5975 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5695 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5696 | - else $temp_array['image_thumbnail'] = ''; |
|
| 5976 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 5977 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5978 | + } else { |
|
| 5979 | + $temp_array['image_thumbnail'] = ''; |
|
| 5980 | + } |
|
| 5697 | 5981 | } |
| 5698 | 5982 | $temp_array['registration_count'] = $row['registration_count']; |
| 5699 | 5983 | $aircraft_array[] = $temp_array; |
@@ -5736,8 +6020,11 @@ discard block |
||
| 5736 | 6020 | if($row['registration'] != "") |
| 5737 | 6021 | { |
| 5738 | 6022 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5739 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5740 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6023 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6024 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6025 | + } else { |
|
| 6026 | + $temp_array['image_thumbnail'] = ''; |
|
| 6027 | + } |
|
| 5741 | 6028 | } |
| 5742 | 6029 | $temp_array['registration_count'] = $row['registration_count']; |
| 5743 | 6030 | $aircraft_array[] = $temp_array; |
@@ -5780,8 +6067,11 @@ discard block |
||
| 5780 | 6067 | if($row['registration'] != "") |
| 5781 | 6068 | { |
| 5782 | 6069 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5783 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 5784 | - else $temp_array['image_thumbnail'] = ''; |
|
| 6070 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6071 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6072 | + } else { |
|
| 6073 | + $temp_array['image_thumbnail'] = ''; |
|
| 6074 | + } |
|
| 5785 | 6075 | } |
| 5786 | 6076 | $temp_array['registration_count'] = $row['registration_count']; |
| 5787 | 6077 | $aircraft_array[] = $temp_array; |
@@ -5930,7 +6220,9 @@ discard block |
||
| 5930 | 6220 | if($row['registration'] != "") |
| 5931 | 6221 | { |
| 5932 | 6222 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5933 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6223 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6224 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6225 | + } |
|
| 5934 | 6226 | } |
| 5935 | 6227 | $temp_array['registration_count'] = $row['registration_count']; |
| 5936 | 6228 | |
@@ -6047,7 +6339,9 @@ discard block |
||
| 6047 | 6339 | if($row['registration'] != "") |
| 6048 | 6340 | { |
| 6049 | 6341 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6050 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6342 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6343 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6344 | + } |
|
| 6051 | 6345 | } |
| 6052 | 6346 | $temp_array['registration_count'] = $row['registration_count']; |
| 6053 | 6347 | |
@@ -6213,7 +6507,9 @@ discard block |
||
| 6213 | 6507 | } |
| 6214 | 6508 | } |
| 6215 | 6509 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6216 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6510 | + if ($limit) { |
|
| 6511 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6512 | + } |
|
| 6217 | 6513 | |
| 6218 | 6514 | $sth = $this->db->prepare($query); |
| 6219 | 6515 | $sth->execute($query_values); |
@@ -6232,7 +6528,9 @@ discard block |
||
| 6232 | 6528 | if($row['registration'] != "") |
| 6233 | 6529 | { |
| 6234 | 6530 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6235 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6531 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6532 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6533 | + } |
|
| 6236 | 6534 | } |
| 6237 | 6535 | |
| 6238 | 6536 | $aircraft_array[] = $temp_array; |
@@ -6273,7 +6571,9 @@ discard block |
||
| 6273 | 6571 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6274 | 6572 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6275 | 6573 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
| 6276 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6574 | + if ($limit) { |
|
| 6575 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6576 | + } |
|
| 6277 | 6577 | |
| 6278 | 6578 | $sth = $this->db->prepare($query); |
| 6279 | 6579 | $sth->execute(); |
@@ -6293,7 +6593,9 @@ discard block |
||
| 6293 | 6593 | if($row['registration'] != "") |
| 6294 | 6594 | { |
| 6295 | 6595 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6296 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6596 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
| 6597 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
| 6598 | + } |
|
| 6297 | 6599 | } |
| 6298 | 6600 | |
| 6299 | 6601 | $aircraft_array[] = $temp_array; |
@@ -6359,7 +6661,9 @@ discard block |
||
| 6359 | 6661 | } |
| 6360 | 6662 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6361 | 6663 | ORDER BY airport_departure_icao_count DESC"; |
| 6362 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6664 | + if ($limit) { |
|
| 6665 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6666 | + } |
|
| 6363 | 6667 | |
| 6364 | 6668 | $sth = $this->db->prepare($query); |
| 6365 | 6669 | $sth->execute($query_values); |
@@ -6410,7 +6714,9 @@ discard block |
||
| 6410 | 6714 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6411 | 6715 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6412 | 6716 | ORDER BY airport_departure_icao_count DESC"; |
| 6413 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6717 | + if ($limit) { |
|
| 6718 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6719 | + } |
|
| 6414 | 6720 | |
| 6415 | 6721 | $sth = $this->db->prepare($query); |
| 6416 | 6722 | $sth->execute(); |
@@ -6488,7 +6794,9 @@ discard block |
||
| 6488 | 6794 | } |
| 6489 | 6795 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6490 | 6796 | ORDER BY airport_departure_icao_count DESC"; |
| 6491 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6797 | + if ($limit) { |
|
| 6798 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6799 | + } |
|
| 6492 | 6800 | //echo $query; |
| 6493 | 6801 | $sth = $this->db->prepare($query); |
| 6494 | 6802 | $sth->execute($query_values); |
@@ -6540,7 +6848,9 @@ discard block |
||
| 6540 | 6848 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6541 | 6849 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
| 6542 | 6850 | ORDER BY airport_departure_icao_count DESC"; |
| 6543 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 6851 | + if ($limit) { |
|
| 6852 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 6853 | + } |
|
| 6544 | 6854 | |
| 6545 | 6855 | $sth = $this->db->prepare($query); |
| 6546 | 6856 | $sth->execute(); |
@@ -6935,7 +7245,9 @@ discard block |
||
| 6935 | 7245 | date_default_timezone_set($globalTimezone); |
| 6936 | 7246 | $datetime = new DateTime($date); |
| 6937 | 7247 | $offset = $datetime->format('P'); |
| 6938 | - } else $offset = '+00:00'; |
|
| 7248 | + } else { |
|
| 7249 | + $offset = '+00:00'; |
|
| 7250 | + } |
|
| 6939 | 7251 | |
| 6940 | 7252 | if ($globalDBdriver == 'mysql') { |
| 6941 | 7253 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
@@ -6985,7 +7297,9 @@ discard block |
||
| 6985 | 7297 | date_default_timezone_set($globalTimezone); |
| 6986 | 7298 | $datetime = new DateTime($date); |
| 6987 | 7299 | $offset = $datetime->format('P'); |
| 6988 | - } else $offset = '+00:00'; |
|
| 7300 | + } else { |
|
| 7301 | + $offset = '+00:00'; |
|
| 7302 | + } |
|
| 6989 | 7303 | |
| 6990 | 7304 | if ($globalDBdriver == 'mysql') { |
| 6991 | 7305 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -7334,7 +7648,9 @@ discard block |
||
| 7334 | 7648 | } |
| 7335 | 7649 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7336 | 7650 | ORDER BY airport_arrival_icao_count DESC"; |
| 7337 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7651 | + if ($limit) { |
|
| 7652 | + $query .= " LIMIT 10"; |
|
| 7653 | + } |
|
| 7338 | 7654 | |
| 7339 | 7655 | |
| 7340 | 7656 | $sth = $this->db->prepare($query); |
@@ -7354,7 +7670,9 @@ discard block |
||
| 7354 | 7670 | if ($icaoaskey) { |
| 7355 | 7671 | $icao = $row['arrival_airport_icao']; |
| 7356 | 7672 | $airport_array[$icao] = $temp_array; |
| 7357 | - } else $airport_array[] = $temp_array; |
|
| 7673 | + } else { |
|
| 7674 | + $airport_array[] = $temp_array; |
|
| 7675 | + } |
|
| 7358 | 7676 | } |
| 7359 | 7677 | |
| 7360 | 7678 | return $airport_array; |
@@ -7391,7 +7709,9 @@ discard block |
||
| 7391 | 7709 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7392 | 7710 | $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7393 | 7711 | ORDER BY airport_arrival_icao_count DESC"; |
| 7394 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7712 | + if ($limit) { |
|
| 7713 | + $query .= " LIMIT 10"; |
|
| 7714 | + } |
|
| 7395 | 7715 | |
| 7396 | 7716 | |
| 7397 | 7717 | $sth = $this->db->prepare($query); |
@@ -7412,7 +7732,9 @@ discard block |
||
| 7412 | 7732 | if ($icaoaskey) { |
| 7413 | 7733 | $icao = $row['arrival_airport_icao']; |
| 7414 | 7734 | $airport_array[$icao] = $temp_array; |
| 7415 | - } else $airport_array[] = $temp_array; |
|
| 7735 | + } else { |
|
| 7736 | + $airport_array[] = $temp_array; |
|
| 7737 | + } |
|
| 7416 | 7738 | } |
| 7417 | 7739 | |
| 7418 | 7740 | return $airport_array; |
@@ -7475,7 +7797,9 @@ discard block |
||
| 7475 | 7797 | } |
| 7476 | 7798 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7477 | 7799 | ORDER BY airport_arrival_icao_count DESC"; |
| 7478 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7800 | + if ($limit) { |
|
| 7801 | + $query .= " LIMIT 10"; |
|
| 7802 | + } |
|
| 7479 | 7803 | |
| 7480 | 7804 | |
| 7481 | 7805 | $sth = $this->db->prepare($query); |
@@ -7494,7 +7818,9 @@ discard block |
||
| 7494 | 7818 | if ($icaoaskey) { |
| 7495 | 7819 | $icao = $row['arrival_airport_icao']; |
| 7496 | 7820 | $airport_array[$icao] = $temp_array; |
| 7497 | - } else $airport_array[] = $temp_array; |
|
| 7821 | + } else { |
|
| 7822 | + $airport_array[] = $temp_array; |
|
| 7823 | + } |
|
| 7498 | 7824 | } |
| 7499 | 7825 | |
| 7500 | 7826 | return $airport_array; |
@@ -7531,7 +7857,9 @@ discard block |
||
| 7531 | 7857 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 7532 | 7858 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
| 7533 | 7859 | ORDER BY airport_arrival_icao_count DESC"; |
| 7534 | - if ($limit) $query .= " LIMIT 10"; |
|
| 7860 | + if ($limit) { |
|
| 7861 | + $query .= " LIMIT 10"; |
|
| 7862 | + } |
|
| 7535 | 7863 | |
| 7536 | 7864 | |
| 7537 | 7865 | $sth = $this->db->prepare($query); |
@@ -7552,7 +7880,9 @@ discard block |
||
| 7552 | 7880 | if ($icaoaskey) { |
| 7553 | 7881 | $icao = $row['arrival_airport_icao']; |
| 7554 | 7882 | $airport_array[$icao] = $temp_array; |
| 7555 | - } else $airport_array[] = $temp_array; |
|
| 7883 | + } else { |
|
| 7884 | + $airport_array[] = $temp_array; |
|
| 7885 | + } |
|
| 7556 | 7886 | } |
| 7557 | 7887 | |
| 7558 | 7888 | return $airport_array; |
@@ -7933,7 +8263,9 @@ discard block |
||
| 7933 | 8263 | date_default_timezone_set($globalTimezone); |
| 7934 | 8264 | $datetime = new DateTime($date); |
| 7935 | 8265 | $offset = $datetime->format('P'); |
| 7936 | - } else $offset = '+00:00'; |
|
| 8266 | + } else { |
|
| 8267 | + $offset = '+00:00'; |
|
| 8268 | + } |
|
| 7937 | 8269 | |
| 7938 | 8270 | if ($globalDBdriver == 'mysql') { |
| 7939 | 8271 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
@@ -7983,7 +8315,9 @@ discard block |
||
| 7983 | 8315 | date_default_timezone_set($globalTimezone); |
| 7984 | 8316 | $datetime = new DateTime($date); |
| 7985 | 8317 | $offset = $datetime->format('P'); |
| 7986 | - } else $offset = '+00:00'; |
|
| 8318 | + } else { |
|
| 8319 | + $offset = '+00:00'; |
|
| 8320 | + } |
|
| 7987 | 8321 | |
| 7988 | 8322 | if ($globalDBdriver == 'mysql') { |
| 7989 | 8323 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -8374,7 +8708,9 @@ discard block |
||
| 8374 | 8708 | } |
| 8375 | 8709 | $query .= " GROUP BY spotter_output.arrival_airport_country |
| 8376 | 8710 | ORDER BY airport_arrival_country_count DESC"; |
| 8377 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 8711 | + if ($limit) { |
|
| 8712 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 8713 | + } |
|
| 8378 | 8714 | |
| 8379 | 8715 | |
| 8380 | 8716 | $sth = $this->db->prepare($query); |
@@ -8661,7 +8997,9 @@ discard block |
||
| 8661 | 8997 | date_default_timezone_set($globalTimezone); |
| 8662 | 8998 | $datetime = new DateTime($date); |
| 8663 | 8999 | $offset = $datetime->format('P'); |
| 8664 | - } else $offset = '+00:00'; |
|
| 9000 | + } else { |
|
| 9001 | + $offset = '+00:00'; |
|
| 9002 | + } |
|
| 8665 | 9003 | |
| 8666 | 9004 | if ($globalDBdriver == 'mysql') { |
| 8667 | 9005 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
@@ -8917,12 +9255,18 @@ discard block |
||
| 8917 | 9255 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
| 8918 | 9256 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 8919 | 9257 | if ($olderthanmonths > 0) { |
| 8920 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 8921 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9258 | + if ($globalDBdriver == 'mysql') { |
|
| 9259 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
| 9260 | + } else { |
|
| 9261 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
| 9262 | + } |
|
| 8922 | 9263 | } |
| 8923 | 9264 | if ($sincedate != '') { |
| 8924 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 8925 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9265 | + if ($globalDBdriver == 'mysql') { |
|
| 9266 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
| 9267 | + } else { |
|
| 9268 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
| 9269 | + } |
|
| 8926 | 9270 | } |
| 8927 | 9271 | $query_values = array(); |
| 8928 | 9272 | if ($year != '') { |
@@ -8953,7 +9297,9 @@ discard block |
||
| 8953 | 9297 | } |
| 8954 | 9298 | } |
| 8955 | 9299 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 8956 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9300 | + if ($limit) { |
|
| 9301 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9302 | + } |
|
| 8957 | 9303 | |
| 8958 | 9304 | $sth = $this->db->prepare($query); |
| 8959 | 9305 | $sth->execute($query_values); |
@@ -8987,15 +9333,23 @@ discard block |
||
| 8987 | 9333 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
| 8988 | 9334 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 8989 | 9335 | if ($olderthanmonths > 0) { |
| 8990 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 8991 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9336 | + if ($globalDBdriver == 'mysql') { |
|
| 9337 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 9338 | + } else { |
|
| 9339 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
| 9340 | + } |
|
| 8992 | 9341 | } |
| 8993 | 9342 | if ($sincedate != '') { |
| 8994 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 8995 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9343 | + if ($globalDBdriver == 'mysql') { |
|
| 9344 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
| 9345 | + } else { |
|
| 9346 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
| 9347 | + } |
|
| 8996 | 9348 | } |
| 8997 | 9349 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
| 8998 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
| 9350 | + if ($limit) { |
|
| 9351 | + $query .= " LIMIT 10 OFFSET 0"; |
|
| 9352 | + } |
|
| 8999 | 9353 | |
| 9000 | 9354 | $sth = $this->db->prepare($query); |
| 9001 | 9355 | $sth->execute(); |
@@ -9032,7 +9386,9 @@ discard block |
||
| 9032 | 9386 | date_default_timezone_set($globalTimezone); |
| 9033 | 9387 | $datetime = new DateTime(); |
| 9034 | 9388 | $offset = $datetime->format('P'); |
| 9035 | - } else $offset = '+00:00'; |
|
| 9389 | + } else { |
|
| 9390 | + $offset = '+00:00'; |
|
| 9391 | + } |
|
| 9036 | 9392 | |
| 9037 | 9393 | if ($globalDBdriver == 'mysql') { |
| 9038 | 9394 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9081,7 +9437,9 @@ discard block |
||
| 9081 | 9437 | date_default_timezone_set($globalTimezone); |
| 9082 | 9438 | $datetime = new DateTime(); |
| 9083 | 9439 | $offset = $datetime->format('P'); |
| 9084 | - } else $offset = '+00:00'; |
|
| 9440 | + } else { |
|
| 9441 | + $offset = '+00:00'; |
|
| 9442 | + } |
|
| 9085 | 9443 | $filter_query = $this->getFilter($filters,true,true); |
| 9086 | 9444 | if ($globalDBdriver == 'mysql') { |
| 9087 | 9445 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9130,7 +9488,9 @@ discard block |
||
| 9130 | 9488 | date_default_timezone_set($globalTimezone); |
| 9131 | 9489 | $datetime = new DateTime(); |
| 9132 | 9490 | $offset = $datetime->format('P'); |
| 9133 | - } else $offset = '+00:00'; |
|
| 9491 | + } else { |
|
| 9492 | + $offset = '+00:00'; |
|
| 9493 | + } |
|
| 9134 | 9494 | $filter_query = $this->getFilter($filters,true,true); |
| 9135 | 9495 | if ($globalDBdriver == 'mysql') { |
| 9136 | 9496 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9176,7 +9536,9 @@ discard block |
||
| 9176 | 9536 | date_default_timezone_set($globalTimezone); |
| 9177 | 9537 | $datetime = new DateTime(); |
| 9178 | 9538 | $offset = $datetime->format('P'); |
| 9179 | - } else $offset = '+00:00'; |
|
| 9539 | + } else { |
|
| 9540 | + $offset = '+00:00'; |
|
| 9541 | + } |
|
| 9180 | 9542 | $filter_query = $this->getFilter($filters,true,true); |
| 9181 | 9543 | if ($globalDBdriver == 'mysql') { |
| 9182 | 9544 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9224,7 +9586,9 @@ discard block |
||
| 9224 | 9586 | date_default_timezone_set($globalTimezone); |
| 9225 | 9587 | $datetime = new DateTime(); |
| 9226 | 9588 | $offset = $datetime->format('P'); |
| 9227 | - } else $offset = '+00:00'; |
|
| 9589 | + } else { |
|
| 9590 | + $offset = '+00:00'; |
|
| 9591 | + } |
|
| 9228 | 9592 | |
| 9229 | 9593 | if ($globalDBdriver == 'mysql') { |
| 9230 | 9594 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9272,7 +9636,9 @@ discard block |
||
| 9272 | 9636 | date_default_timezone_set($globalTimezone); |
| 9273 | 9637 | $datetime = new DateTime(); |
| 9274 | 9638 | $offset = $datetime->format('P'); |
| 9275 | - } else $offset = '+00:00'; |
|
| 9639 | + } else { |
|
| 9640 | + $offset = '+00:00'; |
|
| 9641 | + } |
|
| 9276 | 9642 | |
| 9277 | 9643 | if ($globalDBdriver == 'mysql') { |
| 9278 | 9644 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9319,7 +9685,9 @@ discard block |
||
| 9319 | 9685 | date_default_timezone_set($globalTimezone); |
| 9320 | 9686 | $datetime = new DateTime(); |
| 9321 | 9687 | $offset = $datetime->format('P'); |
| 9322 | - } else $offset = '+00:00'; |
|
| 9688 | + } else { |
|
| 9689 | + $offset = '+00:00'; |
|
| 9690 | + } |
|
| 9323 | 9691 | |
| 9324 | 9692 | if ($globalDBdriver == 'mysql') { |
| 9325 | 9693 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9367,7 +9735,9 @@ discard block |
||
| 9367 | 9735 | date_default_timezone_set($globalTimezone); |
| 9368 | 9736 | $datetime = new DateTime(); |
| 9369 | 9737 | $offset = $datetime->format('P'); |
| 9370 | - } else $offset = '+00:00'; |
|
| 9738 | + } else { |
|
| 9739 | + $offset = '+00:00'; |
|
| 9740 | + } |
|
| 9371 | 9741 | $filter_query = $this->getFilter($filters,true,true); |
| 9372 | 9742 | if ($globalDBdriver == 'mysql') { |
| 9373 | 9743 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9412,7 +9782,9 @@ discard block |
||
| 9412 | 9782 | date_default_timezone_set($globalTimezone); |
| 9413 | 9783 | $datetime = new DateTime(); |
| 9414 | 9784 | $offset = $datetime->format('P'); |
| 9415 | - } else $offset = '+00:00'; |
|
| 9785 | + } else { |
|
| 9786 | + $offset = '+00:00'; |
|
| 9787 | + } |
|
| 9416 | 9788 | $filter_query = $this->getFilter($filters,true,true); |
| 9417 | 9789 | |
| 9418 | 9790 | if ($globalDBdriver == 'mysql') { |
@@ -9459,7 +9831,9 @@ discard block |
||
| 9459 | 9831 | date_default_timezone_set($globalTimezone); |
| 9460 | 9832 | $datetime = new DateTime(); |
| 9461 | 9833 | $offset = $datetime->format('P'); |
| 9462 | - } else $offset = '+00:00'; |
|
| 9834 | + } else { |
|
| 9835 | + $offset = '+00:00'; |
|
| 9836 | + } |
|
| 9463 | 9837 | |
| 9464 | 9838 | if ($globalDBdriver == 'mysql') { |
| 9465 | 9839 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
@@ -9505,7 +9879,9 @@ discard block |
||
| 9505 | 9879 | date_default_timezone_set($globalTimezone); |
| 9506 | 9880 | $datetime = new DateTime(); |
| 9507 | 9881 | $offset = $datetime->format('P'); |
| 9508 | - } else $offset = '+00:00'; |
|
| 9882 | + } else { |
|
| 9883 | + $offset = '+00:00'; |
|
| 9884 | + } |
|
| 9509 | 9885 | $filter_query = $this->getFilter($filters,true,true); |
| 9510 | 9886 | |
| 9511 | 9887 | if ($globalDBdriver == 'mysql') { |
@@ -9552,7 +9928,9 @@ discard block |
||
| 9552 | 9928 | date_default_timezone_set($globalTimezone); |
| 9553 | 9929 | $datetime = new DateTime(); |
| 9554 | 9930 | $offset = $datetime->format('P'); |
| 9555 | - } else $offset = '+00:00'; |
|
| 9931 | + } else { |
|
| 9932 | + $offset = '+00:00'; |
|
| 9933 | + } |
|
| 9556 | 9934 | |
| 9557 | 9935 | if ($globalDBdriver == 'mysql') { |
| 9558 | 9936 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
@@ -9599,7 +9977,9 @@ discard block |
||
| 9599 | 9977 | date_default_timezone_set($globalTimezone); |
| 9600 | 9978 | $datetime = new DateTime(); |
| 9601 | 9979 | $offset = $datetime->format('P'); |
| 9602 | - } else $offset = '+00:00'; |
|
| 9980 | + } else { |
|
| 9981 | + $offset = '+00:00'; |
|
| 9982 | + } |
|
| 9603 | 9983 | |
| 9604 | 9984 | if ($globalDBdriver == 'mysql') { |
| 9605 | 9985 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
@@ -9644,7 +10024,9 @@ discard block |
||
| 9644 | 10024 | date_default_timezone_set($globalTimezone); |
| 9645 | 10025 | $datetime = new DateTime(); |
| 9646 | 10026 | $offset = $datetime->format('P'); |
| 9647 | - } else $offset = '+00:00'; |
|
| 10027 | + } else { |
|
| 10028 | + $offset = '+00:00'; |
|
| 10029 | + } |
|
| 9648 | 10030 | $filter_query = $this->getFilter($filters,true,true); |
| 9649 | 10031 | |
| 9650 | 10032 | if ($globalDBdriver == 'mysql') { |
@@ -9692,7 +10074,9 @@ discard block |
||
| 9692 | 10074 | date_default_timezone_set($globalTimezone); |
| 9693 | 10075 | $datetime = new DateTime(); |
| 9694 | 10076 | $offset = $datetime->format('P'); |
| 9695 | - } else $offset = '+00:00'; |
|
| 10077 | + } else { |
|
| 10078 | + $offset = '+00:00'; |
|
| 10079 | + } |
|
| 9696 | 10080 | |
| 9697 | 10081 | if ($globalDBdriver == 'mysql') { |
| 9698 | 10082 | $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
@@ -9738,7 +10122,9 @@ discard block |
||
| 9738 | 10122 | date_default_timezone_set($globalTimezone); |
| 9739 | 10123 | $datetime = new DateTime(); |
| 9740 | 10124 | $offset = $datetime->format('P'); |
| 9741 | - } else $offset = '+00:00'; |
|
| 10125 | + } else { |
|
| 10126 | + $offset = '+00:00'; |
|
| 10127 | + } |
|
| 9742 | 10128 | $filter_query = $this->getFilter($filters,true,true); |
| 9743 | 10129 | |
| 9744 | 10130 | if ($globalDBdriver == 'mysql') { |
@@ -9786,7 +10172,9 @@ discard block |
||
| 9786 | 10172 | date_default_timezone_set($globalTimezone); |
| 9787 | 10173 | $datetime = new DateTime(); |
| 9788 | 10174 | $offset = $datetime->format('P'); |
| 9789 | - } else $offset = '+00:00'; |
|
| 10175 | + } else { |
|
| 10176 | + $offset = '+00:00'; |
|
| 10177 | + } |
|
| 9790 | 10178 | |
| 9791 | 10179 | if ($globalDBdriver == 'mysql') { |
| 9792 | 10180 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
@@ -9833,7 +10221,9 @@ discard block |
||
| 9833 | 10221 | date_default_timezone_set($globalTimezone); |
| 9834 | 10222 | $datetime = new DateTime(); |
| 9835 | 10223 | $offset = $datetime->format('P'); |
| 9836 | - } else $offset = '+00:00'; |
|
| 10224 | + } else { |
|
| 10225 | + $offset = '+00:00'; |
|
| 10226 | + } |
|
| 9837 | 10227 | $filter_query = $this->getFilter($filters,true,true); |
| 9838 | 10228 | if ($globalDBdriver == 'mysql') { |
| 9839 | 10229 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -9882,7 +10272,9 @@ discard block |
||
| 9882 | 10272 | date_default_timezone_set($globalTimezone); |
| 9883 | 10273 | $datetime = new DateTime(); |
| 9884 | 10274 | $offset = $datetime->format('P'); |
| 9885 | - } else $offset = '+00:00'; |
|
| 10275 | + } else { |
|
| 10276 | + $offset = '+00:00'; |
|
| 10277 | + } |
|
| 9886 | 10278 | |
| 9887 | 10279 | $orderby_sql = ''; |
| 9888 | 10280 | if ($orderby == "hour") |
@@ -9948,7 +10340,9 @@ discard block |
||
| 9948 | 10340 | date_default_timezone_set($globalTimezone); |
| 9949 | 10341 | $datetime = new DateTime(); |
| 9950 | 10342 | $offset = $datetime->format('P'); |
| 9951 | - } else $offset = '+00:00'; |
|
| 10343 | + } else { |
|
| 10344 | + $offset = '+00:00'; |
|
| 10345 | + } |
|
| 9952 | 10346 | |
| 9953 | 10347 | $orderby_sql = ''; |
| 9954 | 10348 | if ($orderby == "hour") |
@@ -10015,7 +10409,9 @@ discard block |
||
| 10015 | 10409 | date_default_timezone_set($globalTimezone); |
| 10016 | 10410 | $datetime = new DateTime(); |
| 10017 | 10411 | $offset = $datetime->format('P'); |
| 10018 | - } else $offset = '+00:00'; |
|
| 10412 | + } else { |
|
| 10413 | + $offset = '+00:00'; |
|
| 10414 | + } |
|
| 10019 | 10415 | |
| 10020 | 10416 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
| 10021 | 10417 | |
@@ -10066,7 +10462,9 @@ discard block |
||
| 10066 | 10462 | date_default_timezone_set($globalTimezone); |
| 10067 | 10463 | $datetime = new DateTime(); |
| 10068 | 10464 | $offset = $datetime->format('P'); |
| 10069 | - } else $offset = '+00:00'; |
|
| 10465 | + } else { |
|
| 10466 | + $offset = '+00:00'; |
|
| 10467 | + } |
|
| 10070 | 10468 | |
| 10071 | 10469 | if ($globalDBdriver == 'mysql') { |
| 10072 | 10470 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10113,7 +10511,9 @@ discard block |
||
| 10113 | 10511 | date_default_timezone_set($globalTimezone); |
| 10114 | 10512 | $datetime = new DateTime(); |
| 10115 | 10513 | $offset = $datetime->format('P'); |
| 10116 | - } else $offset = '+00:00'; |
|
| 10514 | + } else { |
|
| 10515 | + $offset = '+00:00'; |
|
| 10516 | + } |
|
| 10117 | 10517 | |
| 10118 | 10518 | if ($globalDBdriver == 'mysql') { |
| 10119 | 10519 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10160,7 +10560,9 @@ discard block |
||
| 10160 | 10560 | date_default_timezone_set($globalTimezone); |
| 10161 | 10561 | $datetime = new DateTime(); |
| 10162 | 10562 | $offset = $datetime->format('P'); |
| 10163 | - } else $offset = '+00:00'; |
|
| 10563 | + } else { |
|
| 10564 | + $offset = '+00:00'; |
|
| 10565 | + } |
|
| 10164 | 10566 | |
| 10165 | 10567 | if ($globalDBdriver == 'mysql') { |
| 10166 | 10568 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10208,7 +10610,9 @@ discard block |
||
| 10208 | 10610 | date_default_timezone_set($globalTimezone); |
| 10209 | 10611 | $datetime = new DateTime(); |
| 10210 | 10612 | $offset = $datetime->format('P'); |
| 10211 | - } else $offset = '+00:00'; |
|
| 10613 | + } else { |
|
| 10614 | + $offset = '+00:00'; |
|
| 10615 | + } |
|
| 10212 | 10616 | |
| 10213 | 10617 | if ($globalDBdriver == 'mysql') { |
| 10214 | 10618 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10256,7 +10660,9 @@ discard block |
||
| 10256 | 10660 | date_default_timezone_set($globalTimezone); |
| 10257 | 10661 | $datetime = new DateTime($date); |
| 10258 | 10662 | $offset = $datetime->format('P'); |
| 10259 | - } else $offset = '+00:00'; |
|
| 10663 | + } else { |
|
| 10664 | + $offset = '+00:00'; |
|
| 10665 | + } |
|
| 10260 | 10666 | |
| 10261 | 10667 | if ($globalDBdriver == 'mysql') { |
| 10262 | 10668 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10304,7 +10710,9 @@ discard block |
||
| 10304 | 10710 | date_default_timezone_set($globalTimezone); |
| 10305 | 10711 | $datetime = new DateTime(); |
| 10306 | 10712 | $offset = $datetime->format('P'); |
| 10307 | - } else $offset = '+00:00'; |
|
| 10713 | + } else { |
|
| 10714 | + $offset = '+00:00'; |
|
| 10715 | + } |
|
| 10308 | 10716 | |
| 10309 | 10717 | if ($globalDBdriver == 'mysql') { |
| 10310 | 10718 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10351,7 +10759,9 @@ discard block |
||
| 10351 | 10759 | date_default_timezone_set($globalTimezone); |
| 10352 | 10760 | $datetime = new DateTime(); |
| 10353 | 10761 | $offset = $datetime->format('P'); |
| 10354 | - } else $offset = '+00:00'; |
|
| 10762 | + } else { |
|
| 10763 | + $offset = '+00:00'; |
|
| 10764 | + } |
|
| 10355 | 10765 | |
| 10356 | 10766 | if ($globalDBdriver == 'mysql') { |
| 10357 | 10767 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10398,7 +10808,9 @@ discard block |
||
| 10398 | 10808 | date_default_timezone_set($globalTimezone); |
| 10399 | 10809 | $datetime = new DateTime(); |
| 10400 | 10810 | $offset = $datetime->format('P'); |
| 10401 | - } else $offset = '+00:00'; |
|
| 10811 | + } else { |
|
| 10812 | + $offset = '+00:00'; |
|
| 10813 | + } |
|
| 10402 | 10814 | |
| 10403 | 10815 | if ($globalDBdriver == 'mysql') { |
| 10404 | 10816 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10448,7 +10860,9 @@ discard block |
||
| 10448 | 10860 | date_default_timezone_set($globalTimezone); |
| 10449 | 10861 | $datetime = new DateTime(); |
| 10450 | 10862 | $offset = $datetime->format('P'); |
| 10451 | - } else $offset = '+00:00'; |
|
| 10863 | + } else { |
|
| 10864 | + $offset = '+00:00'; |
|
| 10865 | + } |
|
| 10452 | 10866 | |
| 10453 | 10867 | if ($globalDBdriver == 'mysql') { |
| 10454 | 10868 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10495,7 +10909,9 @@ discard block |
||
| 10495 | 10909 | date_default_timezone_set($globalTimezone); |
| 10496 | 10910 | $datetime = new DateTime(); |
| 10497 | 10911 | $offset = $datetime->format('P'); |
| 10498 | - } else $offset = '+00:00'; |
|
| 10912 | + } else { |
|
| 10913 | + $offset = '+00:00'; |
|
| 10914 | + } |
|
| 10499 | 10915 | |
| 10500 | 10916 | if ($globalDBdriver == 'mysql') { |
| 10501 | 10917 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10706,8 +11122,11 @@ discard block |
||
| 10706 | 11122 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 10707 | 11123 | } |
| 10708 | 11124 | } |
| 10709 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
| 10710 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11125 | + if (empty($query_values)) { |
|
| 11126 | + $queryi .= $this->getFilter($filters); |
|
| 11127 | + } else { |
|
| 11128 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11129 | + } |
|
| 10711 | 11130 | |
| 10712 | 11131 | //echo $query; |
| 10713 | 11132 | $sth = $this->db->prepare($queryi); |
@@ -10786,8 +11205,11 @@ discard block |
||
| 10786 | 11205 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 10787 | 11206 | } |
| 10788 | 11207 | } |
| 10789 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 10790 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11208 | + if ($query == '') { |
|
| 11209 | + $queryi .= $this->getFilter($filters); |
|
| 11210 | + } else { |
|
| 11211 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11212 | + } |
|
| 10791 | 11213 | |
| 10792 | 11214 | |
| 10793 | 11215 | $sth = $this->db->prepare($queryi); |
@@ -10810,7 +11232,9 @@ discard block |
||
| 10810 | 11232 | date_default_timezone_set($globalTimezone); |
| 10811 | 11233 | $datetime = new DateTime(); |
| 10812 | 11234 | $offset = $datetime->format('P'); |
| 10813 | - } else $offset = '+00:00'; |
|
| 11235 | + } else { |
|
| 11236 | + $offset = '+00:00'; |
|
| 11237 | + } |
|
| 10814 | 11238 | |
| 10815 | 11239 | if ($globalDBdriver == 'mysql') { |
| 10816 | 11240 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10996,7 +11420,9 @@ discard block |
||
| 10996 | 11420 | */ |
| 10997 | 11421 | public function parseDirection($direction = 0) |
| 10998 | 11422 | { |
| 10999 | - if ($direction == '') $direction = 0; |
|
| 11423 | + if ($direction == '') { |
|
| 11424 | + $direction = 0; |
|
| 11425 | + } |
|
| 11000 | 11426 | $direction_array = array(); |
| 11001 | 11427 | $temp_array = array(); |
| 11002 | 11428 | |
@@ -11097,7 +11523,9 @@ discard block |
||
| 11097 | 11523 | if (isset($result->AirlineFlightInfoResult)) |
| 11098 | 11524 | { |
| 11099 | 11525 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
| 11100 | - } else return ''; |
|
| 11526 | + } else { |
|
| 11527 | + return ''; |
|
| 11528 | + } |
|
| 11101 | 11529 | |
| 11102 | 11530 | $registration = $this->convertAircraftRegistration($registration); |
| 11103 | 11531 | |
@@ -11126,7 +11554,9 @@ discard block |
||
| 11126 | 11554 | if (count($row) > 0) { |
| 11127 | 11555 | //return $row['Registration']; |
| 11128 | 11556 | return $row['registration']; |
| 11129 | - } else return ''; |
|
| 11557 | + } else { |
|
| 11558 | + return ''; |
|
| 11559 | + } |
|
| 11130 | 11560 | |
| 11131 | 11561 | } |
| 11132 | 11562 | |
@@ -11149,9 +11579,14 @@ discard block |
||
| 11149 | 11579 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11150 | 11580 | $sth->closeCursor(); |
| 11151 | 11581 | if (count($row) > 0) { |
| 11152 | - if ($row['type_flight'] == null) return ''; |
|
| 11153 | - else return $row['type_flight']; |
|
| 11154 | - } else return ''; |
|
| 11582 | + if ($row['type_flight'] == null) { |
|
| 11583 | + return ''; |
|
| 11584 | + } else { |
|
| 11585 | + return $row['type_flight']; |
|
| 11586 | + } |
|
| 11587 | + } else { |
|
| 11588 | + return ''; |
|
| 11589 | + } |
|
| 11155 | 11590 | |
| 11156 | 11591 | } |
| 11157 | 11592 | |
@@ -11169,7 +11604,9 @@ discard block |
||
| 11169 | 11604 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 11170 | 11605 | |
| 11171 | 11606 | $Connection = new Connection($this->db); |
| 11172 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11607 | + if (!$Connection->tableExists('countries')) { |
|
| 11608 | + return ''; |
|
| 11609 | + } |
|
| 11173 | 11610 | |
| 11174 | 11611 | try { |
| 11175 | 11612 | /* |
@@ -11189,9 +11626,13 @@ discard block |
||
| 11189 | 11626 | $sth->closeCursor(); |
| 11190 | 11627 | if (count($row) > 0) { |
| 11191 | 11628 | return $row; |
| 11192 | - } else return ''; |
|
| 11629 | + } else { |
|
| 11630 | + return ''; |
|
| 11631 | + } |
|
| 11193 | 11632 | } catch (PDOException $e) { |
| 11194 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 11633 | + if (isset($globalDebug) && $globalDebug) { |
|
| 11634 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 11635 | + } |
|
| 11195 | 11636 | return ''; |
| 11196 | 11637 | } |
| 11197 | 11638 | |
@@ -11209,7 +11650,9 @@ discard block |
||
| 11209 | 11650 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
| 11210 | 11651 | |
| 11211 | 11652 | $Connection = new Connection($this->db); |
| 11212 | - if (!$Connection->tableExists('countries')) return ''; |
|
| 11653 | + if (!$Connection->tableExists('countries')) { |
|
| 11654 | + return ''; |
|
| 11655 | + } |
|
| 11213 | 11656 | |
| 11214 | 11657 | try { |
| 11215 | 11658 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -11221,9 +11664,13 @@ discard block |
||
| 11221 | 11664 | $sth->closeCursor(); |
| 11222 | 11665 | if (count($row) > 0) { |
| 11223 | 11666 | return $row; |
| 11224 | - } else return ''; |
|
| 11667 | + } else { |
|
| 11668 | + return ''; |
|
| 11669 | + } |
|
| 11225 | 11670 | } catch (PDOException $e) { |
| 11226 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
| 11671 | + if (isset($globalDebug) && $globalDebug) { |
|
| 11672 | + echo 'Error : '.$e->getMessage()."\n"; |
|
| 11673 | + } |
|
| 11227 | 11674 | return ''; |
| 11228 | 11675 | } |
| 11229 | 11676 | |
@@ -11473,7 +11920,9 @@ discard block |
||
| 11473 | 11920 | { |
| 11474 | 11921 | global $globalBitlyAccessToken; |
| 11475 | 11922 | |
| 11476 | - if ($globalBitlyAccessToken == '') return $url; |
|
| 11923 | + if ($globalBitlyAccessToken == '') { |
|
| 11924 | + return $url; |
|
| 11925 | + } |
|
| 11477 | 11926 | |
| 11478 | 11927 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
| 11479 | 11928 | |
@@ -11622,7 +12071,9 @@ discard block |
||
| 11622 | 12071 | |
| 11623 | 12072 | |
| 11624 | 12073 | // routes |
| 11625 | - if ($globalDebug) print "Routes...\n"; |
|
| 12074 | + if ($globalDebug) { |
|
| 12075 | + print "Routes...\n"; |
|
| 12076 | + } |
|
| 11626 | 12077 | if ($globalDBdriver == 'mysql') { |
| 11627 | 12078 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
| 11628 | 12079 | } else { |
@@ -11641,7 +12092,9 @@ discard block |
||
| 11641 | 12092 | } |
| 11642 | 12093 | } |
| 11643 | 12094 | |
| 11644 | - if ($globalDebug) print "Airlines...\n"; |
|
| 12095 | + if ($globalDebug) { |
|
| 12096 | + print "Airlines...\n"; |
|
| 12097 | + } |
|
| 11645 | 12098 | //airlines |
| 11646 | 12099 | if ($globalDBdriver == 'mysql') { |
| 11647 | 12100 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -11655,10 +12108,15 @@ discard block |
||
| 11655 | 12108 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 11656 | 12109 | { |
| 11657 | 12110 | $fromsource = NULL; |
| 11658 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 11659 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 11660 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 11661 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 12111 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
| 12112 | + $fromsource = 'vatsim'; |
|
| 12113 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
| 12114 | + $fromsource = 'ivao'; |
|
| 12115 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 12116 | + $fromsource = 'vatsim'; |
|
| 12117 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 12118 | + $fromsource = 'ivao'; |
|
| 12119 | + } |
|
| 11662 | 12120 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
| 11663 | 12121 | if (isset($airline_array[0]['name'])) { |
| 11664 | 12122 | $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
@@ -11668,13 +12126,17 @@ discard block |
||
| 11668 | 12126 | } |
| 11669 | 12127 | } |
| 11670 | 12128 | |
| 11671 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12129 | + if ($globalDebug) { |
|
| 12130 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
| 12131 | + } |
|
| 11672 | 12132 | //duplicate modes |
| 11673 | 12133 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
| 11674 | 12134 | $sth = $this->db->prepare($query); |
| 11675 | 12135 | $sth->execute(); |
| 11676 | 12136 | |
| 11677 | - if ($globalDebug) print "Aircraft...\n"; |
|
| 12137 | + if ($globalDebug) { |
|
| 12138 | + print "Aircraft...\n"; |
|
| 12139 | + } |
|
| 11678 | 12140 | //aircraft |
| 11679 | 12141 | if ($globalDBdriver == 'mysql') { |
| 11680 | 12142 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -11717,26 +12179,38 @@ discard block |
||
| 11717 | 12179 | if (isset($closestAirports[0])) { |
| 11718 | 12180 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
| 11719 | 12181 | $airport_icao = $closestAirports[0]['icao']; |
| 11720 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12182 | + if ($globalDebug) { |
|
| 12183 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12184 | + } |
|
| 11721 | 12185 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
| 11722 | 12186 | foreach ($closestAirports as $airport) { |
| 11723 | 12187 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
| 11724 | 12188 | $airport_icao = $airport['icao']; |
| 11725 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12189 | + if ($globalDebug) { |
|
| 12190 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 12191 | + } |
|
| 11726 | 12192 | break; |
| 11727 | 12193 | } |
| 11728 | 12194 | } |
| 11729 | 12195 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
| 11730 | 12196 | $airport_icao = $closestAirports[0]['icao']; |
| 11731 | - if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12197 | + if ($globalDebug) { |
|
| 12198 | + echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12199 | + } |
|
| 11732 | 12200 | } else { |
| 11733 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12201 | + if ($globalDebug) { |
|
| 12202 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
| 12203 | + } |
|
| 11734 | 12204 | } |
| 11735 | 12205 | } else { |
| 11736 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12206 | + if ($globalDebug) { |
|
| 12207 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 12208 | + } |
|
| 11737 | 12209 | } |
| 11738 | 12210 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 11739 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12211 | + if ($globalDebug) { |
|
| 12212 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
| 12213 | + } |
|
| 11740 | 12214 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
| 11741 | 12215 | $sthu = $this->db->prepare($update_query); |
| 11742 | 12216 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 5 | 5 | $global_query = "SELECT spotter_output.* FROM spotter_output"; |
| 6 | 6 | |
| 7 | -class Spotter{ |
|
| 7 | +class Spotter { |
|
| 8 | 8 | public $aircraft_correct_icaotype = array('CL64' => 'CL60', |
| 9 | 9 | 'F9LX' => 'F900', |
| 10 | 10 | 'K35T' => 'K35R', |
@@ -59,45 +59,45 @@ discard block |
||
| 59 | 59 | * @param Array $filter the filter |
| 60 | 60 | * @return Array the SQL part |
| 61 | 61 | */ |
| 62 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 62 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 63 | 63 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 64 | 64 | $filters = array(); |
| 65 | 65 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 66 | 66 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 67 | 67 | $filters = $globalStatsFilters[$globalFilterName]; |
| 68 | 68 | } else { |
| 69 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 69 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 72 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 73 | 73 | $filter_query_join = ''; |
| 74 | 74 | $filter_query_where = ''; |
| 75 | - foreach($filters as $flt) { |
|
| 75 | + foreach ($filters as $flt) { |
|
| 76 | 76 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 77 | 77 | if ($flt['airlines'][0] != '') { |
| 78 | 78 | if (isset($flt['source'])) { |
| 79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 80 | 80 | } else { |
| 81 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 81 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | } |
| 85 | 85 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 86 | 86 | if (isset($flt['source'])) { |
| 87 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 87 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 88 | 88 | } else { |
| 89 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 89 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
| 93 | 93 | if (isset($flt['source'])) { |
| 94 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 94 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 99 | 99 | if ($filter['airlines'][0] != '') { |
| 100 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 100 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
@@ -107,19 +107,19 @@ discard block |
||
| 107 | 107 | $filter_query_join .= " INNER JOIN (SELECT icao FROM airlines WHERE alliance = '".$filter['alliance']."') sal ON sal.icao = spotter_output.airline_icao "; |
| 108 | 108 | } |
| 109 | 109 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 110 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 110 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 111 | 111 | } |
| 112 | 112 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 113 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 113 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 114 | 114 | } |
| 115 | 115 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 116 | 116 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
| 117 | 117 | } |
| 118 | 118 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 119 | 119 | if ($filter_query_where == '') { |
| 120 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 120 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 121 | 121 | } else { |
| 122 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 122 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @return Array the spotter information |
| 138 | 138 | * |
| 139 | 139 | */ |
| 140 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 140 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 141 | 141 | { |
| 142 | 142 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
| 143 | 143 | $Image = new Image($this->db); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $sth = $this->db->prepare($query.$limitQuery); |
| 168 | 168 | $sth->execute($params); |
| 169 | 169 | } catch (PDOException $e) { |
| 170 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 170 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 171 | 171 | exit(); |
| 172 | 172 | } |
| 173 | 173 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $spotter_array = array(); |
| 178 | 178 | |
| 179 | 179 | |
| 180 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 180 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 181 | 181 | { |
| 182 | 182 | $num_rows++; |
| 183 | 183 | $temp_array = array(); |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
| 222 | 222 | if (isset($row['route_stop']) && $row['route_stop'] != '') { |
| 223 | 223 | $temp_array['route_stop'] = $row['route_stop']; |
| 224 | - $allroute = explode(' ',$row['route_stop']); |
|
| 224 | + $allroute = explode(' ', $row['route_stop']); |
|
| 225 | 225 | foreach ($allroute as $route) { |
| 226 | 226 | $route_airport_array = $this->getAllAirportInfo($route); |
| 227 | 227 | if (isset($route_airport_array[0]['name'])) { |
@@ -274,16 +274,16 @@ discard block |
||
| 274 | 274 | { |
| 275 | 275 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 276 | 276 | } else { |
| 277 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 277 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 278 | 278 | } |
| 279 | 279 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 280 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 281 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 280 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 281 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 282 | 282 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 283 | 283 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
| 284 | 284 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
| 285 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
| 286 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
| 285 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
| 286 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
| 287 | 287 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
| 288 | 288 | } |
| 289 | 289 | } |
@@ -318,9 +318,9 @@ discard block |
||
| 318 | 318 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 319 | 319 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 320 | 320 | if (is_numeric(substr($row['ident'], 2, 1))) { |
| 321 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource); |
|
| 321 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource); |
|
| 322 | 322 | } elseif (is_numeric(substr($row['ident'], 3, 1))) { |
| 323 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 323 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 324 | 324 | } else { |
| 325 | 325 | $airline_array = $this->getAllAirlineInfo('NA'); |
| 326 | 326 | } |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | } |
| 358 | 358 | } |
| 359 | 359 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
| 360 | - $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3)); |
|
| 360 | + $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3)); |
|
| 361 | 361 | //$acars_array = ACARS->getLiveAcarsData('BA40YL'); |
| 362 | 362 | if (count($acars_array) > 0) { |
| 363 | 363 | $temp_array['acars'] = $acars_array; |
@@ -374,11 +374,11 @@ discard block |
||
| 374 | 374 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 377 | + if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 378 | 378 | { |
| 379 | 379 | if ($globalIVAO) { |
| 380 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 381 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 380 | + if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']); |
|
| 381 | + else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']); |
|
| 382 | 382 | } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
| 383 | 383 | if (count($image_array) > 0) { |
| 384 | 384 | $temp_array['image'] = $image_array[0]['image']; |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 403 | 403 | } |
| 404 | 404 | |
| 405 | - if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 405 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 406 | 406 | if ($schedules === true) { |
| 407 | 407 | $schedule_array = $Schedule->getSchedule($temp_array['ident']); |
| 408 | 408 | //print_r($schedule_array); |
@@ -484,12 +484,12 @@ discard block |
||
| 484 | 484 | if (isset($row['squawk'])) { |
| 485 | 485 | $temp_array['squawk'] = $row['squawk']; |
| 486 | 486 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 487 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
|
| 488 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 487 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']); |
|
| 488 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 489 | 489 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 490 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
|
| 491 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 492 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 490 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']); |
|
| 491 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 492 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | $temp_array['query_number_rows'] = $num_rows; |
@@ -508,7 +508,7 @@ discard block |
||
| 508 | 508 | * @return Array the spotter information |
| 509 | 509 | * |
| 510 | 510 | */ |
| 511 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
| 511 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
| 512 | 512 | { |
| 513 | 513 | global $globalTimezone, $globalDBdriver; |
| 514 | 514 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -518,7 +518,7 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | $query_values = array(); |
| 520 | 520 | $additional_query = ''; |
| 521 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 521 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 522 | 522 | if ($q != "") |
| 523 | 523 | { |
| 524 | 524 | if (!is_string($q)) |
@@ -526,8 +526,8 @@ discard block |
||
| 526 | 526 | return false; |
| 527 | 527 | } else { |
| 528 | 528 | $q_array = explode(" ", $q); |
| 529 | - foreach ($q_array as $q_item){ |
|
| 530 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 529 | + foreach ($q_array as $q_item) { |
|
| 530 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 531 | 531 | $additional_query .= " AND ("; |
| 532 | 532 | if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
| 533 | 533 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -559,37 +559,37 @@ discard block |
||
| 559 | 559 | |
| 560 | 560 | if ($registration != "") |
| 561 | 561 | { |
| 562 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 562 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 563 | 563 | if (!is_string($registration)) |
| 564 | 564 | { |
| 565 | 565 | return false; |
| 566 | 566 | } else { |
| 567 | 567 | $additional_query .= " AND spotter_output.registration = :registration"; |
| 568 | - $query_values = array_merge($query_values,array(':registration' => $registration)); |
|
| 568 | + $query_values = array_merge($query_values, array(':registration' => $registration)); |
|
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | if ($aircraft_icao != "") |
| 573 | 573 | { |
| 574 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 574 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 575 | 575 | if (!is_string($aircraft_icao)) |
| 576 | 576 | { |
| 577 | 577 | return false; |
| 578 | 578 | } else { |
| 579 | 579 | $additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao"; |
| 580 | - $query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao)); |
|
| 580 | + $query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao)); |
|
| 581 | 581 | } |
| 582 | 582 | } |
| 583 | 583 | |
| 584 | 584 | if ($aircraft_manufacturer != "") |
| 585 | 585 | { |
| 586 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 586 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 587 | 587 | if (!is_string($aircraft_manufacturer)) |
| 588 | 588 | { |
| 589 | 589 | return false; |
| 590 | 590 | } else { |
| 591 | 591 | $additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer"; |
| 592 | - $query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 592 | + $query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 593 | 593 | } |
| 594 | 594 | } |
| 595 | 595 | |
@@ -605,25 +605,25 @@ discard block |
||
| 605 | 605 | |
| 606 | 606 | if ($airline_icao != "") |
| 607 | 607 | { |
| 608 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 608 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 609 | 609 | if (!is_string($airline_icao)) |
| 610 | 610 | { |
| 611 | 611 | return false; |
| 612 | 612 | } else { |
| 613 | 613 | $additional_query .= " AND spotter_output.airline_icao = :airline_icao"; |
| 614 | - $query_values = array_merge($query_values,array(':airline_icao' => $airline_icao)); |
|
| 614 | + $query_values = array_merge($query_values, array(':airline_icao' => $airline_icao)); |
|
| 615 | 615 | } |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | 618 | if ($airline_country != "") |
| 619 | 619 | { |
| 620 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 620 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
| 621 | 621 | if (!is_string($airline_country)) |
| 622 | 622 | { |
| 623 | 623 | return false; |
| 624 | 624 | } else { |
| 625 | 625 | $additional_query .= " AND spotter_output.airline_country = :airline_country"; |
| 626 | - $query_values = array_merge($query_values,array(':airline_country' => $airline_country)); |
|
| 626 | + $query_values = array_merge($query_values, array(':airline_country' => $airline_country)); |
|
| 627 | 627 | } |
| 628 | 628 | } |
| 629 | 629 | |
@@ -650,31 +650,31 @@ discard block |
||
| 650 | 650 | |
| 651 | 651 | if ($airport != "") |
| 652 | 652 | { |
| 653 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 653 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 654 | 654 | if (!is_string($airport)) |
| 655 | 655 | { |
| 656 | 656 | return false; |
| 657 | 657 | } else { |
| 658 | 658 | $additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)"; |
| 659 | - $query_values = array_merge($query_values,array(':airport' => $airport)); |
|
| 659 | + $query_values = array_merge($query_values, array(':airport' => $airport)); |
|
| 660 | 660 | } |
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | if ($airport_country != "") |
| 664 | 664 | { |
| 665 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 665 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
| 666 | 666 | if (!is_string($airport_country)) |
| 667 | 667 | { |
| 668 | 668 | return false; |
| 669 | 669 | } else { |
| 670 | 670 | $additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)"; |
| 671 | - $query_values = array_merge($query_values,array(':airport_country' => $airport_country)); |
|
| 671 | + $query_values = array_merge($query_values, array(':airport_country' => $airport_country)); |
|
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | if ($callsign != "") |
| 676 | 676 | { |
| 677 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 677 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 678 | 678 | if (!is_string($callsign)) |
| 679 | 679 | { |
| 680 | 680 | return false; |
@@ -682,79 +682,79 @@ discard block |
||
| 682 | 682 | $translate = $Translation->ident2icao($callsign); |
| 683 | 683 | if ($translate != $callsign) { |
| 684 | 684 | $additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)"; |
| 685 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
| 685 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
| 686 | 686 | } else { |
| 687 | 687 | $additional_query .= " AND spotter_output.ident = :callsign"; |
| 688 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
| 688 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
| 689 | 689 | } |
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | if ($owner != "") |
| 694 | 694 | { |
| 695 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 695 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 696 | 696 | if (!is_string($owner)) |
| 697 | 697 | { |
| 698 | 698 | return false; |
| 699 | 699 | } else { |
| 700 | 700 | $additional_query .= " AND spotter_output.owner_name = :owner"; |
| 701 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 701 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 702 | 702 | } |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | if ($pilot_name != "") |
| 706 | 706 | { |
| 707 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 707 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 708 | 708 | if (!is_string($pilot_name)) |
| 709 | 709 | { |
| 710 | 710 | return false; |
| 711 | 711 | } else { |
| 712 | 712 | $additional_query .= " AND spotter_output.pilot_name = :pilot_name"; |
| 713 | - $query_values = array_merge($query_values,array(':pilot_name' => $pilot_name)); |
|
| 713 | + $query_values = array_merge($query_values, array(':pilot_name' => $pilot_name)); |
|
| 714 | 714 | } |
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | if ($pilot_id != "") |
| 718 | 718 | { |
| 719 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 719 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
| 720 | 720 | if (!is_string($pilot_id)) |
| 721 | 721 | { |
| 722 | 722 | return false; |
| 723 | 723 | } else { |
| 724 | 724 | $additional_query .= " AND spotter_output.pilot_id = :pilot_id"; |
| 725 | - $query_values = array_merge($query_values,array(':pilot_id' => $pilot_id)); |
|
| 725 | + $query_values = array_merge($query_values, array(':pilot_id' => $pilot_id)); |
|
| 726 | 726 | } |
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | if ($departure_airport_route != "") |
| 730 | 730 | { |
| 731 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 731 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
| 732 | 732 | if (!is_string($departure_airport_route)) |
| 733 | 733 | { |
| 734 | 734 | return false; |
| 735 | 735 | } else { |
| 736 | 736 | $additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route"; |
| 737 | - $query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route)); |
|
| 737 | + $query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route)); |
|
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | 741 | if ($arrival_airport_route != "") |
| 742 | 742 | { |
| 743 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 743 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
| 744 | 744 | if (!is_string($arrival_airport_route)) |
| 745 | 745 | { |
| 746 | 746 | return false; |
| 747 | 747 | } else { |
| 748 | 748 | $additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route"; |
| 749 | - $query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 749 | + $query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 750 | 750 | } |
| 751 | 751 | } |
| 752 | 752 | |
| 753 | 753 | if ($altitude != "") |
| 754 | 754 | { |
| 755 | 755 | $altitude_array = explode(",", $altitude); |
| 756 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 757 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 756 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 757 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 758 | 758 | |
| 759 | 759 | if ($altitude_array[1] != "") |
| 760 | 760 | { |
@@ -770,8 +770,8 @@ discard block |
||
| 770 | 770 | if ($date_posted != "") |
| 771 | 771 | { |
| 772 | 772 | $date_array = explode(",", $date_posted); |
| 773 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 774 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 773 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 774 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 775 | 775 | |
| 776 | 776 | if ($globalTimezone != '') { |
| 777 | 777 | date_default_timezone_set($globalTimezone); |
@@ -802,8 +802,8 @@ discard block |
||
| 802 | 802 | { |
| 803 | 803 | $limit_array = explode(",", $limit); |
| 804 | 804 | |
| 805 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 806 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 805 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 806 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 807 | 807 | |
| 808 | 808 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 809 | 809 | { |
@@ -832,23 +832,23 @@ discard block |
||
| 832 | 832 | |
| 833 | 833 | |
| 834 | 834 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 835 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 835 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 836 | 836 | |
| 837 | 837 | if ($globalDBdriver == 'mysql') { |
| 838 | - $query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 838 | + $query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 839 | 839 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 840 | 840 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
| 841 | 841 | } else { |
| 842 | - $query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 842 | + $query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 843 | 843 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 844 | 844 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
| 845 | 845 | } |
| 846 | 846 | } else { |
| 847 | - $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 847 | + $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 848 | 848 | ".$additional_query." |
| 849 | 849 | ".$orderby_query; |
| 850 | 850 | } |
| 851 | - $spotter_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
| 851 | + $spotter_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
| 852 | 852 | return $spotter_array; |
| 853 | 853 | } |
| 854 | 854 | |
@@ -871,8 +871,8 @@ discard block |
||
| 871 | 871 | { |
| 872 | 872 | $limit_array = explode(",", $limit); |
| 873 | 873 | |
| 874 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 875 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 874 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 875 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 876 | 876 | |
| 877 | 877 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 878 | 878 | { |
@@ -889,9 +889,9 @@ discard block |
||
| 889 | 889 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 890 | 890 | } |
| 891 | 891 | |
| 892 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 892 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 893 | 893 | |
| 894 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 894 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 895 | 895 | |
| 896 | 896 | return $spotter_array; |
| 897 | 897 | } |
@@ -937,34 +937,34 @@ discard block |
||
| 937 | 937 | { |
| 938 | 938 | return false; |
| 939 | 939 | } else { |
| 940 | - if ($interval == "30m"){ |
|
| 940 | + if ($interval == "30m") { |
|
| 941 | 941 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date '; |
| 942 | - } else if ($interval == "1h"){ |
|
| 942 | + } else if ($interval == "1h") { |
|
| 943 | 943 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date '; |
| 944 | - } else if ($interval == "3h"){ |
|
| 944 | + } else if ($interval == "3h") { |
|
| 945 | 945 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date '; |
| 946 | - } else if ($interval == "6h"){ |
|
| 946 | + } else if ($interval == "6h") { |
|
| 947 | 947 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date '; |
| 948 | - } else if ($interval == "12h"){ |
|
| 948 | + } else if ($interval == "12h") { |
|
| 949 | 949 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date '; |
| 950 | - } else if ($interval == "24h"){ |
|
| 950 | + } else if ($interval == "24h") { |
|
| 951 | 951 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date '; |
| 952 | - } else if ($interval == "7d"){ |
|
| 952 | + } else if ($interval == "7d") { |
|
| 953 | 953 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date '; |
| 954 | - } else if ($interval == "30d"){ |
|
| 954 | + } else if ($interval == "30d") { |
|
| 955 | 955 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date '; |
| 956 | 956 | } |
| 957 | 957 | } |
| 958 | 958 | } |
| 959 | 959 | |
| 960 | - $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 960 | + $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 961 | 961 | WHERE spotter_output.latitude <> '' |
| 962 | 962 | AND spotter_output.longitude <> '' |
| 963 | 963 | ".$additional_query." |
| 964 | 964 | HAVING distance < :radius |
| 965 | 965 | ORDER BY distance"; |
| 966 | 966 | |
| 967 | - $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query); |
|
| 967 | + $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query); |
|
| 968 | 968 | |
| 969 | 969 | return $spotter_array; |
| 970 | 970 | } |
@@ -976,21 +976,21 @@ discard block |
||
| 976 | 976 | * @return Array the spotter information |
| 977 | 977 | * |
| 978 | 978 | */ |
| 979 | - public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
|
| 979 | + public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array()) |
|
| 980 | 980 | { |
| 981 | 981 | global $global_query; |
| 982 | 982 | |
| 983 | 983 | date_default_timezone_set('UTC'); |
| 984 | 984 | |
| 985 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 985 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 986 | 986 | |
| 987 | 987 | $limit_query = ''; |
| 988 | 988 | if ($limit != "") |
| 989 | 989 | { |
| 990 | 990 | $limit_array = explode(",", $limit); |
| 991 | 991 | |
| 992 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 993 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 992 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 993 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 994 | 994 | |
| 995 | 995 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 996 | 996 | { |
@@ -1007,7 +1007,7 @@ discard block |
||
| 1007 | 1007 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1008 | 1008 | } |
| 1009 | 1009 | |
| 1010 | - $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1010 | + $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1011 | 1011 | |
| 1012 | 1012 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1013 | 1013 | |
@@ -1026,15 +1026,15 @@ discard block |
||
| 1026 | 1026 | global $global_query; |
| 1027 | 1027 | |
| 1028 | 1028 | date_default_timezone_set('UTC'); |
| 1029 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1029 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1030 | 1030 | |
| 1031 | 1031 | $limit_query = ''; |
| 1032 | 1032 | if ($limit != "") |
| 1033 | 1033 | { |
| 1034 | 1034 | $limit_array = explode(",", $limit); |
| 1035 | 1035 | |
| 1036 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1037 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1036 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1037 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1038 | 1038 | |
| 1039 | 1039 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1040 | 1040 | { |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | - $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1054 | + $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1055 | 1055 | |
| 1056 | 1056 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1057 | 1057 | |
@@ -1065,20 +1065,20 @@ discard block |
||
| 1065 | 1065 | * @return Array the spotter information |
| 1066 | 1066 | * |
| 1067 | 1067 | */ |
| 1068 | - public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
|
| 1068 | + public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array()) |
|
| 1069 | 1069 | { |
| 1070 | 1070 | global $global_query; |
| 1071 | 1071 | |
| 1072 | 1072 | date_default_timezone_set('UTC'); |
| 1073 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1073 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1074 | 1074 | |
| 1075 | 1075 | $limit_query = ''; |
| 1076 | 1076 | if ($limit != "") |
| 1077 | 1077 | { |
| 1078 | 1078 | $limit_array = explode(",", $limit); |
| 1079 | 1079 | |
| 1080 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1081 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1080 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1081 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1082 | 1082 | |
| 1083 | 1083 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1084 | 1084 | { |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | - $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1098 | + $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1099 | 1099 | |
| 1100 | 1100 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1101 | 1101 | |
@@ -1115,7 +1115,7 @@ discard block |
||
| 1115 | 1115 | |
| 1116 | 1116 | date_default_timezone_set('UTC'); |
| 1117 | 1117 | |
| 1118 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1118 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1119 | 1119 | |
| 1120 | 1120 | $limit_query = ''; |
| 1121 | 1121 | |
@@ -1123,8 +1123,8 @@ discard block |
||
| 1123 | 1123 | { |
| 1124 | 1124 | $limit_array = explode(",", $limit); |
| 1125 | 1125 | |
| 1126 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1127 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1126 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1127 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1128 | 1128 | |
| 1129 | 1129 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1130 | 1130 | { |
@@ -1141,7 +1141,7 @@ discard block |
||
| 1141 | 1141 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | - $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1144 | + $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1145 | 1145 | |
| 1146 | 1146 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1147 | 1147 | |
@@ -1160,14 +1160,14 @@ discard block |
||
| 1160 | 1160 | global $global_query; |
| 1161 | 1161 | |
| 1162 | 1162 | date_default_timezone_set('UTC'); |
| 1163 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1163 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1164 | 1164 | $limit_query = ''; |
| 1165 | 1165 | if ($limit != "") |
| 1166 | 1166 | { |
| 1167 | 1167 | $limit_array = explode(",", $limit); |
| 1168 | 1168 | |
| 1169 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1170 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1169 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1170 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1171 | 1171 | |
| 1172 | 1172 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1173 | 1173 | { |
@@ -1184,7 +1184,7 @@ discard block |
||
| 1184 | 1184 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | - $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1187 | + $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1188 | 1188 | |
| 1189 | 1189 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1190 | 1190 | |
@@ -1208,9 +1208,9 @@ discard block |
||
| 1208 | 1208 | $query_values = array(':id' => $id); |
| 1209 | 1209 | |
| 1210 | 1210 | //$query = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." "; |
| 1211 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 1211 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 1212 | 1212 | |
| 1213 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 1213 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 1214 | 1214 | |
| 1215 | 1215 | return $spotter_array; |
| 1216 | 1216 | } |
@@ -1248,8 +1248,8 @@ discard block |
||
| 1248 | 1248 | { |
| 1249 | 1249 | $limit_array = explode(",", $limit); |
| 1250 | 1250 | |
| 1251 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1252 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1251 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1252 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1253 | 1253 | |
| 1254 | 1254 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1255 | 1255 | { |
@@ -1303,8 +1303,8 @@ discard block |
||
| 1303 | 1303 | { |
| 1304 | 1304 | $limit_array = explode(",", $limit); |
| 1305 | 1305 | |
| 1306 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1307 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1306 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1307 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1308 | 1308 | |
| 1309 | 1309 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1310 | 1310 | { |
@@ -1353,8 +1353,8 @@ discard block |
||
| 1353 | 1353 | { |
| 1354 | 1354 | $limit_array = explode(",", $limit); |
| 1355 | 1355 | |
| 1356 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1357 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1356 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1357 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1358 | 1358 | |
| 1359 | 1359 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1360 | 1360 | { |
@@ -1395,7 +1395,7 @@ discard block |
||
| 1395 | 1395 | $query_values = array(); |
| 1396 | 1396 | $limit_query = ''; |
| 1397 | 1397 | $additional_query = ''; |
| 1398 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1398 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1399 | 1399 | |
| 1400 | 1400 | if ($aircraft_type != "") |
| 1401 | 1401 | { |
@@ -1412,8 +1412,8 @@ discard block |
||
| 1412 | 1412 | { |
| 1413 | 1413 | $limit_array = explode(",", $limit); |
| 1414 | 1414 | |
| 1415 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1416 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1415 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1416 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1417 | 1417 | |
| 1418 | 1418 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1419 | 1419 | { |
@@ -1469,8 +1469,8 @@ discard block |
||
| 1469 | 1469 | { |
| 1470 | 1470 | $limit_array = explode(",", $limit); |
| 1471 | 1471 | |
| 1472 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1473 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1472 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1473 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1474 | 1474 | |
| 1475 | 1475 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1476 | 1476 | { |
@@ -1486,7 +1486,7 @@ discard block |
||
| 1486 | 1486 | } else { |
| 1487 | 1487 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1488 | 1488 | } |
| 1489 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1489 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1490 | 1490 | |
| 1491 | 1491 | //$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query; |
| 1492 | 1492 | $query = $global_query.$filter_query." ".$additional_query." ".$orderby_query; |
@@ -1505,7 +1505,7 @@ discard block |
||
| 1505 | 1505 | * @return Array the spotter information |
| 1506 | 1506 | * |
| 1507 | 1507 | */ |
| 1508 | - public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
|
| 1508 | + public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array()) |
|
| 1509 | 1509 | { |
| 1510 | 1510 | global $global_query; |
| 1511 | 1511 | |
@@ -1514,7 +1514,7 @@ discard block |
||
| 1514 | 1514 | $query_values = array(); |
| 1515 | 1515 | $limit_query = ''; |
| 1516 | 1516 | $additional_query = ''; |
| 1517 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1517 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1518 | 1518 | |
| 1519 | 1519 | if ($airline != "") |
| 1520 | 1520 | { |
@@ -1531,8 +1531,8 @@ discard block |
||
| 1531 | 1531 | { |
| 1532 | 1532 | $limit_array = explode(",", $limit); |
| 1533 | 1533 | |
| 1534 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1535 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1534 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1535 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1536 | 1536 | |
| 1537 | 1537 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1538 | 1538 | { |
@@ -1562,7 +1562,7 @@ discard block |
||
| 1562 | 1562 | * @return Array the spotter information |
| 1563 | 1563 | * |
| 1564 | 1564 | */ |
| 1565 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1565 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
| 1566 | 1566 | { |
| 1567 | 1567 | global $global_query; |
| 1568 | 1568 | |
@@ -1570,7 +1570,7 @@ discard block |
||
| 1570 | 1570 | $query_values = array(); |
| 1571 | 1571 | $limit_query = ''; |
| 1572 | 1572 | $additional_query = ''; |
| 1573 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1573 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1574 | 1574 | |
| 1575 | 1575 | if ($airport != "") |
| 1576 | 1576 | { |
@@ -1587,8 +1587,8 @@ discard block |
||
| 1587 | 1587 | { |
| 1588 | 1588 | $limit_array = explode(",", $limit); |
| 1589 | 1589 | |
| 1590 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1591 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1590 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1591 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1592 | 1592 | |
| 1593 | 1593 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1594 | 1594 | { |
@@ -1620,7 +1620,7 @@ discard block |
||
| 1620 | 1620 | * @return Array the spotter information |
| 1621 | 1621 | * |
| 1622 | 1622 | */ |
| 1623 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 1623 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 1624 | 1624 | { |
| 1625 | 1625 | global $global_query, $globalTimezone, $globalDBdriver; |
| 1626 | 1626 | |
@@ -1628,7 +1628,7 @@ discard block |
||
| 1628 | 1628 | $limit_query = ''; |
| 1629 | 1629 | $additional_query = ''; |
| 1630 | 1630 | |
| 1631 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1631 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1632 | 1632 | |
| 1633 | 1633 | if ($date != "") |
| 1634 | 1634 | { |
@@ -1657,8 +1657,8 @@ discard block |
||
| 1657 | 1657 | { |
| 1658 | 1658 | $limit_array = explode(",", $limit); |
| 1659 | 1659 | |
| 1660 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1661 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1660 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1661 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1662 | 1662 | |
| 1663 | 1663 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1664 | 1664 | { |
@@ -1688,7 +1688,7 @@ discard block |
||
| 1688 | 1688 | * @return Array the spotter information |
| 1689 | 1689 | * |
| 1690 | 1690 | */ |
| 1691 | - public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
|
| 1691 | + public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array()) |
|
| 1692 | 1692 | { |
| 1693 | 1693 | global $global_query; |
| 1694 | 1694 | |
@@ -1697,7 +1697,7 @@ discard block |
||
| 1697 | 1697 | $query_values = array(); |
| 1698 | 1698 | $limit_query = ''; |
| 1699 | 1699 | $additional_query = ''; |
| 1700 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1700 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1701 | 1701 | if ($country != "") |
| 1702 | 1702 | { |
| 1703 | 1703 | if (!is_string($country)) |
@@ -1714,8 +1714,8 @@ discard block |
||
| 1714 | 1714 | { |
| 1715 | 1715 | $limit_array = explode(",", $limit); |
| 1716 | 1716 | |
| 1717 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1718 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1717 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1718 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1719 | 1719 | |
| 1720 | 1720 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1721 | 1721 | { |
@@ -1755,7 +1755,7 @@ discard block |
||
| 1755 | 1755 | $query_values = array(); |
| 1756 | 1756 | $additional_query = ''; |
| 1757 | 1757 | $limit_query = ''; |
| 1758 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1758 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1759 | 1759 | |
| 1760 | 1760 | if ($aircraft_manufacturer != "") |
| 1761 | 1761 | { |
@@ -1772,8 +1772,8 @@ discard block |
||
| 1772 | 1772 | { |
| 1773 | 1773 | $limit_array = explode(",", $limit); |
| 1774 | 1774 | |
| 1775 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1776 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1775 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1776 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1777 | 1777 | |
| 1778 | 1778 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1779 | 1779 | { |
@@ -1815,14 +1815,14 @@ discard block |
||
| 1815 | 1815 | $query_values = array(); |
| 1816 | 1816 | $additional_query = ''; |
| 1817 | 1817 | $limit_query = ''; |
| 1818 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1818 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1819 | 1819 | if ($departure_airport_icao != "") |
| 1820 | 1820 | { |
| 1821 | 1821 | if (!is_string($departure_airport_icao)) |
| 1822 | 1822 | { |
| 1823 | 1823 | return false; |
| 1824 | 1824 | } else { |
| 1825 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1825 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1826 | 1826 | $additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)"; |
| 1827 | 1827 | //$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao"; |
| 1828 | 1828 | $query_values = array(':departure_airport_icao' => $departure_airport_icao); |
@@ -1835,10 +1835,10 @@ discard block |
||
| 1835 | 1835 | { |
| 1836 | 1836 | return false; |
| 1837 | 1837 | } else { |
| 1838 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1838 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1839 | 1839 | $additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)"; |
| 1840 | 1840 | //$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)"; |
| 1841 | - $query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1841 | + $query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1842 | 1842 | } |
| 1843 | 1843 | } |
| 1844 | 1844 | |
@@ -1846,8 +1846,8 @@ discard block |
||
| 1846 | 1846 | { |
| 1847 | 1847 | $limit_array = explode(",", $limit); |
| 1848 | 1848 | |
| 1849 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1850 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1849 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1850 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1851 | 1851 | |
| 1852 | 1852 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1853 | 1853 | { |
@@ -1886,15 +1886,15 @@ discard block |
||
| 1886 | 1886 | global $global_query; |
| 1887 | 1887 | |
| 1888 | 1888 | date_default_timezone_set('UTC'); |
| 1889 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1889 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1890 | 1890 | $limit_query = ''; |
| 1891 | 1891 | |
| 1892 | 1892 | if ($limit != "") |
| 1893 | 1893 | { |
| 1894 | 1894 | $limit_array = explode(",", $limit); |
| 1895 | 1895 | |
| 1896 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1897 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1896 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1897 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1898 | 1898 | |
| 1899 | 1899 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1900 | 1900 | { |
@@ -1911,7 +1911,7 @@ discard block |
||
| 1911 | 1911 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1912 | 1912 | } |
| 1913 | 1913 | |
| 1914 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1914 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1915 | 1915 | |
| 1916 | 1916 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1917 | 1917 | |
@@ -1924,19 +1924,19 @@ discard block |
||
| 1924 | 1924 | * @return String the highlight text |
| 1925 | 1925 | * |
| 1926 | 1926 | */ |
| 1927 | - public function getHighlightByRegistration($registration,$filter = array()) |
|
| 1927 | + public function getHighlightByRegistration($registration, $filter = array()) |
|
| 1928 | 1928 | { |
| 1929 | 1929 | global $global_query; |
| 1930 | 1930 | |
| 1931 | 1931 | date_default_timezone_set('UTC'); |
| 1932 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1933 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 1932 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1933 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 1934 | 1934 | |
| 1935 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1935 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1936 | 1936 | $sth = $this->db->prepare($query); |
| 1937 | 1937 | $sth->execute(array(':registration' => $registration)); |
| 1938 | 1938 | |
| 1939 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1939 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1940 | 1940 | { |
| 1941 | 1941 | $highlight = $row['highlight']; |
| 1942 | 1942 | } |
@@ -1952,14 +1952,14 @@ discard block |
||
| 1952 | 1952 | * @return String usage |
| 1953 | 1953 | * |
| 1954 | 1954 | */ |
| 1955 | - public function getSquawkUsage($squawk = '',$country = 'FR') |
|
| 1955 | + public function getSquawkUsage($squawk = '', $country = 'FR') |
|
| 1956 | 1956 | { |
| 1957 | 1957 | |
| 1958 | - $squawk = filter_var($squawk,FILTER_SANITIZE_STRING); |
|
| 1959 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1958 | + $squawk = filter_var($squawk, FILTER_SANITIZE_STRING); |
|
| 1959 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1960 | 1960 | |
| 1961 | 1961 | $query = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1"; |
| 1962 | - $query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country); |
|
| 1962 | + $query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country); |
|
| 1963 | 1963 | |
| 1964 | 1964 | $sth = $this->db->prepare($query); |
| 1965 | 1965 | $sth->execute($query_values); |
@@ -1981,9 +1981,9 @@ discard block |
||
| 1981 | 1981 | public function getAirportIcao($airport_iata = '') |
| 1982 | 1982 | { |
| 1983 | 1983 | |
| 1984 | - $airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING); |
|
| 1984 | + $airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING); |
|
| 1985 | 1985 | |
| 1986 | - $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1986 | + $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1987 | 1987 | $query_values = array(':airport' => $airport_iata); |
| 1988 | 1988 | |
| 1989 | 1989 | $sth = $this->db->prepare($query); |
@@ -2005,12 +2005,12 @@ discard block |
||
| 2005 | 2005 | * @return Float distance to the airport |
| 2006 | 2006 | * |
| 2007 | 2007 | */ |
| 2008 | - public function getAirportDistance($airport_icao,$latitude,$longitude) |
|
| 2008 | + public function getAirportDistance($airport_icao, $latitude, $longitude) |
|
| 2009 | 2009 | { |
| 2010 | 2010 | |
| 2011 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 2011 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 2012 | 2012 | |
| 2013 | - $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 2013 | + $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 2014 | 2014 | $query_values = array(':airport' => $airport_icao); |
| 2015 | 2015 | $sth = $this->db->prepare($query); |
| 2016 | 2016 | $sth->execute($query_values); |
@@ -2020,7 +2020,7 @@ discard block |
||
| 2020 | 2020 | $airport_latitude = $row['latitude']; |
| 2021 | 2021 | $airport_longitude = $row['longitude']; |
| 2022 | 2022 | $Common = new Common(); |
| 2023 | - return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
|
| 2023 | + return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude); |
|
| 2024 | 2024 | } else return ''; |
| 2025 | 2025 | } |
| 2026 | 2026 | |
@@ -2034,11 +2034,11 @@ discard block |
||
| 2034 | 2034 | public function getAllAirportInfo($airport = '') |
| 2035 | 2035 | { |
| 2036 | 2036 | |
| 2037 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 2037 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 2038 | 2038 | |
| 2039 | 2039 | $query_values = array(); |
| 2040 | 2040 | if ($airport == 'NA') { |
| 2041 | - return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => '')); |
|
| 2041 | + return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => '')); |
|
| 2042 | 2042 | } elseif ($airport == '') { |
| 2043 | 2043 | $query = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport"; |
| 2044 | 2044 | } else { |
@@ -2086,14 +2086,14 @@ discard block |
||
| 2086 | 2086 | { |
| 2087 | 2087 | $lst_countries = ''; |
| 2088 | 2088 | foreach ($countries as $country) { |
| 2089 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 2089 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 2090 | 2090 | if ($lst_countries == '') { |
| 2091 | 2091 | $lst_countries = "'".$country."'"; |
| 2092 | 2092 | } else { |
| 2093 | 2093 | $lst_countries .= ",'".$country."'"; |
| 2094 | 2094 | } |
| 2095 | 2095 | } |
| 2096 | - $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 2096 | + $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 2097 | 2097 | |
| 2098 | 2098 | $sth = $this->db->prepare($query); |
| 2099 | 2099 | $sth->execute(); |
@@ -2101,7 +2101,7 @@ discard block |
||
| 2101 | 2101 | $airport_array = array(); |
| 2102 | 2102 | $temp_array = array(); |
| 2103 | 2103 | |
| 2104 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2104 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2105 | 2105 | { |
| 2106 | 2106 | $temp_array['name'] = $row['name']; |
| 2107 | 2107 | $temp_array['city'] = $row['city']; |
@@ -2129,10 +2129,10 @@ discard block |
||
| 2129 | 2129 | { |
| 2130 | 2130 | global $globalDBdriver; |
| 2131 | 2131 | if (is_array($coord)) { |
| 2132 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2133 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2134 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2135 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2132 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2133 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2134 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2135 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2136 | 2136 | } else return array(); |
| 2137 | 2137 | if ($globalDBdriver == 'mysql') { |
| 2138 | 2138 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
@@ -2144,7 +2144,7 @@ discard block |
||
| 2144 | 2144 | |
| 2145 | 2145 | $airport_array = array(); |
| 2146 | 2146 | |
| 2147 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2147 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2148 | 2148 | { |
| 2149 | 2149 | $temp_array = $row; |
| 2150 | 2150 | |
@@ -2164,13 +2164,13 @@ discard block |
||
| 2164 | 2164 | public function getAllWaypointsInfobyCoord($coord) |
| 2165 | 2165 | { |
| 2166 | 2166 | if (is_array($coord)) { |
| 2167 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2168 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2169 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2170 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2167 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2168 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2169 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2170 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2171 | 2171 | } else return array(); |
| 2172 | 2172 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2173 | - $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 2173 | + $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 2174 | 2174 | //$query = "SELECT waypoints.* FROM waypoints"; |
| 2175 | 2175 | //$query = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end"; |
| 2176 | 2176 | //$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
@@ -2182,7 +2182,7 @@ discard block |
||
| 2182 | 2182 | |
| 2183 | 2183 | $waypoints_array = array(); |
| 2184 | 2184 | |
| 2185 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2185 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2186 | 2186 | { |
| 2187 | 2187 | $temp_array = $row; |
| 2188 | 2188 | |
@@ -2204,10 +2204,10 @@ discard block |
||
| 2204 | 2204 | { |
| 2205 | 2205 | global $globalUseRealAirlines; |
| 2206 | 2206 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2207 | - $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
|
| 2207 | + $airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING)); |
|
| 2208 | 2208 | if ($airline_icao == 'NA') { |
| 2209 | 2209 | $airline_array = array(); |
| 2210 | - $airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2210 | + $airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2211 | 2211 | return $airline_array; |
| 2212 | 2212 | } else { |
| 2213 | 2213 | if (strlen($airline_icao) == 2) { |
@@ -2228,7 +2228,7 @@ discard block |
||
| 2228 | 2228 | if ($fromsource === NULL) { |
| 2229 | 2229 | $sth->execute(array(':airline_icao' => $airline_icao)); |
| 2230 | 2230 | } else { |
| 2231 | - $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
|
| 2231 | + $sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource)); |
|
| 2232 | 2232 | } |
| 2233 | 2233 | /* |
| 2234 | 2234 | $airline_array = array(); |
@@ -2273,13 +2273,13 @@ discard block |
||
| 2273 | 2273 | { |
| 2274 | 2274 | global $globalUseRealAirlines; |
| 2275 | 2275 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2276 | - $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
|
| 2277 | - $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
|
| 2276 | + $airline_name = strtolower(filter_var($airline_name, FILTER_SANITIZE_STRING)); |
|
| 2277 | + $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
|
| 2278 | 2278 | $sth = $this->db->prepare($query); |
| 2279 | 2279 | if ($fromsource === NULL) { |
| 2280 | 2280 | $sth->execute(array(':airline_name' => $airline_name)); |
| 2281 | 2281 | } else { |
| 2282 | - $sth->execute(array(':airline_name' => $airline_name,':fromsource' => $fromsource)); |
|
| 2282 | + $sth->execute(array(':airline_name' => $airline_name, ':fromsource' => $fromsource)); |
|
| 2283 | 2283 | } |
| 2284 | 2284 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2285 | 2285 | if (empty($result) && $fromsource !== NULL) { |
@@ -2304,12 +2304,12 @@ discard block |
||
| 2304 | 2304 | */ |
| 2305 | 2305 | public function getAllAircraftInfo($aircraft_type) |
| 2306 | 2306 | { |
| 2307 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2307 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2308 | 2308 | |
| 2309 | 2309 | if ($aircraft_type == 'NA') { |
| 2310 | - return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2310 | + return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2311 | 2311 | } |
| 2312 | - $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2312 | + $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2313 | 2313 | |
| 2314 | 2314 | $sth = $this->db->prepare($query); |
| 2315 | 2315 | $sth->execute(array(':aircraft_type' => $aircraft_type)); |
@@ -2341,7 +2341,7 @@ discard block |
||
| 2341 | 2341 | */ |
| 2342 | 2342 | public function getAircraftIcao($aircraft_type) |
| 2343 | 2343 | { |
| 2344 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2344 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2345 | 2345 | $all_aircraft = array('737-300' => 'B733', |
| 2346 | 2346 | '777-200' => 'B772', |
| 2347 | 2347 | '777-200ER' => 'B772', |
@@ -2353,10 +2353,10 @@ discard block |
||
| 2353 | 2353 | 'A380' => 'A388'); |
| 2354 | 2354 | if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
| 2355 | 2355 | |
| 2356 | - $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2356 | + $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2357 | 2357 | $aircraft_type = strtoupper($aircraft_type); |
| 2358 | 2358 | $sth = $this->db->prepare($query); |
| 2359 | - $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
|
| 2359 | + $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,)); |
|
| 2360 | 2360 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2361 | 2361 | if (isset($result[0]['icao'])) return $result[0]['icao']; |
| 2362 | 2362 | else return ''; |
@@ -2371,9 +2371,9 @@ discard block |
||
| 2371 | 2371 | */ |
| 2372 | 2372 | public function getAllAircraftType($aircraft_modes) |
| 2373 | 2373 | { |
| 2374 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 2374 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 2375 | 2375 | |
| 2376 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2376 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2377 | 2377 | |
| 2378 | 2378 | $sth = $this->db->prepare($query); |
| 2379 | 2379 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -2396,9 +2396,9 @@ discard block |
||
| 2396 | 2396 | */ |
| 2397 | 2397 | public function getAllAircraftTypeByRegistration($registration) |
| 2398 | 2398 | { |
| 2399 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2399 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2400 | 2400 | |
| 2401 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2401 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2402 | 2402 | |
| 2403 | 2403 | $sth = $this->db->prepare($query); |
| 2404 | 2404 | $sth->execute(array(':registration' => $registration)); |
@@ -2419,9 +2419,9 @@ discard block |
||
| 2419 | 2419 | */ |
| 2420 | 2420 | public function getAllIDByRegistration($registration) |
| 2421 | 2421 | { |
| 2422 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2422 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2423 | 2423 | |
| 2424 | - $query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2424 | + $query = "SELECT spotter_id,flightaware_id, date FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2425 | 2425 | |
| 2426 | 2426 | $sth = $this->db->prepare($query); |
| 2427 | 2427 | $sth->execute(array(':registration' => $registration)); |
@@ -2429,7 +2429,7 @@ discard block |
||
| 2429 | 2429 | $idarray = array(); |
| 2430 | 2430 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 2431 | 2431 | $date = $row['date']; |
| 2432 | - $idarray[$date] = array('flightaware_id' => $row['flightaware_id'],'spotter_id' => $row['spotter_id']); |
|
| 2432 | + $idarray[$date] = array('flightaware_id' => $row['flightaware_id'], 'spotter_id' => $row['spotter_id']); |
|
| 2433 | 2433 | } |
| 2434 | 2434 | return $idarray; |
| 2435 | 2435 | } |
@@ -2443,8 +2443,8 @@ discard block |
||
| 2443 | 2443 | */ |
| 2444 | 2444 | public function getOperator($operator) |
| 2445 | 2445 | { |
| 2446 | - $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
|
| 2447 | - $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2446 | + $operator = filter_var($operator, FILTER_SANITIZE_STRING); |
|
| 2447 | + $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2448 | 2448 | |
| 2449 | 2449 | $sth = $this->db->prepare($query); |
| 2450 | 2450 | $sth->execute(array(':operator' => $operator)); |
@@ -2465,9 +2465,9 @@ discard block |
||
| 2465 | 2465 | */ |
| 2466 | 2466 | public function getRouteInfo($callsign) |
| 2467 | 2467 | { |
| 2468 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 2468 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 2469 | 2469 | if ($callsign == '') return array(); |
| 2470 | - $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
| 2470 | + $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
| 2471 | 2471 | |
| 2472 | 2472 | $sth = $this->db->prepare($query); |
| 2473 | 2473 | $sth->execute(array(':callsign' => $callsign)); |
@@ -2488,9 +2488,9 @@ discard block |
||
| 2488 | 2488 | */ |
| 2489 | 2489 | public function getAircraftInfoByRegistration($registration) |
| 2490 | 2490 | { |
| 2491 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2491 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2492 | 2492 | |
| 2493 | - $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2493 | + $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2494 | 2494 | |
| 2495 | 2495 | $sth = $this->db->prepare($query); |
| 2496 | 2496 | $sth->execute(array(':registration' => $registration)); |
@@ -2498,7 +2498,7 @@ discard block |
||
| 2498 | 2498 | $aircraft_array = array(); |
| 2499 | 2499 | $temp_array = array(); |
| 2500 | 2500 | |
| 2501 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2501 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2502 | 2502 | { |
| 2503 | 2503 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2504 | 2504 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -2520,7 +2520,7 @@ discard block |
||
| 2520 | 2520 | */ |
| 2521 | 2521 | public function getAircraftOwnerByRegistration($registration) |
| 2522 | 2522 | { |
| 2523 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2523 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2524 | 2524 | $Connection = new Connection($this->db); |
| 2525 | 2525 | if ($Connection->tableExists('aircraft_owner')) { |
| 2526 | 2526 | $query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1"; |
@@ -2542,7 +2542,7 @@ discard block |
||
| 2542 | 2542 | public function getAllFlightsforSitemap() |
| 2543 | 2543 | { |
| 2544 | 2544 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
| 2545 | - $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2545 | + $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2546 | 2546 | |
| 2547 | 2547 | $sth = $this->db->prepare($query); |
| 2548 | 2548 | $sth->execute(); |
@@ -2589,7 +2589,7 @@ discard block |
||
| 2589 | 2589 | $manufacturer_array = array(); |
| 2590 | 2590 | $temp_array = array(); |
| 2591 | 2591 | |
| 2592 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2592 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2593 | 2593 | { |
| 2594 | 2594 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 2595 | 2595 | |
@@ -2626,7 +2626,7 @@ discard block |
||
| 2626 | 2626 | $aircraft_array = array(); |
| 2627 | 2627 | $temp_array = array(); |
| 2628 | 2628 | |
| 2629 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2629 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2630 | 2630 | { |
| 2631 | 2631 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 2632 | 2632 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
@@ -2647,8 +2647,8 @@ discard block |
||
| 2647 | 2647 | */ |
| 2648 | 2648 | public function getAllAircraftRegistrations($filters = array()) |
| 2649 | 2649 | { |
| 2650 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2651 | - $query = "SELECT DISTINCT spotter_output.registration |
|
| 2650 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2651 | + $query = "SELECT DISTINCT spotter_output.registration |
|
| 2652 | 2652 | FROM spotter_output".$filter_query." spotter_output.registration <> '' |
| 2653 | 2653 | ORDER BY spotter_output.registration ASC"; |
| 2654 | 2654 | |
@@ -2658,7 +2658,7 @@ discard block |
||
| 2658 | 2658 | $aircraft_array = array(); |
| 2659 | 2659 | $temp_array = array(); |
| 2660 | 2660 | |
| 2661 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2661 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2662 | 2662 | { |
| 2663 | 2663 | $temp_array['registration'] = $row['registration']; |
| 2664 | 2664 | |
@@ -2675,11 +2675,11 @@ discard block |
||
| 2675 | 2675 | * @return Array list of source name |
| 2676 | 2676 | * |
| 2677 | 2677 | */ |
| 2678 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 2678 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 2679 | 2679 | { |
| 2680 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2680 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2681 | 2681 | $query_values = array(); |
| 2682 | - $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2682 | + $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2683 | 2683 | FROM spotter_output".$filter_query." spotter_output.source_name <> ''"; |
| 2684 | 2684 | if ($type != '') { |
| 2685 | 2685 | $query_values = array(':type' => $type); |
@@ -2694,7 +2694,7 @@ discard block |
||
| 2694 | 2694 | $source_array = array(); |
| 2695 | 2695 | $temp_array = array(); |
| 2696 | 2696 | |
| 2697 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2697 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2698 | 2698 | { |
| 2699 | 2699 | $temp_array['source_name'] = $row['source_name']; |
| 2700 | 2700 | $source_array[] = $temp_array; |
@@ -2710,11 +2710,11 @@ discard block |
||
| 2710 | 2710 | * @return Array list of airline names |
| 2711 | 2711 | * |
| 2712 | 2712 | */ |
| 2713 | - public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
|
| 2713 | + public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array()) |
|
| 2714 | 2714 | { |
| 2715 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2716 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2717 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 2715 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2716 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2717 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
| 2718 | 2718 | if ($airline_type == '' || $airline_type == 'all') { |
| 2719 | 2719 | /* |
| 2720 | 2720 | $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
@@ -2733,7 +2733,7 @@ discard block |
||
| 2733 | 2733 | $query_data = array(':forsource' => $forsource); |
| 2734 | 2734 | } |
| 2735 | 2735 | } else { |
| 2736 | - $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2736 | + $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2737 | 2737 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 2738 | 2738 | AND spotter_output.airline_type = :airline_type |
| 2739 | 2739 | ORDER BY spotter_output.airline_icao ASC"; |
@@ -2746,7 +2746,7 @@ discard block |
||
| 2746 | 2746 | $airline_array = array(); |
| 2747 | 2747 | $temp_array = array(); |
| 2748 | 2748 | |
| 2749 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2749 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2750 | 2750 | { |
| 2751 | 2751 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2752 | 2752 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -2763,10 +2763,10 @@ discard block |
||
| 2763 | 2763 | * @return Array list of alliance names |
| 2764 | 2764 | * |
| 2765 | 2765 | */ |
| 2766 | - public function getAllAllianceNames($forsource = NULL,$filters = array()) |
|
| 2766 | + public function getAllAllianceNames($forsource = NULL, $filters = array()) |
|
| 2767 | 2767 | { |
| 2768 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2769 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2768 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2769 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2770 | 2770 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
| 2771 | 2771 | elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
| 2772 | 2772 | elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
@@ -2794,8 +2794,8 @@ discard block |
||
| 2794 | 2794 | */ |
| 2795 | 2795 | public function getAllAirlineCountries($filters = array()) |
| 2796 | 2796 | { |
| 2797 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2798 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2797 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2798 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2799 | 2799 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2800 | 2800 | ORDER BY spotter_output.airline_country ASC"; |
| 2801 | 2801 | |
@@ -2806,7 +2806,7 @@ discard block |
||
| 2806 | 2806 | $airline_array = array(); |
| 2807 | 2807 | $temp_array = array(); |
| 2808 | 2808 | |
| 2809 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2809 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2810 | 2810 | { |
| 2811 | 2811 | $temp_array['airline_country'] = $row['airline_country']; |
| 2812 | 2812 | |
@@ -2826,9 +2826,9 @@ discard block |
||
| 2826 | 2826 | */ |
| 2827 | 2827 | public function getAllAirportNames($filters = array()) |
| 2828 | 2828 | { |
| 2829 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2829 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2830 | 2830 | $airport_array = array(); |
| 2831 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2831 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2832 | 2832 | FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' |
| 2833 | 2833 | ORDER BY spotter_output.departure_airport_city ASC"; |
| 2834 | 2834 | |
@@ -2837,7 +2837,7 @@ discard block |
||
| 2837 | 2837 | $sth->execute(); |
| 2838 | 2838 | |
| 2839 | 2839 | $temp_array = array(); |
| 2840 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2840 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2841 | 2841 | { |
| 2842 | 2842 | $temp_array['airport_icao'] = $row['airport_icao']; |
| 2843 | 2843 | $temp_array['airport_name'] = $row['airport_name']; |
@@ -2847,14 +2847,14 @@ discard block |
||
| 2847 | 2847 | $airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array; |
| 2848 | 2848 | } |
| 2849 | 2849 | |
| 2850 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2850 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2851 | 2851 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' |
| 2852 | 2852 | ORDER BY spotter_output.arrival_airport_city ASC"; |
| 2853 | 2853 | |
| 2854 | 2854 | $sth = $this->db->prepare($query); |
| 2855 | 2855 | $sth->execute(); |
| 2856 | 2856 | |
| 2857 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2857 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2858 | 2858 | { |
| 2859 | 2859 | // if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao']) |
| 2860 | 2860 | // { |
@@ -2878,8 +2878,8 @@ discard block |
||
| 2878 | 2878 | */ |
| 2879 | 2879 | public function getAllOwnerNames($filters = array()) |
| 2880 | 2880 | { |
| 2881 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2882 | - $query = "SELECT DISTINCT spotter_output.owner_name |
|
| 2881 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2882 | + $query = "SELECT DISTINCT spotter_output.owner_name |
|
| 2883 | 2883 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' |
| 2884 | 2884 | ORDER BY spotter_output.owner_name ASC"; |
| 2885 | 2885 | |
@@ -2896,8 +2896,8 @@ discard block |
||
| 2896 | 2896 | */ |
| 2897 | 2897 | public function getAllPilotNames($filters = array()) |
| 2898 | 2898 | { |
| 2899 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2900 | - $query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id |
|
| 2899 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2900 | + $query = "SELECT DISTINCT spotter_output.pilot_name, spotter_output.pilot_id |
|
| 2901 | 2901 | FROM spotter_output".$filter_query." spotter_output.pilot_name <> '' |
| 2902 | 2902 | ORDER BY spotter_output.pilot_name ASC"; |
| 2903 | 2903 | |
@@ -2930,21 +2930,21 @@ discard block |
||
| 2930 | 2930 | |
| 2931 | 2931 | $temp_array = array(); |
| 2932 | 2932 | |
| 2933 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2933 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2934 | 2934 | { |
| 2935 | 2935 | $temp_array['airport_country'] = $row['airport_country']; |
| 2936 | 2936 | |
| 2937 | 2937 | $airport_array[$row['airport_country']] = $temp_array; |
| 2938 | 2938 | } |
| 2939 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2940 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2939 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2940 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2941 | 2941 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2942 | 2942 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2943 | 2943 | |
| 2944 | 2944 | $sth = $this->db->prepare($query); |
| 2945 | 2945 | $sth->execute(); |
| 2946 | 2946 | |
| 2947 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2947 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2948 | 2948 | { |
| 2949 | 2949 | if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country']) |
| 2950 | 2950 | { |
@@ -2967,9 +2967,9 @@ discard block |
||
| 2967 | 2967 | */ |
| 2968 | 2968 | public function getAllCountries($filters = array()) |
| 2969 | 2969 | { |
| 2970 | - $Connection= new Connection($this->db); |
|
| 2970 | + $Connection = new Connection($this->db); |
|
| 2971 | 2971 | if ($Connection->tableExists('countries')) { |
| 2972 | - $query = "SELECT countries.name AS airport_country |
|
| 2972 | + $query = "SELECT countries.name AS airport_country |
|
| 2973 | 2973 | FROM countries |
| 2974 | 2974 | ORDER BY countries.name ASC"; |
| 2975 | 2975 | $sth = $this->db->prepare($query); |
@@ -2978,14 +2978,14 @@ discard block |
||
| 2978 | 2978 | $temp_array = array(); |
| 2979 | 2979 | $country_array = array(); |
| 2980 | 2980 | |
| 2981 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2981 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2982 | 2982 | { |
| 2983 | 2983 | $temp_array['country'] = $row['airport_country']; |
| 2984 | 2984 | $country_array[$row['airport_country']] = $temp_array; |
| 2985 | 2985 | } |
| 2986 | 2986 | } else { |
| 2987 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2988 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2987 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2988 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2989 | 2989 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' |
| 2990 | 2990 | ORDER BY spotter_output.departure_airport_country ASC"; |
| 2991 | 2991 | |
@@ -2994,20 +2994,20 @@ discard block |
||
| 2994 | 2994 | |
| 2995 | 2995 | $temp_array = array(); |
| 2996 | 2996 | $country_array = array(); |
| 2997 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2997 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2998 | 2998 | { |
| 2999 | 2999 | $temp_array['country'] = $row['airport_country']; |
| 3000 | 3000 | $country_array[$row['airport_country']] = $temp_array; |
| 3001 | 3001 | } |
| 3002 | 3002 | |
| 3003 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 3003 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 3004 | 3004 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 3005 | 3005 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 3006 | 3006 | |
| 3007 | 3007 | $sth = $this->db->prepare($query); |
| 3008 | 3008 | $sth->execute(); |
| 3009 | 3009 | |
| 3010 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3010 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3011 | 3011 | { |
| 3012 | 3012 | if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) |
| 3013 | 3013 | { |
@@ -3017,14 +3017,14 @@ discard block |
||
| 3017 | 3017 | } |
| 3018 | 3018 | } |
| 3019 | 3019 | |
| 3020 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 3020 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 3021 | 3021 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 3022 | 3022 | ORDER BY spotter_output.airline_country ASC"; |
| 3023 | 3023 | |
| 3024 | 3024 | $sth = $this->db->prepare($query); |
| 3025 | 3025 | $sth->execute(); |
| 3026 | 3026 | |
| 3027 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3027 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3028 | 3028 | { |
| 3029 | 3029 | if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) |
| 3030 | 3030 | { |
@@ -3048,8 +3048,8 @@ discard block |
||
| 3048 | 3048 | */ |
| 3049 | 3049 | public function getAllIdents($filters = array()) |
| 3050 | 3050 | { |
| 3051 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3052 | - $query = "SELECT DISTINCT spotter_output.ident |
|
| 3051 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3052 | + $query = "SELECT DISTINCT spotter_output.ident |
|
| 3053 | 3053 | FROM spotter_output".$filter_query." spotter_output.ident <> '' |
| 3054 | 3054 | ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0"; |
| 3055 | 3055 | |
@@ -3059,7 +3059,7 @@ discard block |
||
| 3059 | 3059 | $ident_array = array(); |
| 3060 | 3060 | $temp_array = array(); |
| 3061 | 3061 | |
| 3062 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3062 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3063 | 3063 | { |
| 3064 | 3064 | $temp_array['ident'] = $row['ident']; |
| 3065 | 3065 | $ident_array[] = $temp_array; |
@@ -3073,9 +3073,9 @@ discard block |
||
| 3073 | 3073 | * @return Array number, icao, name and city of airports |
| 3074 | 3074 | */ |
| 3075 | 3075 | |
| 3076 | - public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
|
| 3076 | + public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) { |
|
| 3077 | 3077 | global $globalTimezone, $globalDBdriver; |
| 3078 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3078 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3079 | 3079 | if ($globalTimezone != '') { |
| 3080 | 3080 | date_default_timezone_set($globalTimezone); |
| 3081 | 3081 | $datetime = new DateTime(); |
@@ -3140,7 +3140,7 @@ discard block |
||
| 3140 | 3140 | |
| 3141 | 3141 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 3142 | 3142 | global $globalTimezone, $globalDBdriver; |
| 3143 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3143 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3144 | 3144 | if ($globalTimezone != '') { |
| 3145 | 3145 | date_default_timezone_set($globalTimezone); |
| 3146 | 3146 | $datetime = new DateTime(); |
@@ -3224,7 +3224,7 @@ discard block |
||
| 3224 | 3224 | |
| 3225 | 3225 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 3226 | 3226 | global $globalTimezone, $globalDBdriver; |
| 3227 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3227 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3228 | 3228 | if ($globalTimezone != '') { |
| 3229 | 3229 | date_default_timezone_set($globalTimezone); |
| 3230 | 3230 | $datetime = new DateTime(); |
@@ -3257,9 +3257,9 @@ discard block |
||
| 3257 | 3257 | * @return Array number, icao, name and city of airports |
| 3258 | 3258 | */ |
| 3259 | 3259 | |
| 3260 | - public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
|
| 3260 | + public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) { |
|
| 3261 | 3261 | global $globalTimezone, $globalDBdriver; |
| 3262 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3262 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3263 | 3263 | if ($globalTimezone != '') { |
| 3264 | 3264 | date_default_timezone_set($globalTimezone); |
| 3265 | 3265 | $datetime = new DateTime(); |
@@ -3391,12 +3391,12 @@ discard block |
||
| 3391 | 3391 | } else $offset = '+00:00'; |
| 3392 | 3392 | |
| 3393 | 3393 | if ($globalDBdriver == 'mysql') { |
| 3394 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3394 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3395 | 3395 | FROM spotter_output |
| 3396 | 3396 | WHERE spotter_output.date <> '' |
| 3397 | 3397 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
| 3398 | 3398 | } else { |
| 3399 | - $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3399 | + $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3400 | 3400 | FROM spotter_output |
| 3401 | 3401 | WHERE spotter_output.date <> '' |
| 3402 | 3402 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
@@ -3408,7 +3408,7 @@ discard block |
||
| 3408 | 3408 | $date_array = array(); |
| 3409 | 3409 | $temp_array = array(); |
| 3410 | 3410 | |
| 3411 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3411 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3412 | 3412 | { |
| 3413 | 3413 | $temp_array['date'] = $row['date']; |
| 3414 | 3414 | |
@@ -3428,7 +3428,7 @@ discard block |
||
| 3428 | 3428 | */ |
| 3429 | 3429 | public function getAllRoutes() |
| 3430 | 3430 | { |
| 3431 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
| 3431 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
| 3432 | 3432 | FROM spotter_output |
| 3433 | 3433 | WHERE spotter_output.ident <> '' |
| 3434 | 3434 | GROUP BY route |
@@ -3439,7 +3439,7 @@ discard block |
||
| 3439 | 3439 | |
| 3440 | 3440 | $routes_array = array(); |
| 3441 | 3441 | $temp_array = array(); |
| 3442 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3442 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3443 | 3443 | { |
| 3444 | 3444 | $temp_array['route'] = $row['route']; |
| 3445 | 3445 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -3458,21 +3458,21 @@ discard block |
||
| 3458 | 3458 | * @return String success or false |
| 3459 | 3459 | * |
| 3460 | 3460 | */ |
| 3461 | - public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
|
| 3461 | + public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL) |
|
| 3462 | 3462 | { |
| 3463 | 3463 | if (!is_numeric(substr($ident, 0, 3))) |
| 3464 | 3464 | { |
| 3465 | 3465 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3466 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3466 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3467 | 3467 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3468 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3468 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3469 | 3469 | } else { |
| 3470 | 3470 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3471 | 3471 | } |
| 3472 | 3472 | if (count($airline_array) == 0) { |
| 3473 | 3473 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3474 | 3474 | } |
| 3475 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3475 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3476 | 3476 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3477 | 3477 | } |
| 3478 | 3478 | } else { |
@@ -3485,7 +3485,7 @@ discard block |
||
| 3485 | 3485 | |
| 3486 | 3486 | |
| 3487 | 3487 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
| 3488 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3488 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type); |
|
| 3489 | 3489 | |
| 3490 | 3490 | try { |
| 3491 | 3491 | $sth = $this->db->prepare($query); |
@@ -3506,11 +3506,11 @@ discard block |
||
| 3506 | 3506 | * @return String success or false |
| 3507 | 3507 | * |
| 3508 | 3508 | */ |
| 3509 | - public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
|
| 3509 | + public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '') |
|
| 3510 | 3510 | { |
| 3511 | 3511 | if ($groundspeed == '') $groundspeed = NULL; |
| 3512 | 3512 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3513 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3513 | + $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3514 | 3514 | |
| 3515 | 3515 | try { |
| 3516 | 3516 | $sth = $this->db->prepare($query); |
@@ -3550,7 +3550,7 @@ discard block |
||
| 3550 | 3550 | * @param String $verticalrate vertival rate of flight |
| 3551 | 3551 | * @return String success or false |
| 3552 | 3552 | */ |
| 3553 | - public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
|
| 3553 | + public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '') |
|
| 3554 | 3554 | { |
| 3555 | 3555 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
| 3556 | 3556 | |
@@ -3574,13 +3574,13 @@ discard block |
||
| 3574 | 3574 | if ($ModeS != '') { |
| 3575 | 3575 | $timeelapsed = microtime(true); |
| 3576 | 3576 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3577 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3577 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3578 | 3578 | } else { |
| 3579 | - $myhex = explode('-',$flightaware_id); |
|
| 3579 | + $myhex = explode('-', $flightaware_id); |
|
| 3580 | 3580 | if (count($myhex) > 0) { |
| 3581 | 3581 | $timeelapsed = microtime(true); |
| 3582 | 3582 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3583 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3583 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3584 | 3584 | } |
| 3585 | 3585 | } |
| 3586 | 3586 | } |
@@ -3602,24 +3602,24 @@ discard block |
||
| 3602 | 3602 | { |
| 3603 | 3603 | $timeelapsed = microtime(true); |
| 3604 | 3604 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3605 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3605 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3606 | 3606 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3607 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3607 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3608 | 3608 | } else { |
| 3609 | 3609 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3610 | 3610 | } |
| 3611 | 3611 | if (count($airline_array) == 0) { |
| 3612 | 3612 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3613 | 3613 | } |
| 3614 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3614 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3615 | 3615 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3616 | 3616 | } |
| 3617 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3617 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3618 | 3618 | |
| 3619 | 3619 | } else { |
| 3620 | 3620 | $timeelapsed = microtime(true); |
| 3621 | 3621 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3622 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3622 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3623 | 3623 | } |
| 3624 | 3624 | } |
| 3625 | 3625 | } else $airline_array = array(); |
@@ -3636,27 +3636,27 @@ discard block |
||
| 3636 | 3636 | { |
| 3637 | 3637 | $timeelapsed = microtime(true); |
| 3638 | 3638 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3639 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3639 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3640 | 3640 | } else { |
| 3641 | 3641 | $timeelapsed = microtime(true); |
| 3642 | 3642 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3643 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3643 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3644 | 3644 | } |
| 3645 | 3645 | } |
| 3646 | 3646 | } else { |
| 3647 | 3647 | if ($ModeS != '') { |
| 3648 | 3648 | $timeelapsed = microtime(true); |
| 3649 | 3649 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3650 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3650 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3651 | 3651 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3652 | 3652 | { |
| 3653 | 3653 | $timeelapsed = microtime(true); |
| 3654 | 3654 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3655 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3655 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3656 | 3656 | } else { |
| 3657 | 3657 | $timeelapsed = microtime(true); |
| 3658 | 3658 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3659 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3659 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3660 | 3660 | } |
| 3661 | 3661 | } |
| 3662 | 3662 | } |
@@ -3672,7 +3672,7 @@ discard block |
||
| 3672 | 3672 | } else { |
| 3673 | 3673 | $timeelapsed = microtime(true); |
| 3674 | 3674 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3675 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3675 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3676 | 3676 | } |
| 3677 | 3677 | } |
| 3678 | 3678 | |
@@ -3687,7 +3687,7 @@ discard block |
||
| 3687 | 3687 | } else { |
| 3688 | 3688 | $timeelapsed = microtime(true); |
| 3689 | 3689 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3690 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3690 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3691 | 3691 | } |
| 3692 | 3692 | } |
| 3693 | 3693 | |
@@ -3740,7 +3740,7 @@ discard block |
||
| 3740 | 3740 | } |
| 3741 | 3741 | |
| 3742 | 3742 | |
| 3743 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
| 3743 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
| 3744 | 3744 | { |
| 3745 | 3745 | $date = date("Y-m-d H:i:s", time()); |
| 3746 | 3746 | } |
@@ -3750,7 +3750,7 @@ discard block |
||
| 3750 | 3750 | { |
| 3751 | 3751 | $timeelapsed = microtime(true); |
| 3752 | 3752 | $image_array = $Image->getSpotterImage($registration); |
| 3753 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3753 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3754 | 3754 | if (!isset($image_array[0]['registration'])) |
| 3755 | 3755 | { |
| 3756 | 3756 | //echo "Add image !!!! \n"; |
@@ -3758,7 +3758,7 @@ discard block |
||
| 3758 | 3758 | } |
| 3759 | 3759 | $timeelapsed = microtime(true); |
| 3760 | 3760 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3761 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3761 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3762 | 3762 | if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
| 3763 | 3763 | } |
| 3764 | 3764 | |
@@ -3766,33 +3766,33 @@ discard block |
||
| 3766 | 3766 | { |
| 3767 | 3767 | if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
| 3768 | 3768 | else $airline_icao = ''; |
| 3769 | - $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3769 | + $image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3770 | 3770 | if (!isset($image_array[0]['registration'])) |
| 3771 | 3771 | { |
| 3772 | 3772 | //echo "Add image !!!! \n"; |
| 3773 | - $Image->addSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3773 | + $Image->addSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3774 | 3774 | } |
| 3775 | 3775 | } |
| 3776 | 3776 | |
| 3777 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 3778 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 3779 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 3780 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3781 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3782 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3783 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3784 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3785 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 3786 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3787 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 3788 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3789 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 3790 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 3791 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 3792 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 3793 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 3794 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 3795 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 3777 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 3778 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 3779 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 3780 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3781 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3782 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3783 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3784 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3785 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 3786 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3787 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 3788 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3789 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 3790 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 3791 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 3792 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 3793 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 3794 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 3795 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 3796 | 3796 | |
| 3797 | 3797 | if (count($airline_array) == 0) |
| 3798 | 3798 | { |
@@ -3820,7 +3820,7 @@ discard block |
||
| 3820 | 3820 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 3821 | 3821 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 3822 | 3822 | if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
| 3823 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3823 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3824 | 3824 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3825 | 3825 | |
| 3826 | 3826 | $airline_name = $airline_array[0]['name']; |
@@ -3830,7 +3830,7 @@ discard block |
||
| 3830 | 3830 | if ($airline_type == '') { |
| 3831 | 3831 | $timeelapsed = microtime(true); |
| 3832 | 3832 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3833 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3833 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3834 | 3834 | } |
| 3835 | 3835 | if ($airline_type == null) $airline_type = ''; |
| 3836 | 3836 | $aircraft_type = $aircraft_array[0]['type']; |
@@ -3842,7 +3842,7 @@ discard block |
||
| 3842 | 3842 | $arrival_airport_name = $arrival_airport_array[0]['name']; |
| 3843 | 3843 | $arrival_airport_city = $arrival_airport_array[0]['city']; |
| 3844 | 3844 | $arrival_airport_country = $arrival_airport_array[0]['country']; |
| 3845 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3845 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3846 | 3846 | |
| 3847 | 3847 | try { |
| 3848 | 3848 | |
@@ -3868,13 +3868,13 @@ discard block |
||
| 3868 | 3868 | { |
| 3869 | 3869 | global $globalDBdriver, $globalTimezone; |
| 3870 | 3870 | if ($globalDBdriver == 'mysql') { |
| 3871 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3871 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3872 | 3872 | WHERE spotter_output.ident = :ident |
| 3873 | 3873 | AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 3874 | 3874 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3875 | 3875 | $query_data = array(':ident' => $ident); |
| 3876 | 3876 | } else { |
| 3877 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3877 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3878 | 3878 | WHERE spotter_output.ident = :ident |
| 3879 | 3879 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3880 | 3880 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -3883,8 +3883,8 @@ discard block |
||
| 3883 | 3883 | |
| 3884 | 3884 | $sth = $this->db->prepare($query); |
| 3885 | 3885 | $sth->execute($query_data); |
| 3886 | - $ident_result=''; |
|
| 3887 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3886 | + $ident_result = ''; |
|
| 3887 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3888 | 3888 | { |
| 3889 | 3889 | $ident_result = $row['ident']; |
| 3890 | 3890 | } |
@@ -3910,8 +3910,8 @@ discard block |
||
| 3910 | 3910 | return false; |
| 3911 | 3911 | } else { |
| 3912 | 3912 | $q_array = explode(" ", $q); |
| 3913 | - foreach ($q_array as $q_item){ |
|
| 3914 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 3913 | + foreach ($q_array as $q_item) { |
|
| 3914 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 3915 | 3915 | $additional_query .= " AND ("; |
| 3916 | 3916 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 3917 | 3917 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
@@ -3926,11 +3926,11 @@ discard block |
||
| 3926 | 3926 | } |
| 3927 | 3927 | } |
| 3928 | 3928 | if ($globalDBdriver == 'mysql') { |
| 3929 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3929 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3930 | 3930 | WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 3931 | 3931 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3932 | 3932 | } else { |
| 3933 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3933 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3934 | 3934 | WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 3935 | 3935 | AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 3936 | 3936 | } |
@@ -3947,11 +3947,11 @@ discard block |
||
| 3947 | 3947 | * @return Array the airline list |
| 3948 | 3948 | * |
| 3949 | 3949 | */ |
| 3950 | - public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '') |
|
| 3950 | + public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 3951 | 3951 | { |
| 3952 | 3952 | global $globalDBdriver; |
| 3953 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3954 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3953 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3954 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3955 | 3955 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA'"; |
| 3956 | 3956 | if ($olderthanmonths > 0) { |
| 3957 | 3957 | if ($globalDBdriver == 'mysql') { |
@@ -3971,28 +3971,28 @@ discard block |
||
| 3971 | 3971 | if ($year != '') { |
| 3972 | 3972 | if ($globalDBdriver == 'mysql') { |
| 3973 | 3973 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 3974 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 3974 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 3975 | 3975 | } else { |
| 3976 | 3976 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 3977 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 3977 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 3978 | 3978 | } |
| 3979 | 3979 | } |
| 3980 | 3980 | if ($month != '') { |
| 3981 | 3981 | if ($globalDBdriver == 'mysql') { |
| 3982 | 3982 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 3983 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 3983 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 3984 | 3984 | } else { |
| 3985 | 3985 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 3986 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 3986 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 3987 | 3987 | } |
| 3988 | 3988 | } |
| 3989 | 3989 | if ($day != '') { |
| 3990 | 3990 | if ($globalDBdriver == 'mysql') { |
| 3991 | 3991 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 3992 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 3992 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 3993 | 3993 | } else { |
| 3994 | 3994 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 3995 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 3995 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 3996 | 3996 | } |
| 3997 | 3997 | } |
| 3998 | 3998 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
@@ -4002,7 +4002,7 @@ discard block |
||
| 4002 | 4002 | $sth->execute($query_values); |
| 4003 | 4003 | $airline_array = array(); |
| 4004 | 4004 | $temp_array = array(); |
| 4005 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4005 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4006 | 4006 | { |
| 4007 | 4007 | $temp_array['airline_name'] = $row['airline_name']; |
| 4008 | 4008 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4019,11 +4019,11 @@ discard block |
||
| 4019 | 4019 | * @return Array the pilots list |
| 4020 | 4020 | * |
| 4021 | 4021 | */ |
| 4022 | - public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '') |
|
| 4022 | + public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 4023 | 4023 | { |
| 4024 | 4024 | global $globalDBdriver; |
| 4025 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4026 | - $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 4025 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4026 | + $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 4027 | 4027 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
| 4028 | 4028 | if ($olderthanmonths > 0) { |
| 4029 | 4029 | if ($globalDBdriver == 'mysql') { |
@@ -4043,28 +4043,28 @@ discard block |
||
| 4043 | 4043 | if ($year != '') { |
| 4044 | 4044 | if ($globalDBdriver == 'mysql') { |
| 4045 | 4045 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4046 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4046 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4047 | 4047 | } else { |
| 4048 | 4048 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4049 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4049 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4050 | 4050 | } |
| 4051 | 4051 | } |
| 4052 | 4052 | if ($month != '') { |
| 4053 | 4053 | if ($globalDBdriver == 'mysql') { |
| 4054 | 4054 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4055 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4055 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4056 | 4056 | } else { |
| 4057 | 4057 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4058 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4058 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4059 | 4059 | } |
| 4060 | 4060 | } |
| 4061 | 4061 | if ($day != '') { |
| 4062 | 4062 | if ($globalDBdriver == 'mysql') { |
| 4063 | 4063 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4064 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4064 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4065 | 4065 | } else { |
| 4066 | 4066 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4067 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4067 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4068 | 4068 | } |
| 4069 | 4069 | } |
| 4070 | 4070 | |
@@ -4076,7 +4076,7 @@ discard block |
||
| 4076 | 4076 | $sth->execute($query_values); |
| 4077 | 4077 | $airline_array = array(); |
| 4078 | 4078 | $temp_array = array(); |
| 4079 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4079 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4080 | 4080 | { |
| 4081 | 4081 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 4082 | 4082 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -4096,7 +4096,7 @@ discard block |
||
| 4096 | 4096 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 4097 | 4097 | { |
| 4098 | 4098 | global $globalDBdriver; |
| 4099 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 4099 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 4100 | 4100 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 4101 | 4101 | if ($olderthanmonths > 0) { |
| 4102 | 4102 | if ($globalDBdriver == 'mysql') { |
@@ -4122,7 +4122,7 @@ discard block |
||
| 4122 | 4122 | $airline_array = array(); |
| 4123 | 4123 | $temp_array = array(); |
| 4124 | 4124 | |
| 4125 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4125 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4126 | 4126 | { |
| 4127 | 4127 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 4128 | 4128 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -4140,11 +4140,11 @@ discard block |
||
| 4140 | 4140 | * @return Array the pilots list |
| 4141 | 4141 | * |
| 4142 | 4142 | */ |
| 4143 | - public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 4143 | + public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 4144 | 4144 | { |
| 4145 | 4145 | global $globalDBdriver; |
| 4146 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4147 | - $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4146 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4147 | + $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4148 | 4148 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL"; |
| 4149 | 4149 | if ($olderthanmonths > 0) { |
| 4150 | 4150 | if ($globalDBdriver == 'mysql') { |
@@ -4164,28 +4164,28 @@ discard block |
||
| 4164 | 4164 | if ($year != '') { |
| 4165 | 4165 | if ($globalDBdriver == 'mysql') { |
| 4166 | 4166 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4167 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4167 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4168 | 4168 | } else { |
| 4169 | 4169 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4170 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4170 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4171 | 4171 | } |
| 4172 | 4172 | } |
| 4173 | 4173 | if ($month != '') { |
| 4174 | 4174 | if ($globalDBdriver == 'mysql') { |
| 4175 | 4175 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4176 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4176 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4177 | 4177 | } else { |
| 4178 | 4178 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4179 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4179 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4180 | 4180 | } |
| 4181 | 4181 | } |
| 4182 | 4182 | if ($day != '') { |
| 4183 | 4183 | if ($globalDBdriver == 'mysql') { |
| 4184 | 4184 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4185 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4185 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4186 | 4186 | } else { |
| 4187 | 4187 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4188 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4188 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4189 | 4189 | } |
| 4190 | 4190 | } |
| 4191 | 4191 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
@@ -4195,7 +4195,7 @@ discard block |
||
| 4195 | 4195 | $sth->execute($query_values); |
| 4196 | 4196 | $airline_array = array(); |
| 4197 | 4197 | $temp_array = array(); |
| 4198 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4198 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4199 | 4199 | { |
| 4200 | 4200 | $temp_array['owner_name'] = $row['owner_name']; |
| 4201 | 4201 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -4210,11 +4210,11 @@ discard block |
||
| 4210 | 4210 | * @return Array the pilots list |
| 4211 | 4211 | * |
| 4212 | 4212 | */ |
| 4213 | - public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 4213 | + public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4214 | 4214 | { |
| 4215 | 4215 | global $globalDBdriver; |
| 4216 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4217 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4216 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4217 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 4218 | 4218 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 4219 | 4219 | if ($olderthanmonths > 0) { |
| 4220 | 4220 | if ($globalDBdriver == 'mysql') { |
@@ -4240,7 +4240,7 @@ discard block |
||
| 4240 | 4240 | $airline_array = array(); |
| 4241 | 4241 | $temp_array = array(); |
| 4242 | 4242 | |
| 4243 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4243 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4244 | 4244 | { |
| 4245 | 4245 | $temp_array['owner_name'] = $row['owner_name']; |
| 4246 | 4246 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -4256,11 +4256,11 @@ discard block |
||
| 4256 | 4256 | * @return Array the airline list |
| 4257 | 4257 | * |
| 4258 | 4258 | */ |
| 4259 | - public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
|
| 4259 | + public function countAllAirlinesByAircraft($aircraft_icao, $filters = array()) |
|
| 4260 | 4260 | { |
| 4261 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4262 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4263 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4261 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4262 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4263 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4264 | 4264 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4265 | 4265 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4266 | 4266 | ORDER BY airline_count DESC"; |
@@ -4272,7 +4272,7 @@ discard block |
||
| 4272 | 4272 | $airline_array = array(); |
| 4273 | 4273 | $temp_array = array(); |
| 4274 | 4274 | |
| 4275 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4275 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4276 | 4276 | { |
| 4277 | 4277 | $temp_array['airline_name'] = $row['airline_name']; |
| 4278 | 4278 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4292,11 +4292,11 @@ discard block |
||
| 4292 | 4292 | * @return Array the airline country list |
| 4293 | 4293 | * |
| 4294 | 4294 | */ |
| 4295 | - public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 4295 | + public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 4296 | 4296 | { |
| 4297 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4298 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4299 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4297 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4298 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4299 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4300 | 4300 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4301 | 4301 | GROUP BY spotter_output.airline_country |
| 4302 | 4302 | ORDER BY airline_country_count DESC |
@@ -4309,7 +4309,7 @@ discard block |
||
| 4309 | 4309 | $airline_country_array = array(); |
| 4310 | 4310 | $temp_array = array(); |
| 4311 | 4311 | |
| 4312 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4312 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4313 | 4313 | { |
| 4314 | 4314 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4315 | 4315 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4328,11 +4328,11 @@ discard block |
||
| 4328 | 4328 | * @return Array the airline list |
| 4329 | 4329 | * |
| 4330 | 4330 | */ |
| 4331 | - public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
|
| 4331 | + public function countAllAirlinesByAirport($airport_icao, $filters = array()) |
|
| 4332 | 4332 | { |
| 4333 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4334 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4335 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4333 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4334 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4335 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4336 | 4336 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 4337 | 4337 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4338 | 4338 | ORDER BY airline_count DESC"; |
@@ -4344,7 +4344,7 @@ discard block |
||
| 4344 | 4344 | $airline_array = array(); |
| 4345 | 4345 | $temp_array = array(); |
| 4346 | 4346 | |
| 4347 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4347 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4348 | 4348 | { |
| 4349 | 4349 | $temp_array['airline_name'] = $row['airline_name']; |
| 4350 | 4350 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4363,11 +4363,11 @@ discard block |
||
| 4363 | 4363 | * @return Array the airline country list |
| 4364 | 4364 | * |
| 4365 | 4365 | */ |
| 4366 | - public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
|
| 4366 | + public function countAllAirlineCountriesByAirport($airport_icao, $filters = array()) |
|
| 4367 | 4367 | { |
| 4368 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4369 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4370 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4368 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4369 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4370 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4371 | 4371 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 4372 | 4372 | GROUP BY spotter_output.airline_country |
| 4373 | 4373 | ORDER BY airline_country_count DESC |
@@ -4380,7 +4380,7 @@ discard block |
||
| 4380 | 4380 | $airline_country_array = array(); |
| 4381 | 4381 | $temp_array = array(); |
| 4382 | 4382 | |
| 4383 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4383 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4384 | 4384 | { |
| 4385 | 4385 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4386 | 4386 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4397,11 +4397,11 @@ discard block |
||
| 4397 | 4397 | * @return Array the airline list |
| 4398 | 4398 | * |
| 4399 | 4399 | */ |
| 4400 | - public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4400 | + public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4401 | 4401 | { |
| 4402 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4403 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4404 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4402 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4403 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4404 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4405 | 4405 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4406 | 4406 | GROUP BY spotter_output.airline_name |
| 4407 | 4407 | ORDER BY airline_count DESC"; |
@@ -4412,7 +4412,7 @@ discard block |
||
| 4412 | 4412 | $airline_array = array(); |
| 4413 | 4413 | $temp_array = array(); |
| 4414 | 4414 | |
| 4415 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4415 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4416 | 4416 | { |
| 4417 | 4417 | $temp_array['airline_name'] = $row['airline_name']; |
| 4418 | 4418 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4432,11 +4432,11 @@ discard block |
||
| 4432 | 4432 | * @return Array the airline country list |
| 4433 | 4433 | * |
| 4434 | 4434 | */ |
| 4435 | - public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4435 | + public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4436 | 4436 | { |
| 4437 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4438 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4439 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4437 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4438 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4439 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4440 | 4440 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4441 | 4441 | GROUP BY spotter_output.airline_country |
| 4442 | 4442 | ORDER BY airline_country_count DESC |
@@ -4449,7 +4449,7 @@ discard block |
||
| 4449 | 4449 | $airline_country_array = array(); |
| 4450 | 4450 | $temp_array = array(); |
| 4451 | 4451 | |
| 4452 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4452 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4453 | 4453 | { |
| 4454 | 4454 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4455 | 4455 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4465,11 +4465,11 @@ discard block |
||
| 4465 | 4465 | * @return Array the airline list |
| 4466 | 4466 | * |
| 4467 | 4467 | */ |
| 4468 | - public function countAllAirlinesByDate($date,$filters = array()) |
|
| 4468 | + public function countAllAirlinesByDate($date, $filters = array()) |
|
| 4469 | 4469 | { |
| 4470 | 4470 | global $globalTimezone, $globalDBdriver; |
| 4471 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4472 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4471 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4472 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4473 | 4473 | if ($globalTimezone != '') { |
| 4474 | 4474 | date_default_timezone_set($globalTimezone); |
| 4475 | 4475 | $datetime = new DateTime($date); |
@@ -4477,12 +4477,12 @@ discard block |
||
| 4477 | 4477 | } else $offset = '+00:00'; |
| 4478 | 4478 | |
| 4479 | 4479 | if ($globalDBdriver == 'mysql') { |
| 4480 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4480 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4481 | 4481 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4482 | 4482 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4483 | 4483 | ORDER BY airline_count DESC"; |
| 4484 | 4484 | } else { |
| 4485 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4485 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4486 | 4486 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4487 | 4487 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4488 | 4488 | ORDER BY airline_count DESC"; |
@@ -4493,7 +4493,7 @@ discard block |
||
| 4493 | 4493 | |
| 4494 | 4494 | $airline_array = array(); |
| 4495 | 4495 | $temp_array = array(); |
| 4496 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4496 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4497 | 4497 | { |
| 4498 | 4498 | $temp_array['airline_name'] = $row['airline_name']; |
| 4499 | 4499 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4513,11 +4513,11 @@ discard block |
||
| 4513 | 4513 | * @return Array the airline country list |
| 4514 | 4514 | * |
| 4515 | 4515 | */ |
| 4516 | - public function countAllAirlineCountriesByDate($date,$filters = array()) |
|
| 4516 | + public function countAllAirlineCountriesByDate($date, $filters = array()) |
|
| 4517 | 4517 | { |
| 4518 | 4518 | global $globalTimezone, $globalDBdriver; |
| 4519 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4520 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4519 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4520 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4521 | 4521 | if ($globalTimezone != '') { |
| 4522 | 4522 | date_default_timezone_set($globalTimezone); |
| 4523 | 4523 | $datetime = new DateTime($date); |
@@ -4525,13 +4525,13 @@ discard block |
||
| 4525 | 4525 | } else $offset = '+00:00'; |
| 4526 | 4526 | |
| 4527 | 4527 | if ($globalDBdriver == 'mysql') { |
| 4528 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4528 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4529 | 4529 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4530 | 4530 | GROUP BY spotter_output.airline_country |
| 4531 | 4531 | ORDER BY airline_country_count DESC |
| 4532 | 4532 | LIMIT 10 OFFSET 0"; |
| 4533 | 4533 | } else { |
| 4534 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4534 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4535 | 4535 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4536 | 4536 | GROUP BY spotter_output.airline_country |
| 4537 | 4537 | ORDER BY airline_country_count DESC |
@@ -4543,7 +4543,7 @@ discard block |
||
| 4543 | 4543 | |
| 4544 | 4544 | $airline_country_array = array(); |
| 4545 | 4545 | $temp_array = array(); |
| 4546 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4546 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4547 | 4547 | { |
| 4548 | 4548 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4549 | 4549 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4560,11 +4560,11 @@ discard block |
||
| 4560 | 4560 | * @return Array the airline list |
| 4561 | 4561 | * |
| 4562 | 4562 | */ |
| 4563 | - public function countAllAirlinesByIdent($ident,$filters = array()) |
|
| 4563 | + public function countAllAirlinesByIdent($ident, $filters = array()) |
|
| 4564 | 4564 | { |
| 4565 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 4566 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4567 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4565 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 4566 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4567 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4568 | 4568 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 4569 | 4569 | GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country |
| 4570 | 4570 | ORDER BY airline_count DESC"; |
@@ -4581,11 +4581,11 @@ discard block |
||
| 4581 | 4581 | * @return Array the airline list |
| 4582 | 4582 | * |
| 4583 | 4583 | */ |
| 4584 | - public function countAllAirlinesByOwner($owner,$filters = array()) |
|
| 4584 | + public function countAllAirlinesByOwner($owner, $filters = array()) |
|
| 4585 | 4585 | { |
| 4586 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 4587 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4588 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4586 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 4587 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4588 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4589 | 4589 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner |
| 4590 | 4590 | GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country |
| 4591 | 4591 | ORDER BY airline_count DESC"; |
@@ -4602,16 +4602,16 @@ discard block |
||
| 4602 | 4602 | * @return String Duration of all flights |
| 4603 | 4603 | * |
| 4604 | 4604 | */ |
| 4605 | - public function getFlightDurationByOwner($owner,$filters = array()) |
|
| 4605 | + public function getFlightDurationByOwner($owner, $filters = array()) |
|
| 4606 | 4606 | { |
| 4607 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 4608 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4609 | - $query = "SELECT SUM(last_seen - date) AS duration |
|
| 4607 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 4608 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4609 | + $query = "SELECT SUM(last_seen - date) AS duration |
|
| 4610 | 4610 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner"; |
| 4611 | 4611 | $sth = $this->db->prepare($query); |
| 4612 | 4612 | $sth->execute(array(':owner' => $owner)); |
| 4613 | 4613 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4614 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4614 | + if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']); |
|
| 4615 | 4615 | else return $result[0]['duration']; |
| 4616 | 4616 | } |
| 4617 | 4617 | |
@@ -4621,16 +4621,16 @@ discard block |
||
| 4621 | 4621 | * @return String Duration of all flights |
| 4622 | 4622 | * |
| 4623 | 4623 | */ |
| 4624 | - public function getFlightDurationByPilot($pilot,$filters = array()) |
|
| 4624 | + public function getFlightDurationByPilot($pilot, $filters = array()) |
|
| 4625 | 4625 | { |
| 4626 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 4627 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4628 | - $query = "SELECT SUM(last_seen - date) AS duration |
|
| 4626 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 4627 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4628 | + $query = "SELECT SUM(last_seen - date) AS duration |
|
| 4629 | 4629 | FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot)"; |
| 4630 | 4630 | $sth = $this->db->prepare($query); |
| 4631 | 4631 | $sth->execute(array(':pilot' => $pilot)); |
| 4632 | 4632 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 4633 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
| 4633 | + if (is_int($result[0]['duration'])) return gmdate('H:i:s', $result[0]['duration']); |
|
| 4634 | 4634 | else return $result[0]['duration']; |
| 4635 | 4635 | } |
| 4636 | 4636 | |
@@ -4640,11 +4640,11 @@ discard block |
||
| 4640 | 4640 | * @return Array the airline list |
| 4641 | 4641 | * |
| 4642 | 4642 | */ |
| 4643 | - public function countAllAirlinesByPilot($pilot,$filters = array()) |
|
| 4643 | + public function countAllAirlinesByPilot($pilot, $filters = array()) |
|
| 4644 | 4644 | { |
| 4645 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 4646 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4647 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4645 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 4646 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4647 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4648 | 4648 | FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 4649 | 4649 | GROUP BY spotter_output.airline_icao, spotter_output.airline_name, spotter_output.airline_country |
| 4650 | 4650 | ORDER BY airline_count DESC"; |
@@ -4661,25 +4661,25 @@ discard block |
||
| 4661 | 4661 | * @return Array the airline list |
| 4662 | 4662 | * |
| 4663 | 4663 | */ |
| 4664 | - public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 4664 | + public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4665 | 4665 | { |
| 4666 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4667 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4668 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4666 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4667 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4668 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4669 | 4669 | |
| 4670 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4670 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4671 | 4671 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4672 | 4672 | GROUP BY spotter_output.airline_name |
| 4673 | 4673 | ORDER BY airline_count DESC"; |
| 4674 | 4674 | |
| 4675 | 4675 | |
| 4676 | 4676 | $sth = $this->db->prepare($query); |
| 4677 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4677 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4678 | 4678 | |
| 4679 | 4679 | $airline_array = array(); |
| 4680 | 4680 | $temp_array = array(); |
| 4681 | 4681 | |
| 4682 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4682 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4683 | 4683 | { |
| 4684 | 4684 | $temp_array['airline_name'] = $row['airline_name']; |
| 4685 | 4685 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4697,13 +4697,13 @@ discard block |
||
| 4697 | 4697 | * @return Array the airline country list |
| 4698 | 4698 | * |
| 4699 | 4699 | */ |
| 4700 | - public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
|
| 4700 | + public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4701 | 4701 | { |
| 4702 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4703 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4704 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4702 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4703 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4704 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4705 | 4705 | |
| 4706 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4706 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4707 | 4707 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4708 | 4708 | GROUP BY spotter_output.airline_country |
| 4709 | 4709 | ORDER BY airline_country_count DESC |
@@ -4711,11 +4711,11 @@ discard block |
||
| 4711 | 4711 | |
| 4712 | 4712 | |
| 4713 | 4713 | $sth = $this->db->prepare($query); |
| 4714 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4714 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4715 | 4715 | |
| 4716 | 4716 | $airline_country_array = array(); |
| 4717 | 4717 | $temp_array = array(); |
| 4718 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4718 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4719 | 4719 | { |
| 4720 | 4720 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4721 | 4721 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4733,11 +4733,11 @@ discard block |
||
| 4733 | 4733 | * @return Array the airline list |
| 4734 | 4734 | * |
| 4735 | 4735 | */ |
| 4736 | - public function countAllAirlinesByCountry($country,$filters = array()) |
|
| 4736 | + public function countAllAirlinesByCountry($country, $filters = array()) |
|
| 4737 | 4737 | { |
| 4738 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4739 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4740 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4738 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4739 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4740 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4741 | 4741 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4742 | 4742 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4743 | 4743 | ORDER BY airline_count DESC"; |
@@ -4748,7 +4748,7 @@ discard block |
||
| 4748 | 4748 | |
| 4749 | 4749 | $airline_array = array(); |
| 4750 | 4750 | $temp_array = array(); |
| 4751 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4751 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4752 | 4752 | { |
| 4753 | 4753 | $temp_array['airline_name'] = $row['airline_name']; |
| 4754 | 4754 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4767,11 +4767,11 @@ discard block |
||
| 4767 | 4767 | * @return Array the airline country list |
| 4768 | 4768 | * |
| 4769 | 4769 | */ |
| 4770 | - public function countAllAirlineCountriesByCountry($country,$filters = array()) |
|
| 4770 | + public function countAllAirlineCountriesByCountry($country, $filters = array()) |
|
| 4771 | 4771 | { |
| 4772 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4773 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4774 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4772 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4773 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4774 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4775 | 4775 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4776 | 4776 | GROUP BY spotter_output.airline_country |
| 4777 | 4777 | ORDER BY airline_country_count DESC |
@@ -4783,7 +4783,7 @@ discard block |
||
| 4783 | 4783 | |
| 4784 | 4784 | $airline_country_array = array(); |
| 4785 | 4785 | $temp_array = array(); |
| 4786 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4786 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4787 | 4787 | { |
| 4788 | 4788 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4789 | 4789 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4803,35 +4803,35 @@ discard block |
||
| 4803 | 4803 | public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
| 4804 | 4804 | { |
| 4805 | 4805 | global $globalDBdriver; |
| 4806 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4807 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4806 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4807 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4808 | 4808 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA'"; |
| 4809 | 4809 | $query_values = array(); |
| 4810 | 4810 | if ($year != '') { |
| 4811 | 4811 | if ($globalDBdriver == 'mysql') { |
| 4812 | 4812 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4813 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4813 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4814 | 4814 | } else { |
| 4815 | 4815 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4816 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4816 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4817 | 4817 | } |
| 4818 | 4818 | } |
| 4819 | 4819 | if ($month != '') { |
| 4820 | 4820 | if ($globalDBdriver == 'mysql') { |
| 4821 | 4821 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4822 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4822 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4823 | 4823 | } else { |
| 4824 | 4824 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4825 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4825 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4826 | 4826 | } |
| 4827 | 4827 | } |
| 4828 | 4828 | if ($day != '') { |
| 4829 | 4829 | if ($globalDBdriver == 'mysql') { |
| 4830 | 4830 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4831 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4831 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4832 | 4832 | } else { |
| 4833 | 4833 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4834 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4834 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4835 | 4835 | } |
| 4836 | 4836 | } |
| 4837 | 4837 | $query .= " GROUP BY spotter_output.airline_country |
@@ -4843,7 +4843,7 @@ discard block |
||
| 4843 | 4843 | |
| 4844 | 4844 | $airline_array = array(); |
| 4845 | 4845 | $temp_array = array(); |
| 4846 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4846 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4847 | 4847 | { |
| 4848 | 4848 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4849 | 4849 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4859,11 +4859,11 @@ discard block |
||
| 4859 | 4859 | * @return Array the airline country list |
| 4860 | 4860 | * |
| 4861 | 4861 | */ |
| 4862 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4862 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4863 | 4863 | { |
| 4864 | 4864 | global $globalDBdriver; |
| 4865 | 4865 | //$filter_query = $this->getFilter($filters,true,true); |
| 4866 | - $Connection= new Connection($this->db); |
|
| 4866 | + $Connection = new Connection($this->db); |
|
| 4867 | 4867 | if (!$Connection->tableExists('countries')) return array(); |
| 4868 | 4868 | /* |
| 4869 | 4869 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -4878,7 +4878,7 @@ discard block |
||
| 4878 | 4878 | */ |
| 4879 | 4879 | require_once('class.SpotterLive.php'); |
| 4880 | 4880 | $SpotterLive = new SpotterLive(); |
| 4881 | - $filter_query = $SpotterLive->getFilter($filters,true,true); |
|
| 4881 | + $filter_query = $SpotterLive->getFilter($filters, true, true); |
|
| 4882 | 4882 | $filter_query .= ' over_country IS NOT NULL'; |
| 4883 | 4883 | if ($olderthanmonths > 0) { |
| 4884 | 4884 | if ($globalDBdriver == 'mysql') { |
@@ -4905,7 +4905,7 @@ discard block |
||
| 4905 | 4905 | $flight_array = array(); |
| 4906 | 4906 | $temp_array = array(); |
| 4907 | 4907 | |
| 4908 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4908 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4909 | 4909 | { |
| 4910 | 4910 | $temp_array['flight_count'] = $row['nb']; |
| 4911 | 4911 | $temp_array['flight_country'] = $row['name']; |
@@ -4923,11 +4923,11 @@ discard block |
||
| 4923 | 4923 | * @return Array the aircraft list |
| 4924 | 4924 | * |
| 4925 | 4925 | */ |
| 4926 | - public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 4926 | + public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 4927 | 4927 | { |
| 4928 | 4928 | global $globalDBdriver; |
| 4929 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4930 | - $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4929 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4930 | + $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4931 | 4931 | FROM spotter_output ".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> ''"; |
| 4932 | 4932 | if ($olderthanmonths > 0) { |
| 4933 | 4933 | if ($globalDBdriver == 'mysql') { |
@@ -4947,28 +4947,28 @@ discard block |
||
| 4947 | 4947 | if ($year != '') { |
| 4948 | 4948 | if ($globalDBdriver == 'mysql') { |
| 4949 | 4949 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 4950 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4950 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4951 | 4951 | } else { |
| 4952 | 4952 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 4953 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 4953 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 4954 | 4954 | } |
| 4955 | 4955 | } |
| 4956 | 4956 | if ($month != '') { |
| 4957 | 4957 | if ($globalDBdriver == 'mysql') { |
| 4958 | 4958 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 4959 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4959 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4960 | 4960 | } else { |
| 4961 | 4961 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 4962 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 4962 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 4963 | 4963 | } |
| 4964 | 4964 | } |
| 4965 | 4965 | if ($day != '') { |
| 4966 | 4966 | if ($globalDBdriver == 'mysql') { |
| 4967 | 4967 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 4968 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4968 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4969 | 4969 | } else { |
| 4970 | 4970 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 4971 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 4971 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 4972 | 4972 | } |
| 4973 | 4973 | } |
| 4974 | 4974 | |
@@ -4980,7 +4980,7 @@ discard block |
||
| 4980 | 4980 | |
| 4981 | 4981 | $aircraft_array = array(); |
| 4982 | 4982 | $temp_array = array(); |
| 4983 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4983 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4984 | 4984 | { |
| 4985 | 4985 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4986 | 4986 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4997,11 +4997,11 @@ discard block |
||
| 4997 | 4997 | * @return Array the aircraft list |
| 4998 | 4998 | * |
| 4999 | 4999 | */ |
| 5000 | - public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '') |
|
| 5000 | + public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 5001 | 5001 | { |
| 5002 | 5002 | global $globalDBdriver; |
| 5003 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5004 | - $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 5003 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5004 | + $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 5005 | 5005 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA'"; |
| 5006 | 5006 | if ($olderthanmonths > 0) { |
| 5007 | 5007 | if ($globalDBdriver == 'mysql') { |
@@ -5021,28 +5021,28 @@ discard block |
||
| 5021 | 5021 | if ($year != '') { |
| 5022 | 5022 | if ($globalDBdriver == 'mysql') { |
| 5023 | 5023 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 5024 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5024 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5025 | 5025 | } else { |
| 5026 | 5026 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 5027 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 5027 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 5028 | 5028 | } |
| 5029 | 5029 | } |
| 5030 | 5030 | if ($month != '') { |
| 5031 | 5031 | if ($globalDBdriver == 'mysql') { |
| 5032 | 5032 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 5033 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5033 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5034 | 5034 | } else { |
| 5035 | 5035 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 5036 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 5036 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 5037 | 5037 | } |
| 5038 | 5038 | } |
| 5039 | 5039 | if ($day != '') { |
| 5040 | 5040 | if ($globalDBdriver == 'mysql') { |
| 5041 | 5041 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 5042 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5042 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5043 | 5043 | } else { |
| 5044 | 5044 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 5045 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 5045 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 5046 | 5046 | } |
| 5047 | 5047 | } |
| 5048 | 5048 | |
@@ -5054,7 +5054,7 @@ discard block |
||
| 5054 | 5054 | |
| 5055 | 5055 | $aircraft_array = array(); |
| 5056 | 5056 | $temp_array = array(); |
| 5057 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5057 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5058 | 5058 | { |
| 5059 | 5059 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 5060 | 5060 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -5072,11 +5072,11 @@ discard block |
||
| 5072 | 5072 | * @return Array the aircraft list |
| 5073 | 5073 | * |
| 5074 | 5074 | */ |
| 5075 | - public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5075 | + public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5076 | 5076 | { |
| 5077 | 5077 | global $globalDBdriver; |
| 5078 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5079 | - $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 5078 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5079 | + $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 5080 | 5080 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
| 5081 | 5081 | if ($olderthanmonths > 0) { |
| 5082 | 5082 | if ($globalDBdriver == 'mysql') { |
@@ -5101,7 +5101,7 @@ discard block |
||
| 5101 | 5101 | |
| 5102 | 5102 | $aircraft_array = array(); |
| 5103 | 5103 | $temp_array = array(); |
| 5104 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5104 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5105 | 5105 | { |
| 5106 | 5106 | //$temp_array['airline_icao'] = $row['airline_icao']; |
| 5107 | 5107 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -5120,13 +5120,13 @@ discard block |
||
| 5120 | 5120 | * @return Array the aircraft list |
| 5121 | 5121 | * |
| 5122 | 5122 | */ |
| 5123 | - public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
|
| 5123 | + public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array()) |
|
| 5124 | 5124 | { |
| 5125 | 5125 | $Image = new Image($this->db); |
| 5126 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5127 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 5126 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5127 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 5128 | 5128 | |
| 5129 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5129 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5130 | 5130 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 5131 | 5131 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
| 5132 | 5132 | ORDER BY registration_count DESC"; |
@@ -5137,14 +5137,14 @@ discard block |
||
| 5137 | 5137 | $aircraft_array = array(); |
| 5138 | 5138 | $temp_array = array(); |
| 5139 | 5139 | |
| 5140 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5140 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5141 | 5141 | { |
| 5142 | 5142 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5143 | 5143 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5144 | 5144 | $temp_array['registration'] = $row['registration']; |
| 5145 | 5145 | $temp_array['airline_name'] = $row['airline_name']; |
| 5146 | 5146 | $temp_array['image_thumbnail'] = ""; |
| 5147 | - if($row['registration'] != "") |
|
| 5147 | + if ($row['registration'] != "") |
|
| 5148 | 5148 | { |
| 5149 | 5149 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5150 | 5150 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5163,11 +5163,11 @@ discard block |
||
| 5163 | 5163 | * @return Array the aircraft list |
| 5164 | 5164 | * |
| 5165 | 5165 | */ |
| 5166 | - public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
|
| 5166 | + public function countAllAircraftTypesByAirline($airline_icao, $filters = array()) |
|
| 5167 | 5167 | { |
| 5168 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5169 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5170 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5168 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5169 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5170 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5171 | 5171 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao |
| 5172 | 5172 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5173 | 5173 | ORDER BY aircraft_icao_count DESC"; |
@@ -5178,7 +5178,7 @@ discard block |
||
| 5178 | 5178 | $aircraft_array = array(); |
| 5179 | 5179 | $temp_array = array(); |
| 5180 | 5180 | |
| 5181 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5181 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5182 | 5182 | { |
| 5183 | 5183 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5184 | 5184 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5196,13 +5196,13 @@ discard block |
||
| 5196 | 5196 | * @return Array the aircraft list |
| 5197 | 5197 | * |
| 5198 | 5198 | */ |
| 5199 | - public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
|
| 5199 | + public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array()) |
|
| 5200 | 5200 | { |
| 5201 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5201 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5202 | 5202 | $Image = new Image($this->db); |
| 5203 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5203 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5204 | 5204 | |
| 5205 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5205 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5206 | 5206 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao |
| 5207 | 5207 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5208 | 5208 | ORDER BY registration_count DESC"; |
@@ -5212,14 +5212,14 @@ discard block |
||
| 5212 | 5212 | |
| 5213 | 5213 | $aircraft_array = array(); |
| 5214 | 5214 | $temp_array = array(); |
| 5215 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5215 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5216 | 5216 | { |
| 5217 | 5217 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5218 | 5218 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5219 | 5219 | $temp_array['registration'] = $row['registration']; |
| 5220 | 5220 | $temp_array['airline_name'] = $row['airline_name']; |
| 5221 | 5221 | $temp_array['image_thumbnail'] = ""; |
| 5222 | - if($row['registration'] != "") |
|
| 5222 | + if ($row['registration'] != "") |
|
| 5223 | 5223 | { |
| 5224 | 5224 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5225 | 5225 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5238,11 +5238,11 @@ discard block |
||
| 5238 | 5238 | * @return Array the aircraft list |
| 5239 | 5239 | * |
| 5240 | 5240 | */ |
| 5241 | - public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
|
| 5241 | + public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array()) |
|
| 5242 | 5242 | { |
| 5243 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5244 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5245 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5243 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5244 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5245 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5246 | 5246 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao |
| 5247 | 5247 | GROUP BY spotter_output.aircraft_manufacturer |
| 5248 | 5248 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5253,7 +5253,7 @@ discard block |
||
| 5253 | 5253 | $aircraft_array = array(); |
| 5254 | 5254 | $temp_array = array(); |
| 5255 | 5255 | |
| 5256 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5256 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5257 | 5257 | { |
| 5258 | 5258 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5259 | 5259 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5270,12 +5270,12 @@ discard block |
||
| 5270 | 5270 | * @return Array the aircraft list |
| 5271 | 5271 | * |
| 5272 | 5272 | */ |
| 5273 | - public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
|
| 5273 | + public function countAllAircraftTypesByAirport($airport_icao, $filters = array()) |
|
| 5274 | 5274 | { |
| 5275 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5276 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5275 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5276 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5277 | 5277 | |
| 5278 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5278 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5279 | 5279 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 5280 | 5280 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5281 | 5281 | ORDER BY aircraft_icao_count DESC"; |
@@ -5285,7 +5285,7 @@ discard block |
||
| 5285 | 5285 | |
| 5286 | 5286 | $aircraft_array = array(); |
| 5287 | 5287 | $temp_array = array(); |
| 5288 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5288 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5289 | 5289 | { |
| 5290 | 5290 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5291 | 5291 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5303,13 +5303,13 @@ discard block |
||
| 5303 | 5303 | * @return Array the aircraft list |
| 5304 | 5304 | * |
| 5305 | 5305 | */ |
| 5306 | - public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
|
| 5306 | + public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array()) |
|
| 5307 | 5307 | { |
| 5308 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5308 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5309 | 5309 | $Image = new Image($this->db); |
| 5310 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5310 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5311 | 5311 | |
| 5312 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5312 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5313 | 5313 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 5314 | 5314 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5315 | 5315 | ORDER BY registration_count DESC"; |
@@ -5319,14 +5319,14 @@ discard block |
||
| 5319 | 5319 | |
| 5320 | 5320 | $aircraft_array = array(); |
| 5321 | 5321 | $temp_array = array(); |
| 5322 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5322 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5323 | 5323 | { |
| 5324 | 5324 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5325 | 5325 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5326 | 5326 | $temp_array['registration'] = $row['registration']; |
| 5327 | 5327 | $temp_array['airline_name'] = $row['airline_name']; |
| 5328 | 5328 | $temp_array['image_thumbnail'] = ""; |
| 5329 | - if($row['registration'] != "") |
|
| 5329 | + if ($row['registration'] != "") |
|
| 5330 | 5330 | { |
| 5331 | 5331 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5332 | 5332 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5344,11 +5344,11 @@ discard block |
||
| 5344 | 5344 | * @return Array the aircraft list |
| 5345 | 5345 | * |
| 5346 | 5346 | */ |
| 5347 | - public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
|
| 5347 | + public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array()) |
|
| 5348 | 5348 | { |
| 5349 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5350 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 5351 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5349 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5350 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 5351 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5352 | 5352 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 5353 | 5353 | GROUP BY spotter_output.aircraft_manufacturer |
| 5354 | 5354 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5359,7 +5359,7 @@ discard block |
||
| 5359 | 5359 | |
| 5360 | 5360 | $aircraft_array = array(); |
| 5361 | 5361 | $temp_array = array(); |
| 5362 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5362 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5363 | 5363 | { |
| 5364 | 5364 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5365 | 5365 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5374,12 +5374,12 @@ discard block |
||
| 5374 | 5374 | * @return Array the aircraft list |
| 5375 | 5375 | * |
| 5376 | 5376 | */ |
| 5377 | - public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 5377 | + public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 5378 | 5378 | { |
| 5379 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5380 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 5379 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5380 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 5381 | 5381 | |
| 5382 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5382 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5383 | 5383 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 5384 | 5384 | GROUP BY spotter_output.aircraft_name |
| 5385 | 5385 | ORDER BY aircraft_icao_count DESC"; |
@@ -5388,7 +5388,7 @@ discard block |
||
| 5388 | 5388 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 5389 | 5389 | $aircraft_array = array(); |
| 5390 | 5390 | $temp_array = array(); |
| 5391 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5391 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5392 | 5392 | { |
| 5393 | 5393 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5394 | 5394 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5407,11 +5407,11 @@ discard block |
||
| 5407 | 5407 | */ |
| 5408 | 5408 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 5409 | 5409 | { |
| 5410 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5410 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5411 | 5411 | $Image = new Image($this->db); |
| 5412 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 5412 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 5413 | 5413 | |
| 5414 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5414 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5415 | 5415 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 5416 | 5416 | GROUP BY spotter_output.registration |
| 5417 | 5417 | ORDER BY registration_count DESC"; |
@@ -5421,14 +5421,14 @@ discard block |
||
| 5421 | 5421 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 5422 | 5422 | $aircraft_array = array(); |
| 5423 | 5423 | $temp_array = array(); |
| 5424 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5424 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5425 | 5425 | { |
| 5426 | 5426 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5427 | 5427 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5428 | 5428 | $temp_array['registration'] = $row['registration']; |
| 5429 | 5429 | $temp_array['airline_name'] = $row['airline_name']; |
| 5430 | 5430 | $temp_array['image_thumbnail'] = ""; |
| 5431 | - if($row['registration'] != "") |
|
| 5431 | + if ($row['registration'] != "") |
|
| 5432 | 5432 | { |
| 5433 | 5433 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5434 | 5434 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5445,11 +5445,11 @@ discard block |
||
| 5445 | 5445 | * @return Array the aircraft list |
| 5446 | 5446 | * |
| 5447 | 5447 | */ |
| 5448 | - public function countAllAircraftTypesByDate($date,$filters = array()) |
|
| 5448 | + public function countAllAircraftTypesByDate($date, $filters = array()) |
|
| 5449 | 5449 | { |
| 5450 | 5450 | global $globalTimezone, $globalDBdriver; |
| 5451 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5452 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5451 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5452 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5453 | 5453 | if ($globalTimezone != '') { |
| 5454 | 5454 | date_default_timezone_set($globalTimezone); |
| 5455 | 5455 | $datetime = new DateTime($date); |
@@ -5457,12 +5457,12 @@ discard block |
||
| 5457 | 5457 | } else $offset = '+00:00'; |
| 5458 | 5458 | |
| 5459 | 5459 | if ($globalDBdriver == 'mysql') { |
| 5460 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5460 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5461 | 5461 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5462 | 5462 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5463 | 5463 | ORDER BY aircraft_icao_count DESC"; |
| 5464 | 5464 | } else { |
| 5465 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5465 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5466 | 5466 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5467 | 5467 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5468 | 5468 | ORDER BY aircraft_icao_count DESC"; |
@@ -5473,7 +5473,7 @@ discard block |
||
| 5473 | 5473 | |
| 5474 | 5474 | $aircraft_array = array(); |
| 5475 | 5475 | $temp_array = array(); |
| 5476 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5476 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5477 | 5477 | { |
| 5478 | 5478 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5479 | 5479 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5491,12 +5491,12 @@ discard block |
||
| 5491 | 5491 | * @return Array the aircraft list |
| 5492 | 5492 | * |
| 5493 | 5493 | */ |
| 5494 | - public function countAllAircraftRegistrationByDate($date,$filters = array()) |
|
| 5494 | + public function countAllAircraftRegistrationByDate($date, $filters = array()) |
|
| 5495 | 5495 | { |
| 5496 | 5496 | global $globalTimezone, $globalDBdriver; |
| 5497 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5497 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5498 | 5498 | $Image = new Image($this->db); |
| 5499 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5499 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5500 | 5500 | if ($globalTimezone != '') { |
| 5501 | 5501 | date_default_timezone_set($globalTimezone); |
| 5502 | 5502 | $datetime = new DateTime($date); |
@@ -5504,12 +5504,12 @@ discard block |
||
| 5504 | 5504 | } else $offset = '+00:00'; |
| 5505 | 5505 | |
| 5506 | 5506 | if ($globalDBdriver == 'mysql') { |
| 5507 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5507 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5508 | 5508 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5509 | 5509 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5510 | 5510 | ORDER BY registration_count DESC"; |
| 5511 | 5511 | } else { |
| 5512 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5512 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5513 | 5513 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5514 | 5514 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5515 | 5515 | ORDER BY registration_count DESC"; |
@@ -5520,14 +5520,14 @@ discard block |
||
| 5520 | 5520 | |
| 5521 | 5521 | $aircraft_array = array(); |
| 5522 | 5522 | $temp_array = array(); |
| 5523 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5523 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5524 | 5524 | { |
| 5525 | 5525 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5526 | 5526 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5527 | 5527 | $temp_array['registration'] = $row['registration']; |
| 5528 | 5528 | $temp_array['airline_name'] = $row['airline_name']; |
| 5529 | 5529 | $temp_array['image_thumbnail'] = ""; |
| 5530 | - if($row['registration'] != "") |
|
| 5530 | + if ($row['registration'] != "") |
|
| 5531 | 5531 | { |
| 5532 | 5532 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5533 | 5533 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5546,11 +5546,11 @@ discard block |
||
| 5546 | 5546 | * @return Array the aircraft manufacturer list |
| 5547 | 5547 | * |
| 5548 | 5548 | */ |
| 5549 | - public function countAllAircraftManufacturerByDate($date,$filters = array()) |
|
| 5549 | + public function countAllAircraftManufacturerByDate($date, $filters = array()) |
|
| 5550 | 5550 | { |
| 5551 | 5551 | global $globalTimezone, $globalDBdriver; |
| 5552 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5553 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5552 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5553 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5554 | 5554 | if ($globalTimezone != '') { |
| 5555 | 5555 | date_default_timezone_set($globalTimezone); |
| 5556 | 5556 | $datetime = new DateTime($date); |
@@ -5558,12 +5558,12 @@ discard block |
||
| 5558 | 5558 | } else $offset = '+00:00'; |
| 5559 | 5559 | |
| 5560 | 5560 | if ($globalDBdriver == 'mysql') { |
| 5561 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5561 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5562 | 5562 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5563 | 5563 | GROUP BY spotter_output.aircraft_manufacturer |
| 5564 | 5564 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5565 | 5565 | } else { |
| 5566 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5566 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5567 | 5567 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5568 | 5568 | GROUP BY spotter_output.aircraft_manufacturer |
| 5569 | 5569 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5575,7 +5575,7 @@ discard block |
||
| 5575 | 5575 | $aircraft_array = array(); |
| 5576 | 5576 | $temp_array = array(); |
| 5577 | 5577 | |
| 5578 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5578 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5579 | 5579 | { |
| 5580 | 5580 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5581 | 5581 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5592,11 +5592,11 @@ discard block |
||
| 5592 | 5592 | * @return Array the aircraft list |
| 5593 | 5593 | * |
| 5594 | 5594 | */ |
| 5595 | - public function countAllAircraftTypesByIdent($ident,$filters = array()) |
|
| 5595 | + public function countAllAircraftTypesByIdent($ident, $filters = array()) |
|
| 5596 | 5596 | { |
| 5597 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5598 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5599 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5597 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5598 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5599 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5600 | 5600 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 5601 | 5601 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5602 | 5602 | ORDER BY aircraft_icao_count DESC"; |
@@ -5607,7 +5607,7 @@ discard block |
||
| 5607 | 5607 | $aircraft_array = array(); |
| 5608 | 5608 | $temp_array = array(); |
| 5609 | 5609 | |
| 5610 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5610 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5611 | 5611 | { |
| 5612 | 5612 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5613 | 5613 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5624,11 +5624,11 @@ discard block |
||
| 5624 | 5624 | * @return Array the aircraft list |
| 5625 | 5625 | * |
| 5626 | 5626 | */ |
| 5627 | - public function countAllAircraftTypesByPilot($pilot,$filters = array()) |
|
| 5627 | + public function countAllAircraftTypesByPilot($pilot, $filters = array()) |
|
| 5628 | 5628 | { |
| 5629 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5630 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 5631 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5629 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5630 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 5631 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5632 | 5632 | FROM spotter_output".$filter_query." (spotter_output.pilot_id = :pilot OR spotter_output.pilot_name = :pilot) |
| 5633 | 5633 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5634 | 5634 | ORDER BY aircraft_icao_count DESC"; |
@@ -5644,11 +5644,11 @@ discard block |
||
| 5644 | 5644 | * @return Array the aircraft list |
| 5645 | 5645 | * |
| 5646 | 5646 | */ |
| 5647 | - public function countAllAircraftTypesByOwner($owner,$filters = array()) |
|
| 5647 | + public function countAllAircraftTypesByOwner($owner, $filters = array()) |
|
| 5648 | 5648 | { |
| 5649 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5650 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 5651 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 5649 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5650 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 5651 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 5652 | 5652 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner |
| 5653 | 5653 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.aircraft_icao |
| 5654 | 5654 | ORDER BY aircraft_icao_count DESC"; |
@@ -5664,13 +5664,13 @@ discard block |
||
| 5664 | 5664 | * @return Array the aircraft list |
| 5665 | 5665 | * |
| 5666 | 5666 | */ |
| 5667 | - public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
|
| 5667 | + public function countAllAircraftRegistrationByIdent($ident, $filters = array()) |
|
| 5668 | 5668 | { |
| 5669 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5669 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5670 | 5670 | $Image = new Image($this->db); |
| 5671 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5671 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5672 | 5672 | |
| 5673 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5673 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5674 | 5674 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident |
| 5675 | 5675 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5676 | 5676 | ORDER BY registration_count DESC"; |
@@ -5682,14 +5682,14 @@ discard block |
||
| 5682 | 5682 | $aircraft_array = array(); |
| 5683 | 5683 | $temp_array = array(); |
| 5684 | 5684 | |
| 5685 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5685 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5686 | 5686 | { |
| 5687 | 5687 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5688 | 5688 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5689 | 5689 | $temp_array['registration'] = $row['registration']; |
| 5690 | 5690 | $temp_array['airline_name'] = $row['airline_name']; |
| 5691 | 5691 | $temp_array['image_thumbnail'] = ""; |
| 5692 | - if($row['registration'] != "") |
|
| 5692 | + if ($row['registration'] != "") |
|
| 5693 | 5693 | { |
| 5694 | 5694 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5695 | 5695 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5707,13 +5707,13 @@ discard block |
||
| 5707 | 5707 | * @return Array the aircraft list |
| 5708 | 5708 | * |
| 5709 | 5709 | */ |
| 5710 | - public function countAllAircraftRegistrationByOwner($owner,$filters = array()) |
|
| 5710 | + public function countAllAircraftRegistrationByOwner($owner, $filters = array()) |
|
| 5711 | 5711 | { |
| 5712 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5712 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5713 | 5713 | $Image = new Image($this->db); |
| 5714 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 5714 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 5715 | 5715 | |
| 5716 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name |
|
| 5716 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name |
|
| 5717 | 5717 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.owner_name = :owner |
| 5718 | 5718 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name |
| 5719 | 5719 | ORDER BY registration_count DESC"; |
@@ -5725,7 +5725,7 @@ discard block |
||
| 5725 | 5725 | $aircraft_array = array(); |
| 5726 | 5726 | $temp_array = array(); |
| 5727 | 5727 | |
| 5728 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5728 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5729 | 5729 | { |
| 5730 | 5730 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5731 | 5731 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5733,7 +5733,7 @@ discard block |
||
| 5733 | 5733 | $temp_array['registration'] = $row['registration']; |
| 5734 | 5734 | $temp_array['airline_name'] = $row['airline_name']; |
| 5735 | 5735 | $temp_array['image_thumbnail'] = ""; |
| 5736 | - if($row['registration'] != "") |
|
| 5736 | + if ($row['registration'] != "") |
|
| 5737 | 5737 | { |
| 5738 | 5738 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5739 | 5739 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5751,13 +5751,13 @@ discard block |
||
| 5751 | 5751 | * @return Array the aircraft list |
| 5752 | 5752 | * |
| 5753 | 5753 | */ |
| 5754 | - public function countAllAircraftRegistrationByPilot($pilot,$filters = array()) |
|
| 5754 | + public function countAllAircraftRegistrationByPilot($pilot, $filters = array()) |
|
| 5755 | 5755 | { |
| 5756 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5756 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5757 | 5757 | $Image = new Image($this->db); |
| 5758 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 5758 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 5759 | 5759 | |
| 5760 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name |
|
| 5760 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.registration, spotter_output.airline_name |
|
| 5761 | 5761 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 5762 | 5762 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_name |
| 5763 | 5763 | ORDER BY registration_count DESC"; |
@@ -5769,7 +5769,7 @@ discard block |
||
| 5769 | 5769 | $aircraft_array = array(); |
| 5770 | 5770 | $temp_array = array(); |
| 5771 | 5771 | |
| 5772 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5772 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5773 | 5773 | { |
| 5774 | 5774 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5775 | 5775 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5777,7 +5777,7 @@ discard block |
||
| 5777 | 5777 | $temp_array['registration'] = $row['registration']; |
| 5778 | 5778 | $temp_array['airline_name'] = $row['airline_name']; |
| 5779 | 5779 | $temp_array['image_thumbnail'] = ""; |
| 5780 | - if($row['registration'] != "") |
|
| 5780 | + if ($row['registration'] != "") |
|
| 5781 | 5781 | { |
| 5782 | 5782 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5783 | 5783 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5796,11 +5796,11 @@ discard block |
||
| 5796 | 5796 | * @return Array the aircraft manufacturer list |
| 5797 | 5797 | * |
| 5798 | 5798 | */ |
| 5799 | - public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
|
| 5799 | + public function countAllAircraftManufacturerByIdent($ident, $filters = array()) |
|
| 5800 | 5800 | { |
| 5801 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5802 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5803 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5801 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5802 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5803 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5804 | 5804 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident |
| 5805 | 5805 | GROUP BY spotter_output.aircraft_manufacturer |
| 5806 | 5806 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5810,7 +5810,7 @@ discard block |
||
| 5810 | 5810 | $sth->execute(array(':ident' => $ident)); |
| 5811 | 5811 | $aircraft_array = array(); |
| 5812 | 5812 | $temp_array = array(); |
| 5813 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5813 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5814 | 5814 | { |
| 5815 | 5815 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5816 | 5816 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5825,11 +5825,11 @@ discard block |
||
| 5825 | 5825 | * @return Array the aircraft manufacturer list |
| 5826 | 5826 | * |
| 5827 | 5827 | */ |
| 5828 | - public function countAllAircraftManufacturerByOwner($owner,$filters = array()) |
|
| 5828 | + public function countAllAircraftManufacturerByOwner($owner, $filters = array()) |
|
| 5829 | 5829 | { |
| 5830 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5831 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 5832 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5830 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5831 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 5832 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5833 | 5833 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.owner_name = :owner |
| 5834 | 5834 | GROUP BY spotter_output.aircraft_manufacturer |
| 5835 | 5835 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5846,11 +5846,11 @@ discard block |
||
| 5846 | 5846 | * @return Array the aircraft manufacturer list |
| 5847 | 5847 | * |
| 5848 | 5848 | */ |
| 5849 | - public function countAllAircraftManufacturerByPilot($pilot,$filters = array()) |
|
| 5849 | + public function countAllAircraftManufacturerByPilot($pilot, $filters = array()) |
|
| 5850 | 5850 | { |
| 5851 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5852 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 5853 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5851 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5852 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 5853 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5854 | 5854 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 5855 | 5855 | GROUP BY spotter_output.aircraft_manufacturer |
| 5856 | 5856 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5868,24 +5868,24 @@ discard block |
||
| 5868 | 5868 | * @return Array the aircraft list |
| 5869 | 5869 | * |
| 5870 | 5870 | */ |
| 5871 | - public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5871 | + public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5872 | 5872 | { |
| 5873 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5874 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5875 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5873 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5874 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5875 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5876 | 5876 | |
| 5877 | 5877 | |
| 5878 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5878 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5879 | 5879 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5880 | 5880 | GROUP BY spotter_output.aircraft_name |
| 5881 | 5881 | ORDER BY aircraft_icao_count DESC"; |
| 5882 | 5882 | |
| 5883 | 5883 | |
| 5884 | 5884 | $sth = $this->db->prepare($query); |
| 5885 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5885 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5886 | 5886 | $aircraft_array = array(); |
| 5887 | 5887 | $temp_array = array(); |
| 5888 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5888 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5889 | 5889 | { |
| 5890 | 5890 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5891 | 5891 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5901,33 +5901,33 @@ discard block |
||
| 5901 | 5901 | * @return Array the aircraft list |
| 5902 | 5902 | * |
| 5903 | 5903 | */ |
| 5904 | - public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5904 | + public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5905 | 5905 | { |
| 5906 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5906 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5907 | 5907 | $Image = new Image($this->db); |
| 5908 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5909 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5908 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5909 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5910 | 5910 | |
| 5911 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5911 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5912 | 5912 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5913 | 5913 | GROUP BY spotter_output.registration |
| 5914 | 5914 | ORDER BY registration_count DESC"; |
| 5915 | 5915 | |
| 5916 | 5916 | |
| 5917 | 5917 | $sth = $this->db->prepare($query); |
| 5918 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5918 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5919 | 5919 | |
| 5920 | 5920 | $aircraft_array = array(); |
| 5921 | 5921 | $temp_array = array(); |
| 5922 | 5922 | |
| 5923 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5923 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5924 | 5924 | { |
| 5925 | 5925 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5926 | 5926 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5927 | 5927 | $temp_array['registration'] = $row['registration']; |
| 5928 | 5928 | $temp_array['airline_name'] = $row['airline_name']; |
| 5929 | 5929 | $temp_array['image_thumbnail'] = ""; |
| 5930 | - if($row['registration'] != "") |
|
| 5930 | + if ($row['registration'] != "") |
|
| 5931 | 5931 | { |
| 5932 | 5932 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5933 | 5933 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5947,25 +5947,25 @@ discard block |
||
| 5947 | 5947 | * @return Array the aircraft manufacturer list |
| 5948 | 5948 | * |
| 5949 | 5949 | */ |
| 5950 | - public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5950 | + public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5951 | 5951 | { |
| 5952 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5953 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5954 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5952 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5953 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5954 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5955 | 5955 | |
| 5956 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5956 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5957 | 5957 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5958 | 5958 | GROUP BY spotter_output.aircraft_manufacturer |
| 5959 | 5959 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5960 | 5960 | |
| 5961 | 5961 | |
| 5962 | 5962 | $sth = $this->db->prepare($query); |
| 5963 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5963 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5964 | 5964 | |
| 5965 | 5965 | $aircraft_array = array(); |
| 5966 | 5966 | $temp_array = array(); |
| 5967 | 5967 | |
| 5968 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5968 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5969 | 5969 | { |
| 5970 | 5970 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5971 | 5971 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5985,11 +5985,11 @@ discard block |
||
| 5985 | 5985 | * @return Array the aircraft list |
| 5986 | 5986 | * |
| 5987 | 5987 | */ |
| 5988 | - public function countAllAircraftTypesByCountry($country,$filters = array()) |
|
| 5988 | + public function countAllAircraftTypesByCountry($country, $filters = array()) |
|
| 5989 | 5989 | { |
| 5990 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5991 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5992 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5990 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5991 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5992 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5993 | 5993 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 5994 | 5994 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5995 | 5995 | ORDER BY aircraft_icao_count DESC"; |
@@ -6001,7 +6001,7 @@ discard block |
||
| 6001 | 6001 | $aircraft_array = array(); |
| 6002 | 6002 | $temp_array = array(); |
| 6003 | 6003 | |
| 6004 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6004 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6005 | 6005 | { |
| 6006 | 6006 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 6007 | 6007 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -6020,12 +6020,12 @@ discard block |
||
| 6020 | 6020 | * @return Array the aircraft list |
| 6021 | 6021 | * |
| 6022 | 6022 | */ |
| 6023 | - public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
|
| 6023 | + public function countAllAircraftRegistrationByCountry($country, $filters = array()) |
|
| 6024 | 6024 | { |
| 6025 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6025 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6026 | 6026 | $Image = new Image($this->db); |
| 6027 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6028 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 6027 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6028 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 6029 | 6029 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 6030 | 6030 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 6031 | 6031 | ORDER BY registration_count DESC"; |
@@ -6037,14 +6037,14 @@ discard block |
||
| 6037 | 6037 | $aircraft_array = array(); |
| 6038 | 6038 | $temp_array = array(); |
| 6039 | 6039 | |
| 6040 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6040 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6041 | 6041 | { |
| 6042 | 6042 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 6043 | 6043 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 6044 | 6044 | $temp_array['registration'] = $row['registration']; |
| 6045 | 6045 | $temp_array['airline_name'] = $row['airline_name']; |
| 6046 | 6046 | $temp_array['image_thumbnail'] = ""; |
| 6047 | - if($row['registration'] != "") |
|
| 6047 | + if ($row['registration'] != "") |
|
| 6048 | 6048 | { |
| 6049 | 6049 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6050 | 6050 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -6064,11 +6064,11 @@ discard block |
||
| 6064 | 6064 | * @return Array the aircraft manufacturer list |
| 6065 | 6065 | * |
| 6066 | 6066 | */ |
| 6067 | - public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
|
| 6067 | + public function countAllAircraftManufacturerByCountry($country, $filters = array()) |
|
| 6068 | 6068 | { |
| 6069 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6070 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6071 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6069 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6070 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6071 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6072 | 6072 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 6073 | 6073 | GROUP BY spotter_output.aircraft_manufacturer |
| 6074 | 6074 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -6080,7 +6080,7 @@ discard block |
||
| 6080 | 6080 | $aircraft_array = array(); |
| 6081 | 6081 | $temp_array = array(); |
| 6082 | 6082 | |
| 6083 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6083 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6084 | 6084 | { |
| 6085 | 6085 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 6086 | 6086 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -6099,38 +6099,38 @@ discard block |
||
| 6099 | 6099 | * @return Array the aircraft list |
| 6100 | 6100 | * |
| 6101 | 6101 | */ |
| 6102 | - public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '') |
|
| 6102 | + public function countAllAircraftManufacturers($filters = array(), $year = '', $month = '', $day = '') |
|
| 6103 | 6103 | { |
| 6104 | 6104 | global $globalDBdriver; |
| 6105 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6106 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6105 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6106 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 6107 | 6107 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 6108 | 6108 | $query_values = array(); |
| 6109 | 6109 | if ($year != '') { |
| 6110 | 6110 | if ($globalDBdriver == 'mysql') { |
| 6111 | 6111 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6112 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6112 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6113 | 6113 | } else { |
| 6114 | 6114 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6115 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6115 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6116 | 6116 | } |
| 6117 | 6117 | } |
| 6118 | 6118 | if ($month != '') { |
| 6119 | 6119 | if ($globalDBdriver == 'mysql') { |
| 6120 | 6120 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6121 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6121 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6122 | 6122 | } else { |
| 6123 | 6123 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6124 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6124 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6125 | 6125 | } |
| 6126 | 6126 | } |
| 6127 | 6127 | if ($day != '') { |
| 6128 | 6128 | if ($globalDBdriver == 'mysql') { |
| 6129 | 6129 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6130 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6130 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6131 | 6131 | } else { |
| 6132 | 6132 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6133 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6133 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6134 | 6134 | } |
| 6135 | 6135 | } |
| 6136 | 6136 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
@@ -6144,7 +6144,7 @@ discard block |
||
| 6144 | 6144 | $manufacturer_array = array(); |
| 6145 | 6145 | $temp_array = array(); |
| 6146 | 6146 | |
| 6147 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6147 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6148 | 6148 | { |
| 6149 | 6149 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 6150 | 6150 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -6163,12 +6163,12 @@ discard block |
||
| 6163 | 6163 | * @return Array the aircraft list |
| 6164 | 6164 | * |
| 6165 | 6165 | */ |
| 6166 | - public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 6166 | + public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 6167 | 6167 | { |
| 6168 | 6168 | global $globalDBdriver; |
| 6169 | 6169 | $Image = new Image($this->db); |
| 6170 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6171 | - $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 6170 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6171 | + $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 6172 | 6172 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 6173 | 6173 | if ($olderthanmonths > 0) { |
| 6174 | 6174 | if ($globalDBdriver == 'mysql') { |
@@ -6188,28 +6188,28 @@ discard block |
||
| 6188 | 6188 | if ($year != '') { |
| 6189 | 6189 | if ($globalDBdriver == 'mysql') { |
| 6190 | 6190 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6191 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6191 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6192 | 6192 | } else { |
| 6193 | 6193 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6194 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6194 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6195 | 6195 | } |
| 6196 | 6196 | } |
| 6197 | 6197 | if ($month != '') { |
| 6198 | 6198 | if ($globalDBdriver == 'mysql') { |
| 6199 | 6199 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6200 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6200 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6201 | 6201 | } else { |
| 6202 | 6202 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6203 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6203 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6204 | 6204 | } |
| 6205 | 6205 | } |
| 6206 | 6206 | if ($day != '') { |
| 6207 | 6207 | if ($globalDBdriver == 'mysql') { |
| 6208 | 6208 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6209 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6209 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6210 | 6210 | } else { |
| 6211 | 6211 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6212 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6212 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6213 | 6213 | } |
| 6214 | 6214 | } |
| 6215 | 6215 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
@@ -6221,7 +6221,7 @@ discard block |
||
| 6221 | 6221 | $aircraft_array = array(); |
| 6222 | 6222 | $temp_array = array(); |
| 6223 | 6223 | |
| 6224 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6224 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6225 | 6225 | { |
| 6226 | 6226 | $temp_array['registration'] = $row['registration']; |
| 6227 | 6227 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -6229,7 +6229,7 @@ discard block |
||
| 6229 | 6229 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 6230 | 6230 | $temp_array['airline_name'] = $row['airline_name']; |
| 6231 | 6231 | $temp_array['image_thumbnail'] = ""; |
| 6232 | - if($row['registration'] != "") |
|
| 6232 | + if ($row['registration'] != "") |
|
| 6233 | 6233 | { |
| 6234 | 6234 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6235 | 6235 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -6248,12 +6248,12 @@ discard block |
||
| 6248 | 6248 | * @return Array the aircraft list |
| 6249 | 6249 | * |
| 6250 | 6250 | */ |
| 6251 | - public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 6251 | + public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 6252 | 6252 | { |
| 6253 | 6253 | global $globalDBdriver; |
| 6254 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6254 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6255 | 6255 | $Image = new Image($this->db); |
| 6256 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 6256 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 6257 | 6257 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 6258 | 6258 | if ($olderthanmonths > 0) { |
| 6259 | 6259 | if ($globalDBdriver == 'mysql') { |
@@ -6281,7 +6281,7 @@ discard block |
||
| 6281 | 6281 | $aircraft_array = array(); |
| 6282 | 6282 | $temp_array = array(); |
| 6283 | 6283 | |
| 6284 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6284 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6285 | 6285 | { |
| 6286 | 6286 | $temp_array['registration'] = $row['registration']; |
| 6287 | 6287 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -6290,7 +6290,7 @@ discard block |
||
| 6290 | 6290 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 6291 | 6291 | $temp_array['airline_name'] = $row['airline_name']; |
| 6292 | 6292 | $temp_array['image_thumbnail'] = ""; |
| 6293 | - if($row['registration'] != "") |
|
| 6293 | + if ($row['registration'] != "") |
|
| 6294 | 6294 | { |
| 6295 | 6295 | $image_array = $Image->getSpotterImage($row['registration']); |
| 6296 | 6296 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -6309,11 +6309,11 @@ discard block |
||
| 6309 | 6309 | * @return Array the airport list |
| 6310 | 6310 | * |
| 6311 | 6311 | */ |
| 6312 | - public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 6312 | + public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 6313 | 6313 | { |
| 6314 | 6314 | global $globalDBdriver; |
| 6315 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6316 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6315 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6316 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6317 | 6317 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 6318 | 6318 | if ($olderthanmonths > 0) { |
| 6319 | 6319 | if ($globalDBdriver == 'mysql') { |
@@ -6333,28 +6333,28 @@ discard block |
||
| 6333 | 6333 | if ($year != '') { |
| 6334 | 6334 | if ($globalDBdriver == 'mysql') { |
| 6335 | 6335 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6336 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6336 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6337 | 6337 | } else { |
| 6338 | 6338 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6339 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6339 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6340 | 6340 | } |
| 6341 | 6341 | } |
| 6342 | 6342 | if ($month != '') { |
| 6343 | 6343 | if ($globalDBdriver == 'mysql') { |
| 6344 | 6344 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6345 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6345 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6346 | 6346 | } else { |
| 6347 | 6347 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6348 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6348 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6349 | 6349 | } |
| 6350 | 6350 | } |
| 6351 | 6351 | if ($day != '') { |
| 6352 | 6352 | if ($globalDBdriver == 'mysql') { |
| 6353 | 6353 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6354 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6354 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6355 | 6355 | } else { |
| 6356 | 6356 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6357 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6357 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6358 | 6358 | } |
| 6359 | 6359 | } |
| 6360 | 6360 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
@@ -6366,7 +6366,7 @@ discard block |
||
| 6366 | 6366 | |
| 6367 | 6367 | $airport_array = array(); |
| 6368 | 6368 | $temp_array = array(); |
| 6369 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6369 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6370 | 6370 | { |
| 6371 | 6371 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6372 | 6372 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6385,11 +6385,11 @@ discard block |
||
| 6385 | 6385 | * @return Array the airport list |
| 6386 | 6386 | * |
| 6387 | 6387 | */ |
| 6388 | - public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 6388 | + public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 6389 | 6389 | { |
| 6390 | 6390 | global $globalDBdriver; |
| 6391 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6392 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6391 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6392 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6393 | 6393 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' "; |
| 6394 | 6394 | if ($olderthanmonths > 0) { |
| 6395 | 6395 | if ($globalDBdriver == 'mysql') { |
@@ -6418,7 +6418,7 @@ discard block |
||
| 6418 | 6418 | $airport_array = array(); |
| 6419 | 6419 | $temp_array = array(); |
| 6420 | 6420 | |
| 6421 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6421 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6422 | 6422 | { |
| 6423 | 6423 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6424 | 6424 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -6438,11 +6438,11 @@ discard block |
||
| 6438 | 6438 | * @return Array the airport list |
| 6439 | 6439 | * |
| 6440 | 6440 | */ |
| 6441 | - public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
| 6441 | + public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 6442 | 6442 | { |
| 6443 | 6443 | global $globalDBdriver; |
| 6444 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6445 | - $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 6444 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6445 | + $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 6446 | 6446 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
| 6447 | 6447 | if ($olderthanmonths > 0) { |
| 6448 | 6448 | if ($globalDBdriver == 'mysql') { |
@@ -6462,28 +6462,28 @@ discard block |
||
| 6462 | 6462 | if ($year != '') { |
| 6463 | 6463 | if ($globalDBdriver == 'mysql') { |
| 6464 | 6464 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 6465 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6465 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6466 | 6466 | } else { |
| 6467 | 6467 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 6468 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 6468 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 6469 | 6469 | } |
| 6470 | 6470 | } |
| 6471 | 6471 | if ($month != '') { |
| 6472 | 6472 | if ($globalDBdriver == 'mysql') { |
| 6473 | 6473 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 6474 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6474 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6475 | 6475 | } else { |
| 6476 | 6476 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 6477 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 6477 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 6478 | 6478 | } |
| 6479 | 6479 | } |
| 6480 | 6480 | if ($day != '') { |
| 6481 | 6481 | if ($globalDBdriver == 'mysql') { |
| 6482 | 6482 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 6483 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6483 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6484 | 6484 | } else { |
| 6485 | 6485 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 6486 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 6486 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 6487 | 6487 | } |
| 6488 | 6488 | } |
| 6489 | 6489 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
@@ -6496,7 +6496,7 @@ discard block |
||
| 6496 | 6496 | $airport_array = array(); |
| 6497 | 6497 | $temp_array = array(); |
| 6498 | 6498 | |
| 6499 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6499 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6500 | 6500 | { |
| 6501 | 6501 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6502 | 6502 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6515,11 +6515,11 @@ discard block |
||
| 6515 | 6515 | * @return Array the airport list |
| 6516 | 6516 | * |
| 6517 | 6517 | */ |
| 6518 | - public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 6518 | + public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 6519 | 6519 | { |
| 6520 | 6520 | global $globalDBdriver; |
| 6521 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6522 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 6521 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6522 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 6523 | 6523 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
| 6524 | 6524 | if ($olderthanmonths > 0) { |
| 6525 | 6525 | if ($globalDBdriver == 'mysql') { |
@@ -6548,7 +6548,7 @@ discard block |
||
| 6548 | 6548 | $airport_array = array(); |
| 6549 | 6549 | $temp_array = array(); |
| 6550 | 6550 | |
| 6551 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6551 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6552 | 6552 | { |
| 6553 | 6553 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6554 | 6554 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -6568,11 +6568,11 @@ discard block |
||
| 6568 | 6568 | * @return Array the airport list |
| 6569 | 6569 | * |
| 6570 | 6570 | */ |
| 6571 | - public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
|
| 6571 | + public function countAllDepartureAirportsByAirline($airline_icao, $filters = array()) |
|
| 6572 | 6572 | { |
| 6573 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6574 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6575 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6573 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6574 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6575 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6576 | 6576 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao AND spotter_output.departure_airport_icao <> '' |
| 6577 | 6577 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6578 | 6578 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6584,7 +6584,7 @@ discard block |
||
| 6584 | 6584 | $airport_array = array(); |
| 6585 | 6585 | $temp_array = array(); |
| 6586 | 6586 | |
| 6587 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6587 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6588 | 6588 | { |
| 6589 | 6589 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6590 | 6590 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6606,11 +6606,11 @@ discard block |
||
| 6606 | 6606 | * @return Array the airport list |
| 6607 | 6607 | * |
| 6608 | 6608 | */ |
| 6609 | - public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 6609 | + public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 6610 | 6610 | { |
| 6611 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6612 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6613 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6611 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6612 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6613 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6614 | 6614 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 6615 | 6615 | GROUP BY spotter_output.departure_airport_country |
| 6616 | 6616 | ORDER BY airport_departure_country_count DESC"; |
@@ -6622,7 +6622,7 @@ discard block |
||
| 6622 | 6622 | $airport_array = array(); |
| 6623 | 6623 | $temp_array = array(); |
| 6624 | 6624 | |
| 6625 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6625 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6626 | 6626 | { |
| 6627 | 6627 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6628 | 6628 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6641,11 +6641,11 @@ discard block |
||
| 6641 | 6641 | * @return Array the airport list |
| 6642 | 6642 | * |
| 6643 | 6643 | */ |
| 6644 | - public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 6644 | + public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 6645 | 6645 | { |
| 6646 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6647 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6648 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6646 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6647 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6648 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6649 | 6649 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao AND spotter_output.departure_airport_icao <> '' |
| 6650 | 6650 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6651 | 6651 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6657,7 +6657,7 @@ discard block |
||
| 6657 | 6657 | $airport_array = array(); |
| 6658 | 6658 | $temp_array = array(); |
| 6659 | 6659 | |
| 6660 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6660 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6661 | 6661 | { |
| 6662 | 6662 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6663 | 6663 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6678,11 +6678,11 @@ discard block |
||
| 6678 | 6678 | * @return Array the airport list |
| 6679 | 6679 | * |
| 6680 | 6680 | */ |
| 6681 | - public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 6681 | + public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 6682 | 6682 | { |
| 6683 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6684 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6685 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6683 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6684 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6685 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6686 | 6686 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6687 | 6687 | GROUP BY spotter_output.departure_airport_country |
| 6688 | 6688 | ORDER BY airport_departure_country_count DESC"; |
@@ -6694,7 +6694,7 @@ discard block |
||
| 6694 | 6694 | $airport_array = array(); |
| 6695 | 6695 | $temp_array = array(); |
| 6696 | 6696 | |
| 6697 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6697 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6698 | 6698 | { |
| 6699 | 6699 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6700 | 6700 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6712,11 +6712,11 @@ discard block |
||
| 6712 | 6712 | * @return Array the airport list |
| 6713 | 6713 | * |
| 6714 | 6714 | */ |
| 6715 | - public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
|
| 6715 | + public function countAllDepartureAirportsByRegistration($registration, $filters = array()) |
|
| 6716 | 6716 | { |
| 6717 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6718 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6719 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6717 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6718 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6719 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6720 | 6720 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration AND spotter_output.departure_airport_icao <> '' |
| 6721 | 6721 | GROUP BY spotter_output.departure_airport_icao |
| 6722 | 6722 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6728,7 +6728,7 @@ discard block |
||
| 6728 | 6728 | $airport_array = array(); |
| 6729 | 6729 | $temp_array = array(); |
| 6730 | 6730 | |
| 6731 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6731 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6732 | 6732 | { |
| 6733 | 6733 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6734 | 6734 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6749,11 +6749,11 @@ discard block |
||
| 6749 | 6749 | * @return Array the airport list |
| 6750 | 6750 | * |
| 6751 | 6751 | */ |
| 6752 | - public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
|
| 6752 | + public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array()) |
|
| 6753 | 6753 | { |
| 6754 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6755 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6756 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6754 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6755 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6756 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6757 | 6757 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration |
| 6758 | 6758 | GROUP BY spotter_output.departure_airport_country |
| 6759 | 6759 | ORDER BY airport_departure_country_count DESC"; |
@@ -6765,7 +6765,7 @@ discard block |
||
| 6765 | 6765 | $airport_array = array(); |
| 6766 | 6766 | $temp_array = array(); |
| 6767 | 6767 | |
| 6768 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6768 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6769 | 6769 | { |
| 6770 | 6770 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6771 | 6771 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6783,11 +6783,11 @@ discard block |
||
| 6783 | 6783 | * @return Array the airport list |
| 6784 | 6784 | * |
| 6785 | 6785 | */ |
| 6786 | - public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
|
| 6786 | + public function countAllDepartureAirportsByAirport($airport_icao, $filters = array()) |
|
| 6787 | 6787 | { |
| 6788 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6789 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6790 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6788 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6789 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6790 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6791 | 6791 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao AND spotter_output.departure_airport_icao <> '' |
| 6792 | 6792 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6793 | 6793 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6799,7 +6799,7 @@ discard block |
||
| 6799 | 6799 | $airport_array = array(); |
| 6800 | 6800 | $temp_array = array(); |
| 6801 | 6801 | |
| 6802 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6802 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6803 | 6803 | { |
| 6804 | 6804 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6805 | 6805 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6820,11 +6820,11 @@ discard block |
||
| 6820 | 6820 | * @return Array the airport list |
| 6821 | 6821 | * |
| 6822 | 6822 | */ |
| 6823 | - public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 6823 | + public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 6824 | 6824 | { |
| 6825 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6826 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6827 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6825 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6826 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6827 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6828 | 6828 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao |
| 6829 | 6829 | GROUP BY spotter_output.departure_airport_country |
| 6830 | 6830 | ORDER BY airport_departure_country_count DESC"; |
@@ -6836,7 +6836,7 @@ discard block |
||
| 6836 | 6836 | $airport_array = array(); |
| 6837 | 6837 | $temp_array = array(); |
| 6838 | 6838 | |
| 6839 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6839 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6840 | 6840 | { |
| 6841 | 6841 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6842 | 6842 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6855,11 +6855,11 @@ discard block |
||
| 6855 | 6855 | * @return Array the airport list |
| 6856 | 6856 | * |
| 6857 | 6857 | */ |
| 6858 | - public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6858 | + public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6859 | 6859 | { |
| 6860 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6861 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6862 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6860 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6861 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6862 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6863 | 6863 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer AND spotter_output.departure_airport_icao <> '' |
| 6864 | 6864 | GROUP BY spotter_output.departure_airport_icao |
| 6865 | 6865 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6871,7 +6871,7 @@ discard block |
||
| 6871 | 6871 | $airport_array = array(); |
| 6872 | 6872 | $temp_array = array(); |
| 6873 | 6873 | |
| 6874 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6874 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6875 | 6875 | { |
| 6876 | 6876 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6877 | 6877 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6892,11 +6892,11 @@ discard block |
||
| 6892 | 6892 | * @return Array the airport list |
| 6893 | 6893 | * |
| 6894 | 6894 | */ |
| 6895 | - public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6895 | + public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6896 | 6896 | { |
| 6897 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6898 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6899 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6897 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6898 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6899 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6900 | 6900 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6901 | 6901 | GROUP BY spotter_output.departure_airport_country |
| 6902 | 6902 | ORDER BY airport_departure_country_count DESC"; |
@@ -6908,7 +6908,7 @@ discard block |
||
| 6908 | 6908 | $airport_array = array(); |
| 6909 | 6909 | $temp_array = array(); |
| 6910 | 6910 | |
| 6911 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6911 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6912 | 6912 | { |
| 6913 | 6913 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6914 | 6914 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6926,11 +6926,11 @@ discard block |
||
| 6926 | 6926 | * @return Array the airport list |
| 6927 | 6927 | * |
| 6928 | 6928 | */ |
| 6929 | - public function countAllDepartureAirportsByDate($date,$filters = array()) |
|
| 6929 | + public function countAllDepartureAirportsByDate($date, $filters = array()) |
|
| 6930 | 6930 | { |
| 6931 | 6931 | global $globalTimezone, $globalDBdriver; |
| 6932 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6933 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6932 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6933 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6934 | 6934 | if ($globalTimezone != '') { |
| 6935 | 6935 | date_default_timezone_set($globalTimezone); |
| 6936 | 6936 | $datetime = new DateTime($date); |
@@ -6938,12 +6938,12 @@ discard block |
||
| 6938 | 6938 | } else $offset = '+00:00'; |
| 6939 | 6939 | |
| 6940 | 6940 | if ($globalDBdriver == 'mysql') { |
| 6941 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6941 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6942 | 6942 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6943 | 6943 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6944 | 6944 | ORDER BY airport_departure_icao_count DESC"; |
| 6945 | 6945 | } else { |
| 6946 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6946 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6947 | 6947 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6948 | 6948 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6949 | 6949 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6955,7 +6955,7 @@ discard block |
||
| 6955 | 6955 | $airport_array = array(); |
| 6956 | 6956 | $temp_array = array(); |
| 6957 | 6957 | |
| 6958 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6958 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6959 | 6959 | { |
| 6960 | 6960 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6961 | 6961 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6976,11 +6976,11 @@ discard block |
||
| 6976 | 6976 | * @return Array the airport list |
| 6977 | 6977 | * |
| 6978 | 6978 | */ |
| 6979 | - public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
|
| 6979 | + public function countAllDepartureAirportCountriesByDate($date, $filters = array()) |
|
| 6980 | 6980 | { |
| 6981 | 6981 | global $globalTimezone, $globalDBdriver; |
| 6982 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6983 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6982 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6983 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6984 | 6984 | if ($globalTimezone != '') { |
| 6985 | 6985 | date_default_timezone_set($globalTimezone); |
| 6986 | 6986 | $datetime = new DateTime($date); |
@@ -6988,12 +6988,12 @@ discard block |
||
| 6988 | 6988 | } else $offset = '+00:00'; |
| 6989 | 6989 | |
| 6990 | 6990 | if ($globalDBdriver == 'mysql') { |
| 6991 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6991 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6992 | 6992 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6993 | 6993 | GROUP BY spotter_output.departure_airport_country |
| 6994 | 6994 | ORDER BY airport_departure_country_count DESC"; |
| 6995 | 6995 | } else { |
| 6996 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6996 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6997 | 6997 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6998 | 6998 | GROUP BY spotter_output.departure_airport_country |
| 6999 | 6999 | ORDER BY airport_departure_country_count DESC"; |
@@ -7005,7 +7005,7 @@ discard block |
||
| 7005 | 7005 | $airport_array = array(); |
| 7006 | 7006 | $temp_array = array(); |
| 7007 | 7007 | |
| 7008 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7008 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7009 | 7009 | { |
| 7010 | 7010 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 7011 | 7011 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -7023,11 +7023,11 @@ discard block |
||
| 7023 | 7023 | * @return Array the airport list |
| 7024 | 7024 | * |
| 7025 | 7025 | */ |
| 7026 | - public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
|
| 7026 | + public function countAllDepartureAirportsByIdent($ident, $filters = array()) |
|
| 7027 | 7027 | { |
| 7028 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7029 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7030 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 7028 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7029 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7030 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 7031 | 7031 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.ident = :ident |
| 7032 | 7032 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7033 | 7033 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7039,7 +7039,7 @@ discard block |
||
| 7039 | 7039 | $airport_array = array(); |
| 7040 | 7040 | $temp_array = array(); |
| 7041 | 7041 | |
| 7042 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7042 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7043 | 7043 | { |
| 7044 | 7044 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7045 | 7045 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7059,11 +7059,11 @@ discard block |
||
| 7059 | 7059 | * @return Array the airport list |
| 7060 | 7060 | * |
| 7061 | 7061 | */ |
| 7062 | - public function countAllDepartureAirportsByOwner($owner,$filters = array()) |
|
| 7062 | + public function countAllDepartureAirportsByOwner($owner, $filters = array()) |
|
| 7063 | 7063 | { |
| 7064 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7065 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 7066 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 7064 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7065 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 7066 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 7067 | 7067 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.owner_name = :owner |
| 7068 | 7068 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7069 | 7069 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7075,7 +7075,7 @@ discard block |
||
| 7075 | 7075 | $airport_array = array(); |
| 7076 | 7076 | $temp_array = array(); |
| 7077 | 7077 | |
| 7078 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7078 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7079 | 7079 | { |
| 7080 | 7080 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7081 | 7081 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7095,11 +7095,11 @@ discard block |
||
| 7095 | 7095 | * @return Array the airport list |
| 7096 | 7096 | * |
| 7097 | 7097 | */ |
| 7098 | - public function countAllDepartureAirportsByPilot($pilot,$filters = array()) |
|
| 7098 | + public function countAllDepartureAirportsByPilot($pilot, $filters = array()) |
|
| 7099 | 7099 | { |
| 7100 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7101 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 7102 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 7100 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7101 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 7102 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 7103 | 7103 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 7104 | 7104 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7105 | 7105 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7110,7 +7110,7 @@ discard block |
||
| 7110 | 7110 | $airport_array = array(); |
| 7111 | 7111 | $temp_array = array(); |
| 7112 | 7112 | |
| 7113 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7113 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7114 | 7114 | { |
| 7115 | 7115 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7116 | 7116 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7132,11 +7132,11 @@ discard block |
||
| 7132 | 7132 | * @return Array the airport list |
| 7133 | 7133 | * |
| 7134 | 7134 | */ |
| 7135 | - public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
|
| 7135 | + public function countAllDepartureAirportCountriesByIdent($ident, $filters = array()) |
|
| 7136 | 7136 | { |
| 7137 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7138 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7139 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7137 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7138 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7139 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7140 | 7140 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident |
| 7141 | 7141 | GROUP BY spotter_output.departure_airport_country |
| 7142 | 7142 | ORDER BY airport_departure_country_count DESC"; |
@@ -7148,7 +7148,7 @@ discard block |
||
| 7148 | 7148 | $airport_array = array(); |
| 7149 | 7149 | $temp_array = array(); |
| 7150 | 7150 | |
| 7151 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7151 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7152 | 7152 | { |
| 7153 | 7153 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 7154 | 7154 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -7165,11 +7165,11 @@ discard block |
||
| 7165 | 7165 | * @return Array the airport list |
| 7166 | 7166 | * |
| 7167 | 7167 | */ |
| 7168 | - public function countAllDepartureAirportCountriesByOwner($owner,$filters = array()) |
|
| 7168 | + public function countAllDepartureAirportCountriesByOwner($owner, $filters = array()) |
|
| 7169 | 7169 | { |
| 7170 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7171 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 7172 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7170 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7171 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 7172 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7173 | 7173 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.owner_name = :owner |
| 7174 | 7174 | GROUP BY spotter_output.departure_airport_country |
| 7175 | 7175 | ORDER BY airport_departure_country_count DESC"; |
@@ -7185,11 +7185,11 @@ discard block |
||
| 7185 | 7185 | * @return Array the airport list |
| 7186 | 7186 | * |
| 7187 | 7187 | */ |
| 7188 | - public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array()) |
|
| 7188 | + public function countAllDepartureAirportCountriesByPilot($pilot, $filters = array()) |
|
| 7189 | 7189 | { |
| 7190 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7191 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 7192 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7190 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7191 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 7192 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7193 | 7193 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 7194 | 7194 | GROUP BY spotter_output.departure_airport_country |
| 7195 | 7195 | ORDER BY airport_departure_country_count DESC"; |
@@ -7207,12 +7207,12 @@ discard block |
||
| 7207 | 7207 | * @return Array the airport list |
| 7208 | 7208 | * |
| 7209 | 7209 | */ |
| 7210 | - public function countAllDepartureAirportsByCountry($country,$filters = array()) |
|
| 7210 | + public function countAllDepartureAirportsByCountry($country, $filters = array()) |
|
| 7211 | 7211 | { |
| 7212 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7213 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7212 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7213 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7214 | 7214 | |
| 7215 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 7215 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 7216 | 7216 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7217 | 7217 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7218 | 7218 | ORDER BY airport_departure_icao_count DESC"; |
@@ -7224,7 +7224,7 @@ discard block |
||
| 7224 | 7224 | $airport_array = array(); |
| 7225 | 7225 | $temp_array = array(); |
| 7226 | 7226 | |
| 7227 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7227 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7228 | 7228 | { |
| 7229 | 7229 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 7230 | 7230 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -7245,11 +7245,11 @@ discard block |
||
| 7245 | 7245 | * @return Array the airport list |
| 7246 | 7246 | * |
| 7247 | 7247 | */ |
| 7248 | - public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
|
| 7248 | + public function countAllDepartureAirportCountriesByCountry($country, $filters = array()) |
|
| 7249 | 7249 | { |
| 7250 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7251 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7252 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7250 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7251 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7252 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 7253 | 7253 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7254 | 7254 | GROUP BY spotter_output.departure_airport_country |
| 7255 | 7255 | ORDER BY airport_departure_country_count DESC"; |
@@ -7261,7 +7261,7 @@ discard block |
||
| 7261 | 7261 | $airport_array = array(); |
| 7262 | 7262 | $temp_array = array(); |
| 7263 | 7263 | |
| 7264 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7264 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7265 | 7265 | { |
| 7266 | 7266 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 7267 | 7267 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -7284,11 +7284,11 @@ discard block |
||
| 7284 | 7284 | * @return Array the airport list |
| 7285 | 7285 | * |
| 7286 | 7286 | */ |
| 7287 | - public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
|
| 7287 | + public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '') |
|
| 7288 | 7288 | { |
| 7289 | 7289 | global $globalDBdriver; |
| 7290 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7291 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7290 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7291 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7292 | 7292 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 7293 | 7293 | if ($olderthanmonths > 0) { |
| 7294 | 7294 | if ($globalDBdriver == 'mysql') { |
@@ -7308,28 +7308,28 @@ discard block |
||
| 7308 | 7308 | if ($year != '') { |
| 7309 | 7309 | if ($globalDBdriver == 'mysql') { |
| 7310 | 7310 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 7311 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7311 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7312 | 7312 | } else { |
| 7313 | 7313 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 7314 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7314 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7315 | 7315 | } |
| 7316 | 7316 | } |
| 7317 | 7317 | if ($month != '') { |
| 7318 | 7318 | if ($globalDBdriver == 'mysql') { |
| 7319 | 7319 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 7320 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7320 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7321 | 7321 | } else { |
| 7322 | 7322 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 7323 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7323 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7324 | 7324 | } |
| 7325 | 7325 | } |
| 7326 | 7326 | if ($day != '') { |
| 7327 | 7327 | if ($globalDBdriver == 'mysql') { |
| 7328 | 7328 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 7329 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7329 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7330 | 7330 | } else { |
| 7331 | 7331 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 7332 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7332 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7333 | 7333 | } |
| 7334 | 7334 | } |
| 7335 | 7335 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
@@ -7343,7 +7343,7 @@ discard block |
||
| 7343 | 7343 | $airport_array = array(); |
| 7344 | 7344 | $temp_array = array(); |
| 7345 | 7345 | |
| 7346 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7346 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7347 | 7347 | { |
| 7348 | 7348 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7349 | 7349 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7366,11 +7366,11 @@ discard block |
||
| 7366 | 7366 | * @return Array the airport list |
| 7367 | 7367 | * |
| 7368 | 7368 | */ |
| 7369 | - public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 7369 | + public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 7370 | 7370 | { |
| 7371 | 7371 | global $globalDBdriver; |
| 7372 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7373 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7372 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7373 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7374 | 7374 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' "; |
| 7375 | 7375 | if ($olderthanmonths > 0) { |
| 7376 | 7376 | if ($globalDBdriver == 'mysql') { |
@@ -7400,7 +7400,7 @@ discard block |
||
| 7400 | 7400 | $airport_array = array(); |
| 7401 | 7401 | $temp_array = array(); |
| 7402 | 7402 | |
| 7403 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7403 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7404 | 7404 | { |
| 7405 | 7405 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 7406 | 7406 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
@@ -7425,11 +7425,11 @@ discard block |
||
| 7425 | 7425 | * @return Array the airport list |
| 7426 | 7426 | * |
| 7427 | 7427 | */ |
| 7428 | - public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
|
| 7428 | + public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array(), $year = '', $month = '', $day = '') |
|
| 7429 | 7429 | { |
| 7430 | 7430 | global $globalDBdriver; |
| 7431 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7432 | - $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 7431 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7432 | + $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 7433 | 7433 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
| 7434 | 7434 | if ($olderthanmonths > 0) { |
| 7435 | 7435 | if ($globalDBdriver == 'mysql') { |
@@ -7449,28 +7449,28 @@ discard block |
||
| 7449 | 7449 | if ($year != '') { |
| 7450 | 7450 | if ($globalDBdriver == 'mysql') { |
| 7451 | 7451 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 7452 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7452 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7453 | 7453 | } else { |
| 7454 | 7454 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 7455 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 7455 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 7456 | 7456 | } |
| 7457 | 7457 | } |
| 7458 | 7458 | if ($month != '') { |
| 7459 | 7459 | if ($globalDBdriver == 'mysql') { |
| 7460 | 7460 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 7461 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7461 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7462 | 7462 | } else { |
| 7463 | 7463 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 7464 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 7464 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 7465 | 7465 | } |
| 7466 | 7466 | } |
| 7467 | 7467 | if ($day != '') { |
| 7468 | 7468 | if ($globalDBdriver == 'mysql') { |
| 7469 | 7469 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 7470 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7470 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7471 | 7471 | } else { |
| 7472 | 7472 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 7473 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 7473 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 7474 | 7474 | } |
| 7475 | 7475 | } |
| 7476 | 7476 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
@@ -7483,7 +7483,7 @@ discard block |
||
| 7483 | 7483 | |
| 7484 | 7484 | $airport_array = array(); |
| 7485 | 7485 | $temp_array = array(); |
| 7486 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7486 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7487 | 7487 | { |
| 7488 | 7488 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7489 | 7489 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7506,11 +7506,11 @@ discard block |
||
| 7506 | 7506 | * @return Array the airport list |
| 7507 | 7507 | * |
| 7508 | 7508 | */ |
| 7509 | - public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 7509 | + public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 7510 | 7510 | { |
| 7511 | 7511 | global $globalDBdriver; |
| 7512 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7513 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 7512 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7513 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 7514 | 7514 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
| 7515 | 7515 | if ($olderthanmonths > 0) { |
| 7516 | 7516 | if ($globalDBdriver == 'mysql') { |
@@ -7540,7 +7540,7 @@ discard block |
||
| 7540 | 7540 | $airport_array = array(); |
| 7541 | 7541 | $temp_array = array(); |
| 7542 | 7542 | |
| 7543 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7543 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7544 | 7544 | { |
| 7545 | 7545 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7546 | 7546 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7566,9 +7566,9 @@ discard block |
||
| 7566 | 7566 | */ |
| 7567 | 7567 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 7568 | 7568 | { |
| 7569 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7570 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7571 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7569 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7570 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7571 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7572 | 7572 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.airline_icao = :airline_icao |
| 7573 | 7573 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7574 | 7574 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7579,7 +7579,7 @@ discard block |
||
| 7579 | 7579 | $airport_array = array(); |
| 7580 | 7580 | $temp_array = array(); |
| 7581 | 7581 | |
| 7582 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7582 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7583 | 7583 | { |
| 7584 | 7584 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7585 | 7585 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7600,12 +7600,12 @@ discard block |
||
| 7600 | 7600 | * @return Array the airport list |
| 7601 | 7601 | * |
| 7602 | 7602 | */ |
| 7603 | - public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 7603 | + public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 7604 | 7604 | { |
| 7605 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7606 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7605 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7606 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7607 | 7607 | |
| 7608 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7608 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7609 | 7609 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 7610 | 7610 | GROUP BY spotter_output.arrival_airport_country |
| 7611 | 7611 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7617,7 +7617,7 @@ discard block |
||
| 7617 | 7617 | $airport_array = array(); |
| 7618 | 7618 | $temp_array = array(); |
| 7619 | 7619 | |
| 7620 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7620 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7621 | 7621 | { |
| 7622 | 7622 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7623 | 7623 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7635,11 +7635,11 @@ discard block |
||
| 7635 | 7635 | * @return Array the airport list |
| 7636 | 7636 | * |
| 7637 | 7637 | */ |
| 7638 | - public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 7638 | + public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 7639 | 7639 | { |
| 7640 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7641 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7642 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7640 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7641 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7642 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7643 | 7643 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 7644 | 7644 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7645 | 7645 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7651,7 +7651,7 @@ discard block |
||
| 7651 | 7651 | $airport_array = array(); |
| 7652 | 7652 | $temp_array = array(); |
| 7653 | 7653 | |
| 7654 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7654 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7655 | 7655 | { |
| 7656 | 7656 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7657 | 7657 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7673,11 +7673,11 @@ discard block |
||
| 7673 | 7673 | * @return Array the airport list |
| 7674 | 7674 | * |
| 7675 | 7675 | */ |
| 7676 | - public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 7676 | + public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 7677 | 7677 | { |
| 7678 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7679 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7680 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7678 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7679 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7680 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7681 | 7681 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 7682 | 7682 | GROUP BY spotter_output.arrival_airport_country |
| 7683 | 7683 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7689,7 +7689,7 @@ discard block |
||
| 7689 | 7689 | $airport_array = array(); |
| 7690 | 7690 | $temp_array = array(); |
| 7691 | 7691 | |
| 7692 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7692 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7693 | 7693 | { |
| 7694 | 7694 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7695 | 7695 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7707,12 +7707,12 @@ discard block |
||
| 7707 | 7707 | * @return Array the airport list |
| 7708 | 7708 | * |
| 7709 | 7709 | */ |
| 7710 | - public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
|
| 7710 | + public function countAllArrivalAirportsByRegistration($registration, $filters = array()) |
|
| 7711 | 7711 | { |
| 7712 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7713 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 7712 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7713 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 7714 | 7714 | |
| 7715 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7715 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7716 | 7716 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.registration = :registration |
| 7717 | 7717 | GROUP BY spotter_output.arrival_airport_icao |
| 7718 | 7718 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7724,7 +7724,7 @@ discard block |
||
| 7724 | 7724 | $airport_array = array(); |
| 7725 | 7725 | $temp_array = array(); |
| 7726 | 7726 | |
| 7727 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7727 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7728 | 7728 | { |
| 7729 | 7729 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7730 | 7730 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7745,11 +7745,11 @@ discard block |
||
| 7745 | 7745 | * @return Array the airport list |
| 7746 | 7746 | * |
| 7747 | 7747 | */ |
| 7748 | - public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
|
| 7748 | + public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array()) |
|
| 7749 | 7749 | { |
| 7750 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7751 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 7752 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7750 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7751 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 7752 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7753 | 7753 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration |
| 7754 | 7754 | GROUP BY spotter_output.arrival_airport_country |
| 7755 | 7755 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7761,7 +7761,7 @@ discard block |
||
| 7761 | 7761 | $airport_array = array(); |
| 7762 | 7762 | $temp_array = array(); |
| 7763 | 7763 | |
| 7764 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7764 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7765 | 7765 | { |
| 7766 | 7766 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7767 | 7767 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7780,11 +7780,11 @@ discard block |
||
| 7780 | 7780 | * @return Array the airport list |
| 7781 | 7781 | * |
| 7782 | 7782 | */ |
| 7783 | - public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
|
| 7783 | + public function countAllArrivalAirportsByAirport($airport_icao, $filters = array()) |
|
| 7784 | 7784 | { |
| 7785 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7786 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7787 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7785 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7786 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7787 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7788 | 7788 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.departure_airport_icao = :airport_icao |
| 7789 | 7789 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7790 | 7790 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7796,7 +7796,7 @@ discard block |
||
| 7796 | 7796 | $airport_array = array(); |
| 7797 | 7797 | $temp_array = array(); |
| 7798 | 7798 | |
| 7799 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7799 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7800 | 7800 | { |
| 7801 | 7801 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7802 | 7802 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7817,11 +7817,11 @@ discard block |
||
| 7817 | 7817 | * @return Array the airport list |
| 7818 | 7818 | * |
| 7819 | 7819 | */ |
| 7820 | - public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 7820 | + public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 7821 | 7821 | { |
| 7822 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7823 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7824 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7822 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7823 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7824 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7825 | 7825 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao |
| 7826 | 7826 | GROUP BY spotter_output.arrival_airport_country |
| 7827 | 7827 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7833,7 +7833,7 @@ discard block |
||
| 7833 | 7833 | $airport_array = array(); |
| 7834 | 7834 | $temp_array = array(); |
| 7835 | 7835 | |
| 7836 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7836 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7837 | 7837 | { |
| 7838 | 7838 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7839 | 7839 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7851,11 +7851,11 @@ discard block |
||
| 7851 | 7851 | * @return Array the airport list |
| 7852 | 7852 | * |
| 7853 | 7853 | */ |
| 7854 | - public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 7854 | + public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 7855 | 7855 | { |
| 7856 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7857 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7858 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7856 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7857 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7858 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7859 | 7859 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7860 | 7860 | GROUP BY spotter_output.arrival_airport_icao |
| 7861 | 7861 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7867,7 +7867,7 @@ discard block |
||
| 7867 | 7867 | $airport_array = array(); |
| 7868 | 7868 | $temp_array = array(); |
| 7869 | 7869 | |
| 7870 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7870 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7871 | 7871 | { |
| 7872 | 7872 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7873 | 7873 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7889,11 +7889,11 @@ discard block |
||
| 7889 | 7889 | * @return Array the airport list |
| 7890 | 7890 | * |
| 7891 | 7891 | */ |
| 7892 | - public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 7892 | + public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 7893 | 7893 | { |
| 7894 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7895 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7896 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7894 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7895 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7896 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7897 | 7897 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7898 | 7898 | GROUP BY spotter_output.arrival_airport_country |
| 7899 | 7899 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7905,7 +7905,7 @@ discard block |
||
| 7905 | 7905 | $airport_array = array(); |
| 7906 | 7906 | $temp_array = array(); |
| 7907 | 7907 | |
| 7908 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7908 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7909 | 7909 | { |
| 7910 | 7910 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7911 | 7911 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7924,11 +7924,11 @@ discard block |
||
| 7924 | 7924 | * @return Array the airport list |
| 7925 | 7925 | * |
| 7926 | 7926 | */ |
| 7927 | - public function countAllArrivalAirportsByDate($date,$filters = array()) |
|
| 7927 | + public function countAllArrivalAirportsByDate($date, $filters = array()) |
|
| 7928 | 7928 | { |
| 7929 | 7929 | global $globalTimezone, $globalDBdriver; |
| 7930 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7931 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7930 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7931 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7932 | 7932 | if ($globalTimezone != '') { |
| 7933 | 7933 | date_default_timezone_set($globalTimezone); |
| 7934 | 7934 | $datetime = new DateTime($date); |
@@ -7936,12 +7936,12 @@ discard block |
||
| 7936 | 7936 | } else $offset = '+00:00'; |
| 7937 | 7937 | |
| 7938 | 7938 | if ($globalDBdriver == 'mysql') { |
| 7939 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7939 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7940 | 7940 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7941 | 7941 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7942 | 7942 | ORDER BY airport_arrival_icao_count DESC"; |
| 7943 | 7943 | } else { |
| 7944 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7944 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7945 | 7945 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7946 | 7946 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7947 | 7947 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7953,7 +7953,7 @@ discard block |
||
| 7953 | 7953 | $airport_array = array(); |
| 7954 | 7954 | $temp_array = array(); |
| 7955 | 7955 | |
| 7956 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7956 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7957 | 7957 | { |
| 7958 | 7958 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7959 | 7959 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7977,8 +7977,8 @@ discard block |
||
| 7977 | 7977 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 7978 | 7978 | { |
| 7979 | 7979 | global $globalTimezone, $globalDBdriver; |
| 7980 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7981 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7980 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7981 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7982 | 7982 | if ($globalTimezone != '') { |
| 7983 | 7983 | date_default_timezone_set($globalTimezone); |
| 7984 | 7984 | $datetime = new DateTime($date); |
@@ -7986,12 +7986,12 @@ discard block |
||
| 7986 | 7986 | } else $offset = '+00:00'; |
| 7987 | 7987 | |
| 7988 | 7988 | if ($globalDBdriver == 'mysql') { |
| 7989 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7989 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7990 | 7990 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7991 | 7991 | GROUP BY spotter_output.arrival_airport_country |
| 7992 | 7992 | ORDER BY airport_arrival_country_count DESC"; |
| 7993 | 7993 | } else { |
| 7994 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7994 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7995 | 7995 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7996 | 7996 | GROUP BY spotter_output.arrival_airport_country |
| 7997 | 7997 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8003,7 +8003,7 @@ discard block |
||
| 8003 | 8003 | $airport_array = array(); |
| 8004 | 8004 | $temp_array = array(); |
| 8005 | 8005 | |
| 8006 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8006 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8007 | 8007 | { |
| 8008 | 8008 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 8009 | 8009 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -8021,11 +8021,11 @@ discard block |
||
| 8021 | 8021 | * @return Array the airport list |
| 8022 | 8022 | * |
| 8023 | 8023 | */ |
| 8024 | - public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
|
| 8024 | + public function countAllArrivalAirportsByIdent($ident, $filters = array()) |
|
| 8025 | 8025 | { |
| 8026 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8027 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 8028 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 8026 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8027 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 8028 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 8029 | 8029 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.ident = :ident |
| 8030 | 8030 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8031 | 8031 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8037,7 +8037,7 @@ discard block |
||
| 8037 | 8037 | $airport_array = array(); |
| 8038 | 8038 | $temp_array = array(); |
| 8039 | 8039 | |
| 8040 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8040 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8041 | 8041 | { |
| 8042 | 8042 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8043 | 8043 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8057,11 +8057,11 @@ discard block |
||
| 8057 | 8057 | * @return Array the airport list |
| 8058 | 8058 | * |
| 8059 | 8059 | */ |
| 8060 | - public function countAllArrivalAirportsByOwner($owner,$filters = array()) |
|
| 8060 | + public function countAllArrivalAirportsByOwner($owner, $filters = array()) |
|
| 8061 | 8061 | { |
| 8062 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8063 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 8064 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 8062 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8063 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 8064 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 8065 | 8065 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND spotter_output.owner_name = :owner |
| 8066 | 8066 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8067 | 8067 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8072,7 +8072,7 @@ discard block |
||
| 8072 | 8072 | $airport_array = array(); |
| 8073 | 8073 | $temp_array = array(); |
| 8074 | 8074 | |
| 8075 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8075 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8076 | 8076 | { |
| 8077 | 8077 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8078 | 8078 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8092,11 +8092,11 @@ discard block |
||
| 8092 | 8092 | * @return Array the airport list |
| 8093 | 8093 | * |
| 8094 | 8094 | */ |
| 8095 | - public function countAllArrivalAirportsByPilot($pilot,$filters = array()) |
|
| 8095 | + public function countAllArrivalAirportsByPilot($pilot, $filters = array()) |
|
| 8096 | 8096 | { |
| 8097 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8098 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 8099 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 8097 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8098 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 8099 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 8100 | 8100 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 8101 | 8101 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8102 | 8102 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8107,7 +8107,7 @@ discard block |
||
| 8107 | 8107 | $airport_array = array(); |
| 8108 | 8108 | $temp_array = array(); |
| 8109 | 8109 | |
| 8110 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8110 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8111 | 8111 | { |
| 8112 | 8112 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8113 | 8113 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8129,9 +8129,9 @@ discard block |
||
| 8129 | 8129 | */ |
| 8130 | 8130 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 8131 | 8131 | { |
| 8132 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8133 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 8134 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8132 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8133 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 8134 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8135 | 8135 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident |
| 8136 | 8136 | GROUP BY spotter_output.arrival_airport_country |
| 8137 | 8137 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8143,7 +8143,7 @@ discard block |
||
| 8143 | 8143 | $airport_array = array(); |
| 8144 | 8144 | $temp_array = array(); |
| 8145 | 8145 | |
| 8146 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8146 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8147 | 8147 | { |
| 8148 | 8148 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 8149 | 8149 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -8162,9 +8162,9 @@ discard block |
||
| 8162 | 8162 | */ |
| 8163 | 8163 | public function countAllArrivalAirportCountriesByOwner($owner, $filters = array()) |
| 8164 | 8164 | { |
| 8165 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8166 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 8167 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8165 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8166 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 8167 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8168 | 8168 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.owner_name = :owner |
| 8169 | 8169 | GROUP BY spotter_output.arrival_airport_country |
| 8170 | 8170 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8182,9 +8182,9 @@ discard block |
||
| 8182 | 8182 | */ |
| 8183 | 8183 | public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array()) |
| 8184 | 8184 | { |
| 8185 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8186 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 8187 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8185 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8186 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 8187 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8188 | 8188 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 8189 | 8189 | GROUP BY spotter_output.arrival_airport_country |
| 8190 | 8190 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8202,11 +8202,11 @@ discard block |
||
| 8202 | 8202 | * @return Array the airport list |
| 8203 | 8203 | * |
| 8204 | 8204 | */ |
| 8205 | - public function countAllArrivalAirportsByCountry($country,$filters = array()) |
|
| 8205 | + public function countAllArrivalAirportsByCountry($country, $filters = array()) |
|
| 8206 | 8206 | { |
| 8207 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8208 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 8209 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 8207 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8208 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 8209 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 8210 | 8210 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 8211 | 8211 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8212 | 8212 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -8218,7 +8218,7 @@ discard block |
||
| 8218 | 8218 | $airport_array = array(); |
| 8219 | 8219 | $temp_array = array(); |
| 8220 | 8220 | |
| 8221 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8221 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8222 | 8222 | { |
| 8223 | 8223 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 8224 | 8224 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -8239,12 +8239,12 @@ discard block |
||
| 8239 | 8239 | * @return Array the airport list |
| 8240 | 8240 | * |
| 8241 | 8241 | */ |
| 8242 | - public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
|
| 8242 | + public function countAllArrivalAirportCountriesByCountry($country, $filters = array()) |
|
| 8243 | 8243 | { |
| 8244 | 8244 | global $globalDBdriver; |
| 8245 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8246 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 8247 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8245 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8246 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 8247 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8248 | 8248 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 8249 | 8249 | GROUP BY spotter_output.arrival_airport_country |
| 8250 | 8250 | ORDER BY airport_arrival_country_count DESC"; |
@@ -8256,7 +8256,7 @@ discard block |
||
| 8256 | 8256 | $airport_array = array(); |
| 8257 | 8257 | $temp_array = array(); |
| 8258 | 8258 | |
| 8259 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8259 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8260 | 8260 | { |
| 8261 | 8261 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 8262 | 8262 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -8275,38 +8275,38 @@ discard block |
||
| 8275 | 8275 | * @return Array the airport departure list |
| 8276 | 8276 | * |
| 8277 | 8277 | */ |
| 8278 | - public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '') |
|
| 8278 | + public function countAllDepartureCountries($filters = array(), $year = '', $month = '', $day = '') |
|
| 8279 | 8279 | { |
| 8280 | 8280 | global $globalDBdriver; |
| 8281 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8282 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 8281 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8282 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 8283 | 8283 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 8284 | 8284 | $query_values = array(); |
| 8285 | 8285 | if ($year != '') { |
| 8286 | 8286 | if ($globalDBdriver == 'mysql') { |
| 8287 | 8287 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 8288 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8288 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8289 | 8289 | } else { |
| 8290 | 8290 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 8291 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8291 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8292 | 8292 | } |
| 8293 | 8293 | } |
| 8294 | 8294 | if ($month != '') { |
| 8295 | 8295 | if ($globalDBdriver == 'mysql') { |
| 8296 | 8296 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 8297 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8297 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8298 | 8298 | } else { |
| 8299 | 8299 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 8300 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8300 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8301 | 8301 | } |
| 8302 | 8302 | } |
| 8303 | 8303 | if ($day != '') { |
| 8304 | 8304 | if ($globalDBdriver == 'mysql') { |
| 8305 | 8305 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 8306 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8306 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8307 | 8307 | } else { |
| 8308 | 8308 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 8309 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8309 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8310 | 8310 | } |
| 8311 | 8311 | } |
| 8312 | 8312 | $query .= " GROUP BY spotter_output.departure_airport_country |
@@ -8320,7 +8320,7 @@ discard block |
||
| 8320 | 8320 | $airport_array = array(); |
| 8321 | 8321 | $temp_array = array(); |
| 8322 | 8322 | |
| 8323 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8323 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8324 | 8324 | { |
| 8325 | 8325 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
| 8326 | 8326 | $temp_array['airport_departure_country'] = $row['departure_airport_country']; |
@@ -8338,38 +8338,38 @@ discard block |
||
| 8338 | 8338 | * @return Array the airport arrival list |
| 8339 | 8339 | * |
| 8340 | 8340 | */ |
| 8341 | - public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
|
| 8341 | + public function countAllArrivalCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
|
| 8342 | 8342 | { |
| 8343 | 8343 | global $globalDBdriver; |
| 8344 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8345 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8344 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8345 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 8346 | 8346 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 8347 | 8347 | $query_values = array(); |
| 8348 | 8348 | if ($year != '') { |
| 8349 | 8349 | if ($globalDBdriver == 'mysql') { |
| 8350 | 8350 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 8351 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8351 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8352 | 8352 | } else { |
| 8353 | 8353 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 8354 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8354 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8355 | 8355 | } |
| 8356 | 8356 | } |
| 8357 | 8357 | if ($month != '') { |
| 8358 | 8358 | if ($globalDBdriver == 'mysql') { |
| 8359 | 8359 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 8360 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8360 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8361 | 8361 | } else { |
| 8362 | 8362 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 8363 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8363 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8364 | 8364 | } |
| 8365 | 8365 | } |
| 8366 | 8366 | if ($day != '') { |
| 8367 | 8367 | if ($globalDBdriver == 'mysql') { |
| 8368 | 8368 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 8369 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8369 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8370 | 8370 | } else { |
| 8371 | 8371 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 8372 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8372 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8373 | 8373 | } |
| 8374 | 8374 | } |
| 8375 | 8375 | $query .= " GROUP BY spotter_output.arrival_airport_country |
@@ -8383,7 +8383,7 @@ discard block |
||
| 8383 | 8383 | $airport_array = array(); |
| 8384 | 8384 | $temp_array = array(); |
| 8385 | 8385 | |
| 8386 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8386 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8387 | 8387 | { |
| 8388 | 8388 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
| 8389 | 8389 | $temp_array['airport_arrival_country'] = $row['arrival_airport_country']; |
@@ -8406,8 +8406,8 @@ discard block |
||
| 8406 | 8406 | */ |
| 8407 | 8407 | public function countAllRoutes($filters = array()) |
| 8408 | 8408 | { |
| 8409 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8410 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8409 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8410 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8411 | 8411 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' |
| 8412 | 8412 | GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 8413 | 8413 | ORDER BY route_count DESC |
@@ -8420,7 +8420,7 @@ discard block |
||
| 8420 | 8420 | $routes_array = array(); |
| 8421 | 8421 | $temp_array = array(); |
| 8422 | 8422 | |
| 8423 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8423 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8424 | 8424 | { |
| 8425 | 8425 | $temp_array['route_count'] = $row['route_count']; |
| 8426 | 8426 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8447,11 +8447,11 @@ discard block |
||
| 8447 | 8447 | * @return Array the route list |
| 8448 | 8448 | * |
| 8449 | 8449 | */ |
| 8450 | - public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
|
| 8450 | + public function countAllRoutesByAircraft($aircraft_icao, $filters = array()) |
|
| 8451 | 8451 | { |
| 8452 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8453 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 8454 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8452 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8453 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 8454 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8455 | 8455 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 8456 | 8456 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8457 | 8457 | ORDER BY route_count DESC"; |
@@ -8462,7 +8462,7 @@ discard block |
||
| 8462 | 8462 | $routes_array = array(); |
| 8463 | 8463 | $temp_array = array(); |
| 8464 | 8464 | |
| 8465 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8465 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8466 | 8466 | { |
| 8467 | 8467 | $temp_array['route_count'] = $row['route_count']; |
| 8468 | 8468 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8489,9 +8489,9 @@ discard block |
||
| 8489 | 8489 | */ |
| 8490 | 8490 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 8491 | 8491 | { |
| 8492 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8492 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8493 | 8493 | $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
| 8494 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8494 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8495 | 8495 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration |
| 8496 | 8496 | GROUP BY route |
| 8497 | 8497 | ORDER BY route_count DESC"; |
@@ -8503,7 +8503,7 @@ discard block |
||
| 8503 | 8503 | $routes_array = array(); |
| 8504 | 8504 | $temp_array = array(); |
| 8505 | 8505 | |
| 8506 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8506 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8507 | 8507 | { |
| 8508 | 8508 | $temp_array['route_count'] = $row['route_count']; |
| 8509 | 8509 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8531,9 +8531,9 @@ discard block |
||
| 8531 | 8531 | */ |
| 8532 | 8532 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 8533 | 8533 | { |
| 8534 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8535 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 8536 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8534 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8535 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 8536 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8537 | 8537 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao |
| 8538 | 8538 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8539 | 8539 | ORDER BY route_count DESC"; |
@@ -8545,7 +8545,7 @@ discard block |
||
| 8545 | 8545 | $routes_array = array(); |
| 8546 | 8546 | $temp_array = array(); |
| 8547 | 8547 | |
| 8548 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8548 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8549 | 8549 | { |
| 8550 | 8550 | $temp_array['route_count'] = $row['route_count']; |
| 8551 | 8551 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8573,9 +8573,9 @@ discard block |
||
| 8573 | 8573 | */ |
| 8574 | 8574 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 8575 | 8575 | { |
| 8576 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8577 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 8578 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8576 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8577 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 8578 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8579 | 8579 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 8580 | 8580 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8581 | 8581 | ORDER BY route_count DESC"; |
@@ -8586,7 +8586,7 @@ discard block |
||
| 8586 | 8586 | $routes_array = array(); |
| 8587 | 8587 | $temp_array = array(); |
| 8588 | 8588 | |
| 8589 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8589 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8590 | 8590 | { |
| 8591 | 8591 | $temp_array['route_count'] = $row['route_count']; |
| 8592 | 8592 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8614,9 +8614,9 @@ discard block |
||
| 8614 | 8614 | */ |
| 8615 | 8615 | public function countAllRoutesByCountry($country, $filters = array()) |
| 8616 | 8616 | { |
| 8617 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8618 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 8619 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8617 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8618 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 8619 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8620 | 8620 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 8621 | 8621 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8622 | 8622 | ORDER BY route_count DESC"; |
@@ -8627,7 +8627,7 @@ discard block |
||
| 8627 | 8627 | $routes_array = array(); |
| 8628 | 8628 | $temp_array = array(); |
| 8629 | 8629 | |
| 8630 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8630 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8631 | 8631 | { |
| 8632 | 8632 | $temp_array['route_count'] = $row['route_count']; |
| 8633 | 8633 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8655,8 +8655,8 @@ discard block |
||
| 8655 | 8655 | public function countAllRoutesByDate($date, $filters = array()) |
| 8656 | 8656 | { |
| 8657 | 8657 | global $globalTimezone, $globalDBdriver; |
| 8658 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8659 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 8658 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8659 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 8660 | 8660 | if ($globalTimezone != '') { |
| 8661 | 8661 | date_default_timezone_set($globalTimezone); |
| 8662 | 8662 | $datetime = new DateTime($date); |
@@ -8664,12 +8664,12 @@ discard block |
||
| 8664 | 8664 | } else $offset = '+00:00'; |
| 8665 | 8665 | |
| 8666 | 8666 | if ($globalDBdriver == 'mysql') { |
| 8667 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8667 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8668 | 8668 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 8669 | 8669 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8670 | 8670 | ORDER BY route_count DESC"; |
| 8671 | 8671 | } else { |
| 8672 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8672 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8673 | 8673 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 8674 | 8674 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8675 | 8675 | ORDER BY route_count DESC"; |
@@ -8681,7 +8681,7 @@ discard block |
||
| 8681 | 8681 | $routes_array = array(); |
| 8682 | 8682 | $temp_array = array(); |
| 8683 | 8683 | |
| 8684 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8684 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8685 | 8685 | { |
| 8686 | 8686 | $temp_array['route_count'] = $row['route_count']; |
| 8687 | 8687 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8708,9 +8708,9 @@ discard block |
||
| 8708 | 8708 | */ |
| 8709 | 8709 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 8710 | 8710 | { |
| 8711 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8712 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 8713 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8711 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8712 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 8713 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8714 | 8714 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident |
| 8715 | 8715 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8716 | 8716 | ORDER BY route_count DESC"; |
@@ -8722,7 +8722,7 @@ discard block |
||
| 8722 | 8722 | $routes_array = array(); |
| 8723 | 8723 | $temp_array = array(); |
| 8724 | 8724 | |
| 8725 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8725 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8726 | 8726 | { |
| 8727 | 8727 | $temp_array['route_count'] = $row['route_count']; |
| 8728 | 8728 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8746,11 +8746,11 @@ discard block |
||
| 8746 | 8746 | * @return Array the route list |
| 8747 | 8747 | * |
| 8748 | 8748 | */ |
| 8749 | - public function countAllRoutesByOwner($owner,$filters = array()) |
|
| 8749 | + public function countAllRoutesByOwner($owner, $filters = array()) |
|
| 8750 | 8750 | { |
| 8751 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8752 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 8753 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8751 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8752 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 8753 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8754 | 8754 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.owner_name = :owner |
| 8755 | 8755 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8756 | 8756 | ORDER BY route_count DESC"; |
@@ -8762,7 +8762,7 @@ discard block |
||
| 8762 | 8762 | $routes_array = array(); |
| 8763 | 8763 | $temp_array = array(); |
| 8764 | 8764 | |
| 8765 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8765 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8766 | 8766 | { |
| 8767 | 8767 | $temp_array['route_count'] = $row['route_count']; |
| 8768 | 8768 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8786,11 +8786,11 @@ discard block |
||
| 8786 | 8786 | * @return Array the route list |
| 8787 | 8787 | * |
| 8788 | 8788 | */ |
| 8789 | - public function countAllRoutesByPilot($pilot,$filters = array()) |
|
| 8789 | + public function countAllRoutesByPilot($pilot, $filters = array()) |
|
| 8790 | 8790 | { |
| 8791 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8792 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 8793 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8791 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8792 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 8793 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8794 | 8794 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 8795 | 8795 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8796 | 8796 | ORDER BY route_count DESC"; |
@@ -8802,7 +8802,7 @@ discard block |
||
| 8802 | 8802 | $routes_array = array(); |
| 8803 | 8803 | $temp_array = array(); |
| 8804 | 8804 | |
| 8805 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8805 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8806 | 8806 | { |
| 8807 | 8807 | $temp_array['route_count'] = $row['route_count']; |
| 8808 | 8808 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8829,9 +8829,9 @@ discard block |
||
| 8829 | 8829 | */ |
| 8830 | 8830 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 8831 | 8831 | { |
| 8832 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8833 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 8834 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8832 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8833 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 8834 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8835 | 8835 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 8836 | 8836 | GROUP BY route |
| 8837 | 8837 | ORDER BY route_count DESC"; |
@@ -8843,7 +8843,7 @@ discard block |
||
| 8843 | 8843 | $routes_array = array(); |
| 8844 | 8844 | $temp_array = array(); |
| 8845 | 8845 | |
| 8846 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8846 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8847 | 8847 | { |
| 8848 | 8848 | $temp_array['route_count'] = $row['route_count']; |
| 8849 | 8849 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -8871,8 +8871,8 @@ discard block |
||
| 8871 | 8871 | */ |
| 8872 | 8872 | public function countAllRoutesWithWaypoints($filters = array()) |
| 8873 | 8873 | { |
| 8874 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8875 | - $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8874 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8875 | + $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 8876 | 8876 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' |
| 8877 | 8877 | GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 8878 | 8878 | ORDER BY route_count DESC |
@@ -8885,7 +8885,7 @@ discard block |
||
| 8885 | 8885 | $routes_array = array(); |
| 8886 | 8886 | $temp_array = array(); |
| 8887 | 8887 | |
| 8888 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8888 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8889 | 8889 | { |
| 8890 | 8890 | $temp_array['spotter_id'] = $row['spotter_id']; |
| 8891 | 8891 | $temp_array['route_count'] = $row['route_count']; |
@@ -8910,11 +8910,11 @@ discard block |
||
| 8910 | 8910 | * @return Array the callsign list |
| 8911 | 8911 | * |
| 8912 | 8912 | */ |
| 8913 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
| 8913 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
| 8914 | 8914 | { |
| 8915 | 8915 | global $globalDBdriver; |
| 8916 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8917 | - $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 8916 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8917 | + $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 8918 | 8918 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 8919 | 8919 | if ($olderthanmonths > 0) { |
| 8920 | 8920 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -8928,28 +8928,28 @@ discard block |
||
| 8928 | 8928 | if ($year != '') { |
| 8929 | 8929 | if ($globalDBdriver == 'mysql') { |
| 8930 | 8930 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 8931 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8931 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8932 | 8932 | } else { |
| 8933 | 8933 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 8934 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 8934 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 8935 | 8935 | } |
| 8936 | 8936 | } |
| 8937 | 8937 | if ($month != '') { |
| 8938 | 8938 | if ($globalDBdriver == 'mysql') { |
| 8939 | 8939 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 8940 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8940 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8941 | 8941 | } else { |
| 8942 | 8942 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 8943 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 8943 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 8944 | 8944 | } |
| 8945 | 8945 | } |
| 8946 | 8946 | if ($day != '') { |
| 8947 | 8947 | if ($globalDBdriver == 'mysql') { |
| 8948 | 8948 | $query .= " AND DAY(spotter_output.date) = :day"; |
| 8949 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8949 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8950 | 8950 | } else { |
| 8951 | 8951 | $query .= " AND EXTRACT(DAY FROM spotter_output.date) = :day"; |
| 8952 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
| 8952 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
| 8953 | 8953 | } |
| 8954 | 8954 | } |
| 8955 | 8955 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
@@ -8961,7 +8961,7 @@ discard block |
||
| 8961 | 8961 | $callsign_array = array(); |
| 8962 | 8962 | $temp_array = array(); |
| 8963 | 8963 | |
| 8964 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8964 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8965 | 8965 | { |
| 8966 | 8966 | $temp_array['callsign_icao'] = $row['ident']; |
| 8967 | 8967 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -8983,8 +8983,8 @@ discard block |
||
| 8983 | 8983 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 8984 | 8984 | { |
| 8985 | 8985 | global $globalDBdriver; |
| 8986 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8987 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 8986 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8987 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 8988 | 8988 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 8989 | 8989 | if ($olderthanmonths > 0) { |
| 8990 | 8990 | if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
@@ -9003,7 +9003,7 @@ discard block |
||
| 9003 | 9003 | $callsign_array = array(); |
| 9004 | 9004 | $temp_array = array(); |
| 9005 | 9005 | |
| 9006 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9006 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9007 | 9007 | { |
| 9008 | 9008 | $temp_array['callsign_icao'] = $row['ident']; |
| 9009 | 9009 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -9057,7 +9057,7 @@ discard block |
||
| 9057 | 9057 | $date_array = array(); |
| 9058 | 9058 | $temp_array = array(); |
| 9059 | 9059 | |
| 9060 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9060 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9061 | 9061 | { |
| 9062 | 9062 | $temp_array['date_name'] = $row['date_name']; |
| 9063 | 9063 | $temp_array['date_count'] = $row['date_count']; |
@@ -9082,15 +9082,15 @@ discard block |
||
| 9082 | 9082 | $datetime = new DateTime(); |
| 9083 | 9083 | $offset = $datetime->format('P'); |
| 9084 | 9084 | } else $offset = '+00:00'; |
| 9085 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9085 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9086 | 9086 | if ($globalDBdriver == 'mysql') { |
| 9087 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 9087 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 9088 | 9088 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 9089 | 9089 | GROUP BY spotter_output.airline_icao, date_name |
| 9090 | 9090 | ORDER BY date_count DESC |
| 9091 | 9091 | LIMIT 10 OFFSET 0"; |
| 9092 | 9092 | } else { |
| 9093 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 9093 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 9094 | 9094 | FROM spotter_output |
| 9095 | 9095 | WHERE spotter_output.airline_icao <> '' |
| 9096 | 9096 | GROUP BY spotter_output.airline_icao, date_name |
@@ -9105,7 +9105,7 @@ discard block |
||
| 9105 | 9105 | $date_array = array(); |
| 9106 | 9106 | $temp_array = array(); |
| 9107 | 9107 | |
| 9108 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9108 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9109 | 9109 | { |
| 9110 | 9110 | $temp_array['date_name'] = $row['date_name']; |
| 9111 | 9111 | $temp_array['date_count'] = $row['date_count']; |
@@ -9131,7 +9131,7 @@ discard block |
||
| 9131 | 9131 | $datetime = new DateTime(); |
| 9132 | 9132 | $offset = $datetime->format('P'); |
| 9133 | 9133 | } else $offset = '+00:00'; |
| 9134 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9134 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9135 | 9135 | if ($globalDBdriver == 'mysql') { |
| 9136 | 9136 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 9137 | 9137 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -9152,7 +9152,7 @@ discard block |
||
| 9152 | 9152 | $date_array = array(); |
| 9153 | 9153 | $temp_array = array(); |
| 9154 | 9154 | |
| 9155 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9155 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9156 | 9156 | { |
| 9157 | 9157 | $temp_array['date_name'] = $row['date_name']; |
| 9158 | 9158 | $temp_array['date_count'] = $row['date_count']; |
@@ -9177,7 +9177,7 @@ discard block |
||
| 9177 | 9177 | $datetime = new DateTime(); |
| 9178 | 9178 | $offset = $datetime->format('P'); |
| 9179 | 9179 | } else $offset = '+00:00'; |
| 9180 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9180 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9181 | 9181 | if ($globalDBdriver == 'mysql') { |
| 9182 | 9182 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 9183 | 9183 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -9198,7 +9198,7 @@ discard block |
||
| 9198 | 9198 | $date_array = array(); |
| 9199 | 9199 | $temp_array = array(); |
| 9200 | 9200 | |
| 9201 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9201 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9202 | 9202 | { |
| 9203 | 9203 | $temp_array['date_name'] = $row['date_name']; |
| 9204 | 9204 | $temp_array['date_count'] = $row['date_count']; |
@@ -9219,7 +9219,7 @@ discard block |
||
| 9219 | 9219 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 9220 | 9220 | { |
| 9221 | 9221 | global $globalTimezone, $globalDBdriver; |
| 9222 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9222 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9223 | 9223 | if ($globalTimezone != '') { |
| 9224 | 9224 | date_default_timezone_set($globalTimezone); |
| 9225 | 9225 | $datetime = new DateTime(); |
@@ -9227,13 +9227,13 @@ discard block |
||
| 9227 | 9227 | } else $offset = '+00:00'; |
| 9228 | 9228 | |
| 9229 | 9229 | if ($globalDBdriver == 'mysql') { |
| 9230 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 9230 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 9231 | 9231 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH) |
| 9232 | 9232 | GROUP BY spotter_output.airline_icao, date_name |
| 9233 | 9233 | ORDER BY spotter_output.date ASC"; |
| 9234 | 9234 | $query_data = array(':offset' => $offset); |
| 9235 | 9235 | } else { |
| 9236 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 9236 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 9237 | 9237 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS' |
| 9238 | 9238 | GROUP BY spotter_output.airline_icao, date_name |
| 9239 | 9239 | ORDER BY date_name ASC"; |
@@ -9246,7 +9246,7 @@ discard block |
||
| 9246 | 9246 | $date_array = array(); |
| 9247 | 9247 | $temp_array = array(); |
| 9248 | 9248 | |
| 9249 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9249 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9250 | 9250 | { |
| 9251 | 9251 | $temp_array['date_name'] = $row['date_name']; |
| 9252 | 9252 | $temp_array['date_count'] = $row['date_count']; |
@@ -9293,7 +9293,7 @@ discard block |
||
| 9293 | 9293 | $date_array = array(); |
| 9294 | 9294 | $temp_array = array(); |
| 9295 | 9295 | |
| 9296 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9296 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9297 | 9297 | { |
| 9298 | 9298 | $temp_array['month_name'] = $row['month_name']; |
| 9299 | 9299 | $temp_array['year_name'] = $row['year_name']; |
@@ -9314,7 +9314,7 @@ discard block |
||
| 9314 | 9314 | public function countAllMonthsByAirlines($filters = array()) |
| 9315 | 9315 | { |
| 9316 | 9316 | global $globalTimezone, $globalDBdriver; |
| 9317 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9317 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9318 | 9318 | if ($globalTimezone != '') { |
| 9319 | 9319 | date_default_timezone_set($globalTimezone); |
| 9320 | 9320 | $datetime = new DateTime(); |
@@ -9322,12 +9322,12 @@ discard block |
||
| 9322 | 9322 | } else $offset = '+00:00'; |
| 9323 | 9323 | |
| 9324 | 9324 | if ($globalDBdriver == 'mysql') { |
| 9325 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 9325 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 9326 | 9326 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 9327 | 9327 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9328 | 9328 | ORDER BY date_count DESC"; |
| 9329 | 9329 | } else { |
| 9330 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 9330 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 9331 | 9331 | FROM spotter_output |
| 9332 | 9332 | WHERE spotter_output.airline_icao <> '' |
| 9333 | 9333 | GROUP BY spotter_output.airline_icao, year_name, month_name |
@@ -9341,7 +9341,7 @@ discard block |
||
| 9341 | 9341 | $date_array = array(); |
| 9342 | 9342 | $temp_array = array(); |
| 9343 | 9343 | |
| 9344 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9344 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9345 | 9345 | { |
| 9346 | 9346 | $temp_array['month_name'] = $row['month_name']; |
| 9347 | 9347 | $temp_array['year_name'] = $row['year_name']; |
@@ -9368,14 +9368,14 @@ discard block |
||
| 9368 | 9368 | $datetime = new DateTime(); |
| 9369 | 9369 | $offset = $datetime->format('P'); |
| 9370 | 9370 | } else $offset = '+00:00'; |
| 9371 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9371 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9372 | 9372 | if ($globalDBdriver == 'mysql') { |
| 9373 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 9373 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 9374 | 9374 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 9375 | 9375 | GROUP BY year_name, month_name |
| 9376 | 9376 | ORDER BY date_count DESC"; |
| 9377 | 9377 | } else { |
| 9378 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 9378 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 9379 | 9379 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 9380 | 9380 | GROUP BY year_name, month_name |
| 9381 | 9381 | ORDER BY date_count DESC"; |
@@ -9387,7 +9387,7 @@ discard block |
||
| 9387 | 9387 | $date_array = array(); |
| 9388 | 9388 | $temp_array = array(); |
| 9389 | 9389 | |
| 9390 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9390 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9391 | 9391 | { |
| 9392 | 9392 | $temp_array['month_name'] = $row['month_name']; |
| 9393 | 9393 | $temp_array['year_name'] = $row['year_name']; |
@@ -9413,15 +9413,15 @@ discard block |
||
| 9413 | 9413 | $datetime = new DateTime(); |
| 9414 | 9414 | $offset = $datetime->format('P'); |
| 9415 | 9415 | } else $offset = '+00:00'; |
| 9416 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9416 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9417 | 9417 | |
| 9418 | 9418 | if ($globalDBdriver == 'mysql') { |
| 9419 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 9419 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 9420 | 9420 | FROM spotter_output".$filter_query." owner_name <> '' |
| 9421 | 9421 | GROUP BY year_name, month_name |
| 9422 | 9422 | ORDER BY date_count DESC"; |
| 9423 | 9423 | } else { |
| 9424 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 9424 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 9425 | 9425 | FROM spotter_output".$filter_query." owner_name <> '' |
| 9426 | 9426 | GROUP BY year_name, month_name |
| 9427 | 9427 | ORDER BY date_count DESC"; |
@@ -9433,7 +9433,7 @@ discard block |
||
| 9433 | 9433 | $date_array = array(); |
| 9434 | 9434 | $temp_array = array(); |
| 9435 | 9435 | |
| 9436 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9436 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9437 | 9437 | { |
| 9438 | 9438 | $temp_array['month_name'] = $row['month_name']; |
| 9439 | 9439 | $temp_array['year_name'] = $row['year_name']; |
@@ -9454,7 +9454,7 @@ discard block |
||
| 9454 | 9454 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 9455 | 9455 | { |
| 9456 | 9456 | global $globalTimezone, $globalDBdriver; |
| 9457 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9457 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9458 | 9458 | if ($globalTimezone != '') { |
| 9459 | 9459 | date_default_timezone_set($globalTimezone); |
| 9460 | 9460 | $datetime = new DateTime(); |
@@ -9462,12 +9462,12 @@ discard block |
||
| 9462 | 9462 | } else $offset = '+00:00'; |
| 9463 | 9463 | |
| 9464 | 9464 | if ($globalDBdriver == 'mysql') { |
| 9465 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 9465 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 9466 | 9466 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 9467 | 9467 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9468 | 9468 | ORDER BY date_count DESC"; |
| 9469 | 9469 | } else { |
| 9470 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 9470 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 9471 | 9471 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 9472 | 9472 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9473 | 9473 | ORDER BY date_count DESC"; |
@@ -9479,7 +9479,7 @@ discard block |
||
| 9479 | 9479 | $date_array = array(); |
| 9480 | 9480 | $temp_array = array(); |
| 9481 | 9481 | |
| 9482 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9482 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9483 | 9483 | { |
| 9484 | 9484 | $temp_array['month_name'] = $row['month_name']; |
| 9485 | 9485 | $temp_array['year_name'] = $row['year_name']; |
@@ -9506,15 +9506,15 @@ discard block |
||
| 9506 | 9506 | $datetime = new DateTime(); |
| 9507 | 9507 | $offset = $datetime->format('P'); |
| 9508 | 9508 | } else $offset = '+00:00'; |
| 9509 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9509 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9510 | 9510 | |
| 9511 | 9511 | if ($globalDBdriver == 'mysql') { |
| 9512 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 9512 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 9513 | 9513 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 9514 | 9514 | GROUP BY year_name, month_name |
| 9515 | 9515 | ORDER BY date_count DESC"; |
| 9516 | 9516 | } else { |
| 9517 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 9517 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 9518 | 9518 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 9519 | 9519 | GROUP BY year_name, month_name |
| 9520 | 9520 | ORDER BY date_count DESC"; |
@@ -9526,7 +9526,7 @@ discard block |
||
| 9526 | 9526 | $date_array = array(); |
| 9527 | 9527 | $temp_array = array(); |
| 9528 | 9528 | |
| 9529 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9529 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9530 | 9530 | { |
| 9531 | 9531 | $temp_array['month_name'] = $row['month_name']; |
| 9532 | 9532 | $temp_array['year_name'] = $row['year_name']; |
@@ -9547,7 +9547,7 @@ discard block |
||
| 9547 | 9547 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 9548 | 9548 | { |
| 9549 | 9549 | global $globalTimezone, $globalDBdriver; |
| 9550 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9550 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9551 | 9551 | if ($globalTimezone != '') { |
| 9552 | 9552 | date_default_timezone_set($globalTimezone); |
| 9553 | 9553 | $datetime = new DateTime(); |
@@ -9555,12 +9555,12 @@ discard block |
||
| 9555 | 9555 | } else $offset = '+00:00'; |
| 9556 | 9556 | |
| 9557 | 9557 | if ($globalDBdriver == 'mysql') { |
| 9558 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 9558 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 9559 | 9559 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 9560 | 9560 | GROUP BY spotter_output.airline_icao,year_name, month_name |
| 9561 | 9561 | ORDER BY date_count DESC"; |
| 9562 | 9562 | } else { |
| 9563 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 9563 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 9564 | 9564 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 9565 | 9565 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9566 | 9566 | ORDER BY date_count DESC"; |
@@ -9572,7 +9572,7 @@ discard block |
||
| 9572 | 9572 | $date_array = array(); |
| 9573 | 9573 | $temp_array = array(); |
| 9574 | 9574 | |
| 9575 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9575 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9576 | 9576 | { |
| 9577 | 9577 | $temp_array['month_name'] = $row['month_name']; |
| 9578 | 9578 | $temp_array['year_name'] = $row['year_name']; |
@@ -9594,7 +9594,7 @@ discard block |
||
| 9594 | 9594 | public function countAllMonthsAirlines($filters = array()) |
| 9595 | 9595 | { |
| 9596 | 9596 | global $globalTimezone, $globalDBdriver; |
| 9597 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9597 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9598 | 9598 | if ($globalTimezone != '') { |
| 9599 | 9599 | date_default_timezone_set($globalTimezone); |
| 9600 | 9600 | $datetime = new DateTime(); |
@@ -9602,12 +9602,12 @@ discard block |
||
| 9602 | 9602 | } else $offset = '+00:00'; |
| 9603 | 9603 | |
| 9604 | 9604 | if ($globalDBdriver == 'mysql') { |
| 9605 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
| 9605 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
| 9606 | 9606 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 9607 | 9607 | GROUP BY year_name, month_name |
| 9608 | 9608 | ORDER BY date_count DESC"; |
| 9609 | 9609 | } else { |
| 9610 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 9610 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 9611 | 9611 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 9612 | 9612 | GROUP BY year_name, month_name |
| 9613 | 9613 | ORDER BY date_count DESC"; |
@@ -9619,7 +9619,7 @@ discard block |
||
| 9619 | 9619 | $date_array = array(); |
| 9620 | 9620 | $temp_array = array(); |
| 9621 | 9621 | |
| 9622 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9622 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9623 | 9623 | { |
| 9624 | 9624 | $temp_array['month_name'] = $row['month_name']; |
| 9625 | 9625 | $temp_array['year_name'] = $row['year_name']; |
@@ -9645,15 +9645,15 @@ discard block |
||
| 9645 | 9645 | $datetime = new DateTime(); |
| 9646 | 9646 | $offset = $datetime->format('P'); |
| 9647 | 9647 | } else $offset = '+00:00'; |
| 9648 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9648 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9649 | 9649 | |
| 9650 | 9650 | if ($globalDBdriver == 'mysql') { |
| 9651 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 9651 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 9652 | 9652 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 9653 | 9653 | GROUP BY year_name, month_name |
| 9654 | 9654 | ORDER BY date_count DESC"; |
| 9655 | 9655 | } else { |
| 9656 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 9656 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 9657 | 9657 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 9658 | 9658 | GROUP BY year_name, month_name |
| 9659 | 9659 | ORDER BY date_count DESC"; |
@@ -9665,7 +9665,7 @@ discard block |
||
| 9665 | 9665 | $date_array = array(); |
| 9666 | 9666 | $temp_array = array(); |
| 9667 | 9667 | |
| 9668 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9668 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9669 | 9669 | { |
| 9670 | 9670 | $temp_array['month_name'] = $row['month_name']; |
| 9671 | 9671 | $temp_array['year_name'] = $row['year_name']; |
@@ -9687,7 +9687,7 @@ discard block |
||
| 9687 | 9687 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 9688 | 9688 | { |
| 9689 | 9689 | global $globalTimezone, $globalDBdriver; |
| 9690 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9690 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9691 | 9691 | if ($globalTimezone != '') { |
| 9692 | 9692 | date_default_timezone_set($globalTimezone); |
| 9693 | 9693 | $datetime = new DateTime(); |
@@ -9695,12 +9695,12 @@ discard block |
||
| 9695 | 9695 | } else $offset = '+00:00'; |
| 9696 | 9696 | |
| 9697 | 9697 | if ($globalDBdriver == 'mysql') { |
| 9698 | - $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 9698 | + $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 9699 | 9699 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 9700 | 9700 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9701 | 9701 | ORDER BY date_count DESC"; |
| 9702 | 9702 | } else { |
| 9703 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 9703 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 9704 | 9704 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 9705 | 9705 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9706 | 9706 | ORDER BY date_count DESC"; |
@@ -9712,7 +9712,7 @@ discard block |
||
| 9712 | 9712 | $date_array = array(); |
| 9713 | 9713 | $temp_array = array(); |
| 9714 | 9714 | |
| 9715 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9715 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9716 | 9716 | { |
| 9717 | 9717 | $temp_array['month_name'] = $row['month_name']; |
| 9718 | 9718 | $temp_array['year_name'] = $row['year_name']; |
@@ -9739,15 +9739,15 @@ discard block |
||
| 9739 | 9739 | $datetime = new DateTime(); |
| 9740 | 9740 | $offset = $datetime->format('P'); |
| 9741 | 9741 | } else $offset = '+00:00'; |
| 9742 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9742 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9743 | 9743 | |
| 9744 | 9744 | if ($globalDBdriver == 'mysql') { |
| 9745 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9745 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9746 | 9746 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 9747 | 9747 | GROUP BY year_name, month_name |
| 9748 | 9748 | ORDER BY date_count DESC"; |
| 9749 | 9749 | } else { |
| 9750 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9750 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9751 | 9751 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 9752 | 9752 | GROUP BY year_name, month_name |
| 9753 | 9753 | ORDER BY date_count DESC"; |
@@ -9759,7 +9759,7 @@ discard block |
||
| 9759 | 9759 | $date_array = array(); |
| 9760 | 9760 | $temp_array = array(); |
| 9761 | 9761 | |
| 9762 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9762 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9763 | 9763 | { |
| 9764 | 9764 | $temp_array['month_name'] = $row['month_name']; |
| 9765 | 9765 | $temp_array['year_name'] = $row['year_name']; |
@@ -9781,7 +9781,7 @@ discard block |
||
| 9781 | 9781 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 9782 | 9782 | { |
| 9783 | 9783 | global $globalTimezone, $globalDBdriver; |
| 9784 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9784 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9785 | 9785 | if ($globalTimezone != '') { |
| 9786 | 9786 | date_default_timezone_set($globalTimezone); |
| 9787 | 9787 | $datetime = new DateTime(); |
@@ -9789,12 +9789,12 @@ discard block |
||
| 9789 | 9789 | } else $offset = '+00:00'; |
| 9790 | 9790 | |
| 9791 | 9791 | if ($globalDBdriver == 'mysql') { |
| 9792 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9792 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9793 | 9793 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 9794 | 9794 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9795 | 9795 | ORDER BY date_count DESC"; |
| 9796 | 9796 | } else { |
| 9797 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9797 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 9798 | 9798 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 9799 | 9799 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 9800 | 9800 | ORDER BY date_count DESC"; |
@@ -9806,7 +9806,7 @@ discard block |
||
| 9806 | 9806 | $date_array = array(); |
| 9807 | 9807 | $temp_array = array(); |
| 9808 | 9808 | |
| 9809 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9809 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9810 | 9810 | { |
| 9811 | 9811 | $temp_array['month_name'] = $row['month_name']; |
| 9812 | 9812 | $temp_array['year_name'] = $row['year_name']; |
@@ -9834,7 +9834,7 @@ discard block |
||
| 9834 | 9834 | $datetime = new DateTime(); |
| 9835 | 9835 | $offset = $datetime->format('P'); |
| 9836 | 9836 | } else $offset = '+00:00'; |
| 9837 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9837 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9838 | 9838 | if ($globalDBdriver == 'mysql') { |
| 9839 | 9839 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 9840 | 9840 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -9855,7 +9855,7 @@ discard block |
||
| 9855 | 9855 | $date_array = array(); |
| 9856 | 9856 | $temp_array = array(); |
| 9857 | 9857 | |
| 9858 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9858 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9859 | 9859 | { |
| 9860 | 9860 | $temp_array['year_name'] = $row['year_name']; |
| 9861 | 9861 | $temp_array['month_name'] = $row['month_name']; |
@@ -9875,7 +9875,7 @@ discard block |
||
| 9875 | 9875 | * @return Array the hour list |
| 9876 | 9876 | * |
| 9877 | 9877 | */ |
| 9878 | - public function countAllHours($orderby,$filters = array()) |
|
| 9878 | + public function countAllHours($orderby, $filters = array()) |
|
| 9879 | 9879 | { |
| 9880 | 9880 | global $globalTimezone, $globalDBdriver; |
| 9881 | 9881 | if ($globalTimezone != '') { |
@@ -9923,7 +9923,7 @@ discard block |
||
| 9923 | 9923 | $hour_array = array(); |
| 9924 | 9924 | $temp_array = array(); |
| 9925 | 9925 | |
| 9926 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9926 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9927 | 9927 | { |
| 9928 | 9928 | $temp_array['hour_name'] = $row['hour_name']; |
| 9929 | 9929 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9943,7 +9943,7 @@ discard block |
||
| 9943 | 9943 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 9944 | 9944 | { |
| 9945 | 9945 | global $globalTimezone, $globalDBdriver; |
| 9946 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9946 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9947 | 9947 | if ($globalTimezone != '') { |
| 9948 | 9948 | date_default_timezone_set($globalTimezone); |
| 9949 | 9949 | $datetime = new DateTime(); |
@@ -9961,7 +9961,7 @@ discard block |
||
| 9961 | 9961 | } |
| 9962 | 9962 | |
| 9963 | 9963 | if ($globalDBdriver == 'mysql') { |
| 9964 | - $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9964 | + $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9965 | 9965 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 9966 | 9966 | GROUP BY spotter_output.airline_icao, hour_name |
| 9967 | 9967 | ".$orderby_sql; |
@@ -9974,7 +9974,7 @@ discard block |
||
| 9974 | 9974 | */ |
| 9975 | 9975 | $query_data = array(':offset' => $offset); |
| 9976 | 9976 | } else { |
| 9977 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9977 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9978 | 9978 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 9979 | 9979 | GROUP BY spotter_output.airline_icao, hour_name |
| 9980 | 9980 | ".$orderby_sql; |
@@ -9987,7 +9987,7 @@ discard block |
||
| 9987 | 9987 | $hour_array = array(); |
| 9988 | 9988 | $temp_array = array(); |
| 9989 | 9989 | |
| 9990 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9990 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9991 | 9991 | { |
| 9992 | 9992 | $temp_array['hour_name'] = $row['hour_name']; |
| 9993 | 9993 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10010,34 +10010,34 @@ discard block |
||
| 10010 | 10010 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 10011 | 10011 | { |
| 10012 | 10012 | global $globalTimezone, $globalDBdriver; |
| 10013 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10013 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10014 | 10014 | if ($globalTimezone != '') { |
| 10015 | 10015 | date_default_timezone_set($globalTimezone); |
| 10016 | 10016 | $datetime = new DateTime(); |
| 10017 | 10017 | $offset = $datetime->format('P'); |
| 10018 | 10018 | } else $offset = '+00:00'; |
| 10019 | 10019 | |
| 10020 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 10020 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 10021 | 10021 | |
| 10022 | 10022 | if ($globalDBdriver == 'mysql') { |
| 10023 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10023 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10024 | 10024 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 10025 | 10025 | GROUP BY hour_name |
| 10026 | 10026 | ORDER BY hour_name ASC"; |
| 10027 | 10027 | } else { |
| 10028 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10028 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10029 | 10029 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 10030 | 10030 | GROUP BY hour_name |
| 10031 | 10031 | ORDER BY hour_name ASC"; |
| 10032 | 10032 | } |
| 10033 | 10033 | |
| 10034 | 10034 | $sth = $this->db->prepare($query); |
| 10035 | - $sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
|
| 10035 | + $sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset)); |
|
| 10036 | 10036 | |
| 10037 | 10037 | $hour_array = array(); |
| 10038 | 10038 | $temp_array = array(); |
| 10039 | 10039 | |
| 10040 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10040 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10041 | 10041 | { |
| 10042 | 10042 | $temp_array['hour_name'] = $row['hour_name']; |
| 10043 | 10043 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10060,8 +10060,8 @@ discard block |
||
| 10060 | 10060 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 10061 | 10061 | { |
| 10062 | 10062 | global $globalTimezone, $globalDBdriver; |
| 10063 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10064 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 10063 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10064 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 10065 | 10065 | if ($globalTimezone != '') { |
| 10066 | 10066 | date_default_timezone_set($globalTimezone); |
| 10067 | 10067 | $datetime = new DateTime(); |
@@ -10069,24 +10069,24 @@ discard block |
||
| 10069 | 10069 | } else $offset = '+00:00'; |
| 10070 | 10070 | |
| 10071 | 10071 | if ($globalDBdriver == 'mysql') { |
| 10072 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10072 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10073 | 10073 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 10074 | 10074 | GROUP BY hour_name |
| 10075 | 10075 | ORDER BY hour_name ASC"; |
| 10076 | 10076 | } else { |
| 10077 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10077 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10078 | 10078 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 10079 | 10079 | GROUP BY hour_name |
| 10080 | 10080 | ORDER BY hour_name ASC"; |
| 10081 | 10081 | } |
| 10082 | 10082 | |
| 10083 | 10083 | $sth = $this->db->prepare($query); |
| 10084 | - $sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
|
| 10084 | + $sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset)); |
|
| 10085 | 10085 | |
| 10086 | 10086 | $hour_array = array(); |
| 10087 | 10087 | $temp_array = array(); |
| 10088 | 10088 | |
| 10089 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10089 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10090 | 10090 | { |
| 10091 | 10091 | $temp_array['hour_name'] = $row['hour_name']; |
| 10092 | 10092 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10107,8 +10107,8 @@ discard block |
||
| 10107 | 10107 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 10108 | 10108 | { |
| 10109 | 10109 | global $globalTimezone, $globalDBdriver; |
| 10110 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10111 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 10110 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10111 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 10112 | 10112 | if ($globalTimezone != '') { |
| 10113 | 10113 | date_default_timezone_set($globalTimezone); |
| 10114 | 10114 | $datetime = new DateTime(); |
@@ -10116,24 +10116,24 @@ discard block |
||
| 10116 | 10116 | } else $offset = '+00:00'; |
| 10117 | 10117 | |
| 10118 | 10118 | if ($globalDBdriver == 'mysql') { |
| 10119 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10119 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10120 | 10120 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 10121 | 10121 | GROUP BY hour_name |
| 10122 | 10122 | ORDER BY hour_name ASC"; |
| 10123 | 10123 | } else { |
| 10124 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10124 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10125 | 10125 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 10126 | 10126 | GROUP BY hour_name |
| 10127 | 10127 | ORDER BY hour_name ASC"; |
| 10128 | 10128 | } |
| 10129 | 10129 | |
| 10130 | 10130 | $sth = $this->db->prepare($query); |
| 10131 | - $sth->execute(array(':registration' => $registration,':offset' => $offset)); |
|
| 10131 | + $sth->execute(array(':registration' => $registration, ':offset' => $offset)); |
|
| 10132 | 10132 | |
| 10133 | 10133 | $hour_array = array(); |
| 10134 | 10134 | $temp_array = array(); |
| 10135 | 10135 | |
| 10136 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10136 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10137 | 10137 | { |
| 10138 | 10138 | $temp_array['hour_name'] = $row['hour_name']; |
| 10139 | 10139 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10154,8 +10154,8 @@ discard block |
||
| 10154 | 10154 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 10155 | 10155 | { |
| 10156 | 10156 | global $globalTimezone, $globalDBdriver; |
| 10157 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10158 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 10157 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10158 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 10159 | 10159 | if ($globalTimezone != '') { |
| 10160 | 10160 | date_default_timezone_set($globalTimezone); |
| 10161 | 10161 | $datetime = new DateTime(); |
@@ -10163,24 +10163,24 @@ discard block |
||
| 10163 | 10163 | } else $offset = '+00:00'; |
| 10164 | 10164 | |
| 10165 | 10165 | if ($globalDBdriver == 'mysql') { |
| 10166 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10166 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10167 | 10167 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 10168 | 10168 | GROUP BY hour_name |
| 10169 | 10169 | ORDER BY hour_name ASC"; |
| 10170 | 10170 | } else { |
| 10171 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10171 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10172 | 10172 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 10173 | 10173 | GROUP BY hour_name |
| 10174 | 10174 | ORDER BY hour_name ASC"; |
| 10175 | 10175 | } |
| 10176 | 10176 | |
| 10177 | 10177 | $sth = $this->db->prepare($query); |
| 10178 | - $sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
|
| 10178 | + $sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset)); |
|
| 10179 | 10179 | |
| 10180 | 10180 | $hour_array = array(); |
| 10181 | 10181 | $temp_array = array(); |
| 10182 | 10182 | |
| 10183 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10183 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10184 | 10184 | { |
| 10185 | 10185 | $temp_array['hour_name'] = $row['hour_name']; |
| 10186 | 10186 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10199,11 +10199,11 @@ discard block |
||
| 10199 | 10199 | * @return Array the hour list |
| 10200 | 10200 | * |
| 10201 | 10201 | */ |
| 10202 | - public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
|
| 10202 | + public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 10203 | 10203 | { |
| 10204 | 10204 | global $globalTimezone, $globalDBdriver; |
| 10205 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10206 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 10205 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10206 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 10207 | 10207 | if ($globalTimezone != '') { |
| 10208 | 10208 | date_default_timezone_set($globalTimezone); |
| 10209 | 10209 | $datetime = new DateTime(); |
@@ -10211,24 +10211,24 @@ discard block |
||
| 10211 | 10211 | } else $offset = '+00:00'; |
| 10212 | 10212 | |
| 10213 | 10213 | if ($globalDBdriver == 'mysql') { |
| 10214 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10214 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10215 | 10215 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 10216 | 10216 | GROUP BY hour_name |
| 10217 | 10217 | ORDER BY hour_name ASC"; |
| 10218 | 10218 | } else { |
| 10219 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10219 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10220 | 10220 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 10221 | 10221 | GROUP BY hour_name |
| 10222 | 10222 | ORDER BY hour_name ASC"; |
| 10223 | 10223 | } |
| 10224 | 10224 | |
| 10225 | 10225 | $sth = $this->db->prepare($query); |
| 10226 | - $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
|
| 10226 | + $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset)); |
|
| 10227 | 10227 | |
| 10228 | 10228 | $hour_array = array(); |
| 10229 | 10229 | $temp_array = array(); |
| 10230 | 10230 | |
| 10231 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10231 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10232 | 10232 | { |
| 10233 | 10233 | $temp_array['hour_name'] = $row['hour_name']; |
| 10234 | 10234 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10250,8 +10250,8 @@ discard block |
||
| 10250 | 10250 | public function countAllHoursByDate($date, $filters = array()) |
| 10251 | 10251 | { |
| 10252 | 10252 | global $globalTimezone, $globalDBdriver; |
| 10253 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10254 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 10253 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10254 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 10255 | 10255 | if ($globalTimezone != '') { |
| 10256 | 10256 | date_default_timezone_set($globalTimezone); |
| 10257 | 10257 | $datetime = new DateTime($date); |
@@ -10259,12 +10259,12 @@ discard block |
||
| 10259 | 10259 | } else $offset = '+00:00'; |
| 10260 | 10260 | |
| 10261 | 10261 | if ($globalDBdriver == 'mysql') { |
| 10262 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10262 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10263 | 10263 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 10264 | 10264 | GROUP BY hour_name |
| 10265 | 10265 | ORDER BY hour_name ASC"; |
| 10266 | 10266 | } else { |
| 10267 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10267 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10268 | 10268 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 10269 | 10269 | GROUP BY hour_name |
| 10270 | 10270 | ORDER BY hour_name ASC"; |
@@ -10276,7 +10276,7 @@ discard block |
||
| 10276 | 10276 | $hour_array = array(); |
| 10277 | 10277 | $temp_array = array(); |
| 10278 | 10278 | |
| 10279 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10279 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10280 | 10280 | { |
| 10281 | 10281 | $temp_array['hour_name'] = $row['hour_name']; |
| 10282 | 10282 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10298,8 +10298,8 @@ discard block |
||
| 10298 | 10298 | public function countAllHoursByIdent($ident, $filters = array()) |
| 10299 | 10299 | { |
| 10300 | 10300 | global $globalTimezone, $globalDBdriver; |
| 10301 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10302 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 10301 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10302 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 10303 | 10303 | if ($globalTimezone != '') { |
| 10304 | 10304 | date_default_timezone_set($globalTimezone); |
| 10305 | 10305 | $datetime = new DateTime(); |
@@ -10307,12 +10307,12 @@ discard block |
||
| 10307 | 10307 | } else $offset = '+00:00'; |
| 10308 | 10308 | |
| 10309 | 10309 | if ($globalDBdriver == 'mysql') { |
| 10310 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10310 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10311 | 10311 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 10312 | 10312 | GROUP BY hour_name |
| 10313 | 10313 | ORDER BY hour_name ASC"; |
| 10314 | 10314 | } else { |
| 10315 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10315 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10316 | 10316 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 10317 | 10317 | GROUP BY hour_name |
| 10318 | 10318 | ORDER BY hour_name ASC"; |
@@ -10320,12 +10320,12 @@ discard block |
||
| 10320 | 10320 | |
| 10321 | 10321 | |
| 10322 | 10322 | $sth = $this->db->prepare($query); |
| 10323 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 10323 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 10324 | 10324 | |
| 10325 | 10325 | $hour_array = array(); |
| 10326 | 10326 | $temp_array = array(); |
| 10327 | 10327 | |
| 10328 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10328 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10329 | 10329 | { |
| 10330 | 10330 | $temp_array['hour_name'] = $row['hour_name']; |
| 10331 | 10331 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10345,8 +10345,8 @@ discard block |
||
| 10345 | 10345 | public function countAllHoursByOwner($owner, $filters = array()) |
| 10346 | 10346 | { |
| 10347 | 10347 | global $globalTimezone, $globalDBdriver; |
| 10348 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10349 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 10348 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10349 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 10350 | 10350 | if ($globalTimezone != '') { |
| 10351 | 10351 | date_default_timezone_set($globalTimezone); |
| 10352 | 10352 | $datetime = new DateTime(); |
@@ -10354,12 +10354,12 @@ discard block |
||
| 10354 | 10354 | } else $offset = '+00:00'; |
| 10355 | 10355 | |
| 10356 | 10356 | if ($globalDBdriver == 'mysql') { |
| 10357 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10357 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10358 | 10358 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner |
| 10359 | 10359 | GROUP BY hour_name |
| 10360 | 10360 | ORDER BY hour_name ASC"; |
| 10361 | 10361 | } else { |
| 10362 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10362 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10363 | 10363 | FROM spotter_output".$filter_query." spotter_output.owner_name = :owner |
| 10364 | 10364 | GROUP BY hour_name |
| 10365 | 10365 | ORDER BY hour_name ASC"; |
@@ -10367,12 +10367,12 @@ discard block |
||
| 10367 | 10367 | |
| 10368 | 10368 | |
| 10369 | 10369 | $sth = $this->db->prepare($query); |
| 10370 | - $sth->execute(array(':owner' => $owner,':offset' => $offset)); |
|
| 10370 | + $sth->execute(array(':owner' => $owner, ':offset' => $offset)); |
|
| 10371 | 10371 | |
| 10372 | 10372 | $hour_array = array(); |
| 10373 | 10373 | $temp_array = array(); |
| 10374 | 10374 | |
| 10375 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10375 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10376 | 10376 | { |
| 10377 | 10377 | $temp_array['hour_name'] = $row['hour_name']; |
| 10378 | 10378 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10392,8 +10392,8 @@ discard block |
||
| 10392 | 10392 | public function countAllHoursByPilot($pilot, $filters = array()) |
| 10393 | 10393 | { |
| 10394 | 10394 | global $globalTimezone, $globalDBdriver; |
| 10395 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10396 | - $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
|
| 10395 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10396 | + $pilot = filter_var($pilot, FILTER_SANITIZE_STRING); |
|
| 10397 | 10397 | if ($globalTimezone != '') { |
| 10398 | 10398 | date_default_timezone_set($globalTimezone); |
| 10399 | 10399 | $datetime = new DateTime(); |
@@ -10401,12 +10401,12 @@ discard block |
||
| 10401 | 10401 | } else $offset = '+00:00'; |
| 10402 | 10402 | |
| 10403 | 10403 | if ($globalDBdriver == 'mysql') { |
| 10404 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10404 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10405 | 10405 | FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 10406 | 10406 | GROUP BY hour_name |
| 10407 | 10407 | ORDER BY hour_name ASC"; |
| 10408 | 10408 | } else { |
| 10409 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10409 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10410 | 10410 | FROM spotter_output".$filter_query." (spotter_output.pilot_name = :pilot OR spotter_output.pilot_id = :pilot) |
| 10411 | 10411 | GROUP BY hour_name |
| 10412 | 10412 | ORDER BY hour_name ASC"; |
@@ -10414,12 +10414,12 @@ discard block |
||
| 10414 | 10414 | |
| 10415 | 10415 | |
| 10416 | 10416 | $sth = $this->db->prepare($query); |
| 10417 | - $sth->execute(array(':pilot' => $pilot,':offset' => $offset)); |
|
| 10417 | + $sth->execute(array(':pilot' => $pilot, ':offset' => $offset)); |
|
| 10418 | 10418 | |
| 10419 | 10419 | $hour_array = array(); |
| 10420 | 10420 | $temp_array = array(); |
| 10421 | 10421 | |
| 10422 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10422 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10423 | 10423 | { |
| 10424 | 10424 | $temp_array['hour_name'] = $row['hour_name']; |
| 10425 | 10425 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10438,12 +10438,12 @@ discard block |
||
| 10438 | 10438 | * @return Array the hour list |
| 10439 | 10439 | * |
| 10440 | 10440 | */ |
| 10441 | - public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
|
| 10441 | + public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 10442 | 10442 | { |
| 10443 | 10443 | global $globalTimezone, $globalDBdriver; |
| 10444 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10445 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 10446 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 10444 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10445 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 10446 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 10447 | 10447 | if ($globalTimezone != '') { |
| 10448 | 10448 | date_default_timezone_set($globalTimezone); |
| 10449 | 10449 | $datetime = new DateTime(); |
@@ -10451,24 +10451,24 @@ discard block |
||
| 10451 | 10451 | } else $offset = '+00:00'; |
| 10452 | 10452 | |
| 10453 | 10453 | if ($globalDBdriver == 'mysql') { |
| 10454 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10454 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10455 | 10455 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 10456 | 10456 | GROUP BY hour_name |
| 10457 | 10457 | ORDER BY hour_name ASC"; |
| 10458 | 10458 | } else { |
| 10459 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10459 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10460 | 10460 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 10461 | 10461 | GROUP BY hour_name |
| 10462 | 10462 | ORDER BY hour_name ASC"; |
| 10463 | 10463 | } |
| 10464 | 10464 | |
| 10465 | 10465 | $sth = $this->db->prepare($query); |
| 10466 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset)); |
|
| 10466 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset)); |
|
| 10467 | 10467 | |
| 10468 | 10468 | $hour_array = array(); |
| 10469 | 10469 | $temp_array = array(); |
| 10470 | 10470 | |
| 10471 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10471 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10472 | 10472 | { |
| 10473 | 10473 | $temp_array['hour_name'] = $row['hour_name']; |
| 10474 | 10474 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10489,8 +10489,8 @@ discard block |
||
| 10489 | 10489 | public function countAllHoursByCountry($country, $filters = array()) |
| 10490 | 10490 | { |
| 10491 | 10491 | global $globalTimezone, $globalDBdriver; |
| 10492 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10493 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 10492 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10493 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 10494 | 10494 | if ($globalTimezone != '') { |
| 10495 | 10495 | date_default_timezone_set($globalTimezone); |
| 10496 | 10496 | $datetime = new DateTime(); |
@@ -10498,24 +10498,24 @@ discard block |
||
| 10498 | 10498 | } else $offset = '+00:00'; |
| 10499 | 10499 | |
| 10500 | 10500 | if ($globalDBdriver == 'mysql') { |
| 10501 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10501 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10502 | 10502 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 10503 | 10503 | GROUP BY hour_name |
| 10504 | 10504 | ORDER BY hour_name ASC"; |
| 10505 | 10505 | } else { |
| 10506 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10506 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10507 | 10507 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 10508 | 10508 | GROUP BY hour_name |
| 10509 | 10509 | ORDER BY hour_name ASC"; |
| 10510 | 10510 | } |
| 10511 | 10511 | |
| 10512 | 10512 | $sth = $this->db->prepare($query); |
| 10513 | - $sth->execute(array(':country' => $country,':offset' => $offset)); |
|
| 10513 | + $sth->execute(array(':country' => $country, ':offset' => $offset)); |
|
| 10514 | 10514 | |
| 10515 | 10515 | $hour_array = array(); |
| 10516 | 10516 | $temp_array = array(); |
| 10517 | 10517 | |
| 10518 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10518 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10519 | 10519 | { |
| 10520 | 10520 | $temp_array['hour_name'] = $row['hour_name']; |
| 10521 | 10521 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10535,29 +10535,29 @@ discard block |
||
| 10535 | 10535 | * @return Integer the number of aircrafts |
| 10536 | 10536 | * |
| 10537 | 10537 | */ |
| 10538 | - public function countOverallAircrafts($filters = array(),$year = '',$month = '') |
|
| 10538 | + public function countOverallAircrafts($filters = array(), $year = '', $month = '') |
|
| 10539 | 10539 | { |
| 10540 | 10540 | global $globalDBdriver; |
| 10541 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10542 | - $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 10541 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10542 | + $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 10543 | 10543 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 10544 | 10544 | $query_values = array(); |
| 10545 | 10545 | if ($year != '') { |
| 10546 | 10546 | if ($globalDBdriver == 'mysql') { |
| 10547 | 10547 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 10548 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10548 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10549 | 10549 | } else { |
| 10550 | 10550 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 10551 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10551 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10552 | 10552 | } |
| 10553 | 10553 | } |
| 10554 | 10554 | if ($month != '') { |
| 10555 | 10555 | if ($globalDBdriver == 'mysql') { |
| 10556 | 10556 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10557 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10557 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10558 | 10558 | } else { |
| 10559 | 10559 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10560 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10560 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10561 | 10561 | } |
| 10562 | 10562 | } |
| 10563 | 10563 | |
@@ -10572,29 +10572,29 @@ discard block |
||
| 10572 | 10572 | * @return Integer the number of aircrafts |
| 10573 | 10573 | * |
| 10574 | 10574 | */ |
| 10575 | - public function countOverallArrival($filters = array(),$year = '',$month = '') |
|
| 10575 | + public function countOverallArrival($filters = array(), $year = '', $month = '') |
|
| 10576 | 10576 | { |
| 10577 | 10577 | global $globalDBdriver; |
| 10578 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10579 | - $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 10578 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10579 | + $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 10580 | 10580 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''"; |
| 10581 | 10581 | $query_values = array(); |
| 10582 | 10582 | if ($year != '') { |
| 10583 | 10583 | if ($globalDBdriver == 'mysql') { |
| 10584 | 10584 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 10585 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10585 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10586 | 10586 | } else { |
| 10587 | 10587 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 10588 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10588 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10589 | 10589 | } |
| 10590 | 10590 | } |
| 10591 | 10591 | if ($month != '') { |
| 10592 | 10592 | if ($globalDBdriver == 'mysql') { |
| 10593 | 10593 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10594 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10594 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10595 | 10595 | } else { |
| 10596 | 10596 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10597 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10597 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10598 | 10598 | } |
| 10599 | 10599 | } |
| 10600 | 10600 | |
@@ -10609,29 +10609,29 @@ discard block |
||
| 10609 | 10609 | * @return Integer the number of pilots |
| 10610 | 10610 | * |
| 10611 | 10611 | */ |
| 10612 | - public function countOverallPilots($filters = array(),$year = '',$month = '') |
|
| 10612 | + public function countOverallPilots($filters = array(), $year = '', $month = '') |
|
| 10613 | 10613 | { |
| 10614 | 10614 | global $globalDBdriver; |
| 10615 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10616 | - $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 10615 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10616 | + $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 10617 | 10617 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
| 10618 | 10618 | $query_values = array(); |
| 10619 | 10619 | if ($year != '') { |
| 10620 | 10620 | if ($globalDBdriver == 'mysql') { |
| 10621 | 10621 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 10622 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10622 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10623 | 10623 | } else { |
| 10624 | 10624 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 10625 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10625 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10626 | 10626 | } |
| 10627 | 10627 | } |
| 10628 | 10628 | if ($month != '') { |
| 10629 | 10629 | if ($globalDBdriver == 'mysql') { |
| 10630 | 10630 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10631 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10631 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10632 | 10632 | } else { |
| 10633 | 10633 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10634 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10634 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10635 | 10635 | } |
| 10636 | 10636 | } |
| 10637 | 10637 | $sth = $this->db->prepare($query); |
@@ -10645,29 +10645,29 @@ discard block |
||
| 10645 | 10645 | * @return Integer the number of owners |
| 10646 | 10646 | * |
| 10647 | 10647 | */ |
| 10648 | - public function countOverallOwners($filters = array(),$year = '',$month = '') |
|
| 10648 | + public function countOverallOwners($filters = array(), $year = '', $month = '') |
|
| 10649 | 10649 | { |
| 10650 | 10650 | global $globalDBdriver; |
| 10651 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10652 | - $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 10651 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10652 | + $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 10653 | 10653 | FROM spotter_output".$filter_query." spotter_output.owner_name <> ''"; |
| 10654 | 10654 | $query_values = array(); |
| 10655 | 10655 | if ($year != '') { |
| 10656 | 10656 | if ($globalDBdriver == 'mysql') { |
| 10657 | 10657 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 10658 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10658 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10659 | 10659 | } else { |
| 10660 | 10660 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 10661 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10661 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10662 | 10662 | } |
| 10663 | 10663 | } |
| 10664 | 10664 | if ($month != '') { |
| 10665 | 10665 | if ($globalDBdriver == 'mysql') { |
| 10666 | 10666 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10667 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10667 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10668 | 10668 | } else { |
| 10669 | 10669 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10670 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10670 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10671 | 10671 | } |
| 10672 | 10672 | } |
| 10673 | 10673 | $sth = $this->db->prepare($query); |
@@ -10682,32 +10682,32 @@ discard block |
||
| 10682 | 10682 | * @return Integer the number of flights |
| 10683 | 10683 | * |
| 10684 | 10684 | */ |
| 10685 | - public function countOverallFlights($filters = array(),$year = '',$month = '') |
|
| 10685 | + public function countOverallFlights($filters = array(), $year = '', $month = '') |
|
| 10686 | 10686 | { |
| 10687 | 10687 | global $globalDBdriver; |
| 10688 | - $queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output"; |
|
| 10688 | + $queryi = "SELECT COUNT(spotter_output.spotter_id) AS flight_count FROM spotter_output"; |
|
| 10689 | 10689 | $query_values = array(); |
| 10690 | 10690 | $query = ''; |
| 10691 | 10691 | if ($year != '') { |
| 10692 | 10692 | if ($globalDBdriver == 'mysql') { |
| 10693 | 10693 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 10694 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10694 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10695 | 10695 | } else { |
| 10696 | 10696 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 10697 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10697 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10698 | 10698 | } |
| 10699 | 10699 | } |
| 10700 | 10700 | if ($month != '') { |
| 10701 | 10701 | if ($globalDBdriver == 'mysql') { |
| 10702 | 10702 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10703 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10703 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10704 | 10704 | } else { |
| 10705 | 10705 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10706 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10706 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10707 | 10707 | } |
| 10708 | 10708 | } |
| 10709 | 10709 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
| 10710 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10710 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 10711 | 10711 | |
| 10712 | 10712 | //echo $query; |
| 10713 | 10713 | $sth = $this->db->prepare($queryi); |
@@ -10721,29 +10721,29 @@ discard block |
||
| 10721 | 10721 | * @return Integer the number of flights |
| 10722 | 10722 | * |
| 10723 | 10723 | */ |
| 10724 | - public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '') |
|
| 10724 | + public function countOverallMilitaryFlights($filters = array(), $year = '', $month = '') |
|
| 10725 | 10725 | { |
| 10726 | 10726 | global $globalDBdriver; |
| 10727 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10728 | - $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 10727 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10728 | + $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 10729 | 10729 | FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'"; |
| 10730 | 10730 | $query_values = array(); |
| 10731 | 10731 | if ($year != '') { |
| 10732 | 10732 | if ($globalDBdriver == 'mysql') { |
| 10733 | 10733 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 10734 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10734 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10735 | 10735 | } else { |
| 10736 | 10736 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 10737 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10737 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10738 | 10738 | } |
| 10739 | 10739 | } |
| 10740 | 10740 | if ($month != '') { |
| 10741 | 10741 | if ($globalDBdriver == 'mysql') { |
| 10742 | 10742 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10743 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10743 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10744 | 10744 | } else { |
| 10745 | 10745 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10746 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10746 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10747 | 10747 | } |
| 10748 | 10748 | } |
| 10749 | 10749 | |
@@ -10760,10 +10760,10 @@ discard block |
||
| 10760 | 10760 | * @return Integer the number of airlines |
| 10761 | 10761 | * |
| 10762 | 10762 | */ |
| 10763 | - public function countOverallAirlines($filters = array(),$year = '',$month = '') |
|
| 10763 | + public function countOverallAirlines($filters = array(), $year = '', $month = '') |
|
| 10764 | 10764 | { |
| 10765 | 10765 | global $globalDBdriver; |
| 10766 | - $queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
|
| 10766 | + $queryi = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
|
| 10767 | 10767 | FROM spotter_output"; |
| 10768 | 10768 | |
| 10769 | 10769 | $query_values = array(); |
@@ -10771,23 +10771,23 @@ discard block |
||
| 10771 | 10771 | if ($year != '') { |
| 10772 | 10772 | if ($globalDBdriver == 'mysql') { |
| 10773 | 10773 | $query .= " AND YEAR(spotter_output.date) = :year"; |
| 10774 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10774 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10775 | 10775 | } else { |
| 10776 | 10776 | $query .= " AND EXTRACT(YEAR FROM spotter_output.date) = :year"; |
| 10777 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
| 10777 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
| 10778 | 10778 | } |
| 10779 | 10779 | } |
| 10780 | 10780 | if ($month != '') { |
| 10781 | 10781 | if ($globalDBdriver == 'mysql') { |
| 10782 | 10782 | $query .= " AND MONTH(spotter_output.date) = :month"; |
| 10783 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10783 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10784 | 10784 | } else { |
| 10785 | 10785 | $query .= " AND EXTRACT(MONTH FROM spotter_output.date) = :month"; |
| 10786 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
| 10786 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
| 10787 | 10787 | } |
| 10788 | 10788 | } |
| 10789 | 10789 | if ($query == '') $queryi .= $this->getFilter($filters); |
| 10790 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 10790 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
| 10791 | 10791 | |
| 10792 | 10792 | |
| 10793 | 10793 | $sth = $this->db->prepare($queryi); |
@@ -10805,7 +10805,7 @@ discard block |
||
| 10805 | 10805 | public function countAllHoursFromToday($filters = array()) |
| 10806 | 10806 | { |
| 10807 | 10807 | global $globalTimezone, $globalDBdriver; |
| 10808 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10808 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10809 | 10809 | if ($globalTimezone != '') { |
| 10810 | 10810 | date_default_timezone_set($globalTimezone); |
| 10811 | 10811 | $datetime = new DateTime(); |
@@ -10813,12 +10813,12 @@ discard block |
||
| 10813 | 10813 | } else $offset = '+00:00'; |
| 10814 | 10814 | |
| 10815 | 10815 | if ($globalDBdriver == 'mysql') { |
| 10816 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10816 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 10817 | 10817 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE() |
| 10818 | 10818 | GROUP BY hour_name |
| 10819 | 10819 | ORDER BY hour_name ASC"; |
| 10820 | 10820 | } else { |
| 10821 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10821 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 10822 | 10822 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 10823 | 10823 | GROUP BY hour_name |
| 10824 | 10824 | ORDER BY hour_name ASC"; |
@@ -10830,7 +10830,7 @@ discard block |
||
| 10830 | 10830 | $hour_array = array(); |
| 10831 | 10831 | $temp_array = array(); |
| 10832 | 10832 | |
| 10833 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10833 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10834 | 10834 | { |
| 10835 | 10835 | $temp_array['hour_name'] = $row['hour_name']; |
| 10836 | 10836 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -10849,14 +10849,14 @@ discard block |
||
| 10849 | 10849 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 10850 | 10850 | { |
| 10851 | 10851 | global $global_query, $globalDBdriver, $globalTimezone; |
| 10852 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 10852 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 10853 | 10853 | date_default_timezone_set('UTC'); |
| 10854 | 10854 | $limit_query = ''; |
| 10855 | 10855 | if ($limit != "") |
| 10856 | 10856 | { |
| 10857 | 10857 | $limit_array = explode(",", $limit); |
| 10858 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 10859 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 10858 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 10859 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 10860 | 10860 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 10861 | 10861 | { |
| 10862 | 10862 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -10909,7 +10909,7 @@ discard block |
||
| 10909 | 10909 | GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH') |
| 10910 | 10910 | HAVING count(spotter_output.ident) > 5$orderby_query"; |
| 10911 | 10911 | //echo $query; |
| 10912 | - $spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone)); |
|
| 10912 | + $spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone)); |
|
| 10913 | 10913 | /* |
| 10914 | 10914 | $sth = $this->db->prepare($query); |
| 10915 | 10915 | $sth->execute(array(':timezone' => $globalTimezone)); |
@@ -10928,9 +10928,9 @@ discard block |
||
| 10928 | 10928 | */ |
| 10929 | 10929 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 10930 | 10930 | { |
| 10931 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 10931 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 10932 | 10932 | |
| 10933 | - $query = "SELECT spotter_output.spotter_id |
|
| 10933 | + $query = "SELECT spotter_output.spotter_id |
|
| 10934 | 10934 | FROM spotter_output |
| 10935 | 10935 | WHERE spotter_output.flightaware_id = '".$flightaware_id."'"; |
| 10936 | 10936 | |
@@ -10938,7 +10938,7 @@ discard block |
||
| 10938 | 10938 | $sth = $this->db->prepare($query); |
| 10939 | 10939 | $sth->execute(); |
| 10940 | 10940 | |
| 10941 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10941 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10942 | 10942 | { |
| 10943 | 10943 | return $row['spotter_id']; |
| 10944 | 10944 | } |
@@ -10963,23 +10963,23 @@ discard block |
||
| 10963 | 10963 | } |
| 10964 | 10964 | |
| 10965 | 10965 | $current_date = date("Y-m-d H:i:s"); |
| 10966 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 10966 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 10967 | 10967 | |
| 10968 | 10968 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 10969 | 10969 | |
| 10970 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 10970 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 10971 | 10971 | $years = $time_array['years']; |
| 10972 | 10972 | |
| 10973 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 10973 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 10974 | 10974 | $months = $time_array['months']; |
| 10975 | 10975 | |
| 10976 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 10976 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 10977 | 10977 | $days = $time_array['days']; |
| 10978 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 10978 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 10979 | 10979 | $hours = $time_array['hours']; |
| 10980 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 10980 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 10981 | 10981 | $minutes = $time_array['minutes']; |
| 10982 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 10982 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 10983 | 10983 | |
| 10984 | 10984 | return $time_array; |
| 10985 | 10985 | } |
@@ -11005,63 +11005,63 @@ discard block |
||
| 11005 | 11005 | $temp_array['direction_degree'] = $direction; |
| 11006 | 11006 | $temp_array['direction_shortname'] = "N"; |
| 11007 | 11007 | $temp_array['direction_fullname'] = "North"; |
| 11008 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 11008 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 11009 | 11009 | $temp_array['direction_degree'] = $direction; |
| 11010 | 11010 | $temp_array['direction_shortname'] = "NNE"; |
| 11011 | 11011 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 11012 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 11012 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 11013 | 11013 | $temp_array['direction_degree'] = $direction; |
| 11014 | 11014 | $temp_array['direction_shortname'] = "NE"; |
| 11015 | 11015 | $temp_array['direction_fullname'] = "Northeast"; |
| 11016 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 11016 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 11017 | 11017 | $temp_array['direction_degree'] = $direction; |
| 11018 | 11018 | $temp_array['direction_shortname'] = "ENE"; |
| 11019 | 11019 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 11020 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 11020 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 11021 | 11021 | $temp_array['direction_degree'] = $direction; |
| 11022 | 11022 | $temp_array['direction_shortname'] = "E"; |
| 11023 | 11023 | $temp_array['direction_fullname'] = "East"; |
| 11024 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 11024 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 11025 | 11025 | $temp_array['direction_degree'] = $direction; |
| 11026 | 11026 | $temp_array['direction_shortname'] = "ESE"; |
| 11027 | 11027 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 11028 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 11028 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 11029 | 11029 | $temp_array['direction_degree'] = $direction; |
| 11030 | 11030 | $temp_array['direction_shortname'] = "SE"; |
| 11031 | 11031 | $temp_array['direction_fullname'] = "Southeast"; |
| 11032 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 11032 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 11033 | 11033 | $temp_array['direction_degree'] = $direction; |
| 11034 | 11034 | $temp_array['direction_shortname'] = "SSE"; |
| 11035 | 11035 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 11036 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 11036 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 11037 | 11037 | $temp_array['direction_degree'] = $direction; |
| 11038 | 11038 | $temp_array['direction_shortname'] = "S"; |
| 11039 | 11039 | $temp_array['direction_fullname'] = "South"; |
| 11040 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 11040 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 11041 | 11041 | $temp_array['direction_degree'] = $direction; |
| 11042 | 11042 | $temp_array['direction_shortname'] = "SSW"; |
| 11043 | 11043 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 11044 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 11044 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 11045 | 11045 | $temp_array['direction_degree'] = $direction; |
| 11046 | 11046 | $temp_array['direction_shortname'] = "SW"; |
| 11047 | 11047 | $temp_array['direction_fullname'] = "Southwest"; |
| 11048 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 11048 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 11049 | 11049 | $temp_array['direction_degree'] = $direction; |
| 11050 | 11050 | $temp_array['direction_shortname'] = "WSW"; |
| 11051 | 11051 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 11052 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 11052 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 11053 | 11053 | $temp_array['direction_degree'] = $direction; |
| 11054 | 11054 | $temp_array['direction_shortname'] = "W"; |
| 11055 | 11055 | $temp_array['direction_fullname'] = "West"; |
| 11056 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 11056 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 11057 | 11057 | $temp_array['direction_degree'] = $direction; |
| 11058 | 11058 | $temp_array['direction_shortname'] = "WNW"; |
| 11059 | 11059 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 11060 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 11060 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 11061 | 11061 | $temp_array['direction_degree'] = $direction; |
| 11062 | 11062 | $temp_array['direction_shortname'] = "NW"; |
| 11063 | 11063 | $temp_array['direction_fullname'] = "Northwest"; |
| 11064 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 11064 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 11065 | 11065 | $temp_array['direction_degree'] = $direction; |
| 11066 | 11066 | $temp_array['direction_shortname'] = "NNW"; |
| 11067 | 11067 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -11114,9 +11114,9 @@ discard block |
||
| 11114 | 11114 | */ |
| 11115 | 11115 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 11116 | 11116 | { |
| 11117 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 11117 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 11118 | 11118 | |
| 11119 | - $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 11119 | + $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 11120 | 11120 | |
| 11121 | 11121 | $sth = $this->db->prepare($query); |
| 11122 | 11122 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -11139,9 +11139,9 @@ discard block |
||
| 11139 | 11139 | */ |
| 11140 | 11140 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 11141 | 11141 | { |
| 11142 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 11142 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 11143 | 11143 | |
| 11144 | - $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 11144 | + $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 11145 | 11145 | |
| 11146 | 11146 | $sth = $this->db->prepare($query); |
| 11147 | 11147 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -11162,11 +11162,11 @@ discard block |
||
| 11162 | 11162 | * @param Float $longitude longitute of the flight |
| 11163 | 11163 | * @return String the countrie |
| 11164 | 11164 | */ |
| 11165 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 11165 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 11166 | 11166 | { |
| 11167 | 11167 | global $globalDBdriver, $globalDebug; |
| 11168 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 11169 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 11168 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 11169 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 11170 | 11170 | |
| 11171 | 11171 | $Connection = new Connection($this->db); |
| 11172 | 11172 | if (!$Connection->tableExists('countries')) return ''; |
@@ -11206,7 +11206,7 @@ discard block |
||
| 11206 | 11206 | public function getCountryFromISO2($iso2) |
| 11207 | 11207 | { |
| 11208 | 11208 | global $globalDBdriver, $globalDebug; |
| 11209 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
| 11209 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
| 11210 | 11210 | |
| 11211 | 11211 | $Connection = new Connection($this->db); |
| 11212 | 11212 | if (!$Connection->tableExists('countries')) return ''; |
@@ -11238,19 +11238,19 @@ discard block |
||
| 11238 | 11238 | */ |
| 11239 | 11239 | public function convertAircraftRegistration($registration) |
| 11240 | 11240 | { |
| 11241 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 11241 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 11242 | 11242 | $registration_prefix = ''; |
| 11243 | 11243 | $registration_1 = substr($registration, 0, 1); |
| 11244 | 11244 | $registration_2 = substr($registration, 0, 2); |
| 11245 | 11245 | |
| 11246 | 11246 | //first get the prefix based on two characters |
| 11247 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 11247 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 11248 | 11248 | |
| 11249 | 11249 | |
| 11250 | 11250 | $sth = $this->db->prepare($query); |
| 11251 | 11251 | $sth->execute(array(':registration_2' => $registration_2)); |
| 11252 | 11252 | |
| 11253 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11253 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11254 | 11254 | { |
| 11255 | 11255 | $registration_prefix = $row['registration_prefix']; |
| 11256 | 11256 | } |
@@ -11258,11 +11258,11 @@ discard block |
||
| 11258 | 11258 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 11259 | 11259 | if ($registration_prefix == '') |
| 11260 | 11260 | { |
| 11261 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 11261 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 11262 | 11262 | $sth = $this->db->prepare($query); |
| 11263 | 11263 | $sth->execute(array(':registration_1' => $registration_1)); |
| 11264 | 11264 | |
| 11265 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11265 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11266 | 11266 | { |
| 11267 | 11267 | $registration_prefix = $row['registration_prefix']; |
| 11268 | 11268 | } |
@@ -11276,7 +11276,7 @@ discard block |
||
| 11276 | 11276 | } else { |
| 11277 | 11277 | $registration = preg_replace("/^(.{1})/", "$1-", $registration); |
| 11278 | 11278 | } |
| 11279 | - } else if(strlen($registration_prefix) == 2){ |
|
| 11279 | + } else if (strlen($registration_prefix) == 2) { |
|
| 11280 | 11280 | if (0 === strpos($registration, 'N')) { |
| 11281 | 11281 | $registration = preg_replace("/^(.{2})/", "$1", $registration); |
| 11282 | 11282 | } else { |
@@ -11295,17 +11295,17 @@ discard block |
||
| 11295 | 11295 | */ |
| 11296 | 11296 | public function countryFromAircraftRegistration($registration) |
| 11297 | 11297 | { |
| 11298 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 11298 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 11299 | 11299 | |
| 11300 | 11300 | $registration_prefix = ''; |
| 11301 | - $registration_test = explode('-',$registration); |
|
| 11301 | + $registration_test = explode('-', $registration); |
|
| 11302 | 11302 | $country = ''; |
| 11303 | 11303 | if ($registration_test[0] != $registration) { |
| 11304 | 11304 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
| 11305 | 11305 | |
| 11306 | 11306 | $sth = $this->db->prepare($query); |
| 11307 | 11307 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 11308 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11308 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11309 | 11309 | { |
| 11310 | 11310 | //$registration_prefix = $row['registration_prefix']; |
| 11311 | 11311 | $country = $row['country']; |
@@ -11316,13 +11316,13 @@ discard block |
||
| 11316 | 11316 | |
| 11317 | 11317 | $country = ''; |
| 11318 | 11318 | //first get the prefix based on two characters |
| 11319 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 11319 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 11320 | 11320 | |
| 11321 | 11321 | |
| 11322 | 11322 | $sth = $this->db->prepare($query); |
| 11323 | 11323 | $sth->execute(array(':registration_2' => $registration_2)); |
| 11324 | 11324 | |
| 11325 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11325 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11326 | 11326 | { |
| 11327 | 11327 | $registration_prefix = $row['registration_prefix']; |
| 11328 | 11328 | $country = $row['country']; |
@@ -11331,12 +11331,12 @@ discard block |
||
| 11331 | 11331 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 11332 | 11332 | if ($registration_prefix == "") |
| 11333 | 11333 | { |
| 11334 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11334 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11335 | 11335 | |
| 11336 | 11336 | $sth = $this->db->prepare($query); |
| 11337 | 11337 | $sth->execute(array(':registration_1' => $registration_1)); |
| 11338 | 11338 | |
| 11339 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11339 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11340 | 11340 | { |
| 11341 | 11341 | //$registration_prefix = $row['registration_prefix']; |
| 11342 | 11342 | $country = $row['country']; |
@@ -11356,17 +11356,17 @@ discard block |
||
| 11356 | 11356 | */ |
| 11357 | 11357 | public function registrationPrefixFromAircraftRegistration($registration) |
| 11358 | 11358 | { |
| 11359 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 11359 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 11360 | 11360 | |
| 11361 | 11361 | $registration_prefix = ''; |
| 11362 | - $registration_test = explode('-',$registration); |
|
| 11362 | + $registration_test = explode('-', $registration); |
|
| 11363 | 11363 | //$country = ''; |
| 11364 | 11364 | if ($registration_test[0] != $registration) { |
| 11365 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11365 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11366 | 11366 | |
| 11367 | 11367 | $sth = $this->db->prepare($query); |
| 11368 | 11368 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 11369 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11369 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11370 | 11370 | { |
| 11371 | 11371 | $registration_prefix = $row['registration_prefix']; |
| 11372 | 11372 | //$country = $row['country']; |
@@ -11376,13 +11376,13 @@ discard block |
||
| 11376 | 11376 | $registration_2 = substr($registration, 0, 2); |
| 11377 | 11377 | |
| 11378 | 11378 | //first get the prefix based on two characters |
| 11379 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 11379 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 11380 | 11380 | |
| 11381 | 11381 | |
| 11382 | 11382 | $sth = $this->db->prepare($query); |
| 11383 | 11383 | $sth->execute(array(':registration_2' => $registration_2)); |
| 11384 | 11384 | |
| 11385 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11385 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11386 | 11386 | { |
| 11387 | 11387 | $registration_prefix = $row['registration_prefix']; |
| 11388 | 11388 | //$country = $row['country']; |
@@ -11391,12 +11391,12 @@ discard block |
||
| 11391 | 11391 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 11392 | 11392 | if ($registration_prefix == "") |
| 11393 | 11393 | { |
| 11394 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11394 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 11395 | 11395 | |
| 11396 | 11396 | $sth = $this->db->prepare($query); |
| 11397 | 11397 | $sth->execute(array(':registration_1' => $registration_1)); |
| 11398 | 11398 | |
| 11399 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11399 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11400 | 11400 | { |
| 11401 | 11401 | $registration_prefix = $row['registration_prefix']; |
| 11402 | 11402 | //$country = $row['country']; |
@@ -11417,13 +11417,13 @@ discard block |
||
| 11417 | 11417 | */ |
| 11418 | 11418 | public function countryFromAircraftRegistrationCode($registration) |
| 11419 | 11419 | { |
| 11420 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 11420 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 11421 | 11421 | |
| 11422 | 11422 | $country = ''; |
| 11423 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
| 11423 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
| 11424 | 11424 | $sth = $this->db->prepare($query); |
| 11425 | 11425 | $sth->execute(array(':registration' => $registration)); |
| 11426 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11426 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11427 | 11427 | { |
| 11428 | 11428 | $country = $row['country']; |
| 11429 | 11429 | } |
@@ -11436,9 +11436,9 @@ discard block |
||
| 11436 | 11436 | * @param String $flightaware_id flightaware_id from spotter_output table |
| 11437 | 11437 | * @param String $highlight New highlight value |
| 11438 | 11438 | */ |
| 11439 | - public function setHighlightFlight($flightaware_id,$highlight) { |
|
| 11439 | + public function setHighlightFlight($flightaware_id, $highlight) { |
|
| 11440 | 11440 | |
| 11441 | - $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 11441 | + $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 11442 | 11442 | $sth = $this->db->prepare($query); |
| 11443 | 11443 | $sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight)); |
| 11444 | 11444 | } |
@@ -11450,13 +11450,13 @@ discard block |
||
| 11450 | 11450 | * @param String $date Date of spotted aircraft |
| 11451 | 11451 | * @param String $highlight New highlight value |
| 11452 | 11452 | */ |
| 11453 | - public function setHighlightFlightByRegistration($registration,$highlight, $date = '') { |
|
| 11453 | + public function setHighlightFlightByRegistration($registration, $highlight, $date = '') { |
|
| 11454 | 11454 | if ($date == '') { |
| 11455 | 11455 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)"; |
| 11456 | 11456 | $query_values = array(':registration' => $registration, ':highlight' => $highlight); |
| 11457 | 11457 | } else { |
| 11458 | 11458 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE registration = :registration AND date(date) = :date"; |
| 11459 | - $query_values = array(':registration' => $registration, ':highlight' => $highlight,':date' => $date); |
|
| 11459 | + $query_values = array(':registration' => $registration, ':highlight' => $highlight, ':date' => $date); |
|
| 11460 | 11460 | } |
| 11461 | 11461 | $sth = $this->db->prepare($query); |
| 11462 | 11462 | $sth->execute($query_values); |
@@ -11486,7 +11486,7 @@ discard block |
||
| 11486 | 11486 | |
| 11487 | 11487 | $bitly_data = json_decode($bitly_data); |
| 11488 | 11488 | $bitly_url = ''; |
| 11489 | - if ($bitly_data->status_txt = "OK"){ |
|
| 11489 | + if ($bitly_data->status_txt = "OK") { |
|
| 11490 | 11490 | $bitly_url = $bitly_data->data->url; |
| 11491 | 11491 | } |
| 11492 | 11492 | |
@@ -11496,7 +11496,7 @@ discard block |
||
| 11496 | 11496 | |
| 11497 | 11497 | public function getOrderBy() |
| 11498 | 11498 | { |
| 11499 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 11499 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 11500 | 11500 | |
| 11501 | 11501 | return $orderby; |
| 11502 | 11502 | |
@@ -11630,14 +11630,14 @@ discard block |
||
| 11630 | 11630 | } |
| 11631 | 11631 | $sth = $this->db->prepare($query); |
| 11632 | 11632 | $sth->execute(); |
| 11633 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11633 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11634 | 11634 | { |
| 11635 | 11635 | $departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']); |
| 11636 | 11636 | $arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']); |
| 11637 | 11637 | if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) { |
| 11638 | - $update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 11638 | + $update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 11639 | 11639 | $sthu = $this->db->prepare($update_query); |
| 11640 | - $sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 11640 | + $sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 11641 | 11641 | } |
| 11642 | 11642 | } |
| 11643 | 11643 | |
@@ -11650,7 +11650,7 @@ discard block |
||
| 11650 | 11650 | } |
| 11651 | 11651 | $sth = $this->db->prepare($query); |
| 11652 | 11652 | $sth->execute(); |
| 11653 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11653 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11654 | 11654 | { |
| 11655 | 11655 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 11656 | 11656 | { |
@@ -11659,11 +11659,11 @@ discard block |
||
| 11659 | 11659 | elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 11660 | 11660 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 11661 | 11661 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 11662 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 11662 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 11663 | 11663 | if (isset($airline_array[0]['name'])) { |
| 11664 | - $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 11664 | + $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 11665 | 11665 | $sthu = $this->db->prepare($update_query); |
| 11666 | - $sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 11666 | + $sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 11667 | 11667 | } |
| 11668 | 11668 | } |
| 11669 | 11669 | } |
@@ -11683,18 +11683,18 @@ discard block |
||
| 11683 | 11683 | } |
| 11684 | 11684 | $sth = $this->db->prepare($query); |
| 11685 | 11685 | $sth->execute(); |
| 11686 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11686 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11687 | 11687 | { |
| 11688 | 11688 | if ($row['aircraft_icao'] != '') { |
| 11689 | 11689 | $aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']); |
| 11690 | - if ($row['registration'] != ""){ |
|
| 11690 | + if ($row['registration'] != "") { |
|
| 11691 | 11691 | $image_array = $Image->getSpotterImage($row['registration']); |
| 11692 | 11692 | if (!isset($image_array[0]['registration'])) { |
| 11693 | 11693 | $Image->addSpotterImage($row['registration']); |
| 11694 | 11694 | } |
| 11695 | 11695 | } |
| 11696 | 11696 | if (count($aircraft_name) > 0) { |
| 11697 | - $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 11697 | + $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 11698 | 11698 | $sthu = $this->db->prepare($update_query); |
| 11699 | 11699 | $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id'])); |
| 11700 | 11700 | } |
@@ -11709,10 +11709,10 @@ discard block |
||
| 11709 | 11709 | $query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output"; |
| 11710 | 11710 | $sth = $this->db->prepare($query); |
| 11711 | 11711 | $sth->execute(); |
| 11712 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11712 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 11713 | 11713 | { |
| 11714 | 11714 | if ($row['last_latitude'] != '' && $row['last_longitude'] != '') { |
| 11715 | - $closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist); |
|
| 11715 | + $closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist); |
|
| 11716 | 11716 | $airport_icao = ''; |
| 11717 | 11717 | if (isset($closestAirports[0])) { |
| 11718 | 11718 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
@@ -11726,7 +11726,7 @@ discard block |
||
| 11726 | 11726 | break; |
| 11727 | 11727 | } |
| 11728 | 11728 | } |
| 11729 | - } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
|
| 11729 | + } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) { |
|
| 11730 | 11730 | $airport_icao = $closestAirports[0]['icao']; |
| 11731 | 11731 | if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
| 11732 | 11732 | } else { |
@@ -11737,28 +11737,28 @@ discard block |
||
| 11737 | 11737 | } |
| 11738 | 11738 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 11739 | 11739 | if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
| 11740 | - $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 11740 | + $update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 11741 | 11741 | $sthu = $this->db->prepare($update_query); |
| 11742 | - $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
|
| 11742 | + $sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id'])); |
|
| 11743 | 11743 | } |
| 11744 | 11744 | } |
| 11745 | 11745 | } |
| 11746 | 11746 | } |
| 11747 | 11747 | |
| 11748 | - public function closestAirports($origLat,$origLon,$dist = 10) { |
|
| 11748 | + public function closestAirports($origLat, $origLon, $dist = 10) { |
|
| 11749 | 11749 | global $globalDBdriver; |
| 11750 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 11750 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 11751 | 11751 | /* |
| 11752 | 11752 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 11753 | 11753 | FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 11754 | 11754 | having distance < $dist ORDER BY distance limit 100;"; |
| 11755 | 11755 | */ |
| 11756 | 11756 | if ($globalDBdriver == 'mysql') { |
| 11757 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
| 11757 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
| 11758 | 11758 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 11759 | 11759 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 11760 | 11760 | } else { |
| 11761 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
| 11761 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
| 11762 | 11762 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 11763 | 11763 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 11764 | 11764 | } |
@@ -40,6 +40,10 @@ |
||
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | + /** |
|
| 44 | + * @param string $id |
|
| 45 | + * @param string $ident |
|
| 46 | + */ |
|
| 43 | 47 | public function get_Schedule($id,$ident) { |
| 44 | 48 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
| 45 | 49 | // Get schedule here, so it's done only one time |
@@ -9,16 +9,16 @@ discard block |
||
| 9 | 9 | require_once(dirname(__FILE__).'/class.Source.php'); |
| 10 | 10 | |
| 11 | 11 | class SpotterImport { |
| 12 | - private $all_flights = array(); |
|
| 13 | - private $last_delete_hourly = 0; |
|
| 14 | - private $last_delete = 0; |
|
| 15 | - private $stats = array(); |
|
| 16 | - private $tmd = 0; |
|
| 17 | - private $source_location = array(); |
|
| 18 | - public $db = null; |
|
| 19 | - public $nb = 0; |
|
| 20 | - |
|
| 21 | - public function __construct($dbc = null) { |
|
| 12 | + private $all_flights = array(); |
|
| 13 | + private $last_delete_hourly = 0; |
|
| 14 | + private $last_delete = 0; |
|
| 15 | + private $stats = array(); |
|
| 16 | + private $tmd = 0; |
|
| 17 | + private $source_location = array(); |
|
| 18 | + public $db = null; |
|
| 19 | + public $nb = 0; |
|
| 20 | + |
|
| 21 | + public function __construct($dbc = null) { |
|
| 22 | 22 | global $globalBeta; |
| 23 | 23 | $Connection = new Connection($dbc); |
| 24 | 24 | $this->db = $Connection->db(); |
@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | $currentdate = date('Y-m-d'); |
| 30 | 30 | $sourcestat = $Stats->getStatsSource($currentdate); |
| 31 | 31 | if (!empty($sourcestat)) { |
| 32 | - foreach($sourcestat as $srcst) { |
|
| 33 | - $type = $srcst['stats_type']; |
|
| 32 | + foreach($sourcestat as $srcst) { |
|
| 33 | + $type = $srcst['stats_type']; |
|
| 34 | 34 | if ($type == 'polar' || $type == 'hist') { |
| 35 | - $source = $srcst['source_name']; |
|
| 36 | - $data = $srcst['source_data']; |
|
| 37 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 38 | - } |
|
| 39 | - } |
|
| 35 | + $source = $srcst['source_name']; |
|
| 36 | + $data = $srcst['source_data']; |
|
| 37 | + $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + } |
|
| 40 | 41 | } |
| 41 | - } |
|
| 42 | 42 | |
| 43 | - public function get_Schedule($id,$ident) { |
|
| 43 | + public function get_Schedule($id,$ident) { |
|
| 44 | 44 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
| 45 | 45 | // Get schedule here, so it's done only one time |
| 46 | 46 | |
@@ -60,42 +60,42 @@ discard block |
||
| 60 | 60 | $operator = $Spotter->getOperator($ident); |
| 61 | 61 | $scheduleexist = false; |
| 62 | 62 | if ($Schedule->checkSchedule($operator) == 0) { |
| 63 | - $operator = $Translation->checkTranslation($ident); |
|
| 64 | - if ($Schedule->checkSchedule($operator) == 0) { |
|
| 63 | + $operator = $Translation->checkTranslation($ident); |
|
| 64 | + if ($Schedule->checkSchedule($operator) == 0) { |
|
| 65 | 65 | $schedule = $Schedule->fetchSchedule($operator); |
| 66 | 66 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 67 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 68 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 69 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 70 | - // Should also check if route schedule = route from DB |
|
| 71 | - if ($schedule['DepartureAirportIATA'] != '') { |
|
| 67 | + if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 68 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 69 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 70 | + // Should also check if route schedule = route from DB |
|
| 71 | + if ($schedule['DepartureAirportIATA'] != '') { |
|
| 72 | 72 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
| 73 | - $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
| 74 | - if (trim($airport_icao) != '') { |
|
| 73 | + $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
| 74 | + if (trim($airport_icao) != '') { |
|
| 75 | 75 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 76 | 76 | if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
| 77 | - } |
|
| 77 | + } |
|
| 78 | + } |
|
| 78 | 79 | } |
| 79 | - } |
|
| 80 | - if ($schedule['ArrivalAirportIATA'] != '') { |
|
| 80 | + if ($schedule['ArrivalAirportIATA'] != '') { |
|
| 81 | 81 | if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) { |
| 82 | - $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
| 83 | - if (trim($airport_icao) != '') { |
|
| 82 | + $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
| 83 | + if (trim($airport_icao) != '') { |
|
| 84 | 84 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 85 | 85 | if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
| 86 | - } |
|
| 86 | + } |
|
| 87 | + } |
|
| 87 | 88 | } |
| 88 | - } |
|
| 89 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 89 | + $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 90 | 90 | } |
| 91 | - } else $scheduleexist = true; |
|
| 91 | + } else $scheduleexist = true; |
|
| 92 | 92 | } else $scheduleexist = true; |
| 93 | 93 | // close connection, at least one way will work ? |
| 94 | - if ($scheduleexist) { |
|
| 94 | + if ($scheduleexist) { |
|
| 95 | 95 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
| 96 | - $sch = $Schedule->getSchedule($operator); |
|
| 96 | + $sch = $Schedule->getSchedule($operator); |
|
| 97 | 97 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | $Spotter->db = null; |
| 100 | 100 | $Schedule->db = null; |
| 101 | 101 | $Translation->db = null; |
@@ -110,92 +110,92 @@ discard block |
||
| 110 | 110 | } |
| 111 | 111 | */ |
| 112 | 112 | } |
| 113 | - } |
|
| 113 | + } |
|
| 114 | 114 | |
| 115 | - public function checkAll() { |
|
| 115 | + public function checkAll() { |
|
| 116 | 116 | global $globalDebug; |
| 117 | 117 | if ($globalDebug) echo "Update last seen flights data...\n"; |
| 118 | 118 | foreach ($this->all_flights as $key => $flight) { |
| 119 | - if (isset($this->all_flights[$key]['id'])) { |
|
| 119 | + if (isset($this->all_flights[$key]['id'])) { |
|
| 120 | 120 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 121 | - $Spotter = new Spotter($this->db); |
|
| 122 | - $real_arrival = $this->arrival($key); |
|
| 123 | - $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 124 | - } |
|
| 121 | + $Spotter = new Spotter($this->db); |
|
| 122 | + $real_arrival = $this->arrival($key); |
|
| 123 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 124 | + } |
|
| 125 | + } |
|
| 125 | 126 | } |
| 126 | - } |
|
| 127 | 127 | |
| 128 | - public function arrival($key) { |
|
| 128 | + public function arrival($key) { |
|
| 129 | 129 | global $globalClosestMinDist, $globalDebug; |
| 130 | 130 | if ($globalDebug) echo 'Update arrival...'."\n"; |
| 131 | 131 | $Spotter = new Spotter($this->db); |
| 132 | - $airport_icao = ''; |
|
| 133 | - $airport_time = ''; |
|
| 134 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 132 | + $airport_icao = ''; |
|
| 133 | + $airport_time = ''; |
|
| 134 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 135 | 135 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 136 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 137 | - if (isset($closestAirports[0])) { |
|
| 138 | - if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
| 139 | - $airport_icao = $closestAirports[0]['icao']; |
|
| 140 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 141 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 142 | - } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
| 143 | - foreach ($closestAirports as $airport) { |
|
| 144 | - if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
| 145 | - $airport_icao = $airport['icao']; |
|
| 146 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 147 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 148 | - break; |
|
| 149 | - } |
|
| 150 | - } |
|
| 151 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 152 | - $airport_icao = $closestAirports[0]['icao']; |
|
| 153 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
| 154 | - } else { |
|
| 155 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 156 | - } |
|
| 157 | - } else { |
|
| 158 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 159 | - } |
|
| 160 | - |
|
| 161 | - } else { |
|
| 162 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 163 | - } |
|
| 164 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 165 | - } |
|
| 166 | - |
|
| 167 | - |
|
| 168 | - |
|
| 169 | - public function del() { |
|
| 136 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 137 | + if (isset($closestAirports[0])) { |
|
| 138 | + if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
| 139 | + $airport_icao = $closestAirports[0]['icao']; |
|
| 140 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 141 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 142 | + } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
| 143 | + foreach ($closestAirports as $airport) { |
|
| 144 | + if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
| 145 | + $airport_icao = $airport['icao']; |
|
| 146 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 147 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 148 | + break; |
|
| 149 | + } |
|
| 150 | + } |
|
| 151 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 152 | + $airport_icao = $closestAirports[0]['icao']; |
|
| 153 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
| 154 | + } else { |
|
| 155 | + if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 156 | + } |
|
| 157 | + } else { |
|
| 158 | + if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 159 | + } |
|
| 160 | + |
|
| 161 | + } else { |
|
| 162 | + if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 163 | + } |
|
| 164 | + return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 165 | + } |
|
| 166 | + |
|
| 167 | + |
|
| 168 | + |
|
| 169 | + public function del() { |
|
| 170 | 170 | global $globalDebug; |
| 171 | 171 | // Delete old infos |
| 172 | 172 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 173 | 173 | foreach ($this->all_flights as $key => $flight) { |
| 174 | - if (isset($flight['lastupdate'])) { |
|
| 175 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 176 | - if (isset($this->all_flights[$key]['id'])) { |
|
| 177 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 174 | + if (isset($flight['lastupdate'])) { |
|
| 175 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
| 176 | + if (isset($this->all_flights[$key]['id'])) { |
|
| 177 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 178 | 178 | /* |
| 179 | 179 | $SpotterLive = new SpotterLive(); |
| 180 | 180 | $SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']); |
| 181 | 181 | $SpotterLive->db = null; |
| 182 | 182 | */ |
| 183 | - $real_arrival = $this->arrival($key); |
|
| 184 | - $Spotter = new Spotter($this->db); |
|
| 185 | - if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
| 183 | + $real_arrival = $this->arrival($key); |
|
| 184 | + $Spotter = new Spotter($this->db); |
|
| 185 | + if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
| 186 | 186 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
| 187 | 187 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 188 | 188 | } |
| 189 | 189 | // Put in archive |
| 190 | 190 | // $Spotter->db = null; |
| 191 | - } |
|
| 192 | - unset($this->all_flights[$key]); |
|
| 193 | - } |
|
| 194 | - } |
|
| 195 | - } |
|
| 196 | - } |
|
| 197 | - |
|
| 198 | - public function add($line) { |
|
| 191 | + } |
|
| 192 | + unset($this->all_flights[$key]); |
|
| 193 | + } |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | + |
|
| 198 | + public function add($line) { |
|
| 199 | 199 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights; |
| 200 | 200 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 201 | 201 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
@@ -220,18 +220,18 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | // SBS format is CSV format |
| 222 | 222 | if(is_array($line) && isset($line['hex'])) { |
| 223 | - //print_r($line); |
|
| 224 | - if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
|
| 223 | + //print_r($line); |
|
| 224 | + if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
|
| 225 | 225 | |
| 226 | 226 | // Increment message number |
| 227 | 227 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 228 | - $current_date = date('Y-m-d'); |
|
| 229 | - $source = $line['source_name']; |
|
| 230 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 231 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 232 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 233 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 234 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 228 | + $current_date = date('Y-m-d'); |
|
| 229 | + $source = $line['source_name']; |
|
| 230 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 231 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 232 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 233 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 234 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /* |
@@ -247,17 +247,17 @@ discard block |
||
| 247 | 247 | //$this->db = $dbc; |
| 248 | 248 | |
| 249 | 249 | $hex = trim($line['hex']); |
| 250 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 251 | - else $id = trim($line['id']); |
|
| 250 | + if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 251 | + else $id = trim($line['id']); |
|
| 252 | 252 | |
| 253 | 253 | //print_r($this->all_flights); |
| 254 | 254 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
| 255 | - $this->all_flights[$id] = array('hex' => $hex); |
|
| 256 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 257 | - //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 255 | + $this->all_flights[$id] = array('hex' => $hex); |
|
| 256 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 257 | + //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
| 258 | 258 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 259 | - //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 260 | - if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) { |
|
| 259 | + //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 260 | + if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) { |
|
| 261 | 261 | |
| 262 | 262 | $timeelapsed = microtime(true); |
| 263 | 263 | $Spotter = new Spotter($this->db); |
@@ -266,39 +266,39 @@ discard block |
||
| 266 | 266 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 267 | 267 | |
| 268 | 268 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
| 269 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 270 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 271 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 272 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 269 | + if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 270 | + elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 271 | + elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 272 | + elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 273 | 273 | } |
| 274 | 274 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
| 275 | - } else if (isset($line['aircraft_name'])) { |
|
| 275 | + } else if (isset($line['aircraft_name'])) { |
|
| 276 | 276 | // Get aircraft ICAO from aircraft name |
| 277 | 277 | $Spotter = new Spotter($this->db); |
| 278 | 278 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 279 | 279 | $Spotter->db = null; |
| 280 | 280 | if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
| 281 | 281 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
| 282 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 283 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
| 284 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 285 | - if (!isset($line['id'])) { |
|
| 282 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 283 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
| 284 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 285 | + if (!isset($line['id'])) { |
|
| 286 | 286 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 287 | 287 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
| 288 | 288 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 289 | 289 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 290 | - //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 291 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 290 | + //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 291 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 292 | 292 | |
| 293 | - if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
| 294 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 293 | + if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
| 294 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 298 | 298 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) { |
| 299 | - if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 299 | + if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
| 300 | 300 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 301 | - } else { |
|
| 301 | + } else { |
|
| 302 | 302 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 303 | 303 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 304 | 304 | /* |
@@ -307,41 +307,41 @@ discard block |
||
| 307 | 307 | print_r($line); |
| 308 | 308 | */ |
| 309 | 309 | return ''; |
| 310 | - } |
|
| 310 | + } |
|
| 311 | 311 | } else { |
| 312 | 312 | date_default_timezone_set('UTC'); |
| 313 | 313 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
| 317 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 317 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 318 | 318 | } |
| 319 | 319 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 320 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 320 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 321 | 321 | } |
| 322 | 322 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 323 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
| 323 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
| 324 | 324 | } |
| 325 | 325 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 326 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
| 326 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
| 330 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 331 | - if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 330 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 331 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
| 332 | 332 | $timeelapsed = microtime(true); |
| 333 | - $Spotter = new Spotter($this->db); |
|
| 334 | - $fromsource = NULL; |
|
| 335 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 336 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 333 | + $Spotter = new Spotter($this->db); |
|
| 334 | + $fromsource = NULL; |
|
| 335 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 336 | + elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 337 | 337 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 338 | 338 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 339 | 339 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 340 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 340 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 341 | 341 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 342 | 342 | $Spotter->db = null; |
| 343 | 343 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 344 | - } |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | 346 | /* |
| 347 | 347 | if (!isset($line['id'])) { |
@@ -351,26 +351,26 @@ discard block |
||
| 351 | 351 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 352 | 352 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 353 | 353 | */ |
| 354 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 354 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 355 | 355 | |
| 356 | - //$putinarchive = true; |
|
| 357 | - if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 356 | + //$putinarchive = true; |
|
| 357 | + if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
| 358 | 358 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
| 359 | - } |
|
| 360 | - if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 359 | + } |
|
| 360 | + if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
| 361 | 361 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
| 362 | - } |
|
| 363 | - if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
| 364 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 365 | - } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 362 | + } |
|
| 363 | + if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
| 364 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 365 | + } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
| 366 | 366 | $timeelapsed = microtime(true); |
| 367 | 367 | $Spotter = new Spotter($this->db); |
| 368 | 368 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 369 | 369 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 370 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 370 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 371 | 371 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 372 | 372 | |
| 373 | - } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 373 | + } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
| 374 | 374 | $timeelapsed = microtime(true); |
| 375 | 375 | $Spotter = new Spotter($this->db); |
| 376 | 376 | $route = $Spotter->getRouteInfo(trim($line['ident'])); |
@@ -384,43 +384,43 @@ discard block |
||
| 384 | 384 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 385 | 385 | |
| 386 | 386 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 387 | - //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 388 | - if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 387 | + //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
| 388 | + if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
| 389 | 389 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
| 390 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 391 | - } |
|
| 390 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 391 | + } |
|
| 392 | 392 | } |
| 393 | 393 | if (!isset($globalFork)) $globalFork = TRUE; |
| 394 | 394 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 395 | 395 | if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
| 396 | 396 | } |
| 397 | - } |
|
| 397 | + } |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | if (isset($line['speed']) && $line['speed'] != '') { |
| 401 | 401 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 402 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 403 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 404 | - //$dataFound = true; |
|
| 402 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 403 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 404 | + //$dataFound = true; |
|
| 405 | 405 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 406 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 407 | - if ($distance > 1000 && $distance < 10000) { |
|
| 408 | - // use datetime |
|
| 406 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 407 | + if ($distance > 1000 && $distance < 10000) { |
|
| 408 | + // use datetime |
|
| 409 | 409 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 410 | 410 | $speed = $speed*3.6; |
| 411 | 411 | if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
| 412 | 412 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
| 413 | - } |
|
| 413 | + } |
|
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | |
| 417 | 417 | |
| 418 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 419 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 420 | - else unset($timediff); |
|
| 421 | - if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
| 418 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 419 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 420 | + else unset($timediff); |
|
| 421 | + if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
| 422 | 422 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
| 423 | - if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 423 | + if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 424 | 424 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 425 | 425 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 426 | 426 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -434,16 +434,16 @@ discard block |
||
| 434 | 434 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 435 | 435 | $this->tmd = 0; |
| 436 | 436 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 437 | - } |
|
| 437 | + } |
|
| 438 | 438 | } |
| 439 | 439 | |
| 440 | 440 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 441 | - //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 441 | + //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 442 | 442 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 443 | 443 | if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
| 444 | - $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 445 | - $dataFound = true; |
|
| 446 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 444 | + $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
| 445 | + $dataFound = true; |
|
| 446 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 447 | 447 | } |
| 448 | 448 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 449 | 449 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
@@ -454,20 +454,20 @@ discard block |
||
| 454 | 454 | //$putinarchive = true; |
| 455 | 455 | } |
| 456 | 456 | */ |
| 457 | - /* |
|
| 457 | + /* |
|
| 458 | 458 | } elseif (isset($this->all_flights[$id]['latitude'])) { |
| 459 | 459 | if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n"; |
| 460 | 460 | } |
| 461 | 461 | */ |
| 462 | 462 | } |
| 463 | 463 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 464 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 465 | - //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 464 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 465 | + //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
| 466 | 466 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 467 | 467 | if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
| 468 | - $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 469 | - $dataFound = true; |
|
| 470 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 468 | + $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
| 469 | + $dataFound = true; |
|
| 470 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
| 471 | 471 | } |
| 472 | 472 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 473 | 473 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
@@ -485,53 +485,53 @@ discard block |
||
| 485 | 485 | */ |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - } else if ($globalDebug && $timediff > 20) { |
|
| 488 | + } else if ($globalDebug && $timediff > 20) { |
|
| 489 | 489 | $this->tmd = $this->tmd + 1; |
| 490 | 490 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 491 | 491 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
| 492 | 492 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 493 | 493 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 494 | - } |
|
| 494 | + } |
|
| 495 | 495 | } |
| 496 | 496 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 497 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 498 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 497 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 498 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 499 | 499 | } |
| 500 | 500 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 501 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 502 | - //$dataFound = true; |
|
| 501 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 502 | + //$dataFound = true; |
|
| 503 | 503 | } |
| 504 | 504 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 505 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 505 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 506 | 506 | } |
| 507 | 507 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 508 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 508 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 509 | 509 | } |
| 510 | 510 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 511 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 512 | - //$dataFound = true; |
|
| 511 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 512 | + //$dataFound = true; |
|
| 513 | 513 | } |
| 514 | 514 | if (isset($line['ground']) && $line['ground'] != '') { |
| 515 | - if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 515 | + if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
| 516 | 516 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 517 | 517 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 518 | 518 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 519 | 519 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
| 520 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 520 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 521 | 521 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 522 | - } |
|
| 523 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 524 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 525 | - //$dataFound = true; |
|
| 522 | + } |
|
| 523 | + if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 524 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 525 | + //$dataFound = true; |
|
| 526 | 526 | } |
| 527 | 527 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 528 | - if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
| 529 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 530 | - $highlight = ''; |
|
| 531 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 532 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 533 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 534 | - if ($highlight != '') { |
|
| 528 | + if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
| 529 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 530 | + $highlight = ''; |
|
| 531 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 532 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 533 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 534 | + if ($highlight != '') { |
|
| 535 | 535 | $timeelapsed = microtime(true); |
| 536 | 536 | $Spotter = new Spotter($this->db); |
| 537 | 537 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
@@ -541,38 +541,38 @@ discard block |
||
| 541 | 541 | $this->all_flights[$id]['putinarchive'] = true; |
| 542 | 542 | //$putinarchive = true; |
| 543 | 543 | //$highlight = ''; |
| 544 | - } |
|
| 544 | + } |
|
| 545 | 545 | |
| 546 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 547 | - //$dataFound = true; |
|
| 546 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 547 | + //$dataFound = true; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 551 | - //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 551 | + //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 552 | 552 | if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
| 553 | 553 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 554 | 554 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 555 | 555 | //$dataFound = true; |
| 556 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 556 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 560 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 560 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | if (isset($line['heading']) && $line['heading'] != '') { |
| 564 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 565 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 566 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 567 | - //$dataFound = true; |
|
| 564 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 565 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 566 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 567 | + //$dataFound = true; |
|
| 568 | 568 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 569 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 570 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 571 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 572 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 569 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 570 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 571 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 572 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 573 | 573 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 574 | - // If not enough messages and ACARS set heading to 0 |
|
| 575 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 574 | + // If not enough messages and ACARS set heading to 0 |
|
| 575 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 576 | 576 | } |
| 577 | 577 | if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 578 | 578 | elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
@@ -583,119 +583,119 @@ discard block |
||
| 583 | 583 | //if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 584 | 584 | //if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 585 | 585 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
| 586 | - $this->all_flights[$id]['lastupdate'] = time(); |
|
| 587 | - if ($this->all_flights[$id]['addedSpotter'] == 0) { |
|
| 588 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 589 | - //print_r($this->all_flights); |
|
| 590 | - //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 591 | - //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 592 | - if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 586 | + $this->all_flights[$id]['lastupdate'] = time(); |
|
| 587 | + if ($this->all_flights[$id]['addedSpotter'] == 0) { |
|
| 588 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 589 | + //print_r($this->all_flights); |
|
| 590 | + //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
| 591 | + //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
| 592 | + if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
| 593 | 593 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
| 594 | 594 | $timeelapsed = microtime(true); |
| 595 | 595 | $SpotterLive = new SpotterLive($this->db); |
| 596 | 596 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
| 597 | - $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
|
| 598 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 597 | + $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
|
| 598 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 599 | 599 | } elseif (isset($line['id'])) { |
| 600 | - $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
|
| 601 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 600 | + $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
|
| 601 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 602 | 602 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 603 | - $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
|
| 604 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 603 | + $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
|
| 604 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 605 | 605 | } else $recent_ident = ''; |
| 606 | 606 | $SpotterLive->db=null; |
| 607 | 607 | |
| 608 | 608 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 609 | 609 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 610 | - } else { |
|
| 610 | + } else { |
|
| 611 | 611 | $recent_ident = ''; |
| 612 | 612 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
| 613 | - } |
|
| 614 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 615 | - if($recent_ident == "") |
|
| 616 | - { |
|
| 613 | + } |
|
| 614 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 615 | + if($recent_ident == "") |
|
| 616 | + { |
|
| 617 | 617 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 618 | 618 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 619 | 619 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 620 | 620 | //adds the spotter data for the archive |
| 621 | 621 | $ignoreImport = false; |
| 622 | 622 | foreach($globalAirportIgnore as $airportIgnore) { |
| 623 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 623 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 624 | 624 | $ignoreImport = true; |
| 625 | - } |
|
| 625 | + } |
|
| 626 | 626 | } |
| 627 | 627 | if (count($globalAirportAccept) > 0) { |
| 628 | - $ignoreImport = true; |
|
| 629 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 628 | + $ignoreImport = true; |
|
| 629 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 630 | 630 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 631 | - $ignoreImport = false; |
|
| 631 | + $ignoreImport = false; |
|
| 632 | + } |
|
| 632 | 633 | } |
| 633 | - } |
|
| 634 | 634 | } |
| 635 | 635 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 636 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 636 | + foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 637 | 637 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
| 638 | - $ignoreImport = true; |
|
| 638 | + $ignoreImport = true; |
|
| 639 | + } |
|
| 639 | 640 | } |
| 640 | - } |
|
| 641 | 641 | } |
| 642 | 642 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 643 | - $ignoreImport = true; |
|
| 644 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 643 | + $ignoreImport = true; |
|
| 644 | + foreach($globalAirlineAccept as $airlineAccept) { |
|
| 645 | 645 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
| 646 | - $ignoreImport = false; |
|
| 646 | + $ignoreImport = false; |
|
| 647 | + } |
|
| 647 | 648 | } |
| 648 | - } |
|
| 649 | 649 | } |
| 650 | 650 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 651 | - $ignoreImport = true; |
|
| 652 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 651 | + $ignoreImport = true; |
|
| 652 | + foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 653 | 653 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 654 | - $ignoreImport = false; |
|
| 654 | + $ignoreImport = false; |
|
| 655 | + } |
|
| 655 | 656 | } |
| 656 | - } |
|
| 657 | 657 | } |
| 658 | 658 | |
| 659 | 659 | if (!$ignoreImport) { |
| 660 | - $highlight = ''; |
|
| 661 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 662 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 663 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 664 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 665 | - $timeelapsed = microtime(true); |
|
| 666 | - $Spotter = new Spotter($this->db); |
|
| 667 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
| 668 | - $Spotter->db = null; |
|
| 669 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 670 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 660 | + $highlight = ''; |
|
| 661 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 662 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 663 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 664 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 665 | + $timeelapsed = microtime(true); |
|
| 666 | + $Spotter = new Spotter($this->db); |
|
| 667 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
| 668 | + $Spotter->db = null; |
|
| 669 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 670 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 671 | 671 | |
| 672 | - // Add source stat in DB |
|
| 673 | - $Stats = new Stats($this->db); |
|
| 674 | - if (!empty($this->stats)) { |
|
| 672 | + // Add source stat in DB |
|
| 673 | + $Stats = new Stats($this->db); |
|
| 674 | + if (!empty($this->stats)) { |
|
| 675 | 675 | if ($globalDebug) echo 'Add source stats : '; |
| 676 | - foreach($this->stats as $date => $data) { |
|
| 677 | - foreach($data as $source => $sourced) { |
|
| 678 | - //print_r($sourced); |
|
| 679 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 680 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 681 | - if (isset($sourced['msg'])) { |
|
| 682 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 683 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 684 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 685 | - unset($this->stats[$date][$source]['msg']); |
|
| 686 | - } |
|
| 687 | - } |
|
| 688 | - } |
|
| 689 | - if ($date != date('Y-m-d')) { |
|
| 690 | - unset($this->stats[$date]); |
|
| 691 | - } |
|
| 692 | - } |
|
| 693 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 694 | - |
|
| 695 | - } |
|
| 696 | - $Stats->db = null; |
|
| 676 | + foreach($this->stats as $date => $data) { |
|
| 677 | + foreach($data as $source => $sourced) { |
|
| 678 | + //print_r($sourced); |
|
| 679 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 680 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 681 | + if (isset($sourced['msg'])) { |
|
| 682 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 683 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 684 | + echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 685 | + unset($this->stats[$date][$source]['msg']); |
|
| 686 | + } |
|
| 687 | + } |
|
| 688 | + } |
|
| 689 | + if ($date != date('Y-m-d')) { |
|
| 690 | + unset($this->stats[$date]); |
|
| 691 | + } |
|
| 692 | + } |
|
| 693 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 694 | + |
|
| 695 | + } |
|
| 696 | + $Stats->db = null; |
|
| 697 | 697 | |
| 698 | - $this->del(); |
|
| 698 | + $this->del(); |
|
| 699 | 699 | } elseif ($globalDebug) echo 'Ignore data'."\n"; |
| 700 | 700 | //$ignoreImport = false; |
| 701 | 701 | $this->all_flights[$id]['addedSpotter'] = 1; |
@@ -713,18 +713,18 @@ discard block |
||
| 713 | 713 | */ |
| 714 | 714 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 715 | 715 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 716 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 717 | - //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 718 | - $SpotterLive = new SpotterLive($this->db); |
|
| 719 | - $SpotterLive->deleteLiveSpotterData(); |
|
| 720 | - $SpotterLive->db=null; |
|
| 721 | - if ($globalDebug) echo " Done\n"; |
|
| 722 | - $this->last_delete = time(); |
|
| 716 | + if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 717 | + //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 718 | + $SpotterLive = new SpotterLive($this->db); |
|
| 719 | + $SpotterLive->deleteLiveSpotterData(); |
|
| 720 | + $SpotterLive->db=null; |
|
| 721 | + if ($globalDebug) echo " Done\n"; |
|
| 722 | + $this->last_delete = time(); |
|
| 723 | 723 | } |
| 724 | - } else { |
|
| 724 | + } else { |
|
| 725 | 725 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
| 726 | - $this->all_flights[$id]['id'] = $recent_ident; |
|
| 727 | - $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 726 | + $this->all_flights[$id]['id'] = $recent_ident; |
|
| 727 | + $this->all_flights[$id]['addedSpotter'] = 1; |
|
| 728 | 728 | } |
| 729 | 729 | if (isset($globalDaemon) && !$globalDaemon) { |
| 730 | 730 | $Spotter = new Spotter($this->db); |
@@ -732,14 +732,14 @@ discard block |
||
| 732 | 732 | $Spotter->db = null; |
| 733 | 733 | } |
| 734 | 734 | |
| 735 | - } |
|
| 735 | + } |
|
| 736 | + } |
|
| 736 | 737 | } |
| 737 | - } |
|
| 738 | - //adds the spotter LIVE data |
|
| 739 | - //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 740 | - //echo "\nAdd in Live !! \n"; |
|
| 741 | - //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
| 742 | - if ($globalDebug) { |
|
| 738 | + //adds the spotter LIVE data |
|
| 739 | + //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
| 740 | + //echo "\nAdd in Live !! \n"; |
|
| 741 | + //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
| 742 | + if ($globalDebug) { |
|
| 743 | 743 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 744 | 744 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
| 745 | 745 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
@@ -747,49 +747,49 @@ discard block |
||
| 747 | 747 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
| 748 | 748 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
| 749 | 749 | } |
| 750 | - } |
|
| 751 | - $ignoreImport = false; |
|
| 752 | - if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 753 | - if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 750 | + } |
|
| 751 | + $ignoreImport = false; |
|
| 752 | + if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
| 753 | + if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
| 754 | 754 | |
| 755 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 756 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 757 | - $ignoreImport = true; |
|
| 755 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 756 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 757 | + $ignoreImport = true; |
|
| 758 | + } |
|
| 758 | 759 | } |
| 759 | - } |
|
| 760 | - if (count($globalAirportAccept) > 0) { |
|
| 761 | - $ignoreImport = true; |
|
| 762 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 763 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 760 | + if (count($globalAirportAccept) > 0) { |
|
| 761 | + $ignoreImport = true; |
|
| 762 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
| 763 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
| 764 | 764 | $ignoreImport = false; |
| 765 | - } |
|
| 765 | + } |
|
| 766 | 766 | } |
| 767 | - } |
|
| 768 | - if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 767 | + } |
|
| 768 | + if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
| 769 | 769 | foreach($globalAirlineIgnore as $airlineIgnore) { |
| 770 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 770 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 771 | 771 | $ignoreImport = true; |
| 772 | - } |
|
| 772 | + } |
|
| 773 | 773 | } |
| 774 | - } |
|
| 775 | - if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 774 | + } |
|
| 775 | + if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
| 776 | 776 | $ignoreImport = true; |
| 777 | 777 | foreach($globalAirlineAccept as $airlineAccept) { |
| 778 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 778 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 779 | 779 | $ignoreImport = false; |
| 780 | - } |
|
| 780 | + } |
|
| 781 | 781 | } |
| 782 | - } |
|
| 783 | - if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 782 | + } |
|
| 783 | + if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
| 784 | 784 | $ignoreImport = true; |
| 785 | 785 | foreach($globalPilotIdAccept as $pilotIdAccept) { |
| 786 | - if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 787 | - $ignoreImport = false; |
|
| 788 | - } |
|
| 786 | + if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
| 787 | + $ignoreImport = false; |
|
| 788 | + } |
|
| 789 | + } |
|
| 789 | 790 | } |
| 790 | - } |
|
| 791 | 791 | |
| 792 | - if (!$ignoreImport) { |
|
| 792 | + if (!$ignoreImport) { |
|
| 793 | 793 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 794 | 794 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 795 | 795 | $timeelapsed = microtime(true); |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | if ($stats_heading == 16) $stats_heading = 0; |
| 828 | 828 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 829 | 829 | for ($i=0;$i<=15;$i++) { |
| 830 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 830 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 831 | 831 | } |
| 832 | 832 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 833 | 833 | } else { |
@@ -840,11 +840,11 @@ discard block |
||
| 840 | 840 | //var_dump($this->stats); |
| 841 | 841 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 842 | 842 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 843 | - end($this->stats[$current_date][$source]['hist']); |
|
| 844 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 843 | + end($this->stats[$current_date][$source]['hist']); |
|
| 844 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 845 | 845 | } else $mini = 0; |
| 846 | 846 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 847 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 847 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 848 | 848 | } |
| 849 | 849 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 850 | 850 | } else { |
@@ -861,22 +861,22 @@ discard block |
||
| 861 | 861 | |
| 862 | 862 | |
| 863 | 863 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 864 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 865 | - $SpotterLive = new SpotterLive($this->db); |
|
| 866 | - $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 867 | - $SpotterLive->db = null; |
|
| 868 | - //SpotterLive->deleteLiveSpotterData(); |
|
| 869 | - if ($globalDebug) echo " Done\n"; |
|
| 870 | - $this->last_delete_hourly = time(); |
|
| 864 | + if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 865 | + $SpotterLive = new SpotterLive($this->db); |
|
| 866 | + $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
| 867 | + $SpotterLive->db = null; |
|
| 868 | + //SpotterLive->deleteLiveSpotterData(); |
|
| 869 | + if ($globalDebug) echo " Done\n"; |
|
| 870 | + $this->last_delete_hourly = time(); |
|
| 871 | 871 | } |
| 872 | 872 | |
| 873 | - } |
|
| 874 | - //$ignoreImport = false; |
|
| 873 | + } |
|
| 874 | + //$ignoreImport = false; |
|
| 875 | 875 | } |
| 876 | 876 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 877 | 877 | if ($send) return $this->all_flights[$id]; |
| 878 | - } |
|
| 878 | + } |
|
| 879 | + } |
|
| 879 | 880 | } |
| 880 | - } |
|
| 881 | 881 | } |
| 882 | 882 | ?> |
@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | $currentdate = date('Y-m-d'); |
| 30 | 30 | $sourcestat = $Stats->getStatsSource($currentdate); |
| 31 | 31 | if (!empty($sourcestat)) { |
| 32 | - foreach($sourcestat as $srcst) { |
|
| 32 | + foreach ($sourcestat as $srcst) { |
|
| 33 | 33 | $type = $srcst['stats_type']; |
| 34 | 34 | if ($type == 'polar' || $type == 'hist') { |
| 35 | 35 | $source = $srcst['source_name']; |
| 36 | 36 | $data = $srcst['source_data']; |
| 37 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
| 37 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | - public function get_Schedule($id,$ident) { |
|
| 43 | + public function get_Schedule($id, $ident) { |
|
| 44 | 44 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
| 45 | 45 | // Get schedule here, so it's done only one time |
| 46 | 46 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | $schedule = $Schedule->fetchSchedule($operator); |
| 66 | 66 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 67 | 67 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
| 68 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 69 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 68 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
| 69 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
| 70 | 70 | // Should also check if route schedule = route from DB |
| 71 | 71 | if ($schedule['DepartureAirportIATA'] != '') { |
| 72 | 72 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
| 89 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
| 90 | 90 | } |
| 91 | 91 | } else $scheduleexist = true; |
| 92 | 92 | } else $scheduleexist = true; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | if ($scheduleexist) { |
| 95 | 95 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
| 96 | 96 | $sch = $Schedule->getSchedule($operator); |
| 97 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
| 97 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport' => $sch['arrival_airport_icao'], 'departure_airport' => $sch['departure_airport_icao'], 'departure_airport_time' => $sch['departure_airport_time'], 'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
| 98 | 98 | } |
| 99 | 99 | $Spotter->db = null; |
| 100 | 100 | $Schedule->db = null; |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
| 121 | 121 | $Spotter = new Spotter($this->db); |
| 122 | 122 | $real_arrival = $this->arrival($key); |
| 123 | - $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 123 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
| 124 | 124 | } |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $airport_time = ''; |
| 134 | 134 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
| 135 | 135 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 136 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
| 136 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
| 137 | 137 | if (isset($closestAirports[0])) { |
| 138 | 138 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 139 | 139 | $airport_icao = $closestAirports[0]['icao']; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | break; |
| 149 | 149 | } |
| 150 | 150 | } |
| 151 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
| 151 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
| 152 | 152 | $airport_icao = $closestAirports[0]['icao']; |
| 153 | 153 | $airport_time = $this->all_flights[$key]['datetime']; |
| 154 | 154 | } else { |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } else { |
| 162 | 162 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
| 163 | 163 | } |
| 164 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
| 164 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 173 | 173 | foreach ($this->all_flights as $key => $flight) { |
| 174 | 174 | if (isset($flight['lastupdate'])) { |
| 175 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 175 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
| 176 | 176 | if (isset($this->all_flights[$key]['id'])) { |
| 177 | 177 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
| 178 | 178 | /* |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $real_arrival = $this->arrival($key); |
| 184 | 184 | $Spotter = new Spotter($this->db); |
| 185 | 185 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 186 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
| 186 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
| 187 | 187 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 188 | 188 | } |
| 189 | 189 | // Put in archive |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $send = false; |
| 220 | 220 | |
| 221 | 221 | // SBS format is CSV format |
| 222 | - if(is_array($line) && isset($line['hex'])) { |
|
| 222 | + if (is_array($line) && isset($line['hex'])) { |
|
| 223 | 223 | //print_r($line); |
| 224 | 224 | if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
| 225 | 225 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | //print_r($this->all_flights); |
| 254 | 254 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
| 255 | 255 | $this->all_flights[$id] = array('hex' => $hex); |
| 256 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 256 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 257 | 257 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 258 | 258 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 259 | 259 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | $Spotter = new Spotter($this->db); |
| 264 | 264 | $aircraft_icao = $Spotter->getAllAircraftType($hex); |
| 265 | 265 | $Spotter->db = null; |
| 266 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 266 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 267 | 267 | |
| 268 | 268 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
| 269 | 269 | if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
@@ -271,33 +271,33 @@ discard block |
||
| 271 | 271 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
| 272 | 272 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
| 273 | 273 | } |
| 274 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 274 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 275 | 275 | } else if (isset($line['aircraft_name'])) { |
| 276 | 276 | // Get aircraft ICAO from aircraft name |
| 277 | 277 | $Spotter = new Spotter($this->db); |
| 278 | 278 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 279 | 279 | $Spotter->db = null; |
| 280 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 281 | - else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
| 282 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 283 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
| 284 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
| 280 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
| 281 | + else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
| 282 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 283 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true)); |
|
| 284 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
| 285 | 285 | if (!isset($line['id'])) { |
| 286 | 286 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 287 | 287 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
| 288 | 288 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 289 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 289 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 290 | 290 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 291 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 291 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 292 | 292 | |
| 293 | 293 | if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
| 294 | 294 | if ($globalAllFlights !== FALSE) $dataFound = true; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
| 298 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) { |
|
| 298 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60) { |
|
| 299 | 299 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 300 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
| 300 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
| 301 | 301 | } else { |
| 302 | 302 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 303 | 303 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -310,24 +310,24 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | } else { |
| 312 | 312 | date_default_timezone_set('UTC'); |
| 313 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 313 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
| 317 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
| 317 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
| 318 | 318 | } |
| 319 | 319 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
| 320 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
| 320 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
| 321 | 321 | } |
| 322 | 322 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
| 323 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
| 323 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => $line['pilot_id'])); |
|
| 324 | 324 | } |
| 325 | 325 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
| 326 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
| 326 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => $line['pilot_name'])); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
| 330 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
| 330 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
| 331 | 331 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
| 332 | 332 | $timeelapsed = microtime(true); |
| 333 | 333 | $Spotter = new Spotter($this->db); |
@@ -337,10 +337,10 @@ discard block |
||
| 337 | 337 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 338 | 338 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 339 | 339 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 340 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
| 340 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
| 341 | 341 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 342 | 342 | $Spotter->db = null; |
| 343 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 343 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | /* |
@@ -351,24 +351,24 @@ discard block |
||
| 351 | 351 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 352 | 352 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 353 | 353 | */ |
| 354 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 354 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 355 | 355 | |
| 356 | 356 | //$putinarchive = true; |
| 357 | 357 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
| 358 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 358 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
| 359 | 359 | } |
| 360 | 360 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
| 361 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 361 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
| 362 | 362 | } |
| 363 | 363 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
| 364 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 364 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
| 365 | 365 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
| 366 | 366 | $timeelapsed = microtime(true); |
| 367 | 367 | $Spotter = new Spotter($this->db); |
| 368 | 368 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 369 | 369 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 370 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
| 371 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 370 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
| 371 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 372 | 372 | |
| 373 | 373 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 374 | 374 | $timeelapsed = microtime(true); |
@@ -381,34 +381,34 @@ discard block |
||
| 381 | 381 | $Translation->db = null; |
| 382 | 382 | } |
| 383 | 383 | $Spotter->db = null; |
| 384 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 384 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 385 | 385 | |
| 386 | 386 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 387 | 387 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
| 388 | 388 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
| 389 | 389 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
| 390 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
| 390 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
| 391 | 391 | } |
| 392 | 392 | } |
| 393 | 393 | if (!isset($globalFork)) $globalFork = TRUE; |
| 394 | 394 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 395 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 395 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | if (isset($line['speed']) && $line['speed'] != '') { |
| 401 | 401 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
| 402 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
| 403 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
| 402 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
| 403 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
| 404 | 404 | //$dataFound = true; |
| 405 | 405 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 406 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
| 406 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
| 407 | 407 | if ($distance > 1000 && $distance < 10000) { |
| 408 | 408 | // use datetime |
| 409 | 409 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 410 | 410 | $speed = $speed*3.6; |
| 411 | - if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 411 | + if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
| 412 | 412 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
| 413 | 413 | } |
| 414 | 414 | } |
@@ -416,11 +416,11 @@ discard block |
||
| 416 | 416 | |
| 417 | 417 | |
| 418 | 418 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 419 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 419 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
| 420 | 420 | else unset($timediff); |
| 421 | - if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
| 421 | + if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')))) { |
|
| 422 | 422 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
| 423 | - if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 423 | + if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
| 424 | 424 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 425 | 425 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 426 | 426 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -428,10 +428,10 @@ discard block |
||
| 428 | 428 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
| 429 | 429 | $timeelapsed = microtime(true); |
| 430 | 430 | $Spotter = new Spotter($this->db); |
| 431 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 431 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
| 432 | 432 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
| 433 | 433 | $Spotter->db = null; |
| 434 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 434 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 435 | 435 | $this->tmd = 0; |
| 436 | 436 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
| 437 | 437 | } |
@@ -440,13 +440,13 @@ discard block |
||
| 440 | 440 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 441 | 441 | //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 442 | 442 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
| 443 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
| 443 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
| 444 | 444 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
| 445 | 445 | $dataFound = true; |
| 446 | 446 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 447 | 447 | } |
| 448 | 448 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 449 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
| 449 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
| 450 | 450 | /* |
| 451 | 451 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
| 452 | 452 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -464,13 +464,13 @@ discard block |
||
| 464 | 464 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
| 465 | 465 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 466 | 466 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 467 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
| 467 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
|
| 468 | 468 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
| 469 | 469 | $dataFound = true; |
| 470 | 470 | $this->all_flights[$id]['time_last_coord'] = time(); |
| 471 | 471 | } |
| 472 | 472 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
| 473 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
| 473 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
| 474 | 474 | /* |
| 475 | 475 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
| 476 | 476 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -488,45 +488,45 @@ discard block |
||
| 488 | 488 | } else if ($globalDebug && $timediff > 20) { |
| 489 | 489 | $this->tmd = $this->tmd + 1; |
| 490 | 490 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
| 491 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
| 492 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
| 491 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
| 492 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
| 493 | 493 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
| 494 | 494 | } |
| 495 | 495 | } |
| 496 | 496 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 497 | 497 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
| 498 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
| 498 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
| 499 | 499 | } |
| 500 | 500 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
| 501 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
| 501 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
| 502 | 502 | //$dataFound = true; |
| 503 | 503 | } |
| 504 | 504 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 505 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
| 505 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
| 506 | 506 | } |
| 507 | 507 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 508 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
| 508 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
| 509 | 509 | } |
| 510 | 510 | if (isset($line['emergency']) && $line['emergency'] != '') { |
| 511 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
| 511 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
| 512 | 512 | //$dataFound = true; |
| 513 | 513 | } |
| 514 | 514 | if (isset($line['ground']) && $line['ground'] != '') { |
| 515 | 515 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
| 516 | 516 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 517 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
| 518 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
| 519 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
| 520 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 521 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 517 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
| 518 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
| 519 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
| 520 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
| 521 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 522 | 522 | } |
| 523 | 523 | if ($line['ground'] != 1) $line['ground'] = 0; |
| 524 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
| 524 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
| 525 | 525 | //$dataFound = true; |
| 526 | 526 | } |
| 527 | 527 | if (isset($line['squawk']) && $line['squawk'] != '') { |
| 528 | 528 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
| 529 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 529 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 530 | 530 | $highlight = ''; |
| 531 | 531 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
| 532 | 532 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -534,48 +534,48 @@ discard block |
||
| 534 | 534 | if ($highlight != '') { |
| 535 | 535 | $timeelapsed = microtime(true); |
| 536 | 536 | $Spotter = new Spotter($this->db); |
| 537 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
| 537 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
| 538 | 538 | $Spotter->db = null; |
| 539 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 539 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 540 | 540 | |
| 541 | 541 | $this->all_flights[$id]['putinarchive'] = true; |
| 542 | 542 | //$putinarchive = true; |
| 543 | 543 | //$highlight = ''; |
| 544 | 544 | } |
| 545 | 545 | |
| 546 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 546 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
| 547 | 547 | //$dataFound = true; |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 551 | 551 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 552 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 553 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
| 554 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
| 552 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 553 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
| 554 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
| 555 | 555 | //$dataFound = true; |
| 556 | 556 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 560 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
| 560 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | if (isset($line['heading']) && $line['heading'] != '') { |
| 564 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 565 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
| 566 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
| 564 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 565 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
| 566 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
| 567 | 567 | //$dataFound = true; |
| 568 | 568 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 569 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 570 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
| 571 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 569 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 570 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
| 571 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 572 | 572 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
| 573 | 573 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 574 | 574 | // If not enough messages and ACARS set heading to 0 |
| 575 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
| 575 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
| 576 | 576 | } |
| 577 | - if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 578 | - elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 577 | + if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 578 | + elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 579 | 579 | |
| 580 | 580 | // print_r($this->all_flights[$id]); |
| 581 | 581 | //gets the callsign from the last hour |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
| 586 | 586 | $this->all_flights[$id]['lastupdate'] = time(); |
| 587 | 587 | if ($this->all_flights[$id]['addedSpotter'] == 0) { |
| 588 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 588 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 589 | 589 | //print_r($this->all_flights); |
| 590 | 590 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
| 591 | 591 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -595,61 +595,61 @@ discard block |
||
| 595 | 595 | $SpotterLive = new SpotterLive($this->db); |
| 596 | 596 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
| 597 | 597 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 598 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 598 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 599 | 599 | } elseif (isset($line['id'])) { |
| 600 | 600 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 601 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 601 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 602 | 602 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 603 | 603 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 604 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 604 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 605 | 605 | } else $recent_ident = ''; |
| 606 | - $SpotterLive->db=null; |
|
| 606 | + $SpotterLive->db = null; |
|
| 607 | 607 | |
| 608 | 608 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 609 | 609 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 610 | 610 | } else { |
| 611 | 611 | $recent_ident = ''; |
| 612 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
| 612 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
| 613 | 613 | } |
| 614 | 614 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 615 | - if($recent_ident == "") |
|
| 615 | + if ($recent_ident == "") |
|
| 616 | 616 | { |
| 617 | 617 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
| 618 | 618 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 619 | 619 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 620 | 620 | //adds the spotter data for the archive |
| 621 | 621 | $ignoreImport = false; |
| 622 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 622 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 623 | 623 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 624 | 624 | $ignoreImport = true; |
| 625 | 625 | } |
| 626 | 626 | } |
| 627 | 627 | if (count($globalAirportAccept) > 0) { |
| 628 | 628 | $ignoreImport = true; |
| 629 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 629 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 630 | 630 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 631 | 631 | $ignoreImport = false; |
| 632 | 632 | } |
| 633 | 633 | } |
| 634 | 634 | } |
| 635 | 635 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 636 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 637 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 636 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 637 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
| 638 | 638 | $ignoreImport = true; |
| 639 | 639 | } |
| 640 | 640 | } |
| 641 | 641 | } |
| 642 | 642 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 643 | 643 | $ignoreImport = true; |
| 644 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 645 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 644 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 645 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
| 646 | 646 | $ignoreImport = false; |
| 647 | 647 | } |
| 648 | 648 | } |
| 649 | 649 | } |
| 650 | 650 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 651 | 651 | $ignoreImport = true; |
| 652 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 652 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 653 | 653 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 654 | 654 | $ignoreImport = false; |
| 655 | 655 | } |
@@ -661,27 +661,27 @@ discard block |
||
| 661 | 661 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
| 662 | 662 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
| 663 | 663 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
| 664 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 664 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 665 | 665 | $timeelapsed = microtime(true); |
| 666 | 666 | $Spotter = new Spotter($this->db); |
| 667 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
| 667 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name']); |
|
| 668 | 668 | $Spotter->db = null; |
| 669 | 669 | if ($globalDebug && isset($result)) echo $result."\n"; |
| 670 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 670 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 671 | 671 | |
| 672 | 672 | // Add source stat in DB |
| 673 | 673 | $Stats = new Stats($this->db); |
| 674 | 674 | if (!empty($this->stats)) { |
| 675 | 675 | if ($globalDebug) echo 'Add source stats : '; |
| 676 | - foreach($this->stats as $date => $data) { |
|
| 677 | - foreach($data as $source => $sourced) { |
|
| 676 | + foreach ($this->stats as $date => $data) { |
|
| 677 | + foreach ($data as $source => $sourced) { |
|
| 678 | 678 | //print_r($sourced); |
| 679 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 680 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 679 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
| 680 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
| 681 | 681 | if (isset($sourced['msg'])) { |
| 682 | 682 | if (time() - $sourced['msg']['date'] > 10) { |
| 683 | 683 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
| 684 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
| 684 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
| 685 | 685 | unset($this->stats[$date][$source]['msg']); |
| 686 | 686 | } |
| 687 | 687 | } |
@@ -717,18 +717,18 @@ discard block |
||
| 717 | 717 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 718 | 718 | $SpotterLive = new SpotterLive($this->db); |
| 719 | 719 | $SpotterLive->deleteLiveSpotterData(); |
| 720 | - $SpotterLive->db=null; |
|
| 720 | + $SpotterLive->db = null; |
|
| 721 | 721 | if ($globalDebug) echo " Done\n"; |
| 722 | 722 | $this->last_delete = time(); |
| 723 | 723 | } |
| 724 | 724 | } else { |
| 725 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
|
| 725 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
|
| 726 | 726 | $this->all_flights[$id]['id'] = $recent_ident; |
| 727 | 727 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 728 | 728 | } |
| 729 | 729 | if (isset($globalDaemon) && !$globalDaemon) { |
| 730 | 730 | $Spotter = new Spotter($this->db); |
| 731 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
| 731 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
| 732 | 732 | $Spotter->db = null; |
| 733 | 733 | } |
| 734 | 734 | |
@@ -752,37 +752,37 @@ discard block |
||
| 752 | 752 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 753 | 753 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 754 | 754 | |
| 755 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 755 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 756 | 756 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 757 | 757 | $ignoreImport = true; |
| 758 | 758 | } |
| 759 | 759 | } |
| 760 | 760 | if (count($globalAirportAccept) > 0) { |
| 761 | 761 | $ignoreImport = true; |
| 762 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
| 762 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
| 763 | 763 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
| 764 | 764 | $ignoreImport = false; |
| 765 | 765 | } |
| 766 | 766 | } |
| 767 | 767 | } |
| 768 | 768 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
| 769 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
| 770 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
| 769 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
| 770 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
| 771 | 771 | $ignoreImport = true; |
| 772 | 772 | } |
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | 775 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
| 776 | 776 | $ignoreImport = true; |
| 777 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
| 778 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
| 777 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
| 778 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
| 779 | 779 | $ignoreImport = false; |
| 780 | 780 | } |
| 781 | 781 | } |
| 782 | 782 | } |
| 783 | 783 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
| 784 | 784 | $ignoreImport = true; |
| 785 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
| 785 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
| 786 | 786 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
| 787 | 787 | $ignoreImport = false; |
| 788 | 788 | } |
@@ -790,13 +790,13 @@ discard block |
||
| 790 | 790 | } |
| 791 | 791 | |
| 792 | 792 | if (!$ignoreImport) { |
| 793 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 793 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
| 794 | 794 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
| 795 | 795 | $timeelapsed = microtime(true); |
| 796 | 796 | $SpotterLive = new SpotterLive($this->db); |
| 797 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
| 797 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
| 798 | 798 | $SpotterLive->db = null; |
| 799 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 799 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 800 | 800 | |
| 801 | 801 | // Put statistics in $this->stats variable |
| 802 | 802 | //if ($line['format_source'] != 'aprs') { |
@@ -814,19 +814,19 @@ discard block |
||
| 814 | 814 | $latitude = $globalCenterLatitude; |
| 815 | 815 | $longitude = $globalCenterLongitude; |
| 816 | 816 | } |
| 817 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
| 817 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
| 818 | 818 | } else { |
| 819 | 819 | $latitude = $this->source_location[$source]['latitude']; |
| 820 | 820 | $longitude = $this->source_location[$source]['longitude']; |
| 821 | 821 | } |
| 822 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 822 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 823 | 823 | //$stats_heading = $stats_heading%22.5; |
| 824 | 824 | $stats_heading = round($stats_heading/22.5); |
| 825 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
| 825 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
| 826 | 826 | $current_date = date('Y-m-d'); |
| 827 | 827 | if ($stats_heading == 16) $stats_heading = 0; |
| 828 | 828 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 829 | - for ($i=0;$i<=15;$i++) { |
|
| 829 | + for ($i = 0; $i <= 15; $i++) { |
|
| 830 | 830 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
| 831 | 831 | } |
| 832 | 832 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -841,9 +841,9 @@ discard block |
||
| 841 | 841 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 842 | 842 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 843 | 843 | end($this->stats[$current_date][$source]['hist']); |
| 844 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 844 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
| 845 | 845 | } else $mini = 0; |
| 846 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
| 846 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
| 847 | 847 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 848 | 848 | } |
| 849 | 849 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
| 857 | 857 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 858 | 858 | if ($globalDebug) echo $result."\n"; |
| 859 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 859 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
| 860 | 860 | //$this->del(); |
| 861 | 861 | |
| 862 | 862 | |
@@ -53,7 +53,9 @@ discard block |
||
| 53 | 53 | $dbc = $this->db; |
| 54 | 54 | $this->all_flights[$id]['schedule_check'] = true; |
| 55 | 55 | if ($globalSchedulesFetch) { |
| 56 | - if ($globalDebug) echo 'Getting schedule info...'."\n"; |
|
| 56 | + if ($globalDebug) { |
|
| 57 | + echo 'Getting schedule info...'."\n"; |
|
| 58 | + } |
|
| 57 | 59 | $Spotter = new Spotter($dbc); |
| 58 | 60 | $Schedule = new Schedule($dbc); |
| 59 | 61 | $Translation = new Translation($dbc); |
@@ -64,7 +66,9 @@ discard block |
||
| 64 | 66 | if ($Schedule->checkSchedule($operator) == 0) { |
| 65 | 67 | $schedule = $Schedule->fetchSchedule($operator); |
| 66 | 68 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
| 67 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 69 | + if ($globalDebug) { |
|
| 70 | + echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
| 71 | + } |
|
| 68 | 72 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
| 69 | 73 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
| 70 | 74 | // Should also check if route schedule = route from DB |
@@ -73,7 +77,9 @@ discard block |
||
| 73 | 77 | $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
| 74 | 78 | if (trim($airport_icao) != '') { |
| 75 | 79 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
| 76 | - if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 80 | + if ($globalDebug) { |
|
| 81 | + echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
|
| 82 | + } |
|
| 77 | 83 | } |
| 78 | 84 | } |
| 79 | 85 | } |
@@ -82,17 +88,25 @@ discard block |
||
| 82 | 88 | $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
| 83 | 89 | if (trim($airport_icao) != '') { |
| 84 | 90 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
| 85 | - if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 91 | + if ($globalDebug) { |
|
| 92 | + echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
|
| 93 | + } |
|
| 86 | 94 | } |
| 87 | 95 | } |
| 88 | 96 | } |
| 89 | 97 | $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
| 90 | 98 | } |
| 91 | - } else $scheduleexist = true; |
|
| 92 | - } else $scheduleexist = true; |
|
| 99 | + } else { |
|
| 100 | + $scheduleexist = true; |
|
| 101 | + } |
|
| 102 | + } else { |
|
| 103 | + $scheduleexist = true; |
|
| 104 | + } |
|
| 93 | 105 | // close connection, at least one way will work ? |
| 94 | 106 | if ($scheduleexist) { |
| 95 | - if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
| 107 | + if ($globalDebug) { |
|
| 108 | + echo "-> get arrival/departure airport info for ".$ident."\n"; |
|
| 109 | + } |
|
| 96 | 110 | $sch = $Schedule->getSchedule($operator); |
| 97 | 111 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
| 98 | 112 | } |
@@ -114,7 +128,9 @@ discard block |
||
| 114 | 128 | |
| 115 | 129 | public function checkAll() { |
| 116 | 130 | global $globalDebug; |
| 117 | - if ($globalDebug) echo "Update last seen flights data...\n"; |
|
| 131 | + if ($globalDebug) { |
|
| 132 | + echo "Update last seen flights data...\n"; |
|
| 133 | + } |
|
| 118 | 134 | foreach ($this->all_flights as $key => $flight) { |
| 119 | 135 | if (isset($this->all_flights[$key]['id'])) { |
| 120 | 136 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
@@ -127,24 +143,32 @@ discard block |
||
| 127 | 143 | |
| 128 | 144 | public function arrival($key) { |
| 129 | 145 | global $globalClosestMinDist, $globalDebug; |
| 130 | - if ($globalDebug) echo 'Update arrival...'."\n"; |
|
| 146 | + if ($globalDebug) { |
|
| 147 | + echo 'Update arrival...'."\n"; |
|
| 148 | + } |
|
| 131 | 149 | $Spotter = new Spotter($this->db); |
| 132 | 150 | $airport_icao = ''; |
| 133 | 151 | $airport_time = ''; |
| 134 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
| 152 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') { |
|
| 153 | + $globalClosestMinDist = 50; |
|
| 154 | + } |
|
| 135 | 155 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 136 | 156 | $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
| 137 | 157 | if (isset($closestAirports[0])) { |
| 138 | 158 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
| 139 | 159 | $airport_icao = $closestAirports[0]['icao']; |
| 140 | 160 | $airport_time = $this->all_flights[$key]['datetime']; |
| 141 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 161 | + if ($globalDebug) { |
|
| 162 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 163 | + } |
|
| 142 | 164 | } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
| 143 | 165 | foreach ($closestAirports as $airport) { |
| 144 | 166 | if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
| 145 | 167 | $airport_icao = $airport['icao']; |
| 146 | 168 | $airport_time = $this->all_flights[$key]['datetime']; |
| 147 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 169 | + if ($globalDebug) { |
|
| 170 | + echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
| 171 | + } |
|
| 148 | 172 | break; |
| 149 | 173 | } |
| 150 | 174 | } |
@@ -152,14 +176,20 @@ discard block |
||
| 152 | 176 | $airport_icao = $closestAirports[0]['icao']; |
| 153 | 177 | $airport_time = $this->all_flights[$key]['datetime']; |
| 154 | 178 | } else { |
| 155 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 179 | + if ($globalDebug) { |
|
| 180 | + echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
| 181 | + } |
|
| 156 | 182 | } |
| 157 | 183 | } else { |
| 158 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 184 | + if ($globalDebug) { |
|
| 185 | + echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
| 186 | + } |
|
| 159 | 187 | } |
| 160 | 188 | |
| 161 | 189 | } else { |
| 162 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 190 | + if ($globalDebug) { |
|
| 191 | + echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
| 192 | + } |
|
| 163 | 193 | } |
| 164 | 194 | return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
| 165 | 195 | } |
@@ -169,12 +199,16 @@ discard block |
||
| 169 | 199 | public function del() { |
| 170 | 200 | global $globalDebug; |
| 171 | 201 | // Delete old infos |
| 172 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
| 202 | + if ($globalDebug) { |
|
| 203 | + echo 'Delete old values and update latest data...'."\n"; |
|
| 204 | + } |
|
| 173 | 205 | foreach ($this->all_flights as $key => $flight) { |
| 174 | 206 | if (isset($flight['lastupdate'])) { |
| 175 | 207 | if ($flight['lastupdate'] < (time()-3000)) { |
| 176 | 208 | if (isset($this->all_flights[$key]['id'])) { |
| 177 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 209 | + if ($globalDebug) { |
|
| 210 | + echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
| 211 | + } |
|
| 178 | 212 | /* |
| 179 | 213 | $SpotterLive = new SpotterLive(); |
| 180 | 214 | $SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']); |
@@ -184,7 +218,9 @@ discard block |
||
| 184 | 218 | $Spotter = new Spotter($this->db); |
| 185 | 219 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
| 186 | 220 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
| 187 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 221 | + if ($globalDebug && $result != 'success') { |
|
| 222 | + echo '!!! ERROR : '.$result."\n"; |
|
| 223 | + } |
|
| 188 | 224 | } |
| 189 | 225 | // Put in archive |
| 190 | 226 | // $Spotter->db = null; |
@@ -198,8 +234,10 @@ discard block |
||
| 198 | 234 | public function add($line) { |
| 199 | 235 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights; |
| 200 | 236 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
| 201 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
|
| 202 | -/* |
|
| 237 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
| 238 | + $globalCoordMinChange = '0.02'; |
|
| 239 | + } |
|
| 240 | + /* |
|
| 203 | 241 | $Spotter = new Spotter(); |
| 204 | 242 | $dbc = $Spotter->db; |
| 205 | 243 | $SpotterLive = new SpotterLive($dbc); |
@@ -227,11 +265,15 @@ discard block |
||
| 227 | 265 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 228 | 266 | $current_date = date('Y-m-d'); |
| 229 | 267 | $source = $line['source_name']; |
| 230 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 268 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
| 269 | + $source = $line['format_source']; |
|
| 270 | + } |
|
| 231 | 271 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
| 232 | 272 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
| 233 | 273 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
| 234 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 274 | + } else { |
|
| 275 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 276 | + } |
|
| 235 | 277 | } |
| 236 | 278 | |
| 237 | 279 | /* |
@@ -247,8 +289,11 @@ discard block |
||
| 247 | 289 | //$this->db = $dbc; |
| 248 | 290 | |
| 249 | 291 | $hex = trim($line['hex']); |
| 250 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
| 251 | - else $id = trim($line['id']); |
|
| 292 | + if (!isset($line['id'])) { |
|
| 293 | + $id = trim($line['hex']); |
|
| 294 | + } else { |
|
| 295 | + $id = trim($line['id']); |
|
| 296 | + } |
|
| 252 | 297 | |
| 253 | 298 | //print_r($this->all_flights); |
| 254 | 299 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
@@ -263,13 +308,20 @@ discard block |
||
| 263 | 308 | $Spotter = new Spotter($this->db); |
| 264 | 309 | $aircraft_icao = $Spotter->getAllAircraftType($hex); |
| 265 | 310 | $Spotter->db = null; |
| 266 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 311 | + if ($globalDebugTimeElapsed) { |
|
| 312 | + echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 313 | + } |
|
| 267 | 314 | |
| 268 | 315 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
| 269 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
| 270 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
| 271 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
| 272 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
| 316 | + if ($line['aircraft_type'] == 'PARA_GLIDER') { |
|
| 317 | + $aircraft_icao = 'GLID'; |
|
| 318 | + } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') { |
|
| 319 | + $aircraft_icao = 'UHEL'; |
|
| 320 | + } elseif ($line['aircraft_type'] == 'TOW_PLANE') { |
|
| 321 | + $aircraft_icao = 'TOWPLANE'; |
|
| 322 | + } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') { |
|
| 323 | + $aircraft_icao = 'POWAIRC'; |
|
| 324 | + } |
|
| 273 | 325 | } |
| 274 | 326 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
| 275 | 327 | } else if (isset($line['aircraft_name'])) { |
@@ -277,21 +329,36 @@ discard block |
||
| 277 | 329 | $Spotter = new Spotter($this->db); |
| 278 | 330 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
| 279 | 331 | $Spotter->db = null; |
| 280 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 281 | - else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
| 282 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 332 | + if ($aircraft_icao != '') { |
|
| 333 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
| 334 | + } else { |
|
| 335 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
| 336 | + } |
|
| 337 | + } else { |
|
| 338 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
| 339 | + } |
|
| 283 | 340 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
| 284 | 341 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
| 285 | 342 | if (!isset($line['id'])) { |
| 286 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 287 | -// if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
| 343 | + if (!isset($globalDaemon)) { |
|
| 344 | + $globalDaemon = TRUE; |
|
| 345 | + } |
|
| 346 | + // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
|
| 288 | 347 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
| 289 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 348 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
|
| 349 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 350 | + } |
|
| 290 | 351 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 291 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 352 | + } else { |
|
| 353 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 354 | + } |
|
| 292 | 355 | |
| 293 | - if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
| 294 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
| 356 | + if ($globalDebug) { |
|
| 357 | + echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
| 358 | + } |
|
| 359 | + if ($globalAllFlights !== FALSE) { |
|
| 360 | + $dataFound = true; |
|
| 361 | + } |
|
| 295 | 362 | } |
| 296 | 363 | |
| 297 | 364 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
@@ -299,8 +366,11 @@ discard block |
||
| 299 | 366 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
| 300 | 367 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
| 301 | 368 | } else { |
| 302 | - if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 303 | - elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 369 | + if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 370 | + echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 371 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) { |
|
| 372 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 373 | + } |
|
| 304 | 374 | /* |
| 305 | 375 | echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']); |
| 306 | 376 | print_r($this->all_flights[$id]); |
@@ -332,15 +402,25 @@ discard block |
||
| 332 | 402 | $timeelapsed = microtime(true); |
| 333 | 403 | $Spotter = new Spotter($this->db); |
| 334 | 404 | $fromsource = NULL; |
| 335 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
| 336 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
| 337 | - elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
| 338 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
| 339 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
| 405 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
| 406 | + $fromsource = $globalAirlinesSource; |
|
| 407 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') { |
|
| 408 | + $fromsource = 'vatsim'; |
|
| 409 | + } elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') { |
|
| 410 | + $fromsource = 'ivao'; |
|
| 411 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
| 412 | + $fromsource = 'vatsim'; |
|
| 413 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
| 414 | + $fromsource = 'ivao'; |
|
| 415 | + } |
|
| 340 | 416 | $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
| 341 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 417 | + if ($globalDebug && $result != 'success') { |
|
| 418 | + echo '!!! ERROR : '.$result."\n"; |
|
| 419 | + } |
|
| 342 | 420 | $Spotter->db = null; |
| 343 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 421 | + if ($globalDebugTimeElapsed) { |
|
| 422 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 423 | + } |
|
| 344 | 424 | } |
| 345 | 425 | |
| 346 | 426 | /* |
@@ -351,7 +431,9 @@ discard block |
||
| 351 | 431 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
| 352 | 432 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
| 353 | 433 | */ |
| 354 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 434 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 435 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 436 | + } |
|
| 355 | 437 | |
| 356 | 438 | //$putinarchive = true; |
| 357 | 439 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
@@ -368,7 +450,9 @@ discard block |
||
| 368 | 450 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
| 369 | 451 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
| 370 | 452 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
| 371 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 453 | + if ($globalDebugTimeElapsed) { |
|
| 454 | + echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 455 | + } |
|
| 372 | 456 | |
| 373 | 457 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
| 374 | 458 | $timeelapsed = microtime(true); |
@@ -381,7 +465,9 @@ discard block |
||
| 381 | 465 | $Translation->db = null; |
| 382 | 466 | } |
| 383 | 467 | $Spotter->db = null; |
| 384 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 468 | + if ($globalDebugTimeElapsed) { |
|
| 469 | + echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 470 | + } |
|
| 385 | 471 | |
| 386 | 472 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
| 387 | 473 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
@@ -390,9 +476,13 @@ discard block |
||
| 390 | 476 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
| 391 | 477 | } |
| 392 | 478 | } |
| 393 | - if (!isset($globalFork)) $globalFork = TRUE; |
|
| 479 | + if (!isset($globalFork)) { |
|
| 480 | + $globalFork = TRUE; |
|
| 481 | + } |
|
| 394 | 482 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
| 395 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
| 483 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) { |
|
| 484 | + $this->get_Schedule($id,trim($line['ident'])); |
|
| 485 | + } |
|
| 396 | 486 | } |
| 397 | 487 | } |
| 398 | 488 | } |
@@ -408,16 +498,23 @@ discard block |
||
| 408 | 498 | // use datetime |
| 409 | 499 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
| 410 | 500 | $speed = $speed*3.6; |
| 411 | - if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 412 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
| 501 | + if ($speed < 1000) { |
|
| 502 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
| 503 | + } |
|
| 504 | + if ($globalDebug) { |
|
| 505 | + echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
| 506 | + } |
|
| 413 | 507 | } |
| 414 | 508 | } |
| 415 | 509 | |
| 416 | 510 | |
| 417 | 511 | |
| 418 | 512 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 419 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 420 | - else unset($timediff); |
|
| 513 | + if (isset($this->all_flights[$id]['time_last_coord'])) { |
|
| 514 | + $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
| 515 | + } else { |
|
| 516 | + unset($timediff); |
|
| 517 | + } |
|
| 421 | 518 | if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
| 422 | 519 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
| 423 | 520 | if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
@@ -425,21 +522,31 @@ discard block |
||
| 425 | 522 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
| 426 | 523 | $this->all_flights[$id]['putinarchive'] = true; |
| 427 | 524 | |
| 428 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 525 | + if ($globalDebug) { |
|
| 526 | + echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 527 | + } |
|
| 429 | 528 | $timeelapsed = microtime(true); |
| 430 | 529 | $Spotter = new Spotter($this->db); |
| 431 | 530 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 432 | - if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 531 | + if (!empty($all_country)) { |
|
| 532 | + $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
|
| 533 | + } |
|
| 433 | 534 | $Spotter->db = null; |
| 434 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 535 | + if ($globalDebugTimeElapsed) { |
|
| 536 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 537 | + } |
|
| 435 | 538 | $this->tmd = 0; |
| 436 | - if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 539 | + if ($globalDebug) { |
|
| 540 | + echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
|
| 541 | + } |
|
| 437 | 542 | } |
| 438 | 543 | } |
| 439 | 544 | |
| 440 | 545 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 441 | 546 | //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 442 | - if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
|
| 547 | + if (!isset($this->all_flights[$id]['archive_latitude'])) { |
|
| 548 | + $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
|
| 549 | + } |
|
| 443 | 550 | if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
| 444 | 551 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
| 445 | 552 | $dataFound = true; |
@@ -461,9 +568,13 @@ discard block |
||
| 461 | 568 | */ |
| 462 | 569 | } |
| 463 | 570 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 464 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 571 | + if ($line['longitude'] > 180) { |
|
| 572 | + $line['longitude'] = $line['longitude'] - 360; |
|
| 573 | + } |
|
| 465 | 574 | //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
| 466 | - if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
|
| 575 | + if (!isset($this->all_flights[$id]['archive_longitude'])) { |
|
| 576 | + $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
|
| 577 | + } |
|
| 467 | 578 | if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
| 468 | 579 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
| 469 | 580 | $dataFound = true; |
@@ -494,7 +605,9 @@ discard block |
||
| 494 | 605 | } |
| 495 | 606 | } |
| 496 | 607 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 497 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 608 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) { |
|
| 609 | + $dataFound = true; |
|
| 610 | + } |
|
| 498 | 611 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
| 499 | 612 | } |
| 500 | 613 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
@@ -516,11 +629,17 @@ discard block |
||
| 516 | 629 | // Here we force archive of flight because after ground it's a new one (or should be) |
| 517 | 630 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
| 518 | 631 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
| 519 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
| 520 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 521 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 632 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) { |
|
| 633 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
|
| 634 | + } elseif (isset($line['id'])) { |
|
| 635 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
| 636 | + } elseif (isset($this->all_flights[$id]['ident'])) { |
|
| 637 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
| 638 | + } |
|
| 639 | + } |
|
| 640 | + if ($line['ground'] != 1) { |
|
| 641 | + $line['ground'] = 0; |
|
| 522 | 642 | } |
| 523 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
| 524 | 643 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
| 525 | 644 | //$dataFound = true; |
| 526 | 645 | } |
@@ -528,28 +647,40 @@ discard block |
||
| 528 | 647 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
| 529 | 648 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
| 530 | 649 | $highlight = ''; |
| 531 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 532 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 533 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 650 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 651 | + $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
| 652 | + } |
|
| 653 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 654 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
| 655 | + } |
|
| 656 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 657 | + $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
| 658 | + } |
|
| 534 | 659 | if ($highlight != '') { |
| 535 | 660 | $timeelapsed = microtime(true); |
| 536 | 661 | $Spotter = new Spotter($this->db); |
| 537 | 662 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
| 538 | 663 | $Spotter->db = null; |
| 539 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 664 | + if ($globalDebugTimeElapsed) { |
|
| 665 | + echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 666 | + } |
|
| 540 | 667 | |
| 541 | 668 | $this->all_flights[$id]['putinarchive'] = true; |
| 542 | 669 | //$putinarchive = true; |
| 543 | 670 | //$highlight = ''; |
| 544 | 671 | } |
| 545 | 672 | |
| 546 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 673 | + } else { |
|
| 674 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
| 675 | + } |
|
| 547 | 676 | //$dataFound = true; |
| 548 | 677 | } |
| 549 | 678 | |
| 550 | 679 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 551 | 680 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
| 552 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 681 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) { |
|
| 682 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 683 | + } |
|
| 553 | 684 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
| 554 | 685 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
| 555 | 686 | //$dataFound = true; |
@@ -561,21 +692,30 @@ discard block |
||
| 561 | 692 | } |
| 562 | 693 | |
| 563 | 694 | if (isset($line['heading']) && $line['heading'] != '') { |
| 564 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 695 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) { |
|
| 696 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 697 | + } |
|
| 565 | 698 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
| 566 | 699 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
| 567 | 700 | //$dataFound = true; |
| 568 | 701 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
| 569 | 702 | $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 570 | 703 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
| 571 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
| 572 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 704 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) { |
|
| 705 | + $this->all_flights[$id]['putinarchive'] = true; |
|
| 706 | + } |
|
| 707 | + if ($globalDebug) { |
|
| 708 | + echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
| 709 | + } |
|
| 573 | 710 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
| 574 | 711 | // If not enough messages and ACARS set heading to 0 |
| 575 | 712 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
| 576 | 713 | } |
| 577 | - if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
| 578 | - elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
| 714 | + if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) { |
|
| 715 | + $dataFound = false; |
|
| 716 | + } elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) { |
|
| 717 | + $dataFound = false; |
|
| 718 | + } |
|
| 579 | 719 | |
| 580 | 720 | // print_r($this->all_flights[$id]); |
| 581 | 721 | //gets the callsign from the last hour |
@@ -590,23 +730,36 @@ discard block |
||
| 590 | 730 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
| 591 | 731 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
| 592 | 732 | if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
| 593 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 733 | + if ($globalDebug) { |
|
| 734 | + echo "Check if aircraft is already in DB..."; |
|
| 735 | + } |
|
| 594 | 736 | $timeelapsed = microtime(true); |
| 595 | 737 | $SpotterLive = new SpotterLive($this->db); |
| 596 | 738 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
| 597 | 739 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
| 598 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 740 | + if ($globalDebugTimeElapsed) { |
|
| 741 | + echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 742 | + } |
|
| 599 | 743 | } elseif (isset($line['id'])) { |
| 600 | 744 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
| 601 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 745 | + if ($globalDebugTimeElapsed) { |
|
| 746 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 747 | + } |
|
| 602 | 748 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
| 603 | 749 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
| 604 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 605 | - } else $recent_ident = ''; |
|
| 750 | + if ($globalDebugTimeElapsed) { |
|
| 751 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 752 | + } |
|
| 753 | + } else { |
|
| 754 | + $recent_ident = ''; |
|
| 755 | + } |
|
| 606 | 756 | $SpotterLive->db=null; |
| 607 | 757 | |
| 608 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 609 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 758 | + if ($globalDebug && $recent_ident == '') { |
|
| 759 | + echo " Not in DB.\n"; |
|
| 760 | + } elseif ($globalDebug && $recent_ident != '') { |
|
| 761 | + echo " Already in DB.\n"; |
|
| 762 | + } |
|
| 610 | 763 | } else { |
| 611 | 764 | $recent_ident = ''; |
| 612 | 765 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
@@ -614,7 +767,9 @@ discard block |
||
| 614 | 767 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
| 615 | 768 | if($recent_ident == "") |
| 616 | 769 | { |
| 617 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 770 | + if ($globalDebug) { |
|
| 771 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
|
| 772 | + } |
|
| 618 | 773 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
| 619 | 774 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
| 620 | 775 | //adds the spotter data for the archive |
@@ -658,26 +813,44 @@ discard block |
||
| 658 | 813 | |
| 659 | 814 | if (!$ignoreImport) { |
| 660 | 815 | $highlight = ''; |
| 661 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
| 662 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 663 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
| 664 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 816 | + if ($this->all_flights[$id]['squawk'] == '7500') { |
|
| 817 | + $highlight = 'Squawk 7500 : Hijack'; |
|
| 818 | + } |
|
| 819 | + if ($this->all_flights[$id]['squawk'] == '7600') { |
|
| 820 | + $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
| 821 | + } |
|
| 822 | + if ($this->all_flights[$id]['squawk'] == '7700') { |
|
| 823 | + $highlight = 'Squawk 7700 : Emergency'; |
|
| 824 | + } |
|
| 825 | + if (!isset($this->all_flights[$id]['id'])) { |
|
| 826 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
| 827 | + } |
|
| 665 | 828 | $timeelapsed = microtime(true); |
| 666 | 829 | $Spotter = new Spotter($this->db); |
| 667 | 830 | $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
| 668 | 831 | $Spotter->db = null; |
| 669 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 670 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 832 | + if ($globalDebug && isset($result)) { |
|
| 833 | + echo $result."\n"; |
|
| 834 | + } |
|
| 835 | + if ($globalDebugTimeElapsed) { |
|
| 836 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 837 | + } |
|
| 671 | 838 | |
| 672 | 839 | // Add source stat in DB |
| 673 | 840 | $Stats = new Stats($this->db); |
| 674 | 841 | if (!empty($this->stats)) { |
| 675 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 842 | + if ($globalDebug) { |
|
| 843 | + echo 'Add source stats : '; |
|
| 844 | + } |
|
| 676 | 845 | foreach($this->stats as $date => $data) { |
| 677 | 846 | foreach($data as $source => $sourced) { |
| 678 | 847 | //print_r($sourced); |
| 679 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 680 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 848 | + if (isset($sourced['polar'])) { |
|
| 849 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
| 850 | + } |
|
| 851 | + if (isset($sourced['hist'])) { |
|
| 852 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
| 853 | + } |
|
| 681 | 854 | if (isset($sourced['msg'])) { |
| 682 | 855 | if (time() - $sourced['msg']['date'] > 10) { |
| 683 | 856 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -690,13 +863,17 @@ discard block |
||
| 690 | 863 | unset($this->stats[$date]); |
| 691 | 864 | } |
| 692 | 865 | } |
| 693 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 866 | + if ($globalDebug) { |
|
| 867 | + echo 'Done'."\n"; |
|
| 868 | + } |
|
| 694 | 869 | |
| 695 | 870 | } |
| 696 | 871 | $Stats->db = null; |
| 697 | 872 | |
| 698 | 873 | $this->del(); |
| 699 | - } elseif ($globalDebug) echo 'Ignore data'."\n"; |
|
| 874 | + } elseif ($globalDebug) { |
|
| 875 | + echo 'Ignore data'."\n"; |
|
| 876 | + } |
|
| 700 | 877 | //$ignoreImport = false; |
| 701 | 878 | $this->all_flights[$id]['addedSpotter'] = 1; |
| 702 | 879 | //print_r($this->all_flights[$id]); |
@@ -713,12 +890,16 @@ discard block |
||
| 713 | 890 | */ |
| 714 | 891 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
| 715 | 892 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 716 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 893 | + if ($globalDebug) { |
|
| 894 | + echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
| 895 | + } |
|
| 717 | 896 | //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 718 | 897 | $SpotterLive = new SpotterLive($this->db); |
| 719 | 898 | $SpotterLive->deleteLiveSpotterData(); |
| 720 | 899 | $SpotterLive->db=null; |
| 721 | - if ($globalDebug) echo " Done\n"; |
|
| 900 | + if ($globalDebug) { |
|
| 901 | + echo " Done\n"; |
|
| 902 | + } |
|
| 722 | 903 | $this->last_delete = time(); |
| 723 | 904 | } |
| 724 | 905 | } else { |
@@ -741,11 +922,17 @@ discard block |
||
| 741 | 922 | //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
| 742 | 923 | if ($globalDebug) { |
| 743 | 924 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
| 744 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 745 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
| 925 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 926 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 927 | + } else { |
|
| 928 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
|
| 929 | + } |
|
| 746 | 930 | } else { |
| 747 | - if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 748 | - else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
| 931 | + if (isset($this->all_flights[$id]['source_name'])) { |
|
| 932 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
|
| 933 | + } else { |
|
| 934 | + echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
|
| 935 | + } |
|
| 749 | 936 | } |
| 750 | 937 | } |
| 751 | 938 | $ignoreImport = false; |
@@ -791,19 +978,25 @@ discard block |
||
| 791 | 978 | |
| 792 | 979 | if (!$ignoreImport) { |
| 793 | 980 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
| 794 | - if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 981 | + if ($globalDebug) { |
|
| 982 | + echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
|
| 983 | + } |
|
| 795 | 984 | $timeelapsed = microtime(true); |
| 796 | 985 | $SpotterLive = new SpotterLive($this->db); |
| 797 | 986 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
| 798 | 987 | $SpotterLive->db = null; |
| 799 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 988 | + if ($globalDebugTimeElapsed) { |
|
| 989 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 990 | + } |
|
| 800 | 991 | |
| 801 | 992 | // Put statistics in $this->stats variable |
| 802 | 993 | //if ($line['format_source'] != 'aprs') { |
| 803 | 994 | //if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) { |
| 804 | 995 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
| 805 | 996 | $source = $this->all_flights[$id]['source_name']; |
| 806 | - if ($source == '') $source = $this->all_flights[$id]['format_source']; |
|
| 997 | + if ($source == '') { |
|
| 998 | + $source = $this->all_flights[$id]['format_source']; |
|
| 999 | + } |
|
| 807 | 1000 | if (!isset($this->source_location[$source])) { |
| 808 | 1001 | $Location = new Source(); |
| 809 | 1002 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -824,7 +1017,9 @@ discard block |
||
| 824 | 1017 | $stats_heading = round($stats_heading/22.5); |
| 825 | 1018 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
| 826 | 1019 | $current_date = date('Y-m-d'); |
| 827 | - if ($stats_heading == 16) $stats_heading = 0; |
|
| 1020 | + if ($stats_heading == 16) { |
|
| 1021 | + $stats_heading = 0; |
|
| 1022 | + } |
|
| 828 | 1023 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 829 | 1024 | for ($i=0;$i<=15;$i++) { |
| 830 | 1025 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -842,7 +1037,9 @@ discard block |
||
| 842 | 1037 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 843 | 1038 | end($this->stats[$current_date][$source]['hist']); |
| 844 | 1039 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
| 845 | - } else $mini = 0; |
|
| 1040 | + } else { |
|
| 1041 | + $mini = 0; |
|
| 1042 | + } |
|
| 846 | 1043 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 847 | 1044 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 848 | 1045 | } |
@@ -853,20 +1050,30 @@ discard block |
||
| 853 | 1050 | } |
| 854 | 1051 | |
| 855 | 1052 | $this->all_flights[$id]['lastupdate'] = time(); |
| 856 | - if ($this->all_flights[$id]['putinarchive']) $send = true; |
|
| 1053 | + if ($this->all_flights[$id]['putinarchive']) { |
|
| 1054 | + $send = true; |
|
| 1055 | + } |
|
| 857 | 1056 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
| 858 | - if ($globalDebug) echo $result."\n"; |
|
| 859 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1057 | + if ($globalDebug) { |
|
| 1058 | + echo $result."\n"; |
|
| 1059 | + } |
|
| 1060 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
| 1061 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 1062 | + } |
|
| 860 | 1063 | //$this->del(); |
| 861 | 1064 | |
| 862 | 1065 | |
| 863 | 1066 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 864 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1067 | + if ($globalDebug) { |
|
| 1068 | + echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
| 1069 | + } |
|
| 865 | 1070 | $SpotterLive = new SpotterLive($this->db); |
| 866 | 1071 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
| 867 | 1072 | $SpotterLive->db = null; |
| 868 | 1073 | //SpotterLive->deleteLiveSpotterData(); |
| 869 | - if ($globalDebug) echo " Done\n"; |
|
| 1074 | + if ($globalDebug) { |
|
| 1075 | + echo " Done\n"; |
|
| 1076 | + } |
|
| 870 | 1077 | $this->last_delete_hourly = time(); |
| 871 | 1078 | } |
| 872 | 1079 | |
@@ -874,7 +1081,9 @@ discard block |
||
| 874 | 1081 | //$ignoreImport = false; |
| 875 | 1082 | } |
| 876 | 1083 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 877 | - if ($send) return $this->all_flights[$id]; |
|
| 1084 | + if ($send) { |
|
| 1085 | + return $this->all_flights[$id]; |
|
| 1086 | + } |
|
| 878 | 1087 | } |
| 879 | 1088 | } |
| 880 | 1089 | } |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * Get SQL query part for filter used |
| 16 | 16 | * @param Array $filter the filter |
| 17 | - * @return Array the SQL part |
|
| 17 | + * @return string the SQL part |
|
| 18 | 18 | */ |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * Get SQL query part for filter used |
|
| 16 | - * @param Array $filter the filter |
|
| 17 | - * @return Array the SQL part |
|
| 18 | - */ |
|
| 15 | + * Get SQL query part for filter used |
|
| 16 | + * @param Array $filter the filter |
|
| 17 | + * @return Array the SQL part |
|
| 18 | + */ |
|
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 21 | 21 | $filters = array(); |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
| 89 | - * Gets all the spotter information based on the latest data entry |
|
| 90 | - * |
|
| 91 | - * @return Array the spotter information |
|
| 92 | - * |
|
| 93 | - */ |
|
| 89 | + * Gets all the spotter information based on the latest data entry |
|
| 90 | + * |
|
| 91 | + * @return Array the spotter information |
|
| 92 | + * |
|
| 93 | + */ |
|
| 94 | 94 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
| 95 | 95 | { |
| 96 | 96 | global $globalDBdriver, $globalLiveInterval; |
@@ -132,11 +132,11 @@ discard block |
||
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | /** |
| 135 | - * Gets Minimal Live Spotter data |
|
| 136 | - * |
|
| 137 | - * @return Array the spotter information |
|
| 138 | - * |
|
| 139 | - */ |
|
| 135 | + * Gets Minimal Live Spotter data |
|
| 136 | + * |
|
| 137 | + * @return Array the spotter information |
|
| 138 | + * |
|
| 139 | + */ |
|
| 140 | 140 | public function getMinLiveSpotterData($filter = array()) |
| 141 | 141 | { |
| 142 | 142 | global $globalDBdriver, $globalLiveInterval; |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | /** |
| 192 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 193 | - * |
|
| 194 | - * @return Array the spotter information |
|
| 195 | - * |
|
| 196 | - */ |
|
| 192 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 193 | + * |
|
| 194 | + * @return Array the spotter information |
|
| 195 | + * |
|
| 196 | + */ |
|
| 197 | 197 | public function getMinLastLiveSpotterData($filter = array()) |
| 198 | 198 | { |
| 199 | 199 | global $globalDBdriver, $globalLiveInterval; |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
| 212 | 212 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 213 | 213 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 214 | - } else { |
|
| 214 | + } else { |
|
| 215 | 215 | /* |
| 216 | 216 | $query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
| 217 | 217 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | // echo $query; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - try { |
|
| 226 | + try { |
|
| 227 | 227 | $sth = $this->db->prepare($query); |
| 228 | 228 | $sth->execute(); |
| 229 | 229 | } catch(PDOException $e) { |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | - * Gets number of latest data entry |
|
| 239 | - * |
|
| 240 | - * @return String number of entry |
|
| 241 | - * |
|
| 242 | - */ |
|
| 238 | + * Gets number of latest data entry |
|
| 239 | + * |
|
| 240 | + * @return String number of entry |
|
| 241 | + * |
|
| 242 | + */ |
|
| 243 | 243 | public function getLiveSpotterCount($filter = array()) |
| 244 | 244 | { |
| 245 | 245 | global $globalDBdriver, $globalLiveInterval; |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
| 269 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 270 | - * |
|
| 271 | - * @return Array the spotter information |
|
| 272 | - * |
|
| 273 | - */ |
|
| 269 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 270 | + * |
|
| 271 | + * @return Array the spotter information |
|
| 272 | + * |
|
| 273 | + */ |
|
| 274 | 274 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
| 275 | 275 | { |
| 276 | 276 | global $globalDBdriver, $globalLiveInterval; |
@@ -295,11 +295,11 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 299 | - * |
|
| 300 | - * @return Array the spotter information |
|
| 301 | - * |
|
| 302 | - */ |
|
| 298 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 299 | + * |
|
| 300 | + * @return Array the spotter information |
|
| 301 | + * |
|
| 302 | + */ |
|
| 303 | 303 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 304 | 304 | { |
| 305 | 305 | $Spotter = new Spotter($this->db); |
@@ -309,145 +309,145 @@ discard block |
||
| 309 | 309 | return false; |
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | - if ($lng != '') |
|
| 313 | - { |
|
| 314 | - if (!is_numeric($lng)) |
|
| 315 | - { |
|
| 316 | - return false; |
|
| 317 | - } |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - if ($radius != '') |
|
| 321 | - { |
|
| 322 | - if (!is_numeric($radius)) |
|
| 323 | - { |
|
| 324 | - return false; |
|
| 325 | - } |
|
| 326 | - } |
|
| 312 | + if ($lng != '') |
|
| 313 | + { |
|
| 314 | + if (!is_numeric($lng)) |
|
| 315 | + { |
|
| 316 | + return false; |
|
| 317 | + } |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + if ($radius != '') |
|
| 321 | + { |
|
| 322 | + if (!is_numeric($radius)) |
|
| 323 | + { |
|
| 324 | + return false; |
|
| 325 | + } |
|
| 326 | + } |
|
| 327 | 327 | $additional_query = ''; |
| 328 | - if ($interval != '') |
|
| 329 | - { |
|
| 330 | - if (!is_string($interval)) |
|
| 331 | - { |
|
| 332 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 333 | - return false; |
|
| 334 | - } else { |
|
| 335 | - if ($interval == '1m') |
|
| 336 | - { |
|
| 337 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 338 | - } else if ($interval == '15m'){ |
|
| 339 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
| 340 | - } |
|
| 341 | - } |
|
| 342 | - } else { |
|
| 343 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 344 | - } |
|
| 345 | - |
|
| 346 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 328 | + if ($interval != '') |
|
| 329 | + { |
|
| 330 | + if (!is_string($interval)) |
|
| 331 | + { |
|
| 332 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 333 | + return false; |
|
| 334 | + } else { |
|
| 335 | + if ($interval == '1m') |
|
| 336 | + { |
|
| 337 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 338 | + } else if ($interval == '15m'){ |
|
| 339 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
| 340 | + } |
|
| 341 | + } |
|
| 342 | + } else { |
|
| 343 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 344 | + } |
|
| 345 | + |
|
| 346 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 347 | 347 | WHERE spotter_live.latitude <> '' |
| 348 | 348 | AND spotter_live.longitude <> '' |
| 349 | 349 | ".$additional_query." |
| 350 | 350 | HAVING distance < :radius |
| 351 | 351 | ORDER BY distance"; |
| 352 | 352 | |
| 353 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 353 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 354 | 354 | |
| 355 | - return $spotter_array; |
|
| 356 | - } |
|
| 355 | + return $spotter_array; |
|
| 356 | + } |
|
| 357 | 357 | |
| 358 | 358 | |
| 359 | - /** |
|
| 360 | - * Gets all the spotter information based on a particular callsign |
|
| 361 | - * |
|
| 362 | - * @return Array the spotter information |
|
| 363 | - * |
|
| 364 | - */ |
|
| 359 | + /** |
|
| 360 | + * Gets all the spotter information based on a particular callsign |
|
| 361 | + * |
|
| 362 | + * @return Array the spotter information |
|
| 363 | + * |
|
| 364 | + */ |
|
| 365 | 365 | public function getLastLiveSpotterDataByIdent($ident) |
| 366 | 366 | { |
| 367 | 367 | $Spotter = new Spotter($this->db); |
| 368 | 368 | date_default_timezone_set('UTC'); |
| 369 | 369 | |
| 370 | 370 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 371 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 371 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 372 | 372 | |
| 373 | 373 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
| 374 | 374 | |
| 375 | 375 | return $spotter_array; |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | - /** |
|
| 379 | - * Gets all the spotter information based on a particular callsign |
|
| 380 | - * |
|
| 381 | - * @return Array the spotter information |
|
| 382 | - * |
|
| 383 | - */ |
|
| 378 | + /** |
|
| 379 | + * Gets all the spotter information based on a particular callsign |
|
| 380 | + * |
|
| 381 | + * @return Array the spotter information |
|
| 382 | + * |
|
| 383 | + */ |
|
| 384 | 384 | public function getDateLiveSpotterDataByIdent($ident,$date) |
| 385 | 385 | { |
| 386 | 386 | $Spotter = new Spotter($this->db); |
| 387 | 387 | date_default_timezone_set('UTC'); |
| 388 | 388 | |
| 389 | 389 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 390 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 390 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 391 | 391 | |
| 392 | - $date = date('c',$date); |
|
| 392 | + $date = date('c',$date); |
|
| 393 | 393 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
| 394 | 394 | |
| 395 | 395 | return $spotter_array; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - /** |
|
| 399 | - * Gets last spotter information based on a particular callsign |
|
| 400 | - * |
|
| 401 | - * @return Array the spotter information |
|
| 402 | - * |
|
| 403 | - */ |
|
| 398 | + /** |
|
| 399 | + * Gets last spotter information based on a particular callsign |
|
| 400 | + * |
|
| 401 | + * @return Array the spotter information |
|
| 402 | + * |
|
| 403 | + */ |
|
| 404 | 404 | public function getLastLiveSpotterDataById($id) |
| 405 | 405 | { |
| 406 | 406 | $Spotter = new Spotter($this->db); |
| 407 | 407 | date_default_timezone_set('UTC'); |
| 408 | 408 | |
| 409 | 409 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 410 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 410 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 411 | 411 | |
| 412 | 412 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
| 413 | 413 | |
| 414 | 414 | return $spotter_array; |
| 415 | 415 | } |
| 416 | 416 | |
| 417 | - /** |
|
| 418 | - * Gets last spotter information based on a particular callsign |
|
| 419 | - * |
|
| 420 | - * @return Array the spotter information |
|
| 421 | - * |
|
| 422 | - */ |
|
| 417 | + /** |
|
| 418 | + * Gets last spotter information based on a particular callsign |
|
| 419 | + * |
|
| 420 | + * @return Array the spotter information |
|
| 421 | + * |
|
| 422 | + */ |
|
| 423 | 423 | public function getDateLiveSpotterDataById($id,$date) |
| 424 | 424 | { |
| 425 | 425 | $Spotter = new Spotter($this->db); |
| 426 | 426 | date_default_timezone_set('UTC'); |
| 427 | 427 | |
| 428 | 428 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 429 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 430 | - $date = date('c',$date); |
|
| 429 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 430 | + $date = date('c',$date); |
|
| 431 | 431 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
| 432 | 432 | |
| 433 | 433 | return $spotter_array; |
| 434 | 434 | } |
| 435 | 435 | |
| 436 | - /** |
|
| 437 | - * Gets altitude information based on a particular callsign |
|
| 438 | - * |
|
| 439 | - * @return Array the spotter information |
|
| 440 | - * |
|
| 441 | - */ |
|
| 436 | + /** |
|
| 437 | + * Gets altitude information based on a particular callsign |
|
| 438 | + * |
|
| 439 | + * @return Array the spotter information |
|
| 440 | + * |
|
| 441 | + */ |
|
| 442 | 442 | public function getAltitudeLiveSpotterDataByIdent($ident) |
| 443 | 443 | { |
| 444 | 444 | |
| 445 | 445 | date_default_timezone_set('UTC'); |
| 446 | 446 | |
| 447 | 447 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 448 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 448 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 449 | 449 | |
| 450 | - try { |
|
| 450 | + try { |
|
| 451 | 451 | |
| 452 | 452 | $sth = $this->db->prepare($query); |
| 453 | 453 | $sth->execute(array(':ident' => $ident)); |
@@ -460,12 +460,12 @@ discard block |
||
| 460 | 460 | return $spotter_array; |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - /** |
|
| 464 | - * Gets all the spotter information based on a particular id |
|
| 465 | - * |
|
| 466 | - * @return Array the spotter information |
|
| 467 | - * |
|
| 468 | - */ |
|
| 463 | + /** |
|
| 464 | + * Gets all the spotter information based on a particular id |
|
| 465 | + * |
|
| 466 | + * @return Array the spotter information |
|
| 467 | + * |
|
| 468 | + */ |
|
| 469 | 469 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
| 470 | 470 | { |
| 471 | 471 | global $globalDBdriver, $globalLiveInterval; |
@@ -493,18 +493,18 @@ discard block |
||
| 493 | 493 | return $spotter_array; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | - /** |
|
| 497 | - * Gets all the spotter information based on a particular ident |
|
| 498 | - * |
|
| 499 | - * @return Array the spotter information |
|
| 500 | - * |
|
| 501 | - */ |
|
| 496 | + /** |
|
| 497 | + * Gets all the spotter information based on a particular ident |
|
| 498 | + * |
|
| 499 | + * @return Array the spotter information |
|
| 500 | + * |
|
| 501 | + */ |
|
| 502 | 502 | public function getAllLiveSpotterDataByIdent($ident) |
| 503 | 503 | { |
| 504 | 504 | date_default_timezone_set('UTC'); |
| 505 | 505 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 506 | 506 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
| 507 | - try { |
|
| 507 | + try { |
|
| 508 | 508 | |
| 509 | 509 | $sth = $this->db->prepare($query); |
| 510 | 510 | $sth->execute(array(':ident' => $ident)); |
@@ -518,23 +518,23 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | |
| 520 | 520 | /** |
| 521 | - * Deletes all info in the table |
|
| 522 | - * |
|
| 523 | - * @return String success or false |
|
| 524 | - * |
|
| 525 | - */ |
|
| 521 | + * Deletes all info in the table |
|
| 522 | + * |
|
| 523 | + * @return String success or false |
|
| 524 | + * |
|
| 525 | + */ |
|
| 526 | 526 | public function deleteLiveSpotterData() |
| 527 | 527 | { |
| 528 | 528 | global $globalDBdriver; |
| 529 | 529 | if ($globalDBdriver == 'mysql') { |
| 530 | 530 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
| 531 | 531 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
| 532 | - //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
| 532 | + //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
| 533 | 533 | } else { |
| 534 | 534 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | - try { |
|
| 537 | + try { |
|
| 538 | 538 | |
| 539 | 539 | $sth = $this->db->prepare($query); |
| 540 | 540 | $sth->execute(); |
@@ -546,18 +546,18 @@ discard block |
||
| 546 | 546 | } |
| 547 | 547 | |
| 548 | 548 | /** |
| 549 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 550 | - * |
|
| 551 | - * @return String success or false |
|
| 552 | - * |
|
| 553 | - */ |
|
| 549 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 550 | + * |
|
| 551 | + * @return String success or false |
|
| 552 | + * |
|
| 553 | + */ |
|
| 554 | 554 | public function deleteLiveSpotterDataNotUpdated() |
| 555 | 555 | { |
| 556 | 556 | global $globalDBdriver, $globalDebug; |
| 557 | 557 | if ($globalDBdriver == 'mysql') { |
| 558 | 558 | //$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0'; |
| 559 | - $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 560 | - try { |
|
| 559 | + $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 560 | + try { |
|
| 561 | 561 | |
| 562 | 562 | $sth = $this->db->prepare($query); |
| 563 | 563 | $sth->execute(); |
@@ -565,8 +565,8 @@ discard block |
||
| 565 | 565 | return "error"; |
| 566 | 566 | } |
| 567 | 567 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 568 | - $i = 0; |
|
| 569 | - $j =0; |
|
| 568 | + $i = 0; |
|
| 569 | + $j =0; |
|
| 570 | 570 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 571 | 571 | foreach($all as $row) |
| 572 | 572 | { |
@@ -574,20 +574,20 @@ discard block |
||
| 574 | 574 | $j++; |
| 575 | 575 | if ($j == 30) { |
| 576 | 576 | if ($globalDebug) echo "."; |
| 577 | - try { |
|
| 577 | + try { |
|
| 578 | 578 | |
| 579 | 579 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 580 | 580 | $sth->execute(); |
| 581 | 581 | } catch(PDOException $e) { |
| 582 | 582 | return "error"; |
| 583 | 583 | } |
| 584 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
| 585 | - $j = 0; |
|
| 584 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
| 585 | + $j = 0; |
|
| 586 | 586 | } |
| 587 | 587 | $query_delete .= "'".$row['flightaware_id']."',"; |
| 588 | 588 | } |
| 589 | 589 | if ($i > 0) { |
| 590 | - try { |
|
| 590 | + try { |
|
| 591 | 591 | |
| 592 | 592 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 593 | 593 | $sth->execute(); |
@@ -598,9 +598,9 @@ discard block |
||
| 598 | 598 | return "success"; |
| 599 | 599 | } elseif ($globalDBdriver == 'pgsql') { |
| 600 | 600 | //$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0"; |
| 601 | - //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 602 | - $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 603 | - try { |
|
| 601 | + //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 602 | + $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 603 | + try { |
|
| 604 | 604 | |
| 605 | 605 | $sth = $this->db->prepare($query); |
| 606 | 606 | $sth->execute(); |
@@ -644,17 +644,17 @@ discard block |
||
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | /** |
| 647 | - * Deletes all info in the table for an ident |
|
| 648 | - * |
|
| 649 | - * @return String success or false |
|
| 650 | - * |
|
| 651 | - */ |
|
| 647 | + * Deletes all info in the table for an ident |
|
| 648 | + * |
|
| 649 | + * @return String success or false |
|
| 650 | + * |
|
| 651 | + */ |
|
| 652 | 652 | public function deleteLiveSpotterDataByIdent($ident) |
| 653 | 653 | { |
| 654 | 654 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 655 | 655 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
| 656 | 656 | |
| 657 | - try { |
|
| 657 | + try { |
|
| 658 | 658 | |
| 659 | 659 | $sth = $this->db->prepare($query); |
| 660 | 660 | $sth->execute(array(':ident' => $ident)); |
@@ -666,17 +666,17 @@ discard block |
||
| 666 | 666 | } |
| 667 | 667 | |
| 668 | 668 | /** |
| 669 | - * Deletes all info in the table for an id |
|
| 670 | - * |
|
| 671 | - * @return String success or false |
|
| 672 | - * |
|
| 673 | - */ |
|
| 669 | + * Deletes all info in the table for an id |
|
| 670 | + * |
|
| 671 | + * @return String success or false |
|
| 672 | + * |
|
| 673 | + */ |
|
| 674 | 674 | public function deleteLiveSpotterDataById($id) |
| 675 | 675 | { |
| 676 | 676 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 677 | 677 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
| 678 | 678 | |
| 679 | - try { |
|
| 679 | + try { |
|
| 680 | 680 | |
| 681 | 681 | $sth = $this->db->prepare($query); |
| 682 | 682 | $sth->execute(array(':id' => $id)); |
@@ -689,11 +689,11 @@ discard block |
||
| 689 | 689 | |
| 690 | 690 | |
| 691 | 691 | /** |
| 692 | - * Gets the aircraft ident within the last hour |
|
| 693 | - * |
|
| 694 | - * @return String the ident |
|
| 695 | - * |
|
| 696 | - */ |
|
| 692 | + * Gets the aircraft ident within the last hour |
|
| 693 | + * |
|
| 694 | + * @return String the ident |
|
| 695 | + * |
|
| 696 | + */ |
|
| 697 | 697 | public function getIdentFromLastHour($ident) |
| 698 | 698 | { |
| 699 | 699 | global $globalDBdriver, $globalTimezone; |
@@ -719,14 +719,14 @@ discard block |
||
| 719 | 719 | $ident_result = $row['ident']; |
| 720 | 720 | } |
| 721 | 721 | return $ident_result; |
| 722 | - } |
|
| 722 | + } |
|
| 723 | 723 | |
| 724 | 724 | /** |
| 725 | - * Check recent aircraft |
|
| 726 | - * |
|
| 727 | - * @return String the ident |
|
| 728 | - * |
|
| 729 | - */ |
|
| 725 | + * Check recent aircraft |
|
| 726 | + * |
|
| 727 | + * @return String the ident |
|
| 728 | + * |
|
| 729 | + */ |
|
| 730 | 730 | public function checkIdentRecent($ident) |
| 731 | 731 | { |
| 732 | 732 | global $globalDBdriver, $globalTimezone; |
@@ -752,14 +752,14 @@ discard block |
||
| 752 | 752 | $ident_result = $row['flightaware_id']; |
| 753 | 753 | } |
| 754 | 754 | return $ident_result; |
| 755 | - } |
|
| 755 | + } |
|
| 756 | 756 | |
| 757 | 757 | /** |
| 758 | - * Check recent aircraft by id |
|
| 759 | - * |
|
| 760 | - * @return String the ident |
|
| 761 | - * |
|
| 762 | - */ |
|
| 758 | + * Check recent aircraft by id |
|
| 759 | + * |
|
| 760 | + * @return String the ident |
|
| 761 | + * |
|
| 762 | + */ |
|
| 763 | 763 | public function checkIdRecent($id) |
| 764 | 764 | { |
| 765 | 765 | global $globalDBdriver, $globalTimezone; |
@@ -785,14 +785,14 @@ discard block |
||
| 785 | 785 | $ident_result = $row['flightaware_id']; |
| 786 | 786 | } |
| 787 | 787 | return $ident_result; |
| 788 | - } |
|
| 788 | + } |
|
| 789 | 789 | |
| 790 | 790 | /** |
| 791 | - * Check recent aircraft by ModeS |
|
| 792 | - * |
|
| 793 | - * @return String the ModeS |
|
| 794 | - * |
|
| 795 | - */ |
|
| 791 | + * Check recent aircraft by ModeS |
|
| 792 | + * |
|
| 793 | + * @return String the ModeS |
|
| 794 | + * |
|
| 795 | + */ |
|
| 796 | 796 | public function checkModeSRecent($modes) |
| 797 | 797 | { |
| 798 | 798 | global $globalDBdriver, $globalTimezone; |
@@ -819,19 +819,19 @@ discard block |
||
| 819 | 819 | $ident_result = $row['flightaware_id']; |
| 820 | 820 | } |
| 821 | 821 | return $ident_result; |
| 822 | - } |
|
| 822 | + } |
|
| 823 | 823 | |
| 824 | 824 | /** |
| 825 | - * Adds a new spotter data |
|
| 826 | - * |
|
| 827 | - * @param String $flightaware_id the ID from flightaware |
|
| 828 | - * @param String $ident the flight ident |
|
| 829 | - * @param String $aircraft_icao the aircraft type |
|
| 830 | - * @param String $departure_airport_icao the departure airport |
|
| 831 | - * @param String $arrival_airport_icao the arrival airport |
|
| 832 | - * @return String success or false |
|
| 833 | - * |
|
| 834 | - */ |
|
| 825 | + * Adds a new spotter data |
|
| 826 | + * |
|
| 827 | + * @param String $flightaware_id the ID from flightaware |
|
| 828 | + * @param String $ident the flight ident |
|
| 829 | + * @param String $aircraft_icao the aircraft type |
|
| 830 | + * @param String $departure_airport_icao the departure airport |
|
| 831 | + * @param String $arrival_airport_icao the arrival airport |
|
| 832 | + * @return String success or false |
|
| 833 | + * |
|
| 834 | + */ |
|
| 835 | 835 | public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
| 836 | 836 | { |
| 837 | 837 | global $globalURL, $globalArchive, $globalDebug; |
@@ -966,10 +966,10 @@ discard block |
||
| 966 | 966 | $arrival_airport_country = ''; |
| 967 | 967 | |
| 968 | 968 | |
| 969 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 970 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 971 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 972 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 969 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 970 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 971 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 972 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 973 | 973 | |
| 974 | 974 | $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
| 975 | 975 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
@@ -979,14 +979,14 @@ discard block |
||
| 979 | 979 | |
| 980 | 980 | $sth = $this->db->prepare($query); |
| 981 | 981 | $sth->execute($query_values); |
| 982 | - } catch(PDOException $e) { |
|
| 983 | - return "error : ".$e->getMessage(); |
|
| 984 | - } |
|
| 982 | + } catch(PDOException $e) { |
|
| 983 | + return "error : ".$e->getMessage(); |
|
| 984 | + } |
|
| 985 | 985 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 986 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 987 | - $SpotterArchive = new SpotterArchive($this->db); |
|
| 988 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 989 | - if ($globalDebug) echo $result.')'; |
|
| 986 | + if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 987 | + $SpotterArchive = new SpotterArchive($this->db); |
|
| 988 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 989 | + if ($globalDebug) echo $result.')'; |
|
| 990 | 990 | } |
| 991 | 991 | return "success"; |
| 992 | 992 | |
@@ -16,45 +16,45 @@ discard block |
||
| 16 | 16 | * @param Array $filter the filter |
| 17 | 17 | * @return Array the SQL part |
| 18 | 18 | */ |
| 19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
| 21 | 21 | $filters = array(); |
| 22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
| 25 | 25 | } else { |
| 26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 29 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 30 | 30 | $filter_query_join = ''; |
| 31 | 31 | $filter_query_where = ''; |
| 32 | - foreach($filters as $flt) { |
|
| 32 | + foreach ($filters as $flt) { |
|
| 33 | 33 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 34 | 34 | if ($flt['airlines'][0] != '') { |
| 35 | 35 | if (isset($flt['source'])) { |
| 36 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 36 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 37 | 37 | } else { |
| 38 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 38 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 43 | 43 | if (isset($flt['source'])) { |
| 44 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 44 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 45 | 45 | } else { |
| 46 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 46 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
| 50 | 50 | if (isset($flt['source'])) { |
| 51 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 51 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 56 | 56 | if ($filter['airlines'][0] != '') { |
| 57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -64,19 +64,19 @@ discard block |
||
| 64 | 64 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
| 65 | 65 | } |
| 66 | 66 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 67 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 67 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
| 68 | 68 | } |
| 69 | 69 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 70 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 70 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 71 | 71 | } |
| 72 | 72 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 73 | 73 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
| 74 | 74 | } |
| 75 | 75 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 76 | 76 | if ($filter_query_where == '') { |
| 77 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 77 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 78 | 78 | } else { |
| 79 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 79 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | if ($limit != '') |
| 103 | 103 | { |
| 104 | 104 | $limit_array = explode(',', $limit); |
| 105 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 105 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 106 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 107 | 107 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 108 | 108 | { |
| 109 | 109 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | } else { |
| 127 | 127 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
| 128 | 128 | } |
| 129 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 129 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 130 | 130 | |
| 131 | 131 | return $spotter_array; |
| 132 | 132 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | global $globalDBdriver, $globalLiveInterval; |
| 143 | 143 | date_default_timezone_set('UTC'); |
| 144 | 144 | |
| 145 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 145 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 146 | 146 | |
| 147 | 147 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 148 | 148 | if ($globalDBdriver == 'mysql') { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
| 154 | 154 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
| 155 | 155 | */ |
| 156 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 156 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 157 | 157 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
| 158 | 158 | |
| 159 | 159 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date ORDER BY spotter_live.date GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
| 169 | 169 | */ |
| 170 | 170 | |
| 171 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 171 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 172 | 172 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
| 173 | 173 | |
| 174 | 174 | |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | try { |
| 180 | 180 | $sth = $this->db->prepare($query); |
| 181 | 181 | $sth->execute(); |
| 182 | - } catch(PDOException $e) { |
|
| 182 | + } catch (PDOException $e) { |
|
| 183 | 183 | echo $e->getMessage(); |
| 184 | 184 | die; |
| 185 | 185 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | global $globalDBdriver, $globalLiveInterval; |
| 200 | 200 | date_default_timezone_set('UTC'); |
| 201 | 201 | |
| 202 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 202 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 203 | 203 | |
| 204 | 204 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 205 | 205 | if ($globalDBdriver == 'mysql') { |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 209 | 209 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 210 | 210 | */ |
| 211 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 211 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 212 | 212 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 213 | 213 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 214 | 214 | } else { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 218 | 218 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 219 | 219 | */ |
| 220 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 220 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
| 221 | 221 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 222 | 222 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 223 | 223 | // echo $query; |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | try { |
| 227 | 227 | $sth = $this->db->prepare($query); |
| 228 | 228 | $sth->execute(); |
| 229 | - } catch(PDOException $e) { |
|
| 229 | + } catch (PDOException $e) { |
|
| 230 | 230 | echo $e->getMessage(); |
| 231 | 231 | die; |
| 232 | 232 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | public function getLiveSpotterCount($filter = array()) |
| 244 | 244 | { |
| 245 | 245 | global $globalDBdriver, $globalLiveInterval; |
| 246 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 246 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 247 | 247 | |
| 248 | 248 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 249 | 249 | if ($globalDBdriver == 'mysql') { |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | try { |
| 257 | 257 | $sth = $this->db->prepare($query); |
| 258 | 258 | $sth->execute(); |
| 259 | - } catch(PDOException $e) { |
|
| 259 | + } catch (PDOException $e) { |
|
| 260 | 260 | echo $e->getMessage(); |
| 261 | 261 | die; |
| 262 | 262 | } |
@@ -279,10 +279,10 @@ discard block |
||
| 279 | 279 | $filter_query = $this->getFilter($filter); |
| 280 | 280 | |
| 281 | 281 | if (is_array($coord)) { |
| 282 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 283 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 284 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 285 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 282 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 283 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 284 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 285 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 286 | 286 | } else return array(); |
| 287 | 287 | if ($globalDBdriver == 'mysql') { |
| 288 | 288 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | if ($interval == '1m') |
| 336 | 336 | { |
| 337 | 337 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 338 | - } else if ($interval == '15m'){ |
|
| 338 | + } else if ($interval == '15m') { |
|
| 339 | 339 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
| 340 | 340 | } |
| 341 | 341 | } |
@@ -343,14 +343,14 @@ discard block |
||
| 343 | 343 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 346 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 347 | 347 | WHERE spotter_live.latitude <> '' |
| 348 | 348 | AND spotter_live.longitude <> '' |
| 349 | 349 | ".$additional_query." |
| 350 | 350 | HAVING distance < :radius |
| 351 | 351 | ORDER BY distance"; |
| 352 | 352 | |
| 353 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 353 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 354 | 354 | |
| 355 | 355 | return $spotter_array; |
| 356 | 356 | } |
@@ -368,9 +368,9 @@ discard block |
||
| 368 | 368 | date_default_timezone_set('UTC'); |
| 369 | 369 | |
| 370 | 370 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 371 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 371 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 372 | 372 | |
| 373 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 373 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 374 | 374 | |
| 375 | 375 | return $spotter_array; |
| 376 | 376 | } |
@@ -381,16 +381,16 @@ discard block |
||
| 381 | 381 | * @return Array the spotter information |
| 382 | 382 | * |
| 383 | 383 | */ |
| 384 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
| 384 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
| 385 | 385 | { |
| 386 | 386 | $Spotter = new Spotter($this->db); |
| 387 | 387 | date_default_timezone_set('UTC'); |
| 388 | 388 | |
| 389 | 389 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 390 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 390 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 391 | 391 | |
| 392 | - $date = date('c',$date); |
|
| 393 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 392 | + $date = date('c', $date); |
|
| 393 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 394 | 394 | |
| 395 | 395 | return $spotter_array; |
| 396 | 396 | } |
@@ -407,9 +407,9 @@ discard block |
||
| 407 | 407 | date_default_timezone_set('UTC'); |
| 408 | 408 | |
| 409 | 409 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 410 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 410 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 411 | 411 | |
| 412 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 412 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 413 | 413 | |
| 414 | 414 | return $spotter_array; |
| 415 | 415 | } |
@@ -420,15 +420,15 @@ discard block |
||
| 420 | 420 | * @return Array the spotter information |
| 421 | 421 | * |
| 422 | 422 | */ |
| 423 | - public function getDateLiveSpotterDataById($id,$date) |
|
| 423 | + public function getDateLiveSpotterDataById($id, $date) |
|
| 424 | 424 | { |
| 425 | 425 | $Spotter = new Spotter($this->db); |
| 426 | 426 | date_default_timezone_set('UTC'); |
| 427 | 427 | |
| 428 | 428 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 429 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 430 | - $date = date('c',$date); |
|
| 431 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 429 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 430 | + $date = date('c', $date); |
|
| 431 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 432 | 432 | |
| 433 | 433 | return $spotter_array; |
| 434 | 434 | } |
@@ -445,13 +445,13 @@ discard block |
||
| 445 | 445 | date_default_timezone_set('UTC'); |
| 446 | 446 | |
| 447 | 447 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 448 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 448 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 449 | 449 | |
| 450 | 450 | try { |
| 451 | 451 | |
| 452 | 452 | $sth = $this->db->prepare($query); |
| 453 | 453 | $sth->execute(array(':ident' => $ident)); |
| 454 | - } catch(PDOException $e) { |
|
| 454 | + } catch (PDOException $e) { |
|
| 455 | 455 | echo $e->getMessage(); |
| 456 | 456 | die; |
| 457 | 457 | } |
@@ -466,7 +466,7 @@ discard block |
||
| 466 | 466 | * @return Array the spotter information |
| 467 | 467 | * |
| 468 | 468 | */ |
| 469 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
| 469 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
| 470 | 470 | { |
| 471 | 471 | global $globalDBdriver, $globalLiveInterval; |
| 472 | 472 | date_default_timezone_set('UTC'); |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | try { |
| 486 | 486 | $sth = $this->db->prepare($query); |
| 487 | 487 | $sth->execute(array(':id' => $id)); |
| 488 | - } catch(PDOException $e) { |
|
| 488 | + } catch (PDOException $e) { |
|
| 489 | 489 | echo $e->getMessage(); |
| 490 | 490 | die; |
| 491 | 491 | } |
@@ -503,12 +503,12 @@ discard block |
||
| 503 | 503 | { |
| 504 | 504 | date_default_timezone_set('UTC'); |
| 505 | 505 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 506 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 506 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 507 | 507 | try { |
| 508 | 508 | |
| 509 | 509 | $sth = $this->db->prepare($query); |
| 510 | 510 | $sth->execute(array(':ident' => $ident)); |
| 511 | - } catch(PDOException $e) { |
|
| 511 | + } catch (PDOException $e) { |
|
| 512 | 512 | echo $e->getMessage(); |
| 513 | 513 | die; |
| 514 | 514 | } |
@@ -538,7 +538,7 @@ discard block |
||
| 538 | 538 | |
| 539 | 539 | $sth = $this->db->prepare($query); |
| 540 | 540 | $sth->execute(); |
| 541 | - } catch(PDOException $e) { |
|
| 541 | + } catch (PDOException $e) { |
|
| 542 | 542 | return "error"; |
| 543 | 543 | } |
| 544 | 544 | |
@@ -561,14 +561,14 @@ discard block |
||
| 561 | 561 | |
| 562 | 562 | $sth = $this->db->prepare($query); |
| 563 | 563 | $sth->execute(); |
| 564 | - } catch(PDOException $e) { |
|
| 564 | + } catch (PDOException $e) { |
|
| 565 | 565 | return "error"; |
| 566 | 566 | } |
| 567 | 567 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 568 | 568 | $i = 0; |
| 569 | - $j =0; |
|
| 569 | + $j = 0; |
|
| 570 | 570 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 571 | - foreach($all as $row) |
|
| 571 | + foreach ($all as $row) |
|
| 572 | 572 | { |
| 573 | 573 | $i++; |
| 574 | 574 | $j++; |
@@ -576,9 +576,9 @@ discard block |
||
| 576 | 576 | if ($globalDebug) echo "."; |
| 577 | 577 | try { |
| 578 | 578 | |
| 579 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 579 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 580 | 580 | $sth->execute(); |
| 581 | - } catch(PDOException $e) { |
|
| 581 | + } catch (PDOException $e) { |
|
| 582 | 582 | return "error"; |
| 583 | 583 | } |
| 584 | 584 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -589,9 +589,9 @@ discard block |
||
| 589 | 589 | if ($i > 0) { |
| 590 | 590 | try { |
| 591 | 591 | |
| 592 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 592 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 593 | 593 | $sth->execute(); |
| 594 | - } catch(PDOException $e) { |
|
| 594 | + } catch (PDOException $e) { |
|
| 595 | 595 | return "error"; |
| 596 | 596 | } |
| 597 | 597 | } |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | |
| 605 | 605 | $sth = $this->db->prepare($query); |
| 606 | 606 | $sth->execute(); |
| 607 | - } catch(PDOException $e) { |
|
| 607 | + } catch (PDOException $e) { |
|
| 608 | 608 | return "error"; |
| 609 | 609 | } |
| 610 | 610 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -652,13 +652,13 @@ discard block |
||
| 652 | 652 | public function deleteLiveSpotterDataByIdent($ident) |
| 653 | 653 | { |
| 654 | 654 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 655 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 655 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 656 | 656 | |
| 657 | 657 | try { |
| 658 | 658 | |
| 659 | 659 | $sth = $this->db->prepare($query); |
| 660 | 660 | $sth->execute(array(':ident' => $ident)); |
| 661 | - } catch(PDOException $e) { |
|
| 661 | + } catch (PDOException $e) { |
|
| 662 | 662 | return "error"; |
| 663 | 663 | } |
| 664 | 664 | |
@@ -674,13 +674,13 @@ discard block |
||
| 674 | 674 | public function deleteLiveSpotterDataById($id) |
| 675 | 675 | { |
| 676 | 676 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 677 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 677 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 678 | 678 | |
| 679 | 679 | try { |
| 680 | 680 | |
| 681 | 681 | $sth = $this->db->prepare($query); |
| 682 | 682 | $sth->execute(array(':id' => $id)); |
| 683 | - } catch(PDOException $e) { |
|
| 683 | + } catch (PDOException $e) { |
|
| 684 | 684 | return "error"; |
| 685 | 685 | } |
| 686 | 686 | |
@@ -698,13 +698,13 @@ discard block |
||
| 698 | 698 | { |
| 699 | 699 | global $globalDBdriver, $globalTimezone; |
| 700 | 700 | if ($globalDBdriver == 'mysql') { |
| 701 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 701 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 702 | 702 | WHERE spotter_live.ident = :ident |
| 703 | 703 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 704 | 704 | AND spotter_live.date < UTC_TIMESTAMP()'; |
| 705 | 705 | $query_data = array(':ident' => $ident); |
| 706 | 706 | } else { |
| 707 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 707 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 708 | 708 | WHERE spotter_live.ident = :ident |
| 709 | 709 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 710 | 710 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -713,8 +713,8 @@ discard block |
||
| 713 | 713 | |
| 714 | 714 | $sth = $this->db->prepare($query); |
| 715 | 715 | $sth->execute($query_data); |
| 716 | - $ident_result=''; |
|
| 717 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 716 | + $ident_result = ''; |
|
| 717 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 718 | 718 | { |
| 719 | 719 | $ident_result = $row['ident']; |
| 720 | 720 | } |
@@ -731,13 +731,13 @@ discard block |
||
| 731 | 731 | { |
| 732 | 732 | global $globalDBdriver, $globalTimezone; |
| 733 | 733 | if ($globalDBdriver == 'mysql') { |
| 734 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 734 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 735 | 735 | WHERE spotter_live.ident = :ident |
| 736 | 736 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 737 | 737 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 738 | 738 | $query_data = array(':ident' => $ident); |
| 739 | 739 | } else { |
| 740 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 740 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 741 | 741 | WHERE spotter_live.ident = :ident |
| 742 | 742 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 743 | 743 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -746,8 +746,8 @@ discard block |
||
| 746 | 746 | |
| 747 | 747 | $sth = $this->db->prepare($query); |
| 748 | 748 | $sth->execute($query_data); |
| 749 | - $ident_result=''; |
|
| 750 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 749 | + $ident_result = ''; |
|
| 750 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 751 | 751 | { |
| 752 | 752 | $ident_result = $row['flightaware_id']; |
| 753 | 753 | } |
@@ -764,13 +764,13 @@ discard block |
||
| 764 | 764 | { |
| 765 | 765 | global $globalDBdriver, $globalTimezone; |
| 766 | 766 | if ($globalDBdriver == 'mysql') { |
| 767 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 767 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 768 | 768 | WHERE spotter_live.flightaware_id = :id |
| 769 | 769 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 770 | 770 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 771 | 771 | $query_data = array(':id' => $id); |
| 772 | 772 | } else { |
| 773 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 773 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 774 | 774 | WHERE spotter_live.flightaware_id = :id |
| 775 | 775 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 776 | 776 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -779,8 +779,8 @@ discard block |
||
| 779 | 779 | |
| 780 | 780 | $sth = $this->db->prepare($query); |
| 781 | 781 | $sth->execute($query_data); |
| 782 | - $ident_result=''; |
|
| 783 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 782 | + $ident_result = ''; |
|
| 783 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 784 | 784 | { |
| 785 | 785 | $ident_result = $row['flightaware_id']; |
| 786 | 786 | } |
@@ -797,13 +797,13 @@ discard block |
||
| 797 | 797 | { |
| 798 | 798 | global $globalDBdriver, $globalTimezone; |
| 799 | 799 | if ($globalDBdriver == 'mysql') { |
| 800 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 800 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 801 | 801 | WHERE spotter_live.ModeS = :modes |
| 802 | 802 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 803 | 803 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 804 | 804 | $query_data = array(':modes' => $modes); |
| 805 | 805 | } else { |
| 806 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 806 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 807 | 807 | WHERE spotter_live.ModeS = :modes |
| 808 | 808 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
| 809 | 809 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -812,8 +812,8 @@ discard block |
||
| 812 | 812 | |
| 813 | 813 | $sth = $this->db->prepare($query); |
| 814 | 814 | $sth->execute($query_data); |
| 815 | - $ident_result=''; |
|
| 816 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 815 | + $ident_result = ''; |
|
| 816 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 817 | 817 | { |
| 818 | 818 | //$ident_result = $row['spotter_live_id']; |
| 819 | 819 | $ident_result = $row['flightaware_id']; |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | * @return String success or false |
| 833 | 833 | * |
| 834 | 834 | */ |
| 835 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 835 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 836 | 836 | { |
| 837 | 837 | global $globalURL, $globalArchive, $globalDebug; |
| 838 | 838 | $Common = new Common(); |
@@ -925,26 +925,26 @@ discard block |
||
| 925 | 925 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 926 | 926 | |
| 927 | 927 | |
| 928 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 929 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 930 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 931 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 932 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 933 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 934 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 935 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 936 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 937 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 938 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 939 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 940 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 941 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 942 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 943 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 944 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 945 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 946 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 947 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 928 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 929 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 930 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 931 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 932 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 933 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 934 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 935 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 936 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 937 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 938 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 939 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 940 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 941 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 942 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 943 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 944 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 945 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 946 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 947 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 948 | 948 | |
| 949 | 949 | $airline_name = ''; |
| 950 | 950 | $airline_icao = ''; |
@@ -966,26 +966,26 @@ discard block |
||
| 966 | 966 | $arrival_airport_country = ''; |
| 967 | 967 | |
| 968 | 968 | |
| 969 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 970 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 971 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 972 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 969 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 970 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 971 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 972 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 973 | 973 | |
| 974 | - $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
| 974 | + $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
| 975 | 975 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
| 976 | 976 | |
| 977 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
| 977 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
| 978 | 978 | try { |
| 979 | 979 | |
| 980 | 980 | $sth = $this->db->prepare($query); |
| 981 | 981 | $sth->execute($query_values); |
| 982 | - } catch(PDOException $e) { |
|
| 982 | + } catch (PDOException $e) { |
|
| 983 | 983 | return "error : ".$e->getMessage(); |
| 984 | 984 | } |
| 985 | 985 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 986 | 986 | if ($globalDebug) echo '(Add to SBS archive : '; |
| 987 | 987 | $SpotterArchive = new SpotterArchive($this->db); |
| 988 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 988 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
| 989 | 989 | if ($globalDebug) echo $result.')'; |
| 990 | 990 | } |
| 991 | 991 | return "success"; |
@@ -994,7 +994,7 @@ discard block |
||
| 994 | 994 | |
| 995 | 995 | public function getOrderBy() |
| 996 | 996 | { |
| 997 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 997 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 998 | 998 | return $orderby; |
| 999 | 999 | } |
| 1000 | 1000 | |
@@ -26,7 +26,9 @@ discard block |
||
| 26 | 26 | $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 29 | + if (is_array($globalFilter)) { |
|
| 30 | + $filter = array_merge($filter,$globalFilter); |
|
| 31 | + } |
|
| 30 | 32 | $filter_query_join = ''; |
| 31 | 33 | $filter_query_where = ''; |
| 32 | 34 | foreach($filters as $flt) { |
@@ -79,8 +81,11 @@ discard block |
||
| 79 | 81 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 80 | 82 | } |
| 81 | 83 | } |
| 82 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 83 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 84 | + if ($filter_query_where == '' && $where) { |
|
| 85 | + $filter_query_where = ' WHERE'; |
|
| 86 | + } elseif ($filter_query_where != '' && $and) { |
|
| 87 | + $filter_query_where .= ' AND'; |
|
| 88 | + } |
|
| 84 | 89 | $filter_query = $filter_query_join.$filter_query_where; |
| 85 | 90 | return $filter_query; |
| 86 | 91 | } |
@@ -119,7 +124,9 @@ discard block |
||
| 119 | 124 | } |
| 120 | 125 | } |
| 121 | 126 | |
| 122 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 127 | + if (!isset($globalLiveInterval)) { |
|
| 128 | + $globalLiveInterval = '200'; |
|
| 129 | + } |
|
| 123 | 130 | if ($globalDBdriver == 'mysql') { |
| 124 | 131 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
| 125 | 132 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -144,7 +151,9 @@ discard block |
||
| 144 | 151 | |
| 145 | 152 | $filter_query = $this->getFilter($filter,true,true); |
| 146 | 153 | |
| 147 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 154 | + if (!isset($globalLiveInterval)) { |
|
| 155 | + $globalLiveInterval = '200'; |
|
| 156 | + } |
|
| 148 | 157 | if ($globalDBdriver == 'mysql') { |
| 149 | 158 | // $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query"; |
| 150 | 159 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
@@ -201,7 +210,9 @@ discard block |
||
| 201 | 210 | |
| 202 | 211 | $filter_query = $this->getFilter($filter,true,true); |
| 203 | 212 | |
| 204 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 213 | + if (!isset($globalLiveInterval)) { |
|
| 214 | + $globalLiveInterval = '200'; |
|
| 215 | + } |
|
| 205 | 216 | if ($globalDBdriver == 'mysql') { |
| 206 | 217 | /* |
| 207 | 218 | $query = 'SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -245,7 +256,9 @@ discard block |
||
| 245 | 256 | global $globalDBdriver, $globalLiveInterval; |
| 246 | 257 | $filter_query = $this->getFilter($filter,true,true); |
| 247 | 258 | |
| 248 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 259 | + if (!isset($globalLiveInterval)) { |
|
| 260 | + $globalLiveInterval = '200'; |
|
| 261 | + } |
|
| 249 | 262 | if ($globalDBdriver == 'mysql') { |
| 250 | 263 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
| 251 | 264 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -275,7 +288,9 @@ discard block |
||
| 275 | 288 | { |
| 276 | 289 | global $globalDBdriver, $globalLiveInterval; |
| 277 | 290 | $Spotter = new Spotter($this->db); |
| 278 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 291 | + if (!isset($globalLiveInterval)) { |
|
| 292 | + $globalLiveInterval = '200'; |
|
| 293 | + } |
|
| 279 | 294 | $filter_query = $this->getFilter($filter); |
| 280 | 295 | |
| 281 | 296 | if (is_array($coord)) { |
@@ -283,7 +298,9 @@ discard block |
||
| 283 | 298 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 284 | 299 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 285 | 300 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 286 | - } else return array(); |
|
| 301 | + } else { |
|
| 302 | + return array(); |
|
| 303 | + } |
|
| 287 | 304 | if ($globalDBdriver == 'mysql') { |
| 288 | 305 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
| 289 | 306 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -474,11 +491,15 @@ discard block |
||
| 474 | 491 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
| 475 | 492 | if ($globalDBdriver == 'mysql') { |
| 476 | 493 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 477 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 494 | + if ($liveinterval) { |
|
| 495 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 496 | + } |
|
| 478 | 497 | $query .= ' ORDER BY date'; |
| 479 | 498 | } else { |
| 480 | 499 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
| 481 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 500 | + if ($liveinterval) { |
|
| 501 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 502 | + } |
|
| 482 | 503 | $query .= ' ORDER BY date'; |
| 483 | 504 | } |
| 484 | 505 | |
@@ -573,7 +594,9 @@ discard block |
||
| 573 | 594 | $i++; |
| 574 | 595 | $j++; |
| 575 | 596 | if ($j == 30) { |
| 576 | - if ($globalDebug) echo "."; |
|
| 597 | + if ($globalDebug) { |
|
| 598 | + echo "."; |
|
| 599 | + } |
|
| 577 | 600 | try { |
| 578 | 601 | |
| 579 | 602 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -880,7 +903,9 @@ discard block |
||
| 880 | 903 | { |
| 881 | 904 | return false; |
| 882 | 905 | } |
| 883 | - } else return ''; |
|
| 906 | + } else { |
|
| 907 | + return ''; |
|
| 908 | + } |
|
| 884 | 909 | |
| 885 | 910 | if ($longitude != '') |
| 886 | 911 | { |
@@ -888,7 +913,9 @@ discard block |
||
| 888 | 913 | { |
| 889 | 914 | return false; |
| 890 | 915 | } |
| 891 | - } else return ''; |
|
| 916 | + } else { |
|
| 917 | + return ''; |
|
| 918 | + } |
|
| 892 | 919 | |
| 893 | 920 | if ($waypoints != '') |
| 894 | 921 | { |
@@ -904,7 +931,9 @@ discard block |
||
| 904 | 931 | { |
| 905 | 932 | return false; |
| 906 | 933 | } |
| 907 | - } else $altitude = 0; |
|
| 934 | + } else { |
|
| 935 | + $altitude = 0; |
|
| 936 | + } |
|
| 908 | 937 | |
| 909 | 938 | if ($heading != '') |
| 910 | 939 | { |
@@ -912,7 +941,9 @@ discard block |
||
| 912 | 941 | { |
| 913 | 942 | return false; |
| 914 | 943 | } |
| 915 | - } else $heading = 0; |
|
| 944 | + } else { |
|
| 945 | + $heading = 0; |
|
| 946 | + } |
|
| 916 | 947 | |
| 917 | 948 | if ($groundspeed != '') |
| 918 | 949 | { |
@@ -920,9 +951,13 @@ discard block |
||
| 920 | 951 | { |
| 921 | 952 | return false; |
| 922 | 953 | } |
| 923 | - } else $groundspeed = 0; |
|
| 954 | + } else { |
|
| 955 | + $groundspeed = 0; |
|
| 956 | + } |
|
| 924 | 957 | date_default_timezone_set('UTC'); |
| 925 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 958 | + if ($date == '') { |
|
| 959 | + $date = date("Y-m-d H:i:s", time()); |
|
| 960 | + } |
|
| 926 | 961 | |
| 927 | 962 | |
| 928 | 963 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -966,10 +1001,18 @@ discard block |
||
| 966 | 1001 | $arrival_airport_country = ''; |
| 967 | 1002 | |
| 968 | 1003 | |
| 969 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 970 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 971 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 972 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1004 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
| 1005 | + $squawk = NULL; |
|
| 1006 | + } |
|
| 1007 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
| 1008 | + $verticalrate = NULL; |
|
| 1009 | + } |
|
| 1010 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
| 1011 | + $groundspeed = 0; |
|
| 1012 | + } |
|
| 1013 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1014 | + $heading = 0; |
|
| 1015 | + } |
|
| 973 | 1016 | |
| 974 | 1017 | $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
| 975 | 1018 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
@@ -983,10 +1026,14 @@ discard block |
||
| 983 | 1026 | return "error : ".$e->getMessage(); |
| 984 | 1027 | } |
| 985 | 1028 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 986 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 1029 | + if ($globalDebug) { |
|
| 1030 | + echo '(Add to SBS archive : '; |
|
| 1031 | + } |
|
| 987 | 1032 | $SpotterArchive = new SpotterArchive($this->db); |
| 988 | 1033 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
| 989 | - if ($globalDebug) echo $result.')'; |
|
| 1034 | + if ($globalDebug) { |
|
| 1035 | + echo $result.')'; |
|
| 1036 | + } |
|
| 990 | 1037 | } |
| 991 | 1038 | return "success"; |
| 992 | 1039 | |
@@ -125,6 +125,9 @@ discard block |
||
| 125 | 125 | public $tag_start = 0; |
| 126 | 126 | private $dom = null; |
| 127 | 127 | |
| 128 | + /** |
|
| 129 | + * @param simple_html_dom $dom |
|
| 130 | + */ |
|
| 128 | 131 | function __construct($dom) |
| 129 | 132 | { |
| 130 | 133 | $this->dom = $dom; |
@@ -1501,6 +1504,11 @@ discard block |
||
| 1501 | 1504 | } |
| 1502 | 1505 | |
| 1503 | 1506 | // parse attributes |
| 1507 | + |
|
| 1508 | + /** |
|
| 1509 | + * @param simple_html_dom_node $node |
|
| 1510 | + * @param string[] $space |
|
| 1511 | + */ |
|
| 1504 | 1512 | protected function parse_attr($node, $name, &$space) |
| 1505 | 1513 | { |
| 1506 | 1514 | // Per sourceforge: http://sourceforge.net/tracker/?func=detail&aid=3061408&group_id=218559&atid=1044037 |
@@ -1538,6 +1546,11 @@ discard block |
||
| 1538 | 1546 | } |
| 1539 | 1547 | |
| 1540 | 1548 | // link node's parent |
| 1549 | + |
|
| 1550 | + /** |
|
| 1551 | + * @param simple_html_dom_node $node |
|
| 1552 | + * @param boolean $is_child |
|
| 1553 | + */ |
|
| 1541 | 1554 | protected function link_nodes(&$node, $is_child) |
| 1542 | 1555 | { |
| 1543 | 1556 | $node->parent = $this->parent; |
@@ -1549,6 +1562,10 @@ discard block |
||
| 1549 | 1562 | } |
| 1550 | 1563 | |
| 1551 | 1564 | // as a text node |
| 1565 | + |
|
| 1566 | + /** |
|
| 1567 | + * @param string $tag |
|
| 1568 | + */ |
|
| 1552 | 1569 | protected function as_text_node($tag) |
| 1553 | 1570 | { |
| 1554 | 1571 | $node = new simple_html_dom_node($this); |
@@ -1559,12 +1576,18 @@ discard block |
||
| 1559 | 1576 | return true; |
| 1560 | 1577 | } |
| 1561 | 1578 | |
| 1579 | + /** |
|
| 1580 | + * @param string $chars |
|
| 1581 | + */ |
|
| 1562 | 1582 | protected function skip($chars) |
| 1563 | 1583 | { |
| 1564 | 1584 | $this->pos += strspn($this->doc, $chars, $this->pos); |
| 1565 | 1585 | $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
| 1566 | 1586 | } |
| 1567 | 1587 | |
| 1588 | + /** |
|
| 1589 | + * @param string $chars |
|
| 1590 | + */ |
|
| 1568 | 1591 | protected function copy_skip($chars) |
| 1569 | 1592 | { |
| 1570 | 1593 | $pos = $this->pos; |
@@ -1575,6 +1598,9 @@ discard block |
||
| 1575 | 1598 | return substr($this->doc, $pos, $len); |
| 1576 | 1599 | } |
| 1577 | 1600 | |
| 1601 | + /** |
|
| 1602 | + * @param string $chars |
|
| 1603 | + */ |
|
| 1578 | 1604 | protected function copy_until($chars) |
| 1579 | 1605 | { |
| 1580 | 1606 | $pos = $this->pos; |
@@ -1584,6 +1610,9 @@ discard block |
||
| 1584 | 1610 | return substr($this->doc, $pos, $len); |
| 1585 | 1611 | } |
| 1586 | 1612 | |
| 1613 | + /** |
|
| 1614 | + * @param string $char |
|
| 1615 | + */ |
|
| 1587 | 1616 | protected function copy_until_char($char) |
| 1588 | 1617 | { |
| 1589 | 1618 | if ($this->char===null) return ''; |
@@ -1602,6 +1631,9 @@ discard block |
||
| 1602 | 1631 | return substr($this->doc, $pos_old, $pos-$pos_old); |
| 1603 | 1632 | } |
| 1604 | 1633 | |
| 1634 | + /** |
|
| 1635 | + * @param string $char |
|
| 1636 | + */ |
|
| 1605 | 1637 | protected function copy_until_char_escape($char) |
| 1606 | 1638 | { |
| 1607 | 1639 | if ($this->char===null) return ''; |
@@ -1633,6 +1665,10 @@ discard block |
||
| 1633 | 1665 | |
| 1634 | 1666 | // remove noise from html content |
| 1635 | 1667 | // save the noise in the $this->noise array. |
| 1668 | + |
|
| 1669 | + /** |
|
| 1670 | + * @param string $pattern |
|
| 1671 | + */ |
|
| 1636 | 1672 | protected function remove_noise($pattern, $remove_tag=false) |
| 1637 | 1673 | { |
| 1638 | 1674 | global $debug_object; |
@@ -1658,6 +1694,10 @@ discard block |
||
| 1658 | 1694 | } |
| 1659 | 1695 | |
| 1660 | 1696 | // restore noise to html content |
| 1697 | + |
|
| 1698 | + /** |
|
| 1699 | + * @param string|null $text |
|
| 1700 | + */ |
|
| 1661 | 1701 | function restore_noise($text) |
| 1662 | 1702 | { |
| 1663 | 1703 | global $debug_object; |
@@ -824,11 +824,11 @@ |
||
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | /** |
| 827 | - * Returns true if $string is valid UTF-8 and false otherwise. |
|
| 828 | - * |
|
| 829 | - * @param mixed $str String to be tested |
|
| 830 | - * @return boolean |
|
| 831 | - */ |
|
| 827 | + * Returns true if $string is valid UTF-8 and false otherwise. |
|
| 828 | + * |
|
| 829 | + * @param mixed $str String to be tested |
|
| 830 | + * @return boolean |
|
| 831 | + */ |
|
| 832 | 832 | static function is_utf8($str) |
| 833 | 833 | { |
| 834 | 834 | $c=0; $b=0; |
@@ -45,21 +45,21 @@ discard block |
||
| 45 | 45 | */ |
| 46 | 46 | define('HDOM_TYPE_ELEMENT', 1); |
| 47 | 47 | define('HDOM_TYPE_COMMENT', 2); |
| 48 | -define('HDOM_TYPE_TEXT', 3); |
|
| 49 | -define('HDOM_TYPE_ENDTAG', 4); |
|
| 50 | -define('HDOM_TYPE_ROOT', 5); |
|
| 48 | +define('HDOM_TYPE_TEXT', 3); |
|
| 49 | +define('HDOM_TYPE_ENDTAG', 4); |
|
| 50 | +define('HDOM_TYPE_ROOT', 5); |
|
| 51 | 51 | define('HDOM_TYPE_UNKNOWN', 6); |
| 52 | 52 | define('HDOM_QUOTE_DOUBLE', 0); |
| 53 | 53 | define('HDOM_QUOTE_SINGLE', 1); |
| 54 | -define('HDOM_QUOTE_NO', 3); |
|
| 55 | -define('HDOM_INFO_BEGIN', 0); |
|
| 56 | -define('HDOM_INFO_END', 1); |
|
| 57 | -define('HDOM_INFO_QUOTE', 2); |
|
| 58 | -define('HDOM_INFO_SPACE', 3); |
|
| 59 | -define('HDOM_INFO_TEXT', 4); |
|
| 60 | -define('HDOM_INFO_INNER', 5); |
|
| 61 | -define('HDOM_INFO_OUTER', 6); |
|
| 62 | -define('HDOM_INFO_ENDSPACE',7); |
|
| 54 | +define('HDOM_QUOTE_NO', 3); |
|
| 55 | +define('HDOM_INFO_BEGIN', 0); |
|
| 56 | +define('HDOM_INFO_END', 1); |
|
| 57 | +define('HDOM_INFO_QUOTE', 2); |
|
| 58 | +define('HDOM_INFO_SPACE', 3); |
|
| 59 | +define('HDOM_INFO_TEXT', 4); |
|
| 60 | +define('HDOM_INFO_INNER', 5); |
|
| 61 | +define('HDOM_INFO_OUTER', 6); |
|
| 62 | +define('HDOM_INFO_ENDSPACE', 7); |
|
| 63 | 63 | define('DEFAULT_TARGET_CHARSET', 'UTF-8'); |
| 64 | 64 | define('DEFAULT_BR_TEXT', "\r\n"); |
| 65 | 65 | define('DEFAULT_SPAN_TEXT', " "); |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | // ----------------------------------------------------------------------------- |
| 69 | 69 | // get html dom from file |
| 70 | 70 | // $maxlen is defined in the code as PHP_STREAM_COPY_ALL which is defined as -1. |
| 71 | -function file_get_html($url, $use_include_path = false, $context=null, $offset = -1, $maxLen=-1, $lowercase = true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) |
|
| 71 | +function file_get_html($url, $use_include_path = false, $context = null, $offset = -1, $maxLen = -1, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT) |
|
| 72 | 72 | { |
| 73 | 73 | // We DO force the tags to be terminated. |
| 74 | 74 | $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // get html dom from string |
| 89 | -function str_get_html($str, $lowercase=true, $forceTagsClosed=true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) |
|
| 89 | +function str_get_html($str, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT) |
|
| 90 | 90 | { |
| 91 | 91 | $dom = new simple_html_dom(null, $lowercase, $forceTagsClosed, $target_charset, $stripRN, $defaultBRText, $defaultSpanText); |
| 92 | 92 | if (empty($str) || strlen($str) > MAX_FILE_SIZE) |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | // dump html dom tree |
| 102 | -function dump_html_tree($node, $show_attr=true, $deep=0) |
|
| 102 | +function dump_html_tree($node, $show_attr = true, $deep = 0) |
|
| 103 | 103 | { |
| 104 | 104 | $node->dump($node); |
| 105 | 105 | } |
@@ -151,12 +151,12 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | // dump node's tree |
| 154 | - function dump($show_attr=true, $deep=0) |
|
| 154 | + function dump($show_attr = true, $deep = 0) |
|
| 155 | 155 | { |
| 156 | 156 | $lead = str_repeat(' ', $deep); |
| 157 | 157 | |
| 158 | 158 | echo $lead.$this->tag; |
| 159 | - if ($show_attr && count($this->attr)>0) |
|
| 159 | + if ($show_attr && count($this->attr) > 0) |
|
| 160 | 160 | { |
| 161 | 161 | echo '('; |
| 162 | 162 | foreach ($this->attr as $k=>$v) |
@@ -169,18 +169,18 @@ discard block |
||
| 169 | 169 | { |
| 170 | 170 | foreach ($this->nodes as $c) |
| 171 | 171 | { |
| 172 | - $c->dump($show_attr, $deep+1); |
|
| 172 | + $c->dump($show_attr, $deep + 1); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | // Debugging function to dump a single dom node with a bunch of information about it. |
| 179 | - function dump_node($echo=true) |
|
| 179 | + function dump_node($echo = true) |
|
| 180 | 180 | { |
| 181 | 181 | |
| 182 | 182 | $string = $this->tag; |
| 183 | - if (count($this->attr)>0) |
|
| 183 | + if (count($this->attr) > 0) |
|
| 184 | 184 | { |
| 185 | 185 | $string .= '('; |
| 186 | 186 | foreach ($this->attr as $k=>$v) |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | } |
| 190 | 190 | $string .= ')'; |
| 191 | 191 | } |
| 192 | - if (count($this->_)>0) |
|
| 192 | + if (count($this->_) > 0) |
|
| 193 | 193 | { |
| 194 | 194 | $string .= ' $_ ('; |
| 195 | 195 | foreach ($this->_ as $k=>$v) |
@@ -211,22 +211,22 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | if (isset($this->text)) |
| 213 | 213 | { |
| 214 | - $string .= " text: (" . $this->text . ")"; |
|
| 214 | + $string .= " text: (".$this->text.")"; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | $string .= " HDOM_INNER_INFO: '"; |
| 218 | 218 | if (isset($node->_[HDOM_INFO_INNER])) |
| 219 | 219 | { |
| 220 | - $string .= $node->_[HDOM_INFO_INNER] . "'"; |
|
| 220 | + $string .= $node->_[HDOM_INFO_INNER]."'"; |
|
| 221 | 221 | } |
| 222 | 222 | else |
| 223 | 223 | { |
| 224 | 224 | $string .= ' NULL '; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - $string .= " children: " . count($this->children); |
|
| 228 | - $string .= " nodes: " . count($this->nodes); |
|
| 229 | - $string .= " tag_start: " . $this->tag_start; |
|
| 227 | + $string .= " children: ".count($this->children); |
|
| 228 | + $string .= " nodes: ".count($this->nodes); |
|
| 229 | + $string .= " tag_start: ".$this->tag_start; |
|
| 230 | 230 | $string .= "\n"; |
| 231 | 231 | |
| 232 | 232 | if ($echo) |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | |
| 243 | 243 | // returns the parent of node |
| 244 | 244 | // If a node is passed in, it will reset the parent of the current node to that one. |
| 245 | - function parent($parent=null) |
|
| 245 | + function parent($parent = null) |
|
| 246 | 246 | { |
| 247 | 247 | // I am SURE that this doesn't work properly. |
| 248 | 248 | // It fails to unset the current node from it's current parents nodes or children list first. |
@@ -263,9 +263,9 @@ discard block |
||
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | // returns children of node |
| 266 | - function children($idx=-1) |
|
| 266 | + function children($idx = -1) |
|
| 267 | 267 | { |
| 268 | - if ($idx===-1) |
|
| 268 | + if ($idx === -1) |
|
| 269 | 269 | { |
| 270 | 270 | return $this->children; |
| 271 | 271 | } |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | // returns the first child of node |
| 280 | 280 | function first_child() |
| 281 | 281 | { |
| 282 | - if (count($this->children)>0) |
|
| 282 | + if (count($this->children) > 0) |
|
| 283 | 283 | { |
| 284 | 284 | return $this->children[0]; |
| 285 | 285 | } |
@@ -289,9 +289,9 @@ discard block |
||
| 289 | 289 | // returns the last child of node |
| 290 | 290 | function last_child() |
| 291 | 291 | { |
| 292 | - if (($count=count($this->children))>0) |
|
| 292 | + if (($count = count($this->children)) > 0) |
|
| 293 | 293 | { |
| 294 | - return $this->children[$count-1]; |
|
| 294 | + return $this->children[$count - 1]; |
|
| 295 | 295 | } |
| 296 | 296 | return null; |
| 297 | 297 | } |
@@ -299,18 +299,18 @@ discard block |
||
| 299 | 299 | // returns the next sibling of node |
| 300 | 300 | function next_sibling() |
| 301 | 301 | { |
| 302 | - if ($this->parent===null) |
|
| 302 | + if ($this->parent === null) |
|
| 303 | 303 | { |
| 304 | 304 | return null; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | $idx = 0; |
| 308 | 308 | $count = count($this->parent->children); |
| 309 | - while ($idx<$count && $this!==$this->parent->children[$idx]) |
|
| 309 | + while ($idx < $count && $this !== $this->parent->children[$idx]) |
|
| 310 | 310 | { |
| 311 | 311 | ++$idx; |
| 312 | 312 | } |
| 313 | - if (++$idx>=$count) |
|
| 313 | + if (++$idx >= $count) |
|
| 314 | 314 | { |
| 315 | 315 | return null; |
| 316 | 316 | } |
@@ -320,12 +320,12 @@ discard block |
||
| 320 | 320 | // returns the previous sibling of node |
| 321 | 321 | function prev_sibling() |
| 322 | 322 | { |
| 323 | - if ($this->parent===null) return null; |
|
| 323 | + if ($this->parent === null) return null; |
|
| 324 | 324 | $idx = 0; |
| 325 | 325 | $count = count($this->parent->children); |
| 326 | - while ($idx<$count && $this!==$this->parent->children[$idx]) |
|
| 326 | + while ($idx < $count && $this !== $this->parent->children[$idx]) |
|
| 327 | 327 | ++$idx; |
| 328 | - if (--$idx<0) return null; |
|
| 328 | + if (--$idx < 0) return null; |
|
| 329 | 329 | return $this->parent->children[$idx]; |
| 330 | 330 | } |
| 331 | 331 | |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | |
| 341 | 341 | while (!is_null($returnDom)) |
| 342 | 342 | { |
| 343 | - if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: " . $returnDom->tag); } |
|
| 343 | + if (is_object($debug_object)) { $debug_object->debug_log(2, "Current tag is: ".$returnDom->tag); } |
|
| 344 | 344 | |
| 345 | 345 | if ($returnDom->tag == $tag) |
| 346 | 346 | { |
@@ -374,16 +374,16 @@ discard block |
||
| 374 | 374 | { |
| 375 | 375 | if (!empty($this->text)) |
| 376 | 376 | { |
| 377 | - $text = " with text: " . $this->text; |
|
| 377 | + $text = " with text: ".$this->text; |
|
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | - $debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text); |
|
| 380 | + $debug_object->debug_log(1, 'Innertext of tag: '.$this->tag.$text); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | - if ($this->tag==='root') return $this->innertext(); |
|
| 383 | + if ($this->tag === 'root') return $this->innertext(); |
|
| 384 | 384 | |
| 385 | 385 | // trigger callback |
| 386 | - if ($this->dom && $this->dom->callback!==null) |
|
| 386 | + if ($this->dom && $this->dom->callback !== null) |
|
| 387 | 387 | { |
| 388 | 388 | call_user_func_array($this->dom->callback, array($this)); |
| 389 | 389 | } |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | // render end tag |
| 421 | - if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) |
|
| 421 | + if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END] != 0) |
|
| 422 | 422 | $ret .= '</'.$this->tag.'>'; |
| 423 | 423 | return $ret; |
| 424 | 424 | } |
@@ -433,8 +433,8 @@ discard block |
||
| 433 | 433 | case HDOM_TYPE_COMMENT: return ''; |
| 434 | 434 | case HDOM_TYPE_UNKNOWN: return ''; |
| 435 | 435 | } |
| 436 | - if (strcasecmp($this->tag, 'script')===0) return ''; |
|
| 437 | - if (strcasecmp($this->tag, 'style')===0) return ''; |
|
| 436 | + if (strcasecmp($this->tag, 'script') === 0) return ''; |
|
| 437 | + if (strcasecmp($this->tag, 'style') === 0) return ''; |
|
| 438 | 438 | |
| 439 | 439 | $ret = ''; |
| 440 | 440 | // In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL. |
@@ -480,12 +480,12 @@ discard block |
||
| 480 | 480 | ++$i; |
| 481 | 481 | |
| 482 | 482 | // skip removed attribute |
| 483 | - if ($val===null || $val===false) |
|
| 483 | + if ($val === null || $val === false) |
|
| 484 | 484 | continue; |
| 485 | 485 | |
| 486 | 486 | $ret .= $this->_[HDOM_INFO_SPACE][$i][0]; |
| 487 | 487 | //no value attr: nowrap, checked selected... |
| 488 | - if ($val===true) |
|
| 488 | + if ($val === true) |
|
| 489 | 489 | $ret .= $key; |
| 490 | 490 | else { |
| 491 | 491 | switch ($this->_[HDOM_INFO_QUOTE][$i]) |
@@ -498,34 +498,34 @@ discard block |
||
| 498 | 498 | } |
| 499 | 499 | } |
| 500 | 500 | $ret = $this->dom->restore_noise($ret); |
| 501 | - return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>'; |
|
| 501 | + return $ret.$this->_[HDOM_INFO_ENDSPACE].'>'; |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | // find elements by css selector |
| 505 | 505 | //PaperG - added ability for find to lowercase the value of the selector. |
| 506 | - function find($selector, $idx=null, $lowercase=false) |
|
| 506 | + function find($selector, $idx = null, $lowercase = false) |
|
| 507 | 507 | { |
| 508 | 508 | $selectors = $this->parse_selector($selector); |
| 509 | - if (($count=count($selectors))===0) return array(); |
|
| 509 | + if (($count = count($selectors)) === 0) return array(); |
|
| 510 | 510 | $found_keys = array(); |
| 511 | 511 | |
| 512 | 512 | // find each selector |
| 513 | - for ($c=0; $c<$count; ++$c) |
|
| 513 | + for ($c = 0; $c < $count; ++$c) |
|
| 514 | 514 | { |
| 515 | 515 | // The change on the below line was documented on the sourceforge code tracker id 2788009 |
| 516 | 516 | // used to be: if (($levle=count($selectors[0]))===0) return array(); |
| 517 | - if (($levle=count($selectors[$c]))===0) return array(); |
|
| 517 | + if (($levle = count($selectors[$c])) === 0) return array(); |
|
| 518 | 518 | if (!isset($this->_[HDOM_INFO_BEGIN])) return array(); |
| 519 | 519 | |
| 520 | 520 | $head = array($this->_[HDOM_INFO_BEGIN]=>1); |
| 521 | 521 | |
| 522 | 522 | // handle descendant selectors, no recursive! |
| 523 | - for ($l=0; $l<$levle; ++$l) |
|
| 523 | + for ($l = 0; $l < $levle; ++$l) |
|
| 524 | 524 | { |
| 525 | 525 | $ret = array(); |
| 526 | 526 | foreach ($head as $k=>$v) |
| 527 | 527 | { |
| 528 | - $n = ($k===-1) ? $this->dom->root : $this->dom->nodes[$k]; |
|
| 528 | + $n = ($k === -1) ? $this->dom->root : $this->dom->nodes[$k]; |
|
| 529 | 529 | //PaperG - Pass this optional parameter on to the seek function. |
| 530 | 530 | $n->seek($selectors[$c][$l], $ret, $lowercase); |
| 531 | 531 | } |
@@ -550,13 +550,13 @@ discard block |
||
| 550 | 550 | |
| 551 | 551 | // return nth-element or array |
| 552 | 552 | if (is_null($idx)) return $found; |
| 553 | - else if ($idx<0) $idx = count($found) + $idx; |
|
| 553 | + else if ($idx < 0) $idx = count($found) + $idx; |
|
| 554 | 554 | return (isset($found[$idx])) ? $found[$idx] : null; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | // seek for given conditions |
| 558 | 558 | // PaperG - added parameter to allow for case insensitive testing of the value of a selector. |
| 559 | - protected function seek($selector, &$ret, $lowercase=false) |
|
| 559 | + protected function seek($selector, &$ret, $lowercase = false) |
|
| 560 | 560 | { |
| 561 | 561 | global $debug_object; |
| 562 | 562 | if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } |
@@ -569,8 +569,8 @@ discard block |
||
| 569 | 569 | $count = 0; |
| 570 | 570 | foreach ($this->children as $c) |
| 571 | 571 | { |
| 572 | - if ($tag==='*' || $tag===$c->tag) { |
|
| 573 | - if (++$count==$key) { |
|
| 572 | + if ($tag === '*' || $tag === $c->tag) { |
|
| 573 | + if (++$count == $key) { |
|
| 574 | 574 | $ret[$c->_[HDOM_INFO_BEGIN]] = 1; |
| 575 | 575 | return; |
| 576 | 576 | } |
@@ -580,38 +580,38 @@ discard block |
||
| 580 | 580 | } |
| 581 | 581 | |
| 582 | 582 | $end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0; |
| 583 | - if ($end==0) { |
|
| 583 | + if ($end == 0) { |
|
| 584 | 584 | $parent = $this->parent; |
| 585 | - while (!isset($parent->_[HDOM_INFO_END]) && $parent!==null) { |
|
| 585 | + while (!isset($parent->_[HDOM_INFO_END]) && $parent !== null) { |
|
| 586 | 586 | $end -= 1; |
| 587 | 587 | $parent = $parent->parent; |
| 588 | 588 | } |
| 589 | 589 | $end += $parent->_[HDOM_INFO_END]; |
| 590 | 590 | } |
| 591 | 591 | |
| 592 | - for ($i=$this->_[HDOM_INFO_BEGIN]+1; $i<$end; ++$i) { |
|
| 592 | + for ($i = $this->_[HDOM_INFO_BEGIN] + 1; $i < $end; ++$i) { |
|
| 593 | 593 | $node = $this->dom->nodes[$i]; |
| 594 | 594 | |
| 595 | 595 | $pass = true; |
| 596 | 596 | |
| 597 | - if ($tag==='*' && !$key) { |
|
| 597 | + if ($tag === '*' && !$key) { |
|
| 598 | 598 | if (in_array($node, $this->children, true)) |
| 599 | 599 | $ret[$i] = 1; |
| 600 | 600 | continue; |
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | // compare tag |
| 604 | - if ($tag && $tag!=$node->tag && $tag!=='*') {$pass=false;} |
|
| 604 | + if ($tag && $tag != $node->tag && $tag !== '*') {$pass = false; } |
|
| 605 | 605 | // compare key |
| 606 | 606 | if ($pass && $key) { |
| 607 | 607 | if ($no_key) { |
| 608 | - if (isset($node->attr[$key])) $pass=false; |
|
| 608 | + if (isset($node->attr[$key])) $pass = false; |
|
| 609 | 609 | } else { |
| 610 | - if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false; |
|
| 610 | + if (($key != "plaintext") && !isset($node->attr[$key])) $pass = false; |
|
| 611 | 611 | } |
| 612 | 612 | } |
| 613 | 613 | // compare value |
| 614 | - if ($pass && $key && $val && $val!=='*') { |
|
| 614 | + if ($pass && $key && $val && $val !== '*') { |
|
| 615 | 615 | // If they have told us that this is a "plaintext" search then we want the plaintext of the node - right? |
| 616 | 616 | if ($key == "plaintext") { |
| 617 | 617 | // $node->plaintext actually returns $node->text(); |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | // this is a normal search, we want the value of that attribute of the tag. |
| 621 | 621 | $nodeKeyValue = $node->attr[$key]; |
| 622 | 622 | } |
| 623 | - if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: " . $node->tag . " for attribute: " . $key . $exp . $val . " where nodes value is: " . $nodeKeyValue);} |
|
| 623 | + if (is_object($debug_object)) {$debug_object->debug_log(2, "testing node: ".$node->tag." for attribute: ".$key.$exp.$val." where nodes value is: ".$nodeKeyValue); } |
|
| 624 | 624 | |
| 625 | 625 | //PaperG - If lowercase is set, do a case insensitive test of the value of the selector. |
| 626 | 626 | if ($lowercase) { |
@@ -628,11 +628,11 @@ discard block |
||
| 628 | 628 | } else { |
| 629 | 629 | $check = $this->match($exp, $val, $nodeKeyValue); |
| 630 | 630 | } |
| 631 | - if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: " . ($check ? "true" : "false"));} |
|
| 631 | + if (is_object($debug_object)) {$debug_object->debug_log(2, "after match: ".($check ? "true" : "false")); } |
|
| 632 | 632 | |
| 633 | 633 | // handle multiple class |
| 634 | - if (!$check && strcasecmp($key, 'class')===0) { |
|
| 635 | - foreach (explode(' ',$node->attr[$key]) as $k) { |
|
| 634 | + if (!$check && strcasecmp($key, 'class') === 0) { |
|
| 635 | + foreach (explode(' ', $node->attr[$key]) as $k) { |
|
| 636 | 636 | // Without this, there were cases where leading, trailing, or double spaces lead to our comparing blanks - bad form. |
| 637 | 637 | if (!empty($k)) { |
| 638 | 638 | if ($lowercase) { |
@@ -650,24 +650,24 @@ discard block |
||
| 650 | 650 | unset($node); |
| 651 | 651 | } |
| 652 | 652 | // It's passed by reference so this is actually what this function returns. |
| 653 | - if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret);} |
|
| 653 | + if (is_object($debug_object)) {$debug_object->debug_log(1, "EXIT - ret: ", $ret); } |
|
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | protected function match($exp, $pattern, $value) { |
| 657 | 657 | global $debug_object; |
| 658 | - if (is_object($debug_object)) {$debug_object->debug_log_entry(1);} |
|
| 658 | + if (is_object($debug_object)) {$debug_object->debug_log_entry(1); } |
|
| 659 | 659 | |
| 660 | 660 | switch ($exp) { |
| 661 | 661 | case '=': |
| 662 | - return ($value===$pattern); |
|
| 662 | + return ($value === $pattern); |
|
| 663 | 663 | case '!=': |
| 664 | - return ($value!==$pattern); |
|
| 664 | + return ($value !== $pattern); |
|
| 665 | 665 | case '^=': |
| 666 | - return preg_match("/^".preg_quote($pattern,'/')."/", $value); |
|
| 666 | + return preg_match("/^".preg_quote($pattern, '/')."/", $value); |
|
| 667 | 667 | case '$=': |
| 668 | - return preg_match("/".preg_quote($pattern,'/')."$/", $value); |
|
| 668 | + return preg_match("/".preg_quote($pattern, '/')."$/", $value); |
|
| 669 | 669 | case '*=': |
| 670 | - if ($pattern[0]=='/') { |
|
| 670 | + if ($pattern[0] == '/') { |
|
| 671 | 671 | return preg_match($pattern, $value); |
| 672 | 672 | } |
| 673 | 673 | return preg_match("/".$pattern."/i", $value); |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | |
| 678 | 678 | protected function parse_selector($selector_string) { |
| 679 | 679 | global $debug_object; |
| 680 | - if (is_object($debug_object)) {$debug_object->debug_log_entry(1);} |
|
| 680 | + if (is_object($debug_object)) {$debug_object->debug_log_entry(1); } |
|
| 681 | 681 | |
| 682 | 682 | // pattern of CSS selectors, modified from mootools |
| 683 | 683 | // Paperg: Add the colon to the attrbute, so that it properly finds <tag attr:ibute="something" > like google does. |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | // $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; |
| 689 | 689 | $pattern = "/([\w-:\*]*)(?:\#([\w-]+)|\.([\w-]+))?(?:\[@?(!?[\w-:]+)(?:([!*^$]?=)[\"']?(.*?)[\"']?)?\])?([\/, ]+)/is"; |
| 690 | 690 | preg_match_all($pattern, trim($selector_string).' ', $matches, PREG_SET_ORDER); |
| 691 | - if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches);} |
|
| 691 | + if (is_object($debug_object)) {$debug_object->debug_log(2, "Matches Array: ", $matches); } |
|
| 692 | 692 | |
| 693 | 693 | $selectors = array(); |
| 694 | 694 | $result = array(); |
@@ -696,29 +696,29 @@ discard block |
||
| 696 | 696 | |
| 697 | 697 | foreach ($matches as $m) { |
| 698 | 698 | $m[0] = trim($m[0]); |
| 699 | - if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue; |
|
| 699 | + if ($m[0] === '' || $m[0] === '/' || $m[0] === '//') continue; |
|
| 700 | 700 | // for browser generated xpath |
| 701 | - if ($m[1]==='tbody') continue; |
|
| 701 | + if ($m[1] === 'tbody') continue; |
|
| 702 | 702 | |
| 703 | 703 | list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false); |
| 704 | - if (!empty($m[2])) {$key='id'; $val=$m[2];} |
|
| 705 | - if (!empty($m[3])) {$key='class'; $val=$m[3];} |
|
| 706 | - if (!empty($m[4])) {$key=$m[4];} |
|
| 707 | - if (!empty($m[5])) {$exp=$m[5];} |
|
| 708 | - if (!empty($m[6])) {$val=$m[6];} |
|
| 704 | + if (!empty($m[2])) {$key = 'id'; $val = $m[2]; } |
|
| 705 | + if (!empty($m[3])) {$key = 'class'; $val = $m[3]; } |
|
| 706 | + if (!empty($m[4])) {$key = $m[4]; } |
|
| 707 | + if (!empty($m[5])) {$exp = $m[5]; } |
|
| 708 | + if (!empty($m[6])) {$val = $m[6]; } |
|
| 709 | 709 | |
| 710 | 710 | // convert to lowercase |
| 711 | - if ($this->dom->lowercase) {$tag=strtolower($tag); $key=strtolower($key);} |
|
| 711 | + if ($this->dom->lowercase) {$tag = strtolower($tag); $key = strtolower($key); } |
|
| 712 | 712 | //elements that do NOT have the specified attribute |
| 713 | - if (isset($key[0]) && $key[0]==='!') {$key=substr($key, 1); $no_key=true;} |
|
| 713 | + if (isset($key[0]) && $key[0] === '!') {$key = substr($key, 1); $no_key = true; } |
|
| 714 | 714 | |
| 715 | 715 | $result[] = array($tag, $key, $val, $exp, $no_key); |
| 716 | - if (trim($m[7])===',') { |
|
| 716 | + if (trim($m[7]) === ',') { |
|
| 717 | 717 | $selectors[] = $result; |
| 718 | 718 | $result = array(); |
| 719 | 719 | } |
| 720 | 720 | } |
| 721 | - if (count($result)>0) |
|
| 721 | + if (count($result) > 0) |
|
| 722 | 722 | $selectors[] = $result; |
| 723 | 723 | return $selectors; |
| 724 | 724 | } |
@@ -742,7 +742,7 @@ discard block |
||
| 742 | 742 | function __set($name, $value) |
| 743 | 743 | { |
| 744 | 744 | global $debug_object; |
| 745 | - if (is_object($debug_object)) {$debug_object->debug_log_entry(1);} |
|
| 745 | + if (is_object($debug_object)) {$debug_object->debug_log_entry(1); } |
|
| 746 | 746 | |
| 747 | 747 | switch ($name) |
| 748 | 748 | { |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | function convert_text($text) |
| 781 | 781 | { |
| 782 | 782 | global $debug_object; |
| 783 | - if (is_object($debug_object)) {$debug_object->debug_log_entry(1);} |
|
| 783 | + if (is_object($debug_object)) {$debug_object->debug_log_entry(1); } |
|
| 784 | 784 | |
| 785 | 785 | $converted_text = $text; |
| 786 | 786 | |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | $sourceCharset = strtoupper($this->dom->_charset); |
| 793 | 793 | $targetCharset = strtoupper($this->dom->_target_charset); |
| 794 | 794 | } |
| 795 | - if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: " . $sourceCharset . " target charaset: " . $targetCharset);} |
|
| 795 | + if (is_object($debug_object)) {$debug_object->debug_log(3, "source charset: ".$sourceCharset." target charaset: ".$targetCharset); } |
|
| 796 | 796 | |
| 797 | 797 | if (!empty($sourceCharset) && !empty($targetCharset) && (strcasecmp($sourceCharset, $targetCharset) != 0)) |
| 798 | 798 | { |
@@ -831,27 +831,27 @@ discard block |
||
| 831 | 831 | */ |
| 832 | 832 | static function is_utf8($str) |
| 833 | 833 | { |
| 834 | - $c=0; $b=0; |
|
| 835 | - $bits=0; |
|
| 836 | - $len=strlen($str); |
|
| 837 | - for($i=0; $i<$len; $i++) |
|
| 834 | + $c = 0; $b = 0; |
|
| 835 | + $bits = 0; |
|
| 836 | + $len = strlen($str); |
|
| 837 | + for ($i = 0; $i < $len; $i++) |
|
| 838 | 838 | { |
| 839 | - $c=ord($str[$i]); |
|
| 840 | - if($c > 128) |
|
| 839 | + $c = ord($str[$i]); |
|
| 840 | + if ($c > 128) |
|
| 841 | 841 | { |
| 842 | - if(($c >= 254)) return false; |
|
| 843 | - elseif($c >= 252) $bits=6; |
|
| 844 | - elseif($c >= 248) $bits=5; |
|
| 845 | - elseif($c >= 240) $bits=4; |
|
| 846 | - elseif($c >= 224) $bits=3; |
|
| 847 | - elseif($c >= 192) $bits=2; |
|
| 842 | + if (($c >= 254)) return false; |
|
| 843 | + elseif ($c >= 252) $bits = 6; |
|
| 844 | + elseif ($c >= 248) $bits = 5; |
|
| 845 | + elseif ($c >= 240) $bits = 4; |
|
| 846 | + elseif ($c >= 224) $bits = 3; |
|
| 847 | + elseif ($c >= 192) $bits = 2; |
|
| 848 | 848 | else return false; |
| 849 | - if(($i+$bits) > $len) return false; |
|
| 850 | - while($bits > 1) |
|
| 849 | + if (($i + $bits) > $len) return false; |
|
| 850 | + while ($bits > 1) |
|
| 851 | 851 | { |
| 852 | 852 | $i++; |
| 853 | - $b=ord($str[$i]); |
|
| 854 | - if($b < 128 || $b > 191) return false; |
|
| 853 | + $b = ord($str[$i]); |
|
| 854 | + if ($b < 128 || $b > 191) return false; |
|
| 855 | 855 | $bits--; |
| 856 | 856 | } |
| 857 | 857 | } |
@@ -955,24 +955,24 @@ discard block |
||
| 955 | 955 | } |
| 956 | 956 | |
| 957 | 957 | // camel naming conventions |
| 958 | - function getAllAttributes() {return $this->attr;} |
|
| 959 | - function getAttribute($name) {return $this->__get($name);} |
|
| 960 | - function setAttribute($name, $value) {$this->__set($name, $value);} |
|
| 961 | - function hasAttribute($name) {return $this->__isset($name);} |
|
| 962 | - function removeAttribute($name) {$this->__set($name, null);} |
|
| 963 | - function getElementById($id) {return $this->find("#$id", 0);} |
|
| 964 | - function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);} |
|
| 965 | - function getElementByTagName($name) {return $this->find($name, 0);} |
|
| 966 | - function getElementsByTagName($name, $idx=null) {return $this->find($name, $idx);} |
|
| 967 | - function parentNode() {return $this->parent();} |
|
| 968 | - function childNodes($idx=-1) {return $this->children($idx);} |
|
| 969 | - function firstChild() {return $this->first_child();} |
|
| 970 | - function lastChild() {return $this->last_child();} |
|
| 971 | - function nextSibling() {return $this->next_sibling();} |
|
| 972 | - function previousSibling() {return $this->prev_sibling();} |
|
| 973 | - function hasChildNodes() {return $this->has_child();} |
|
| 974 | - function nodeName() {return $this->tag;} |
|
| 975 | - function appendChild($node) {$node->parent($this); return $node;} |
|
| 958 | + function getAllAttributes() {return $this->attr; } |
|
| 959 | + function getAttribute($name) {return $this->__get($name); } |
|
| 960 | + function setAttribute($name, $value) {$this->__set($name, $value); } |
|
| 961 | + function hasAttribute($name) {return $this->__isset($name); } |
|
| 962 | + function removeAttribute($name) {$this->__set($name, null); } |
|
| 963 | + function getElementById($id) {return $this->find("#$id", 0); } |
|
| 964 | + function getElementsById($id, $idx = null) {return $this->find("#$id", $idx); } |
|
| 965 | + function getElementByTagName($name) {return $this->find($name, 0); } |
|
| 966 | + function getElementsByTagName($name, $idx = null) {return $this->find($name, $idx); } |
|
| 967 | + function parentNode() {return $this->parent(); } |
|
| 968 | + function childNodes($idx = -1) {return $this->children($idx); } |
|
| 969 | + function firstChild() {return $this->first_child(); } |
|
| 970 | + function lastChild() {return $this->last_child(); } |
|
| 971 | + function nextSibling() {return $this->next_sibling(); } |
|
| 972 | + function previousSibling() {return $this->prev_sibling(); } |
|
| 973 | + function hasChildNodes() {return $this->has_child(); } |
|
| 974 | + function nodeName() {return $this->tag; } |
|
| 975 | + function appendChild($node) {$node->parent($this); return $node; } |
|
| 976 | 976 | |
| 977 | 977 | } |
| 978 | 978 | |
@@ -1028,11 +1028,11 @@ discard block |
||
| 1028 | 1028 | 'option'=>array('option'=>1), |
| 1029 | 1029 | ); |
| 1030 | 1030 | |
| 1031 | - function __construct($str=null, $lowercase=true, $forceTagsClosed=true, $target_charset=DEFAULT_TARGET_CHARSET, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) |
|
| 1031 | + function __construct($str = null, $lowercase = true, $forceTagsClosed = true, $target_charset = DEFAULT_TARGET_CHARSET, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT) |
|
| 1032 | 1032 | { |
| 1033 | 1033 | if ($str) |
| 1034 | 1034 | { |
| 1035 | - if (preg_match("/^http:\/\//i",$str) || is_file($str)) |
|
| 1035 | + if (preg_match("/^http:\/\//i", $str) || is_file($str)) |
|
| 1036 | 1036 | { |
| 1037 | 1037 | $this->load_file($str); |
| 1038 | 1038 | } |
@@ -1043,7 +1043,7 @@ discard block |
||
| 1043 | 1043 | } |
| 1044 | 1044 | // Forcing tags to be closed implies that we don't trust the html, but it can lead to parsing errors if we SHOULD trust the html. |
| 1045 | 1045 | if (!$forceTagsClosed) { |
| 1046 | - $this->optional_closing_array=array(); |
|
| 1046 | + $this->optional_closing_array = array(); |
|
| 1047 | 1047 | } |
| 1048 | 1048 | $this->_target_charset = $target_charset; |
| 1049 | 1049 | } |
@@ -1054,7 +1054,7 @@ discard block |
||
| 1054 | 1054 | } |
| 1055 | 1055 | |
| 1056 | 1056 | // load html from string |
| 1057 | - function load($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) |
|
| 1057 | + function load($str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT) |
|
| 1058 | 1058 | { |
| 1059 | 1059 | global $debug_object; |
| 1060 | 1060 | |
@@ -1096,7 +1096,7 @@ discard block |
||
| 1096 | 1096 | $args = func_get_args(); |
| 1097 | 1097 | $this->load(call_user_func_array('file_get_contents', $args), true); |
| 1098 | 1098 | // Throw an error if we can't properly load the dom. |
| 1099 | - if (($error=error_get_last())!==null) { |
|
| 1099 | + if (($error = error_get_last()) !== null) { |
|
| 1100 | 1100 | $this->clear(); |
| 1101 | 1101 | return false; |
| 1102 | 1102 | } |
@@ -1115,16 +1115,16 @@ discard block |
||
| 1115 | 1115 | } |
| 1116 | 1116 | |
| 1117 | 1117 | // save dom as string |
| 1118 | - function save($filepath='') |
|
| 1118 | + function save($filepath = '') |
|
| 1119 | 1119 | { |
| 1120 | 1120 | $ret = $this->root->innertext(); |
| 1121 | - if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX); |
|
| 1121 | + if ($filepath !== '') file_put_contents($filepath, $ret, LOCK_EX); |
|
| 1122 | 1122 | return $ret; |
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | 1125 | // find dom node by css selector |
| 1126 | 1126 | // Paperg - allow us to specify that we want case insensitive testing of the value of the selector. |
| 1127 | - function find($selector, $idx=null, $lowercase=false) |
|
| 1127 | + function find($selector, $idx = null, $lowercase = false) |
|
| 1128 | 1128 | { |
| 1129 | 1129 | return $this->root->find($selector, $idx, $lowercase); |
| 1130 | 1130 | } |
@@ -1132,22 +1132,22 @@ discard block |
||
| 1132 | 1132 | // clean up memory due to php5 circular references memory leak... |
| 1133 | 1133 | function clear() |
| 1134 | 1134 | { |
| 1135 | - foreach ($this->nodes as $n) {$n->clear(); $n = null;} |
|
| 1135 | + foreach ($this->nodes as $n) {$n->clear(); $n = null; } |
|
| 1136 | 1136 | // This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear. |
| 1137 | - if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;} |
|
| 1138 | - if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);} |
|
| 1139 | - if (isset($this->root)) {$this->root->clear(); unset($this->root);} |
|
| 1137 | + if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null; } |
|
| 1138 | + if (isset($this->parent)) {$this->parent->clear(); unset($this->parent); } |
|
| 1139 | + if (isset($this->root)) {$this->root->clear(); unset($this->root); } |
|
| 1140 | 1140 | unset($this->doc); |
| 1141 | 1141 | unset($this->noise); |
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | - function dump($show_attr=true) |
|
| 1144 | + function dump($show_attr = true) |
|
| 1145 | 1145 | { |
| 1146 | 1146 | $this->root->dump($show_attr); |
| 1147 | 1147 | } |
| 1148 | 1148 | |
| 1149 | 1149 | // prepare HTML data and init everything |
| 1150 | - protected function prepare($str, $lowercase=true, $stripRN=true, $defaultBRText=DEFAULT_BR_TEXT, $defaultSpanText=DEFAULT_SPAN_TEXT) |
|
| 1150 | + protected function prepare($str, $lowercase = true, $stripRN = true, $defaultBRText = DEFAULT_BR_TEXT, $defaultSpanText = DEFAULT_SPAN_TEXT) |
|
| 1151 | 1151 | { |
| 1152 | 1152 | $this->clear(); |
| 1153 | 1153 | |
@@ -1178,13 +1178,13 @@ discard block |
||
| 1178 | 1178 | $this->root->_[HDOM_INFO_BEGIN] = -1; |
| 1179 | 1179 | $this->root->nodetype = HDOM_TYPE_ROOT; |
| 1180 | 1180 | $this->parent = $this->root; |
| 1181 | - if ($this->size>0) $this->char = $this->doc[0]; |
|
| 1181 | + if ($this->size > 0) $this->char = $this->doc[0]; |
|
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | 1184 | // parse html content |
| 1185 | 1185 | protected function parse() |
| 1186 | 1186 | { |
| 1187 | - if (($s = $this->copy_until_char('<'))==='') |
|
| 1187 | + if (($s = $this->copy_until_char('<')) === '') |
|
| 1188 | 1188 | { |
| 1189 | 1189 | return $this->read_tag(); |
| 1190 | 1190 | } |
@@ -1213,18 +1213,18 @@ discard block |
||
| 1213 | 1213 | if ($success) |
| 1214 | 1214 | { |
| 1215 | 1215 | $charset = $matches[1]; |
| 1216 | - if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: ' . $charset);} |
|
| 1216 | + if (is_object($debug_object)) {$debug_object->debug_log(2, 'header content-type found charset of: '.$charset); } |
|
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | 1219 | } |
| 1220 | 1220 | |
| 1221 | 1221 | if (empty($charset)) |
| 1222 | 1222 | { |
| 1223 | - $el = $this->root->find('meta[http-equiv=Content-Type]',0, true); |
|
| 1223 | + $el = $this->root->find('meta[http-equiv=Content-Type]', 0, true); |
|
| 1224 | 1224 | if (!empty($el)) |
| 1225 | 1225 | { |
| 1226 | 1226 | $fullvalue = $el->content; |
| 1227 | - if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found' . $fullvalue);} |
|
| 1227 | + if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag found'.$fullvalue); } |
|
| 1228 | 1228 | |
| 1229 | 1229 | if (!empty($fullvalue)) |
| 1230 | 1230 | { |
@@ -1236,7 +1236,7 @@ discard block |
||
| 1236 | 1236 | else |
| 1237 | 1237 | { |
| 1238 | 1238 | // If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1 |
| 1239 | - if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');} |
|
| 1239 | + if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.'); } |
|
| 1240 | 1240 | $charset = 'ISO-8859-1'; |
| 1241 | 1241 | } |
| 1242 | 1242 | } |
@@ -1251,14 +1251,14 @@ discard block |
||
| 1251 | 1251 | if (function_exists('mb_detect_encoding')) |
| 1252 | 1252 | { |
| 1253 | 1253 | // Have php try to detect the encoding from the text given to us. |
| 1254 | - $charset = mb_detect_encoding($this->root->plaintext . "ascii", $encoding_list = array( "UTF-8", "CP1252" ) ); |
|
| 1255 | - if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: ' . $charset);} |
|
| 1254 | + $charset = mb_detect_encoding($this->root->plaintext."ascii", $encoding_list = array("UTF-8", "CP1252")); |
|
| 1255 | + if (is_object($debug_object)) {$debug_object->debug_log(2, 'mb_detect found: '.$charset); } |
|
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | 1258 | // and if this doesn't work... then we need to just wrongheadedly assume it's UTF-8 so that we can move on - cause this will usually give us most of what we need... |
| 1259 | 1259 | if ($charset === false) |
| 1260 | 1260 | { |
| 1261 | - if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8');} |
|
| 1261 | + if (is_object($debug_object)) {$debug_object->debug_log(2, 'since mb_detect failed - using default of utf-8'); } |
|
| 1262 | 1262 | $charset = 'UTF-8'; |
| 1263 | 1263 | } |
| 1264 | 1264 | } |
@@ -1266,11 +1266,11 @@ discard block |
||
| 1266 | 1266 | // Since CP1252 is a superset, if we get one of it's subsets, we want it instead. |
| 1267 | 1267 | if ((strtolower($charset) == strtolower('ISO-8859-1')) || (strtolower($charset) == strtolower('Latin1')) || (strtolower($charset) == strtolower('Latin-1'))) |
| 1268 | 1268 | { |
| 1269 | - if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing ' . $charset . ' with CP1252 as its a superset');} |
|
| 1269 | + if (is_object($debug_object)) {$debug_object->debug_log(2, 'replacing '.$charset.' with CP1252 as its a superset'); } |
|
| 1270 | 1270 | $charset = 'CP1252'; |
| 1271 | 1271 | } |
| 1272 | 1272 | |
| 1273 | - if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - ' . $charset);} |
|
| 1273 | + if (is_object($debug_object)) {$debug_object->debug_log(1, 'EXIT - '.$charset); } |
|
| 1274 | 1274 | |
| 1275 | 1275 | return $this->_charset = $charset; |
| 1276 | 1276 | } |
@@ -1278,41 +1278,41 @@ discard block |
||
| 1278 | 1278 | // read tag info |
| 1279 | 1279 | protected function read_tag() |
| 1280 | 1280 | { |
| 1281 | - if ($this->char!=='<') |
|
| 1281 | + if ($this->char !== '<') |
|
| 1282 | 1282 | { |
| 1283 | 1283 | $this->root->_[HDOM_INFO_END] = $this->cursor; |
| 1284 | 1284 | return false; |
| 1285 | 1285 | } |
| 1286 | 1286 | $begin_tag_pos = $this->pos; |
| 1287 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1287 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1288 | 1288 | |
| 1289 | 1289 | // end tag |
| 1290 | - if ($this->char==='/') |
|
| 1290 | + if ($this->char === '/') |
|
| 1291 | 1291 | { |
| 1292 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1292 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1293 | 1293 | // This represents the change in the simple_html_dom trunk from revision 180 to 181. |
| 1294 | 1294 | // $this->skip($this->token_blank_t); |
| 1295 | 1295 | $this->skip($this->token_blank); |
| 1296 | 1296 | $tag = $this->copy_until_char('>'); |
| 1297 | 1297 | |
| 1298 | 1298 | // skip attributes in end tag |
| 1299 | - if (($pos = strpos($tag, ' '))!==false) |
|
| 1299 | + if (($pos = strpos($tag, ' ')) !== false) |
|
| 1300 | 1300 | $tag = substr($tag, 0, $pos); |
| 1301 | 1301 | |
| 1302 | 1302 | $parent_lower = strtolower($this->parent->tag); |
| 1303 | 1303 | $tag_lower = strtolower($tag); |
| 1304 | 1304 | |
| 1305 | - if ($parent_lower!==$tag_lower) |
|
| 1305 | + if ($parent_lower !== $tag_lower) |
|
| 1306 | 1306 | { |
| 1307 | 1307 | if (isset($this->optional_closing_tags[$parent_lower]) && isset($this->block_tags[$tag_lower])) |
| 1308 | 1308 | { |
| 1309 | 1309 | $this->parent->_[HDOM_INFO_END] = 0; |
| 1310 | 1310 | $org_parent = $this->parent; |
| 1311 | 1311 | |
| 1312 | - while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) |
|
| 1312 | + while (($this->parent->parent) && strtolower($this->parent->tag) !== $tag_lower) |
|
| 1313 | 1313 | $this->parent = $this->parent->parent; |
| 1314 | 1314 | |
| 1315 | - if (strtolower($this->parent->tag)!==$tag_lower) { |
|
| 1315 | + if (strtolower($this->parent->tag) !== $tag_lower) { |
|
| 1316 | 1316 | $this->parent = $org_parent; // restore origonal parent |
| 1317 | 1317 | if ($this->parent->parent) $this->parent = $this->parent->parent; |
| 1318 | 1318 | $this->parent->_[HDOM_INFO_END] = $this->cursor; |
@@ -1324,17 +1324,17 @@ discard block |
||
| 1324 | 1324 | $this->parent->_[HDOM_INFO_END] = 0; |
| 1325 | 1325 | $org_parent = $this->parent; |
| 1326 | 1326 | |
| 1327 | - while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) |
|
| 1327 | + while (($this->parent->parent) && strtolower($this->parent->tag) !== $tag_lower) |
|
| 1328 | 1328 | $this->parent = $this->parent->parent; |
| 1329 | 1329 | |
| 1330 | - if (strtolower($this->parent->tag)!==$tag_lower) |
|
| 1330 | + if (strtolower($this->parent->tag) !== $tag_lower) |
|
| 1331 | 1331 | { |
| 1332 | 1332 | $this->parent = $org_parent; // restore origonal parent |
| 1333 | 1333 | $this->parent->_[HDOM_INFO_END] = $this->cursor; |
| 1334 | 1334 | return $this->as_text_node($tag); |
| 1335 | 1335 | } |
| 1336 | 1336 | } |
| 1337 | - else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower) |
|
| 1337 | + else if (($this->parent->parent) && strtolower($this->parent->parent->tag) === $tag_lower) |
|
| 1338 | 1338 | { |
| 1339 | 1339 | $this->parent->_[HDOM_INFO_END] = 0; |
| 1340 | 1340 | $this->parent = $this->parent->parent; |
@@ -1346,7 +1346,7 @@ discard block |
||
| 1346 | 1346 | $this->parent->_[HDOM_INFO_END] = $this->cursor; |
| 1347 | 1347 | if ($this->parent->parent) $this->parent = $this->parent->parent; |
| 1348 | 1348 | |
| 1349 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1349 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1350 | 1350 | return true; |
| 1351 | 1351 | } |
| 1352 | 1352 | |
@@ -1357,25 +1357,25 @@ discard block |
||
| 1357 | 1357 | $node->tag_start = $begin_tag_pos; |
| 1358 | 1358 | |
| 1359 | 1359 | // doctype, cdata & comments... |
| 1360 | - if (isset($tag[0]) && $tag[0]==='!') { |
|
| 1361 | - $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>'); |
|
| 1360 | + if (isset($tag[0]) && $tag[0] === '!') { |
|
| 1361 | + $node->_[HDOM_INFO_TEXT] = '<'.$tag.$this->copy_until_char('>'); |
|
| 1362 | 1362 | |
| 1363 | - if (isset($tag[2]) && $tag[1]==='-' && $tag[2]==='-') { |
|
| 1363 | + if (isset($tag[2]) && $tag[1] === '-' && $tag[2] === '-') { |
|
| 1364 | 1364 | $node->nodetype = HDOM_TYPE_COMMENT; |
| 1365 | 1365 | $node->tag = 'comment'; |
| 1366 | 1366 | } else { |
| 1367 | 1367 | $node->nodetype = HDOM_TYPE_UNKNOWN; |
| 1368 | 1368 | $node->tag = 'unknown'; |
| 1369 | 1369 | } |
| 1370 | - if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>'; |
|
| 1370 | + if ($this->char === '>') $node->_[HDOM_INFO_TEXT] .= '>'; |
|
| 1371 | 1371 | $this->link_nodes($node, true); |
| 1372 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1372 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1373 | 1373 | return true; |
| 1374 | 1374 | } |
| 1375 | 1375 | |
| 1376 | 1376 | // text |
| 1377 | - if ($pos=strpos($tag, '<')!==false) { |
|
| 1378 | - $tag = '<' . substr($tag, 0, -1); |
|
| 1377 | + if ($pos = strpos($tag, '<') !== false) { |
|
| 1378 | + $tag = '<'.substr($tag, 0, -1); |
|
| 1379 | 1379 | $node->_[HDOM_INFO_TEXT] = $tag; |
| 1380 | 1380 | $this->link_nodes($node, false); |
| 1381 | 1381 | $this->char = $this->doc[--$this->pos]; // prev |
@@ -1383,15 +1383,15 @@ discard block |
||
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | 1385 | if (!preg_match("/^[\w-:]+$/", $tag)) { |
| 1386 | - $node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>'); |
|
| 1387 | - if ($this->char==='<') { |
|
| 1386 | + $node->_[HDOM_INFO_TEXT] = '<'.$tag.$this->copy_until('<>'); |
|
| 1387 | + if ($this->char === '<') { |
|
| 1388 | 1388 | $this->link_nodes($node, false); |
| 1389 | 1389 | return true; |
| 1390 | 1390 | } |
| 1391 | 1391 | |
| 1392 | - if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>'; |
|
| 1392 | + if ($this->char === '>') $node->_[HDOM_INFO_TEXT] .= '>'; |
|
| 1393 | 1393 | $this->link_nodes($node, false); |
| 1394 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1394 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1395 | 1395 | return true; |
| 1396 | 1396 | } |
| 1397 | 1397 | |
@@ -1401,7 +1401,7 @@ discard block |
||
| 1401 | 1401 | $node->tag = ($this->lowercase) ? $tag_lower : $tag; |
| 1402 | 1402 | |
| 1403 | 1403 | // handle optional closing tags |
| 1404 | - if (isset($this->optional_closing_tags[$tag_lower]) ) |
|
| 1404 | + if (isset($this->optional_closing_tags[$tag_lower])) |
|
| 1405 | 1405 | { |
| 1406 | 1406 | while (isset($this->optional_closing_tags[$tag_lower][strtolower($this->parent->tag)])) |
| 1407 | 1407 | { |
@@ -1417,67 +1417,67 @@ discard block |
||
| 1417 | 1417 | // attributes |
| 1418 | 1418 | do |
| 1419 | 1419 | { |
| 1420 | - if ($this->char!==null && $space[0]==='') |
|
| 1420 | + if ($this->char !== null && $space[0] === '') |
|
| 1421 | 1421 | { |
| 1422 | 1422 | break; |
| 1423 | 1423 | } |
| 1424 | 1424 | $name = $this->copy_until($this->token_equal); |
| 1425 | - if ($guard===$this->pos) |
|
| 1425 | + if ($guard === $this->pos) |
|
| 1426 | 1426 | { |
| 1427 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1427 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1428 | 1428 | continue; |
| 1429 | 1429 | } |
| 1430 | 1430 | $guard = $this->pos; |
| 1431 | 1431 | |
| 1432 | 1432 | // handle endless '<' |
| 1433 | - if ($this->pos>=$this->size-1 && $this->char!=='>') { |
|
| 1433 | + if ($this->pos >= $this->size - 1 && $this->char !== '>') { |
|
| 1434 | 1434 | $node->nodetype = HDOM_TYPE_TEXT; |
| 1435 | 1435 | $node->_[HDOM_INFO_END] = 0; |
| 1436 | - $node->_[HDOM_INFO_TEXT] = '<'.$tag . $space[0] . $name; |
|
| 1436 | + $node->_[HDOM_INFO_TEXT] = '<'.$tag.$space[0].$name; |
|
| 1437 | 1437 | $node->tag = 'text'; |
| 1438 | 1438 | $this->link_nodes($node, false); |
| 1439 | 1439 | return true; |
| 1440 | 1440 | } |
| 1441 | 1441 | |
| 1442 | 1442 | // handle mismatch '<' |
| 1443 | - if ($this->doc[$this->pos-1]=='<') { |
|
| 1443 | + if ($this->doc[$this->pos - 1] == '<') { |
|
| 1444 | 1444 | $node->nodetype = HDOM_TYPE_TEXT; |
| 1445 | 1445 | $node->tag = 'text'; |
| 1446 | 1446 | $node->attr = array(); |
| 1447 | 1447 | $node->_[HDOM_INFO_END] = 0; |
| 1448 | - $node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos-$begin_tag_pos-1); |
|
| 1448 | + $node->_[HDOM_INFO_TEXT] = substr($this->doc, $begin_tag_pos, $this->pos - $begin_tag_pos - 1); |
|
| 1449 | 1449 | $this->pos -= 2; |
| 1450 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1450 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1451 | 1451 | $this->link_nodes($node, false); |
| 1452 | 1452 | return true; |
| 1453 | 1453 | } |
| 1454 | 1454 | |
| 1455 | - if ($name!=='/' && $name!=='') { |
|
| 1455 | + if ($name !== '/' && $name !== '') { |
|
| 1456 | 1456 | $space[1] = $this->copy_skip($this->token_blank); |
| 1457 | 1457 | $name = $this->restore_noise($name); |
| 1458 | 1458 | if ($this->lowercase) $name = strtolower($name); |
| 1459 | - if ($this->char==='=') { |
|
| 1460 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1459 | + if ($this->char === '=') { |
|
| 1460 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1461 | 1461 | $this->parse_attr($node, $name, $space); |
| 1462 | 1462 | } |
| 1463 | 1463 | else { |
| 1464 | 1464 | //no value attr: nowrap, checked selected... |
| 1465 | 1465 | $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO; |
| 1466 | 1466 | $node->attr[$name] = true; |
| 1467 | - if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev |
|
| 1467 | + if ($this->char != '>') $this->char = $this->doc[--$this->pos]; // prev |
|
| 1468 | 1468 | } |
| 1469 | 1469 | $node->_[HDOM_INFO_SPACE][] = $space; |
| 1470 | 1470 | $space = array($this->copy_skip($this->token_blank), '', ''); |
| 1471 | 1471 | } |
| 1472 | 1472 | else |
| 1473 | 1473 | break; |
| 1474 | - } while ($this->char!=='>' && $this->char!=='/'); |
|
| 1474 | + } while ($this->char !== '>' && $this->char !== '/'); |
|
| 1475 | 1475 | |
| 1476 | 1476 | $this->link_nodes($node, true); |
| 1477 | 1477 | $node->_[HDOM_INFO_ENDSPACE] = $space[0]; |
| 1478 | 1478 | |
| 1479 | 1479 | // check self closing |
| 1480 | - if ($this->copy_until_char_escape('>')==='/') |
|
| 1480 | + if ($this->copy_until_char_escape('>') === '/') |
|
| 1481 | 1481 | { |
| 1482 | 1482 | $node->_[HDOM_INFO_ENDSPACE] .= '/'; |
| 1483 | 1483 | $node->_[HDOM_INFO_END] = 0; |
@@ -1487,7 +1487,7 @@ discard block |
||
| 1487 | 1487 | // reset parent |
| 1488 | 1488 | if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node; |
| 1489 | 1489 | } |
| 1490 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1490 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1491 | 1491 | |
| 1492 | 1492 | // If it's a BR tag, we need to set it's text to the default text. |
| 1493 | 1493 | // This way when we see it in plaintext, we can generate formatting that the user wants. |
@@ -1514,15 +1514,15 @@ discard block |
||
| 1514 | 1514 | switch ($this->char) { |
| 1515 | 1515 | case '"': |
| 1516 | 1516 | $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE; |
| 1517 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1517 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1518 | 1518 | $node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('"')); |
| 1519 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1519 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1520 | 1520 | break; |
| 1521 | 1521 | case '\'': |
| 1522 | 1522 | $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_SINGLE; |
| 1523 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1523 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1524 | 1524 | $node->attr[$name] = $this->restore_noise($this->copy_until_char_escape('\'')); |
| 1525 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1525 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1526 | 1526 | break; |
| 1527 | 1527 | default: |
| 1528 | 1528 | $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO; |
@@ -1553,16 +1553,16 @@ discard block |
||
| 1553 | 1553 | { |
| 1554 | 1554 | $node = new simple_html_dom_node($this); |
| 1555 | 1555 | ++$this->cursor; |
| 1556 | - $node->_[HDOM_INFO_TEXT] = '</' . $tag . '>'; |
|
| 1556 | + $node->_[HDOM_INFO_TEXT] = '</'.$tag.'>'; |
|
| 1557 | 1557 | $this->link_nodes($node, false); |
| 1558 | - $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1558 | + $this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1559 | 1559 | return true; |
| 1560 | 1560 | } |
| 1561 | 1561 | |
| 1562 | 1562 | protected function skip($chars) |
| 1563 | 1563 | { |
| 1564 | 1564 | $this->pos += strspn($this->doc, $chars, $this->pos); |
| 1565 | - $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1565 | + $this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1566 | 1566 | } |
| 1567 | 1567 | |
| 1568 | 1568 | protected function copy_skip($chars) |
@@ -1570,8 +1570,8 @@ discard block |
||
| 1570 | 1570 | $pos = $this->pos; |
| 1571 | 1571 | $len = strspn($this->doc, $chars, $pos); |
| 1572 | 1572 | $this->pos += $len; |
| 1573 | - $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1574 | - if ($len===0) return ''; |
|
| 1573 | + $this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1574 | + if ($len === 0) return ''; |
|
| 1575 | 1575 | return substr($this->doc, $pos, $len); |
| 1576 | 1576 | } |
| 1577 | 1577 | |
@@ -1580,70 +1580,70 @@ discard block |
||
| 1580 | 1580 | $pos = $this->pos; |
| 1581 | 1581 | $len = strcspn($this->doc, $chars, $pos); |
| 1582 | 1582 | $this->pos += $len; |
| 1583 | - $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1583 | + $this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next |
|
| 1584 | 1584 | return substr($this->doc, $pos, $len); |
| 1585 | 1585 | } |
| 1586 | 1586 | |
| 1587 | 1587 | protected function copy_until_char($char) |
| 1588 | 1588 | { |
| 1589 | - if ($this->char===null) return ''; |
|
| 1589 | + if ($this->char === null) return ''; |
|
| 1590 | 1590 | |
| 1591 | - if (($pos = strpos($this->doc, $char, $this->pos))===false) { |
|
| 1592 | - $ret = substr($this->doc, $this->pos, $this->size-$this->pos); |
|
| 1591 | + if (($pos = strpos($this->doc, $char, $this->pos)) === false) { |
|
| 1592 | + $ret = substr($this->doc, $this->pos, $this->size - $this->pos); |
|
| 1593 | 1593 | $this->char = null; |
| 1594 | 1594 | $this->pos = $this->size; |
| 1595 | 1595 | return $ret; |
| 1596 | 1596 | } |
| 1597 | 1597 | |
| 1598 | - if ($pos===$this->pos) return ''; |
|
| 1598 | + if ($pos === $this->pos) return ''; |
|
| 1599 | 1599 | $pos_old = $this->pos; |
| 1600 | 1600 | $this->char = $this->doc[$pos]; |
| 1601 | 1601 | $this->pos = $pos; |
| 1602 | - return substr($this->doc, $pos_old, $pos-$pos_old); |
|
| 1602 | + return substr($this->doc, $pos_old, $pos - $pos_old); |
|
| 1603 | 1603 | } |
| 1604 | 1604 | |
| 1605 | 1605 | protected function copy_until_char_escape($char) |
| 1606 | 1606 | { |
| 1607 | - if ($this->char===null) return ''; |
|
| 1607 | + if ($this->char === null) return ''; |
|
| 1608 | 1608 | |
| 1609 | 1609 | $start = $this->pos; |
| 1610 | 1610 | while (1) |
| 1611 | 1611 | { |
| 1612 | - if (($pos = strpos($this->doc, $char, $start))===false) |
|
| 1612 | + if (($pos = strpos($this->doc, $char, $start)) === false) |
|
| 1613 | 1613 | { |
| 1614 | - $ret = substr($this->doc, $this->pos, $this->size-$this->pos); |
|
| 1614 | + $ret = substr($this->doc, $this->pos, $this->size - $this->pos); |
|
| 1615 | 1615 | $this->char = null; |
| 1616 | 1616 | $this->pos = $this->size; |
| 1617 | 1617 | return $ret; |
| 1618 | 1618 | } |
| 1619 | 1619 | |
| 1620 | - if ($pos===$this->pos) return ''; |
|
| 1620 | + if ($pos === $this->pos) return ''; |
|
| 1621 | 1621 | |
| 1622 | - if ($this->doc[$pos-1]==='\\') { |
|
| 1623 | - $start = $pos+1; |
|
| 1622 | + if ($this->doc[$pos - 1] === '\\') { |
|
| 1623 | + $start = $pos + 1; |
|
| 1624 | 1624 | continue; |
| 1625 | 1625 | } |
| 1626 | 1626 | |
| 1627 | 1627 | $pos_old = $this->pos; |
| 1628 | 1628 | $this->char = $this->doc[$pos]; |
| 1629 | 1629 | $this->pos = $pos; |
| 1630 | - return substr($this->doc, $pos_old, $pos-$pos_old); |
|
| 1630 | + return substr($this->doc, $pos_old, $pos - $pos_old); |
|
| 1631 | 1631 | } |
| 1632 | 1632 | } |
| 1633 | 1633 | |
| 1634 | 1634 | // remove noise from html content |
| 1635 | 1635 | // save the noise in the $this->noise array. |
| 1636 | - protected function remove_noise($pattern, $remove_tag=false) |
|
| 1636 | + protected function remove_noise($pattern, $remove_tag = false) |
|
| 1637 | 1637 | { |
| 1638 | 1638 | global $debug_object; |
| 1639 | 1639 | if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } |
| 1640 | 1640 | |
| 1641 | 1641 | $count = preg_match_all($pattern, $this->doc, $matches, PREG_SET_ORDER|PREG_OFFSET_CAPTURE); |
| 1642 | 1642 | |
| 1643 | - for ($i=$count-1; $i>-1; --$i) |
|
| 1643 | + for ($i = $count - 1; $i > -1; --$i) |
|
| 1644 | 1644 | { |
| 1645 | - $key = '___noise___'.sprintf('% 5d', count($this->noise)+1000); |
|
| 1646 | - if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: ' . $key); } |
|
| 1645 | + $key = '___noise___'.sprintf('% 5d', count($this->noise) + 1000); |
|
| 1646 | + if (is_object($debug_object)) { $debug_object->debug_log(2, 'key is: '.$key); } |
|
| 1647 | 1647 | $idx = ($remove_tag) ? 0 : 1; |
| 1648 | 1648 | $this->noise[$key] = $matches[$i][$idx][0]; |
| 1649 | 1649 | $this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0])); |
@@ -1651,7 +1651,7 @@ discard block |
||
| 1651 | 1651 | |
| 1652 | 1652 | // reset the length of content |
| 1653 | 1653 | $this->size = strlen($this->doc); |
| 1654 | - if ($this->size>0) |
|
| 1654 | + if ($this->size > 0) |
|
| 1655 | 1655 | { |
| 1656 | 1656 | $this->char = $this->doc[0]; |
| 1657 | 1657 | } |
@@ -1663,28 +1663,28 @@ discard block |
||
| 1663 | 1663 | global $debug_object; |
| 1664 | 1664 | if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } |
| 1665 | 1665 | |
| 1666 | - while (($pos=strpos($text, '___noise___'))!==false) |
|
| 1666 | + while (($pos = strpos($text, '___noise___')) !== false) |
|
| 1667 | 1667 | { |
| 1668 | 1668 | // Sometimes there is a broken piece of markup, and we don't GET the pos+11 etc... token which indicates a problem outside of us... |
| 1669 | - if (strlen($text) > $pos+15) |
|
| 1669 | + if (strlen($text) > $pos + 15) |
|
| 1670 | 1670 | { |
| 1671 | - $key = '___noise___'.$text[$pos+11].$text[$pos+12].$text[$pos+13].$text[$pos+14].$text[$pos+15]; |
|
| 1672 | - if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: ' . $key); } |
|
| 1671 | + $key = '___noise___'.$text[$pos + 11].$text[$pos + 12].$text[$pos + 13].$text[$pos + 14].$text[$pos + 15]; |
|
| 1672 | + if (is_object($debug_object)) { $debug_object->debug_log(2, 'located key of: '.$key); } |
|
| 1673 | 1673 | |
| 1674 | 1674 | if (isset($this->noise[$key])) |
| 1675 | 1675 | { |
| 1676 | - $text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16); |
|
| 1676 | + $text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos + 16); |
|
| 1677 | 1677 | } |
| 1678 | 1678 | else |
| 1679 | 1679 | { |
| 1680 | 1680 | // do this to prevent an infinite loop. |
| 1681 | - $text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16); |
|
| 1681 | + $text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key.substr($text, $pos + 16); |
|
| 1682 | 1682 | } |
| 1683 | 1683 | } |
| 1684 | 1684 | else |
| 1685 | 1685 | { |
| 1686 | 1686 | // There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem. |
| 1687 | - $text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11); |
|
| 1687 | + $text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY'.substr($text, $pos + 11); |
|
| 1688 | 1688 | } |
| 1689 | 1689 | } |
| 1690 | 1690 | return $text; |
@@ -1696,9 +1696,9 @@ discard block |
||
| 1696 | 1696 | global $debug_object; |
| 1697 | 1697 | if (is_object($debug_object)) { $debug_object->debug_log_entry(1); } |
| 1698 | 1698 | |
| 1699 | - foreach($this->noise as $noiseElement) |
|
| 1699 | + foreach ($this->noise as $noiseElement) |
|
| 1700 | 1700 | { |
| 1701 | - if (strpos($noiseElement, $text)!==false) |
|
| 1701 | + if (strpos($noiseElement, $text) !== false) |
|
| 1702 | 1702 | { |
| 1703 | 1703 | return $noiseElement; |
| 1704 | 1704 | } |
@@ -1727,16 +1727,16 @@ discard block |
||
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | 1729 | // camel naming conventions |
| 1730 | - function childNodes($idx=-1) {return $this->root->childNodes($idx);} |
|
| 1731 | - function firstChild() {return $this->root->first_child();} |
|
| 1732 | - function lastChild() {return $this->root->last_child();} |
|
| 1733 | - function createElement($name, $value=null) {return @str_get_html("<$name>$value</$name>")->first_child();} |
|
| 1734 | - function createTextNode($value) {return @end(str_get_html($value)->nodes);} |
|
| 1735 | - function getElementById($id) {return $this->find("#$id", 0);} |
|
| 1736 | - function getElementsById($id, $idx=null) {return $this->find("#$id", $idx);} |
|
| 1737 | - function getElementByTagName($name) {return $this->find($name, 0);} |
|
| 1738 | - function getElementsByTagName($name, $idx=-1) {return $this->find($name, $idx);} |
|
| 1739 | - function loadFile() {$args = func_get_args();$this->load_file($args);} |
|
| 1730 | + function childNodes($idx = -1) {return $this->root->childNodes($idx); } |
|
| 1731 | + function firstChild() {return $this->root->first_child(); } |
|
| 1732 | + function lastChild() {return $this->root->last_child(); } |
|
| 1733 | + function createElement($name, $value = null) {return @str_get_html("<$name>$value</$name>")->first_child(); } |
|
| 1734 | + function createTextNode($value) {return @end(str_get_html($value)->nodes); } |
|
| 1735 | + function getElementById($id) {return $this->find("#$id", 0); } |
|
| 1736 | + function getElementsById($id, $idx = null) {return $this->find("#$id", $idx); } |
|
| 1737 | + function getElementByTagName($name) {return $this->find($name, 0); } |
|
| 1738 | + function getElementsByTagName($name, $idx = -1) {return $this->find($name, $idx); } |
|
| 1739 | + function loadFile() {$args = func_get_args(); $this->load_file($args); } |
|
| 1740 | 1740 | } |
| 1741 | 1741 | |
| 1742 | 1742 | ?> |
| 1743 | 1743 | \ No newline at end of file |
@@ -159,8 +159,9 @@ discard block |
||
| 159 | 159 | if ($show_attr && count($this->attr)>0) |
| 160 | 160 | { |
| 161 | 161 | echo '('; |
| 162 | - foreach ($this->attr as $k=>$v) |
|
| 163 | - echo "[$k]=>\"".$this->$k.'", '; |
|
| 162 | + foreach ($this->attr as $k=>$v) { |
|
| 163 | + echo "[$k]=>\"".$this->$k.'", '; |
|
| 164 | + } |
|
| 164 | 165 | echo ')'; |
| 165 | 166 | } |
| 166 | 167 | echo "\n"; |
@@ -218,8 +219,7 @@ discard block |
||
| 218 | 219 | if (isset($node->_[HDOM_INFO_INNER])) |
| 219 | 220 | { |
| 220 | 221 | $string .= $node->_[HDOM_INFO_INNER] . "'"; |
| 221 | - } |
|
| 222 | - else |
|
| 222 | + } else |
|
| 223 | 223 | { |
| 224 | 224 | $string .= ' NULL '; |
| 225 | 225 | } |
@@ -233,8 +233,7 @@ discard block |
||
| 233 | 233 | { |
| 234 | 234 | echo $string; |
| 235 | 235 | return; |
| 236 | - } |
|
| 237 | - else |
|
| 236 | + } else |
|
| 238 | 237 | { |
| 239 | 238 | return $string; |
| 240 | 239 | } |
@@ -320,12 +319,17 @@ discard block |
||
| 320 | 319 | // returns the previous sibling of node |
| 321 | 320 | function prev_sibling() |
| 322 | 321 | { |
| 323 | - if ($this->parent===null) return null; |
|
| 322 | + if ($this->parent===null) { |
|
| 323 | + return null; |
|
| 324 | + } |
|
| 324 | 325 | $idx = 0; |
| 325 | 326 | $count = count($this->parent->children); |
| 326 | - while ($idx<$count && $this!==$this->parent->children[$idx]) |
|
| 327 | - ++$idx; |
|
| 328 | - if (--$idx<0) return null; |
|
| 327 | + while ($idx<$count && $this!==$this->parent->children[$idx]) { |
|
| 328 | + ++$idx; |
|
| 329 | + } |
|
| 330 | + if (--$idx<0) { |
|
| 331 | + return null; |
|
| 332 | + } |
|
| 329 | 333 | return $this->parent->children[$idx]; |
| 330 | 334 | } |
| 331 | 335 | |
@@ -354,12 +358,17 @@ discard block |
||
| 354 | 358 | // get dom node's inner html |
| 355 | 359 | function innertext() |
| 356 | 360 | { |
| 357 | - if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER]; |
|
| 358 | - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
| 361 | + if (isset($this->_[HDOM_INFO_INNER])) { |
|
| 362 | + return $this->_[HDOM_INFO_INNER]; |
|
| 363 | + } |
|
| 364 | + if (isset($this->_[HDOM_INFO_TEXT])) { |
|
| 365 | + return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
| 366 | + } |
|
| 359 | 367 | |
| 360 | 368 | $ret = ''; |
| 361 | - foreach ($this->nodes as $n) |
|
| 362 | - $ret .= $n->outertext(); |
|
| 369 | + foreach ($this->nodes as $n) { |
|
| 370 | + $ret .= $n->outertext(); |
|
| 371 | + } |
|
| 363 | 372 | return $ret; |
| 364 | 373 | } |
| 365 | 374 | |
@@ -380,7 +389,9 @@ discard block |
||
| 380 | 389 | $debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text); |
| 381 | 390 | } |
| 382 | 391 | |
| 383 | - if ($this->tag==='root') return $this->innertext(); |
|
| 392 | + if ($this->tag==='root') { |
|
| 393 | + return $this->innertext(); |
|
| 394 | + } |
|
| 384 | 395 | |
| 385 | 396 | // trigger callback |
| 386 | 397 | if ($this->dom && $this->dom->callback!==null) |
@@ -388,8 +399,12 @@ discard block |
||
| 388 | 399 | call_user_func_array($this->dom->callback, array($this)); |
| 389 | 400 | } |
| 390 | 401 | |
| 391 | - if (isset($this->_[HDOM_INFO_OUTER])) return $this->_[HDOM_INFO_OUTER]; |
|
| 392 | - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
| 402 | + if (isset($this->_[HDOM_INFO_OUTER])) { |
|
| 403 | + return $this->_[HDOM_INFO_OUTER]; |
|
| 404 | + } |
|
| 405 | + if (isset($this->_[HDOM_INFO_TEXT])) { |
|
| 406 | + return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
| 407 | + } |
|
| 393 | 408 | |
| 394 | 409 | // render begin tag |
| 395 | 410 | if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]) |
@@ -418,23 +433,30 @@ discard block |
||
| 418 | 433 | } |
| 419 | 434 | |
| 420 | 435 | // render end tag |
| 421 | - if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) |
|
| 422 | - $ret .= '</'.$this->tag.'>'; |
|
| 436 | + if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END]!=0) { |
|
| 437 | + $ret .= '</'.$this->tag.'>'; |
|
| 438 | + } |
|
| 423 | 439 | return $ret; |
| 424 | 440 | } |
| 425 | 441 | |
| 426 | 442 | // get dom node's plain text |
| 427 | 443 | function text() |
| 428 | 444 | { |
| 429 | - if (isset($this->_[HDOM_INFO_INNER])) return $this->_[HDOM_INFO_INNER]; |
|
| 445 | + if (isset($this->_[HDOM_INFO_INNER])) { |
|
| 446 | + return $this->_[HDOM_INFO_INNER]; |
|
| 447 | + } |
|
| 430 | 448 | switch ($this->nodetype) |
| 431 | 449 | { |
| 432 | 450 | case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
| 433 | 451 | case HDOM_TYPE_COMMENT: return ''; |
| 434 | 452 | case HDOM_TYPE_UNKNOWN: return ''; |
| 435 | 453 | } |
| 436 | - if (strcasecmp($this->tag, 'script')===0) return ''; |
|
| 437 | - if (strcasecmp($this->tag, 'style')===0) return ''; |
|
| 454 | + if (strcasecmp($this->tag, 'script')===0) { |
|
| 455 | + return ''; |
|
| 456 | + } |
|
| 457 | + if (strcasecmp($this->tag, 'style')===0) { |
|
| 458 | + return ''; |
|
| 459 | + } |
|
| 438 | 460 | |
| 439 | 461 | $ret = ''; |
| 440 | 462 | // In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed for some span tags, and some p tags) $this->nodes is set to NULL. |
@@ -470,7 +492,9 @@ discard block |
||
| 470 | 492 | function makeup() |
| 471 | 493 | { |
| 472 | 494 | // text, comment, unknown |
| 473 | - if (isset($this->_[HDOM_INFO_TEXT])) return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
| 495 | + if (isset($this->_[HDOM_INFO_TEXT])) { |
|
| 496 | + return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]); |
|
| 497 | + } |
|
| 474 | 498 | |
| 475 | 499 | $ret = '<'.$this->tag; |
| 476 | 500 | $i = -1; |
@@ -480,14 +504,15 @@ discard block |
||
| 480 | 504 | ++$i; |
| 481 | 505 | |
| 482 | 506 | // skip removed attribute |
| 483 | - if ($val===null || $val===false) |
|
| 484 | - continue; |
|
| 507 | + if ($val===null || $val===false) { |
|
| 508 | + continue; |
|
| 509 | + } |
|
| 485 | 510 | |
| 486 | 511 | $ret .= $this->_[HDOM_INFO_SPACE][$i][0]; |
| 487 | 512 | //no value attr: nowrap, checked selected... |
| 488 | - if ($val===true) |
|
| 489 | - $ret .= $key; |
|
| 490 | - else { |
|
| 513 | + if ($val===true) { |
|
| 514 | + $ret .= $key; |
|
| 515 | + } else { |
|
| 491 | 516 | switch ($this->_[HDOM_INFO_QUOTE][$i]) |
| 492 | 517 | { |
| 493 | 518 | case HDOM_QUOTE_DOUBLE: $quote = '"'; break; |
@@ -506,7 +531,9 @@ discard block |
||
| 506 | 531 | function find($selector, $idx=null, $lowercase=false) |
| 507 | 532 | { |
| 508 | 533 | $selectors = $this->parse_selector($selector); |
| 509 | - if (($count=count($selectors))===0) return array(); |
|
| 534 | + if (($count=count($selectors))===0) { |
|
| 535 | + return array(); |
|
| 536 | + } |
|
| 510 | 537 | $found_keys = array(); |
| 511 | 538 | |
| 512 | 539 | // find each selector |
@@ -514,8 +541,12 @@ discard block |
||
| 514 | 541 | { |
| 515 | 542 | // The change on the below line was documented on the sourceforge code tracker id 2788009 |
| 516 | 543 | // used to be: if (($levle=count($selectors[0]))===0) return array(); |
| 517 | - if (($levle=count($selectors[$c]))===0) return array(); |
|
| 518 | - if (!isset($this->_[HDOM_INFO_BEGIN])) return array(); |
|
| 544 | + if (($levle=count($selectors[$c]))===0) { |
|
| 545 | + return array(); |
|
| 546 | + } |
|
| 547 | + if (!isset($this->_[HDOM_INFO_BEGIN])) { |
|
| 548 | + return array(); |
|
| 549 | + } |
|
| 519 | 550 | |
| 520 | 551 | $head = array($this->_[HDOM_INFO_BEGIN]=>1); |
| 521 | 552 | |
@@ -545,12 +576,16 @@ discard block |
||
| 545 | 576 | ksort($found_keys); |
| 546 | 577 | |
| 547 | 578 | $found = array(); |
| 548 | - foreach ($found_keys as $k=>$v) |
|
| 549 | - $found[] = $this->dom->nodes[$k]; |
|
| 579 | + foreach ($found_keys as $k=>$v) { |
|
| 580 | + $found[] = $this->dom->nodes[$k]; |
|
| 581 | + } |
|
| 550 | 582 | |
| 551 | 583 | // return nth-element or array |
| 552 | - if (is_null($idx)) return $found; |
|
| 553 | - else if ($idx<0) $idx = count($found) + $idx; |
|
| 584 | + if (is_null($idx)) { |
|
| 585 | + return $found; |
|
| 586 | + } else if ($idx<0) { |
|
| 587 | + $idx = count($found) + $idx; |
|
| 588 | + } |
|
| 554 | 589 | return (isset($found[$idx])) ? $found[$idx] : null; |
| 555 | 590 | } |
| 556 | 591 | |
@@ -595,8 +630,9 @@ discard block |
||
| 595 | 630 | $pass = true; |
| 596 | 631 | |
| 597 | 632 | if ($tag==='*' && !$key) { |
| 598 | - if (in_array($node, $this->children, true)) |
|
| 599 | - $ret[$i] = 1; |
|
| 633 | + if (in_array($node, $this->children, true)) { |
|
| 634 | + $ret[$i] = 1; |
|
| 635 | + } |
|
| 600 | 636 | continue; |
| 601 | 637 | } |
| 602 | 638 | |
@@ -605,9 +641,13 @@ discard block |
||
| 605 | 641 | // compare key |
| 606 | 642 | if ($pass && $key) { |
| 607 | 643 | if ($no_key) { |
| 608 | - if (isset($node->attr[$key])) $pass=false; |
|
| 644 | + if (isset($node->attr[$key])) { |
|
| 645 | + $pass=false; |
|
| 646 | + } |
|
| 609 | 647 | } else { |
| 610 | - if (($key != "plaintext") && !isset($node->attr[$key])) $pass=false; |
|
| 648 | + if (($key != "plaintext") && !isset($node->attr[$key])) { |
|
| 649 | + $pass=false; |
|
| 650 | + } |
|
| 611 | 651 | } |
| 612 | 652 | } |
| 613 | 653 | // compare value |
@@ -640,13 +680,19 @@ discard block |
||
| 640 | 680 | } else { |
| 641 | 681 | $check = $this->match($exp, $val, $k); |
| 642 | 682 | } |
| 643 | - if ($check) break; |
|
| 683 | + if ($check) { |
|
| 684 | + break; |
|
| 685 | + } |
|
| 644 | 686 | } |
| 645 | 687 | } |
| 646 | 688 | } |
| 647 | - if (!$check) $pass = false; |
|
| 689 | + if (!$check) { |
|
| 690 | + $pass = false; |
|
| 691 | + } |
|
| 692 | + } |
|
| 693 | + if ($pass) { |
|
| 694 | + $ret[$i] = 1; |
|
| 648 | 695 | } |
| 649 | - if ($pass) $ret[$i] = 1; |
|
| 650 | 696 | unset($node); |
| 651 | 697 | } |
| 652 | 698 | // It's passed by reference so this is actually what this function returns. |
@@ -696,9 +742,13 @@ discard block |
||
| 696 | 742 | |
| 697 | 743 | foreach ($matches as $m) { |
| 698 | 744 | $m[0] = trim($m[0]); |
| 699 | - if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') continue; |
|
| 745 | + if ($m[0]==='' || $m[0]==='/' || $m[0]==='//') { |
|
| 746 | + continue; |
|
| 747 | + } |
|
| 700 | 748 | // for browser generated xpath |
| 701 | - if ($m[1]==='tbody') continue; |
|
| 749 | + if ($m[1]==='tbody') { |
|
| 750 | + continue; |
|
| 751 | + } |
|
| 702 | 752 | |
| 703 | 753 | list($tag, $key, $val, $exp, $no_key) = array($m[1], null, null, '=', false); |
| 704 | 754 | if (!empty($m[2])) {$key='id'; $val=$m[2];} |
@@ -718,8 +768,9 @@ discard block |
||
| 718 | 768 | $result = array(); |
| 719 | 769 | } |
| 720 | 770 | } |
| 721 | - if (count($result)>0) |
|
| 722 | - $selectors[] = $result; |
|
| 771 | + if (count($result)>0) { |
|
| 772 | + $selectors[] = $result; |
|
| 773 | + } |
|
| 723 | 774 | return $selectors; |
| 724 | 775 | } |
| 725 | 776 | |
@@ -748,7 +799,9 @@ discard block |
||
| 748 | 799 | { |
| 749 | 800 | case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value; |
| 750 | 801 | case 'innertext': |
| 751 | - if (isset($this->_[HDOM_INFO_TEXT])) return $this->_[HDOM_INFO_TEXT] = $value; |
|
| 802 | + if (isset($this->_[HDOM_INFO_TEXT])) { |
|
| 803 | + return $this->_[HDOM_INFO_TEXT] = $value; |
|
| 804 | + } |
|
| 752 | 805 | return $this->_[HDOM_INFO_INNER] = $value; |
| 753 | 806 | } |
| 754 | 807 | if (!isset($this->attr[$name])) |
@@ -772,8 +825,9 @@ discard block |
||
| 772 | 825 | } |
| 773 | 826 | |
| 774 | 827 | function __unset($name) { |
| 775 | - if (isset($this->attr[$name])) |
|
| 776 | - unset($this->attr[$name]); |
|
| 828 | + if (isset($this->attr[$name])) { |
|
| 829 | + unset($this->attr[$name]); |
|
| 830 | + } |
|
| 777 | 831 | } |
| 778 | 832 | |
| 779 | 833 | // PaperG - Function to convert the text from one character set to another if the two sets are not the same. |
@@ -800,8 +854,7 @@ discard block |
||
| 800 | 854 | if ((strcasecmp($targetCharset, 'UTF-8') == 0) && ($this->is_utf8($text))) |
| 801 | 855 | { |
| 802 | 856 | $converted_text = $text; |
| 803 | - } |
|
| 804 | - else |
|
| 857 | + } else |
|
| 805 | 858 | { |
| 806 | 859 | $converted_text = iconv($sourceCharset, $targetCharset, $text); |
| 807 | 860 | } |
@@ -839,19 +892,31 @@ discard block |
||
| 839 | 892 | $c=ord($str[$i]); |
| 840 | 893 | if($c > 128) |
| 841 | 894 | { |
| 842 | - if(($c >= 254)) return false; |
|
| 843 | - elseif($c >= 252) $bits=6; |
|
| 844 | - elseif($c >= 248) $bits=5; |
|
| 845 | - elseif($c >= 240) $bits=4; |
|
| 846 | - elseif($c >= 224) $bits=3; |
|
| 847 | - elseif($c >= 192) $bits=2; |
|
| 848 | - else return false; |
|
| 849 | - if(($i+$bits) > $len) return false; |
|
| 895 | + if(($c >= 254)) { |
|
| 896 | + return false; |
|
| 897 | + } elseif($c >= 252) { |
|
| 898 | + $bits=6; |
|
| 899 | + } elseif($c >= 248) { |
|
| 900 | + $bits=5; |
|
| 901 | + } elseif($c >= 240) { |
|
| 902 | + $bits=4; |
|
| 903 | + } elseif($c >= 224) { |
|
| 904 | + $bits=3; |
|
| 905 | + } elseif($c >= 192) { |
|
| 906 | + $bits=2; |
|
| 907 | + } else { |
|
| 908 | + return false; |
|
| 909 | + } |
|
| 910 | + if(($i+$bits) > $len) { |
|
| 911 | + return false; |
|
| 912 | + } |
|
| 850 | 913 | while($bits > 1) |
| 851 | 914 | { |
| 852 | 915 | $i++; |
| 853 | 916 | $b=ord($str[$i]); |
| 854 | - if($b < 128 || $b > 191) return false; |
|
| 917 | + if($b < 128 || $b > 191) { |
|
| 918 | + return false; |
|
| 919 | + } |
|
| 855 | 920 | $bits--; |
| 856 | 921 | } |
| 857 | 922 | } |
@@ -1035,8 +1100,7 @@ discard block |
||
| 1035 | 1100 | if (preg_match("/^http:\/\//i",$str) || is_file($str)) |
| 1036 | 1101 | { |
| 1037 | 1102 | $this->load_file($str); |
| 1038 | - } |
|
| 1039 | - else |
|
| 1103 | + } else |
|
| 1040 | 1104 | { |
| 1041 | 1105 | $this->load($str, $lowercase, $stripRN, $defaultBRText, $defaultSpanText); |
| 1042 | 1106 | } |
@@ -1118,7 +1182,9 @@ discard block |
||
| 1118 | 1182 | function save($filepath='') |
| 1119 | 1183 | { |
| 1120 | 1184 | $ret = $this->root->innertext(); |
| 1121 | - if ($filepath!=='') file_put_contents($filepath, $ret, LOCK_EX); |
|
| 1185 | + if ($filepath!=='') { |
|
| 1186 | + file_put_contents($filepath, $ret, LOCK_EX); |
|
| 1187 | + } |
|
| 1122 | 1188 | return $ret; |
| 1123 | 1189 | } |
| 1124 | 1190 | |
@@ -1134,7 +1200,10 @@ discard block |
||
| 1134 | 1200 | { |
| 1135 | 1201 | foreach ($this->nodes as $n) {$n->clear(); $n = null;} |
| 1136 | 1202 | // This add next line is documented in the sourceforge repository. 2977248 as a fix for ongoing memory leaks that occur even with the use of clear. |
| 1137 | - if (isset($this->children)) foreach ($this->children as $n) {$n->clear(); $n = null;} |
|
| 1203 | + if (isset($this->children)) { |
|
| 1204 | + foreach ($this->children as $n) {$n->clear(); |
|
| 1205 | + } |
|
| 1206 | + $n = null;} |
|
| 1138 | 1207 | if (isset($this->parent)) {$this->parent->clear(); unset($this->parent);} |
| 1139 | 1208 | if (isset($this->root)) {$this->root->clear(); unset($this->root);} |
| 1140 | 1209 | unset($this->doc); |
@@ -1178,7 +1247,9 @@ discard block |
||
| 1178 | 1247 | $this->root->_[HDOM_INFO_BEGIN] = -1; |
| 1179 | 1248 | $this->root->nodetype = HDOM_TYPE_ROOT; |
| 1180 | 1249 | $this->parent = $this->root; |
| 1181 | - if ($this->size>0) $this->char = $this->doc[0]; |
|
| 1250 | + if ($this->size>0) { |
|
| 1251 | + $this->char = $this->doc[0]; |
|
| 1252 | + } |
|
| 1182 | 1253 | } |
| 1183 | 1254 | |
| 1184 | 1255 | // parse html content |
@@ -1232,8 +1303,7 @@ discard block |
||
| 1232 | 1303 | if ($success) |
| 1233 | 1304 | { |
| 1234 | 1305 | $charset = $matches[1]; |
| 1235 | - } |
|
| 1236 | - else |
|
| 1306 | + } else |
|
| 1237 | 1307 | { |
| 1238 | 1308 | // If there is a meta tag, and they don't specify the character set, research says that it's typically ISO-8859-1 |
| 1239 | 1309 | if (is_object($debug_object)) {$debug_object->debug_log(2, 'meta content-type tag couldn\'t be parsed. using iso-8859 default.');} |
@@ -1296,8 +1366,9 @@ discard block |
||
| 1296 | 1366 | $tag = $this->copy_until_char('>'); |
| 1297 | 1367 | |
| 1298 | 1368 | // skip attributes in end tag |
| 1299 | - if (($pos = strpos($tag, ' '))!==false) |
|
| 1300 | - $tag = substr($tag, 0, $pos); |
|
| 1369 | + if (($pos = strpos($tag, ' '))!==false) { |
|
| 1370 | + $tag = substr($tag, 0, $pos); |
|
| 1371 | + } |
|
| 1301 | 1372 | |
| 1302 | 1373 | $parent_lower = strtolower($this->parent->tag); |
| 1303 | 1374 | $tag_lower = strtolower($tag); |
@@ -1309,23 +1380,26 @@ discard block |
||
| 1309 | 1380 | $this->parent->_[HDOM_INFO_END] = 0; |
| 1310 | 1381 | $org_parent = $this->parent; |
| 1311 | 1382 | |
| 1312 | - while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) |
|
| 1313 | - $this->parent = $this->parent->parent; |
|
| 1383 | + while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) { |
|
| 1384 | + $this->parent = $this->parent->parent; |
|
| 1385 | + } |
|
| 1314 | 1386 | |
| 1315 | 1387 | if (strtolower($this->parent->tag)!==$tag_lower) { |
| 1316 | 1388 | $this->parent = $org_parent; // restore origonal parent |
| 1317 | - if ($this->parent->parent) $this->parent = $this->parent->parent; |
|
| 1389 | + if ($this->parent->parent) { |
|
| 1390 | + $this->parent = $this->parent->parent; |
|
| 1391 | + } |
|
| 1318 | 1392 | $this->parent->_[HDOM_INFO_END] = $this->cursor; |
| 1319 | 1393 | return $this->as_text_node($tag); |
| 1320 | 1394 | } |
| 1321 | - } |
|
| 1322 | - else if (($this->parent->parent) && isset($this->block_tags[$tag_lower])) |
|
| 1395 | + } else if (($this->parent->parent) && isset($this->block_tags[$tag_lower])) |
|
| 1323 | 1396 | { |
| 1324 | 1397 | $this->parent->_[HDOM_INFO_END] = 0; |
| 1325 | 1398 | $org_parent = $this->parent; |
| 1326 | 1399 | |
| 1327 | - while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) |
|
| 1328 | - $this->parent = $this->parent->parent; |
|
| 1400 | + while (($this->parent->parent) && strtolower($this->parent->tag)!==$tag_lower) { |
|
| 1401 | + $this->parent = $this->parent->parent; |
|
| 1402 | + } |
|
| 1329 | 1403 | |
| 1330 | 1404 | if (strtolower($this->parent->tag)!==$tag_lower) |
| 1331 | 1405 | { |
@@ -1333,18 +1407,19 @@ discard block |
||
| 1333 | 1407 | $this->parent->_[HDOM_INFO_END] = $this->cursor; |
| 1334 | 1408 | return $this->as_text_node($tag); |
| 1335 | 1409 | } |
| 1336 | - } |
|
| 1337 | - else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower) |
|
| 1410 | + } else if (($this->parent->parent) && strtolower($this->parent->parent->tag)===$tag_lower) |
|
| 1338 | 1411 | { |
| 1339 | 1412 | $this->parent->_[HDOM_INFO_END] = 0; |
| 1340 | 1413 | $this->parent = $this->parent->parent; |
| 1414 | + } else { |
|
| 1415 | + return $this->as_text_node($tag); |
|
| 1341 | 1416 | } |
| 1342 | - else |
|
| 1343 | - return $this->as_text_node($tag); |
|
| 1344 | 1417 | } |
| 1345 | 1418 | |
| 1346 | 1419 | $this->parent->_[HDOM_INFO_END] = $this->cursor; |
| 1347 | - if ($this->parent->parent) $this->parent = $this->parent->parent; |
|
| 1420 | + if ($this->parent->parent) { |
|
| 1421 | + $this->parent = $this->parent->parent; |
|
| 1422 | + } |
|
| 1348 | 1423 | |
| 1349 | 1424 | $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
| 1350 | 1425 | return true; |
@@ -1367,7 +1442,9 @@ discard block |
||
| 1367 | 1442 | $node->nodetype = HDOM_TYPE_UNKNOWN; |
| 1368 | 1443 | $node->tag = 'unknown'; |
| 1369 | 1444 | } |
| 1370 | - if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>'; |
|
| 1445 | + if ($this->char==='>') { |
|
| 1446 | + $node->_[HDOM_INFO_TEXT].='>'; |
|
| 1447 | + } |
|
| 1371 | 1448 | $this->link_nodes($node, true); |
| 1372 | 1449 | $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
| 1373 | 1450 | return true; |
@@ -1389,7 +1466,9 @@ discard block |
||
| 1389 | 1466 | return true; |
| 1390 | 1467 | } |
| 1391 | 1468 | |
| 1392 | - if ($this->char==='>') $node->_[HDOM_INFO_TEXT].='>'; |
|
| 1469 | + if ($this->char==='>') { |
|
| 1470 | + $node->_[HDOM_INFO_TEXT].='>'; |
|
| 1471 | + } |
|
| 1393 | 1472 | $this->link_nodes($node, false); |
| 1394 | 1473 | $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
| 1395 | 1474 | return true; |
@@ -1455,22 +1534,26 @@ discard block |
||
| 1455 | 1534 | if ($name!=='/' && $name!=='') { |
| 1456 | 1535 | $space[1] = $this->copy_skip($this->token_blank); |
| 1457 | 1536 | $name = $this->restore_noise($name); |
| 1458 | - if ($this->lowercase) $name = strtolower($name); |
|
| 1537 | + if ($this->lowercase) { |
|
| 1538 | + $name = strtolower($name); |
|
| 1539 | + } |
|
| 1459 | 1540 | if ($this->char==='=') { |
| 1460 | 1541 | $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
| 1461 | 1542 | $this->parse_attr($node, $name, $space); |
| 1462 | - } |
|
| 1463 | - else { |
|
| 1543 | + } else { |
|
| 1464 | 1544 | //no value attr: nowrap, checked selected... |
| 1465 | 1545 | $node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO; |
| 1466 | 1546 | $node->attr[$name] = true; |
| 1467 | - if ($this->char!='>') $this->char = $this->doc[--$this->pos]; // prev |
|
| 1547 | + if ($this->char!='>') { |
|
| 1548 | + $this->char = $this->doc[--$this->pos]; |
|
| 1549 | + } |
|
| 1550 | + // prev |
|
| 1468 | 1551 | } |
| 1469 | 1552 | $node->_[HDOM_INFO_SPACE][] = $space; |
| 1470 | 1553 | $space = array($this->copy_skip($this->token_blank), '', ''); |
| 1554 | + } else { |
|
| 1555 | + break; |
|
| 1471 | 1556 | } |
| 1472 | - else |
|
| 1473 | - break; |
|
| 1474 | 1557 | } while ($this->char!=='>' && $this->char!=='/'); |
| 1475 | 1558 | |
| 1476 | 1559 | $this->link_nodes($node, true); |
@@ -1481,11 +1564,12 @@ discard block |
||
| 1481 | 1564 | { |
| 1482 | 1565 | $node->_[HDOM_INFO_ENDSPACE] .= '/'; |
| 1483 | 1566 | $node->_[HDOM_INFO_END] = 0; |
| 1484 | - } |
|
| 1485 | - else |
|
| 1567 | + } else |
|
| 1486 | 1568 | { |
| 1487 | 1569 | // reset parent |
| 1488 | - if (!isset($this->self_closing_tags[strtolower($node->tag)])) $this->parent = $node; |
|
| 1570 | + if (!isset($this->self_closing_tags[strtolower($node->tag)])) { |
|
| 1571 | + $this->parent = $node; |
|
| 1572 | + } |
|
| 1489 | 1573 | } |
| 1490 | 1574 | $this->char = (++$this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
| 1491 | 1575 | |
@@ -1571,7 +1655,9 @@ discard block |
||
| 1571 | 1655 | $len = strspn($this->doc, $chars, $pos); |
| 1572 | 1656 | $this->pos += $len; |
| 1573 | 1657 | $this->char = ($this->pos<$this->size) ? $this->doc[$this->pos] : null; // next |
| 1574 | - if ($len===0) return ''; |
|
| 1658 | + if ($len===0) { |
|
| 1659 | + return ''; |
|
| 1660 | + } |
|
| 1575 | 1661 | return substr($this->doc, $pos, $len); |
| 1576 | 1662 | } |
| 1577 | 1663 | |
@@ -1586,7 +1672,9 @@ discard block |
||
| 1586 | 1672 | |
| 1587 | 1673 | protected function copy_until_char($char) |
| 1588 | 1674 | { |
| 1589 | - if ($this->char===null) return ''; |
|
| 1675 | + if ($this->char===null) { |
|
| 1676 | + return ''; |
|
| 1677 | + } |
|
| 1590 | 1678 | |
| 1591 | 1679 | if (($pos = strpos($this->doc, $char, $this->pos))===false) { |
| 1592 | 1680 | $ret = substr($this->doc, $this->pos, $this->size-$this->pos); |
@@ -1595,7 +1683,9 @@ discard block |
||
| 1595 | 1683 | return $ret; |
| 1596 | 1684 | } |
| 1597 | 1685 | |
| 1598 | - if ($pos===$this->pos) return ''; |
|
| 1686 | + if ($pos===$this->pos) { |
|
| 1687 | + return ''; |
|
| 1688 | + } |
|
| 1599 | 1689 | $pos_old = $this->pos; |
| 1600 | 1690 | $this->char = $this->doc[$pos]; |
| 1601 | 1691 | $this->pos = $pos; |
@@ -1604,7 +1694,9 @@ discard block |
||
| 1604 | 1694 | |
| 1605 | 1695 | protected function copy_until_char_escape($char) |
| 1606 | 1696 | { |
| 1607 | - if ($this->char===null) return ''; |
|
| 1697 | + if ($this->char===null) { |
|
| 1698 | + return ''; |
|
| 1699 | + } |
|
| 1608 | 1700 | |
| 1609 | 1701 | $start = $this->pos; |
| 1610 | 1702 | while (1) |
@@ -1617,7 +1709,9 @@ discard block |
||
| 1617 | 1709 | return $ret; |
| 1618 | 1710 | } |
| 1619 | 1711 | |
| 1620 | - if ($pos===$this->pos) return ''; |
|
| 1712 | + if ($pos===$this->pos) { |
|
| 1713 | + return ''; |
|
| 1714 | + } |
|
| 1621 | 1715 | |
| 1622 | 1716 | if ($this->doc[$pos-1]==='\\') { |
| 1623 | 1717 | $start = $pos+1; |
@@ -1674,14 +1768,12 @@ discard block |
||
| 1674 | 1768 | if (isset($this->noise[$key])) |
| 1675 | 1769 | { |
| 1676 | 1770 | $text = substr($text, 0, $pos).$this->noise[$key].substr($text, $pos+16); |
| 1677 | - } |
|
| 1678 | - else |
|
| 1771 | + } else |
|
| 1679 | 1772 | { |
| 1680 | 1773 | // do this to prevent an infinite loop. |
| 1681 | 1774 | $text = substr($text, 0, $pos).'UNDEFINED NOISE FOR KEY: '.$key . substr($text, $pos+16); |
| 1682 | 1775 | } |
| 1683 | - } |
|
| 1684 | - else |
|
| 1776 | + } else |
|
| 1685 | 1777 | { |
| 1686 | 1778 | // There is no valid key being given back to us... We must get rid of the ___noise___ or we will have a problem. |
| 1687 | 1779 | $text = substr($text, 0, $pos).'NO NUMERIC NOISE KEY' . substr($text, $pos+11); |
@@ -3,13 +3,13 @@ discard block |
||
| 3 | 3 | require_once('require/class.Spotter.php'); |
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
| 8 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
| 6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
| 8 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
| 9 | 9 | |
| 10 | 10 | if (!empty($spotter_array)) |
| 11 | 11 | { |
| 12 | - $title = sprintf(_("Most Common Aircraft Manufacturer on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 12 | + $title = sprintf(_("Most Common Aircraft Manufacturer on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
| 13 | 13 | |
| 14 | 14 | require_once('header.php'); |
| 15 | 15 | print '<div class="select-item">'; |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>'; |
| 28 | 28 | print '<br />'; |
| 29 | 29 | print '<div class="info column">'; |
| 30 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 30 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 31 | 31 | print '</div>'; |
| 32 | 32 | |
| 33 | 33 | include('date-sub-menu.php'); |
| 34 | 34 | print '<div class="column">'; |
| 35 | 35 | print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>'; |
| 36 | - print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 36 | + print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 37 | 37 | |
| 38 | 38 | $manufacturers_array = $Spotter->countAllAircraftManufacturerByDate($date); |
| 39 | 39 | if (!empty($manufacturers_array)) |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | print '</thead>'; |
| 49 | 49 | print '<tbody>'; |
| 50 | 50 | $i = 1; |
| 51 | - foreach($manufacturers_array as $manufacturer_item) |
|
| 51 | + foreach ($manufacturers_array as $manufacturer_item) |
|
| 52 | 52 | { |
| 53 | 53 | print '<tr>'; |
| 54 | 54 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | require_once('require/class.Spotter.php'); |
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
| 8 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
| 6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
| 8 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
| 9 | 9 | |
| 10 | 10 | if (!empty($spotter_array)) |
| 11 | 11 | { |
@@ -27,13 +27,13 @@ discard block |
||
| 27 | 27 | print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>'; |
| 28 | 28 | print '<br />'; |
| 29 | 29 | print '<div class="info column">'; |
| 30 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 30 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
| 31 | 31 | print '</div>'; |
| 32 | 32 | |
| 33 | 33 | include('date-sub-menu.php'); |
| 34 | 34 | print '<div class="column">'; |
| 35 | 35 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
| 36 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 36 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
| 37 | 37 | |
| 38 | 38 | $aircraft_array = $Spotter->countAllAircraftRegistrationByDate($date); |
| 39 | 39 | if (!empty($aircraft_array)) |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | print '</thead>'; |
| 51 | 51 | print '<tbody>'; |
| 52 | 52 | $i = 1; |
| 53 | - foreach($aircraft_array as $aircraft_item) |
|
| 53 | + foreach ($aircraft_array as $aircraft_item) |
|
| 54 | 54 | { |
| 55 | 55 | print '<tr>'; |
| 56 | 56 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | if (isset($aircraft_item['aircraft_type'])) { |
| 61 | 61 | print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_type'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:").' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>'; |
| 62 | 62 | } else { |
| 63 | - print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:");' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>'; |
|
| 63 | + print '<a href="'.$globalURL.'/registration/'.$aircraft_item['registration'].'"><img src="'.$aircraft_item['image_thumbnail'].'" class="img-rounded" data-toggle="popover" title="'.$aircraft_item['registration'].' - '.$aircraft_item['aircraft_icao'].' - '.$aircraft_item['airline_name'].'" alt="'.$aircraft_item['registration'].' - '.$aircraft_item['airline_name'].'" data-content="'._("Registration:").' '.$aircraft_item['registration'].'<br />'._("Aircraft:").' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')<br />'._("Airline:"); ' '.$aircraft_item['airline_name'].'" data-html="true" width="100px" /></a>'; |
|
| 64 | 64 | } |
| 65 | 65 | print '</td>'; |
| 66 | 66 | } else { |
@@ -4,8 +4,8 @@ |
||
| 4 | 4 | require_once('require/class.Stats.php'); |
| 5 | 5 | require_once('require/class.Language.php'); |
| 6 | 6 | if (!isset($_GET['airline'])) { |
| 7 | - header('Location: '.$globalURL.'/airline'); |
|
| 8 | - die(); |
|
| 7 | + header('Location: '.$globalURL.'/airline'); |
|
| 8 | + die(); |
|
| 9 | 9 | } |
| 10 | 10 | $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 11 | 11 | $Spotter = new Spotter(); |
@@ -7,13 +7,13 @@ discard block |
||
| 7 | 7 | header('Location: '.$globalURL.'/airline'); |
| 8 | 8 | die(); |
| 9 | 9 | } |
| 10 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 10 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | -$spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1",""); |
|
| 12 | +$spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", ""); |
|
| 13 | 13 | |
| 14 | 14 | if (!empty($spotter_array)) |
| 15 | 15 | { |
| 16 | - $title = sprintf(_("Most Common Aircraft Manufacturer from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
| 16 | + $title = sprintf(_("Most Common Aircraft Manufacturer from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
| 17 | 17 | require_once('header.php'); |
| 18 | 18 | print '<div class="select-item">'; |
| 19 | 19 | print '<form action="'.$globalURL.'/airline" method="post">'; |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | $Stats = new Stats(); |
| 23 | 23 | $airline_names = $Stats->getAllAirlineNames(); |
| 24 | 24 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
| 25 | - foreach($airline_names as $airline_name) |
|
| 25 | + foreach ($airline_names as $airline_name) |
|
| 26 | 26 | { |
| 27 | - if($airline == $airline_name['airline_icao']) |
|
| 27 | + if ($airline == $airline_name['airline_icao']) |
|
| 28 | 28 | { |
| 29 | 29 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
| 30 | 30 | } else { |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | include('airline-sub-menu.php'); |
| 63 | 63 | print '<div class="column">'; |
| 64 | 64 | print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>'; |
| 65 | - print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
| 65 | + print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
| 66 | 66 | |
| 67 | 67 | $manufacturers_array = $Spotter->countAllAircraftManufacturerByAirline($airline); |
| 68 | 68 | if (!empty($manufacturers_array)) |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | print '</thead>'; |
| 78 | 78 | print '<tbody>'; |
| 79 | 79 | $i = 1; |
| 80 | - foreach($manufacturers_array as $manufacturer_item) |
|
| 80 | + foreach ($manufacturers_array as $manufacturer_item) |
|
| 81 | 81 | { |
| 82 | 82 | print '<tr>'; |
| 83 | 83 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -21,7 +21,9 @@ discard block |
||
| 21 | 21 | print '<option></option>'; |
| 22 | 22 | $Stats = new Stats(); |
| 23 | 23 | $airline_names = $Stats->getAllAirlineNames(); |
| 24 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
| 24 | + if (empty($airline_names)) { |
|
| 25 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
| 26 | + } |
|
| 25 | 27 | foreach($airline_names as $airline_name) |
| 26 | 28 | { |
| 27 | 29 | if($airline == $airline_name['airline_icao']) |
@@ -43,8 +45,7 @@ discard block |
||
| 43 | 45 | if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif')) |
| 44 | 46 | { |
| 45 | 47 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
| 46 | - } |
|
| 47 | - elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
| 48 | + } elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
| 48 | 49 | { |
| 49 | 50 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
| 50 | 51 | } |