Skip to content
This repository has been archived by the owner on Oct 20, 2024. It is now read-only.

Remove/download whazzup #113

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion app/Http/Controllers/GithubController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,14 @@ public function send_issue(Request $request){
/** Send issue to github on the repo alexcaussades/l10 is token is valid*/

$users = new UsersController();
$user = $users->get_info_user($request->user_id);

$user = $users->get_info_user($request->user_id);
if(!$user){
$users = [
"name" => "Anonymous",
"vid" => "Anonymous"
];
}
$issue = Http::withToken($this->token())->post($this->url_issue(), [
"title" => "Feedback from: " . $user->name . " (VID: ".$user->vid.")",
"body" => $request->body,
Expand Down
16 changes: 8 additions & 8 deletions app/Http/Controllers/chartIvaoFRcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
class chartIvaoFRcontroller extends Controller
{
public function strcture($ivao){
$ccr = substr($ivao, 0, -1);
$ccr_search = str_split($ccr);
$new_icao = $ccr_search[0].$ccr_search[1].$ccr_search[2].$ccr_search[2];
$new_icao = strtolower($new_icao);
$whazzup = new whazzupController();
$prepare_icao = $whazzup->get_airport($ivao);
$new_icao = strtolower($prepare_icao["centerId"]);

$r =[
"new_icao" => $new_icao,
"ivao" => $ivao,
"info" => $prepare_icao,
];
return $r;
}
Expand All @@ -32,10 +32,10 @@ public function chart_ivao($ivao){
}

public function structure_CCR($ccr){
$ccr_search = str_split($ccr);
$new_icao = $ccr_search[0].$ccr_search[1].$ccr_search[2].$ccr_search[2];
$new_icao = strtolower($new_icao);
$icaoUpper = strtoupper($new_icao);
$whazzup = new whazzupController();
$prepare_icao = $whazzup->get_center($ccr);
$new_icao = strtolower($prepare_icao["id"]);
$icaoUpper = strtoupper($prepare_icao["id"]);

$r =[
"new_icao" => $new_icao,
Expand Down
78 changes: 31 additions & 47 deletions app/Http/Controllers/myOnlineServeurController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,28 @@ public function get_whazzup()
return $whazzup->json();
}

public function VerrifOnlineServeur()
public function VerrifOnlineServeur($vid)
{
$whazzup = new whazzupController();
$whazzup = $whazzup->whazzup_api_traker();
$review = $whazzup;
$json = collect($review);
$atcs = collect($json['clients']['atcs']);
$pilots = collect($json['clients']['pilots']);
/** search the informations */
$atcs = $atcs->whereIn('userId', $this->vid);
$pilots = $pilots->whereIn('userId', $this->vid);
$atcs = $atcs->toArray();
$pilots = $pilots->toArray();
/** joker dans la recherhe index */
$atcs = array_values($atcs) ?? null;
$pilots = array_values($pilots) ?? null;
$u = collect(["atc" => $atcs, "pilot" => $pilots]);
$p = $whazzup->Get_Position_pilote($vid);
$atc = $whazzup->Get_Position($vid);
$u = [
"pilot" => $p,
"atc" => $atc
];
return $u;
}

public function getVerrifOnlineServeur()
{
$q = $this->VerrifOnlineServeur();
$q = $this->VerrifOnlineServeur($this->vid);
$whazzupp = new whazzupController();
$chartIvaoFRcontroller = new chartIvaoFRcontroller();
$chartController = new CarteSIAController();
//dd($q);
if ($q['atc'] != null) {

if ($q['atc'][0]['atcSession']['position'] == "CTR") {
if ($q['atc']['atcSession']['position'] == "CTR") {
$ivao_session = $whazzupp->track_session_id($q['atc'][0]['id']);
$ivao_session_decode = json_decode($ivao_session, true);
$time = Carbon::parse($ivao_session_decode["time"])->format('H:i');
Expand All @@ -71,7 +64,7 @@ public function getVerrifOnlineServeur()
$new_ccr = $ident[0];
$ident[0] = substr($ident[0], 0, -1);
$metar = $metar->getFirAtc($ident[0]);
$chart_crr = $chartIvaoFRcontroller->chart_ccr($new_ccr);
$chart_crr = $chartIvaoFRcontroller->chart_ccr($new_ccr);
$atc_online = [];
for ($i = 0; $i < count($metar); $i++) {
$atc_online[$i]["icao"] = $metar[$i][0]["callsign"];
Expand All @@ -97,21 +90,23 @@ public function getVerrifOnlineServeur()
"revision" => $q['atc'][0]['atis']['revision'],
];
return view("myoline.ccr", ["atc" => $atc, "atc_online" => $atc_online, "chart_crr" => $chart_crr]);

}
$ivao_session = $whazzupp->track_session_id($q['atc'][0]['id']);
$ivao_session = $whazzupp->track_session_id($q['atc']['id']);
$ivao_session_decode = json_decode($ivao_session, true);
//dd($ivao_session_decode);
$time = Carbon::parse($ivao_session_decode["time"])->format('H:i');
$new_icao = $ivao_session_decode['callsign'];
$new_icao = explode("_", $new_icao);
$new_icao = $new_icao[0];

$r = $whazzupp->get_rwy($new_icao);
$metar = $whazzupp->Get_metar($new_icao);
$taf = $whazzupp->Get_taf($new_icao);
$atc_online = $whazzupp->ckeck_online_atc($new_icao);
$chart_ivao = $chartIvaoFRcontroller->chart_ivao($new_icao);
$atis = $q['atc'][0]['atis']['lines'] ?? null;
$callsign = $q['atc'][0]['callsign'];
$atis = $whazzupp->get_atis_latest_2($ivao_session_decode["callsign"]);
$atis = json_decode($atis, true);
$callsign = $q['atc']['callsign'];
$callsign = explode("_", $callsign);
$callsign = $callsign[0];
$atc = [
Expand All @@ -120,7 +115,7 @@ public function getVerrifOnlineServeur()
"frequency" => $ivao_session_decode["atcSession"]['frequency'],
"rating" => $ivao_session_decode["user"]['rating']["atcRating"]["shortName"],
"time" => $time,
"revision" => $q['atc'][0]['atis']['revision'],
"revision" => $atis['revision'],
"atis" => $r,
"metar" => $metar['metar'],
"taf" => $taf['taf'],
Expand All @@ -143,18 +138,19 @@ public function getVerrifOnlineServeur()
]
];
return view("myoline.atc", ["atc" => $atc, "atis" => $atis, "plateform" => $plateform, "fly" => $fly, "chart_ivao" => $chart_ivao]);

} elseif ($q['pilot'] != null) {
$ivao_session = $whazzupp->track_session_id($q['pilot'][0]['id']);
//dd($q);
$ivao_session = $whazzupp->track_session_id($q['pilot']['id']);
$ivao_session_decode = json_decode($ivao_session, true);
$fp_session = $whazzupp->get_flightPlans($ivao_session_decode["id"]);
$fp_session = $fp_session[0];
//dd($fp_session);
$atc_online_departure = $whazzupp->ckeck_online_atc($fp_session['departureId']);
$atc_online_arrival = $whazzupp->ckeck_online_atc($fp_session['arrivalId']);
$q = $q['pilot'];
$distance_arrival = $q[0]['lastTrack']['arrivalDistance'] ?? null;
$distance_arrival = $q['lastTrack']['arrivalDistance'] ?? null;
$distance_arrival = explode(".", $distance_arrival);
$speed = $q[0]['lastTrack']['groundSpeed'] / 60 ?? 1;
$speed = $q['lastTrack']['groundSpeed'] / 60 ?? 1;
$metar_dep = $whazzupp->Get_metar($fp_session["departureId"]);
$metar_arr = $whazzupp->Get_metar($fp_session["arrivalId"]);
$taf_dep = $whazzupp->Get_taf($fp_session["departureId"]);
Expand All @@ -174,10 +170,10 @@ public function getVerrifOnlineServeur()
"callsign" => $ivao_session_decode['callsign'],
"id_session" => $ivao_session_decode['id'],
"lastTrack" => [
"altitude" => $q[0]['lastTrack']['altitude'],
"transponder" => $q[0]['lastTrack']['transponder'],
"altitude" => $q['lastTrack']['altitude'],
"transponder" => $q['lastTrack']['transponder'],
"arrivalDistance" => $distance_arrival[0],
"state" => $q[0]['lastTrack']['state'],
"state" => $q['lastTrack']['state'],
"time" => Carbon::parse($ivao_session_decode["time"])->format('H:i'),
],
"flightPlan" => [
Expand All @@ -192,13 +188,13 @@ public function getVerrifOnlineServeur()
"flightType" => $fp_session['flightType'],
"personsOnBoard" => $fp_session['peopleOnBoard'],
"departureTime" => Carbon::parse($fp_session['departureTime'])->format('H:i'),
"aircraftEquipments" => $q[0]['flightPlan']['aircraftEquipments'],
"aircraftTransponderTypes" => $q[0]['flightPlan']['aircraftTransponderTypes']
"aircraftEquipments" => $fp_session['aircraftEquipments'][0]["id"],
"aircraftTransponderTypes" => $fp_session['aircraftTransponderTypes'][0]["id"],
],
"arrival_time" => $arrival_time,
"distance_arrival" => $distance_arrival[0],
"aircraft" => $q[0]['flightPlan']['aircraft']['model'],
"wakeTurbulence" => $q[0]['flightPlan']['aircraft']['wakeTurbulence']
"aircraft" => $q['flightPlan']['aircraft']['model'],
"wakeTurbulence" => $q['flightPlan']['aircraft']['wakeTurbulence']
];
$atc = [
"depature" => [
Expand Down Expand Up @@ -235,17 +231,5 @@ public function getVerrifOnlineServeur()
}
}

public function check_online()
{
$q = $this->VerrifOnlineServeur();

if ($q["atc"] != null) {
return true;
} elseif ($q["pilot"] != null) {
return true;
} else {
return false;
}
}


}
61 changes: 57 additions & 4 deletions app/Http/Controllers/whazzupController.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,12 +281,39 @@ public function Get_taf($icao = null)
return $metar;
}

public function Get_Position($icao = null)
public function Get_Position($vid = "191514")
{
$metar = $this->API_request("v2/tracker/now/atc");
$p = json_decode($metar, true);
//in list of pilot search userId
foreach ($p as $pilot) {
if ($pilot["userId"] == $vid) {
$data = $pilot;
return $data;
}
}
}

public function Get_Position_old()
{
$metar = $this->API_request("v2/tracker/now/atc");
return $metar;
}

public function Get_Position_pilote($vid = "191514")
{
$metar = $this->API_request("v2/tracker/now/pilots");
$p = json_decode($metar, true);
//in list of pilot search userId
foreach ($p as $pilot) {
if ($pilot["userId"] == $vid) {
$data = $pilot;
return $data;
}
}

}

public function track_session_id($idsession = null)
{
$metar = $this->API_request("v2/tracker/sessions/" . $idsession);
Expand Down Expand Up @@ -374,12 +401,17 @@ public function get_traffics_count($icao = null)
return $metar->json();
}

public function get_atis_latest($icao = null)
public function get_atis_latest_2($icao = null)
{
$metar = $this->API_request("v2/ATCPositions/" . $icao . "/atis");
$metar = $this->API_request("v2/ATCPositions/" . $icao . "/atis/latest");
return $metar;
}

public function get_session_vid($vid = null)
{
$metar = $this->API_request("/v2/users/" . $vid);
return $metar->json();
}

public function whazzup_api_traker()
{
Expand Down Expand Up @@ -442,7 +474,7 @@ public function position_search($icao = null)
public function ckeck_online_atc($icao)
{
$act_possition = $this->position_search($icao);
$position = $this->Get_Position();
$position = $this->Get_Position_old();
$position = $position->json();
$position = collect($position);
$o = [];
Expand Down Expand Up @@ -571,10 +603,31 @@ public function creator()
return $creator;
}

public function get_airport_atc($icao)
{
$airport = $this->API_request("/v2/airports/" . $icao . "/ATCPositions");
$airport = $airport->json();
return $airport;
}

public function get_airport($icao)
{
$airport = $this->API_request("/v2/airports/" . $icao);
$airport = $airport->json();
return $airport;
}

public function get_center($icao)
{
$airport = $this->API_request("/v2/centers/" . $icao . "/subcenters");
$airport = $airport->json();
return $airport;

public function get_aircrafts($icao_code)
{
$aircrafts = $this->API_request("/v2/aircrafts/" . $icao_code);
$aircrafts = $aircrafts->json();
return $aircrafts;

}
}
30 changes: 29 additions & 1 deletion database/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
}
]
},
"4":{
"4":{
"id": 5,
"name": "2023 / 30",
"date": "2023-10-04",
Expand Down Expand Up @@ -134,6 +134,34 @@
"description": "Create CSS event Ximea"
}

]
},
"5":{
"id": 6,
"name": "2023 / 31",
"date": "2023-10-18",
"version": "26.2.2",
"option": [
{
"id": 0,
"type": "Change",
"btn": "success",
"description": "Update AIRAC 2311"
},
{
"id": 1,
"type": "remove",
"btn": "dark",
"description": "Remove direct link whazzup file (not used) page Platform fixing via API IVAO"
},
{
"id": 2,
"type": "Change",
"btn": "warning",
"description": "Change Version VID search"
}

]
}

}
10 changes: 5 additions & 5 deletions resources/views/myoline/atc.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@
@foreach ($fly["fly"]["arrivals"]["data"] as $PilotData)

<tr>
<td class="text-white" scope="row">{{ $PilotData["callsign"] }}</td>
<td class="text-white">{{ $PilotData["lastTrack"]["state"] }}</td>
<td class="text-white">{{ $PilotData["flightPlan"]["route"] }}</td>
<td class="text-white">{{ $PilotData["flightPlan"]["flightRules"] }}</td>
<td class="text-white">{{ $PilotData["flightPlan"]["arrivalId"] }}</td>
<td class="text-white" scope="row">{{ $PilotData["callsign"] ?? NULL }}</td>
<td class="text-white">{{ $PilotData["lastTrack"]["state"] ?? NULL }}</td>
<td class="text-white">{{ $PilotData["flightPlan"]["route"] ?? NULL }}</td>
<td class="text-white">{{ $PilotData["flightPlan"]["flightRules"] ?? NULL }}</td>
<td class="text-white">{{ $PilotData["flightPlan"]["arrivalId"] ?? NULL }}</td>
</tr>

@endforeach
Expand Down
2 changes: 1 addition & 1 deletion resources/views/nav-wellcome.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@

</ul>
</div>
<button class="btn btn-success my-2 my-lg-0 rounded">AIRAC 2309</button>
<button class="btn btn-success my-2 my-lg-0 rounded">AIRAC 2310</button>
</div>
</nav>
Loading
Loading