Skip to content

Commit

Permalink
🤡 No idea what these stuffs are
Browse files Browse the repository at this point in the history
  • Loading branch information
donatmarko committed Dec 25, 2019
1 parent 03e3355 commit b0ea1a8
Show file tree
Hide file tree
Showing 13 changed files with 284 additions and 189 deletions.
26 changes: 2 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,24 +1,2 @@
/bootstrap/compiled.php
/vendor

/build/logs
/build/coverage

/app/tests/_log

composer.phar

.DS_Store

/.idea
/_ide_helper.php

/app/config/packages
/public/packages

/node_modules

.env
.htpasswd

config-inc.php
config-inc.php
node_modules
17 changes: 6 additions & 11 deletions cronjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

include('config-inc.php');
require 'classes/whazzup.php';
$wz = new Whazzup('https://ivao.donatus.hu/whazzup.json.txt', true);
$wz = new Whazzup('https://api.donatus.hu/oavi/json/whazzup.json', true);

$sql = new mysqli($sql_server, $sql_username, $sql_password, $sql_database);
//$sql->autocommit(FALSE);
Expand Down Expand Up @@ -35,7 +35,7 @@
];
}

$stmt_atc_i = $sql->prepare("INSERT INTO atcs (callsign, vid, rating, status, latitude, longitude, server, protocol, software, connected_at, frequency, radar_range, atis, atis_time, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())");
$stmt_atc_i = $sql->prepare("INSERT INTO atcs (callsign, vid, rating, status, latitude, longitude, server, protocol, software, connected_at, frequency, radar_range, atis, atis_time, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())");
$stmt_atc_u = $sql->prepare("UPDATE atcs SET latitude=?, longitude=?, frequency=?, radar_range=?, atis=?, atis_time=?, updated_at=now() WHERE callsign=? AND connected_at=?");

$stmt_pilot_i = $sql->prepare("INSERT INTO pilots (callsign, vid, rating, status, latitude, longitude, server, protocol, software, connected_at, heading, on_ground, altitude, groundspeed, mode_a, fp_aircraft, fp_speed, fp_rfl, fp_departure, fp_destination, fp_alternate, fp_alternate2, fp_type, fp_pob, fp_route, fp_item18, fp_rev, fp_rule, fp_deptime, fp_eet, fp_endurance, sim_type, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())");
Expand Down Expand Up @@ -104,9 +104,8 @@
'name' => $mail_fromName,
'email' => $mail_fromEmail
],
'to' => $mail_toEmail,
'cc' => 'srta14@ivao.aero',
'subject' => '[IVAO-HU] Non-validated KFOR controller online',
'to' => $mail_toEmail,
'subject' => '[oavi] Non-validated KFOR controller online',
'body' => Common::JsonToTable(json_encode($atc)) . "<p>Mail sent automatically, do not reply</p>"
])
]);
Expand All @@ -119,10 +118,8 @@
{
if (array_key_exists($pilot['callsign'], $alreadyOnlines))
{
$stmt_pilot_u = $sql->prepare("UPDATE pilots SET latitude=?, longitude=?, heading=?, on_ground=?, altitude=?, groundspeed=?, mode_a=?, fp_aircraft=?, fp_speed=?, fp_rfl=?, fp_departure=?, fp_destination=?, fp_alternate=?, fp_alternate2=?, fp_type=?, fp_pob=?, fp_route=?, fp_item18=?, fp_rev=?, fp_rule=?, fp_deptime=?, fp_eet=?, fp_endurance=?, updated_at=now() WHERE callsign=? AND connected_at=?");

// if user is already online, we're updating its details
$stmt_pilot_u->bind_param('ddiiiiisssssssssssissiiss',
$stmt_pilot_u->bind_param('ddiiiiissssssssississiiss',
$pilot['latitude'],
$pilot['longitude'],
$pilot['heading'],
Expand Down Expand Up @@ -157,9 +154,7 @@
}
else
{
$stmt_pilot_i = $sql->prepare("INSERT INTO pilots (callsign, vid, rating, status, latitude, longitude, server, protocol, software, connected_at, heading, on_ground, altitude, groundspeed, mode_a, fp_aircraft, fp_speed, fp_rfl, fp_departure, fp_destination, fp_alternate, fp_alternate2, fp_type, fp_pob, fp_route, fp_item18, fp_rev, fp_rule, fp_deptime, fp_eet, fp_endurance, sim_type, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())");

$stmt_pilot_i->bind_param('sissddssssiiiiisssssssississiiss',
$stmt_pilot_i->bind_param('sissddssssiiiiissssssssissisiiis',
$pilot['callsign'],
$pilot['vid'],
$pilot['rating'],
Expand Down
34 changes: 18 additions & 16 deletions get.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,29 @@
// ONLINE sessions
if ($type == 1)
{
$wz = new Whazzup('https://ivao.donatus.hu/whazzup.json.txt', true);
$wz = new Whazzup('https://api.donatus.hu/oavi/whazzup.txt', false);
$result = [];

foreach ($wz->GetAll() as $client)
// if filtered to a specific member or session
if ($vid || $callsign)
{
if ($vid)
foreach ($wz->GetAll() as $client)
{
if ($client["vid"] == $vid)
$result[] = $client;
}
if ($callsign)
{
if ($client["callsign"] == $callsign)
$result[] = $client;
if ($vid)
{
if ($client["vid"] == $vid)
$result[] = $client;
}
if ($callsign)
{
if ($client["callsign"] == $callsign)
$result[] = $client;
}
}
}

if (count($result) == 1)
echo json_encode($result[0]);
else
echo json_encode($result);
}
else // if we like to return every online member
echo json_encode($wz->GetAll());
}

// TRACKED sessions
Expand All @@ -60,7 +62,7 @@
$sessions = [];
$airports = [];

$queryPilot = 'SELECT "PILOT" AS type, id, callsign, vid, rating, server, software, connected_at, disconnected_at, mode_a, fp_aircraft, fp_speed, fp_rfl, fp_departure, fp_destination, fp_alternate, fp_alternate2, fp_type, fp_pob, fp_route, fp_item18, fp_rule, fp_deptime, fp_eet, fp_endurance, sim_type, updated_at FROM pilots';
$queryPilot = 'SELECT "PILOT" AS type, id, callsign, vid, rating, server, software, connected_at, disconnected_at, latitude, longitude, altitude, groundspeed, mode_a, fp_aircraft, fp_speed, fp_rfl, fp_departure, fp_destination, fp_alternate, fp_alternate2, fp_type, fp_pob, fp_route, fp_item18, fp_rule, fp_deptime, fp_eet, fp_endurance, sim_type, updated_at FROM pilots';
$queryATC = 'SELECT "ATC" AS type, id, callsign, vid, rating, server, software, connected_at, disconnected_at, latitude, longitude, radar_range, frequency, atis, updated_at FROM atcs';

if ($id && $client !== null)
Expand Down
Binary file added img/plane/plane.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/plane/plane24x24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/plane/plane33x33.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/plane/plane50x50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 6 additions & 23 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<link rel="stylesheet" href="node_modules/sidebar-v2/css/leaflet-sidebar.min.css">
<link rel="stylesheet" href="node_modules/@fortawesome/fontawesome-free/css/all.min.css">
<link rel="stylesheet" href="css/style.css">
<title>IVAO-HU Tracker</title>
<title>IVAO Better Tracker</title>
</head>
<body>
Expand Down Expand Up @@ -70,7 +70,7 @@
<h1 class="sidebar-header">Info<span class="sidebar-close"><i class="fas fa-caret-left"></i></span></h1>
<div style="text-align: center; margin-top: 1rem">
<h2>IVAO Hungary Tracker</h2>
<h2>IVAO Better Tracker</h2>
developed by Donat Marko
</div>
</div>
Expand All @@ -79,34 +79,16 @@
<div id="map" class="sidebar-map"></div>
<div class="modal fade" id="modalFlight" tabindex="-1" role="dialog">
<div class="modal fade" id="modalSession" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">Pilot session #<span id="txtPilotId"></span></h5>
<h5 class="modal-title" id="txtSessionId"></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div id="contentFlight"></div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="modalATC" tabindex="-1" role="dialog">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">ATC session #<span id="txtATCId"></span></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div id="contentATC"></div>
</div>
<div class="modal-body" id="contentSession"></div>
</div>
</div>
</div>
Expand All @@ -119,6 +101,7 @@
<script src="node_modules/leaflet-arc/bin/leaflet-arc.min.js"></script>
<script src="node_modules/sidebar-v2/js/leaflet-sidebar.min.js"></script>
<script src="node_modules/js-cookie/src/js.cookie.js"></script>
<script src="node_modules/leaflet-rotatedmarker/leaflet.rotatedMarker.js"></script>
<script src="js/main.js"></script>
<script src="js/tracker.js"></script>
</body>
Expand Down
50 changes: 49 additions & 1 deletion js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,52 @@ $(document).ajaxStart(function() {
$(document).ajaxComplete(function() {
$(".loader").hide();
$('[data-toggle="tooltip"]').tooltip();
});
});

var iconPlane = L.icon({
iconUrl: 'img/plane/plane24x24.png',
iconSize: [24, 24]
});
var onlineElems = [];
var elements = [];
var airportIcon = L.divIcon({className: 'fas fa-map-marker-alt'});
var map = L.map('map', {
center: getMapCenter(),
zoom: getMapZoom(),
worldCopyJump: true,
minZoom: 3,
});
map.on('moveend', mapStateSave);
map.on('zoomend', mapStateSave);
L.tileLayer('https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>'
}).addTo(map);
var sidebar = L.control.sidebar('sidebar').addTo(map);

function getMapCenter()
{
if (!Cookies.get("lat") || !Cookies.get("lon"))
{
Cookies.set("zoom", 5);
Cookies.set("lat", 47);
Cookies.set("lon", 15);
}
console.log("Map center loaded.");
return [Cookies.get("lat"), Cookies.get("lon")];
}

function getMapZoom()
{
if (!Cookies.get("zoom"))
Cookies.set("zoom", 5);
console.log("Map zoom loaded.");
return Cookies.get("zoom");
}

function mapStateSave(e)
{
Cookies.set("zoom", e.target.getZoom());
Cookies.set("lat", e.target.getCenter().lat);
Cookies.set("lon", e.target.getCenter().lng);
console.log("Map settings saved.");
}
Loading

0 comments on commit b0ea1a8

Please sign in to comment.