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

Commit

Permalink
Scope ivao (#69)
Browse files Browse the repository at this point in the history
* Feedback connect Github and discord

* Correction Metar

* f

* correctif
  • Loading branch information
alexcaussades authored Sep 9, 2023
1 parent fde8b4c commit a32697b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 5 deletions.
15 changes: 11 additions & 4 deletions app/Http/Controllers/metarController.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,13 @@ public function visibility($metar)
{
$regex_visibility_vertical = "/[0-9]{4}|CAVOK/";
preg_match_all($regex_visibility_vertical, $metar, $matches);
return $matches[0][2];
/** Condition sur le nombre de chiffre de retour de la regex */
if (count($matches[0]) > 3) {
$visibility = $matches[0][2];
} else {
$visibility = $matches[0][3];
}
return $visibility;
}

public function winds($metar)
Expand Down Expand Up @@ -207,11 +213,12 @@ public function clouds($metar)
$regexclouds = "/(BKN|FEW|SCT|OVC)([0-9]{3})(CB|TCU)?/";
preg_match_all($regexclouds, $metar, $clouds);
// tout remetre dans une ligne avec une virgule

if ($clouds[0] != Null) {
if (count($clouds[0]) > 1) {
$clouds = implode(", ", $clouds[0]);
} else {
$clouds = $clouds[0];
$clouds = $clouds[0][0];
}
} else {
$clouds = "No";
Expand Down Expand Up @@ -259,7 +266,7 @@ public function metar($icao)
$temp = $this->temp_qnh($metar->metar);
$winds = $this->winds($metar->metar);
$visibility = $this->visibility($metar->metar);
$clouds = $this->clouds($metar->metar);
$clouds = $this->clouds($metar->metar) ?? "None";
$station = $this->station($metar->metar);
$times = $this->time($metar->metar);

Expand Down Expand Up @@ -295,7 +302,7 @@ public function taf($icao)
$taf = $whazzup->Get_taf($icao);
$taf = json_decode($taf);
$taf = [
"taf" => $taf->taf,
"taf" => $taf->taf ?? "None",
];
return $taf;
}
Expand Down
25 changes: 25 additions & 0 deletions resources/views/errors/404.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@extends("metar-base")

@section("title", "Metar")

@include("navbar")

@section('content')


<div class="container">
<div class="card mt-5 border-info shadow p-3 mb-5 bg-body-tertiary rounded">
<div class="card-body">
<p class="card-text">
<div class="d-flex justify-content-center">
<div class="mx-auto p-5 p-5 align-content-end flex-wrap">
<h1 class="display-1 mt-8">404</h1>
<h2 class="display-4">Page not found</h2>
<p class="lead">The page you are looking for was not found.</p>
<a href="{{ Route('home') }}" class="btn btn-primary">Go back to home</a> <a href="{{ Route('feedback.index') }}" class="btn btn-dark ms-2">Feedback</a>
</div>
</div>
</p>
</div>
</div>
</div>
19 changes: 18 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -672,14 +672,31 @@

Route::get("test", function (Request $request) {

$online = new myOnlineServeurController("1", "440306");
$online = new myOnlineServeurController("1", "562637");
$online = $online->getVerrifOnlineServeur();
return $online;
})->name("test");

Route::get("test2", function (Request $request) {

$whazzup = new whazzupController();
$whazzup->API_request_session();
$u = $whazzup->track_session_id('53150078');
return $u->json();
})->name("test2");

Route::get("test3", function (Request $request) {
$request->merge([
"code" => $request->code
]);
$q = Http::asForm()->post("https://discord.com/api/oauth2/token", [
/** data for connect api request token */

"client_id" => env('discord_client_id'),
"client_secret" => env('discord_client_secret'),
"grant_type" => 'authorization_code', // "authorization_code"
"code" => $request->code
]);
$q = json_decode($q);
dd($q);
})->name("test3");

0 comments on commit a32697b

Please sign in to comment.