@@ -4,55 +4,55 @@ |
||
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | 6 | if (isset($_GET['start_date'])) { |
| 7 | - //for the date manipulation into the query |
|
| 8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 9 | - $start_date = $_GET['start_date'].":00"; |
|
| 10 | - $end_date = $_GET['end_date'].":00"; |
|
| 11 | - $sql_date = $start_date.",".$end_date; |
|
| 12 | - } else if($_GET['start_date'] != ""){ |
|
| 13 | - $start_date = $_GET['start_date'].":00"; |
|
| 14 | - $sql_date = $start_date; |
|
| 15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 16 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
|
| 17 | - $sql_date = $end_date; |
|
| 18 | - } else $sql_date = ''; |
|
| 7 | + //for the date manipulation into the query |
|
| 8 | + if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 9 | + $start_date = $_GET['start_date'].":00"; |
|
| 10 | + $end_date = $_GET['end_date'].":00"; |
|
| 11 | + $sql_date = $start_date.",".$end_date; |
|
| 12 | + } else if($_GET['start_date'] != ""){ |
|
| 13 | + $start_date = $_GET['start_date'].":00"; |
|
| 14 | + $sql_date = $start_date; |
|
| 15 | + } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 16 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
|
| 17 | + $sql_date = $end_date; |
|
| 18 | + } else $sql_date = ''; |
|
| 19 | 19 | } else $sql_date = ''; |
| 20 | 20 | |
| 21 | 21 | if (isset($_GET['highest_altitude'])) { |
| 22 | - //for altitude manipulation |
|
| 23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 24 | - $end_altitude = $_GET['highest_altitude']; |
|
| 25 | - $start_altitude = $_GET['lowest_altitude']; |
|
| 26 | - $sql_altitude = $start_altitude.",".$end_altitude; |
|
| 27 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 28 | - $end_altitude = $_GET['highest_altitude']; |
|
| 29 | - $sql_altitude = $end_altitude; |
|
| 30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 31 | - $start_altitude = $_GET['lowest_altitude'].",60000"; |
|
| 32 | - $sql_altitude = $start_altitude; |
|
| 33 | - } else $sql_altitude = ''; |
|
| 22 | + //for altitude manipulation |
|
| 23 | + if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 24 | + $end_altitude = $_GET['highest_altitude']; |
|
| 25 | + $start_altitude = $_GET['lowest_altitude']; |
|
| 26 | + $sql_altitude = $start_altitude.",".$end_altitude; |
|
| 27 | + } else if($_GET['highest_altitude'] != ""){ |
|
| 28 | + $end_altitude = $_GET['highest_altitude']; |
|
| 29 | + $sql_altitude = $end_altitude; |
|
| 30 | + } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 31 | + $start_altitude = $_GET['lowest_altitude'].",60000"; |
|
| 32 | + $sql_altitude = $start_altitude; |
|
| 33 | + } else $sql_altitude = ''; |
|
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | |
| 36 | 36 | //calculuation for the pagination |
| 37 | 37 | if(!isset($_GET['limit'])) |
| 38 | 38 | { |
| 39 | - if (!isset($_GET['number_results'])) |
|
| 40 | - { |
|
| 41 | - $limit_start = 0; |
|
| 42 | - $limit_end = 25; |
|
| 43 | - $absolute_difference = 25; |
|
| 44 | - } else { |
|
| 45 | - if ($_GET['number_results'] > 1000){ |
|
| 46 | - $_GET['number_results'] = 1000; |
|
| 47 | - } |
|
| 48 | - $limit_start = 0; |
|
| 49 | - $limit_end = $_GET['number_results']; |
|
| 50 | - $absolute_difference = $_GET['number_results']; |
|
| 51 | - } |
|
| 39 | + if (!isset($_GET['number_results'])) |
|
| 40 | + { |
|
| 41 | + $limit_start = 0; |
|
| 42 | + $limit_end = 25; |
|
| 43 | + $absolute_difference = 25; |
|
| 44 | + } else { |
|
| 45 | + if ($_GET['number_results'] > 1000){ |
|
| 46 | + $_GET['number_results'] = 1000; |
|
| 47 | + } |
|
| 48 | + $limit_start = 0; |
|
| 49 | + $limit_end = $_GET['number_results']; |
|
| 50 | + $absolute_difference = $_GET['number_results']; |
|
| 51 | + } |
|
| 52 | 52 | } else { |
| 53 | - $limit_explode = explode(",", $_GET['limit']); |
|
| 54 | - $limit_start = $limit_explode[0]; |
|
| 55 | - $limit_end = $limit_explode[1]; |
|
| 53 | + $limit_explode = explode(",", $_GET['limit']); |
|
| 54 | + $limit_start = $limit_explode[0]; |
|
| 55 | + $limit_end = $limit_explode[1]; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -5,14 +5,14 @@ discard block |
||
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | 6 | if (isset($_GET['start_date'])) { |
| 7 | 7 | //for the date manipulation into the query |
| 8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 9 | 9 | $start_date = $_GET['start_date'].":00"; |
| 10 | 10 | $end_date = $_GET['end_date'].":00"; |
| 11 | 11 | $sql_date = $start_date.",".$end_date; |
| 12 | - } else if($_GET['start_date'] != ""){ |
|
| 12 | + } else if ($_GET['start_date'] != "") { |
|
| 13 | 13 | $start_date = $_GET['start_date'].":00"; |
| 14 | 14 | $sql_date = $start_date; |
| 15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | 18 | } else $sql_date = ''; |
@@ -20,21 +20,21 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | if (isset($_GET['highest_altitude'])) { |
| 22 | 22 | //for altitude manipulation |
| 23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 24 | 24 | $end_altitude = $_GET['highest_altitude']; |
| 25 | 25 | $start_altitude = $_GET['lowest_altitude']; |
| 26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 27 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 27 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 28 | 28 | $end_altitude = $_GET['highest_altitude']; |
| 29 | 29 | $sql_altitude = $end_altitude; |
| 30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 31 | 31 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
| 32 | 32 | $sql_altitude = $start_altitude; |
| 33 | 33 | } else $sql_altitude = ''; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | |
| 36 | 36 | //calculuation for the pagination |
| 37 | -if(!isset($_GET['limit'])) |
|
| 37 | +if (!isset($_GET['limit'])) |
|
| 38 | 38 | { |
| 39 | 39 | if (!isset($_GET['number_results'])) |
| 40 | 40 | { |
@@ -42,14 +42,14 @@ discard block |
||
| 42 | 42 | $limit_end = 25; |
| 43 | 43 | $absolute_difference = 25; |
| 44 | 44 | } else { |
| 45 | - if ($_GET['number_results'] > 1000){ |
|
| 45 | + if ($_GET['number_results'] > 1000) { |
|
| 46 | 46 | $_GET['number_results'] = 1000; |
| 47 | 47 | } |
| 48 | 48 | $limit_start = 0; |
| 49 | 49 | $limit_end = $_GET['number_results']; |
| 50 | 50 | $absolute_difference = $_GET['number_results']; |
| 51 | 51 | } |
| 52 | -} else { |
|
| 52 | +} else { |
|
| 53 | 53 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | 54 | $limit_start = $limit_explode[0]; |
| 55 | 55 | $limit_end = $limit_explode[1]; |
@@ -69,30 +69,30 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 71 | 71 | else $sort = ''; |
| 72 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 73 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 74 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 75 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 76 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 77 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 78 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 79 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 80 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 81 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 82 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 83 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 84 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 85 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 86 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 87 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 88 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 72 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 73 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 74 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 75 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 76 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 77 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 78 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 79 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 80 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 81 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 82 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 83 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 84 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 85 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 86 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 87 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 88 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 89 | 89 | |
| 90 | 90 | $i = 1; |
| 91 | 91 | //$output .= "oid;Line\n"; |
| 92 | 92 | $output = ''; |
| 93 | 93 | if (!empty($spotter_array)) |
| 94 | 94 | { |
| 95 | - foreach($spotter_array as $spotter_item) |
|
| 95 | + foreach ($spotter_array as $spotter_item) |
|
| 96 | 96 | { |
| 97 | 97 | if ($spotter_item['waypoints'] != '') { |
| 98 | 98 | $waypoint_pieces = explode(' ', $spotter_item['waypoints']); |
@@ -15,8 +15,12 @@ discard block |
||
| 15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | - } else $sql_date = ''; |
|
| 19 | -} else $sql_date = ''; |
|
| 18 | + } else { |
|
| 19 | + $sql_date = ''; |
|
| 20 | + } |
|
| 21 | + } else { |
|
| 22 | + $sql_date = ''; |
|
| 23 | +} |
|
| 20 | 24 | |
| 21 | 25 | if (isset($_GET['highest_altitude'])) { |
| 22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
| 30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 31 | 35 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
| 32 | 36 | $sql_altitude = $start_altitude; |
| 33 | - } else $sql_altitude = ''; |
|
| 34 | -} else $sql_altitude = ''; |
|
| 37 | + } else { |
|
| 38 | + $sql_altitude = ''; |
|
| 39 | + } |
|
| 40 | + } else { |
|
| 41 | + $sql_altitude = ''; |
|
| 42 | +} |
|
| 35 | 43 | |
| 36 | 44 | //calculuation for the pagination |
| 37 | 45 | if(!isset($_GET['limit'])) |
@@ -49,7 +57,7 @@ discard block |
||
| 49 | 57 | $limit_end = $_GET['number_results']; |
| 50 | 58 | $absolute_difference = $_GET['number_results']; |
| 51 | 59 | } |
| 52 | -} else { |
|
| 60 | +} else { |
|
| 53 | 61 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | 62 | $limit_start = $limit_explode[0]; |
| 55 | 63 | $limit_end = $limit_explode[1]; |
@@ -67,8 +75,11 @@ discard block |
||
| 67 | 75 | |
| 68 | 76 | header("Content-type: text/yaml"); |
| 69 | 77 | |
| 70 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 71 | -else $sort = ''; |
|
| 78 | +if (isset($_GET['sort'])) { |
|
| 79 | + $sort = $_GET['sort']; |
|
| 80 | +} else { |
|
| 81 | + $sort = ''; |
|
| 82 | +} |
|
| 72 | 83 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 73 | 84 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
| 74 | 85 | $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | var data = google.visualization.arrayToDataTable([ |
| 24 | 24 | ["'._("Country").'", "'._("# of times").'"], '; |
| 25 | 25 | $country_data = ''; |
| 26 | -foreach($airline_array as $airline_item) |
|
| 26 | +foreach ($airline_array as $airline_item) |
|
| 27 | 27 | { |
| 28 | 28 | $country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],'; |
| 29 | 29 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | print '</thead>'; |
| 58 | 58 | print '<tbody>'; |
| 59 | 59 | $i = 1; |
| 60 | - foreach($airline_array as $airline_item) |
|
| 60 | + foreach ($airline_array as $airline_item) |
|
| 61 | 61 | { |
| 62 | 62 | print '<tr>'; |
| 63 | 63 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | $page_url = $globalURL.'/acars-archive'; |
| 10 | 10 | |
| 11 | -if(!isset($_GET['limit'])) |
|
| 11 | +if (!isset($_GET['limit'])) |
|
| 12 | 12 | { |
| 13 | 13 | $limit_start = 0; |
| 14 | 14 | $limit_end = 25; |
@@ -36,8 +36,12 @@ |
||
| 36 | 36 | if (!empty($spotter_array)) { |
| 37 | 37 | include('table-output.php'); |
| 38 | 38 | print '<div class="pagination">'; |
| 39 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$_GET['sort'].'">«'._("Previous Page").'</a>'; |
|
| 40 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$_GET['sort'].'">'._("Next Page").'»</a>'; |
|
| 39 | + if ($limit_previous_1 >= 0) { |
|
| 40 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'/'.$_GET['sort'].'">«'._("Previous Page").'</a>'; |
|
| 41 | + } |
|
| 42 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
| 43 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'/'.$_GET['sort'].'">'._("Next Page").'»</a>'; |
|
| 44 | + } |
|
| 41 | 45 | print '</div>'; |
| 42 | 46 | } |
| 43 | 47 | print '</div>'; |
@@ -7,18 +7,18 @@ discard block |
||
| 7 | 7 | public $latest_schema = 23; |
| 8 | 8 | |
| 9 | 9 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
| 10 | - global $globalDBdriver; |
|
| 11 | - if ($dbc === null) { |
|
| 10 | + global $globalDBdriver; |
|
| 11 | + if ($dbc === null) { |
|
| 12 | 12 | if ($this->db === null && $dbname === null) { |
| 13 | - if ($user === null && $pass === null) { |
|
| 13 | + if ($user === null && $pass === null) { |
|
| 14 | 14 | $this->createDBConnection(); |
| 15 | - } else { |
|
| 15 | + } else { |
|
| 16 | 16 | $this->createDBConnection(null,$user,$pass); |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | } else { |
| 19 | - $this->createDBConnection($dbname); |
|
| 19 | + $this->createDBConnection($dbname); |
|
| 20 | 20 | } |
| 21 | - } elseif ($dbname === null || $dbname === 'default') { |
|
| 21 | + } elseif ($dbname === null || $dbname === 'default') { |
|
| 22 | 22 | $this->db = $dbc; |
| 23 | 23 | if ($this->connectionExists() === false) { |
| 24 | 24 | /* |
@@ -28,19 +28,19 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | $this->createDBConnection(); |
| 30 | 30 | } |
| 31 | - } else { |
|
| 31 | + } else { |
|
| 32 | 32 | //$this->connectionExists(); |
| 33 | 33 | $this->dbs[$dbname] = $dbc; |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | - * Creates the database connection |
|
| 40 | - * |
|
| 41 | - * @return Boolean of the database connection |
|
| 42 | - * |
|
| 43 | - */ |
|
| 39 | + * Creates the database connection |
|
| 40 | + * |
|
| 41 | + * @return Boolean of the database connection |
|
| 42 | + * |
|
| 43 | + */ |
|
| 44 | 44 | |
| 45 | 45 | public function createDBConnection($DBname = null, $user = null, $pass = null) |
| 46 | 46 | { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | return false; |
| 134 | 134 | } |
| 135 | 135 | if($results->rowCount()>0) { |
| 136 | - return true; |
|
| 136 | + return true; |
|
| 137 | 137 | } |
| 138 | 138 | else return false; |
| 139 | 139 | } |
@@ -150,14 +150,14 @@ discard block |
||
| 150 | 150 | $sum = $sum->fetchColumn(0); |
| 151 | 151 | } else $sum = 0; |
| 152 | 152 | if (intval($sum) !== 2) { |
| 153 | - return false; |
|
| 153 | + return false; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | } catch(PDOException $e) { |
| 157 | 157 | if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
| 158 | - throw $e; |
|
| 159 | - } |
|
| 160 | - //echo 'error ! '.$e->getMessage(); |
|
| 158 | + throw $e; |
|
| 159 | + } |
|
| 160 | + //echo 'error ! '.$e->getMessage(); |
|
| 161 | 161 | return false; |
| 162 | 162 | } |
| 163 | 163 | return true; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | return false; |
| 182 | 182 | } |
| 183 | 183 | if($results->rowCount()>0) { |
| 184 | - return true; |
|
| 184 | + return true; |
|
| 185 | 185 | } |
| 186 | 186 | else return false; |
| 187 | 187 | } |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | $version = 0; |
| 236 | 236 | if ($this->tableExists('aircraft')) { |
| 237 | 237 | if (!$this->tableExists('config')) { |
| 238 | - $version = '1'; |
|
| 239 | - return $version; |
|
| 238 | + $version = '1'; |
|
| 239 | + return $version; |
|
| 240 | 240 | } else { |
| 241 | 241 | $Connection = new Connection(); |
| 242 | 242 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
@@ -257,8 +257,8 @@ discard block |
||
| 257 | 257 | * @return Boolean if latest version or not |
| 258 | 258 | */ |
| 259 | 259 | public function latest() { |
| 260 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 261 | - else return false; |
|
| 260 | + if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 261 | + else return false; |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | } |
@@ -6,6 +6,9 @@ discard block |
||
| 6 | 6 | public $dbs = array(); |
| 7 | 7 | public $latest_schema = 23; |
| 8 | 8 | |
| 9 | + /** |
|
| 10 | + * @param string $dbname |
|
| 11 | + */ |
|
| 9 | 12 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
| 10 | 13 | global $globalDBdriver; |
| 11 | 14 | if ($dbc === null) { |
@@ -131,6 +134,9 @@ discard block |
||
| 131 | 134 | return true; |
| 132 | 135 | } |
| 133 | 136 | |
| 137 | + /** |
|
| 138 | + * @param string $table |
|
| 139 | + */ |
|
| 134 | 140 | public function tableExists($table) |
| 135 | 141 | { |
| 136 | 142 | global $globalDBdriver, $globalDBname; |
@@ -180,6 +186,11 @@ discard block |
||
| 180 | 186 | /* |
| 181 | 187 | * Check if index exist |
| 182 | 188 | */ |
| 189 | + |
|
| 190 | + /** |
|
| 191 | + * @param string $table |
|
| 192 | + * @param string $index |
|
| 193 | + */ |
|
| 183 | 194 | public function indexExists($table,$index) |
| 184 | 195 | { |
| 185 | 196 | global $globalDBdriver, $globalDBname; |
@@ -225,6 +236,11 @@ discard block |
||
| 225 | 236 | * Check if a column name exist in a table |
| 226 | 237 | * @return Boolean column exist or not |
| 227 | 238 | */ |
| 239 | + |
|
| 240 | + /** |
|
| 241 | + * @param string $table |
|
| 242 | + * @param string $name |
|
| 243 | + */ |
|
| 228 | 244 | public function checkColumnName($table,$name) |
| 229 | 245 | { |
| 230 | 246 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
@@ -1,19 +1,19 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once(dirname(__FILE__).'/settings.php'); |
| 3 | 3 | |
| 4 | -class Connection{ |
|
| 4 | +class Connection { |
|
| 5 | 5 | public $db = null; |
| 6 | 6 | public $dbs = array(); |
| 7 | 7 | public $latest_schema = 26; |
| 8 | 8 | |
| 9 | - public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
|
| 9 | + public function __construct($dbc = null, $dbname = null, $user = null, $pass = null) { |
|
| 10 | 10 | global $globalDBdriver; |
| 11 | 11 | if ($dbc === null) { |
| 12 | 12 | if ($this->db === null && $dbname === null) { |
| 13 | 13 | if ($user === null && $pass === null) { |
| 14 | 14 | $this->createDBConnection(); |
| 15 | 15 | } else { |
| 16 | - $this->createDBConnection(null,$user,$pass); |
|
| 16 | + $this->createDBConnection(null, $user, $pass); |
|
| 17 | 17 | } |
| 18 | 18 | } else { |
| 19 | 19 | $this->createDBConnection($dbname); |
@@ -91,14 +91,14 @@ discard block |
||
| 91 | 91 | while (true) { |
| 92 | 92 | try { |
| 93 | 93 | if ($globalDBSdriver == 'mysql') { |
| 94 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
| 94 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;charset=utf8", $globalDBSuser, $globalDBSpass); |
|
| 95 | 95 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 96 | 96 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 97 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
| 98 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 99 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 100 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 101 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 97 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
| 98 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 500); |
|
| 99 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
| 100 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
| 101 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
| 102 | 102 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 103 | 103 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
| 104 | 104 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -108,18 +108,18 @@ discard block |
||
| 108 | 108 | $this->dbs[$DBname]->exec('SET SESSION time_zone = "+00:00"'); |
| 109 | 109 | //$this->dbs[$DBname]->exec('SET @@session.time_zone = "+00:00"'); |
| 110 | 110 | } else { |
| 111 | - $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
| 111 | + $this->dbs[$DBname] = new PDO("$globalDBSdriver:host=$globalDBShost;port=$globalDBSport;dbname=$globalDBSname;options='--client_encoding=utf8'", $globalDBSuser, $globalDBSpass); |
|
| 112 | 112 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 113 | 113 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 114 | - $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
|
| 115 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 116 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 117 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 118 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 114 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER); |
|
| 115 | + if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, 200); |
|
| 116 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT, $globalDBTimeOut); |
|
| 117 | + if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, true); |
|
| 118 | + else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT, $globalDBPersistent); |
|
| 119 | 119 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 120 | 120 | } |
| 121 | 121 | break; |
| 122 | - } catch(PDOException $e) { |
|
| 122 | + } catch (PDOException $e) { |
|
| 123 | 123 | $i++; |
| 124 | 124 | if (isset($globalDebug) && $globalDebug) echo $e->getMessage()."\n"; |
| 125 | 125 | //exit; |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | try { |
| 144 | 144 | //$Connection = new Connection(); |
| 145 | 145 | $results = $this->db->query($query); |
| 146 | - } catch(PDOException $e) { |
|
| 146 | + } catch (PDOException $e) { |
|
| 147 | 147 | return false; |
| 148 | 148 | } |
| 149 | - if($results->rowCount()>0) { |
|
| 149 | + if ($results->rowCount() > 0) { |
|
| 150 | 150 | return true; |
| 151 | 151 | } |
| 152 | 152 | else return false; |
@@ -167,8 +167,8 @@ discard block |
||
| 167 | 167 | return false; |
| 168 | 168 | } |
| 169 | 169 | |
| 170 | - } catch(PDOException $e) { |
|
| 171 | - if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
| 170 | + } catch (PDOException $e) { |
|
| 171 | + if ($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
|
| 172 | 172 | throw $e; |
| 173 | 173 | } |
| 174 | 174 | //echo 'error ! '.$e->getMessage(); |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | /* |
| 181 | 181 | * Check if index exist |
| 182 | 182 | */ |
| 183 | - public function indexExists($table,$index) |
|
| 183 | + public function indexExists($table, $index) |
|
| 184 | 184 | { |
| 185 | 185 | global $globalDBdriver, $globalDBname; |
| 186 | 186 | if ($globalDBdriver == 'mysql') { |
@@ -191,10 +191,10 @@ discard block |
||
| 191 | 191 | try { |
| 192 | 192 | //$Connection = new Connection(); |
| 193 | 193 | $results = $this->db->query($query); |
| 194 | - } catch(PDOException $e) { |
|
| 194 | + } catch (PDOException $e) { |
|
| 195 | 195 | return false; |
| 196 | 196 | } |
| 197 | - if($results->rowCount()>0) { |
|
| 197 | + if ($results->rowCount() > 0) { |
|
| 198 | 198 | return true; |
| 199 | 199 | } |
| 200 | 200 | else return false; |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
| 210 | 210 | try { |
| 211 | 211 | $results = $this->db->query($query); |
| 212 | - } catch(PDOException $e) { |
|
| 212 | + } catch (PDOException $e) { |
|
| 213 | 213 | return "error : ".$e->getMessage()."\n"; |
| 214 | 214 | } |
| 215 | 215 | $columns = array(); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * Check if a column name exist in a table |
| 226 | 226 | * @return Boolean column exist or not |
| 227 | 227 | */ |
| 228 | - public function checkColumnName($table,$name) |
|
| 228 | + public function checkColumnName($table, $name) |
|
| 229 | 229 | { |
| 230 | 230 | global $globalDBdriver, $globalDBname; |
| 231 | 231 | if ($globalDBdriver == 'mysql') { |
@@ -235,8 +235,8 @@ discard block |
||
| 235 | 235 | } |
| 236 | 236 | try { |
| 237 | 237 | $sth = $this->db()->prepare($query); |
| 238 | - $sth->execute(array(':database' => $globalDBname,':table' => $table,':name' => $name)); |
|
| 239 | - } catch(PDOException $e) { |
|
| 238 | + $sth->execute(array(':database' => $globalDBname, ':table' => $table, ':name' => $name)); |
|
| 239 | + } catch (PDOException $e) { |
|
| 240 | 240 | echo "error : ".$e->getMessage()."\n"; |
| 241 | 241 | } |
| 242 | 242 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | try { |
| 275 | 275 | $sth = $this->db->prepare($query); |
| 276 | 276 | $sth->execute(); |
| 277 | - } catch(PDOException $e) { |
|
| 277 | + } catch (PDOException $e) { |
|
| 278 | 278 | return "error : ".$e->getMessage()."\n"; |
| 279 | 279 | } |
| 280 | 280 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -64,8 +64,11 @@ discard block |
||
| 64 | 64 | $globalDBSname = $globalDBname; |
| 65 | 65 | $globalDBSuser = $globalDBuser; |
| 66 | 66 | $globalDBSpass = $globalDBpass; |
| 67 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
| 68 | - else $globalDBSport = $globalDBport; |
|
| 67 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
| 68 | + $globalDBSport = 3306; |
|
| 69 | + } else { |
|
| 70 | + $globalDBSport = $globalDBport; |
|
| 71 | + } |
|
| 69 | 72 | } else { |
| 70 | 73 | $DBname = 'default'; |
| 71 | 74 | $globalDBSdriver = $globalDBdriver; |
@@ -73,8 +76,11 @@ discard block |
||
| 73 | 76 | $globalDBSname = $globalDBname; |
| 74 | 77 | $globalDBSuser = $user; |
| 75 | 78 | $globalDBSpass = $pass; |
| 76 | - if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306; |
|
| 77 | - else $globalDBSport = $globalDBport; |
|
| 79 | + if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') { |
|
| 80 | + $globalDBSport = 3306; |
|
| 81 | + } else { |
|
| 82 | + $globalDBSport = $globalDBport; |
|
| 83 | + } |
|
| 78 | 84 | } |
| 79 | 85 | } else { |
| 80 | 86 | $globalDBSdriver = $globalDB[$DBname]['driver']; |
@@ -82,11 +88,16 @@ discard block |
||
| 82 | 88 | $globalDBSname = $globalDB[$DBname]['name']; |
| 83 | 89 | $globalDBSuser = $globalDB[$DBname]['user']; |
| 84 | 90 | $globalDBSpass = $globalDB[$DBname]['pass']; |
| 85 | - if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port']; |
|
| 86 | - else $globalDBSport = 3306; |
|
| 91 | + if (isset($globalDB[$DBname]['port'])) { |
|
| 92 | + $globalDBSport = $globalDB[$DBname]['port']; |
|
| 93 | + } else { |
|
| 94 | + $globalDBSport = 3306; |
|
| 95 | + } |
|
| 87 | 96 | } |
| 88 | 97 | // Set number of try to connect to DB |
| 89 | - if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5; |
|
| 98 | + if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) { |
|
| 99 | + $globalDBretry = 5; |
|
| 100 | + } |
|
| 90 | 101 | $i = 0; |
| 91 | 102 | while (true) { |
| 92 | 103 | try { |
@@ -95,10 +106,16 @@ discard block |
||
| 95 | 106 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 96 | 107 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 97 | 108 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
| 98 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 99 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 100 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 101 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 109 | + if (!isset($globalDBTimeOut)) { |
|
| 110 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500); |
|
| 111 | + } else { |
|
| 112 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 113 | + } |
|
| 114 | + if (!isset($globalDBPersistent)) { |
|
| 115 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 116 | + } else { |
|
| 117 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 118 | + } |
|
| 102 | 119 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 103 | 120 | $this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true); |
| 104 | 121 | // Workaround against "ONLY_FULL_GROUP_BY" mode |
@@ -112,22 +129,34 @@ discard block |
||
| 112 | 129 | //$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'"); |
| 113 | 130 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 114 | 131 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER); |
| 115 | - if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 116 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 117 | - if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 118 | - else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 132 | + if (!isset($globalDBTimeOut)) { |
|
| 133 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200); |
|
| 134 | + } else { |
|
| 135 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut); |
|
| 136 | + } |
|
| 137 | + if (!isset($globalDBPersistent)) { |
|
| 138 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true); |
|
| 139 | + } else { |
|
| 140 | + $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent); |
|
| 141 | + } |
|
| 119 | 142 | $this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); |
| 120 | 143 | } |
| 121 | 144 | break; |
| 122 | 145 | } catch(PDOException $e) { |
| 123 | 146 | $i++; |
| 124 | - if (isset($globalDebug) && $globalDebug) echo $e->getMessage()."\n"; |
|
| 147 | + if (isset($globalDebug) && $globalDebug) { |
|
| 148 | + echo $e->getMessage()."\n"; |
|
| 149 | + } |
|
| 125 | 150 | //exit; |
| 126 | - if ($i > $globalDBretry) return false; |
|
| 151 | + if ($i > $globalDBretry) { |
|
| 152 | + return false; |
|
| 153 | + } |
|
| 127 | 154 | //return false; |
| 128 | 155 | } |
| 129 | 156 | } |
| 130 | - if ($DBname === 'default') $this->db = $this->dbs['default']; |
|
| 157 | + if ($DBname === 'default') { |
|
| 158 | + $this->db = $this->dbs['default']; |
|
| 159 | + } |
|
| 131 | 160 | return true; |
| 132 | 161 | } |
| 133 | 162 | |
@@ -139,7 +168,9 @@ discard block |
||
| 139 | 168 | } else { |
| 140 | 169 | $query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'"; |
| 141 | 170 | } |
| 142 | - if ($this->db == NULL) return false; |
|
| 171 | + if ($this->db == NULL) { |
|
| 172 | + return false; |
|
| 173 | + } |
|
| 143 | 174 | try { |
| 144 | 175 | //$Connection = new Connection(); |
| 145 | 176 | $results = $this->db->query($query); |
@@ -148,21 +179,28 @@ discard block |
||
| 148 | 179 | } |
| 149 | 180 | if($results->rowCount()>0) { |
| 150 | 181 | return true; |
| 182 | + } else { |
|
| 183 | + return false; |
|
| 151 | 184 | } |
| 152 | - else return false; |
|
| 153 | 185 | } |
| 154 | 186 | |
| 155 | 187 | public function connectionExists() |
| 156 | 188 | { |
| 157 | 189 | global $globalDBdriver, $globalDBCheckConnection; |
| 158 | - if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true; |
|
| 190 | + if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) { |
|
| 191 | + return true; |
|
| 192 | + } |
|
| 159 | 193 | $query = "SELECT 1 + 1"; |
| 160 | - if ($this->db === null) return false; |
|
| 194 | + if ($this->db === null) { |
|
| 195 | + return false; |
|
| 196 | + } |
|
| 161 | 197 | try { |
| 162 | 198 | $sum = @$this->db->query($query); |
| 163 | 199 | if ($sum instanceof \PDOStatement) { |
| 164 | 200 | $sum = $sum->fetchColumn(0); |
| 165 | - } else $sum = 0; |
|
| 201 | + } else { |
|
| 202 | + $sum = 0; |
|
| 203 | + } |
|
| 166 | 204 | if (intval($sum) !== 2) { |
| 167 | 205 | return false; |
| 168 | 206 | } |
@@ -196,8 +234,9 @@ discard block |
||
| 196 | 234 | } |
| 197 | 235 | if($results->rowCount()>0) { |
| 198 | 236 | return true; |
| 237 | + } else { |
|
| 238 | + return false; |
|
| 199 | 239 | } |
| 200 | - else return false; |
|
| 201 | 240 | } |
| 202 | 241 | |
| 203 | 242 | /* |
@@ -240,9 +279,12 @@ discard block |
||
| 240 | 279 | echo "error : ".$e->getMessage()."\n"; |
| 241 | 280 | } |
| 242 | 281 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 243 | - if ($result['nb'] > 0) return true; |
|
| 244 | - else return false; |
|
| 245 | -/* } else { |
|
| 282 | + if ($result['nb'] > 0) { |
|
| 283 | + return true; |
|
| 284 | + } else { |
|
| 285 | + return false; |
|
| 286 | + } |
|
| 287 | + /* } else { |
|
| 246 | 288 | $query = "SELECT * FROM ".$table." LIMIT 0"; |
| 247 | 289 | try { |
| 248 | 290 | $results = $this->db->query($query); |
@@ -280,7 +322,9 @@ discard block |
||
| 280 | 322 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 281 | 323 | return $result['value']; |
| 282 | 324 | } |
| 283 | - } else return $version; |
|
| 325 | + } else { |
|
| 326 | + return $version; |
|
| 327 | + } |
|
| 284 | 328 | } |
| 285 | 329 | |
| 286 | 330 | /* |
@@ -288,8 +332,11 @@ discard block |
||
| 288 | 332 | * @return Boolean if latest version or not |
| 289 | 333 | */ |
| 290 | 334 | public function latest() { |
| 291 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 292 | - else return false; |
|
| 335 | + if ($this->check_schema_version() == $this->latest_schema) { |
|
| 336 | + return true; |
|
| 337 | + } else { |
|
| 338 | + return false; |
|
| 339 | + } |
|
| 293 | 340 | } |
| 294 | 341 | |
| 295 | 342 | } |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | header('Content-Type: text/javascript'); |
| 18 | 18 | |
| 19 | 19 | |
| 20 | -$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
| 20 | +$polar = $Stats->getStatsSource(date('Y-m-d'), 'polar'); |
|
| 21 | 21 | $output = '{"type": "FeatureCollection","features": ['; |
| 22 | 22 | if (!empty($polar)) { |
| 23 | - foreach($polar as $eachpolar) { |
|
| 23 | + foreach ($polar as $eachpolar) { |
|
| 24 | 24 | $data = json_decode($eachpolar['source_data']); |
| 25 | 25 | $name = $eachpolar['source_name']; |
| 26 | 26 | $coord = $Location->getLocationInfobySourceName($name); |
@@ -33,15 +33,15 @@ discard block |
||
| 33 | 33 | $initial_longitude = $globalCenterLongitude; |
| 34 | 34 | } |
| 35 | 35 | $first = ''; |
| 36 | - foreach($data as $value => $key) { |
|
| 37 | - $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key); |
|
| 38 | - if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
| 36 | + foreach ($data as $value => $key) { |
|
| 37 | + $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude, $initial_longitude, $value*22.5, $key); |
|
| 38 | + if ($first == '') $first = '['.round($final_coord['longitude'], 5).','.round($final_coord['latitude'], 5).']'; |
|
| 39 | 39 | $output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],'; |
| 40 | 40 | } |
| 41 | 41 | $output .= $first; |
| 42 | 42 | $output .= ']]}},'; |
| 43 | 43 | } |
| 44 | - $output = substr($output, 0, -1); |
|
| 44 | + $output = substr($output, 0, -1); |
|
| 45 | 45 | } |
| 46 | 46 | $output .= ']}'; |
| 47 | 47 | print $output; |
@@ -35,7 +35,9 @@ |
||
| 35 | 35 | $first = ''; |
| 36 | 36 | foreach($data as $value => $key) { |
| 37 | 37 | $final_coord = $Common->getCoordfromDistanceBearing($initial_latitude,$initial_longitude,$value*22.5,$key); |
| 38 | - if ($first == '') $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
| 38 | + if ($first == '') { |
|
| 39 | + $first = '['.round($final_coord['longitude'],5).','.round($final_coord['latitude'],5).']'; |
|
| 40 | + } |
|
| 39 | 41 | $output .= '['.$final_coord['longitude'].','.$final_coord['latitude'].'],'; |
| 40 | 42 | } |
| 41 | 43 | $output .= $first; |
@@ -11,10 +11,10 @@ discard block |
||
| 11 | 11 | $Common = new Common(); |
| 12 | 12 | |
| 13 | 13 | if (isset($_GET['download'])) { |
| 14 | - if ($_GET['download'] == "true") |
|
| 15 | - { |
|
| 14 | + if ($_GET['download'] == "true") |
|
| 15 | + { |
|
| 16 | 16 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | } |
| 19 | 19 | header('Content-Type: text/javascript'); |
| 20 | 20 | |
@@ -325,29 +325,29 @@ discard block |
||
| 325 | 325 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
| 326 | 326 | || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
| 327 | 327 | || (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) { |
| 328 | - if ($from_archive) { |
|
| 329 | - $spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
|
| 330 | - } else { |
|
| 331 | - $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
|
| 332 | - } |
|
| 333 | - $d = false; |
|
| 328 | + if ($from_archive) { |
|
| 329 | + $spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
|
| 330 | + } else { |
|
| 331 | + $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
|
| 332 | + } |
|
| 333 | + $d = false; |
|
| 334 | 334 | foreach ($spotter_history_array as $key => $spotter_history) |
| 335 | 335 | { |
| 336 | - /* |
|
| 336 | + /* |
|
| 337 | 337 | if (abs($spotter_history['longitude']-$spotter_item['longitude']) > 200 || $d==true) { |
| 338 | 338 | if ($d == false) $d = true; |
| 339 | 339 | } else { |
| 340 | 340 | */ |
| 341 | 341 | $alt = round($spotter_history['altitude']/10)*10; |
| 342 | 342 | if (!isset($prev_alt) || $prev_alt != $alt) { |
| 343 | - if (isset($prev_alt)) { |
|
| 343 | + if (isset($prev_alt)) { |
|
| 344 | 344 | //$output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].','.$spotter_history['altitude'].']'; |
| 345 | 345 | $output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].', '.$spotter_history['altitude'].']'; |
| 346 | 346 | $output_history .= ']}},'; |
| 347 | 347 | $output .= $output_history; |
| 348 | - } |
|
| 349 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 350 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 348 | + } |
|
| 349 | + if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 350 | + else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 351 | 351 | } |
| 352 | 352 | $output_history .= '['; |
| 353 | 353 | $output_history .= $spotter_history['longitude'].', '; |
@@ -355,41 +355,41 @@ discard block |
||
| 355 | 355 | $output_history .= $spotter_history['altitude']*30.48; |
| 356 | 356 | $output_history .= '],'; |
| 357 | 357 | $prev_alt = $alt; |
| 358 | - //} |
|
| 358 | + //} |
|
| 359 | 359 | } |
| 360 | 360 | if (isset($output_history)) { |
| 361 | - $output_history = substr($output_history, 0, -1); |
|
| 362 | - $output_history .= ']}},'; |
|
| 363 | - $output .= $output_history; |
|
| 364 | - unset($prev_alt); |
|
| 365 | - unset($output_history); |
|
| 361 | + $output_history = substr($output_history, 0, -1); |
|
| 362 | + $output_history .= ']}},'; |
|
| 363 | + $output .= $output_history; |
|
| 364 | + unset($prev_alt); |
|
| 365 | + unset($output_history); |
|
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | if (isset($history) && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 370 | - $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 371 | - if (isset($spotter_item['departure_airport_latitude'])) { |
|
| 370 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 371 | + if (isset($spotter_item['departure_airport_latitude'])) { |
|
| 372 | 372 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
| 373 | - } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
| 373 | + } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
| 374 | 374 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
| 375 | 375 | //print_r($dairport); |
| 376 | 376 | //echo $spotter_item['departure_airport']; |
| 377 | 377 | if (isset($dairport[0]['latitude'])) { |
| 378 | - $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
| 378 | + $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
| 379 | 379 | } |
| 380 | - } |
|
| 381 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
| 380 | + } |
|
| 381 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
| 382 | 382 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
| 383 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
| 383 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
| 384 | 384 | //print_r($aairport); |
| 385 | 385 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
| 386 | 386 | if (isset($aairport[0]['latitude'])) { |
| 387 | - $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
| 387 | + $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
| 388 | 388 | } |
| 389 | - } |
|
| 390 | - $output_air .= ']}},'; |
|
| 391 | - $output .= $output_air; |
|
| 392 | - unset($output_air); |
|
| 389 | + } |
|
| 390 | + $output_air .= ']}},'; |
|
| 391 | + $output .= $output_air; |
|
| 392 | + unset($output_air); |
|
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | $output = substr($output, 0, -1); |
@@ -25,13 +25,13 @@ discard block |
||
| 25 | 25 | $min = false; |
| 26 | 26 | $allhistory = false; |
| 27 | 27 | $filter['source'] = array(); |
| 28 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 29 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 30 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 31 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 32 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 33 | -if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 34 | -if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 28 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 29 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 30 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 31 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs')); |
|
| 32 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 33 | +if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',', $_COOKIE['Airlines']); |
|
| 34 | +if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',', $_COOKIE['Sources']); |
|
| 35 | 35 | if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') $filter['airlinestype'] = $_COOKIE['airlinestype']; |
| 36 | 36 | |
| 37 | 37 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | if (isset($_GET['ident'])) { |
| 42 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 42 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 43 | 43 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
| 44 | 44 | if (empty($spotter_array)) { |
| 45 | 45 | $from_archive = true; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | $allhistory = true; |
| 49 | 49 | } elseif (isset($_GET['flightaware_id'])) { |
| 50 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 50 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 51 | 51 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
| 52 | 52 | if (empty($spotter_array)) { |
| 53 | 53 | $from_archive = true; |
@@ -56,37 +56,37 @@ discard block |
||
| 56 | 56 | $allhistory = true; |
| 57 | 57 | } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
| 58 | 58 | //if (isset($_GET['coord'])) { |
| 59 | - $coord = explode(',',$_GET['coord']); |
|
| 60 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
| 59 | + $coord = explode(',', $_GET['coord']); |
|
| 60 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
| 61 | 61 | |
| 62 | 62 | #} elseif (isset($globalMapPopup) && !$globalMapPopup) { |
| 63 | 63 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
| 64 | 64 | $from_archive = true; |
| 65 | 65 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 66 | 66 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 67 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 68 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 69 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 70 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 71 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 72 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
| 67 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 68 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 69 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 70 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 71 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 72 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
| 73 | 73 | } elseif ($min) { |
| 74 | 74 | $spotter_array = $SpotterLive->getMinLiveSpotterData($filter); |
| 75 | 75 | # $min = true; |
| 76 | 76 | } else { |
| 77 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
| 77 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | if (!empty($spotter_array)) { |
| 81 | 81 | if (isset($_GET['archive'])) { |
| 82 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 82 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 83 | 83 | } else { |
| 84 | 84 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 85 | 85 | } |
| 86 | 86 | if ($flightcnt == '') $flightcnt = 0; |
| 87 | 87 | } else $flightcnt = 0; |
| 88 | 88 | |
| 89 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 89 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 90 | 90 | |
| 91 | 91 | $j = 0; |
| 92 | 92 | $prev_flightaware_id = ''; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 102 | 102 | { |
| 103 | 103 | $output .= '"features": ['; |
| 104 | - foreach($spotter_array as $spotter_item) |
|
| 104 | + foreach ($spotter_array as $spotter_item) |
|
| 105 | 105 | { |
| 106 | 106 | $j++; |
| 107 | 107 | date_default_timezone_set('UTC'); |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
| 153 | 153 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 154 | 154 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 155 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
| 155 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
| 156 | 156 | } elseif (isset($spotter_item['aircraft_type'])) { |
| 157 | 157 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
| 158 | 158 | } elseif (!$min) { |
@@ -220,15 +220,15 @@ discard block |
||
| 220 | 220 | if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
| 221 | 221 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
| 222 | 222 | |
| 223 | - if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
| 224 | - else $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
| 223 | + if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
| 224 | + else $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
| 225 | 225 | //$output .= '"nextlatitude": "'.$nextcoord['latitude'].'",'; |
| 226 | 226 | //$output .= '"nextlongitude": "'.$nextcoord['longitude'].'",'; |
| 227 | 227 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 228 | 228 | |
| 229 | 229 | if (!$min) $output .= '"image": "'.$image.'",'; |
| 230 | 230 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 231 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
| 231 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
| 232 | 232 | } |
| 233 | 233 | if (isset($spotter_item['image_source_website'])) { |
| 234 | 234 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
| 251 | 251 | } |
| 252 | 252 | if (isset($spotter_item['acars'])) { |
| 253 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
| 253 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
| 254 | 254 | } |
| 255 | 255 | // type when not aircraft ? |
| 256 | 256 | if ($compress) $output .= '"t": "aircraft"'; |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | */ |
| 321 | 321 | //if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id'])))) { |
| 322 | 322 | //if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id']))) || (isset($_GET['history']) && $_GET['history'] == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) { |
| 323 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
| 323 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
| 324 | 324 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
| 325 | 325 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
| 326 | 326 | || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
@@ -350,9 +350,9 @@ discard block |
||
| 350 | 350 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
| 351 | 351 | } |
| 352 | 352 | $output_history .= '['; |
| 353 | - $output_history .= $spotter_history['longitude'].', '; |
|
| 354 | - $output_history .= $spotter_history['latitude'].', '; |
|
| 355 | - $output_history .= $spotter_history['altitude']*30.48; |
|
| 353 | + $output_history .= $spotter_history['longitude'].', '; |
|
| 354 | + $output_history .= $spotter_history['latitude'].', '; |
|
| 355 | + $output_history .= $spotter_history['altitude']*30.48; |
|
| 356 | 356 | $output_history .= '],'; |
| 357 | 357 | $prev_alt = $alt; |
| 358 | 358 | //} |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | //$output .= ']}}'; |
| 397 | 397 | $output .= ']'; |
| 398 | 398 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 399 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
| 399 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
| 400 | 400 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
| 401 | 401 | $output .= '"fc": "'.$j.'"'; |
| 402 | 402 | } else { |
@@ -18,21 +18,40 @@ discard block |
||
| 18 | 18 | } |
| 19 | 19 | header('Content-Type: text/javascript'); |
| 20 | 20 | |
| 21 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 22 | -else $compress = $globalJsonCompress; |
|
| 21 | +if (!isset($globalJsonCompress)) { |
|
| 22 | + $compress = true; |
|
| 23 | +} else { |
|
| 24 | + $compress = $globalJsonCompress; |
|
| 25 | +} |
|
| 23 | 26 | |
| 24 | 27 | $from_archive = false; |
| 25 | 28 | $min = false; |
| 26 | 29 | $allhistory = false; |
| 27 | 30 | $filter['source'] = array(); |
| 28 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 29 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 30 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 31 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 32 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 33 | -if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 34 | -if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 35 | -if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') $filter['airlinestype'] = $_COOKIE['airlinestype']; |
|
| 31 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') { |
|
| 32 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 33 | +} |
|
| 34 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') { |
|
| 35 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 36 | +} |
|
| 37 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') { |
|
| 38 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 39 | +} |
|
| 40 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') { |
|
| 41 | + $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 42 | +} |
|
| 43 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') { |
|
| 44 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 45 | +} |
|
| 46 | +if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') { |
|
| 47 | + $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 48 | +} |
|
| 49 | +if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') { |
|
| 50 | + $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 51 | +} |
|
| 52 | +if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') { |
|
| 53 | + $filter['airlinestype'] = $_COOKIE['airlinestype']; |
|
| 54 | +} |
|
| 36 | 55 | |
| 37 | 56 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 38 | 57 | $min = true; |
@@ -83,8 +102,12 @@ discard block |
||
| 83 | 102 | } else { |
| 84 | 103 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 85 | 104 | } |
| 86 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 87 | -} else $flightcnt = 0; |
|
| 105 | + if ($flightcnt == '') { |
|
| 106 | + $flightcnt = 0; |
|
| 107 | + } |
|
| 108 | + } else { |
|
| 109 | + $flightcnt = 0; |
|
| 110 | +} |
|
| 88 | 111 | |
| 89 | 112 | $sqltime = round(microtime(true)-$begintime,2); |
| 90 | 113 | |
@@ -93,8 +116,11 @@ discard block |
||
| 93 | 116 | |
| 94 | 117 | $output = '{'; |
| 95 | 118 | $output .= '"type": "FeatureCollection",'; |
| 96 | - if ($min) $output .= '"minimal": "true",'; |
|
| 97 | - else $output .= '"minimal": "false",'; |
|
| 119 | + if ($min) { |
|
| 120 | + $output .= '"minimal": "true",'; |
|
| 121 | + } else { |
|
| 122 | + $output .= '"minimal": "false",'; |
|
| 123 | + } |
|
| 98 | 124 | $output .= '"fc": "'.$flightcnt.'",'; |
| 99 | 125 | $output .= '"sqt": "'.$sqltime.'",'; |
| 100 | 126 | |
@@ -131,11 +157,16 @@ discard block |
||
| 131 | 157 | //$output .= '"sqt": "'.$sqltime.'",'; |
| 132 | 158 | $output .= '"id": "'.$spotter_item['flightaware_id'].'",'; |
| 133 | 159 | $output .= '"properties": {'; |
| 134 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 135 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 160 | + if ($compress) { |
|
| 161 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 162 | + } else { |
|
| 163 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 164 | + } |
|
| 136 | 165 | $output .= '"fc": "'.$flightcnt.'",'; |
| 137 | 166 | $output .= '"sqt": "'.$sqltime.'",'; |
| 138 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 167 | + if (isset($begindate)) { |
|
| 168 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 169 | + } |
|
| 139 | 170 | |
| 140 | 171 | /* |
| 141 | 172 | if ($min) $output .= '"minimal": "true",'; |
@@ -143,13 +174,21 @@ discard block |
||
| 143 | 174 | */ |
| 144 | 175 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 145 | 176 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 146 | - if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
| 147 | - else $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
| 177 | + if ($compress) { |
|
| 178 | + $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
| 179 | + } else { |
|
| 180 | + $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
| 181 | + } |
|
| 148 | 182 | } else { |
| 149 | - if ($compress) $output .= '"c": "NA",'; |
|
| 150 | - else $output .= '"callsign": "NA",'; |
|
| 183 | + if ($compress) { |
|
| 184 | + $output .= '"c": "NA",'; |
|
| 185 | + } else { |
|
| 186 | + $output .= '"callsign": "NA",'; |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | + if (isset($spotter_item['registration'])) { |
|
| 190 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 151 | 191 | } |
| 152 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 153 | 192 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 154 | 193 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 155 | 194 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -162,20 +201,31 @@ discard block |
||
| 162 | 201 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
| 163 | 202 | } |
| 164 | 203 | if (!isset($spotter_item['aircraft_shadow'])) { |
| 165 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 166 | - else { |
|
| 204 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 205 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 206 | + } else { |
|
| 167 | 207 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 168 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 169 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 170 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 208 | + if (count($aircraft_info) > 0) { |
|
| 209 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 210 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 211 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 212 | + } else { |
|
| 213 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 214 | + } |
|
| 171 | 215 | } |
| 172 | 216 | } |
| 173 | 217 | if ($spotter_item['aircraft_shadow'] == '') { |
| 174 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 175 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 218 | + if ($compress) { |
|
| 219 | + $output .= '"as": "default.png",'; |
|
| 220 | + } else { |
|
| 221 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 222 | + } |
|
| 176 | 223 | } else { |
| 177 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 178 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 224 | + if ($compress) { |
|
| 225 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 226 | + } else { |
|
| 227 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 228 | + } |
|
| 179 | 229 | } |
| 180 | 230 | if (isset($spotter_item['airline_name'])) { |
| 181 | 231 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -183,8 +233,11 @@ discard block |
||
| 183 | 233 | $output .= '"airline_name": "NA",'; |
| 184 | 234 | } |
| 185 | 235 | if (isset($spotter_item['departure_airport'])) { |
| 186 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 187 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 236 | + if ($compress) { |
|
| 237 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 238 | + } else { |
|
| 239 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 240 | + } |
|
| 188 | 241 | } |
| 189 | 242 | if (isset($spotter_item['departure_airport_city'])) { |
| 190 | 243 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -196,8 +249,11 @@ discard block |
||
| 196 | 249 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
| 197 | 250 | } |
| 198 | 251 | if (isset($spotter_item['arrival_airport'])) { |
| 199 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 200 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 252 | + if ($compress) { |
|
| 253 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 254 | + } else { |
|
| 255 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 256 | + } |
|
| 201 | 257 | } |
| 202 | 258 | if (isset($spotter_item['arrival_airport_city'])) { |
| 203 | 259 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -215,18 +271,29 @@ discard block |
||
| 215 | 271 | $output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",'; |
| 216 | 272 | } |
| 217 | 273 | |
| 218 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 219 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 220 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 221 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 274 | + if ($compress) { |
|
| 275 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 276 | + } else { |
|
| 277 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 278 | + } |
|
| 279 | + if ($compress) { |
|
| 280 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 281 | + } else { |
|
| 282 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 283 | + } |
|
| 222 | 284 | |
| 223 | - if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
| 224 | - else $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
| 285 | + if (isset($archivespeed)) { |
|
| 286 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
| 287 | + } else { |
|
| 288 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
| 289 | + } |
|
| 225 | 290 | //$output .= '"nextlatitude": "'.$nextcoord['latitude'].'",'; |
| 226 | 291 | //$output .= '"nextlongitude": "'.$nextcoord['longitude'].'",'; |
| 227 | 292 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 228 | 293 | |
| 229 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
| 294 | + if (!$min) { |
|
| 295 | + $output .= '"image": "'.$image.'",'; |
|
| 296 | + } |
|
| 230 | 297 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 231 | 298 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
| 232 | 299 | } |
@@ -234,8 +301,11 @@ discard block |
||
| 234 | 301 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
| 235 | 302 | } |
| 236 | 303 | if (isset($spotter_item['squawk'])) { |
| 237 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 238 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 304 | + if ($compress) { |
|
| 305 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 306 | + } else { |
|
| 307 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 308 | + } |
|
| 239 | 309 | } |
| 240 | 310 | if (isset($spotter_item['squawk_usage'])) { |
| 241 | 311 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -253,8 +323,11 @@ discard block |
||
| 253 | 323 | $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
| 254 | 324 | } |
| 255 | 325 | // type when not aircraft ? |
| 256 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 257 | - else $output .= '"type": "aircraft"'; |
|
| 326 | + if ($compress) { |
|
| 327 | + $output .= '"t": "aircraft"'; |
|
| 328 | + } else { |
|
| 329 | + $output .= '"type": "aircraft"'; |
|
| 330 | + } |
|
| 258 | 331 | $output .= '},'; |
| 259 | 332 | $output .= '"geometry": {'; |
| 260 | 333 | $output .= '"type": "Point",'; |
@@ -321,7 +394,9 @@ discard block |
||
| 321 | 394 | //if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id'])))) { |
| 322 | 395 | //if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id']))) || (isset($_GET['history']) && $_GET['history'] == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) { |
| 323 | 396 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
| 324 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
| 397 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
| 398 | + $history = $_COOKIE['history']; |
|
| 399 | + } |
|
| 325 | 400 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
| 326 | 401 | || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
| 327 | 402 | || (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) { |
@@ -346,8 +421,11 @@ discard block |
||
| 346 | 421 | $output_history .= ']}},'; |
| 347 | 422 | $output .= $output_history; |
| 348 | 423 | } |
| 349 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 350 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 424 | + if ($compress) { |
|
| 425 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 426 | + } else { |
|
| 427 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
| 428 | + } |
|
| 351 | 429 | } |
| 352 | 430 | $output_history .= '['; |
| 353 | 431 | $output_history .= $spotter_history['longitude'].', '; |
@@ -397,7 +475,9 @@ discard block |
||
| 397 | 475 | $output .= ']'; |
| 398 | 476 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 399 | 477 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 400 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 478 | + if (isset($begindate)) { |
|
| 479 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 480 | + } |
|
| 401 | 481 | $output .= '"fc": "'.$j.'"'; |
| 402 | 482 | } else { |
| 403 | 483 | $output .= '"features": '; |
@@ -9,10 +9,10 @@ discard block |
||
| 9 | 9 | $Common = new Common(); |
| 10 | 10 | |
| 11 | 11 | if (isset($_GET['download'])) { |
| 12 | - if ($_GET['download'] == "true") |
|
| 13 | - { |
|
| 12 | + if ($_GET['download'] == "true") |
|
| 13 | + { |
|
| 14 | 14 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
| 15 | - } |
|
| 15 | + } |
|
| 16 | 16 | } |
| 17 | 17 | header('Content-Type: text/javascript'); |
| 18 | 18 | |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | //waypoint plotting |
| 94 | - /* |
|
| 94 | + /* |
|
| 95 | 95 | $output .= '{'; |
| 96 | 96 | $output .= '"type": "Feature",'; |
| 97 | 97 | $output .= '"properties": {'; |
@@ -270,8 +270,8 @@ discard block |
||
| 270 | 270 | $output_time .= (strtotime($spotter_history['date'])*1000).','; |
| 271 | 271 | } |
| 272 | 272 | if (isset($output_time)) { |
| 273 | - $output_time = substr($output_time, 0, -1); |
|
| 274 | - $output .= '"time": ['.$output_time.'],'; |
|
| 273 | + $output_time = substr($output_time, 0, -1); |
|
| 274 | + $output .= '"time": ['.$output_time.'],'; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -285,8 +285,8 @@ discard block |
||
| 285 | 285 | $output .= '"coordinates": ['; |
| 286 | 286 | |
| 287 | 287 | if (isset($output_history)) { |
| 288 | - $output_history = substr($output_history, 0, -1); |
|
| 289 | - $output .= $output_history; |
|
| 288 | + $output_history = substr($output_history, 0, -1); |
|
| 289 | + $output .= $output_history; |
|
| 290 | 290 | } |
| 291 | 291 | |
| 292 | 292 | $output .= ']'; |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | $min = false; |
| 24 | 24 | $allhistory = false; |
| 25 | 25 | $filter['source'] = array(); |
| 26 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 27 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 28 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 29 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 30 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 31 | -if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 32 | -if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 26 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 27 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 28 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 29 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs')); |
|
| 30 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 31 | +if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',', $_COOKIE['Airlines']); |
|
| 32 | +if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',', $_COOKIE['Sources']); |
|
| 33 | 33 | if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') $filter['airlinestype'] = $_COOKIE['airlinestype']; |
| 34 | 34 | |
| 35 | 35 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | if (isset($_GET['ident'])) { |
| 40 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 40 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 41 | 41 | $from_archive = true; |
| 42 | 42 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
| 43 | 43 | $allhistory = true; |
| 44 | 44 | } elseif (isset($_GET['flightaware_id'])) { |
| 45 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 45 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 46 | 46 | $from_archive = true; |
| 47 | 47 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
| 48 | 48 | $allhistory = true; |
@@ -50,20 +50,20 @@ discard block |
||
| 50 | 50 | $from_archive = true; |
| 51 | 51 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 52 | 52 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 53 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 57 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 58 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
| 53 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 57 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 58 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if (!empty($spotter_array)) { |
| 62 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 62 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 63 | 63 | if ($flightcnt == '') $flightcnt = 0; |
| 64 | 64 | } else $flightcnt = 0; |
| 65 | 65 | |
| 66 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 66 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 67 | 67 | |
| 68 | 68 | //var_dump($spotter_array); |
| 69 | 69 | $j = 0; |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 79 | 79 | { |
| 80 | 80 | $output .= '"features": ['; |
| 81 | - foreach($spotter_array as $spotter_item) |
|
| 81 | + foreach ($spotter_array as $spotter_item) |
|
| 82 | 82 | { |
| 83 | 83 | $j++; |
| 84 | 84 | date_default_timezone_set('UTC'); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
| 162 | 162 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 163 | 163 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 164 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
| 164 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
| 165 | 165 | } elseif (isset($spotter_item['aircraft_type'])) { |
| 166 | 166 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
| 167 | 167 | } elseif (!$min) { |
@@ -228,15 +228,15 @@ discard block |
||
| 228 | 228 | if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
| 229 | 229 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
| 230 | 230 | |
| 231 | - if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
| 232 | - else $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
| 231 | + if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
| 232 | + else $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
| 233 | 233 | //$output .= '"nextlatitude": "'.$nextcoord['latitude'].'",'; |
| 234 | 234 | //$output .= '"nextlongitude": "'.$nextcoord['longitude'].'",'; |
| 235 | 235 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 236 | 236 | |
| 237 | 237 | if (!$min) $output .= '"image": "'.$image.'",'; |
| 238 | 238 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 239 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
| 239 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
| 240 | 240 | } |
| 241 | 241 | if (isset($spotter_item['image_source_website'])) { |
| 242 | 242 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
| 259 | 259 | } |
| 260 | 260 | if (isset($spotter_item['acars'])) { |
| 261 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
| 261 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
| 262 | 262 | } |
| 263 | 263 | $spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataById($spotter_item['flightaware_id']); |
| 264 | 264 | //$spotter_history_array = array(); |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $output_time .= (strtotime($spotter_history['date'])*1000).','; |
| 271 | 271 | } |
| 272 | 272 | if (isset($output_time)) { |
| 273 | - $output_time = substr($output_time, 0, -1); |
|
| 273 | + $output_time = substr($output_time, 0, -1); |
|
| 274 | 274 | $output .= '"time": ['.$output_time.'],'; |
| 275 | 275 | } |
| 276 | 276 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | $output .= '"coordinates": ['; |
| 286 | 286 | |
| 287 | 287 | if (isset($output_history)) { |
| 288 | - $output_history = substr($output_history, 0, -1); |
|
| 288 | + $output_history = substr($output_history, 0, -1); |
|
| 289 | 289 | $output .= $output_history; |
| 290 | 290 | } |
| 291 | 291 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | $output = substr($output, 0, -1); |
| 298 | 298 | $output .= ']'; |
| 299 | 299 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 300 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
| 300 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
| 301 | 301 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
| 302 | 302 | $output .= '"fc": "'.$flightcnt.'"'; |
| 303 | 303 | } else { |
@@ -16,21 +16,40 @@ discard block |
||
| 16 | 16 | } |
| 17 | 17 | header('Content-Type: text/javascript'); |
| 18 | 18 | |
| 19 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 20 | -else $compress = $globalJsonCompress; |
|
| 19 | +if (!isset($globalJsonCompress)) { |
|
| 20 | + $compress = true; |
|
| 21 | +} else { |
|
| 22 | + $compress = $globalJsonCompress; |
|
| 23 | +} |
|
| 21 | 24 | |
| 22 | 25 | $from_archive = false; |
| 23 | 26 | $min = false; |
| 24 | 27 | $allhistory = false; |
| 25 | 28 | $filter['source'] = array(); |
| 26 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 27 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 28 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 29 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 30 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 31 | -if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 32 | -if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 33 | -if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') $filter['airlinestype'] = $_COOKIE['airlinestype']; |
|
| 29 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') { |
|
| 30 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 31 | +} |
|
| 32 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') { |
|
| 33 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 34 | +} |
|
| 35 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') { |
|
| 36 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 37 | +} |
|
| 38 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') { |
|
| 39 | + $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 40 | +} |
|
| 41 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') { |
|
| 42 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 43 | +} |
|
| 44 | +if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') { |
|
| 45 | + $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 46 | +} |
|
| 47 | +if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') { |
|
| 48 | + $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 49 | +} |
|
| 50 | +if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') { |
|
| 51 | + $filter['airlinestype'] = $_COOKIE['airlinestype']; |
|
| 52 | +} |
|
| 34 | 53 | |
| 35 | 54 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 36 | 55 | $min = true; |
@@ -60,8 +79,12 @@ discard block |
||
| 60 | 79 | |
| 61 | 80 | if (!empty($spotter_array)) { |
| 62 | 81 | $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
| 63 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 64 | -} else $flightcnt = 0; |
|
| 82 | + if ($flightcnt == '') { |
|
| 83 | + $flightcnt = 0; |
|
| 84 | + } |
|
| 85 | + } else { |
|
| 86 | + $flightcnt = 0; |
|
| 87 | +} |
|
| 65 | 88 | |
| 66 | 89 | $sqltime = round(microtime(true)-$begintime,2); |
| 67 | 90 | |
@@ -70,8 +93,11 @@ discard block |
||
| 70 | 93 | |
| 71 | 94 | $output = '{'; |
| 72 | 95 | $output .= '"type": "FeatureCollection",'; |
| 73 | - if ($min) $output .= '"minimal": "true",'; |
|
| 74 | - else $output .= '"minimal": "false",'; |
|
| 96 | + if ($min) { |
|
| 97 | + $output .= '"minimal": "true",'; |
|
| 98 | + } else { |
|
| 99 | + $output .= '"minimal": "false",'; |
|
| 100 | + } |
|
| 75 | 101 | $output .= '"fc": "'.$flightcnt.'",'; |
| 76 | 102 | $output .= '"sqt": "'.$sqltime.'",'; |
| 77 | 103 | |
@@ -140,11 +166,16 @@ discard block |
||
| 140 | 166 | //$output .= '"fc": "'.$flightcnt.'",'; |
| 141 | 167 | //$output .= '"sqt": "'.$sqltime.'",'; |
| 142 | 168 | $output .= '"properties": {'; |
| 143 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 144 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 169 | + if ($compress) { |
|
| 170 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
| 171 | + } else { |
|
| 172 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
| 173 | + } |
|
| 145 | 174 | $output .= '"fc": "'.$flightcnt.'",'; |
| 146 | 175 | $output .= '"sqt": "'.$sqltime.'",'; |
| 147 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 176 | + if (isset($begindate)) { |
|
| 177 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 178 | + } |
|
| 148 | 179 | |
| 149 | 180 | /* |
| 150 | 181 | if ($min) $output .= '"minimal": "true",'; |
@@ -152,13 +183,21 @@ discard block |
||
| 152 | 183 | */ |
| 153 | 184 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 154 | 185 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 155 | - if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
| 156 | - else $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
| 186 | + if ($compress) { |
|
| 187 | + $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
| 188 | + } else { |
|
| 189 | + $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
| 190 | + } |
|
| 157 | 191 | } else { |
| 158 | - if ($compress) $output .= '"c": "NA",'; |
|
| 159 | - else $output .= '"callsign": "NA",'; |
|
| 192 | + if ($compress) { |
|
| 193 | + $output .= '"c": "NA",'; |
|
| 194 | + } else { |
|
| 195 | + $output .= '"callsign": "NA",'; |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + if (isset($spotter_item['registration'])) { |
|
| 199 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 160 | 200 | } |
| 161 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
| 162 | 201 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 163 | 202 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 164 | 203 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -171,19 +210,29 @@ discard block |
||
| 171 | 210 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
| 172 | 211 | } |
| 173 | 212 | if (!isset($spotter_item['aircraft_shadow'])) { |
| 174 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 175 | - else { |
|
| 213 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 214 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 215 | + } else { |
|
| 176 | 216 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 177 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 178 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 217 | + if (count($aircraft_info) > 0) { |
|
| 218 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 219 | + } else { |
|
| 220 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 221 | + } |
|
| 179 | 222 | } |
| 180 | 223 | } |
| 181 | 224 | if ($spotter_item['aircraft_shadow'] == '') { |
| 182 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 183 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 225 | + if ($compress) { |
|
| 226 | + $output .= '"as": "default.png",'; |
|
| 227 | + } else { |
|
| 228 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 229 | + } |
|
| 184 | 230 | } else { |
| 185 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 186 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 231 | + if ($compress) { |
|
| 232 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 233 | + } else { |
|
| 234 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 235 | + } |
|
| 187 | 236 | } |
| 188 | 237 | if (isset($spotter_item['airline_name'])) { |
| 189 | 238 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -191,8 +240,11 @@ discard block |
||
| 191 | 240 | $output .= '"airline_name": "NA",'; |
| 192 | 241 | } |
| 193 | 242 | if (isset($spotter_item['departure_airport'])) { |
| 194 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 195 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 243 | + if ($compress) { |
|
| 244 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
| 245 | + } else { |
|
| 246 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
| 247 | + } |
|
| 196 | 248 | } |
| 197 | 249 | if (isset($spotter_item['departure_airport_city'])) { |
| 198 | 250 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -204,8 +256,11 @@ discard block |
||
| 204 | 256 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
| 205 | 257 | } |
| 206 | 258 | if (isset($spotter_item['arrival_airport'])) { |
| 207 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 208 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 259 | + if ($compress) { |
|
| 260 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
| 261 | + } else { |
|
| 262 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
| 263 | + } |
|
| 209 | 264 | } |
| 210 | 265 | if (isset($spotter_item['arrival_airport_city'])) { |
| 211 | 266 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -223,18 +278,29 @@ discard block |
||
| 223 | 278 | $output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",'; |
| 224 | 279 | } |
| 225 | 280 | |
| 226 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 227 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 228 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 229 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 281 | + if ($compress) { |
|
| 282 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
| 283 | + } else { |
|
| 284 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
| 285 | + } |
|
| 286 | + if ($compress) { |
|
| 287 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
| 288 | + } else { |
|
| 289 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
| 290 | + } |
|
| 230 | 291 | |
| 231 | - if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
| 232 | - else $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
| 292 | + if (isset($archivespeed)) { |
|
| 293 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
| 294 | + } else { |
|
| 295 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
| 296 | + } |
|
| 233 | 297 | //$output .= '"nextlatitude": "'.$nextcoord['latitude'].'",'; |
| 234 | 298 | //$output .= '"nextlongitude": "'.$nextcoord['longitude'].'",'; |
| 235 | 299 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 236 | 300 | |
| 237 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
| 301 | + if (!$min) { |
|
| 302 | + $output .= '"image": "'.$image.'",'; |
|
| 303 | + } |
|
| 238 | 304 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 239 | 305 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
| 240 | 306 | } |
@@ -242,8 +308,11 @@ discard block |
||
| 242 | 308 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
| 243 | 309 | } |
| 244 | 310 | if (isset($spotter_item['squawk'])) { |
| 245 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 246 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 311 | + if ($compress) { |
|
| 312 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
| 313 | + } else { |
|
| 314 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
| 315 | + } |
|
| 247 | 316 | } |
| 248 | 317 | if (isset($spotter_item['squawk_usage'])) { |
| 249 | 318 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -277,8 +346,11 @@ discard block |
||
| 277 | 346 | |
| 278 | 347 | |
| 279 | 348 | // FIXME : type when not aircraft ? |
| 280 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 281 | - else $output .= '"type": "aircraft"'; |
|
| 349 | + if ($compress) { |
|
| 350 | + $output .= '"t": "aircraft"'; |
|
| 351 | + } else { |
|
| 352 | + $output .= '"type": "aircraft"'; |
|
| 353 | + } |
|
| 282 | 354 | $output .= '},'; |
| 283 | 355 | $output .= '"geometry": {'; |
| 284 | 356 | $output .= '"type": "MultiPoint",'; |
@@ -298,7 +370,9 @@ discard block |
||
| 298 | 370 | $output .= ']'; |
| 299 | 371 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 300 | 372 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 301 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 373 | + if (isset($begindate)) { |
|
| 374 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 375 | + } |
|
| 302 | 376 | $output .= '"fc": "'.$flightcnt.'"'; |
| 303 | 377 | } else { |
| 304 | 378 | $output .= '"features": '; |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | $from_archive = false; |
| 11 | 11 | if (isset($_GET['ident'])) { |
| 12 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 12 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 13 | 13 | if (isset($_GET['currenttime'])) { |
| 14 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
| 15 | 15 | $currenttime = round($currenttime/1000); |
| 16 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime); |
|
| 16 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime); |
|
| 17 | 17 | } else { |
| 18 | 18 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
| 19 | 19 | if (empty($spotter_array)) { |
@@ -23,11 +23,11 @@ discard block |
||
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | if (isset($_GET['flightaware_id'])) { |
| 26 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 26 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 27 | 27 | if (isset($_GET['currenttime'])) { |
| 28 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
| 28 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
| 29 | 29 | $currenttime = round($currenttime/1000); |
| 30 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime); |
|
| 30 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime); |
|
| 31 | 31 | } else { |
| 32 | 32 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
| 33 | 33 | if (empty($spotter_array)) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
| 46 | 46 | { |
| 47 | 47 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
| 48 | - $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 48 | + $image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 49 | 49 | } else $image = $spotter_item['image_thumbnail']; |
| 50 | 50 | |
| 51 | 51 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
| 64 | 64 | if (isset($spotter_item['departure_airport_time'])) { |
| 65 | 65 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 66 | - print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>'; |
|
| 66 | + print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>'; |
|
| 67 | 67 | } else { |
| 68 | 68 | print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>'; |
| 69 | 69 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country']; |
| 73 | 73 | if (isset($spotter_item['arrival_airport_time'])) { |
| 74 | 74 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 75 | - print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>'; |
|
| 75 | + print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>'; |
|
| 76 | 76 | } else { |
| 77 | 77 | print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>'; |
| 78 | 78 | } |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | if (isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
| 137 | 137 | if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
| 138 | -if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
| 138 | +if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br/>', $spotter_item['acars']['message'])).'</div>'; |
|
| 139 | 139 | if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
| 140 | 140 | print '</div>'; |
| 141 | 141 | ?> |
@@ -46,7 +46,9 @@ discard block |
||
| 46 | 46 | { |
| 47 | 47 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
| 48 | 48 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 49 | - } else $image = $spotter_item['image_thumbnail']; |
|
| 49 | + } else { |
|
| 50 | + $image = $spotter_item['image_thumbnail']; |
|
| 51 | + } |
|
| 50 | 52 | |
| 51 | 53 | } |
| 52 | 54 | /* else { |
@@ -58,7 +60,9 @@ discard block |
||
| 58 | 60 | print '<div class="left"><img src="'.$image.'" alt="'.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].'" title="'.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' Image © '.$spotter_item['image_copyright'].'"/><br />Image © '.$spotter_item['image_copyright'].'</div>'; |
| 59 | 61 | } |
| 60 | 62 | print '<div class="right"><div class="callsign-details"><div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
| 61 | -if (isset($spotter_item['airline_name'])) print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
| 63 | +if (isset($spotter_item['airline_name'])) { |
|
| 64 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
| 65 | +} |
|
| 62 | 66 | print '</div>'; |
| 63 | 67 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
| 64 | 68 | if (isset($spotter_item['departure_airport_time'])) { |
@@ -86,9 +90,14 @@ discard block |
||
| 86 | 90 | print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country']; |
| 87 | 91 | print '</div></div><div>'; |
| 88 | 92 | print '<span>'._("Aircraft").'</span>'; |
| 89 | -if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
| 90 | -if (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
| 91 | -else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
| 93 | +if (isset($spotter_item['aircraft_wiki'])) { |
|
| 94 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
| 95 | +} |
|
| 96 | +if (isset($spotter_item['aircraft_type'])) { |
|
| 97 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
| 98 | +} else { |
|
| 99 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
| 100 | +} |
|
| 92 | 101 | print '</div>'; |
| 93 | 102 | print '<div><span>'._("Altitude").'</span>'; |
| 94 | 103 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
@@ -97,7 +106,9 @@ discard block |
||
| 97 | 106 | print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
| 98 | 107 | } |
| 99 | 108 | print '</div>'; |
| 100 | -if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
| 109 | +if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
| 110 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
| 111 | +} |
|
| 101 | 112 | print '<div><span>'._("Speed").'</span>'; |
| 102 | 113 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
| 103 | 114 | print round($spotter_item['ground_speed']*1.15078).' mph'; |
@@ -111,8 +122,11 @@ discard block |
||
| 111 | 122 | print '<div><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>'; |
| 112 | 123 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
| 113 | 124 | print '<div><span>'._("Pilot").'</span>'; |
| 114 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
| 115 | - else print $spotter_item['pilot_name']; |
|
| 125 | + if (isset($spotter_item['pilot_id'])) { |
|
| 126 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
| 127 | + } else { |
|
| 128 | + print $spotter_item['pilot_name']; |
|
| 129 | + } |
|
| 116 | 130 | print '</div>'; |
| 117 | 131 | } |
| 118 | 132 | |
@@ -133,10 +147,18 @@ discard block |
||
| 133 | 147 | } |
| 134 | 148 | print '</div>'; |
| 135 | 149 | |
| 136 | -if (isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
| 137 | -if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
| 138 | -if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
| 139 | -if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
| 150 | +if (isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') { |
|
| 151 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
| 152 | +} |
|
| 153 | +if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
| 154 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
| 155 | +} |
|
| 156 | +if (isset($spotter_item['acars']['message'])) { |
|
| 157 | + print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
| 158 | +} |
|
| 159 | +if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
| 160 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
| 161 | +} |
|
| 140 | 162 | print '</div>'; |
| 141 | 163 | ?> |
| 142 | 164 | </div> |
@@ -40,21 +40,40 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | header('Content-Type: text/javascript'); |
| 42 | 42 | |
| 43 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 44 | -else $compress = $globalJsonCompress; |
|
| 43 | +if (!isset($globalJsonCompress)) { |
|
| 44 | + $compress = true; |
|
| 45 | +} else { |
|
| 46 | + $compress = $globalJsonCompress; |
|
| 47 | +} |
|
| 45 | 48 | |
| 46 | 49 | $from_archive = false; |
| 47 | 50 | $min = false; |
| 48 | 51 | $allhistory = false; |
| 49 | 52 | $filter['source'] = array(); |
| 50 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 51 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 52 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 53 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 54 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 55 | -if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 56 | -if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 57 | -if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') $filter['airlinestype'] = $_COOKIE['airlinestype']; |
|
| 53 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') { |
|
| 54 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 55 | +} |
|
| 56 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') { |
|
| 57 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 58 | +} |
|
| 59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') { |
|
| 60 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 61 | +} |
|
| 62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') { |
|
| 63 | + $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 64 | +} |
|
| 65 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') { |
|
| 66 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 67 | +} |
|
| 68 | +if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') { |
|
| 69 | + $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 70 | +} |
|
| 71 | +if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') { |
|
| 72 | + $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 73 | +} |
|
| 74 | +if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') { |
|
| 75 | + $filter['airlinestype'] = $_COOKIE['airlinestype']; |
|
| 76 | +} |
|
| 58 | 77 | /* |
| 59 | 78 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 60 | 79 | $min = true; |
@@ -105,8 +124,12 @@ discard block |
||
| 105 | 124 | } else { |
| 106 | 125 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 107 | 126 | } |
| 108 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 109 | -} else $flightcnt = 0; |
|
| 127 | + if ($flightcnt == '') { |
|
| 128 | + $flightcnt = 0; |
|
| 129 | + } |
|
| 130 | + } else { |
|
| 131 | + $flightcnt = 0; |
|
| 132 | +} |
|
| 110 | 133 | |
| 111 | 134 | $sqltime = round(microtime(true)-$begintime,2); |
| 112 | 135 | $minitime = time(); |
@@ -263,8 +286,12 @@ discard block |
||
| 263 | 286 | } |
| 264 | 287 | } else { |
| 265 | 288 | $output .= '"model": {"gltf" : "/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
| 266 | - if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 267 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 289 | + if ($spotter_item['aircraft_shadow'] != '') { |
|
| 290 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 291 | + } |
|
| 292 | + if ($spotter_item['aircraft_icao'] != '') { |
|
| 293 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
| 294 | + } |
|
| 268 | 295 | } |
| 269 | 296 | $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
| 270 | 297 | $output .= '"position": {'; |
@@ -273,7 +300,9 @@ discard block |
||
| 273 | 300 | // $output .= '"interpolationDegree" : 5,'; |
| 274 | 301 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
| 275 | 302 | $output .= '"cartographicDegrees": ['; |
| 276 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
| 303 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
| 304 | + $minitime = strtotime($spotter_item['date']); |
|
| 305 | + } |
|
| 277 | 306 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
| 278 | 307 | $output .= $spotter_item['longitude'].', '; |
| 279 | 308 | $output .= $spotter_item['latitude'].', '; |
@@ -13,30 +13,30 @@ discard block |
||
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | function quaternionrotate($heading, $attitude = 0, $bank = 0) { |
| 16 | - // Assuming the angles are in radians. |
|
| 17 | - $c1 = cos($heading/2); |
|
| 18 | - $s1 = sin($heading/2); |
|
| 19 | - $c2 = cos($attitude/2); |
|
| 20 | - $s2 = sin($attitude/2); |
|
| 21 | - $c3 = cos($bank/2); |
|
| 22 | - $s3 = sin($bank/2); |
|
| 23 | - $c1c2 = $c1*$c2; |
|
| 24 | - $s1s2 = $s1*$s2; |
|
| 25 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 26 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 27 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 28 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 29 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 16 | + // Assuming the angles are in radians. |
|
| 17 | + $c1 = cos($heading/2); |
|
| 18 | + $s1 = sin($heading/2); |
|
| 19 | + $c2 = cos($attitude/2); |
|
| 20 | + $s2 = sin($attitude/2); |
|
| 21 | + $c3 = cos($bank/2); |
|
| 22 | + $s3 = sin($bank/2); |
|
| 23 | + $c1c2 = $c1*$c2; |
|
| 24 | + $s1s2 = $s1*$s2; |
|
| 25 | + $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 26 | + $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 27 | + $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 28 | + $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 29 | + return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 30 | 30 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | if (isset($_GET['download'])) { |
| 36 | - if ($_GET['download'] == "true") |
|
| 37 | - { |
|
| 36 | + if ($_GET['download'] == "true") |
|
| 37 | + { |
|
| 38 | 38 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
| 39 | - } |
|
| 39 | + } |
|
| 40 | 40 | } |
| 41 | 41 | header('Content-Type: text/javascript'); |
| 42 | 42 | |
@@ -188,78 +188,78 @@ discard block |
||
| 188 | 188 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20 },'; |
| 189 | 189 | } elseif ($spotter_item['engine_type'] == 'Jet') { |
| 190 | 190 | if ($spotter_item['engine_count'] == '1') { |
| 191 | - if ($spotter_item['wake_category'] == 'M') { |
|
| 191 | + if ($spotter_item['wake_category'] == 'M') { |
|
| 192 | 192 | $model = 'J1M'; |
| 193 | - } elseif ($spotter_item['wake_category'] == 'L') { |
|
| 193 | + } elseif ($spotter_item['wake_category'] == 'L') { |
|
| 194 | 194 | $model = ''; |
| 195 | - } |
|
| 195 | + } |
|
| 196 | 196 | } elseif ($spotter_item['engine_count'] == '2') { |
| 197 | - if ($spotter_item['wake_category'] == 'M') { |
|
| 197 | + if ($spotter_item['wake_category'] == 'M') { |
|
| 198 | 198 | $model = 'J2M'; |
| 199 | - } elseif ($spotter_item['wake_category'] == 'H') { |
|
| 199 | + } elseif ($spotter_item['wake_category'] == 'H') { |
|
| 200 | 200 | $model = 'J2H'; |
| 201 | - } elseif ($spotter_item['wake_category'] == 'L') { |
|
| 201 | + } elseif ($spotter_item['wake_category'] == 'L') { |
|
| 202 | 202 | $model = 'J2L'; |
| 203 | - } |
|
| 203 | + } |
|
| 204 | 204 | } elseif ($spotter_item['engine_count'] == '3') { |
| 205 | - if ($spotter_item['wake_category'] == 'M') { |
|
| 205 | + if ($spotter_item['wake_category'] == 'M') { |
|
| 206 | 206 | $model = 'J3M'; |
| 207 | - } elseif ($spotter_item['wake_category'] == 'H') { |
|
| 207 | + } elseif ($spotter_item['wake_category'] == 'H') { |
|
| 208 | 208 | $model = 'J3H'; |
| 209 | - } |
|
| 209 | + } |
|
| 210 | 210 | } elseif ($spotter_item['engine_count'] == '4') { |
| 211 | - if ($spotter_item['wake_category'] == 'M') { |
|
| 211 | + if ($spotter_item['wake_category'] == 'M') { |
|
| 212 | 212 | $model = 'J4M'; |
| 213 | - } elseif ($spotter_item['wake_category'] == 'H') { |
|
| 213 | + } elseif ($spotter_item['wake_category'] == 'H') { |
|
| 214 | 214 | $model = 'J4H'; |
| 215 | - } |
|
| 215 | + } |
|
| 216 | 216 | } |
| 217 | 217 | if (isset($modelsdb[$model])) { |
| 218 | - $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 218 | + $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 219 | 219 | } else { |
| 220 | - $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 220 | + $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 221 | 221 | } |
| 222 | 222 | } elseif ($spotter_item['engine_type'] == 'Turboprop') { |
| 223 | 223 | if ($spotter_item['engine_count'] == '1') { |
| 224 | - if ($spotter_item['wake_category'] == 'L') { |
|
| 224 | + if ($spotter_item['wake_category'] == 'L') { |
|
| 225 | 225 | $model = 'T1L'; |
| 226 | - } |
|
| 226 | + } |
|
| 227 | 227 | } elseif ($spotter_item['engine_count'] == '2') { |
| 228 | - if ($spotter_item['wake_category'] == 'M') { |
|
| 228 | + if ($spotter_item['wake_category'] == 'M') { |
|
| 229 | 229 | $model = 'T2M'; |
| 230 | - } elseif ($spotter_item['wake_category'] == 'L') { |
|
| 230 | + } elseif ($spotter_item['wake_category'] == 'L') { |
|
| 231 | 231 | $model = 'T2L'; |
| 232 | - } |
|
| 232 | + } |
|
| 233 | 233 | } elseif ($spotter_item['engine_count'] == '4') { |
| 234 | - if ($spotter_item['wake_category'] == 'M') { |
|
| 235 | - } elseif ($spotter_item['wake_category'] == 'H') { |
|
| 234 | + if ($spotter_item['wake_category'] == 'M') { |
|
| 235 | + } elseif ($spotter_item['wake_category'] == 'H') { |
|
| 236 | 236 | $model = 'T4H'; |
| 237 | - } |
|
| 237 | + } |
|
| 238 | 238 | } |
| 239 | 239 | if (isset($modelsdb[$model])) { |
| 240 | - $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 240 | + $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 241 | 241 | } else { |
| 242 | - $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 242 | + $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 243 | 243 | } |
| 244 | 244 | } elseif ($spotter_item['engine_type'] == 'Piston') { |
| 245 | 245 | if ($spotter_item['engine_count'] == '1') { |
| 246 | - if ($spotter_item['wake_category'] == 'L') { |
|
| 246 | + if ($spotter_item['wake_category'] == 'L') { |
|
| 247 | 247 | $model = 'P1L'; |
| 248 | - } elseif ($spotter_item['wake_category'] == 'M') { |
|
| 248 | + } elseif ($spotter_item['wake_category'] == 'M') { |
|
| 249 | 249 | $model = 'P1M'; |
| 250 | - } |
|
| 250 | + } |
|
| 251 | 251 | } elseif ($spotter_item['engine_count'] == '2') { |
| 252 | - if ($spotter_item['wake_category'] == 'M') { |
|
| 252 | + if ($spotter_item['wake_category'] == 'M') { |
|
| 253 | 253 | $model = 'P2M'; |
| 254 | - } elseif ($spotter_item['wake_category'] == 'L') { |
|
| 254 | + } elseif ($spotter_item['wake_category'] == 'L') { |
|
| 255 | 255 | $model = 'P2L'; |
| 256 | - } |
|
| 256 | + } |
|
| 257 | 257 | // ju52 = P3M |
| 258 | 258 | } |
| 259 | 259 | if (isset($modelsdb[$model])) { |
| 260 | - $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 260 | + $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$model].'","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 261 | 261 | } else { |
| 262 | - $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 262 | + $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
|
| 263 | 263 | } |
| 264 | 264 | } else { |
| 265 | 265 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },'; |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | $s3 = sin($bank/2); |
| 23 | 23 | $c1c2 = $c1*$c2; |
| 24 | 24 | $s1s2 = $s1*$s2; |
| 25 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
| 26 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
| 27 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 28 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 29 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
| 25 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
| 26 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
| 27 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
| 28 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
| 29 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
| 30 | 30 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
| 31 | 31 | |
| 32 | 32 | } |
@@ -47,13 +47,13 @@ discard block |
||
| 47 | 47 | $min = false; |
| 48 | 48 | $allhistory = false; |
| 49 | 49 | $filter['source'] = array(); |
| 50 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 51 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 52 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 53 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
| 54 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 55 | -if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',',$_COOKIE['Airlines']); |
|
| 56 | -if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',',$_COOKIE['Sources']); |
|
| 50 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 51 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 52 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 53 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs')); |
|
| 54 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 55 | +if (isset($_COOKIE['Airlines']) && $_COOKIE['Airlines'] != '') $filter['airlines'] = explode(',', $_COOKIE['Airlines']); |
|
| 56 | +if (isset($_COOKIE['Sources']) && $_COOKIE['Sources'] != '') $filter['source_aprs'] = explode(',', $_COOKIE['Sources']); |
|
| 57 | 57 | if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] != 'all') $filter['airlinestype'] = $_COOKIE['airlinestype']; |
| 58 | 58 | /* |
| 59 | 59 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
@@ -101,22 +101,22 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | if (!empty($spotter_array)) { |
| 103 | 103 | if (isset($_GET['archive'])) { |
| 104 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 104 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 105 | 105 | } else { |
| 106 | 106 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
| 107 | 107 | } |
| 108 | 108 | if ($flightcnt == '') $flightcnt = 0; |
| 109 | 109 | } else $flightcnt = 0; |
| 110 | 110 | |
| 111 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 111 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 112 | 112 | $minitime = time(); |
| 113 | 113 | |
| 114 | 114 | |
| 115 | 115 | $modelsdb = array(); |
| 116 | 116 | if (file_exists('models/modelsdb')) { |
| 117 | - if (($handle = fopen('models/modelsdb','r')) !== FALSE) { |
|
| 118 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
| 119 | - if (isset($row[1]) ){ |
|
| 117 | + if (($handle = fopen('models/modelsdb', 'r')) !== FALSE) { |
|
| 118 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
| 119 | + if (isset($row[1])) { |
|
| 120 | 120 | $model = $row[0]; |
| 121 | 121 | $modelsdb[$model] = $row[1]; |
| 122 | 122 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | $output .= '},'; |
| 140 | 140 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 141 | 141 | { |
| 142 | - foreach($spotter_array as $spotter_item) |
|
| 142 | + foreach ($spotter_array as $spotter_item) |
|
| 143 | 143 | { |
| 144 | 144 | $j++; |
| 145 | 145 | date_default_timezone_set('UTC'); |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
| 275 | 275 | $output .= '"cartographicDegrees": ['; |
| 276 | 276 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
| 277 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 277 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 278 | 278 | $output .= $spotter_item['longitude'].', '; |
| 279 | 279 | $output .= $spotter_item['latitude'].', '; |
| 280 | 280 | $prevlong = $spotter_item['longitude']; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
| 287 | 287 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
| 288 | 288 | } else { |
| 289 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
| 289 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
| 290 | 290 | if ($spotter_item['ground_speed'] == 0) { |
| 291 | 291 | $output .= $prevlong.', '; |
| 292 | 292 | $output .= $prevlat.', '; |
@@ -314,6 +314,6 @@ discard block |
||
| 314 | 314 | $output = substr($output, 0, -1); |
| 315 | 315 | } |
| 316 | 316 | $output .= ']'; |
| 317 | -$output = str_replace('%minitime%',date("c",$minitime),$output); |
|
| 317 | +$output = str_replace('%minitime%', date("c", $minitime), $output); |
|
| 318 | 318 | print $output; |
| 319 | 319 | ?> |